Version 2.14.0-354.0.dev
Merge commit '6c4f9f0045ad7e00e364a91ee51989e29e928247' into 'dev'
diff --git a/build/dart/dart_action.gni b/build/dart/dart_action.gni
index c357aad..334a09a 100644
--- a/build/dart/dart_action.gni
+++ b/build/dart/dart_action.gni
@@ -51,6 +51,10 @@
testonly = invoker.testonly
}
+ if (defined(invoker.pool)) {
+ pool = invoker.pool
+ }
+
script = "$_dart_root/build/gn_run_binary.py"
if (defined(invoker.inputs)) {
@@ -109,6 +113,7 @@
"depfile",
"deps",
"outputs",
+ "pool",
"testonly",
"visibility",
])
@@ -256,6 +261,7 @@
"deps",
"inputs",
"outputs",
+ "pool",
"tool",
"testonly",
"visibility",
@@ -321,6 +327,7 @@
"inputs",
"outputs",
"packages",
+ "pool",
"script",
"testonly",
"tool",
@@ -380,6 +387,7 @@
"inputs",
"outputs",
"packages",
+ "pool",
"testonly",
"tool",
"visibility",
diff --git a/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
index d9894e4..14f3d3d 100644
--- a/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
@@ -12,8 +12,8 @@
class FixedTypeBuilder extends TypeBuilder {
final DartType type;
- final Uri fileUri;
- final int charOffset;
+ final Uri? fileUri;
+ final int? charOffset;
const FixedTypeBuilder(this.type, this.fileUri, this.charOffset);
diff --git a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
index b1bd488..cf242da 100644
--- a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
@@ -51,6 +51,8 @@
/// constructor.
class FormalParameterBuilder extends ModifierBuilderImpl
implements VariableBuilder {
+ static const String noNameSentinel = 'no name sentinel';
+
/// List of metadata builders for the metadata declared on this parameter.
final List<MetadataBuilder>? metadata;
@@ -130,7 +132,8 @@
if (!library.isNonNullableByDefault && builtType != null) {
builtType = legacyErasure(builtType);
}
- variable = new VariableDeclarationImpl(name, functionNestingLevel,
+ variable = new VariableDeclarationImpl(
+ name == noNameSentinel ? null : name, functionNestingLevel,
type: builtType,
isFinal: isFinal,
isConst: isConst,
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 ef545f2..264bbc2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1256,12 +1256,16 @@
} else {
Substitution substitution = Substitution.fromPairs(
initialTarget.function.typeParameters, arguments.types);
- arguments.types.clear();
- arguments.types.length = redirectionTarget!.typeArguments.length;
- for (int i = 0; i < arguments.types.length; i++) {
- arguments.types[i] =
+ for (int i = 0; i < redirectionTarget!.typeArguments.length; i++) {
+ DartType typeArgument =
substitution.substituteType(redirectionTarget.typeArguments[i]);
+ if (i < arguments.types.length) {
+ arguments.types[i] = typeArgument;
+ } else {
+ arguments.types.add(typeArgument);
+ }
}
+ arguments.types.length = redirectionTarget.typeArguments.length;
replacementNode = buildStaticInvocation(
resolvedTarget,
@@ -1686,7 +1690,10 @@
@override
void handleSend(Token beginToken, Token endToken) {
assert(checkState(beginToken, [
- ValueKinds.ArgumentsOrNull,
+ unionOfKinds([
+ ValueKinds.ArgumentsOrNull,
+ ValueKinds.ParserRecovery,
+ ]),
ValueKinds.TypeArgumentsOrNull,
unionOfKinds([
ValueKinds.Expression,
@@ -1697,12 +1704,12 @@
])
]));
debugEvent("Send");
- Arguments? arguments = pop() as Arguments?;
+ Object? arguments = pop();
List<UnresolvedType>? typeArguments = pop() as List<UnresolvedType>?;
Object receiver = pop()!;
// Delay adding [typeArguments] to [forest] for type aliases: They
// must be unaliased to the type arguments of the denoted type.
- bool isInForest = arguments != null &&
+ bool isInForest = arguments is Arguments &&
typeArguments != null &&
(receiver is! TypeUseGenerator ||
(receiver is TypeUseGenerator &&
@@ -1716,22 +1723,23 @@
(receiver is TypeUseGenerator &&
receiver.declaration is TypeAliasBuilder));
}
- if (receiver is Identifier) {
+ if (receiver is ParserRecovery || arguments is ParserRecovery) {
+ push(new ParserErrorGenerator(
+ this, beginToken, fasta.messageSyntheticToken));
+ } else if (receiver is Identifier) {
Name name = new Name(receiver.name, libraryBuilder.nameOrigin);
if (arguments == null) {
push(new IncompletePropertyAccessGenerator(this, beginToken, name));
} else {
push(new SendAccessGenerator(
- this, beginToken, name, typeArguments, arguments,
+ this, beginToken, name, typeArguments, arguments as Arguments,
isTypeArgumentsInForest: isInForest));
}
- } else if (receiver is ParserRecovery) {
- push(new ParserErrorGenerator(
- this, beginToken, fasta.messageSyntheticToken));
} else if (arguments == null) {
push(receiver);
} else {
- push(finishSend(receiver, typeArguments, arguments, beginToken.charOffset,
+ push(finishSend(receiver, typeArguments, arguments as Arguments,
+ beginToken.charOffset,
isTypeArgumentsInForest: isInForest));
}
assert(checkState(beginToken, [
@@ -2679,7 +2687,7 @@
if (!libraryBuilder.isNonNullableByDefault) {
reportNonNullableModifierError(lateToken);
}
- UnresolvedType type = pop() as UnresolvedType;
+ UnresolvedType? type = pop() as UnresolvedType?;
int modifiers = (lateToken != null ? lateMask : 0) |
Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme);
_enterLocalState(inLateLocalInitializer: lateToken != null);
@@ -4954,7 +4962,8 @@
@override
void endTypeArguments(int count, Token beginToken, Token endToken) {
debugEvent("TypeArguments");
- push(const FixedNullableList<UnresolvedType>().pop(stack, count) ??
+ push(const FixedNullableList<UnresolvedType>()
+ .popNonNullable(stack, count, dummyUnresolvedType) ??
NullValue.TypeArguments);
}
@@ -5001,10 +5010,28 @@
@override
void handleNamedArgument(Token colon) {
debugEvent("NamedArgument");
+ assert(checkState(colon, [
+ unionOfKinds([
+ ValueKinds.Expression,
+ ValueKinds.Generator,
+ ]),
+ unionOfKinds([
+ ValueKinds.Identifier,
+ ValueKinds.ParserRecovery,
+ ])
+ ]));
Expression value = popForValue();
- Identifier identifier = pop() as Identifier;
- push(new NamedExpression(identifier.name, value)
- ..fileOffset = identifier.charOffset);
+ Object? identifier = pop();
+ if (identifier is Identifier) {
+ push(new NamedExpression(identifier.name, value)
+ ..fileOffset = identifier.charOffset);
+ } else {
+ assert(
+ identifier is ParserRecovery,
+ "Unexpected argument name: "
+ "${identifier} (${identifier.runtimeType})");
+ push(identifier);
+ }
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 653af5c..211d929 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -943,7 +943,7 @@
: numberSemantics = backend.numberSemantics,
coreTypes = typeEnvironment.coreTypes,
canonicalizationCache = <Constant, Constant>{},
- nodeCache = <Node, Constant>{},
+ nodeCache = <Node, Constant?>{},
env = new EvaluationEnvironment() {
if (environmentDefines == null && !backend.supportsUnevaluatedConstants) {
throw new ArgumentError(
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index e08aaf2..e11111a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -2078,7 +2078,7 @@
DartType inferredKeyType,
DartType inferredValueType,
DartType spreadContext,
- List<DartType?> actualTypes,
+ List<DartType> actualTypes,
List<DartType> actualTypesForSet,
Map<TreeNode, DartType> inferredSpreadTypes,
Map<Expression, DartType> inferredConditionTypes,
@@ -2096,8 +2096,8 @@
DartType spreadType = spreadResult.inferredType;
inferredSpreadTypes[entry.expression] = spreadType;
int length = actualTypes.length;
- actualTypes.add(null);
- actualTypes.add(null);
+ actualTypes.add(noInferredType);
+ actualTypes.add(noInferredType);
storeSpreadMapEntryElementTypes(
spreadType, entry.isNullAware, actualTypes, length);
DartType? actualKeyType = actualTypes[length];
@@ -2108,7 +2108,7 @@
MapLiteralEntry replacement = entry;
if (typeChecksNeeded) {
- if (actualKeyType == null) {
+ if (actualKeyType == noInferredType) {
if (inferrer.coreTypes.isNull(spreadTypeBound) &&
!entry.isNullAware) {
replacement = new MapLiteralEntry(
@@ -2204,7 +2204,7 @@
1);
}
}
- if (!inferrer.isAssignable(inferredValueType, actualValueType!)) {
+ if (!inferrer.isAssignable(inferredValueType, actualValueType)) {
if (inferrer.isNonNullableByDefault) {
IsSubtypeOf subtypeCheckResult = inferrer.typeSchemaEnvironment
.performNullabilityAwareSubtypeCheck(
@@ -2273,7 +2273,7 @@
}
// Use 'dynamic' for error recovery.
- if (actualKeyType == null) {
+ if (actualKeyType == noInferredType) {
actualKeyType = actualTypes[length] = const DynamicType();
actualValueType = actualTypes[length + 1] = const DynamicType();
}
@@ -2287,7 +2287,7 @@
entry.entryType = new InterfaceType(
mapEntryClass!,
inferrer.library.nonNullable,
- <DartType>[actualKeyType, actualValueType!]);
+ <DartType>[actualKeyType, actualValueType]);
bool isMap = inferrer.typeSchemaEnvironment.isSubtypeOf(
spreadType,
@@ -2354,10 +2354,10 @@
typeChecksNeeded);
int length = actualTypes.length;
actualTypes[length - 2] = inferrer.typeSchemaEnvironment
- .getStandardUpperBound(actualKeyType!, actualTypes[length - 2]!,
+ .getStandardUpperBound(actualKeyType, actualTypes[length - 2],
inferrer.library.library);
actualTypes[length - 1] = inferrer.typeSchemaEnvironment
- .getStandardUpperBound(actualValueType!, actualTypes[length - 1]!,
+ .getStandardUpperBound(actualValueType, actualTypes[length - 1],
inferrer.library.library);
int lengthForSet = actualTypesForSet.length;
actualTypesForSet[lengthForSet - 1] = inferrer.typeSchemaEnvironment
@@ -2622,7 +2622,7 @@
inferredConditionTypes = new Map<Expression, DartType>.identity();
}
if (inferenceNeeded) {
- inferredTypes = [const UnknownType(), const UnknownType()];
+ inferredTypes = [noInferredType, noInferredType];
inferrer.typeSchemaEnvironment.inferGenericFunctionOrType(
mapType,
mapClass.typeParameters,
@@ -2701,7 +2701,7 @@
formalTypesForSet.add(setType.typeArguments[0]);
}
- List<DartType> inferredTypesForSet = <DartType>[const UnknownType()];
+ List<DartType> inferredTypesForSet = <DartType>[noInferredType];
inferrer.typeSchemaEnvironment.inferGenericFunctionOrType(
setType,
inferrer.coreTypes.setClass.typeParameters,
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 098e1aa..fb00d81 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -716,7 +716,9 @@
Constructor? referenceFrom) {
VariableDeclaration copyFormal(VariableDeclaration formal) {
VariableDeclaration copy = new VariableDeclaration(formal.name,
- isFinal: formal.isFinal, isConst: formal.isConst);
+ isFinal: formal.isFinal,
+ isConst: formal.isConst,
+ type: const UnknownType());
if (formal.type is! UnknownType) {
copy.type = substitute(formal.type, substitutionMap);
} else {
@@ -1424,7 +1426,7 @@
void updateType() {
// ignore: unnecessary_null_comparison
- assert(source.type != null, "No type computed for $source.");
+ assert(source.type is! UnknownType, "No type computed for $source.");
target.type = substitute(source.type, substitutionMap);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart b/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
index 265cee2..4f63d8b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
@@ -179,12 +179,11 @@
}
RedirectionTarget? getRedirectionTarget(Procedure member, EnsureLoaded helper) {
- List<DartType> typeArguments = <DartType>[]..length =
- member.function.typeParameters.length;
- for (int i = 0; i < typeArguments.length; i++) {
- typeArguments[i] = new TypeParameterType.withDefaultNullabilityForLibrary(
+ List<DartType> typeArguments = new List<DartType>.generate(
+ member.function.typeParameters.length, (int i) {
+ return new TypeParameterType.withDefaultNullabilityForLibrary(
member.function.typeParameters[i], member.enclosingLibrary);
- }
+ }, growable: true);
// We use the [tortoise and hare algorithm]
// (https://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare) to
@@ -201,15 +200,15 @@
Member nextTortoise = tortoiseBody!.target!;
helper.ensureLoaded(nextTortoise);
List<DartType>? nextTypeArguments = tortoiseBody.typeArguments;
- if (nextTypeArguments == null) {
- nextTypeArguments = <DartType>[];
- }
-
- Substitution sub = Substitution.fromPairs(
- tortoise.function!.typeParameters, typeArguments);
- typeArguments = <DartType>[]..length = nextTypeArguments.length;
- for (int i = 0; i < typeArguments.length; i++) {
- typeArguments[i] = sub.substituteType(nextTypeArguments[i]);
+ if (nextTypeArguments != null) {
+ Substitution sub = Substitution.fromPairs(
+ tortoise.function!.typeParameters, typeArguments);
+ typeArguments =
+ new List<DartType>.generate(nextTypeArguments.length, (int i) {
+ return sub.substituteType(nextTypeArguments[i]);
+ }, growable: true);
+ } else {
+ typeArguments = <DartType>[];
}
tortoise = nextTortoise;
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
index b5828a4..7f6631d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
@@ -11,6 +11,7 @@
import '../builder/class_builder.dart';
import '../builder/dynamic_type_declaration_builder.dart';
+import '../builder/fixed_type_builder.dart';
import '../builder/formal_parameter_builder.dart';
import '../builder/function_type_builder.dart';
import '../builder/future_or_type_declaration_builder.dart';
@@ -39,7 +40,10 @@
@override
TypeBuilder visitInvalidType(InvalidType node) {
- throw "Not implemented";
+ return new FixedTypeBuilder(
+ node,
+ /* fileUri = */ null,
+ /* charOffset = */ null);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/utils.dart b/pkg/front_end/lib/src/fasta/kernel/utils.dart
index b24667f..a077ad7 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -32,9 +32,12 @@
import '../builder/fixed_type_builder.dart';
import '../builder/formal_parameter_builder.dart';
+import '../builder/metadata_builder.dart';
import '../builder/type_builder.dart';
import '../builder/type_variable_builder.dart';
+import '../builder/unresolved_type.dart';
import '../combinator.dart';
+import '../configuration.dart';
import '../identifiers.dart';
import '../source/source_library_builder.dart';
import 'body_builder.dart';
@@ -159,6 +162,7 @@
final Token dummyToken = new SyntheticToken(TokenType.AT, -1);
final Identifier dummyIdentifier = new Identifier(dummyToken);
final Combinator dummyCombinator = new Combinator(false, {}, -1, dummyUri);
+final MetadataBuilder dummyMetadataBuilder = new MetadataBuilder(dummyToken);
final TypeBuilder dummyTypeBuilder =
new FixedTypeBuilder(dummyDartType, dummyUri, -1);
final FormalParameterBuilder dummyFormalParameterBuilder =
@@ -167,3 +171,6 @@
new TypeVariableBuilder(TypeVariableBuilder.noNameSentinel, null, -1, null);
final Label dummyLabel = new Label('', -1);
final FieldInfo dummyFieldInfo = new FieldInfo('', -1, null, dummyToken, -1);
+final Configuration dummyConfiguration = new Configuration(-1, '', '', '');
+final UnresolvedType dummyUnresolvedType =
+ new UnresolvedType(dummyTypeBuilder, -1, dummyUri);
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 37348d5..331d16b 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -339,7 +339,7 @@
debugEvent("TopLevelMethod");
Token bodyToken = pop() as Token;
Object? name = pop();
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
checkEmpty(beginToken.charOffset);
if (name is ParserRecovery) return;
@@ -509,7 +509,7 @@
debugEvent("Import");
Object? name = pop(NullValue.Prefix);
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
checkEmpty(importKeyword.charOffset);
if (name is ParserRecovery) return;
@@ -535,7 +535,7 @@
void endExport(Token exportKeyword, Token semicolon) {
debugEvent("Export");
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
Library libraryNode = libraryBuilder.library;
LibraryDependency dependency =
libraryNode.dependencies[importExportDirectiveIndex++];
@@ -546,7 +546,7 @@
void endPart(Token partKeyword, Token semicolon) {
debugEvent("Part");
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
Library libraryNode = libraryBuilder.library;
if (libraryNode.parts.length > partDirectiveIndex) {
// If partDirectiveIndex >= libraryNode.parts.length we are in a case of
@@ -588,7 +588,7 @@
debugEvent("ClassFactoryMethod");
Token bodyToken = pop() as Token;
Object? name = pop();
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
checkEmpty(beginToken.charOffset);
if (name is ParserRecovery || currentClassIsParserRecovery) return;
@@ -699,7 +699,7 @@
// in handleNoFormalParameters rather than the supplied token.
pop(); // bodyToken
Object? name = pop();
- Token metadata = pop() as Token;
+ Token? metadata = pop() as Token?;
checkEmpty(beginToken.charOffset);
if (name is ParserRecovery || currentClassIsParserRecovery) return;
FunctionBuilderImpl builder;
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index a4c8a0e..1cbd3d7 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -162,7 +162,8 @@
@override
void endMetadataStar(int count) {
debugEvent("MetadataStar");
- push(const FixedNullableList<MetadataBuilder>().pop(stack, count) ??
+ push(const FixedNullableList<MetadataBuilder>()
+ .popNonNullable(stack, count, dummyMetadataBuilder) ??
NullValue.Metadata);
}
@@ -259,7 +260,8 @@
@override
void endConditionalUris(int count) {
debugEvent("EndConditionalUris");
- push(const FixedNullableList<Configuration>().pop(stack, count) ??
+ push(const FixedNullableList<Configuration>()
+ .popNonNullable(stack, count, dummyConfiguration) ??
NullValue.ConditionalUris);
}
@@ -1369,7 +1371,8 @@
@override
void endTypeArguments(int count, Token beginToken, Token endToken) {
debugEvent("TypeArguments");
- push(const FixedNullableList<TypeBuilder>().pop(stack, count) ??
+ push(const FixedNullableList<TypeBuilder>()
+ .popNonNullable(stack, count, dummyTypeBuilder) ??
NullValue.TypeArguments);
}
@@ -1468,8 +1471,14 @@
if (name is ParserRecovery) {
push(name);
} else {
- push(libraryBuilder.addFormalParameter(metadata, modifiers, type,
- name as String, thisKeyword != null, charOffset, initializerStart));
+ push(libraryBuilder.addFormalParameter(
+ metadata,
+ modifiers,
+ type,
+ name == null ? FormalParameterBuilder.noNameSentinel : name as String,
+ thisKeyword != null,
+ charOffset,
+ initializerStart));
}
}
@@ -1557,8 +1566,8 @@
assert(formals.isNotEmpty);
if (formals.length == 2) {
// The name may be null for generalized function types.
- // ignore: unnecessary_null_comparison
- if (formals[0].name != null && formals[0].name == formals[1].name) {
+ if (formals[0].name != FormalParameterBuilder.noNameSentinel &&
+ formals[0].name == formals[1].name) {
addProblem(
templateDuplicatedParameterName.withArguments(formals[1].name),
formals[1].charOffset,
@@ -1574,8 +1583,7 @@
Map<String, FormalParameterBuilder> seenNames =
<String, FormalParameterBuilder>{};
for (FormalParameterBuilder formal in formals) {
- // ignore: unnecessary_null_comparison
- if (formal.name == null) continue;
+ if (formal.name == FormalParameterBuilder.noNameSentinel) continue;
if (seenNames.containsKey(formal.name)) {
addProblem(
templateDuplicatedParameterName.withArguments(formal.name),
@@ -1877,7 +1885,7 @@
bool isParserRecovery = false;
for (int i = count - 1; i != -1; i--) {
int charEndOffset = popCharOffset();
- Token beforeLast = pop() as Token;
+ Token? beforeLast = pop() as Token?;
Token? initializerTokenForInference = pop() as Token?;
int charOffset = popCharOffset();
Object? name = pop(NullValue.Identifier);
@@ -1909,7 +1917,8 @@
void handleTypeVariablesDefined(Token token, int count) {
debugEvent("TypeVariablesDefined");
assert(count > 0);
- push(const FixedNullableList<TypeVariableBuilder>().pop(stack, count) ??
+ push(const FixedNullableList<TypeVariableBuilder>()
+ .popNonNullable(stack, count, dummyTypeVariableBuilder) ??
NullValue.TypeVariables);
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index cead87b..324a721 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -803,7 +803,7 @@
if (startToken != null) {
// Extract only the tokens for the initializer expression from the
// token stream.
- Token endToken = info.beforeLast;
+ Token endToken = info.beforeLast!;
endToken.setNext(new Token.eof(endToken.next!.offset));
new Token.eof(startToken.previous!.offset).setNext(startToken);
}
@@ -4241,12 +4241,11 @@
Builder? declaration = iterator.current;
while (declaration != null) {
if (declaration is SourceTypeAliasBuilder) {
- declaration.buildTypedefTearOffs(this,
- (Procedure procedure) {
- procedure.isStatic = true;
- if (!declaration!.isPatch && !declaration.isDuplicate) {
- library.addProcedure(procedure);
- }
+ declaration.buildTypedefTearOffs(this, (Procedure procedure) {
+ procedure.isStatic = true;
+ if (!declaration!.isPatch && !declaration.isDuplicate) {
+ library.addProcedure(procedure);
+ }
});
}
declaration = declaration.next;
@@ -4523,7 +4522,7 @@
final String name;
final int charOffset;
final Token? initializerToken;
- final Token beforeLast;
+ final Token? beforeLast;
final int charEndOffset;
const FieldInfo(this.name, this.charOffset, this.initializerToken,
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index d6f2f0c..269a892 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -245,6 +245,7 @@
dash
dashes
day
+days
db
ddart
dds
diff --git a/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.expect b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.expect
new file mode 100644
index 0000000..9b02f5d
--- /dev/null
+++ b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:19: Error: Type 'C' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:25: Error: Type 'D' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:3:17: Error: Type 'D' not found.
+// class B extends D with A {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class A<T extends invalid-type> extends core::Object /*isMixinDeclaration*/ {
+}
+abstract class _B&D&A = core::Object with self::A<invalid-type> /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_B&D&A
+ : super core::Object::•()
+ ;
+}
+class B extends self::_B&D&A {
+ synthetic constructor •() → self::B
+ : super self::_B&D&A::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.outline.expect b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.outline.expect
new file mode 100644
index 0000000..e9d2a26
--- /dev/null
+++ b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.outline.expect
@@ -0,0 +1,31 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:19: Error: Type 'C' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:25: Error: Type 'D' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:3:17: Error: Type 'D' not found.
+// class B extends D with A {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class A<T extends invalid-type> extends core::Object /*isMixinDeclaration*/ {
+}
+abstract class _B&D&A = core::Object with self::A<invalid-type> /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_B&D&A
+ ;
+}
+class B extends self::_B&D&A {
+ synthetic constructor •() → self::B
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.transformed.expect b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.transformed.expect
new file mode 100644
index 0000000..8b03fd8a
--- /dev/null
+++ b/pkg/front_end/testcases/general/crashes/crash_04/main.dart.weak.transformed.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:19: Error: Type 'C' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:1:25: Error: Type 'D' not found.
+// mixin A<T extends C> on D {}
+// ^
+//
+// pkg/front_end/testcases/general/crashes/crash_04/main.dart:3:17: Error: Type 'D' not found.
+// class B extends D with A {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class A<T extends invalid-type> extends core::Object /*isMixinDeclaration*/ {
+}
+abstract class _B&D&A extends core::Object implements self::A<invalid-type> /*isAnonymousMixin,isEliminatedMixin*/ {
+ synthetic constructor •() → self::_B&D&A
+ : super core::Object::•()
+ ;
+}
+class B extends self::_B&D&A {
+ synthetic constructor •() → self::B
+ : super self::_B&D&A::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue44007.dart b/pkg/front_end/testcases/general/issue44007.dart
new file mode 100644
index 0000000..9e5ebd9
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+void test() {
+ var list = [
+ DateTime.now().add(Duration(days: 3)),
+ DateTime.now().add(Duration(days: 2)),
+ DateTime.now(),
+ DateTime.now().subtract(Duration(days: 1))
+ ];
+
+ list.sort((a, b) => a.compareTo(b));
+ print(list);
+
+ print(DateTime.parse(2019-01-17 00:00:00.000));
+}
+
+main() {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/issue44007.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue44007.dart.textual_outline.expect
new file mode 100644
index 0000000..31c91a2
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart.textual_outline.expect
@@ -0,0 +1,2 @@
+void test() {}
+main() {}
diff --git a/pkg/front_end/testcases/general/issue44007.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue44007.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..4742c78
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart.textual_outline_modelled.expect
@@ -0,0 +1,2 @@
+main() {}
+void test() {}
diff --git a/pkg/front_end/testcases/general/issue44007.dart.weak.expect b/pkg/front_end/testcases/general/issue44007.dart.weak.expect
new file mode 100644
index 0000000..efd3a92
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart.weak.expect
@@ -0,0 +1,35 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:35: Error: Expected ',' before this.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:35: Error: Expected an identifier, but got '00'.
+// Try inserting an identifier before '00'.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:40: Error: Expected ')' before this.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:18: Error: Expected an identifier, but got 'parse'.
+// Try inserting an identifier before 'parse'.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ core::List<core::DateTime> list = <core::DateTime>[new core::DateTime::now().{core::DateTime::add}(new core::Duration::•(days: 3)){(core::Duration) → core::DateTime}, new core::DateTime::now().{core::DateTime::add}(new core::Duration::•(days: 2)){(core::Duration) → core::DateTime}, new core::DateTime::now(), new core::DateTime::now().{core::DateTime::subtract}(new core::Duration::•(days: 1)){(core::Duration) → core::DateTime}];
+ list.{core::List::sort}((core::DateTime a, core::DateTime b) → core::int => a.{core::DateTime::compareTo}(b){(core::DateTime) → core::int}){([(core::DateTime, core::DateTime) →? core::int]) → void};
+ core::print(list);
+ core::print(invalid-expression "pkg/front_end/testcases/general/issue44007.dart:16:18: Error: Expected an identifier, but got 'parse'.
+Try inserting an identifier before 'parse'.
+ print(DateTime.parse(2019-01-17 00:00:00.000));
+ ^^^^^");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue44007.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue44007.dart.weak.outline.expect
new file mode 100644
index 0000000..d7d3d2f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart.weak.outline.expect
@@ -0,0 +1,7 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+static method test() → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue44007.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue44007.dart.weak.transformed.expect
new file mode 100644
index 0000000..244d264
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44007.dart.weak.transformed.expect
@@ -0,0 +1,35 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:35: Error: Expected ',' before this.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:35: Error: Expected an identifier, but got '00'.
+// Try inserting an identifier before '00'.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:40: Error: Expected ')' before this.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^
+//
+// pkg/front_end/testcases/general/issue44007.dart:16:18: Error: Expected an identifier, but got 'parse'.
+// Try inserting an identifier before 'parse'.
+// print(DateTime.parse(2019-01-17 00:00:00.000));
+// ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static method test() → void {
+ core::List<core::DateTime> list = core::_GrowableList::_literal4<core::DateTime>(new core::DateTime::now().{core::DateTime::add}(new core::Duration::•(days: 3)){(core::Duration) → core::DateTime}, new core::DateTime::now().{core::DateTime::add}(new core::Duration::•(days: 2)){(core::Duration) → core::DateTime}, new core::DateTime::now(), new core::DateTime::now().{core::DateTime::subtract}(new core::Duration::•(days: 1)){(core::Duration) → core::DateTime});
+ list.{core::List::sort}((core::DateTime a, core::DateTime b) → core::int => a.{core::DateTime::compareTo}(b){(core::DateTime) → core::int}){([(core::DateTime, core::DateTime) →? core::int]) → void};
+ core::print(list);
+ core::print(invalid-expression "pkg/front_end/testcases/general/issue44007.dart:16:18: Error: Expected an identifier, but got 'parse'.
+Try inserting an identifier before 'parse'.
+ print(DateTime.parse(2019-01-17 00:00:00.000));
+ ^^^^^");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue44347.dart b/pkg/front_end/testcases/general/issue44347.dart
index 2d9a01e..074b4e5 100644
--- a/pkg/front_end/testcases/general/issue44347.dart
+++ b/pkg/front_end/testcases/general/issue44347.dart
@@ -1,7 +1,9 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
// @dart=2.9
+
test() {
Set<int>.();
}
diff --git a/pkg/front_end/testcases/general/issue44347.dart.weak.expect b/pkg/front_end/testcases/general/issue44347.dart.weak.expect
index 23f91b5..fc179e1 100644
--- a/pkg/front_end/testcases/general/issue44347.dart.weak.expect
+++ b/pkg/front_end/testcases/general/issue44347.dart.weak.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue44347.dart:6:6: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// pkg/front_end/testcases/general/issue44347.dart:8:6: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
// Set<int>.();
// ^
//
-// pkg/front_end/testcases/general/issue44347.dart:6:13: Error: Expected an identifier, but got ')'.
+// pkg/front_end/testcases/general/issue44347.dart:8:13: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// Set<int>.();
// ^
//
-// pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
+// pkg/front_end/testcases/general/issue44347.dart:8:12: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.
// Set<int>.();
// ^
@@ -20,7 +20,7 @@
import self as self;
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
+ invalid-expression "pkg/front_end/testcases/general/issue44347.dart:8:12: Error: Expected an identifier, but got '('.
Try inserting an identifier before '('.
Set<int>.();
^";
diff --git a/pkg/front_end/testcases/general/issue44347.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue44347.dart.weak.transformed.expect
index 23f91b5..fc179e1 100644
--- a/pkg/front_end/testcases/general/issue44347.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/issue44347.dart.weak.transformed.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue44347.dart:6:6: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// pkg/front_end/testcases/general/issue44347.dart:8:6: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
// Set<int>.();
// ^
//
-// pkg/front_end/testcases/general/issue44347.dart:6:13: Error: Expected an identifier, but got ')'.
+// pkg/front_end/testcases/general/issue44347.dart:8:13: Error: Expected an identifier, but got ')'.
// Try inserting an identifier before ')'.
// Set<int>.();
// ^
//
-// pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
+// pkg/front_end/testcases/general/issue44347.dart:8:12: Error: Expected an identifier, but got '('.
// Try inserting an identifier before '('.
// Set<int>.();
// ^
@@ -20,7 +20,7 @@
import self as self;
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/general/issue44347.dart:6:12: Error: Expected an identifier, but got '('.
+ invalid-expression "pkg/front_end/testcases/general/issue44347.dart:8:12: Error: Expected an identifier, but got '('.
Try inserting an identifier before '('.
Set<int>.();
^";
diff --git a/pkg/front_end/testcases/general/issue44733.dart b/pkg/front_end/testcases/general/issue44733.dart
new file mode 100644
index 0000000..92227d1
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44733.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+abstract class B extends A with C {}
+
+mixin C on D {}
+
+B get x => super.x;
+void f() {
+ switch (x.y.z) {
+ }
+}
+
+abstract class E {}
+
+abstract class D {
+ E get y {}
+}
+
+abstract class A {
+ F get y => super.y as F;
+}
+
+main() {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/issue44733.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue44733.dart.textual_outline.expect
new file mode 100644
index 0000000..7fafd11
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44733.dart.textual_outline.expect
@@ -0,0 +1,17 @@
+abstract class B extends A with C {}
+
+mixin C on D {}
+B get x => super.x;
+void f() {}
+
+abstract class E {}
+
+abstract class D {
+ E get y {}
+}
+
+abstract class A {
+ F get y => super.y as F;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue44733.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue44733.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..ba7e44d
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44733.dart.textual_outline_modelled.expect
@@ -0,0 +1,17 @@
+B get x => super.x;
+
+abstract class A {
+ F get y => super.y as F;
+}
+
+abstract class B extends A with C {}
+
+abstract class D {
+ E get y {}
+}
+
+abstract class E {}
+
+main() {}
+mixin C on D {}
+void f() {}
diff --git a/pkg/front_end/testcases/general/issue44733.dart.weak.expect b/pkg/front_end/testcases/general/issue44733.dart.weak.expect
new file mode 100644
index 0000000..186db3f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44733.dart.weak.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue44733.dart:22:3: Error: Type 'F' not found.
+// F get y => super.y as F;
+// ^
+//
+// pkg/front_end/testcases/general/issue44733.dart:5:16: Error: 'A' doesn't implement 'D' so it can't be used with 'C'.
+// - 'A' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// - 'D' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// - 'C' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// abstract class B extends A with C {}
+// ^
+//
+// pkg/front_end/testcases/general/issue44733.dart:9:12: Error: Expected identifier, but got 'super'.
+// B get x => super.x;
+// ^^^^^
+//
+// pkg/front_end/testcases/general/issue44733.dart:18:9: Error: A non-null value must be returned since the return type 'E' doesn't allow null.
+// - 'E' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// E get y {}
+// ^
+//
+// pkg/front_end/testcases/general/issue44733.dart:22:25: Error: 'F' isn't a type.
+// F get y => super.y as F;
+// ^
+//
+// pkg/front_end/testcases/general/issue44733.dart:22:20: Error: Superclass has no getter named 'y'.
+// F get y => super.y as F;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class _B&A&C = self::A with self::C /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_B&A&C
+ : super self::A::•()
+ ;
+}
+abstract class B extends self::_B&A&C {
+ synthetic constructor •() → self::B
+ : super self::_B&A&C::•()
+ ;
+}
+abstract class C extends self::D /*isMixinDeclaration*/ {
+}
+abstract class E extends core::Object {
+ synthetic constructor •() → self::E
+ : super core::Object::•()
+ ;
+}
+abstract class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+ get y() → self::E {
+ return let final Never #t1 = invalid-expression "pkg/front_end/testcases/general/issue44733.dart:18:9: Error: A non-null value must be returned since the return type 'E' doesn't allow null.
+ - 'E' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+ E get y {}
+ ^" in null;
+ }
+}
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ get y() → invalid-type
+ return super.y as{ForNonNullableByDefault} invalid-type;
+}
+static get x() → self::B
+ return invalid-expression "pkg/front_end/testcases/general/issue44733.dart:9:12: Error: Expected identifier, but got 'super'.
+B get x => super.x;
+ ^^^^^"{dynamic}.x as{TypeError,ForDynamic,ForNonNullableByDefault} self::B;
+static method f() → void {
+ switch(self::x.{self::A::y}{invalid-type}{<invalid>}.z) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue44733.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue44733.dart.weak.outline.expect
new file mode 100644
index 0000000..b1f8519
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue44733.dart.weak.outline.expect
@@ -0,0 +1,51 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue44733.dart:22:3: Error: Type 'F' not found.
+// F get y => super.y as F;
+// ^
+//
+// pkg/front_end/testcases/general/issue44733.dart:5:16: Error: 'A' doesn't implement 'D' so it can't be used with 'C'.
+// - 'A' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// - 'D' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// - 'C' is from 'pkg/front_end/testcases/general/issue44733.dart'.
+// abstract class B extends A with C {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class _B&A&C = self::A with self::C /*isAnonymousMixin*/ {
+ synthetic constructor •() → self::_B&A&C
+ : super self::A::•()
+ ;
+}
+abstract class B extends self::_B&A&C {
+ synthetic constructor •() → self::B
+ ;
+}
+abstract class C extends self::D /*isMixinDeclaration*/ {
+}
+abstract class E extends core::Object {
+ synthetic constructor •() → self::E
+ ;
+}
+abstract class D extends core::Object {
+ synthetic constructor •() → self::D
+ ;
+ get y() → self::E
+ ;
+}
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+ get y() → invalid-type
+ ;
+}
+static get x() → self::B
+ ;
+static method f() → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/incremental.status b/pkg/front_end/testcases/incremental.status
index 7edb02b..afed71c 100644
--- a/pkg/front_end/testcases/incremental.status
+++ b/pkg/front_end/testcases/incremental.status
@@ -6,5 +6,3 @@
# http://dartbug.com/41812#issuecomment-684825703
strongmode_mixins_2: Crash
-
-crash_07: Crash
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml.world.1.expect b/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml.world.1.expect
index 5938335..38493c4 100644
--- a/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml.world.1.expect
@@ -43,7 +43,7 @@
;
}
abstract class _A&B&C&D extends main::_A&B&C implements main::D /*isAnonymousMixin,isEliminatedMixin*/ {
- synthetic constructor named(dynamic _field) → main::_A&B&C&D*
+ synthetic constructor named(lib::E* _field) → main::_A&B&C&D*
: super main::_A&B&C::named(_field)
;
}
diff --git a/pkg/front_end/testcases/outline.status b/pkg/front_end/testcases/outline.status
index b866349..4f83215 100644
--- a/pkg/front_end/testcases/outline.status
+++ b/pkg/front_end/testcases/outline.status
@@ -13,7 +13,6 @@
general/bug30695: TypeCheckError
general/covariant_field: TypeCheckError
general/crashes/crash_02/main: Crash
-general/crashes/crash_04/main: Crash
general/crashes/crash_06/main: Crash
general/getter_vs_setter_type: TypeCheckError
general/infer_field_from_multiple: TypeCheckError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index 29295ce..6aacb2f 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -35,7 +35,6 @@
general/covariant_field: TypeCheckError
general/covariant_generic: RuntimeError
general/crashes/crash_02/main: Crash
-general/crashes/crash_04/main: Crash
general/crashes/crash_06/main: Crash
general/duplicated_declarations: TypeCheckError
general/duplicated_field_initializer: RuntimeError
@@ -86,6 +85,7 @@
general/issue41210a: TypeCheckError
general/issue41210b/issue41210.no_link: TypeCheckError
general/issue41210b/issue41210: TypeCheckError
+general/issue44733: TypeCheckError
general/issue45204: TypeCheckError
general/micro: RuntimeError
general/mixin_application_override: TypeCheckError
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index 569aa45..d88eb7b16 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -40,7 +40,6 @@
general/covariant_field: TypeCheckError
general/covariant_generic: RuntimeError
general/crashes/crash_02/main: Crash
-general/crashes/crash_04/main: Crash
general/crashes/crash_06/main: Crash
general/duplicated_declarations: TypeCheckError
general/duplicated_field_initializer: RuntimeError
@@ -91,6 +90,7 @@
general/issue41210a: TypeCheckError
general/issue41210b/issue41210.no_link: TypeCheckError
general/issue41210b/issue41210: TypeCheckError
+general/issue44733: TypeCheckError
general/issue45204: TypeCheckError
general/micro: RuntimeError
general/mixin_application_override: ExpectationFileMismatch # Too many errors.
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index babe0c6..1d243d9 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -25,8 +25,8 @@
final ConstantIndexer _constantIndexer;
final UriIndexer _sourceUriIndexer = new UriIndexer();
bool _currentlyInNonimplementation = false;
- final List<bool> _sourcesFromRealImplementation = <bool>[];
- final List<bool> _sourcesUsedInLibrary = <bool>[];
+ final List<bool?> _sourcesFromRealImplementation = <bool?>[];
+ final List<bool?> _sourcesUsedInLibrary = <bool?>[];
Map<LibraryDependency, int> _libraryDependencyIndex =
<LibraryDependency, int>{};
NonNullableByDefaultCompiledMode? compilationMode;
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index f66182a..7a61ee2 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -1722,6 +1722,8 @@
/// are removed first; in the case of ties, classes with lower topological sort
/// index are removed first.
class _LubHeap extends Heap<_ClassInfo> {
+ _LubHeap() : super(_dummyClassInfo);
+
@override
bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b);
@@ -1731,3 +1733,5 @@
return a.topologicalIndex < b.topologicalIndex;
}
}
+
+final _ClassInfo _dummyClassInfo = new _ClassInfo(dummyClass);
diff --git a/pkg/kernel/lib/src/heap.dart b/pkg/kernel/lib/src/heap.dart
index ecb3f0a..f70098b 100644
--- a/pkg/kernel/lib/src/heap.dart
+++ b/pkg/kernel/lib/src/heap.dart
@@ -5,6 +5,9 @@
/// Basic implementation of a heap, with O(log n) insertion and removal.
abstract class Heap<T> {
final _items = <T>[];
+ final T _dummyValue;
+
+ Heap(this._dummyValue);
bool get isEmpty => _items.isEmpty;
@@ -12,7 +15,7 @@
void add(T item) {
int index = _items.length;
- _items.length += 1;
+ _items.add(_dummyValue);
while (index > 0) {
T parent = _items[_parentIndex(index)];
if (sortsBefore(parent, item)) break;
diff --git a/pkg/kernel/test/heap_test.dart b/pkg/kernel/test/heap_test.dart
index 95071ef..07f5245 100644
--- a/pkg/kernel/test/heap_test.dart
+++ b/pkg/kernel/test/heap_test.dart
@@ -36,5 +36,7 @@
}
class _intHeap extends Heap<int> {
+ _intHeap() : super(0);
+
bool sortsBefore(int a, int b) => a < b;
}
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 1903854..c52f156 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -18961,9 +18961,9 @@
if (Symbol::IsSymbolCid(GetClassId())) {
hash = Symbol::CanonicalizeHash(*this);
} else {
- const intptr_t instance_size = SizeFromClass();
- ASSERT(instance_size != 0);
- hash = instance_size / kCompressedWordSize;
+ const intptr_t class_id = cls.id();
+ ASSERT(class_id != 0);
+ hash = class_id;
uword this_addr = reinterpret_cast<uword>(this->untag());
Object& obj = Object::Handle(zone);
Instance& instance = Instance::Handle(zone);
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index dae798f..93cfc12 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -5029,6 +5029,64 @@
/*check_identity=*/false));
}
+// Because we want to reuse CanonicalizeHash for hashCode, we should not have
+// collisions.
+TEST_CASE(CanonicalizeHash_Const_Instances) {
+ const char* kScript =
+ "class A {\n"
+ " final int n;\n"
+ " \n"
+ " const A(this.n);\n"
+ "}\n"
+ "\n"
+ "class B {\n"
+ " final int n;\n"
+ " \n"
+ " const B(this.n);\n"
+ "}\n"
+ "\n"
+ "valueA() {\n"
+ " return const A(5);\n"
+ "}\n"
+ "\n"
+ "valueB() {\n"
+ " return const B(5);\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
+ EXPECT_VALID(lib);
+
+ Dart_Handle value_a_result =
+ Dart_Invoke(lib, NewString("valueA"), 0, nullptr);
+ EXPECT_VALID(value_a_result);
+ Dart_Handle value_b_result =
+ Dart_Invoke(lib, NewString("valueB"), 0, nullptr);
+ EXPECT_VALID(value_b_result);
+
+ TransitionNativeToVM transition(Thread::Current());
+
+ const auto& value_a_dart = Instance::CheckedHandle(
+ Thread::Current()->zone(), Api::UnwrapHandle(value_a_result));
+ const auto& value_b_dart = Instance::CheckedHandle(
+ Thread::Current()->zone(), Api::UnwrapHandle(value_b_result));
+
+ const uint32_t canonicalize_hash_a = value_a_dart.CanonicalizeHash();
+ const uint32_t canonicalize_hash_b = value_b_dart.CanonicalizeHash();
+
+ bool success = canonicalize_hash_a != canonicalize_hash_b;
+
+ if (!success) {
+ LogBlock lb;
+ THR_Print("Hash collision between %s and %s\n", value_a_dart.ToCString(),
+ value_b_dart.ToCString());
+ THR_Print("VM CanonicalizeHash a %" Px32 " %" Pd32 "\n",
+ canonicalize_hash_a, canonicalize_hash_a);
+ THR_Print("VM CanonicalizeHash b %" Px32 " %" Pd32 "\n",
+ canonicalize_hash_b, canonicalize_hash_b);
+ }
+ EXPECT(success);
+}
+
TEST_CASE(LinkedHashMap_iteration) {
const char* kScript =
"makeMap() {\n"
diff --git a/tools/VERSION b/tools/VERSION
index ce0eb0e..b155add 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 353
+PRERELEASE 354
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni
index 317153a..6a2efbb 100644
--- a/utils/application_snapshot.gni
+++ b/utils/application_snapshot.gni
@@ -82,6 +82,9 @@
# Build the kernel file using the prebuilt VM to speed up the debug and
# simulator builds.
prebuilt_dart_action(target_name + "_dill") {
+ if (defined(invoker.pool)) {
+ pool = invoker.pool
+ }
deps = extra_deps + [
"$_dart_root/runtime/vm:kernel_platform_files($host_toolchain)",
"$_dart_root/runtime/vm:vm_platform",
@@ -131,6 +134,9 @@
# Create a snapshot from kernel built above.
dart_action(target_name) {
+ if (defined(invoker.pool)) {
+ pool = invoker.pool
+ }
deps = extra_deps + [ ":${target_name}_dill" ]
depfile = "$output.d"
diff --git a/utils/compile_platform.gni b/utils/compile_platform.gni
index 447ed64..37c3407 100644
--- a/utils/compile_platform.gni
+++ b/utils/compile_platform.gni
@@ -41,6 +41,9 @@
}
prebuilt_dart_action(target_name) {
+ if (defined(invoker.pool)) {
+ pool = invoker.pool
+ }
script = "$_dart_root/pkg/front_end/tool/_fasta/compile_platform.dart"
packages = "$_dart_root/.packages"