Enable by default the experiment flags for the 2.17 language features
TEST=Existing language tests
Change-Id: I6c2ecd73a1c7add1451d72adff94df6fdcfca9fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234704
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index ee40393..ca06838 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -147,7 +147,7 @@
isExpired: IsExpired.enhanced_enums,
documentation: 'Enhanced Enums',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.17.0'),
);
static final extension_methods = ExperimentalFeature(
@@ -198,7 +198,7 @@
isExpired: IsExpired.named_arguments_anywhere,
documentation: 'Named Arguments Anywhere',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.17.0'),
);
static final non_nullable = ExperimentalFeature(
@@ -248,7 +248,7 @@
isExpired: IsExpired.super_parameters,
documentation: 'Super-Initializer Parameters',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.17.0'),
);
static final test_experiment = ExperimentalFeature(
@@ -309,7 +309,7 @@
static const bool control_flow_collections = true;
/// Default state of the experiment "enhanced-enums"
- static const bool enhanced_enums = false;
+ static const bool enhanced_enums = true;
/// Default state of the experiment "extension-methods"
static const bool extension_methods = true;
@@ -324,7 +324,7 @@
static const bool macros = false;
/// Default state of the experiment "named-arguments-anywhere"
- static const bool named_arguments_anywhere = false;
+ static const bool named_arguments_anywhere = true;
/// Default state of the experiment "non-nullable"
static const bool non_nullable = true;
@@ -339,7 +339,7 @@
static const bool spread_collections = true;
/// Default state of the experiment "super-parameters"
- static const bool super_parameters = false;
+ static const bool super_parameters = true;
/// Default state of the experiment "test-experiment"
static const bool test_experiment = false;
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 1a8f894..953dfa4 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
@@ -106,17 +106,17 @@
ExperimentalFlag.constantUpdate2018: true,
ExperimentalFlag.constructorTearoffs: true,
ExperimentalFlag.controlFlowCollections: true,
- ExperimentalFlag.enhancedEnums: false,
+ ExperimentalFlag.enhancedEnums: true,
ExperimentalFlag.extensionMethods: true,
ExperimentalFlag.extensionTypes: false,
ExperimentalFlag.genericMetadata: true,
ExperimentalFlag.macros: false,
- ExperimentalFlag.namedArgumentsAnywhere: false,
+ ExperimentalFlag.namedArgumentsAnywhere: true,
ExperimentalFlag.nonNullable: true,
ExperimentalFlag.nonfunctionTypeAliases: true,
ExperimentalFlag.setLiterals: true,
ExperimentalFlag.spreadCollections: true,
- ExperimentalFlag.superParameters: false,
+ ExperimentalFlag.superParameters: true,
ExperimentalFlag.testExperiment: false,
ExperimentalFlag.tripleShift: true,
ExperimentalFlag.valueClass: false,
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 5200b16..9f2744a 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -28,6 +28,9 @@
true,
true,
true,
+ true,
+ true,
+ true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
return kFeatureValues[static_cast<int>(feature)];
@@ -45,6 +48,9 @@
"spread-collections",
"triple-shift",
"constructor-tearoffs",
+ "enhanced-enums",
+ "named-arguments-anywhere",
+ "super-parameters",
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)];
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index d1a5abb..c11734d 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -24,6 +24,9 @@
spread_collections,
triple_shift,
constructor_tearoffs,
+ enhanced_enums,
+ named_arguments_anywhere,
+ super_parameters,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);
diff --git a/tests/language/compile_time_constant/p_test.dart b/tests/language/compile_time_constant/p_test.dart
index 133519f..23426eb 100644
--- a/tests/language/compile_time_constant/p_test.dart
+++ b/tests/language/compile_time_constant/p_test.dart
@@ -5,13 +5,11 @@
import "package:expect/expect.dart";
class A {
- const A(
- this.x
- // ^
- // [analyzer] COMPILE_TIME_ERROR.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
- // [cfe] 'x' is a final instance variable that was initialized at the declaration.
- // ^
- // [cfe] Cannot invoke a non-'const' constructor where a const expression is expected.
+ const A(this.x
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
+ // [cfe] 'x' is a final instance variable that was initialized at the declaration.
+ // [cfe] Cannot invoke a non-'const' constructor where a const expression is expected.
);
final x = null;
}
@@ -19,7 +17,7 @@
class B extends A {
const B();
// ^
- // [analyzer] COMPILE_TIME_ERROR.NO_DEFAULT_SUPER_CONSTRUCTOR
+ // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS
// [cfe] The superclass, 'A', has no unnamed constructor that takes no arguments.
}
diff --git a/tests/language/const/constructor_super_test.dart b/tests/language/const/constructor_super_test.dart
index f710d15..a5be635 100644
--- a/tests/language/const/constructor_super_test.dart
+++ b/tests/language/const/constructor_super_test.dart
@@ -17,8 +17,10 @@
super(x);
// Const constructor cannot call non-const super constructor.
- const B.zerofive() : b = 0, super(5);
- // ^^^^^^^^
+ const B.zerofive()
+ : b = 0,
+ super(5);
+ // ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
// [cfe] A constant constructor can't call a non-constant super constructor.
}
@@ -29,9 +31,9 @@
const C.named(x);
// ^
// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
- // [cfe] The superclass, 'A', has no unnamed constructor that takes no arguments.
// ^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.NO_DEFAULT_SUPER_CONSTRUCTOR
+ // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS
+ // [cfe] The superclass, 'A', has no unnamed constructor that takes no arguments.
}
main() {
diff --git a/tests/language/enum/enhanced_enums_basic_test.dart b/tests/language/enum/enhanced_enums_basic_test.dart
index fee42e2..2b29521 100644
--- a/tests/language/enum/enhanced_enums_basic_test.dart
+++ b/tests/language/enum/enhanced_enums_basic_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=enhanced-enums
-
// Test new enhanced enum syntax.
import 'package:expect/expect.dart';
diff --git a/tests/language/enum/enhanced_enums_error_test.dart b/tests/language/enum/enhanced_enums_error_test.dart
index e812324..b56e29c 100644
--- a/tests/language/enum/enhanced_enums_error_test.dart
+++ b/tests/language/enum/enhanced_enums_error_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=enhanced-enums
-
// Test errors required by new enhanced enum syntax.
// Enums must satisfy the same requirements as their induced class.
diff --git a/tests/language/enum/enhanced_enums_subtype_error_test.dart b/tests/language/enum/enhanced_enums_subtype_error_test.dart
index 11bfb20..ae0be18 100644
--- a/tests/language/enum/enhanced_enums_subtype_error_test.dart
+++ b/tests/language/enum/enhanced_enums_subtype_error_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=enhanced-enums
-
// Test errors required by new enhanced enum syntax.
// Classes which implement `Enum`, but are not `enum` declarations,
diff --git a/tests/language/named_arguments_anywhere/all_kinds_test.dart b/tests/language/named_arguments_anywhere/all_kinds_test.dart
index 38ea69e..004796e 100644
--- a/tests/language/named_arguments_anywhere/all_kinds_test.dart
+++ b/tests/language/named_arguments_anywhere/all_kinds_test.dart
@@ -5,8 +5,6 @@
// Check that placing a named argument anywhere in the argument list works for
// all kinds of invocations.
-// SharedOptions=--enable-experiment=named-arguments-anywhere
-
import "package:expect/expect.dart";
List<Object?> arguments = [];
@@ -17,8 +15,7 @@
}
void runAndCheckEvaluationOrder(
- List<Object?> expectedArguments,
- void Function() functionToRun) {
+ List<Object?> expectedArguments, void Function() functionToRun) {
arguments.clear();
functionToRun();
Expect.listEquals(expectedArguments, arguments);
@@ -32,15 +29,20 @@
Expect.equals(3.14, w);
}
- A.redir1() : this(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ A.redir1()
+ : this(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
- A.redir2() : this(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ A.redir2()
+ : this(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
- A.redir3() : this(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ A.redir3()
+ : this(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
- A.redir4() : this(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ A.redir4()
+ : this(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
- A.redir5() : this(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ A.redir5()
+ : this(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
A.redir6() : this(evaluate(1), w: evaluate(3.14), evaluate("2"));
@@ -92,311 +94,341 @@
// StaticInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- foo(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ foo(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- foo(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ foo(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- foo(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ foo(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// FactoryConstructorInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- A.foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ A.foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- A.foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ A.foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- A.foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ A.foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- B.foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ B.foo(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- B.foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ B.foo(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- B.foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ B.foo(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- B.foo(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ B.foo(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- B.foo(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ B.foo(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- B.foo(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ B.foo(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// ConstructorInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- A(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ A(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- A(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ A(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- A(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ A(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- B(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ B(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- B(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ B(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- B(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ B(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- B(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ B(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- B(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ B(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- B(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ B(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// DynamicInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- d(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ d(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- d(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ d(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- d(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ d(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- d(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ d(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- d(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ d(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- d(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ d(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// FunctionInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- f(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ f(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- f(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ f(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- f(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ f(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- f(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ f(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- f(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ f(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- f(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ f(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// InstanceGetterInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- a.property(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ a.property(evaluate(1), evaluate("2"),
+ z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- a.property(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ a.property(evaluate(1),
+ z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- a.property(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ a.property(
+ z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- a.property(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ a.property(
+ w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- a.property(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ a.property(evaluate(1),
+ w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- a.property(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ a.property(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// InstanceInvocation.
runAndCheckEvaluationOrder([a, 1, "2", false, 3.14], () {
- evaluate(a).bar(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ evaluate(a)
+ .bar(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([a, 1, false, "2", 3.14], () {
- evaluate(a).bar(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ evaluate(a)
+ .bar(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([a, false, 1, "2", 3.14], () {
- evaluate(a).bar(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ evaluate(a)
+ .bar(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([a, 3.14, 1, "2", false], () {
- evaluate(a).bar(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ evaluate(a)
+ .bar(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([a, 1, 3.14, "2", false], () {
- evaluate(a).bar(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ evaluate(a)
+ .bar(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([a, 1, 3.14, "2"], () {
- evaluate(a).bar(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ evaluate(a).bar(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// LocalFunctionInvocation.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- local(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ local(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- local(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ local(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- local(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ local(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- local(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ local(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- local(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ local(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- local(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ local(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// Redirecting generative constructors.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- A.redir1();
+ A.redir1();
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- A.redir2();
+ A.redir2();
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- A.redir3();
+ A.redir3();
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- A.redir4();
+ A.redir4();
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- A.redir5();
+ A.redir5();
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- A.redir6();
+ A.redir6();
});
// Redirecting factory constructors.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- A.redirFactory(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ A.redirFactory(evaluate(1), evaluate("2"),
+ z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- A.redirFactory(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ A.redirFactory(evaluate(1),
+ z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- A.redirFactory(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ A.redirFactory(
+ z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- A.redirFactory(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ A.redirFactory(
+ w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- A.redirFactory(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ A.redirFactory(evaluate(1),
+ w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- A.redirFactory(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ A.redirFactory(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// Constructor super initializers.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- Test.super1();
+ Test.super1();
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- Test.super2();
+ Test.super2();
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- Test.super3();
+ Test.super3();
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- Test.super4();
+ Test.super4();
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- Test.super5();
+ Test.super5();
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- Test.super6();
+ Test.super6();
});
// Implicit .call insertion.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- a(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ a(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- a(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ a(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- a(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ a(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- a(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ a(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- a(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ a(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- a(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ a(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
}
class Test extends A {
Test() : super(1, "2", z: false, w: 3.14);
- Test.super1() : super(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
- Test.super2() : super(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
- Test.super3() : super(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
- Test.super4() : super(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
- Test.super5() : super(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ Test.super1()
+ : super(evaluate(1), evaluate("2"),
+ z: evaluate(false), w: evaluate(3.14));
+ Test.super2()
+ : super(evaluate(1),
+ z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ Test.super3()
+ : super(
+ z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ Test.super4()
+ : super(
+ w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ Test.super5()
+ : super(evaluate(1),
+ w: evaluate(3.14), evaluate("2"), z: evaluate(false));
Test.super6() : super(evaluate(1), w: evaluate(3.14), evaluate("2"));
test() {
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- super.bar(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ super.bar(evaluate(1), evaluate("2"),
+ z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- super.bar(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ super.bar(evaluate(1),
+ z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- super.bar(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ super.bar(
+ z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- super.bar(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ super.bar(
+ w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- super.bar(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ super.bar(evaluate(1),
+ w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- super.bar(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ super.bar(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
// Using super.call() implicitly.
runAndCheckEvaluationOrder([1, "2", false, 3.14], () {
- super(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
+ super(evaluate(1), evaluate("2"), z: evaluate(false), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([1, false, "2", 3.14], () {
- super(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
+ super(evaluate(1), z: evaluate(false), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([false, 1, "2", 3.14], () {
- super(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
+ super(z: evaluate(false), evaluate(1), evaluate("2"), w: evaluate(3.14));
});
runAndCheckEvaluationOrder([3.14, 1, "2", false], () {
- super(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
+ super(w: evaluate(3.14), evaluate(1), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2", false], () {
- super(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
+ super(evaluate(1), w: evaluate(3.14), evaluate("2"), z: evaluate(false));
});
runAndCheckEvaluationOrder([1, 3.14, "2"], () {
- super(evaluate(1), w: evaluate(3.14), evaluate("2"));
+ super(evaluate(1), w: evaluate(3.14), evaluate("2"));
});
}
}
@@ -404,9 +436,10 @@
extension E on A {
test() {
runAndCheckEvaluationOrder(["1", 2], () {
- method(foo: evaluate("1"), evaluate(2)); // This call.
+ method(foo: evaluate("1"), evaluate(2)); // This call.
});
}
+
method(int bar, {String? foo}) {
Expect.equals(2, bar);
Expect.equals("1", foo);
diff --git a/tests/language/named_arguments_anywhere/order_side_effects_error_test.dart b/tests/language/named_arguments_anywhere/order_side_effects_error_test.dart
index 52adfbc..e8a4745 100644
--- a/tests/language/named_arguments_anywhere/order_side_effects_error_test.dart
+++ b/tests/language/named_arguments_anywhere/order_side_effects_error_test.dart
@@ -5,8 +5,6 @@
// Checks that compile-time errors in the arguments are reported when the named
// arguments are placed before the positional.
-// SharedOptions=--enable-experiment=named-arguments-anywhere
-
const a42 = const A(42);
class A {
diff --git a/tests/language/named_arguments_anywhere/order_side_effects_ok_test.dart b/tests/language/named_arguments_anywhere/order_side_effects_ok_test.dart
index 9dd9e93..cc87abc 100644
--- a/tests/language/named_arguments_anywhere/order_side_effects_ok_test.dart
+++ b/tests/language/named_arguments_anywhere/order_side_effects_ok_test.dart
@@ -5,8 +5,6 @@
// Checks that typeinference on arguments continues working after their order is
// changed.
-// SharedOptions=--enable-experiment=named-arguments-anywhere
-
import "package:expect/expect.dart";
Type? argument = null;
@@ -15,7 +13,8 @@
argument = X;
}
-void runAndCheckForTypeArgument(Type expectedArgument, void Function() functionToRun) {
+void runAndCheckForTypeArgument(
+ Type expectedArgument, void Function() functionToRun) {
argument = null;
functionToRun();
Expect.equals(expectedArgument, argument);
@@ -44,29 +43,29 @@
void main() {
runAndCheckForTypeArgument(dynamic, () {
- fooGeneric(const BGeneric(), y: const BGeneric());
+ fooGeneric(const BGeneric(), y: const BGeneric());
});
runAndCheckForTypeArgument(dynamic, () {
- fooGeneric(y: const BGeneric(), const BGeneric());
+ fooGeneric(y: const BGeneric(), const BGeneric());
});
runAndCheckForTypeArgument(int, () {
- fooGeneric(const BGeneric<int>(), y: const BGeneric<List<int>>());
+ fooGeneric(const BGeneric<int>(), y: const BGeneric<List<int>>());
});
runAndCheckForTypeArgument(String, () {
- fooGeneric(y: const BGeneric<List<String>>(), const BGeneric<String>());
+ fooGeneric(y: const BGeneric<List<String>>(), const BGeneric<String>());
});
runAndCheckForTypeArgument(double, () {
- fooFunction(42, y: bar);
+ fooFunction(42, y: bar);
});
runAndCheckForTypeArgument(double, () {
- fooFunction(y: bar, 42);
+ fooFunction(y: bar, 42);
});
runAndCheckForTypeArgument(String, () {
- fooFunctionGeneric(42, y: (String x) {});
+ fooFunctionGeneric(42, y: (String x) {});
});
runAndCheckForTypeArgument(num, () {
- fooFunctionGeneric(y: (num x) {}, 42);
+ fooFunctionGeneric(y: (num x) {}, 42);
});
}
diff --git a/tests/language/super/call3_test.dart b/tests/language/super/call3_test.dart
index 7c43edf..a3b810d 100644
--- a/tests/language/super/call3_test.dart
+++ b/tests/language/super/call3_test.dart
@@ -7,8 +7,7 @@
import "package:expect/expect.dart";
class A {
- A(
- this.x
+ A(this.x
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD
// ^
@@ -25,19 +24,17 @@
class B2 extends A {
B2();
//^^
-// [analyzer] COMPILE_TIME_ERROR.NO_DEFAULT_SUPER_CONSTRUCTOR
+// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS
// [cfe] The superclass, 'A', has no unnamed constructor that takes no arguments.
B2.named() : this.x = 499;
//^^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.NO_DEFAULT_SUPER_CONSTRUCTOR
+// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS
// [cfe] The superclass, 'A', has no unnamed constructor that takes no arguments.
var x;
}
class C {
- C
- .named
- ();
+ C.named();
final foo = 499;
}
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 3483305..7b6ff1b 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -122,15 +122,6 @@
const-functions:
help: "Allow more of the Dart language to be executed in const expressions."
- enhanced-enums:
- help: "Enhanced Enums"
-
- named-arguments-anywhere:
- help: "Named Arguments Anywhere"
-
- super-parameters:
- help: "Super-Initializer Parameters"
-
macros:
help: "Static meta-programming"
@@ -225,3 +216,45 @@
c();
}
expired: true
+
+ enhanced-enums:
+ help: "Enhanced Enums"
+ enabledIn: '2.17.0'
+ validation: |
+ enum T {
+ t();
+ void test() {
+ print("Success");
+ }
+ }
+ void main() {
+ T.t.test();
+ }
+
+ named-arguments-anywhere:
+ help: "Named Arguments Anywhere"
+ enabledIn: '2.17.0'
+ validation: |
+ void test(String msg, {bool enabled : false}) {
+ if (enabled) {
+ print(msg);
+ }
+ }
+ void main() {
+ test(enabled : true, "Success");
+ }
+
+ super-parameters:
+ help: "Super-Initializer Parameters"
+ enabledIn: '2.17.0'
+ validation: |
+ class B {
+ final String foo;
+ B(this.foo);
+ }
+ class C extends B {
+ C(super.foo);
+ }
+ void main(){
+ print(C("Success").foo);
+ }