Version 2.17.0-172.0.dev
Merge commit 'd3e36fab5eb55706a36144fe41abc2546ffa0b55' into 'dev'
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 5423376..be632ea 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -973,7 +973,8 @@
</p>
<p>
If a package root is a file, then the analyzer
- will behave as though that file is a ".packages" file in the
+ will behave as though that file is a
+ ".dart_tool/package_config.json" file in the
source directory. The effect is the same as specifying the file
as a "--packages" parameter to the Dart VM when
executing any Dart file inside the source directory.
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index d5a90a6..dc2c12a 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -2583,9 +2583,9 @@
/// the normal package: URI resolution mechanism.
///
/// If a package root is a file, then the analyzer will behave as though that
- /// file is a ".packages" file in the source directory. The effect is the
- /// same as specifying the file as a "--packages" parameter to the Dart VM
- /// when executing any Dart file inside the source directory.
+ /// file is a ".dart_tool/package_config.json" file in the source directory.
+ /// The effect is the same as specifying the file as a "--packages" parameter
+ /// to the Dart VM when executing any Dart file inside the source directory.
///
/// Files in any directories that are not overridden by this mapping have
/// their package: URI's resolved using the normal pubspec.yaml mechanism. If
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index fddcbfa..bf671b2 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -500,9 +500,10 @@
/// the normal package: URI resolution mechanism.
///
/// If a package root is a file, then the analyzer will behave as though
- /// that file is a ".packages" file in the source directory. The effect is
- /// the same as specifying the file as a "--packages" parameter to the Dart
- /// VM when executing any Dart file inside the source directory.
+ /// that file is a ".dart_tool/package_config.json" file in the source
+ /// directory. The effect is the same as specifying the file as a
+ /// "--packages" parameter to the Dart VM when executing any Dart file
+ /// inside the source directory.
///
/// Files in any directories that are not overridden by this mapping have
/// their package: URI's resolved using the normal pubspec.yaml mechanism.
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index 59da953..d2dda69 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -216,12 +216,12 @@
* not be analyzed.
* @param packageRoots A mapping from source directories to package roots that should override the
* normal package: URI resolution mechanism. If a package root is a file, then the analyzer
- * will behave as though that file is a ".packages" file in the source directory. The
- * effect is the same as specifying the file as a "--packages" parameter to the Dart VM
- * when executing any Dart file inside the source directory. Files in any directories that
- * are not overridden by this mapping have their package: URI's resolved using the normal
- * pubspec.yaml mechanism. If this field is absent, or the empty map is specified, that
- * indicates that the normal pubspec.yaml mechanism should always be used.
+ * will behave as though that file is a ".dart_tool/package_config.json" file in the source
+ * directory. The effect is the same as specifying the file as a "--packages" parameter to
+ * the Dart VM when executing any Dart file inside the source directory. Files in any
+ * directories that are not overridden by this mapping have their package: URI's resolved
+ * using the normal pubspec.yaml mechanism. If this field is absent, or the empty map is
+ * specified, that indicates that the normal pubspec.yaml mechanism should always be used.
*/
public void analysis_setAnalysisRoots(List<String> included, List<String> excluded, Map<String, String> packageRoots);
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 1d7b96a..5c07676 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -870,7 +870,8 @@
</p>
<p>
If a package root is a file, then the analyzer
- will behave as though that file is a ".packages" file in the
+ will behave as though that file is a
+ ".dart_tool/package_config.json" file in the
source directory. The effect is the same as specifying the file
as a "--packages" parameter to the Dart VM when
executing any Dart file inside the source directory.
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 484915e..58d9f35 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -2583,9 +2583,9 @@
/// the normal package: URI resolution mechanism.
///
/// If a package root is a file, then the analyzer will behave as though that
- /// file is a ".packages" file in the source directory. The effect is the
- /// same as specifying the file as a "--packages" parameter to the Dart VM
- /// when executing any Dart file inside the source directory.
+ /// file is a ".dart_tool/package_config.json" file in the source directory.
+ /// The effect is the same as specifying the file as a "--packages" parameter
+ /// to the Dart VM when executing any Dart file inside the source directory.
///
/// Files in any directories that are not overridden by this mapping have
/// their package: URI's resolved using the normal pubspec.yaml mechanism. If
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/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 506e0d0..b033bbe 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -7686,6 +7686,7 @@
..addNode('target', target)
..addToken('operator', operator)
..addNode('methodName', methodName)
+ ..addNode('typeArguments', typeArguments)
..addNode('argumentList', argumentList);
@override
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index b1c1f02..26542c5 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -12526,6 +12526,16 @@
token: f @28
staticElement: self::@function::f
staticType: T Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: < @29
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int @30
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: > @33
argumentList: ArgumentList
leftParenthesis: ( @34
arguments
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/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
index 66e0e85..f786f84 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
@@ -4113,6 +4113,42 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
+ Message Function(
+ DartType _type, String name, bool isNonNullableByDefault)>
+ templateOptionalSuperParameterWithoutInitializer = const Template<
+ Message Function(
+ DartType _type, String name, bool isNonNullableByDefault)>(
+ problemMessageTemplate:
+ r"""Type '#type' of the optional super-initializer parameter '#name' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.""",
+ withArguments: _withArgumentsOptionalSuperParameterWithoutInitializer);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<
+ Message Function(
+ DartType _type, String name, bool isNonNullableByDefault)>
+ codeOptionalSuperParameterWithoutInitializer = const Code<
+ Message Function(
+ DartType _type, String name, bool isNonNullableByDefault)>(
+ "OptionalSuperParameterWithoutInitializer",
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsOptionalSuperParameterWithoutInitializer(
+ DartType _type, String name, bool isNonNullableByDefault) {
+ TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
+ List<Object> typeParts = labeler.labelType(_type);
+ if (name.isEmpty) throw 'No name provided';
+ name = demangleMixinApplicationName(name);
+ String type = typeParts.join();
+ return new Message(codeOptionalSuperParameterWithoutInitializer,
+ problemMessage:
+ """Type '${type}' of the optional super-initializer parameter '${name}' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.""" +
+ labeler.originMessages,
+ arguments: {'type': _type, 'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
Message Function(String name, String name2, DartType _type,
DartType _type2, String name3, bool isNonNullableByDefault)>
templateOverrideTypeMismatchParameter = const Template<
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 5d7f537..9471504 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1965,8 +1965,10 @@
constructor.function.positionalParameters[0].name == "index" &&
constructor.function.positionalParameters[1].name == "name");
(positionalArguments ??= <Expression>[]).insertAll(0, [
- new VariableGet(constructor.function.positionalParameters[0]),
- new VariableGet(constructor.function.positionalParameters[1])
+ new VariableGetImpl(constructor.function.positionalParameters[0],
+ forNullGuardedAccess: false),
+ new VariableGetImpl(constructor.function.positionalParameters[1],
+ forNullGuardedAccess: false)
]);
}
if (positionalArguments != null || namedArguments != null) {
@@ -1997,7 +1999,14 @@
initializer = buildSuperInitializer(
true, superTarget, arguments, builder.charOffset);
}
- constructor.initializers.add(initializer);
+ if (libraryBuilder.enableSuperParametersInLibrary) {
+ InitializerInferenceResult inferenceResult =
+ typeInferrer.inferInitializer(this, initializer);
+ builder.addInitializer(initializer, this,
+ inferenceResult: inferenceResult);
+ } else {
+ constructor.initializers.add(initializer);
+ }
}
setParents(constructor.initializers, constructor);
libraryBuilder.loader.transformListPostInference(constructor.initializers,
diff --git a/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart b/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
index f456a4d..3b70084 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
@@ -5,6 +5,7 @@
import 'package:kernel/ast.dart';
import 'package:kernel/type_algebra.dart';
+import '../builder/library_builder.dart';
import '../source/source_library_builder.dart';
import '../source/source_member_builder.dart';
import 'kernel_helper.dart';
@@ -279,7 +280,8 @@
Procedure tearOff,
Member target,
List<DartType> typeArguments,
- FreshTypeParameters freshTypeParameters) {
+ FreshTypeParameters freshTypeParameters,
+ LibraryBuilder libraryBuilder) {
int fileOffset = tearOff.fileOffset;
List<TypeParameter> typeParameters;
@@ -318,7 +320,7 @@
_createTearOffBody(tearOff, target, arguments);
return new SynthesizedFunctionNode(
substitutionMap, target.function!, tearOff.function,
- identicalSignatures: false);
+ identicalSignatures: false, libraryBuilder: libraryBuilder);
}
/// Creates the synthesized [Procedure] node for a tear off lowering by the
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_helper.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_helper.dart
index 635fec7..bd652d3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_helper.dart
@@ -7,6 +7,10 @@
import 'package:kernel/ast.dart';
import 'package:kernel/clone.dart' show CloneVisitorNotMembers;
import 'package:kernel/type_algebra.dart' show Substitution;
+import 'package:kernel/type_environment.dart';
+
+import '../builder/library_builder.dart';
+import '../messages.dart';
/// Data for clone default values for synthesized function nodes once the
/// original default values have been computed.
@@ -35,20 +39,26 @@
/// named parameters.
final bool identicalSignatures;
- final List<int>? _positionalSuperParameters;
+ final List<int?>? _positionalSuperParameters;
final List<String>? _namedSuperParameters;
bool isOutlineNode;
+ final LibraryBuilder _libraryBuilder;
+
+ CloneVisitorNotMembers? _cloner;
+
SynthesizedFunctionNode(
this._typeSubstitution, this._original, this._synthesized,
{this.identicalSignatures: true,
- List<int>? positionalSuperParameters: null,
+ List<int?>? positionalSuperParameters: null,
List<String>? namedSuperParameters: null,
- this.isOutlineNode: false})
+ this.isOutlineNode: false,
+ required LibraryBuilder libraryBuilder})
: _positionalSuperParameters = positionalSuperParameters,
_namedSuperParameters = namedSuperParameters,
+ _libraryBuilder = libraryBuilder,
// Check that [positionalSuperParameters] and [namedSuperParameters] are
// provided or omitted together.
assert((positionalSuperParameters == null) ==
@@ -56,11 +66,18 @@
assert(positionalSuperParameters == null ||
() {
// Check that [positionalSuperParameters] is sorted if it's
- // provided.
- for (int i = 1; i < positionalSuperParameters.length; i++) {
- if (positionalSuperParameters[i] <
- positionalSuperParameters[i - 1]) {
- return false;
+ // provided. The `null` values are allowed in-between the sorted
+ // values.
+ for (int i = -1, j = 0;
+ j < positionalSuperParameters.length;
+ j++) {
+ int? currentValue = positionalSuperParameters[j];
+ if (currentValue != null) {
+ if (i == -1 || positionalSuperParameters[i]! < currentValue) {
+ i = j;
+ } else {
+ return false;
+ }
}
}
return true;
@@ -82,23 +99,11 @@
return superParameterIndex == namedSuperParameters.length;
}());
- void cloneDefaultValues() {
+ void cloneDefaultValues(TypeEnvironment typeEnvironment) {
// TODO(ahe): It is unclear if it is legal to use type variables in
// default values, but Fasta is currently allowing it, and the VM
// accepts it. If it isn't legal, the we can speed this up by using a
// single cloner without substitution.
- CloneVisitorNotMembers? cloner;
-
- void cloneInitializer(VariableDeclaration originalParameter,
- VariableDeclaration clonedParameter) {
- if (originalParameter.initializer != null) {
- cloner ??=
- new CloneVisitorNotMembers(typeSubstitution: _typeSubstitution);
- clonedParameter.initializer = cloner!
- .clone(originalParameter.initializer!)
- ..parent = clonedParameter;
- }
- }
// For mixin application constructors, the argument count is the same, but
// for redirecting tear off lowerings, the argument count of the tear off
@@ -109,14 +114,21 @@
assert(_positionalSuperParameters != null ||
_synthesized.positionalParameters.length ==
_original.positionalParameters.length);
- List<int>? positionalSuperParameters = _positionalSuperParameters;
+ List<int?>? positionalSuperParameters = _positionalSuperParameters;
for (int i = 0; i < _original.positionalParameters.length; i++) {
if (positionalSuperParameters == null) {
- cloneInitializer(_original.positionalParameters[i],
+ _cloneInitializer(_original.positionalParameters[i],
_synthesized.positionalParameters[i]);
} else if (i < positionalSuperParameters.length) {
- cloneInitializer(_original.positionalParameters[i],
- _synthesized.positionalParameters[positionalSuperParameters[i]]);
+ int? superParameterIndex = positionalSuperParameters[i];
+ if (superParameterIndex != null) {
+ VariableDeclaration originalParameter =
+ _original.positionalParameters[i];
+ VariableDeclaration synthesizedParameter =
+ _synthesized.positionalParameters[superParameterIndex];
+ _cloneDefaultValueForSuperParameters(
+ originalParameter, synthesizedParameter, typeEnvironment);
+ }
}
}
@@ -131,7 +143,7 @@
}
for (int i = 0; i < _synthesized.namedParameters.length; i++) {
if (namedSuperParameters == null) {
- cloneInitializer(
+ _cloneInitializer(
_original.namedParameters[i], _synthesized.namedParameters[i]);
} else if (superParameterNameIndex < namedSuperParameters.length &&
namedSuperParameters[superParameterNameIndex] ==
@@ -141,9 +153,12 @@
int? originalNamedParameterIndex =
originalNamedParameterIndices[superParameterName];
if (originalNamedParameterIndex != null) {
- cloneInitializer(
- _original.namedParameters[originalNamedParameterIndex],
- _synthesized.namedParameters[i]);
+ VariableDeclaration originalParameter =
+ _original.namedParameters[originalNamedParameterIndex];
+ VariableDeclaration synthesizedParameter =
+ _synthesized.namedParameters[i];
+ _cloneDefaultValueForSuperParameters(
+ originalParameter, synthesizedParameter, typeEnvironment);
} else {
// TODO(cstefantsova): Handle the erroneous case of missing names.
}
@@ -155,7 +170,7 @@
VariableDeclaration synthesizedParameter =
_synthesized.positionalParameters[i];
if (i < _original.positionalParameters.length) {
- cloneInitializer(
+ _cloneInitializer(
_original.positionalParameters[i], synthesizedParameter);
} else {
// Error case: use `null` as initializer.
@@ -175,7 +190,7 @@
VariableDeclaration? originalParameter =
originalParameters[synthesizedParameter.name!];
if (originalParameter != null) {
- cloneInitializer(originalParameter, synthesizedParameter);
+ _cloneInitializer(originalParameter, synthesizedParameter);
} else {
// Error case: use `null` as initializer.
synthesizedParameter.initializer = new NullLiteral()
@@ -186,6 +201,43 @@
}
}
+ void _cloneInitializer(VariableDeclaration originalParameter,
+ VariableDeclaration clonedParameter) {
+ if (originalParameter.initializer != null) {
+ CloneVisitorNotMembers cloner = _cloner ??=
+ new CloneVisitorNotMembers(typeSubstitution: _typeSubstitution);
+ clonedParameter.initializer = cloner.clone(originalParameter.initializer!)
+ ..parent = clonedParameter;
+ }
+ }
+
+ void _cloneDefaultValueForSuperParameters(
+ VariableDeclaration originalParameter,
+ VariableDeclaration synthesizedParameter,
+ TypeEnvironment typeEnvironment) {
+ Member member = _synthesized.parent as Member;
+ Expression? originalParameterInitializer = originalParameter.initializer;
+ DartType? originalParameterInitializerType = originalParameterInitializer
+ ?.getStaticType(new StaticTypeContext(member, typeEnvironment));
+ DartType synthesizedParameterType = synthesizedParameter.type;
+ if (originalParameterInitializerType != null &&
+ typeEnvironment.isSubtypeOf(originalParameterInitializerType,
+ synthesizedParameterType, SubtypeCheckMode.withNullabilities)) {
+ _cloneInitializer(originalParameter, synthesizedParameter);
+ } else {
+ if (synthesizedParameterType.isPotentiallyNonNullable) {
+ _libraryBuilder.addProblem(
+ templateOptionalSuperParameterWithoutInitializer.withArguments(
+ synthesizedParameter.type,
+ synthesizedParameter.name!,
+ _libraryBuilder.isNonNullableByDefault),
+ synthesizedParameter.fileOffset,
+ synthesizedParameter.name?.length ?? 1,
+ _libraryBuilder.fileUri);
+ }
+ }
+ }
+
@override
String toString() {
return "SynthesizedFunctionNode(original=${_original.parent}, "
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 342dd2c..730ab5747 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -1086,7 +1086,8 @@
superConstructor, new Arguments(positional, named: named));
SynthesizedFunctionNode synthesizedFunctionNode =
new SynthesizedFunctionNode(
- substitutionMap, superConstructor.function, function);
+ substitutionMap, superConstructor.function, function,
+ libraryBuilder: classBuilder.library);
if (!isConst) {
// For constant constructors default values are computed and cloned part
// of the outline expression and therefore passed to the
@@ -1144,7 +1145,7 @@
for (SynthesizedFunctionNode synthesizedFunctionNode
in synthesizedFunctionNodes) {
if (!forOutline || synthesizedFunctionNode.isOutlineNode) {
- synthesizedFunctionNode.cloneDefaultValues();
+ synthesizedFunctionNode.cloneDefaultValues(loader.typeEnvironment);
}
}
if (!forOutline) {
diff --git a/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart b/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart
index f41c3b9..06f77cb 100644
--- a/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart
@@ -213,6 +213,9 @@
(formal.isInitializingFormal || formal.isSuperInitializingFormal)) {
formal.variable!.type = const UnknownType();
needsInference = true;
+ } else if (!formal.hasDeclaredInitializer &&
+ formal.isSuperInitializingFormal) {
+ needsInference = true;
}
}
if (needsInference) {
@@ -228,7 +231,7 @@
}
/// Infers the types of any untyped initializing formals.
- void inferFormalTypes(ClassHierarchy classHierarchy) {
+ void inferFormalTypes(TypeEnvironment typeEnvironment) {
if (_hasFormalsInferred) return;
if (formals != null) {
for (FormalParameterBuilder formal in formals!) {
@@ -250,7 +253,7 @@
doFinishConstructor: false);
}
finalizeSuperInitializingFormals(
- classHierarchy, _superParameterDefaultValueCloners, initializers);
+ typeEnvironment, _superParameterDefaultValueCloners, initializers);
}
}
_hasFormalsInferred = true;
@@ -305,7 +308,7 @@
}
void finalizeSuperInitializingFormals(
- ClassHierarchy classHierarchy,
+ TypeEnvironment typeEnvironment,
List<SynthesizedFunctionNode> synthesizedFunctionNodes,
List<Initializer>? initializers) {
if (formals == null) return;
@@ -348,20 +351,20 @@
}
if (superTargetBuilder is DeclaredSourceConstructorBuilder) {
- superTargetBuilder.inferFormalTypes(classHierarchy);
+ superTargetBuilder.inferFormalTypes(typeEnvironment);
} else if (superTargetBuilder is SyntheticSourceConstructorBuilder) {
MemberBuilder? superTargetOriginBuilder = superTargetBuilder.actualOrigin;
if (superTargetOriginBuilder is DeclaredSourceConstructorBuilder) {
- superTargetOriginBuilder.inferFormalTypes(classHierarchy);
+ superTargetOriginBuilder.inferFormalTypes(typeEnvironment);
}
}
int superInitializingFormalIndex = -1;
- List<int>? positionalSuperParameters;
+ List<int?>? positionalSuperParameters;
List<String>? namedSuperParameters;
- Supertype? supertype = classHierarchy.getClassAsInstanceOf(
- classBuilder.cls, superTarget.enclosingClass);
+ Supertype? supertype = typeEnvironment.hierarchy
+ .getClassAsInstanceOf(classBuilder.cls, superTarget.enclosingClass);
assert(supertype != null);
Map<TypeParameter, DartType> substitution =
new Map<TypeParameter, DartType>.fromIterables(
@@ -381,8 +384,10 @@
superFormals[superInitializingFormalIndex];
formal.hasDeclaredInitializer = hasImmediatelyDeclaredInitializer ||
correspondingSuperFormal.hasDeclaredInitializer;
- if (!hasImmediatelyDeclaredInitializer) {
- (positionalSuperParameters ??= <int>[]).add(formalIndex);
+ if (!hasImmediatelyDeclaredInitializer && !formal.isRequired) {
+ (positionalSuperParameters ??= <int?>[]).add(formalIndex);
+ } else {
+ (positionalSuperParameters ??= <int?>[]).add(null);
}
} else {
// TODO(cstefantsova): Report an error.
@@ -398,7 +403,7 @@
if (correspondingSuperFormal != null) {
formal.hasDeclaredInitializer = hasImmediatelyDeclaredInitializer ||
correspondingSuperFormal.hasDeclaredInitializer;
- if (!hasImmediatelyDeclaredInitializer) {
+ if (!hasImmediatelyDeclaredInitializer && !formal.isNamedRequired) {
(namedSuperParameters ??= <String>[]).add(formal.name);
}
} else {
@@ -412,8 +417,6 @@
type = substitute(type, substitution);
}
formal.variable!.type = type ?? const DynamicType();
- } else {
- formal.variable!.type = const DynamicType();
}
}
}
@@ -423,7 +426,8 @@
substitution, superTarget.function, constructor.function,
positionalSuperParameters: positionalSuperParameters ?? const <int>[],
namedSuperParameters: namedSuperParameters ?? const <String>[],
- isOutlineNode: true));
+ isOutlineNode: true,
+ libraryBuilder: library));
}
}
@@ -485,6 +489,7 @@
superTargetBuilder
.addSuperParameterDefaultValueCloners(synthesizedFunctionNodes);
}
+
synthesizedFunctionNodes.addAll(_superParameterDefaultValueCloners);
_superParameterDefaultValueCloners.clear();
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart b/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart
index 0f94bdb..16072e5 100644
--- a/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart
@@ -463,7 +463,8 @@
_factoryTearOff!,
target!,
typeArguments ?? [],
- _tearOffTypeParameters!));
+ _tearOffTypeParameters!,
+ library));
}
if (isConst && isPatch) {
_finishPatch();
diff --git a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
index 7ff533d..b932aa9 100644
--- a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
@@ -279,7 +279,8 @@
new Map<TypeParameter, DartType>.fromIterables(
target.enclosingClass!.typeParameters, targetType.typeArguments),
target.function!,
- tearOff.function));
+ tearOff.function,
+ libraryBuilder: library));
});
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index d4ffcab..3459623 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -145,7 +145,7 @@
// Field types have all been inferred so we don't need to guard against
// cyclic dependency.
for (DeclaredSourceConstructorBuilder builder in toBeInferred.values) {
- builder.inferFormalTypes(classHierarchy);
+ builder.inferFormalTypes(typeSchemaEnvironment);
}
toBeInferred.clear();
for (TypeDependency typeDependency in typeDependencies.values) {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 935763f..9f5f948 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -412,7 +412,7 @@
} else if ((constructor = engine.toBeInferred[target]) != null) {
engine.toBeInferred.remove(target);
engine.beingInferred[target] = constructor!;
- constructor.inferFormalTypes(classHierarchy);
+ constructor.inferFormalTypes(typeSchemaEnvironment);
engine.beingInferred.remove(target);
}
}
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 5ff0e55..6563de2 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -709,6 +709,8 @@
OperatorParameterMismatch2/example: Fail
OperatorWithOptionalFormals/analyzerCode: Fail
OperatorWithOptionalFormals/example: Fail
+OptionalSuperParameterWithoutInitializer/analyzerCode: Fail
+OptionalSuperParameterWithoutInitializer/example: Fail
OverrideFewerNamedArguments/example: Fail
OverrideFewerPositionalArguments/example: Fail
OverrideMismatchNamedParameter/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 8f83875..d165d4c 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -5516,3 +5516,6 @@
NonAugmentationClassMemberConflictCause:
problemMessage: "This is the existing member."
severity: CONTEXT
+
+OptionalSuperParameterWithoutInitializer:
+ problemMessage: "Type '#type' of the optional super-initializer parameter '#name' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor."
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 0a0575a..5f1144f 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -81,6 +81,7 @@
boundarykey
bowtie
boz
+bp
bq
brand
brave
@@ -535,6 +536,7 @@
repro
reproduce
reproduction
+req
resuming
retaining
retainingpath
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart b/pkg/front_end/testcases/super_parameters/default_values.dart
index 515a046..f62c550 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart
@@ -106,4 +106,22 @@
S9([int x = 0]) : s = x - 1;
}
+class Ap {
+ Ap([num x = 3.14]);
+}
+
+class Bp extends Ap {
+ Bp([int super.x]); // Error.
+ Bp.req(int super.x); // Ok.
+}
+
+class An {
+ An({num x = 3.14});
+}
+
+class Bn extends An {
+ Bn({int super.x}); // Error.
+ Bn.req({required int super.x}); // Ok.
+}
+
main() {}
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.strong.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.strong.expect
index 29ffdbc..53f4848 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.strong.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.strong.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -135,6 +142,32 @@
: self::S9::s = x.{core::num::-}(1){(core::num) → core::int}, super core::Object::•()
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = #C3]) → self::Ap
+ : super core::Object::•()
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x = #C4]) → self::Bp
+ : super self::Ap::•(x)
+ ;
+ constructor req(core::int x) → self::Bp
+ : super self::Ap::•(x)
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = #C3}) → self::An
+ : super core::Object::•()
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+ constructor req({required core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+}
static method main() → dynamic {}
constants {
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.strong.transformed.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.strong.transformed.expect
index 29ffdbc..53f4848 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.strong.transformed.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -135,6 +142,32 @@
: self::S9::s = x.{core::num::-}(1){(core::num) → core::int}, super core::Object::•()
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = #C3]) → self::Ap
+ : super core::Object::•()
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x = #C4]) → self::Bp
+ : super self::Ap::•(x)
+ ;
+ constructor req(core::int x) → self::Bp
+ : super self::Ap::•(x)
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = #C3}) → self::An
+ : super core::Object::•()
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+ constructor req({required core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+}
static method main() → dynamic {}
constants {
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.textual_outline.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.textual_outline.expect
index 1cb3689..9f3486c 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.textual_outline.expect
@@ -81,4 +81,18 @@
int s;
S9([int x = 0]) : s = x - 1;
}
+class Ap {
+ Ap([num x = 3.14]);
+}
+class Bp extends Ap {
+ Bp([int super.x]);
+ Bp.req(int super.x);
+}
+class An {
+ An({num x = 3.14});
+}
+class Bn extends An {
+ Bn({int super.x});
+ Bn.req({required int super.x});
+}
main() {}
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.expect
index 29ffdbc..53f4848 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -135,6 +142,32 @@
: self::S9::s = x.{core::num::-}(1){(core::num) → core::int}, super core::Object::•()
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = #C3]) → self::Ap
+ : super core::Object::•()
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x = #C4]) → self::Bp
+ : super self::Ap::•(x)
+ ;
+ constructor req(core::int x) → self::Bp
+ : super self::Ap::•(x)
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = #C3}) → self::An
+ : super core::Object::•()
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+ constructor req({required core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+}
static method main() → dynamic {}
constants {
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.modular.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.modular.expect
index 29ffdbc..53f4848 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.modular.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -135,6 +142,32 @@
: self::S9::s = x.{core::num::-}(1){(core::num) → core::int}, super core::Object::•()
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = #C3]) → self::Ap
+ : super core::Object::•()
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x = #C4]) → self::Bp
+ : super self::Ap::•(x)
+ ;
+ constructor req(core::int x) → self::Bp
+ : super self::Ap::•(x)
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = #C3}) → self::An
+ : super core::Object::•()
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+ constructor req({required core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+}
static method main() → dynamic {}
constants {
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.outline.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.outline.expect
index aca3fd0..e843595 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.outline.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -114,5 +121,25 @@
constructor •([core::int x = 0]) → self::S9
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = 3.14]) → self::Ap
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x]) → self::Bp
+ ;
+ constructor req(core::int x) → self::Bp
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = 3.14}) → self::An
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x}) → self::Bn
+ ;
+ constructor req({required core::int x}) → self::Bn
+ ;
+}
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.transformed.expect b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.transformed.expect
index 29ffdbc..53f4848 100644
--- a/pkg/front_end/testcases/super_parameters/default_values.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/default_values.dart.weak.transformed.expect
@@ -2,11 +2,18 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
-// Try adding either an explicit non-'null' default value or the 'required' modifier.
+// pkg/front_end/testcases/super_parameters/default_values.dart:51:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
// C5([int super.x]); // Error.
// ^
//
+// pkg/front_end/testcases/super_parameters/default_values.dart:114:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bp([int super.x]); // Error.
+// ^
+//
+// pkg/front_end/testcases/super_parameters/default_values.dart:123:17: Error: Type 'int' of the optional super-initializer parameter 'x' doesn't allow 'null', but the parameter doesn't have a default value, and the default value can't be copied from the corresponding parameter of the super constructor.
+// Bn({int super.x}); // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -135,6 +142,32 @@
: self::S9::s = x.{core::num::-}(1){(core::num) → core::int}, super core::Object::•()
;
}
+class Ap extends core::Object {
+ constructor •([core::num x = #C3]) → self::Ap
+ : super core::Object::•()
+ ;
+}
+class Bp extends self::Ap {
+ constructor •([core::int x = #C4]) → self::Bp
+ : super self::Ap::•(x)
+ ;
+ constructor req(core::int x) → self::Bp
+ : super self::Ap::•(x)
+ ;
+}
+class An extends core::Object {
+ constructor •({core::num x = #C3}) → self::An
+ : super core::Object::•()
+ ;
+}
+class Bn extends self::An {
+ constructor •({core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+ constructor req({required core::int x = #C4}) → self::Bn
+ : super self::An::•(x: x)
+ ;
+}
static method main() → dynamic {}
constants {
diff --git a/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.expect b/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.expect
index d463400..0bcb96a 100644
--- a/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.expect
+++ b/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.expect
@@ -1,4 +1,15 @@
library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub1(double super.bar1<T1>(int a1),);
+// ^
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub2(double super.bar2<T2>(int a2),);
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -9,10 +20,14 @@
}
class B extends self::A {
constructor sub1(<T1 extends core::Object? = dynamic>(core::int) → core::double bar1) → self::B
- : super self::A::•(bar1)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub1(double super.bar1<T1>(int a1),);
+ ^" in bar1 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
constructor sub2(<T2 extends core::Object? = dynamic>(core::int) → core::double bar2) → self::B
- : super self::A::•(bar2)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub2(double super.bar2<T2>(int a2),);
+ ^" in bar2 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.transformed.expect b/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.transformed.expect
index d463400..0bcb96a 100644
--- a/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/issue47741.dart.strong.transformed.expect
@@ -1,4 +1,15 @@
library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub1(double super.bar1<T1>(int a1),);
+// ^
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub2(double super.bar2<T2>(int a2),);
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -9,10 +20,14 @@
}
class B extends self::A {
constructor sub1(<T1 extends core::Object? = dynamic>(core::int) → core::double bar1) → self::B
- : super self::A::•(bar1)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub1(double super.bar1<T1>(int a1),);
+ ^" in bar1 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
constructor sub2(<T2 extends core::Object? = dynamic>(core::int) → core::double bar2) → self::B
- : super self::A::•(bar2)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub2(double super.bar2<T2>(int a2),);
+ ^" in bar2 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.expect b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.expect
index d463400..0bcb96a 100644
--- a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.expect
+++ b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.expect
@@ -1,4 +1,15 @@
library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub1(double super.bar1<T1>(int a1),);
+// ^
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub2(double super.bar2<T2>(int a2),);
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -9,10 +20,14 @@
}
class B extends self::A {
constructor sub1(<T1 extends core::Object? = dynamic>(core::int) → core::double bar1) → self::B
- : super self::A::•(bar1)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub1(double super.bar1<T1>(int a1),);
+ ^" in bar1 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
constructor sub2(<T2 extends core::Object? = dynamic>(core::int) → core::double bar2) → self::B
- : super self::A::•(bar2)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub2(double super.bar2<T2>(int a2),);
+ ^" in bar2 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.modular.expect b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.modular.expect
index d463400..0bcb96a 100644
--- a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.modular.expect
@@ -1,4 +1,15 @@
library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub1(double super.bar1<T1>(int a1),);
+// ^
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub2(double super.bar2<T2>(int a2),);
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -9,10 +20,14 @@
}
class B extends self::A {
constructor sub1(<T1 extends core::Object? = dynamic>(core::int) → core::double bar1) → self::B
- : super self::A::•(bar1)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub1(double super.bar1<T1>(int a1),);
+ ^" in bar1 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
constructor sub2(<T2 extends core::Object? = dynamic>(core::int) → core::double bar2) → self::B
- : super self::A::•(bar2)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub2(double super.bar2<T2>(int a2),);
+ ^" in bar2 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.transformed.expect b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.transformed.expect
index d463400..0bcb96a 100644
--- a/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/issue47741.dart.weak.transformed.expect
@@ -1,4 +1,15 @@
library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub1(double super.bar1<T1>(int a1),);
+// ^
+//
+// pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+// B.sub2(double super.bar2<T2>(int a2),);
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -9,10 +20,14 @@
}
class B extends self::A {
constructor sub1(<T1 extends core::Object? = dynamic>(core::int) → core::double bar1) → self::B
- : super self::A::•(bar1)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:10:23: Error: The argument type 'double Function<T1>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub1(double super.bar1<T1>(int a1),);
+ ^" in bar1 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
constructor sub2(<T2 extends core::Object? = dynamic>(core::int) → core::double bar2) → self::B
- : super self::A::•(bar2)
+ : super self::A::•(invalid-expression "pkg/front_end/testcases/super_parameters/issue47741.dart:11:23: Error: The argument type 'double Function<T2>(int)' can't be assigned to the parameter type 'int Function<T>(int)'.
+ B.sub2(double super.bar2<T2>(int a2),);
+ ^" in bar2 as{TypeError,ForNonNullableByDefault} <T extends core::Object? = dynamic>(core::int) → core::int)
;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.expect
index 3bd8f09..43d6051 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.expect
@@ -11,7 +11,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = #C1, core::int x = #C3, dynamic s2 = #C2]) → self::C
+ constructor •(core::int c1, [core::int s1 = #C1, core::int x = #C3, core::int s2 = #C2]) → self::C
: self::C::c1 = c1, super self::S::•(s1, s2)
;
}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.transformed.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.transformed.expect
index 3bd8f09..43d6051 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.strong.transformed.expect
@@ -11,7 +11,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = #C1, core::int x = #C3, dynamic s2 = #C2]) → self::C
+ constructor •(core::int c1, [core::int s1 = #C1, core::int x = #C3, core::int s2 = #C2]) → self::C
: self::C::c1 = c1, super self::S::•(s1, s2)
;
}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.expect
index 3bd8f09..43d6051 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.expect
@@ -11,7 +11,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = #C1, core::int x = #C3, dynamic s2 = #C2]) → self::C
+ constructor •(core::int c1, [core::int s1 = #C1, core::int x = #C3, core::int s2 = #C2]) → self::C
: self::C::c1 = c1, super self::S::•(s1, s2)
;
}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.modular.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.modular.expect
index 3bd8f09..43d6051 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.modular.expect
@@ -11,7 +11,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = #C1, core::int x = #C3, dynamic s2 = #C2]) → self::C
+ constructor •(core::int c1, [core::int s1 = #C1, core::int x = #C3, core::int s2 = #C2]) → self::C
: self::C::c1 = c1, super self::S::•(s1, s2)
;
}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.outline.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.outline.expect
index aae570e..6cb35c7 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.outline.expect
@@ -10,7 +10,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = 1, core::int x = 0, dynamic s2 = 2]) → self::C
+ constructor •(core::int c1, [core::int s1 = 1, core::int x = 0, core::int s2 = 2]) → self::C
: self::C::c1 = c1
;
}
diff --git a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.transformed.expect b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.transformed.expect
index 3bd8f09..43d6051 100644
--- a/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/super_parameters/super_parameters_with_types_and_default_values.dart.weak.transformed.expect
@@ -11,7 +11,7 @@
}
class C extends self::S {
field core::int c1;
- constructor •(core::int c1, [dynamic s1 = #C1, core::int x = #C3, dynamic s2 = #C2]) → self::C
+ constructor •(core::int c1, [core::int s1 = #C1, core::int x = #C3, core::int s2 = #C2]) → self::C
: self::C::c1 = c1, super self::S::•(s1, s2)
;
}
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/VERSION b/tools/VERSION
index 46a6247..d182bf2 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 171
+PRERELEASE 172
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 3483305..0fd686d 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('feature enabled');
+ }
+ }
+ 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, 'feature enabled');
+ }
+
+ 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('feature enabled').foo);
+ }