Expire experiments released in earlier stable versions.

Remove messages referring to expired `non-nullable` experiment.
Remove occurrences of --enable-experiment with expired experiments.

TEST=Flags were expired. If existing tests still run, it's a success.

Change-Id: Id66d78eb0a3191ec5e31375faf0effd9ea7b768f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219789
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 0b96e08..5e5e650 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -3272,48 +3272,6 @@
 }
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeExperimentNotEnabledNoFlag =
-    messageExperimentNotEnabledNoFlag;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageExperimentNotEnabledNoFlag = const MessageCode(
-    "ExperimentNotEnabledNoFlag",
-    analyzerCodes: <String>["ParserErrorCode.EXPERIMENT_NOT_ENABLED"],
-    problemMessage:
-        r"""This requires the null safety language feature, which is experimental.""",
-    correctionMessage:
-        r"""You can enable the experiment using the '--enable-experiment=non-nullable' command line option.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(String string2)>
-    templateExperimentNotEnabledNoFlagInvalidLanguageVersion =
-    const Template<Message Function(String string2)>(
-        problemMessageTemplate:
-            r"""This requires the null safety language feature, which is experimental and requires language version of #string2 or higher.""",
-        correctionMessageTemplate:
-            r"""You can enable the experiment using the '--enable-experiment=non-nullable' command line option.""",
-        withArguments:
-            _withArgumentsExperimentNotEnabledNoFlagInvalidLanguageVersion);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string2)>
-    codeExperimentNotEnabledNoFlagInvalidLanguageVersion =
-    const Code<Message Function(String string2)>(
-        "ExperimentNotEnabledNoFlagInvalidLanguageVersion",
-        analyzerCodes: <String>["ParserErrorCode.EXPERIMENT_NOT_ENABLED"]);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsExperimentNotEnabledNoFlagInvalidLanguageVersion(
-    String string2) {
-  if (string2.isEmpty) throw 'No string provided';
-  return new Message(codeExperimentNotEnabledNoFlagInvalidLanguageVersion,
-      problemMessage:
-          """This requires the null safety language feature, which is experimental and requires language version of ${string2} or higher.""",
-      correctionMessage: """You can enable the experiment using the '--enable-experiment=non-nullable' command line option.""",
-      arguments: {'string2': string2});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeExplicitExtensionArgumentMismatch =
     messageExplicitExtensionArgumentMismatch;
 
diff --git a/pkg/compiler/test/sourcemaps/stacktrace_test.dart b/pkg/compiler/test/sourcemaps/stacktrace_test.dart
index 7468227..00ea52f 100644
--- a/pkg/compiler/test/sourcemaps/stacktrace_test.dart
+++ b/pkg/compiler/test/sourcemaps/stacktrace_test.dart
@@ -89,7 +89,6 @@
       '--libraries-spec=$sdkLibrariesSpecificationPath',
       '--packages=${Platform.packageConfig}',
       Flags.testMode,
-      '--enable-experiment=extension-methods',
       input,
     ]..addAll(options);
     print("Compiling dart2js ${arguments.join(' ')}");
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index 4102f5a..4f3c912 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -125,17 +125,17 @@
   ExperimentalFlag.constructorTearoffs: false,
   ExperimentalFlag.controlFlowCollections: true,
   ExperimentalFlag.enhancedEnums: false,
-  ExperimentalFlag.extensionMethods: false,
+  ExperimentalFlag.extensionMethods: true,
   ExperimentalFlag.extensionTypes: false,
-  ExperimentalFlag.genericMetadata: false,
+  ExperimentalFlag.genericMetadata: true,
   ExperimentalFlag.namedArgumentsAnywhere: false,
-  ExperimentalFlag.nonNullable: false,
-  ExperimentalFlag.nonfunctionTypeAliases: false,
+  ExperimentalFlag.nonNullable: true,
+  ExperimentalFlag.nonfunctionTypeAliases: true,
   ExperimentalFlag.setLiterals: true,
   ExperimentalFlag.spreadCollections: true,
   ExperimentalFlag.superParameters: false,
   ExperimentalFlag.testExperiment: false,
-  ExperimentalFlag.tripleShift: false,
+  ExperimentalFlag.tripleShift: true,
   ExperimentalFlag.valueClass: false,
   ExperimentalFlag.variance: false,
 };
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener_impl.dart b/pkg/front_end/lib/src/fasta/source/stack_listener_impl.dart
index fa89f68..3e8326c 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener_impl.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener_impl.dart
@@ -12,8 +12,6 @@
 
 import 'package:kernel/ast.dart';
 
-import '../../api_prototype/experimental_flags.dart';
-
 import '../fasta_codes.dart';
 
 import '../problems.dart' as problems
@@ -97,8 +95,7 @@
             token.charOffset,
             token.charCount);
       }
-    } else if (libraryBuilder.loader.target
-        .isExperimentEnabledByDefault(ExperimentalFlag.nonNullable)) {
+    } else {
       if (libraryBuilder.languageVersion.version <
           libraryBuilder.enableNonNullableVersionInLibrary) {
         addProblem(
@@ -110,25 +107,6 @@
         addProblem(templateExperimentDisabled.withArguments('non-nullable'),
             token.offset, noLength);
       }
-    } else if (!libraryBuilder.loader.target
-        .isExperimentEnabledGlobally(ExperimentalFlag.nonNullable)) {
-      if (libraryBuilder.languageVersion.version <
-          libraryBuilder.enableNonNullableVersionInLibrary) {
-        addProblem(
-            templateExperimentNotEnabledNoFlagInvalidLanguageVersion
-                .withArguments(
-                    libraryBuilder.enableNonNullableVersionInLibrary.toText()),
-            token.offset,
-            noLength);
-      } else {
-        addProblem(messageExperimentNotEnabledNoFlag, token.offset, noLength);
-      }
-    } else {
-      addProblem(
-          templateExperimentNotEnabled.withArguments('non-nullable',
-              libraryBuilder.enableNonNullableVersionInLibrary.toText()),
-          token.offset,
-          noLength);
     }
   }
 
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 0ef4650..5eac795 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -282,16 +282,6 @@
   correctionMessage: "Try updating your pubspec.yaml to set the minimum SDK constraint to #string2 or higher, and running 'pub get'."
   analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED
 
-ExperimentNotEnabledNoFlag:
-  problemMessage: "This requires the null safety language feature, which is experimental."
-  correctionMessage: "You can enable the experiment using the '--enable-experiment=non-nullable' command line option."
-  analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED
-
-ExperimentNotEnabledNoFlagInvalidLanguageVersion:
-  problemMessage: "This requires the null safety language feature, which is experimental and requires language version of #string2 or higher."
-  correctionMessage: "You can enable the experiment using the '--enable-experiment=non-nullable' command line option."
-  analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED
-
 ExperimentDisabled:
   problemMessage: "This requires the '#string' language feature to be enabled."
   correctionMessage: "The feature is on by default but is currently disabled, maybe because the '--enable-experiment=no-#string' command line option is passed."
diff --git a/pkg/front_end/testcases/extensions/extension_methods.dart b/pkg/front_end/testcases/extensions/extension_methods.dart
index 3b79049..958a313 100644
--- a/pkg/front_end/testcases/extensions/extension_methods.dart
+++ b/pkg/front_end/testcases/extensions/extension_methods.dart
@@ -1,8 +1,8 @@
 // Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
+
 // @dart=2.9
-// SharedOptions=--enable-experiment=extension-methods
 
 import 'package:expect/expect.dart';
 
diff --git a/pkg/front_end/testcases/extensions/use_this.dart b/pkg/front_end/testcases/extensions/use_this.dart
index 32ef9d9..8a23cb9 100644
--- a/pkg/front_end/testcases/extensions/use_this.dart
+++ b/pkg/front_end/testcases/extensions/use_this.dart
@@ -1,8 +1,8 @@
 // Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
+
 // @dart=2.9
-// SharedOptions=--enable-experiment=extension-methods
 
 class A1 {}
 
@@ -30,4 +30,4 @@
   }
 }
 
-main() {}
\ No newline at end of file
+main() {}
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 5ebf334..c907f0c 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -18,7 +18,16 @@
 
 bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
   constexpr bool kFeatureValues[] = {
-      true, true, true, true, true, true, true, true, true, true,
+    true,
+    true,
+    true,
+    true,
+    true,
+    true,
+    true,
+    true,
+    true,
+    true,
   };
   ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
   return kFeatureValues[static_cast<int>(feature)];
@@ -26,16 +35,16 @@
 
 const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
   constexpr const char* kFeatureNames[] = {
-      "nonfunction-type-aliases",
-      "non-nullable",
-      "extension-methods",
-      "constant-update-2018",
-      "control-flow-collections",
-      "generic-metadata",
-      "set-literals",
-      "spread-collections",
-      "triple-shift",
-      "constructor-tearoffs",
+    "nonfunction-type-aliases",
+    "non-nullable",
+    "extension-methods",
+    "constant-update-2018",
+    "control-flow-collections",
+    "generic-metadata",
+    "set-literals",
+    "spread-collections",
+    "triple-shift",
+    "constructor-tearoffs",
   };
   ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
   return kFeatureNames[static_cast<int>(feature)];
diff --git a/tests/language/nonfunction_type_aliases/basic_syntax_test.dart b/tests/language/nonfunction_type_aliases/basic_syntax_test.dart
index eb61a95..e83763c 100644
--- a/tests/language/nonfunction_type_aliases/basic_syntax_test.dart
+++ b/tests/language/nonfunction_type_aliases/basic_syntax_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// SharedOptions=--enable-experiment=non-nullable
-
 typedef T0 = void;
 typedef T1 = Function;
 typedef T2<X> = List<X>;
diff --git a/tests/language/nonfunction_type_aliases/nnbd_syntax_test.dart b/tests/language/nonfunction_type_aliases/nnbd_syntax_test.dart
index d14de11..4463ca9 100644
--- a/tests/language/nonfunction_type_aliases/nnbd_syntax_test.dart
+++ b/tests/language/nonfunction_type_aliases/nnbd_syntax_test.dart
@@ -2,15 +2,13 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// SharedOptions=--enable-experiment=non-nullable
-
 typedef T0 = Function?;
 typedef T1<X> = List<X?>?;
 typedef T2<X, Y> = Map<X?, Y?>?;
 typedef T3 = Never? Function(void)?;
 typedef T4<X> = X? Function(X?, {required X? name})?;
-typedef T5<X extends String, Y extends List<X?>> =
-    X? Function(Y?, [Map<Y, Y?>]);
+typedef T5<X extends String, Y extends List<X?>> = X? Function(Y?,
+    [Map<Y, Y?>]);
 
 void main() {
   // ignore:unused_local_variable
diff --git a/tests/language/vm/regress_flutter_42845_test.dart b/tests/language/vm/regress_flutter_42845_test.dart
index ac05e97..0b16f14 100644
--- a/tests/language/vm/regress_flutter_42845_test.dart
+++ b/tests/language/vm/regress_flutter_42845_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// SharedOptions=--enable-experiment=extension-methods
-
 // Tests exported extensions.
 
 import "regress_flutter_42845_lib.dart";
diff --git a/tests/lib/mirrors/method_mirror_extension_test.dart b/tests/lib/mirrors/method_mirror_extension_test.dart
index 2d68474..79e39bb 100644
--- a/tests/lib/mirrors/method_mirror_extension_test.dart
+++ b/tests/lib/mirrors/method_mirror_extension_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// SharedOptions=--enable-experiment=extension-methods
-
 library lib;
 
 import "dart:mirrors";
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 3c3b0a7..971d422 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -151,6 +151,7 @@
         S s = 'feature enabled';
         print(s);
       }
+    expired: true
 
   non-nullable:
     help: "Non Nullable by default"
@@ -161,10 +162,12 @@
         int? a = null;
         print('feature enabled');
       }
+    expired: true
 
   extension-methods:
     help: "Extension Methods"
     enabledIn: '2.6.0'
+    expired: true
 
   constant-update-2018:
     help: "Enhanced constant expressions"
@@ -181,6 +184,7 @@
       Allow annotations to accept type arguments;
       also allow generic function types as type arguments.
     enabledIn: '2.14.0'
+    expired: true
 
   set-literals:
     help: "Set Literals"
@@ -202,6 +206,7 @@
       void main() {
         if ((A() >>> 1) == 42) print('feature enabled');
       }
+    expired: true
 
   constructor-tearoffs:
     help: "Allow constructor tear-offs and explicit generic instantiations."