mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
Retire the 2.17 language feature experiment flags.
Remove them from tests. (They should have been removed from tests before launcing 2.17.) Change-Id: I546f6cb90fdf9e6ed1bb560f3715f9db163b7c68 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250384 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Devon Carew <devoncarew@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com>
This commit is contained in:
parent
f047c33d5a
commit
3fc0bf7e59
|
@ -13,7 +13,6 @@ import 'package:analysis_server/src/utilities/mocks.dart';
|
|||
import 'package:analyzer/dart/analysis/analysis_options.dart' as analysis;
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/instrumentation/service.dart';
|
||||
import 'package:analyzer/src/dart/analysis/experiments.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
|
||||
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
|
||||
|
@ -48,9 +47,11 @@ class AnalysisOptionsFileConfig {
|
|||
var buffer = StringBuffer();
|
||||
|
||||
buffer.writeln('analyzer:');
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
if (experiments.isNotEmpty) {
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
}
|
||||
}
|
||||
buffer.writeln(' language:');
|
||||
buffer.writeln(' strict-casts: $strictCasts');
|
||||
|
@ -206,11 +207,10 @@ class ContextResolutionTest with ResourceProviderMixin {
|
|||
}
|
||||
|
||||
class PubPackageAnalysisServerTest extends ContextResolutionTest {
|
||||
List<String> get experiments => [
|
||||
EnableString.enhanced_enums,
|
||||
EnableString.named_arguments_anywhere,
|
||||
EnableString.super_parameters,
|
||||
];
|
||||
// If experiments are needed,
|
||||
// add `import 'package:analyzer/src/dart/analysis/experiments.dart';`
|
||||
// and list the necessary experiments here.
|
||||
List<String> get experiments => [];
|
||||
|
||||
/// The path that is not in [workspaceRootPath], contains external packages.
|
||||
String get packagesRootPath => '/packages';
|
||||
|
|
|
@ -18,13 +18,13 @@ class RemoveSettingTest extends AnalysisOptionsFixTest {
|
|||
await assertHasFix('''
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
language:
|
||||
enableSuperMixins: true
|
||||
''', '''
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
''');
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,11 @@ analyzer:
|
|||
analyzer:
|
||||
enable-experiment:
|
||||
- not-an-experiment
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
''', '''
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
''');
|
||||
}
|
||||
|
||||
|
@ -45,12 +45,12 @@ analyzer:
|
|||
await assertHasFix('''
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
- not-an-experiment
|
||||
''', '''
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- super-parameters
|
||||
- test-experiment
|
||||
''');
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ class IsExpired {
|
|||
static const bool control_flow_collections = true;
|
||||
|
||||
/// Expiration status of the experiment "enhanced-enums"
|
||||
static const bool enhanced_enums = false;
|
||||
static const bool enhanced_enums = true;
|
||||
|
||||
/// Expiration status of the experiment "extension-methods"
|
||||
static const bool extension_methods = true;
|
||||
|
@ -427,7 +427,7 @@ class IsExpired {
|
|||
static const bool macros = false;
|
||||
|
||||
/// Expiration status of the experiment "named-arguments-anywhere"
|
||||
static const bool named_arguments_anywhere = false;
|
||||
static const bool named_arguments_anywhere = true;
|
||||
|
||||
/// Expiration status of the experiment "non-nullable"
|
||||
static const bool non_nullable = true;
|
||||
|
@ -442,7 +442,7 @@ class IsExpired {
|
|||
static const bool spread_collections = true;
|
||||
|
||||
/// Expiration status of the experiment "super-parameters"
|
||||
static const bool super_parameters = false;
|
||||
static const bool super_parameters = true;
|
||||
|
||||
/// Expiration status of the experiment "test-experiment"
|
||||
static const bool test_experiment = false;
|
||||
|
|
|
@ -421,17 +421,6 @@ void defineAnalyze() {
|
|||
expect(result.stderr, isEmpty);
|
||||
});
|
||||
|
||||
test('--enable-experiment', () async {
|
||||
p = project(mainSrc: 'final x = List.filled(growable: true, 7, "");');
|
||||
var result = await p
|
||||
.run(['analyze', '--enable-experiment=no-named-arguments-anywhere']);
|
||||
|
||||
expect(result.exitCode, 3);
|
||||
expect(result.stdout,
|
||||
contains('Positional arguments must occur before named arguments.'));
|
||||
expect(result.stderr, isEmpty);
|
||||
});
|
||||
|
||||
test('--enable-experiment with a bad experiment', () async {
|
||||
p = project();
|
||||
var result = await p.run(['analyze', '--enable-experiment=bad']);
|
||||
|
|
|
@ -11,7 +11,7 @@ void main() {
|
|||
expect(experimentalFeatures, isNotEmpty);
|
||||
expect(
|
||||
experimentalFeatures.map((experiment) => experiment.enableString),
|
||||
contains('super-parameters'),
|
||||
contains('test-experiment'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -92,8 +92,7 @@ void runSharedTests(SetupCompilerOptions setup, TestDriver driver) {
|
|||
''';
|
||||
|
||||
setUpAll(() async {
|
||||
await driver.initSource(setup, source,
|
||||
experiments: {'named-arguments-anywhere': true});
|
||||
await driver.initSource(setup, source, experiments: const {});
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
|
@ -162,8 +161,7 @@ void runSharedTests(SetupCompilerOptions setup, TestDriver driver) {
|
|||
''';
|
||||
|
||||
setUpAll(() async {
|
||||
await driver
|
||||
.initSource(setup, source, experiments: {'super-parameters': true});
|
||||
await driver.initSource(setup, source, experiments: const {});
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
|
@ -229,8 +227,7 @@ void runSharedTests(SetupCompilerOptions setup, TestDriver driver) {
|
|||
''';
|
||||
|
||||
setUpAll(() async {
|
||||
await driver
|
||||
.initSource(setup, source, experiments: {'enhanced-enums': true});
|
||||
await driver.initSource(setup, source, experiments: const {});
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
|
|
|
@ -94,7 +94,7 @@ class ExperimentalFlag {
|
|||
static const ExperimentalFlag enhancedEnums = const ExperimentalFlag(
|
||||
name: 'enhanced-enums',
|
||||
isEnabledByDefault: true,
|
||||
isExpired: false,
|
||||
isExpired: true,
|
||||
enabledVersion: const Version(2, 17),
|
||||
experimentEnabledVersion: const Version(2, 17),
|
||||
experimentReleasedVersion: const Version(2, 17));
|
||||
|
@ -150,7 +150,7 @@ class ExperimentalFlag {
|
|||
static const ExperimentalFlag namedArgumentsAnywhere = const ExperimentalFlag(
|
||||
name: 'named-arguments-anywhere',
|
||||
isEnabledByDefault: true,
|
||||
isExpired: false,
|
||||
isExpired: true,
|
||||
enabledVersion: const Version(2, 17),
|
||||
experimentEnabledVersion: const Version(2, 17),
|
||||
experimentReleasedVersion: const Version(2, 17));
|
||||
|
@ -190,7 +190,7 @@ class ExperimentalFlag {
|
|||
static const ExperimentalFlag superParameters = const ExperimentalFlag(
|
||||
name: 'super-parameters',
|
||||
isEnabledByDefault: true,
|
||||
isExpired: false,
|
||||
isExpired: true,
|
||||
enabledVersion: const Version(2, 17),
|
||||
experimentEnabledVersion: const Version(2, 17),
|
||||
experimentReleasedVersion: const Version(2, 17));
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--enable-experiment=enhanced-enums
|
|
@ -1 +0,0 @@
|
|||
--enable-experiment=enhanced-enums,named-arguments-anywhere
|
|
@ -1 +0,0 @@
|
|||
--enable-experiment=enhanced-enums,super-parameters
|
|
@ -1 +0,0 @@
|
|||
--enable-experiment=named-arguments-anywhere
|
|
@ -1 +0,0 @@
|
|||
--enable-experiment=super-parameters
|
|
@ -1,15 +1,13 @@
|
|||
// Copyright (c) 2022, 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.
|
||||
//
|
||||
// SharedOptions=--enable-experiment=enhanced-enums
|
||||
|
||||
// @dart=2.17
|
||||
|
||||
import 'common/service_test_common.dart';
|
||||
import 'common/test_helper.dart';
|
||||
|
||||
const int LINE_A = 23;
|
||||
const int LINE_A = 21;
|
||||
const int LINE_B = LINE_A + 11;
|
||||
const int LINE_C = LINE_B + 4;
|
||||
const int LINE_D = LINE_C + 4;
|
||||
|
@ -106,5 +104,4 @@ main([args = const <String>[]]) => runIsolateTests(
|
|||
testeeConcurrent: testMain,
|
||||
pause_on_start: true,
|
||||
pause_on_exit: true,
|
||||
experiments: ['enhanced-enums'],
|
||||
);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) 2022, 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.
|
||||
//
|
||||
// SharedOptions=--enable-experiment=enhanced-enums
|
||||
|
||||
// @dart=2.17
|
||||
|
||||
|
@ -193,7 +191,8 @@ final tests = <IsolateTest>[
|
|||
expect(e1, isA<InstanceRef>());
|
||||
final e1Id = e1.id!;
|
||||
|
||||
dynamic result = await service.evaluate(isolateId, e1Id, 'interfaceGetter1');
|
||||
dynamic result =
|
||||
await service.evaluate(isolateId, e1Id, 'interfaceGetter1');
|
||||
expect(result, isA<InstanceRef>());
|
||||
expect(result.valueAsString, '42');
|
||||
|
||||
|
@ -219,7 +218,8 @@ final tests = <IsolateTest>[
|
|||
},
|
||||
(VmService service, _) async {
|
||||
// Ensure we can evaluate static getters and methods.
|
||||
dynamic result = await service.evaluate(isolateId, enumEClsId, 'staticGetter');
|
||||
dynamic result =
|
||||
await service.evaluate(isolateId, enumEClsId, 'staticGetter');
|
||||
expect(result, isA<InstanceRef>());
|
||||
expect(result.valueAsString, '0');
|
||||
|
||||
|
@ -233,7 +233,8 @@ final tests = <IsolateTest>[
|
|||
expect(e1, isA<InstanceRef>());
|
||||
final e1Id = e1.id!;
|
||||
|
||||
dynamic result = await service.invoke(isolateId, e1Id, 'interfaceMethod1', []);
|
||||
dynamic result =
|
||||
await service.invoke(isolateId, e1Id, 'interfaceMethod1', []);
|
||||
expect(result, isA<InstanceRef>());
|
||||
expect(result.valueAsString, '42');
|
||||
|
||||
|
@ -251,7 +252,8 @@ final tests = <IsolateTest>[
|
|||
},
|
||||
(VmService service, _) async {
|
||||
// Ensure we can invoke static methods.
|
||||
dynamic result = await service.evaluate(isolateId, enumEClsId, 'staticMethod()');
|
||||
dynamic result =
|
||||
await service.evaluate(isolateId, enumEClsId, 'staticMethod()');
|
||||
expect(result, isA<InstanceRef>());
|
||||
expect(result.valueAsString, '42');
|
||||
},
|
||||
|
@ -278,7 +280,8 @@ final tests = <IsolateTest>[
|
|||
resumeIsolate,
|
||||
hasStoppedAtBreakpoint,
|
||||
(VmService service, _) async {
|
||||
dynamic result = await service.evaluateInFrame(isolateId, 0, 'T.toString()');
|
||||
dynamic result =
|
||||
await service.evaluateInFrame(isolateId, 0, 'T.toString()');
|
||||
expect(result.valueAsString, 'int');
|
||||
|
||||
result = await service.evaluateInFrame(isolateId, 0, 'value');
|
||||
|
@ -291,5 +294,4 @@ main([args = const <String>[]]) => runIsolateTests(
|
|||
tests,
|
||||
'enhanced_enum_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
experiments: ['enhanced-enums'],
|
||||
);
|
||||
|
|
|
@ -68,5 +68,4 @@ main([args = const <String>[]]) => runIsolateTests(
|
|||
tests,
|
||||
'eval_named_args_anywhere_test.dart',
|
||||
testeeConcurrent: testFunction,
|
||||
experiments: ['named-arguments-anywhere'],
|
||||
);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) 2022, 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.
|
||||
//
|
||||
// SharedOptions=--enable-experiment=super-parameters
|
||||
|
||||
// @dart=2.17
|
||||
|
||||
|
@ -55,11 +53,11 @@ late final String rootLibId;
|
|||
|
||||
createInstance(VmService service, String expr) async {
|
||||
return await service.evaluate(
|
||||
isolateId,
|
||||
rootLibId,
|
||||
expr,
|
||||
disableBreakpoints: true,
|
||||
);
|
||||
isolateId,
|
||||
rootLibId,
|
||||
expr,
|
||||
disableBreakpoints: true,
|
||||
);
|
||||
}
|
||||
|
||||
evaluateGetter(VmService service, String instanceId, String getter) async {
|
||||
|
@ -96,7 +94,8 @@ final tests = <IsolateTest>[
|
|||
expect(result.json['name'], 'String');
|
||||
},
|
||||
(VmService service, _) async {
|
||||
dynamic instance = await createInstance(service, 'C.constr2(1, "abc", n: 3.14)');
|
||||
dynamic instance =
|
||||
await createInstance(service, 'C.constr2(1, "abc", n: 3.14)');
|
||||
dynamic result = await evaluateGetter(service, instance.id, 'n');
|
||||
expect(result.valueAsString, '3.14');
|
||||
result = await evaluateGetter(service, instance.id, 't');
|
||||
|
@ -117,7 +116,8 @@ final tests = <IsolateTest>[
|
|||
expect(result.json['name'], 'dynamic');
|
||||
},
|
||||
(VmService service, _) async {
|
||||
dynamic instance = await createInstance(service, 'C.constr3(1, "abc", n: 42, t: 3.14)');
|
||||
dynamic instance =
|
||||
await createInstance(service, 'C.constr3(1, "abc", n: 42, t: 3.14)');
|
||||
dynamic result = await evaluateGetter(service, instance.id, 'n');
|
||||
expect(result.valueAsString, '42');
|
||||
result = await evaluateGetter(service, instance.id, 't');
|
||||
|
@ -127,7 +127,8 @@ final tests = <IsolateTest>[
|
|||
result = await service.evaluate(isolateId, instance.id, 'T');
|
||||
expect(result.json['name'], 'double');
|
||||
|
||||
instance = await createInstance(service, 'C.constr3(1, "abc", n: 3.14, t: 42)');
|
||||
instance =
|
||||
await createInstance(service, 'C.constr3(1, "abc", n: 3.14, t: 42)');
|
||||
result = await evaluateGetter(service, instance.id, 'n');
|
||||
expect(result.valueAsString, '3.14');
|
||||
result = await evaluateGetter(service, instance.id, 't');
|
||||
|
@ -177,5 +178,4 @@ main([args = const <String>[]]) => runIsolateTests(
|
|||
tests,
|
||||
'super_constructor_invocation_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
experiments: ['super-parameters'],
|
||||
);
|
||||
|
|
|
@ -233,6 +233,7 @@ features:
|
|||
void main() {
|
||||
T.t.test();
|
||||
}
|
||||
expired: true
|
||||
|
||||
named-arguments-anywhere:
|
||||
help: "Named Arguments Anywhere"
|
||||
|
@ -246,6 +247,7 @@ features:
|
|||
void main() {
|
||||
test(enabled : true, 'feature enabled');
|
||||
}
|
||||
expired: true
|
||||
|
||||
super-parameters:
|
||||
help: "Super-Initializer Parameters"
|
||||
|
@ -261,6 +263,7 @@ features:
|
|||
void main(){
|
||||
print(C('feature enabled').foo);
|
||||
}
|
||||
expired: true
|
||||
|
||||
inference-update-1:
|
||||
help: "Horizontal type inference for function expressions passed to generic invocations."
|
||||
|
|
Loading…
Reference in a new issue