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>
This commit is contained in:
Lasse R.H. Nielsen 2021-11-11 08:28:31 +00:00 committed by commit-bot@chromium.org
parent bbff4d9589
commit 2360783808
13 changed files with 36 additions and 105 deletions

View file

@ -3271,48 +3271,6 @@ Message _withArgumentsExperimentNotEnabled(String string, String string2) {
arguments: {'string': string, 'string2': string2}); arguments: {'string': string, 'string2': string2});
} }
// 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. // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeExplicitExtensionArgumentMismatch = const Code<Null> codeExplicitExtensionArgumentMismatch =
messageExplicitExtensionArgumentMismatch; messageExplicitExtensionArgumentMismatch;

View file

@ -89,7 +89,6 @@ Future runTest(Test test, String config,
'--libraries-spec=$sdkLibrariesSpecificationPath', '--libraries-spec=$sdkLibrariesSpecificationPath',
'--packages=${Platform.packageConfig}', '--packages=${Platform.packageConfig}',
Flags.testMode, Flags.testMode,
'--enable-experiment=extension-methods',
input, input,
]..addAll(options); ]..addAll(options);
print("Compiling dart2js ${arguments.join(' ')}"); print("Compiling dart2js ${arguments.join(' ')}");

View file

@ -125,17 +125,17 @@ const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
ExperimentalFlag.constructorTearoffs: false, ExperimentalFlag.constructorTearoffs: false,
ExperimentalFlag.controlFlowCollections: true, ExperimentalFlag.controlFlowCollections: true,
ExperimentalFlag.enhancedEnums: false, ExperimentalFlag.enhancedEnums: false,
ExperimentalFlag.extensionMethods: false, ExperimentalFlag.extensionMethods: true,
ExperimentalFlag.extensionTypes: false, ExperimentalFlag.extensionTypes: false,
ExperimentalFlag.genericMetadata: false, ExperimentalFlag.genericMetadata: true,
ExperimentalFlag.namedArgumentsAnywhere: false, ExperimentalFlag.namedArgumentsAnywhere: false,
ExperimentalFlag.nonNullable: false, ExperimentalFlag.nonNullable: true,
ExperimentalFlag.nonfunctionTypeAliases: false, ExperimentalFlag.nonfunctionTypeAliases: true,
ExperimentalFlag.setLiterals: true, ExperimentalFlag.setLiterals: true,
ExperimentalFlag.spreadCollections: true, ExperimentalFlag.spreadCollections: true,
ExperimentalFlag.superParameters: false, ExperimentalFlag.superParameters: false,
ExperimentalFlag.testExperiment: false, ExperimentalFlag.testExperiment: false,
ExperimentalFlag.tripleShift: false, ExperimentalFlag.tripleShift: true,
ExperimentalFlag.valueClass: false, ExperimentalFlag.valueClass: false,
ExperimentalFlag.variance: false, ExperimentalFlag.variance: false,
}; };

View file

@ -12,8 +12,6 @@ import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show Token;
import 'package:kernel/ast.dart'; import 'package:kernel/ast.dart';
import '../../api_prototype/experimental_flags.dart';
import '../fasta_codes.dart'; import '../fasta_codes.dart';
import '../problems.dart' as problems import '../problems.dart' as problems
@ -97,8 +95,7 @@ abstract class StackListenerImpl extends StackListener {
token.charOffset, token.charOffset,
token.charCount); token.charCount);
} }
} else if (libraryBuilder.loader.target } else {
.isExperimentEnabledByDefault(ExperimentalFlag.nonNullable)) {
if (libraryBuilder.languageVersion.version < if (libraryBuilder.languageVersion.version <
libraryBuilder.enableNonNullableVersionInLibrary) { libraryBuilder.enableNonNullableVersionInLibrary) {
addProblem( addProblem(
@ -110,25 +107,6 @@ abstract class StackListenerImpl extends StackListener {
addProblem(templateExperimentDisabled.withArguments('non-nullable'), addProblem(templateExperimentDisabled.withArguments('non-nullable'),
token.offset, noLength); 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);
} }
} }

View file

@ -282,16 +282,6 @@ ExperimentNotEnabled:
correctionMessage: "Try updating your pubspec.yaml to set the minimum SDK constraint to #string2 or higher, and running 'pub get'." 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 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: ExperimentDisabled:
problemMessage: "This requires the '#string' language feature to be enabled." 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." correctionMessage: "The feature is on by default but is currently disabled, maybe because the '--enable-experiment=no-#string' command line option is passed."

View file

@ -1,8 +1,8 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // 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 // 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. // BSD-style license that can be found in the LICENSE file.
// @dart=2.9 // @dart=2.9
// SharedOptions=--enable-experiment=extension-methods
import 'package:expect/expect.dart'; import 'package:expect/expect.dart';

View file

@ -1,8 +1,8 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // 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 // 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. // BSD-style license that can be found in the LICENSE file.
// @dart=2.9 // @dart=2.9
// SharedOptions=--enable-experiment=extension-methods
class A1 {} class A1 {}
@ -30,4 +30,4 @@ extension B2<T> on B1<T> {
} }
} }
main() {} main() {}

View file

@ -18,7 +18,16 @@ namespace dart {
bool GetExperimentalFeatureDefault(ExperimentalFeature feature) { bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
constexpr bool kFeatureValues[] = { 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)); ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
return kFeatureValues[static_cast<int>(feature)]; return kFeatureValues[static_cast<int>(feature)];
@ -26,16 +35,16 @@ bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
const char* GetExperimentalFeatureName(ExperimentalFeature feature) { const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = { constexpr const char* kFeatureNames[] = {
"nonfunction-type-aliases", "nonfunction-type-aliases",
"non-nullable", "non-nullable",
"extension-methods", "extension-methods",
"constant-update-2018", "constant-update-2018",
"control-flow-collections", "control-flow-collections",
"generic-metadata", "generic-metadata",
"set-literals", "set-literals",
"spread-collections", "spread-collections",
"triple-shift", "triple-shift",
"constructor-tearoffs", "constructor-tearoffs",
}; };
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames)); ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)]; return kFeatureNames[static_cast<int>(feature)];

View file

@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// SharedOptions=--enable-experiment=non-nullable
typedef T0 = void; typedef T0 = void;
typedef T1 = Function; typedef T1 = Function;
typedef T2<X> = List<X>; typedef T2<X> = List<X>;

View file

@ -2,15 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// SharedOptions=--enable-experiment=non-nullable
typedef T0 = Function?; typedef T0 = Function?;
typedef T1<X> = List<X?>?; typedef T1<X> = List<X?>?;
typedef T2<X, Y> = Map<X?, Y?>?; typedef T2<X, Y> = Map<X?, Y?>?;
typedef T3 = Never? Function(void)?; typedef T3 = Never? Function(void)?;
typedef T4<X> = X? Function(X?, {required X? name})?; typedef T4<X> = X? Function(X?, {required X? name})?;
typedef T5<X extends String, Y extends List<X?>> = typedef T5<X extends String, Y extends List<X?>> = X? Function(Y?,
X? Function(Y?, [Map<Y, Y?>]); [Map<Y, Y?>]);
void main() { void main() {
// ignore:unused_local_variable // ignore:unused_local_variable

View file

@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// SharedOptions=--enable-experiment=extension-methods
// Tests exported extensions. // Tests exported extensions.
import "regress_flutter_42845_lib.dart"; import "regress_flutter_42845_lib.dart";

View file

@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// SharedOptions=--enable-experiment=extension-methods
library lib; library lib;
import "dart:mirrors"; import "dart:mirrors";

View file

@ -151,6 +151,7 @@ features:
S s = 'feature enabled'; S s = 'feature enabled';
print(s); print(s);
} }
expired: true
non-nullable: non-nullable:
help: "Non Nullable by default" help: "Non Nullable by default"
@ -161,10 +162,12 @@ features:
int? a = null; int? a = null;
print('feature enabled'); print('feature enabled');
} }
expired: true
extension-methods: extension-methods:
help: "Extension Methods" help: "Extension Methods"
enabledIn: '2.6.0' enabledIn: '2.6.0'
expired: true
constant-update-2018: constant-update-2018:
help: "Enhanced constant expressions" help: "Enhanced constant expressions"
@ -181,6 +184,7 @@ features:
Allow annotations to accept type arguments; Allow annotations to accept type arguments;
also allow generic function types as type arguments. also allow generic function types as type arguments.
enabledIn: '2.14.0' enabledIn: '2.14.0'
expired: true
set-literals: set-literals:
help: "Set Literals" help: "Set Literals"
@ -202,6 +206,7 @@ features:
void main() { void main() {
if ((A() >>> 1) == 42) print('feature enabled'); if ((A() >>> 1) == 42) print('feature enabled');
} }
expired: true
constructor-tearoffs: constructor-tearoffs:
help: "Allow constructor tear-offs and explicit generic instantiations." help: "Allow constructor tear-offs and explicit generic instantiations."