[cfe] Process invocations eagerly

Some invocation nodes, such as redirecting factory invocations,
type-aliased constructor invocations, and type aliased factory
invocations, were unaliased and resolved via lists of delayed
processing actions. That was due to dependencies of the processing
actions on each other.

This CL untangles the dependencies and processes the invocations
eagerly. Namely, the redirecting factory constructors are processed
before all other nodes that may require unaliasing and resolving. The
eager processing of nodes eliminates the need for fragile filtering of
the nodes that may require post-processing.

Change-Id: I3e6971515a974c01eced31aa68bf72399dcfa8b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Chloe Stefantsova 2024-06-20 07:02:23 +00:00 committed by Commit Queue
parent 09e87e6d7b
commit 282893db9e
63 changed files with 1043 additions and 809 deletions

View file

@ -21,7 +21,6 @@ import '../scope.dart' show Scope;
import '../source/source_factory_builder.dart'; import '../source/source_factory_builder.dart';
import '../source/source_field_builder.dart'; import '../source/source_field_builder.dart';
import '../source/source_library_builder.dart'; import '../source/source_library_builder.dart';
import '../util/helpers.dart' show DelayedActionPerformer;
import 'builder.dart'; import 'builder.dart';
import 'constructor_builder.dart'; import 'constructor_builder.dart';
import 'declaration_builders.dart'; import 'declaration_builders.dart';
@ -271,8 +270,7 @@ class FormalParameterBuilder extends ModifierBuilderImpl
/// Builds the default value from this [initializerToken] if this is a /// Builds the default value from this [initializerToken] if this is a
/// formal parameter on a const constructor or instance method. /// formal parameter on a const constructor or instance method.
void buildOutlineExpressions(SourceLibraryBuilder libraryBuilder, void buildOutlineExpressions(SourceLibraryBuilder libraryBuilder) {
List<DelayedActionPerformer> delayedActionPerformers) {
if (needsDefaultValuesBuiltAsOutlineExpressions) { if (needsDefaultValuesBuiltAsOutlineExpressions) {
if (initializerToken != null) { if (initializerToken != null) {
final DeclarationBuilder declarationBuilder = final DeclarationBuilder declarationBuilder =
@ -294,9 +292,7 @@ class FormalParameterBuilder extends ModifierBuilderImpl
bodyBuilder, initializer, variable!.type, hasDeclaredInitializer); bodyBuilder, initializer, variable!.type, hasDeclaredInitializer);
variable!.initializer = initializer..parent = variable; variable!.initializer = initializer..parent = variable;
initializerWasInferred = true; initializerWasInferred = true;
bodyBuilder.performBacklogComputations( bodyBuilder.performBacklogComputations();
delayedActionPerformers: delayedActionPerformers,
allowFurtherDelays: false);
} else if (kind.isOptional) { } else if (kind.isOptional) {
// As done by BodyBuilder.endFormalParameter. // As done by BodyBuilder.endFormalParameter.
variable!.initializer = new NullLiteral()..parent = variable; variable!.initializer = new NullLiteral()..parent = variable;

View file

@ -105,7 +105,7 @@ class MetadataBuilder {
// TODO(johnniwinther): Avoid potentially inferring annotations multiple // TODO(johnniwinther): Avoid potentially inferring annotations multiple
// times. // times.
bodyBuilder.inferAnnotations(parent, parent.annotations); bodyBuilder.inferAnnotations(parent, parent.annotations);
bodyBuilder.performBacklogComputations(allowFurtherDelays: false); bodyBuilder.performBacklogComputations();
for (MapEntry<MetadataBuilder, int> entry for (MapEntry<MetadataBuilder, int> entry
in parsedAnnotationBuilders.entries) { in parsedAnnotationBuilders.entries) {
MetadataBuilder annotationBuilder = entry.key; MetadataBuilder annotationBuilder = entry.key;

View file

@ -391,7 +391,6 @@ class NominalVariableBuilder extends TypeVariableBuilderBase {
SourceLibraryBuilder libraryBuilder, SourceLibraryBuilder libraryBuilder,
BodyBuilderContext bodyBuilderContext, BodyBuilderContext bodyBuilderContext,
ClassHierarchy classHierarchy, ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
Scope scope) { Scope scope) {
MetadataBuilder.buildAnnotations(parameter, metadata, bodyBuilderContext, MetadataBuilder.buildAnnotations(parameter, metadata, bodyBuilderContext,
libraryBuilder, fileUri!, scope); libraryBuilder, fileUri!, scope);

View file

@ -186,6 +186,7 @@ enum BenchmarkPhases {
outline_computeHierarchy, outline_computeHierarchy,
outline_computeShowHideElements, outline_computeShowHideElements,
outline_installTypedefTearOffs, outline_installTypedefTearOffs,
outline_performRedirectingFactoryInference,
outline_performTopLevelInference, outline_performTopLevelInference,
outline_checkOverrides, outline_checkOverrides,
outline_checkAbstractMembers, outline_checkAbstractMembers,
@ -276,7 +277,6 @@ enum BenchmarkSubdivides {
inferRedirectingFactoryTypeArguments, inferRedirectingFactoryTypeArguments,
buildOutlineExpressions, buildOutlineExpressions,
delayedActionPerformer,
computeMacroApplications_macroExecutorProvider, computeMacroApplications_macroExecutorProvider,
macroApplications_macroExecutorLoadMacro, macroApplications_macroExecutorLoadMacro,

View file

@ -122,7 +122,7 @@ enum JumpTargetKind {
} }
class BodyBuilder extends StackListenerImpl class BodyBuilder extends StackListenerImpl
implements ExpressionGeneratorHelper, DelayedActionPerformer { implements ExpressionGeneratorHelper {
@override @override
final Forest forest; final Forest forest;
@ -242,89 +242,6 @@ class BodyBuilder extends StackListenerImpl
/// nominal correspondingly. /// nominal correspondingly.
bool _insideOfFormalParameterType = false; bool _insideOfFormalParameterType = false;
/// True if the currently built part of the body is inside of a default value
/// of a formal parameter.
///
/// Being inside of a default value is treated with regards to possible
/// nestedness of the default values. See the documentation on
/// [_defaultValueNestingLevel] for details.
bool get _insideOfFormalParameterDefaultValue {
return _defaultValueNestingLevel > 0;
}
/// True if the parser is between [beginMetadata] and [endMetadata].
bool _insideMetadataParsing = false;
/// Numeric nestedness of formal parameter default values.
///
/// The value of 0 means that the currently built part is not within a default
/// value. Consider the following clarifying examples.
///
/// // `const Bar()` isn't within a default value.
/// foo() => const Bar();
///
/// // `const Bar()` is at [_defaultValueNestingLevel] = 1.
/// foo([dynamic x = const Bar()]) {}
///
/// // `const Bar()` is at [_defaultValueNestingLevel] = 2.
/// // `const Baz()` is at [_defaultValueNestingLevel] = 1.
/// foo([dynamic x = ([dynamic y = const Bar()]) => const Baz()]) {}
///
/// Since function expressions aren't const values, currently it's not
/// possible to write a program with [_defaultValueNestingLevel] > 1 that
/// doesn't contain a compile-time error. However, it's still necessary to
/// track the nestedness level to avoid bad compiler states and compiler
/// crashes.
int _defaultValueNestingLevel = 0;
/// Returns true if newly created aliased or redirecting invocations need
/// post-processing such as resolution or unaliasing.
///
/// The need for the condition computed by the getter is due to some parts of
/// the AST being built twice. The first time they are built is during
/// outline expressions building. The second time they are built during the
/// function body building. However, they are fully processed only the first
/// time they are built, and the second time around they are discarded.
/// Additional complication arises due to some nodes, such as annotations,
/// being built only once. So we only need to add the nodes created for the
/// first time into the lists of nodes for post-processing.
///
/// The invocations inside default values that need resolution or unaliasing
/// were already added to the post-processing lists during outline expression
/// building. Only those invocations that are built outside of the default
/// values or inside the default values that aren't built as outline
/// expressions need to be added during the second pass.
bool get _createdStaticInvocationsNeedPostProcessing {
return
// All invocations in outline building phase will be type-inferred, and
// they all should be added to the post-processing.
_context.inOutlineBuildingPhase ||
// Here we aren't in the outline mode, but rather in the
// body-building mode. If the current context has formal parameters
// and is a constructor context, their default values should be
// skipped because in the body-building mode they aren't passed
// through type inference.
(!_context.hasFormalParameters ||
!_insideOfFormalParameterDefaultValue ||
!_context.isConstructor) &&
// The invocations in the metadata should also be skipped in the
// body-building phase, since they aren't type-inferred. An
// exception here are the annotations within method bodies,
// field initializers, and on formal parameters.
!(_context.inMetadata ||
_insideMetadataParsing &&
!_inBody &&
!inFormals &&
!inFieldInitializer) &&
// Finally, the const fields in body-building phase aren't
// inferred and the invocations in them should be skipped during
// post-processing.
!_context.inConstFields;
}
bool get inFunctionType => bool get inFunctionType =>
_structuralParameterDepthLevel > 0 || _insideOfFormalParameterType; _structuralParameterDepthLevel > 0 || _insideOfFormalParameterType;
@ -342,10 +259,6 @@ class BodyBuilder extends StackListenerImpl
int functionNestingLevel = 0; int functionNestingLevel = 0;
int _inBodyCount = 0;
bool get _inBody => _inBodyCount > 0;
Statement? problemInLoopOrSwitch; Statement? problemInLoopOrSwitch;
Scope? switchScope; Scope? switchScope;
@ -365,41 +278,6 @@ class BodyBuilder extends StackListenerImpl
/// and where that was. /// and where that was.
Map<String, int>? initializedFields; Map<String, int>? initializedFields;
/// List of built redirecting factory invocations. The targets of the
/// invocations are to be resolved in a separate step.
final List<FactoryConstructorInvocation> redirectingFactoryInvocations = [];
/// List of redirecting factory invocations delayed for resolution.
///
/// A resolution of a redirecting factory invocation can be delayed because
/// the inference in the declaration of the redirecting factory isn't done
/// yet.
final List<FactoryConstructorInvocation>
delayedRedirectingFactoryInvocations = [];
/// List of built type aliased generative constructor invocations that
/// require unaliasing.
final List<TypeAliasedConstructorInvocation>
typeAliasedConstructorInvocations = [];
/// List of built type aliased factory constructor invocations that require
/// unaliasing.
final List<TypeAliasedFactoryInvocation> typeAliasedFactoryInvocations = [];
/// List of type aliased factory invocations delayed for resolution.
///
/// A resolution of a type aliased factory invocation can be delayed because
/// the inference in the declaration of the target isn't done yet.
final List<TypeAliasedFactoryInvocation>
delayedTypeAliasedFactoryInvocations = [];
/// List of type aliased constructor invocations delayed for resolution.
///
/// A resolution of a type aliased constructor invocation can be delayed
/// because the inference in the declaration of the target isn't done yet.
final List<TypeAliasedConstructorInvocation>
delayedTypeAliasedConstructorInvocations = [];
/// Variables with metadata. Their types need to be inferred late, for /// Variables with metadata. Their types need to be inferred late, for
/// example, in [finishFunction]. /// example, in [finishFunction].
List<VariableDeclaration>? variablesWithMetadata; List<VariableDeclaration>? variablesWithMetadata;
@ -506,9 +384,6 @@ class BodyBuilder extends StackListenerImpl
void enterLocalScope(Scope localScope) { void enterLocalScope(Scope localScope) {
push(scope); push(scope);
scope = localScope; scope = localScope;
if (scope.kind == ScopeKind.functionBody) {
_inBodyCount++;
}
assert(checkState(null, [ assert(checkState(null, [
ValueKinds.Scope, ValueKinds.Scope,
])); ]));
@ -518,9 +393,6 @@ class BodyBuilder extends StackListenerImpl
{required String debugName, required ScopeKind kind}) { {required String debugName, required ScopeKind kind}) {
push(scope); push(scope);
scope = scope.createNestedScope(debugName: debugName, kind: kind); scope = scope.createNestedScope(debugName: debugName, kind: kind);
if (kind == ScopeKind.functionBody) {
_inBodyCount++;
}
assert(checkState(null, [ assert(checkState(null, [
ValueKinds.Scope, ValueKinds.Scope,
])); ]));
@ -545,9 +417,6 @@ class BodyBuilder extends StackListenerImpl
declaredInCurrentGuard = null; declaredInCurrentGuard = null;
} }
} }
if (scope.kind == ScopeKind.functionBody) {
_inBodyCount--;
}
scope = pop() as Scope; scope = pop() as Scope;
} }
@ -907,7 +776,6 @@ class BodyBuilder extends StackListenerImpl
super.push(constantContext); super.push(constantContext);
constantContext = ConstantContext.inferred; constantContext = ConstantContext.inferred;
assert(checkState(token, [ValueKinds.ConstantContext])); assert(checkState(token, [ValueKinds.ConstantContext]));
_insideMetadataParsing = true;
} }
@override @override
@ -982,7 +850,6 @@ class BodyBuilder extends StackListenerImpl
} }
constantContext = savedConstantContext; constantContext = savedConstantContext;
} }
_insideMetadataParsing = false;
assert(checkState(beginToken, [ValueKinds.Expression])); assert(checkState(beginToken, [ValueKinds.Expression]));
} }
@ -1066,21 +933,7 @@ class BodyBuilder extends StackListenerImpl
continue; continue;
} }
if (initializer != null) { if (initializer != null) {
if (fieldBuilder.hasBodyBeenBuilt) { if (!fieldBuilder.hasBodyBeenBuilt) {
// The initializer was already compiled (e.g., if it appear in the
// outline, like constant field initializers) so we do not need to
// perform type inference or transformations.
// If the body is already built and it's a type aliased constructor or
// factory invocation, they shouldn't be checked or resolved the
// second time, so they are removed from the corresponding lists.
if (initializer is TypeAliasedConstructorInvocation) {
typeAliasedConstructorInvocations.remove(initializer);
}
if (initializer is TypeAliasedFactoryInvocation) {
typeAliasedFactoryInvocations.remove(initializer);
}
} else {
initializer = typeInferrer initializer = typeInferrer
.inferFieldInitializer(this, fieldBuilder.builtType, initializer) .inferFieldInitializer(this, fieldBuilder.builtType, initializer)
.expression; .expression;
@ -1108,7 +961,7 @@ class BodyBuilder extends StackListenerImpl
} }
pop(); // Annotations. pop(); // Annotations.
performBacklogComputations(allowFurtherDelays: false); performBacklogComputations();
assert(stack.length == 0); assert(stack.length == 0);
} }
@ -1117,39 +970,13 @@ class BodyBuilder extends StackListenerImpl
/// ///
/// Back logged computations include resolution of redirecting factory /// Back logged computations include resolution of redirecting factory
/// invocations and checking of typedef types. /// invocations and checking of typedef types.
/// void performBacklogComputations() {
/// If the parameter [allowFurtherDelays] is set to `true`, the backlog
/// computations are allowed to be delayed one more time if they can't be
/// completed in the current invocation of [performBacklogComputations] and
/// have a chance to be completed during the next invocation. If
/// [allowFurtherDelays] is set to `false`, the backlog computations are
/// assumed to be final and the function throws an internal exception in case
/// if any of the computations can't be completed.
void performBacklogComputations(
{List<DelayedActionPerformer>? delayedActionPerformers,
required bool allowFurtherDelays}) {
_finishVariableMetadata(); _finishVariableMetadata();
_unaliasTypeAliasedConstructorInvocations(
typeAliasedConstructorInvocations);
_unaliasTypeAliasedFactoryInvocations(typeAliasedFactoryInvocations);
_resolveRedirectingFactoryTargets(redirectingFactoryInvocations,
allowFurtherDelays: allowFurtherDelays);
libraryBuilder.checkPendingBoundsChecks(typeEnvironment); libraryBuilder.checkPendingBoundsChecks(typeEnvironment);
if (hasDelayedActions) {
assert(
delayedActionPerformers != null,
"Body builder has delayed actions that cannot be performed: "
"${[
...delayedRedirectingFactoryInvocations,
...delayedTypeAliasedFactoryInvocations,
...delayedTypeAliasedConstructorInvocations,
]}");
delayedActionPerformers?.add(this);
}
} }
void finishRedirectingFactoryBody() { void finishRedirectingFactoryBody() {
performBacklogComputations(allowFurtherDelays: false); performBacklogComputations();
} }
@override @override
@ -1453,7 +1280,7 @@ class BodyBuilder extends StackListenerImpl
_context.setBody(body); _context.setBody(body);
} }
performBacklogComputations(allowFurtherDelays: false); performBacklogComputations();
} }
void checkAsyncReturnType(AsyncMarker asyncModifier, DartType returnType, void checkAsyncReturnType(AsyncMarker asyncModifier, DartType returnType,
@ -1569,7 +1396,8 @@ class BodyBuilder extends StackListenerImpl
/// [target], `.arguments` is [arguments], `.fileOffset` is [fileOffset], /// [target], `.arguments` is [arguments], `.fileOffset` is [fileOffset],
/// and `.isConst` is [isConst]. /// and `.isConst` is [isConst].
/// Returns null if the invocation can't be resolved. /// Returns null if the invocation can't be resolved.
Expression? _resolveRedirectingFactoryTarget( @override
Expression? resolveRedirectingFactoryTarget(
Procedure target, Arguments arguments, int fileOffset, bool isConst) { Procedure target, Arguments arguments, int fileOffset, bool isConst) {
Procedure initialTarget = target; Procedure initialTarget = target;
Expression replacementNode; Expression replacementNode;
@ -1616,188 +1444,49 @@ class BodyBuilder extends StackListenerImpl
return replacementNode; return replacementNode;
} }
/// If the parameter [allowFurtherDelays] is set to `true`, the resolution of
/// redirecting factories is allowed to be delayed one more time if it can't
/// be completed in the current invocation of
/// [_resolveRedirectingFactoryTargets] and has a chance to be completed
/// during the next invocation. If [allowFurtherDelays] is set to `false`,
/// the resolution of redirecting factories is assumed to be final and the
/// function throws an internal exception in case if any of the resolutions
/// can't be completed.
void _resolveRedirectingFactoryTargets(
List<FactoryConstructorInvocation> redirectingFactoryInvocations,
{required bool allowFurtherDelays}) {
List<FactoryConstructorInvocation> invocations =
redirectingFactoryInvocations.toList();
redirectingFactoryInvocations.clear();
for (FactoryConstructorInvocation invocation in invocations) {
// If the invocation was invalid, it or its parent has already been
// desugared into an exception throwing expression. There is nothing to
// resolve anymore. Note that in the case where the invocation's parent
// was invalid, type inference won't reach the invocation node and won't
// set its inferredType field. If type inference is disabled, reach to
// the outermost parent to check if the node is a dead code.
if (invocation.parent == null) continue;
if (!invocation.hasBeenInferred) {
if (allowFurtherDelays) {
delayedRedirectingFactoryInvocations.add(invocation);
}
continue;
}
Expression? replacement = _resolveRedirectingFactoryTarget(
invocation.target,
invocation.arguments,
invocation.fileOffset,
invocation.isConst);
if (replacement == null) {
delayedRedirectingFactoryInvocations.add(invocation);
} else {
invocation.parent?.replaceChild(invocation, replacement);
}
}
}
void _unaliasTypeAliasedConstructorInvocations(
List<TypeAliasedConstructorInvocation>
typeAliasedConstructorInvocations) {
List<TypeAliasedConstructorInvocation> invocations = [
...typeAliasedConstructorInvocations
];
typeAliasedConstructorInvocations.clear();
for (TypeAliasedConstructorInvocation invocation in invocations) {
assert(invocation.hasBeenInferred || isOrphaned(invocation),
"Node $invocation has not been inferred.");
Expression? replacement;
if (invocation.hasBeenInferred) {
bool inferred = !hasExplicitTypeArguments(invocation.arguments);
DartType aliasedType = new TypedefType(
invocation.typeAliasBuilder.typedef,
Nullability.nonNullable,
invocation.arguments.types);
libraryBuilder.checkBoundsInType(
aliasedType, typeEnvironment, uri, invocation.fileOffset,
allowSuperBounded: false, inferred: inferred);
DartType unaliasedType = aliasedType.unalias;
List<DartType>? invocationTypeArguments = null;
if (unaliasedType is InterfaceType) {
invocationTypeArguments = unaliasedType.typeArguments;
}
Arguments invocationArguments = forest.createArguments(
noLocation, invocation.arguments.positional,
types: invocationTypeArguments, named: invocation.arguments.named);
replacement = new ConstructorInvocation(
invocation.target, invocationArguments,
isConst: invocation.isConst);
}
if (replacement == null) {
delayedTypeAliasedConstructorInvocations.add(invocation);
} else {
invocation.parent?.replaceChild(invocation, replacement);
}
}
typeAliasedConstructorInvocations.clear();
}
void _unaliasTypeAliasedFactoryInvocations(
List<TypeAliasedFactoryInvocation> typeAliasedFactoryInvocations) {
List<TypeAliasedFactoryInvocation> invocations =
typeAliasedFactoryInvocations.toList();
typeAliasedFactoryInvocations.clear();
for (TypeAliasedFactoryInvocation invocation in invocations) {
assert(invocation.hasBeenInferred || isOrphaned(invocation),
"Node $invocation has not been inferred.");
Expression? replacement;
if (invocation.hasBeenInferred) {
bool inferred = !hasExplicitTypeArguments(invocation.arguments);
DartType aliasedType = new TypedefType(
invocation.typeAliasBuilder.typedef,
Nullability.nonNullable,
invocation.arguments.types);
libraryBuilder.checkBoundsInType(
aliasedType, typeEnvironment, uri, invocation.fileOffset,
allowSuperBounded: false, inferred: inferred);
DartType unaliasedType = aliasedType.unalias;
List<DartType>? invocationTypeArguments = null;
if (unaliasedType is TypeDeclarationType) {
invocationTypeArguments = unaliasedType.typeArguments;
}
Arguments invocationArguments = forest.createArguments(
noLocation, invocation.arguments.positional,
types: invocationTypeArguments,
named: invocation.arguments.named,
hasExplicitTypeArguments:
hasExplicitTypeArguments(invocation.arguments));
replacement = _resolveRedirectingFactoryTarget(invocation.target,
invocationArguments, invocation.fileOffset, invocation.isConst);
}
if (replacement == null) {
delayedTypeAliasedFactoryInvocations.add(invocation);
} else {
invocation.parent?.replaceChild(invocation, replacement);
}
}
typeAliasedFactoryInvocations.clear();
}
/// Perform actions that were delayed
///
/// An action can be delayed, for instance, because it depends on some
/// calculations in another library. For example, a resolution of a
/// redirecting factory invocation depends on the type inference in the
/// redirecting factory.
@override @override
void performDelayedActions({required bool allowFurtherDelays}) { Expression unaliasSingleTypeAliasedConstructorInvocation(
if (delayedRedirectingFactoryInvocations.isNotEmpty) { TypeAliasedConstructorInvocation invocation) {
_resolveRedirectingFactoryTargets(delayedRedirectingFactoryInvocations, bool inferred = !hasExplicitTypeArguments(invocation.arguments);
allowFurtherDelays: allowFurtherDelays); DartType aliasedType = new TypedefType(invocation.typeAliasBuilder.typedef,
if (delayedRedirectingFactoryInvocations.isNotEmpty) { Nullability.nonNullable, invocation.arguments.types);
for (StaticInvocation invocation libraryBuilder.checkBoundsInType(
in delayedRedirectingFactoryInvocations) { aliasedType, typeEnvironment, uri, invocation.fileOffset,
internalProblem( allowSuperBounded: false, inferred: inferred);
fasta.templateInternalProblemUnhandled.withArguments( DartType unaliasedType = aliasedType.unalias;
invocation.target.name.text, 'performDelayedActions'), List<DartType>? invocationTypeArguments = null;
invocation.fileOffset, if (unaliasedType is InterfaceType) {
uri); invocationTypeArguments = unaliasedType.typeArguments;
}
}
}
if (delayedTypeAliasedFactoryInvocations.isNotEmpty) {
_unaliasTypeAliasedFactoryInvocations(
delayedTypeAliasedFactoryInvocations);
if (delayedTypeAliasedFactoryInvocations.isNotEmpty) {
for (StaticInvocation invocation
in delayedTypeAliasedFactoryInvocations) {
internalProblem(
fasta.templateInternalProblemUnhandled.withArguments(
invocation.target.name.text, 'performDelayedActions'),
invocation.fileOffset,
uri);
}
}
}
if (delayedTypeAliasedConstructorInvocations.isNotEmpty) {
_unaliasTypeAliasedConstructorInvocations(
delayedTypeAliasedConstructorInvocations);
if (delayedTypeAliasedConstructorInvocations.isNotEmpty) {
for (ConstructorInvocation invocation
in delayedTypeAliasedConstructorInvocations) {
internalProblem(
fasta.templateInternalProblemUnhandled.withArguments(
invocation.target.name.text, 'performDelayedActions'),
invocation.fileOffset,
uri);
}
}
} }
Arguments invocationArguments = forest.createArguments(
noLocation, invocation.arguments.positional,
types: invocationTypeArguments, named: invocation.arguments.named);
return new ConstructorInvocation(invocation.target, invocationArguments,
isConst: invocation.isConst);
} }
bool get hasDelayedActions { @override
return delayedRedirectingFactoryInvocations.isNotEmpty || Expression? unaliasSingleTypeAliasedFactoryInvocation(
delayedTypeAliasedFactoryInvocations.isNotEmpty || TypeAliasedFactoryInvocation invocation) {
delayedTypeAliasedConstructorInvocations.isNotEmpty; bool inferred = !hasExplicitTypeArguments(invocation.arguments);
DartType aliasedType = new TypedefType(invocation.typeAliasBuilder.typedef,
Nullability.nonNullable, invocation.arguments.types);
libraryBuilder.checkBoundsInType(
aliasedType, typeEnvironment, uri, invocation.fileOffset,
allowSuperBounded: false, inferred: inferred);
DartType unaliasedType = aliasedType.unalias;
List<DartType>? invocationTypeArguments = null;
if (unaliasedType is TypeDeclarationType) {
invocationTypeArguments = unaliasedType.typeArguments;
}
Arguments invocationArguments = forest.createArguments(
noLocation, invocation.arguments.positional,
types: invocationTypeArguments,
named: invocation.arguments.named,
hasExplicitTypeArguments:
hasExplicitTypeArguments(invocation.arguments));
return resolveRedirectingFactoryTarget(invocation.target,
invocationArguments, invocation.fileOffset, invocation.isConst);
} }
void _finishVariableMetadata() { void _finishVariableMetadata() {
@ -1849,13 +1538,12 @@ class BodyBuilder extends StackListenerImpl
} else { } else {
temporaryParent = new ListLiteral(expressions); temporaryParent = new ListLiteral(expressions);
} }
performBacklogComputations(allowFurtherDelays: false); performBacklogComputations();
return temporaryParent != null ? temporaryParent.expressions : expressions; return temporaryParent != null ? temporaryParent.expressions : expressions;
} }
Expression parseSingleExpression( Expression parseSingleExpression(
Parser parser, Token token, FunctionNode parameters) { Parser parser, Token token, FunctionNode parameters) {
assert(redirectingFactoryInvocations.isEmpty);
int fileOffset = offsetForToken(token); int fileOffset = offsetForToken(token);
List<NominalVariableBuilder>? typeParameterBuilders; List<NominalVariableBuilder>? typeParameterBuilders;
for (TypeParameter typeParameter in parameters.typeParameters) { for (TypeParameter typeParameter in parameters.typeParameters) {
@ -1926,7 +1614,7 @@ class BodyBuilder extends StackListenerImpl
"Previously implicit assumption about inferFunctionBody " "Previously implicit assumption about inferFunctionBody "
"not returning anything different."); "not returning anything different.");
performBacklogComputations(allowFurtherDelays: false); performBacklogComputations();
return fakeReturn.expression!; return fakeReturn.expression!;
} }
@ -5577,7 +5265,6 @@ class BodyBuilder extends StackListenerImpl
super.push(constantContext); super.push(constantContext);
_insideOfFormalParameterType = false; _insideOfFormalParameterType = false;
constantContext = ConstantContext.required; constantContext = ConstantContext.required;
_defaultValueNestingLevel++;
} }
@override @override
@ -5586,7 +5273,6 @@ class BodyBuilder extends StackListenerImpl
Object? defaultValueExpression = pop(); Object? defaultValueExpression = pop();
constantContext = pop() as ConstantContext; constantContext = pop() as ConstantContext;
push(defaultValueExpression); push(defaultValueExpression);
_defaultValueNestingLevel--;
} }
@override @override
@ -6062,17 +5748,12 @@ class BodyBuilder extends StackListenerImpl
libraryBuilder.checkBoundsInConstructorInvocation( libraryBuilder.checkBoundsInConstructorInvocation(
node, typeEnvironment, uri); node, typeEnvironment, uri);
} else { } else {
TypeAliasedConstructorInvocation typeAliasedConstructorInvocation = node = new TypeAliasedConstructorInvocation(
node = new TypeAliasedConstructorInvocation( typeAliasBuilder, target, arguments,
typeAliasBuilder, target, arguments, isConst: isConst)
isConst: isConst) ..fileOffset = charOffset;
..fileOffset = charOffset;
// No type arguments were passed, so we need not check bounds. // No type arguments were passed, so we need not check bounds.
assert(arguments.types.isEmpty); assert(arguments.types.isEmpty);
if (_createdStaticInvocationsNeedPostProcessing) {
typeAliasedConstructorInvocations
.add(typeAliasedConstructorInvocation);
}
} }
return node; return node;
} else { } else {
@ -6103,9 +5784,6 @@ class BodyBuilder extends StackListenerImpl
libraryBuilder.checkBoundsInFactoryInvocation( libraryBuilder.checkBoundsInFactoryInvocation(
factoryConstructorInvocation, typeEnvironment, uri, factoryConstructorInvocation, typeEnvironment, uri,
inferred: !hasExplicitTypeArguments(arguments)); inferred: !hasExplicitTypeArguments(arguments));
if (_createdStaticInvocationsNeedPostProcessing) {
redirectingFactoryInvocations.add(factoryConstructorInvocation);
}
node = factoryConstructorInvocation; node = factoryConstructorInvocation;
} else { } else {
TypeAliasedFactoryInvocation typeAliasedFactoryInvocation = TypeAliasedFactoryInvocation typeAliasedFactoryInvocation =
@ -6115,9 +5793,6 @@ class BodyBuilder extends StackListenerImpl
..fileOffset = charOffset; ..fileOffset = charOffset;
// No type arguments were passed, so we need not check bounds. // No type arguments were passed, so we need not check bounds.
assert(arguments.types.isEmpty); assert(arguments.types.isEmpty);
if (_createdStaticInvocationsNeedPostProcessing) {
typeAliasedFactoryInvocations.add(typeAliasedFactoryInvocation);
}
node = typeAliasedFactoryInvocation; node = typeAliasedFactoryInvocation;
} }
return node; return node;
@ -10220,14 +9895,12 @@ class _BodyBuilderCloner extends CloneVisitorNotMembers {
node.target, clone(node.arguments), node.target, clone(node.arguments),
isConst: node.isConst) isConst: node.isConst)
..hasBeenInferred = node.hasBeenInferred; ..hasBeenInferred = node.hasBeenInferred;
bodyBuilder.redirectingFactoryInvocations.add(result);
return result; return result;
} else if (node is TypeAliasedFactoryInvocation) { } else if (node is TypeAliasedFactoryInvocation) {
TypeAliasedFactoryInvocation result = new TypeAliasedFactoryInvocation( TypeAliasedFactoryInvocation result = new TypeAliasedFactoryInvocation(
node.typeAliasBuilder, node.target, clone(node.arguments), node.typeAliasBuilder, node.target, clone(node.arguments),
isConst: node.isConst) isConst: node.isConst)
..hasBeenInferred = node.hasBeenInferred; ..hasBeenInferred = node.hasBeenInferred;
bodyBuilder.typeAliasedFactoryInvocations.add(result);
return result; return result;
} }
return super.visitStaticInvocation(node); return super.visitStaticInvocation(node);
@ -10241,7 +9914,6 @@ class _BodyBuilderCloner extends CloneVisitorNotMembers {
node.typeAliasBuilder, node.target, clone(node.arguments), node.typeAliasBuilder, node.target, clone(node.arguments),
isConst: node.isConst) isConst: node.isConst)
..hasBeenInferred = node.hasBeenInferred; ..hasBeenInferred = node.hasBeenInferred;
bodyBuilder.typeAliasedConstructorInvocations.add(result);
return result; return result;
} }
return super.visitConstructorInvocation(node); return super.visitConstructorInvocation(node);

View file

@ -542,6 +542,13 @@ class KernelTarget {
?.enterPhase(BenchmarkPhases.outline_computeFieldPromotability); ?.enterPhase(BenchmarkPhases.outline_computeFieldPromotability);
loader.computeFieldPromotability(); loader.computeFieldPromotability();
benchmarker?.enterPhase(
BenchmarkPhases.outline_performRedirectingFactoryInference);
// TODO(johnniwinther): Add an interface for registering delayed actions.
List<DelayedDefaultValueCloner> delayedDefaultValueCloners = [];
loader.inferRedirectingFactories(
loader.hierarchy, delayedDefaultValueCloners);
benchmarker?.enterPhase(BenchmarkPhases.outline_performTopLevelInference); benchmarker?.enterPhase(BenchmarkPhases.outline_performTopLevelInference);
loader.performTopLevelInference(sortedSourceClassBuilders); loader.performTopLevelInference(sortedSourceClassBuilders);
@ -555,8 +562,6 @@ class KernelTarget {
loader.checkMixins(sortedSourceClassBuilders); loader.checkMixins(sortedSourceClassBuilders);
benchmarker?.enterPhase(BenchmarkPhases.outline_buildOutlineExpressions); benchmarker?.enterPhase(BenchmarkPhases.outline_buildOutlineExpressions);
// TODO(johnniwinther): Add an interface for registering delayed actions.
List<DelayedDefaultValueCloner> delayedDefaultValueCloners = [];
loader.buildOutlineExpressions( loader.buildOutlineExpressions(
loader.hierarchy, delayedDefaultValueCloners); loader.hierarchy, delayedDefaultValueCloners);
delayedDefaultValueCloners.forEach(registerDelayedDefaultValueCloner); delayedDefaultValueCloners.forEach(registerDelayedDefaultValueCloner);

View file

@ -26,7 +26,6 @@ import 'source/source_extension_type_declaration_builder.dart';
import 'source/source_function_builder.dart'; import 'source/source_function_builder.dart';
import 'source/source_library_builder.dart'; import 'source/source_library_builder.dart';
import 'source/source_member_builder.dart'; import 'source/source_member_builder.dart';
import 'util/helpers.dart' show DelayedActionPerformer;
enum ScopeKind { enum ScopeKind {
/// Scope of pattern switch-case statements /// Scope of pattern switch-case statements
@ -1001,9 +1000,7 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder {
ProcedureKind? get kind => null; ProcedureKind? get kind => null;
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
throw new UnsupportedError('$runtimeType.buildOutlineExpressions'); throw new UnsupportedError('$runtimeType.buildOutlineExpressions');
} }

View file

@ -20,7 +20,6 @@ import '../kernel/kernel_helper.dart';
import '../messages.dart'; import '../messages.dart';
import '../problems.dart'; import '../problems.dart';
import '../scope.dart'; import '../scope.dart';
import '../util/helpers.dart';
import 'source_constructor_builder.dart'; import 'source_constructor_builder.dart';
import 'source_field_builder.dart'; import 'source_field_builder.dart';
import 'source_library_builder.dart'; import 'source_library_builder.dart';
@ -147,9 +146,7 @@ mixin SourceDeclarationBuilderMixin implements DeclarationBuilderMixin {
required bool inMetadata, required bool inMetadata,
required bool inConstFields}); required bool inConstFields});
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
MetadataBuilder.buildAnnotations( MetadataBuilder.buildAnnotations(
annotatable, annotatable,
@ -170,7 +167,6 @@ mixin SourceDeclarationBuilderMixin implements DeclarationBuilderMixin {
inMetadata: true, inMetadata: true,
inConstFields: false), inConstFields: false),
classHierarchy, classHierarchy,
delayedActionPerformers,
scope.parent!); scope.parent!);
} }
} }
@ -178,8 +174,8 @@ mixin SourceDeclarationBuilderMixin implements DeclarationBuilderMixin {
Iterator<SourceMemberBuilder> iterator = scope.filteredIterator( Iterator<SourceMemberBuilder> iterator = scope.filteredIterator(
parent: this, includeDuplicates: false, includeAugmentations: true); parent: this, includeDuplicates: false, includeAugmentations: true);
while (iterator.moveNext()) { while (iterator.moveNext()) {
iterator.current.buildOutlineExpressions( iterator.current
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners); .buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
} }
} }

View file

@ -43,7 +43,6 @@ import '../kernel/type_algorithms.dart' show computeTypeVariableBuilderVariance;
import '../kernel/utils.dart' show compareProcedures; import '../kernel/utils.dart' show compareProcedures;
import '../problems.dart' show unexpected, unhandled, unimplemented; import '../problems.dart' show unexpected, unhandled, unimplemented;
import '../scope.dart'; import '../scope.dart';
import '../util/helpers.dart';
import 'class_declaration.dart'; import 'class_declaration.dart';
import 'source_builder_mixins.dart'; import 'source_builder_mixins.dart';
import 'source_constructor_builder.dart'; import 'source_constructor_builder.dart';
@ -344,14 +343,12 @@ class SourceClassBuilder extends ClassBuilderImpl
inConstFields: inConstFields); inConstFields: inConstFields);
} }
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
void build(Builder declaration) { void build(Builder declaration) {
SourceMemberBuilder member = declaration as SourceMemberBuilder; SourceMemberBuilder member = declaration as SourceMemberBuilder;
member.buildOutlineExpressions( member.buildOutlineExpressions(
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} }
MetadataBuilder.buildAnnotations( MetadataBuilder.buildAnnotations(
@ -374,7 +371,6 @@ class SourceClassBuilder extends ClassBuilderImpl
inMetadata: true, inMetadata: true,
inConstFields: false), inConstFields: false),
classHierarchy, classHierarchy,
delayedActionPerformers,
scope.parent!); scope.parent!);
} }
} }

View file

@ -49,7 +49,6 @@ import '../source/source_loader.dart' show SourceLoader;
import '../source/source_member_builder.dart'; import '../source/source_member_builder.dart';
import '../type_inference/inference_results.dart'; import '../type_inference/inference_results.dart';
import '../type_inference/type_schema.dart'; import '../type_inference/type_schema.dart';
import '../util/helpers.dart' show DelayedActionPerformer;
import 'constructor_declaration.dart'; import 'constructor_declaration.dart';
import 'name_scheme.dart'; import 'name_scheme.dart';
import 'source_extension_type_declaration_builder.dart'; import 'source_extension_type_declaration_builder.dart';
@ -299,9 +298,7 @@ abstract class AbstractSourceConstructorBuilder
} }
void _buildConstructorForOutline( void _buildConstructorForOutline(
Token? beginInitializers, Token? beginInitializers, Scope declarationScope) {
List<DelayedActionPerformer> delayedActionPerformers,
Scope declarationScope) {
if (beginInitializers != null) { if (beginInitializers != null) {
final Scope? formalParameterScope; final Scope? formalParameterScope;
if (isConst) { if (isConst) {
@ -327,9 +324,7 @@ abstract class AbstractSourceConstructorBuilder
} }
bodyBuilder.parseInitializers(beginInitializers, bodyBuilder.parseInitializers(beginInitializers,
doFinishConstructor: isConst); doFinishConstructor: isConst);
bodyBuilder.performBacklogComputations( bodyBuilder.performBacklogComputations();
delayedActionPerformers: delayedActionPerformers,
allowFurtherDelays: false);
} }
} }
@ -800,24 +795,20 @@ class DeclaredSourceConstructorBuilder
bool _hasBuiltOutlines = false; bool _hasBuiltOutlines = false;
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
if (_hasBuiltOutlines) return; if (_hasBuiltOutlines) return;
if (isConst && isAugmenting) { if (isConst && isAugmenting) {
origin.buildOutlineExpressions( origin.buildOutlineExpressions(
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} }
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
// For modular compilation purposes we need to include initializers // For modular compilation purposes we need to include initializers
// for const constructors into the outline. We also need to parse // for const constructors into the outline. We also need to parse
// initializers to infer types of the super-initializing parameters. // initializers to infer types of the super-initializing parameters.
if (isConst || _hasSuperInitializingFormals) { if (isConst || _hasSuperInitializingFormals) {
_buildConstructorForOutline( _buildConstructorForOutline(beginInitializers, classBuilder.scope);
beginInitializers, delayedActionPerformers, classBuilder.scope);
} }
addSuperParameterDefaultValueCloners(delayedDefaultValueCloners); addSuperParameterDefaultValueCloners(delayedDefaultValueCloners);
if (isConst && isAugmenting) { if (isConst && isAugmenting) {
@ -1044,9 +1035,7 @@ class SyntheticSourceConstructorBuilder extends DillConstructorBuilder
} }
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
if (_immediatelyDefiningConstructor != null) { if (_immediatelyDefiningConstructor != null) {
// Ensure that default value expressions have been created for [_origin]. // Ensure that default value expressions have been created for [_origin].
@ -1054,8 +1043,8 @@ class SyntheticSourceConstructorBuilder extends DillConstructorBuilder
// values and initializers first. // values and initializers first.
MemberBuilder origin = _immediatelyDefiningConstructor!; MemberBuilder origin = _immediatelyDefiningConstructor!;
if (origin is SourceConstructorBuilder) { if (origin is SourceConstructorBuilder) {
origin.buildOutlineExpressions(classHierarchy, delayedActionPerformers, origin.buildOutlineExpressions(
delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} }
addSuperParameterDefaultValueCloners(delayedDefaultValueCloners); addSuperParameterDefaultValueCloners(delayedDefaultValueCloners);
_immediatelyDefiningConstructor = null; _immediatelyDefiningConstructor = null;
@ -1198,20 +1187,16 @@ class SourceExtensionTypeConstructorBuilder
} }
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
if (isConst) { if (isConst) {
// For modular compilation purposes we need to include initializers // For modular compilation purposes we need to include initializers
// for const constructors into the outline. // for const constructors into the outline.
Scope typeParameterScope = Scope typeParameterScope =
computeTypeParameterScope(extensionTypeDeclarationBuilder.scope); computeTypeParameterScope(extensionTypeDeclarationBuilder.scope);
_buildConstructorForOutline( _buildConstructorForOutline(beginInitializers, typeParameterScope);
beginInitializers, delayedActionPerformers, typeParameterScope);
_buildBody(); _buildBody();
} }
beginInitializers = null; beginInitializers = null;

View file

@ -53,7 +53,6 @@ import '../modifier.dart' show constMask, hasInitializerMask, staticMask;
import '../scope.dart'; import '../scope.dart';
import '../type_inference/inference_results.dart'; import '../type_inference/inference_results.dart';
import '../type_inference/type_schema.dart'; import '../type_inference/type_schema.dart';
import '../util/helpers.dart';
import 'name_scheme.dart'; import 'name_scheme.dart';
import 'source_class_builder.dart' show SourceClassBuilder; import 'source_class_builder.dart' show SourceClassBuilder;
import 'source_constructor_builder.dart'; import 'source_constructor_builder.dart';
@ -81,8 +80,6 @@ class SourceEnumBuilder extends SourceClassBuilder {
final Set<SourceFieldBuilder> _builtElements = final Set<SourceFieldBuilder> _builtElements =
new Set<SourceFieldBuilder>.identity(); new Set<SourceFieldBuilder>.identity();
final List<DelayedActionPerformer> _delayedActionPerformers = [];
SourceEnumBuilder.internal( SourceEnumBuilder.internal(
List<MetadataBuilder>? metadata, List<MetadataBuilder>? metadata,
String name, String name,
@ -745,9 +742,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
// redirecting factories can't be completed at this moment and // redirecting factories can't be completed at this moment and
// therefore should be delayed to another invocation of // therefore should be delayed to another invocation of
// [BodyBuilder.performBacklogComputations]. // [BodyBuilder.performBacklogComputations].
bodyBuilder.performBacklogComputations( bodyBuilder.performBacklogComputations();
delayedActionPerformers: _delayedActionPerformers,
allowFurtherDelays: true);
arguments.positional.insertAll(0, enumSyntheticArguments); arguments.positional.insertAll(0, enumSyntheticArguments);
arguments.argumentsOriginalOrder?.insertAll(0, enumSyntheticArguments); arguments.argumentsOriginalOrder?.insertAll(0, enumSyntheticArguments);
@ -821,9 +816,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
} }
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
List<Expression> values = <Expression>[]; List<Expression> values = <Expression>[];
if (enumConstantInfos != null) { if (enumConstantInfos != null) {
@ -850,8 +843,6 @@ class SourceEnumBuilder extends SourceClassBuilder {
elementBuilder.type.registerInferredType( elementBuilder.type.registerInferredType(
buildElement(elementBuilder, classHierarchy.coreTypes)); buildElement(elementBuilder, classHierarchy.coreTypes));
} }
delayedActionPerformers.addAll(_delayedActionPerformers);
_delayedActionPerformers.clear();
SourceProcedureBuilder toStringBuilder = SourceProcedureBuilder toStringBuilder =
firstMemberNamed("_enumToString") as SourceProcedureBuilder; firstMemberNamed("_enumToString") as SourceProcedureBuilder;
@ -887,8 +878,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
])); ]));
} }
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
} }
} }

View file

@ -28,7 +28,6 @@ import '../messages.dart';
import '../problems.dart'; import '../problems.dart';
import '../scope.dart'; import '../scope.dart';
import '../type_inference/type_inference_engine.dart'; import '../type_inference/type_inference_engine.dart';
import '../util/helpers.dart';
import 'class_declaration.dart'; import 'class_declaration.dart';
import 'source_builder_mixins.dart'; import 'source_builder_mixins.dart';
import 'source_constructor_builder.dart'; import 'source_constructor_builder.dart';
@ -557,18 +556,15 @@ class SourceExtensionTypeDeclarationBuilder
} }
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
Iterator<SourceMemberBuilder> iterator = constructorScope.filteredIterator( Iterator<SourceMemberBuilder> iterator = constructorScope.filteredIterator(
parent: this, includeDuplicates: false, includeAugmentations: true); parent: this, includeDuplicates: false, includeAugmentations: true);
while (iterator.moveNext()) { while (iterator.moveNext()) {
iterator.current.buildOutlineExpressions( iterator.current
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners); .buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
} }
} }

View file

@ -13,6 +13,7 @@ import '../builder/declaration_builders.dart';
import '../builder/formal_parameter_builder.dart'; import '../builder/formal_parameter_builder.dart';
import '../builder/function_builder.dart'; import '../builder/function_builder.dart';
import '../builder/metadata_builder.dart'; import '../builder/metadata_builder.dart';
import '../builder/omitted_type_builder.dart';
import '../builder/type_builder.dart'; import '../builder/type_builder.dart';
import '../codes/fasta_codes.dart'; import '../codes/fasta_codes.dart';
import '../dill/dill_extension_type_member_builder.dart'; import '../dill/dill_extension_type_member_builder.dart';
@ -35,7 +36,6 @@ import '../scope.dart';
import '../type_inference/inference_helper.dart'; import '../type_inference/inference_helper.dart';
import '../type_inference/type_inferrer.dart'; import '../type_inference/type_inferrer.dart';
import '../type_inference/type_schema.dart'; import '../type_inference/type_schema.dart';
import '../util/helpers.dart';
import 'name_scheme.dart'; import 'name_scheme.dart';
import 'redirecting_factory_body.dart'; import 'redirecting_factory_body.dart';
import 'source_class_builder.dart'; import 'source_class_builder.dart';
@ -197,16 +197,13 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl {
bool _hasBuiltOutlines = false; bool _hasBuiltOutlines = false;
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
if (_hasBuiltOutlines) return; if (_hasBuiltOutlines) return;
if (_delayedDefaultValueCloner != null) { if (_delayedDefaultValueCloner != null) {
delayedDefaultValueCloners.add(_delayedDefaultValueCloner!); delayedDefaultValueCloners.add(_delayedDefaultValueCloner!);
} }
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
_hasBuiltOutlines = true; _hasBuiltOutlines = true;
} }
@ -475,20 +472,21 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
bool _hasBuiltOutlines = false; bool _hasBuiltOutlines = false;
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
if (_hasBuiltOutlines) return; if (_hasBuiltOutlines) return;
if (isConst && isAugmenting) { if (isConst && isAugmenting) {
origin.buildOutlineExpressions( origin.buildOutlineExpressions(
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} }
super.buildOutlineExpressions( super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners);
classHierarchy, delayedActionPerformers, delayedDefaultValueCloners);
RedirectingFactoryTarget redirectingFactoryTarget = RedirectingFactoryTarget? redirectingFactoryTarget =
_procedureInternal.function.redirectingFactoryTarget!; _procedureInternal.function.redirectingFactoryTarget;
if (redirectingFactoryTarget == null) {
// The error is reported elsewhere.
return;
}
List<DartType>? typeArguments = redirectingFactoryTarget.typeArguments; List<DartType>? typeArguments = redirectingFactoryTarget.typeArguments;
Member? target = redirectingFactoryTarget.target; Member? target = redirectingFactoryTarget.target;
if (typeArguments != null && typeArguments.any((t) => t is UnknownType)) { if (typeArguments != null && typeArguments.any((t) => t is UnknownType)) {
@ -507,8 +505,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
Builder? targetBuilder = redirectionTarget.target; Builder? targetBuilder = redirectionTarget.target;
if (targetBuilder is SourceMemberBuilder) { if (targetBuilder is SourceMemberBuilder) {
// Ensure that target has been built. // Ensure that target has been built.
targetBuilder.buildOutlineExpressions(classHierarchy, targetBuilder.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} }
if (targetBuilder is FunctionBuilder) { if (targetBuilder is FunctionBuilder) {
target = targetBuilder.member; target = targetBuilder.member;
@ -518,6 +516,23 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
unhandled("${targetBuilder.runtimeType}", "buildOutlineExpressions", unhandled("${targetBuilder.runtimeType}", "buildOutlineExpressions",
charOffset, fileUri); charOffset, fileUri);
} }
// Type arguments for the targets of redirecting factories can only be
// inferred if the formal parameters of the targets are inferred too.
// That may not be the case when the target's parameters are initializing
// parameters referring to fields with types that are to be inferred.
if (targetBuilder is SourceFunctionBuilderImpl) {
List<FormalParameterBuilder>? formals = targetBuilder.formals;
if (formals != null) {
for (FormalParameterBuilder formal in formals) {
TypeBuilder formalType = formal.type;
if (formalType is InferableTypeBuilder) {
formalType.inferType(classHierarchy);
}
}
}
}
typeArguments = inferrer.inferRedirectingFactoryTypeArguments( typeArguments = inferrer.inferRedirectingFactoryTypeArguments(
helper, helper,
_procedureInternal.function.returnType, _procedureInternal.function.returnType,

View file

@ -38,7 +38,6 @@ import '../source/source_extension_builder.dart';
import '../source/source_library_builder.dart' show SourceLibraryBuilder; import '../source/source_library_builder.dart' show SourceLibraryBuilder;
import '../type_inference/type_inference_engine.dart' import '../type_inference/type_inference_engine.dart'
show IncludesTypeParametersNonCovariantly; show IncludesTypeParametersNonCovariantly;
import '../util/helpers.dart' show DelayedActionPerformer;
import 'source_class_builder.dart'; import 'source_class_builder.dart';
import 'source_extension_type_declaration_builder.dart'; import 'source_extension_type_declaration_builder.dart';
import 'source_member_builder.dart'; import 'source_member_builder.dart';
@ -447,9 +446,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl
Iterable<Annotatable> get annotatables => _fieldEncoding.annotatables; Iterable<Annotatable> get annotatables => _fieldEncoding.annotatables;
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
for (Annotatable annotatable in annotatables) { for (Annotatable annotatable in annotatables) {
MetadataBuilder.buildAnnotations( MetadataBuilder.buildAnnotations(
@ -490,9 +487,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl
bodyBuilder.parseFieldInitializer(_constInitializerToken!)) bodyBuilder.parseFieldInitializer(_constInitializerToken!))
.expression; .expression;
buildBody(classHierarchy.coreTypes, initializer); buildBody(classHierarchy.coreTypes, initializer);
bodyBuilder.performBacklogComputations( bodyBuilder.performBacklogComputations();
delayedActionPerformers: delayedActionPerformers,
allowFurtherDelays: false);
} }
_constInitializerToken = null; _constInitializerToken = null;
} }

View file

@ -33,7 +33,6 @@ import '../scope.dart';
import '../source/source_loader.dart' show SourceLoader; import '../source/source_loader.dart' show SourceLoader;
import '../type_inference/type_inference_engine.dart' import '../type_inference/type_inference_engine.dart'
show IncludesTypeParametersNonCovariantly; show IncludesTypeParametersNonCovariantly;
import '../util/helpers.dart' show DelayedActionPerformer;
import 'source_builder_mixins.dart'; import 'source_builder_mixins.dart';
import 'source_extension_type_declaration_builder.dart'; import 'source_extension_type_declaration_builder.dart';
import 'source_member_builder.dart'; import 'source_member_builder.dart';
@ -476,9 +475,7 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl
} }
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
if (!hasBuiltOutlineExpressions) { if (!hasBuiltOutlineExpressions) {
DeclarationBuilder? classOrExtensionBuilder = DeclarationBuilder? classOrExtensionBuilder =
@ -509,7 +506,6 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl
inMetadata: true, inMetadata: true,
inConstFields: false), inConstFields: false),
classHierarchy, classHierarchy,
delayedActionPerformers,
computeTypeParameterScope(parentScope)); computeTypeParameterScope(parentScope));
} }
} }
@ -520,8 +516,7 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl
// buildOutlineExpressions to clear initializerToken to prevent // buildOutlineExpressions to clear initializerToken to prevent
// consuming too much memory. // consuming too much memory.
for (FormalParameterBuilder formal in formals!) { for (FormalParameterBuilder formal in formals!) {
formal.buildOutlineExpressions( formal.buildOutlineExpressions(libraryBuilder);
libraryBuilder, delayedActionPerformers);
} }
} }
hasBuiltOutlineExpressions = true; hasBuiltOutlineExpressions = true;

View file

@ -103,7 +103,6 @@ import '../modifier.dart'
import '../problems.dart' show unexpected, unhandled; import '../problems.dart' show unexpected, unhandled;
import '../scope.dart'; import '../scope.dart';
import '../uris.dart'; import '../uris.dart';
import '../util/helpers.dart';
import 'class_declaration.dart'; import 'class_declaration.dart';
import 'name_scheme.dart'; import 'name_scheme.dart';
import 'offset_map.dart'; import 'offset_map.dart';
@ -1963,6 +1962,8 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
procedureNameScheme, procedureNameScheme,
nativeMethodName, nativeMethodName,
redirectionTarget); redirectionTarget);
(sourceLibraryBuilder.redirectingFactoryBuilders ??= [])
.add(procedureBuilder as RedirectingFactoryBuilder);
} else { } else {
procedureBuilder = new SourceFactoryBuilder( procedureBuilder = new SourceFactoryBuilder(
metadata, metadata,
@ -2777,6 +2778,13 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
/// if [SourceLoader.computeFieldPromotability] hasn't been called. /// if [SourceLoader.computeFieldPromotability] hasn't been called.
FieldNonPromotabilityInfo? fieldNonPromotabilityInfo; FieldNonPromotabilityInfo? fieldNonPromotabilityInfo;
/// Redirecting factory builders defined in the library. They should be
/// collected as they are built, so that we can build the outline expressions
/// in the right order.
///
/// See [SourceLoader.buildOutlineExpressions] for details.
List<RedirectingFactoryBuilder>? redirectingFactoryBuilders;
SourceLibraryBuilder.internal( SourceLibraryBuilder.internal(
SourceLoader loader, SourceLoader loader,
Uri importUri, Uri importUri,
@ -4013,16 +4021,14 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
inConstFields: inConstFields); inConstFields: inConstFields);
} }
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy, List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
List<DelayedDefaultValueCloner> delayedDefaultValueCloners,
List<DelayedActionPerformer> delayedActionPerformers) {
Iterable<SourceLibraryBuilder>? augmentationLibraries = Iterable<SourceLibraryBuilder>? augmentationLibraries =
this.augmentationLibraries; this.augmentationLibraries;
if (augmentationLibraries != null) { if (augmentationLibraries != null) {
for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) {
augmentationLibrary.buildOutlineExpressions(classHierarchy, augmentationLibrary.buildOutlineExpressions(
delayedDefaultValueCloners, delayedActionPerformers); classHierarchy, delayedDefaultValueCloners);
} }
} }
@ -4042,20 +4048,20 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
while (iterator.moveNext()) { while (iterator.moveNext()) {
Builder declaration = iterator.current; Builder declaration = iterator.current;
if (declaration is SourceClassBuilder) { if (declaration is SourceClassBuilder) {
declaration.buildOutlineExpressions(classHierarchy, declaration.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} else if (declaration is SourceExtensionBuilder) { } else if (declaration is SourceExtensionBuilder) {
declaration.buildOutlineExpressions(classHierarchy, declaration.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} else if (declaration is SourceExtensionTypeDeclarationBuilder) { } else if (declaration is SourceExtensionTypeDeclarationBuilder) {
declaration.buildOutlineExpressions(classHierarchy, declaration.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} else if (declaration is SourceMemberBuilder) { } else if (declaration is SourceMemberBuilder) {
declaration.buildOutlineExpressions(classHierarchy, declaration.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} else if (declaration is SourceTypeAliasBuilder) { } else if (declaration is SourceTypeAliasBuilder) {
declaration.buildOutlineExpressions(classHierarchy, declaration.buildOutlineExpressions(
delayedActionPerformers, delayedDefaultValueCloners); classHierarchy, delayedDefaultValueCloners);
} else { } else {
assert( assert(
declaration is PrefixBuilder || declaration is PrefixBuilder ||

View file

@ -77,7 +77,6 @@ import '../type_inference/type_inference_engine.dart';
import '../type_inference/type_inferrer.dart'; import '../type_inference/type_inferrer.dart';
import '../uri_offset.dart'; import '../uri_offset.dart';
import '../uris.dart'; import '../uris.dart';
import '../util/helpers.dart';
import 'diet_listener.dart' show DietListener; import 'diet_listener.dart' show DietListener;
import 'diet_parser.dart' show DietParser, useImplicitCreationExpressionInCfe; import 'diet_parser.dart' show DietParser, useImplicitCreationExpressionInCfe;
import 'name_scheme.dart'; import 'name_scheme.dart';
@ -87,6 +86,7 @@ import 'source_class_builder.dart' show SourceClassBuilder;
import 'source_constructor_builder.dart'; import 'source_constructor_builder.dart';
import 'source_enum_builder.dart'; import 'source_enum_builder.dart';
import 'source_extension_type_declaration_builder.dart'; import 'source_extension_type_declaration_builder.dart';
import 'source_factory_builder.dart';
import 'source_library_builder.dart' import 'source_library_builder.dart'
show show
ImplicitLanguageVersion, ImplicitLanguageVersion,
@ -2771,21 +2771,10 @@ severity: $severity
void buildOutlineExpressions(ClassHierarchy classHierarchy, void buildOutlineExpressions(ClassHierarchy classHierarchy,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
List<DelayedActionPerformer> delayedActionPerformers =
<DelayedActionPerformer>[];
for (SourceLibraryBuilder library in sourceLibraryBuilders) { for (SourceLibraryBuilder library in sourceLibraryBuilders) {
library.buildOutlineExpressions( library.buildOutlineExpressions(
classHierarchy, delayedDefaultValueCloners, delayedActionPerformers); classHierarchy, delayedDefaultValueCloners);
} }
target.benchmarker
?.beginSubdivide(BenchmarkSubdivides.delayedActionPerformer);
for (DelayedActionPerformer delayedActionPerformer
in delayedActionPerformers) {
delayedActionPerformer.performDelayedActions(allowFurtherDelays: false);
}
target.benchmarker?.endSubdivide();
ticker.logMs("Build outline expressions");
} }
void buildClassHierarchy( void buildClassHierarchy(
@ -2813,7 +2802,15 @@ severity: $severity
new TypeInferenceEngineImpl(instrumentation, target.benchmarker); new TypeInferenceEngineImpl(instrumentation, target.benchmarker);
} }
void performTopLevelInference(List<SourceClassBuilder> sourceClasses) { void inferRedirectingFactories(ClassHierarchy classHierarchy,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
/// Inferring redirecting factories partially overlaps with top-level
/// inference, since the formal parameters of the redirection targets should
/// be inferred, and they can be formal initializing parameters requiring
/// inference. [RedirectingFactoryBuilder.buildOutlineExpressions] can
/// invoke inference on those formal parameters. Therefore, the top-level
/// inference should be prepared before we can infer redirecting factories.
/// The first phase of top level initializer inference, which consists of /// The first phase of top level initializer inference, which consists of
/// creating kernel objects for all fields and top level variables that /// creating kernel objects for all fields and top level variables that
/// might be subject to type inference, and records dependencies between /// might be subject to type inference, and records dependencies between
@ -2821,6 +2818,30 @@ severity: $severity
typeInferenceEngine.prepareTopLevel(coreTypes, hierarchy); typeInferenceEngine.prepareTopLevel(coreTypes, hierarchy);
membersBuilder.computeTypes(); membersBuilder.computeTypes();
// TODO(cstefantsova): Put the redirecting factory inference into a separate
// step.
// Redirecting factory invocations can occur in outline expressions and
// should be processed before them. The outline expressions within
// redirecting factory invocations themselves are minimal, containing only
// the target and possibly some type arguments, and don't depend on other
// kinds of outline expressions themselves.
for (SourceLibraryBuilder library in sourceLibraryBuilders) {
List<RedirectingFactoryBuilder>? redirectingFactoryBuilders =
library.redirectingFactoryBuilders;
if (redirectingFactoryBuilders != null) {
for (RedirectingFactoryBuilder redirectingFactoryBuilder
in redirectingFactoryBuilders) {
redirectingFactoryBuilder.buildOutlineExpressions(
classHierarchy, delayedDefaultValueCloners);
}
}
}
ticker.logMs("Performed redirecting factory inference");
}
void performTopLevelInference(List<SourceClassBuilder> sourceClasses) {
List<InferableType> inferableTypes = []; List<InferableType> inferableTypes = [];
for (SourceLibraryBuilder libraryBuilder in sourceLibraryBuilders) { for (SourceLibraryBuilder libraryBuilder in sourceLibraryBuilders) {
libraryBuilder.collectInferableTypes(inferableTypes); libraryBuilder.collectInferableTypes(inferableTypes);

View file

@ -19,7 +19,6 @@ import '../problems.dart' show unsupported;
import '../source/source_library_builder.dart'; import '../source/source_library_builder.dart';
import '../type_inference/type_inference_engine.dart' import '../type_inference/type_inference_engine.dart'
show InferenceDataForTesting; show InferenceDataForTesting;
import '../util/helpers.dart' show DelayedActionPerformer;
import 'source_class_builder.dart'; import 'source_class_builder.dart';
typedef BuildNodesCallback = void Function( typedef BuildNodesCallback = void Function(
@ -34,9 +33,7 @@ abstract class SourceMemberBuilder implements MemberBuilder {
/// Builds the core AST structures for this member as needed for the outline. /// Builds the core AST structures for this member as needed for the outline.
void buildOutlineNodes(BuildNodesCallback f); void buildOutlineNodes(BuildNodesCallback f);
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners); List<DelayedDefaultValueCloner> delayedDefaultValueCloners);
/// Builds the AST nodes for this member as needed for the full compilation. /// Builds the AST nodes for this member as needed for the full compilation.
@ -159,9 +156,7 @@ abstract class SourceMemberBuilderImpl extends MemberBuilderImpl
ProcedureKind? get kind => unsupported("kind", charOffset, fileUri); ProcedureKind? get kind => unsupported("kind", charOffset, fileUri);
@override @override
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {} List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {}
@override @override

View file

@ -25,7 +25,6 @@ import '../kernel/expression_generator_helper.dart';
import '../kernel/kernel_helper.dart'; import '../kernel/kernel_helper.dart';
import '../problems.dart' show unhandled; import '../problems.dart' show unhandled;
import '../scope.dart'; import '../scope.dart';
import '../util/helpers.dart';
import 'source_library_builder.dart' show SourceLibraryBuilder; import 'source_library_builder.dart' show SourceLibraryBuilder;
class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
@ -327,9 +326,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
inConstFields: inConstFields); inConstFields: inConstFields);
} }
void buildOutlineExpressions( void buildOutlineExpressions(ClassHierarchy classHierarchy,
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) { List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
MetadataBuilder.buildAnnotations( MetadataBuilder.buildAnnotations(
typedef, typedef,
@ -350,7 +347,6 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
inMetadata: true, inMetadata: true,
inConstFields: false), inConstFields: false),
classHierarchy, classHierarchy,
delayedActionPerformers,
computeTypeParameterScope(libraryBuilder.scope)); computeTypeParameterScope(libraryBuilder.scope));
} }
} }

View file

@ -5,6 +5,7 @@
import 'package:kernel/ast.dart'; import 'package:kernel/ast.dart';
import '../codes/fasta_codes.dart' show LocatedMessage, Message; import '../codes/fasta_codes.dart' show LocatedMessage, Message;
import '../kernel/internal_ast.dart';
abstract class InferenceHelper { abstract class InferenceHelper {
Uri get uri; Uri get uri;
@ -28,4 +29,13 @@ abstract class InferenceHelper {
String superConstructorNameForDiagnostics(String name); String superConstructorNameForDiagnostics(String name);
String constructorNameForDiagnostics(String name, {String? className}); String constructorNameForDiagnostics(String name, {String? className});
Expression unaliasSingleTypeAliasedConstructorInvocation(
TypeAliasedConstructorInvocation invocation);
Expression? resolveRedirectingFactoryTarget(
Procedure target, Arguments arguments, int fileOffset, bool isConst);
Expression? unaliasSingleTypeAliasedFactoryInvocation(
TypeAliasedFactoryInvocation invocation);
} }

View file

@ -1355,15 +1355,17 @@ class InferenceVisitorImpl extends InferenceVisitorBase
node.fileOffset, functionType, node.arguments as ArgumentsImpl, node.fileOffset, functionType, node.arguments as ArgumentsImpl,
isConst: node.isConst, staticTarget: node.target); isConst: node.isConst, staticTarget: node.target);
node.hasBeenInferred = true; node.hasBeenInferred = true;
Expression resultNode = node;
SourceLibraryBuilder library = libraryBuilder; SourceLibraryBuilder library = libraryBuilder;
if (!hadExplicitTypeArguments) { if (!hadExplicitTypeArguments) {
library.checkBoundsInFactoryInvocation( library.checkBoundsInFactoryInvocation(
node, typeSchemaEnvironment, helper.uri, node, typeSchemaEnvironment, helper.uri,
inferred: true); inferred: true);
} }
return new ExpressionInferenceResult( Expression resolvedExpression = helper.resolveRedirectingFactoryTarget(
result.inferredType, result.applyResult(resultNode)); node.target, node.arguments, node.fileOffset, node.isConst)!;
Expression resultExpression = result.applyResult(resolvedExpression);
return new ExpressionInferenceResult(result.inferredType, resultExpression);
} }
/// Returns the function type of [constructor] when called through [typedef]. /// Returns the function type of [constructor] when called through [typedef].
@ -1416,10 +1418,13 @@ class InferenceVisitorImpl extends InferenceVisitorBase
node.fileOffset, calleeType, node.arguments as ArgumentsImpl, node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
isConst: node.isConst, staticTarget: node.target); isConst: node.isConst, staticTarget: node.target);
node.hasBeenInferred = true; node.hasBeenInferred = true;
Expression resultNode = node;
Expression resolvedExpression =
helper.unaliasSingleTypeAliasedConstructorInvocation(node);
Expression resultingExpression = result.applyResult(resolvedExpression);
return new ExpressionInferenceResult( return new ExpressionInferenceResult(
result.inferredType, result.applyResult(resultNode)); result.inferredType, resultingExpression);
} }
/// Returns the function type of [factory] when called through [typedef]. /// Returns the function type of [factory] when called through [typedef].
@ -1473,10 +1478,13 @@ class InferenceVisitorImpl extends InferenceVisitorBase
InvocationInferenceResult result = inferInvocation(this, typeContext, InvocationInferenceResult result = inferInvocation(this, typeContext,
node.fileOffset, calleeType, node.arguments as ArgumentsImpl, node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
isConst: node.isConst, staticTarget: node.target); isConst: node.isConst, staticTarget: node.target);
Expression resolvedExpression =
helper.unaliasSingleTypeAliasedFactoryInvocation(node)!;
Expression resultExpression = result.applyResult(resolvedExpression);
node.hasBeenInferred = true; node.hasBeenInferred = true;
Expression resultNode = node; return new ExpressionInferenceResult(result.inferredType, resultExpression);
return new ExpressionInferenceResult(
result.inferredType, result.applyResult(resultNode));
} }
@override @override

View file

@ -7,10 +7,6 @@ import 'package:kernel/ast.dart';
import '../../api_prototype/experimental_flags.dart'; import '../../api_prototype/experimental_flags.dart';
import '../source/source_library_builder.dart'; import '../source/source_library_builder.dart';
abstract class DelayedActionPerformer {
void performDelayedActions({required bool allowFurtherDelays});
}
/// Returns `true` if access to `Record` from `dart:core` is allowed. /// Returns `true` if access to `Record` from `dart:core` is allowed.
bool isRecordAccessAllowed(SourceLibraryBuilder library) { bool isRecordAccessAllowed(SourceLibraryBuilder library) {
return library return library

View file

@ -421,15 +421,15 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 0, hitCount: 0,
missCount: 128, missCount: 128,
), ),
// 92.14792978694895%. // 92.06240591213904%.
"package:front_end/src/fasta/kernel/body_builder.dart": ( "package:front_end/src/fasta/kernel/body_builder.dart": (
hitCount: 6877, hitCount: 6727,
missCount: 586, missCount: 580,
), ),
// 70.40816326530613%. // 69.18367346938776%.
"package:front_end/src/fasta/kernel/body_builder_context.dart": ( "package:front_end/src/fasta/kernel/body_builder_context.dart": (
hitCount: 345, hitCount: 339,
missCount: 145, missCount: 151,
), ),
// 36.44736842105264%. // 36.44736842105264%.
"package:front_end/src/fasta/kernel/collections.dart": ( "package:front_end/src/fasta/kernel/collections.dart": (
@ -541,10 +541,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 1, hitCount: 1,
missCount: 33, missCount: 33,
), ),
// 46.484375%. // 46.09375%.
"package:front_end/src/fasta/kernel/internal_ast.dart": ( "package:front_end/src/fasta/kernel/internal_ast.dart": (
hitCount: 595, hitCount: 590,
missCount: 685, missCount: 690,
), ),
// 74.13793103448276%. // 74.13793103448276%.
"package:front_end/src/fasta/kernel/invalid_type.dart": ( "package:front_end/src/fasta/kernel/invalid_type.dart": (
@ -561,10 +561,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 285, hitCount: 285,
missCount: 3, missCount: 3,
), ),
// 81.22605363984674%. // 81.23569794050344%.
"package:front_end/src/fasta/kernel/kernel_target.dart": ( "package:front_end/src/fasta/kernel/kernel_target.dart": (
hitCount: 1060, hitCount: 1065,
missCount: 245, missCount: 246,
), ),
// 61.111111111111114%. // 61.111111111111114%.
"package:front_end/src/fasta/kernel/kernel_variable_builder.dart": ( "package:front_end/src/fasta/kernel/kernel_variable_builder.dart": (
@ -706,9 +706,9 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 118, hitCount: 118,
missCount: 6, missCount: 6,
), ),
// 93.57084357084358%. // 93.57873210633947%.
"package:front_end/src/fasta/source/outline_builder.dart": ( "package:front_end/src/fasta/source/outline_builder.dart": (
hitCount: 2285, hitCount: 2288,
missCount: 157, missCount: 157,
), ),
// 94.44444444444444%. // 94.44444444444444%.
@ -731,9 +731,9 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 858, hitCount: 858,
missCount: 68, missCount: 68,
), ),
// 95.73560767590618%. // 95.6896551724138%.
"package:front_end/src/fasta/source/source_enum_builder.dart": ( "package:front_end/src/fasta/source/source_enum_builder.dart": (
hitCount: 449, hitCount: 444,
missCount: 20, missCount: 20,
), ),
// 61.261261261261254%. // 61.261261261261254%.
@ -747,9 +747,9 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 425, hitCount: 425,
missCount: 79, missCount: 79,
), ),
// 92.22222222222223%. // 92.3076923076923%.
"package:front_end/src/fasta/source/source_factory_builder.dart": ( "package:front_end/src/fasta/source/source_factory_builder.dart": (
hitCount: 581, hitCount: 588,
missCount: 49, missCount: 49,
), ),
// 89.94668697638994%. // 89.94668697638994%.
@ -757,20 +757,20 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 1181, hitCount: 1181,
missCount: 132, missCount: 132,
), ),
// 89.29663608562691%. // 89.32926829268293%.
"package:front_end/src/fasta/source/source_function_builder.dart": ( "package:front_end/src/fasta/source/source_function_builder.dart": (
hitCount: 292, hitCount: 293,
missCount: 35, missCount: 35,
), ),
// 85.4483096521313%. // 85.38745387453875%.
"package:front_end/src/fasta/source/source_library_builder.dart": ( "package:front_end/src/fasta/source/source_library_builder.dart": (
hitCount: 3488, hitCount: 3471,
missCount: 594, missCount: 594,
), ),
// 81.8988464951198%. // 81.96357174589072%.
"package:front_end/src/fasta/source/source_loader.dart": ( "package:front_end/src/fasta/source/source_loader.dart": (
hitCount: 1846, hitCount: 1845,
missCount: 408, missCount: 406,
), ),
// 40.32258064516129%. // 40.32258064516129%.
"package:front_end/src/fasta/source/source_member_builder.dart": ( "package:front_end/src/fasta/source/source_member_builder.dart": (
@ -827,9 +827,9 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 166, hitCount: 166,
missCount: 29, missCount: 29,
), ),
// 90.37792719684674%. // 90.39018177607966%.
"package:front_end/src/fasta/type_inference/inference_visitor.dart": ( "package:front_end/src/fasta/type_inference/inference_visitor.dart": (
hitCount: 7796, hitCount: 7807,
missCount: 830, missCount: 830,
), ),
// 85.96491228070175%. // 85.96491228070175%.
@ -877,10 +877,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 484, hitCount: 484,
missCount: 56, missCount: 56,
), ),
// 54.037267080745345%. // 59.006211180124225%.
"package:front_end/src/fasta/type_inference/type_inferrer.dart": ( "package:front_end/src/fasta/type_inference/type_inferrer.dart": (
hitCount: 87, hitCount: 95,
missCount: 74, missCount: 66,
), ),
// 36.666666666666664%. // 36.666666666666664%.
"package:front_end/src/fasta/type_inference/type_schema.dart": ( "package:front_end/src/fasta/type_inference/type_schema.dart": (
@ -932,10 +932,10 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
hitCount: 78, hitCount: 78,
missCount: 1316, missCount: 1316,
), ),
// 20.424013434089%. // 20.40687919463087%.
"package:front_end/src/fasta/util/parser_ast_helper.dart": ( "package:front_end/src/fasta/util/parser_ast_helper.dart": (
hitCount: 973, hitCount: 973,
missCount: 3791, missCount: 3795,
), ),
// 86.54205607476636%. // 86.54205607476636%.
"package:front_end/src/fasta/util/textual_outline.dart": ( "package:front_end/src/fasta/util/textual_outline.dart": (

View file

@ -16,6 +16,11 @@ library;
// const newConst1 = new ExtensionType1(0); /* Error */ // const newConst1 = new ExtensionType1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'. // Try using a constructor or factory that is 'const'.
// const implicitConstAliased1 = Typedef1(0); /* Error */ // const implicitConstAliased1 = Typedef1(0); /* Error */
@ -30,6 +35,11 @@ library;
// const newConstAliased1 = new Typedef1(0); /* Error */ // const newConstAliased1 = new Typedef1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression.
// const newConst2 = new ExtensionType2(0); /* Error */ // const newConst2 = new ExtensionType2(0); /* Error */
// ^^^ // ^^^
@ -38,16 +48,6 @@ library;
// const newConstAliased2 = new Typedef2(0); /* Error */ // const newConstAliased2 = new Typedef2(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -16,6 +16,11 @@ library;
// const newConst1 = new ExtensionType1(0); /* Error */ // const newConst1 = new ExtensionType1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'. // Try using a constructor or factory that is 'const'.
// const implicitConstAliased1 = Typedef1(0); /* Error */ // const implicitConstAliased1 = Typedef1(0); /* Error */
@ -30,6 +35,11 @@ library;
// const newConstAliased1 = new Typedef1(0); /* Error */ // const newConstAliased1 = new Typedef1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression.
// const newConst2 = new ExtensionType2(0); /* Error */ // const newConst2 = new ExtensionType2(0); /* Error */
// ^^^ // ^^^
@ -38,16 +48,6 @@ library;
// const newConstAliased2 = new Typedef2(0); /* Error */ // const newConstAliased2 = new Typedef2(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -16,6 +16,11 @@ library;
// const newConst1 = new ExtensionType1(0); /* Error */ // const newConst1 = new ExtensionType1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'. // Try using a constructor or factory that is 'const'.
// const implicitConstAliased1 = Typedef1(0); /* Error */ // const implicitConstAliased1 = Typedef1(0); /* Error */
@ -30,6 +35,11 @@ library;
// const newConstAliased1 = new Typedef1(0); /* Error */ // const newConstAliased1 = new Typedef1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression.
// const newConst2 = new ExtensionType2(0); /* Error */ // const newConst2 = new ExtensionType2(0); /* Error */
// ^^^ // ^^^
@ -38,16 +48,6 @@ library;
// const newConstAliased2 = new Typedef2(0); /* Error */ // const newConstAliased2 = new Typedef2(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -16,6 +16,11 @@ library;
// const newConst1 = new ExtensionType1(0); /* Error */ // const newConst1 = new ExtensionType1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:13:31: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'. // Try using a constructor or factory that is 'const'.
// const implicitConstAliased1 = Typedef1(0); /* Error */ // const implicitConstAliased1 = Typedef1(0); /* Error */
@ -30,6 +35,11 @@ library;
// const newConstAliased1 = new Typedef1(0); /* Error */ // const newConstAliased1 = new Typedef1(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression. // pkg/front_end/testcases/extension_types/const_constructor_access.dart:21:19: Error: New expression is not a constant expression.
// const newConst2 = new ExtensionType2(0); /* Error */ // const newConst2 = new ExtensionType2(0); /* Error */
// ^^^ // ^^^
@ -38,16 +48,6 @@ library;
// const newConstAliased2 = new Typedef2(0); /* Error */ // const newConstAliased2 = new Typedef2(0); /* Error */
// ^^^ // ^^^
// //
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:9:23: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConst1 = new ExtensionType1(0); /* Error */
// ^
//
// pkg/front_end/testcases/extension_types/const_constructor_access.dart:15:30: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
// Try using a constructor or factory that is 'const'.
// const newConstAliased1 = new Typedef1(0); /* Error */
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -94,6 +94,16 @@ library;
// class G<X extends Class<X>> {} // class G<X extends Class<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'. // pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -140,16 +150,6 @@ library;
// G<int>.new; // Error // G<int>.new; // Error
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'. // pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.

View file

@ -94,6 +94,16 @@ library;
// class G<X extends Class<X>> {} // class G<X extends Class<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'. // pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -140,16 +150,6 @@ library;
// G<int>.new; // Error // G<int>.new; // Error
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'. // pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.

View file

@ -94,6 +94,16 @@ library;
// class G<X extends Class<X>> {} // class G<X extends Class<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'. // pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -140,16 +150,6 @@ library;
// G<int>.new; // Error // G<int>.new; // Error
// ^ // ^
// //
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new F(); // Error
// ^
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
// typedef F<X extends Class<X>> = Class1;
// ^
//
// pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'. // pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'. // - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.

View file

@ -0,0 +1,16 @@
// Copyright (c) 2024, 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.
class C {
List<A> field;
C({this.field = const [A.redir()]});
}
abstract class A {
const factory A.redir() = B;
}
class B<X> implements A {
const B();
}

View file

@ -0,0 +1,30 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor •({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir() → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>();
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::B<self::B::X%>
: super core::Object::•()
;
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:15:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,30 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor •({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir() → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>();
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::B<self::B::X%>
: super core::Object::•()
;
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:15:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,23 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor •({core::List<self::A> field = const <self::A>[const self::B::•<dynamic>()]}) → self::C
;
}
abstract class A extends core::Object {
static factory redir() → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>();
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::B<self::B::X%>
: super core::Object::•()
;
}
Extra constant evaluation status:
Evaluated: ListLiteral @ org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:7:19 -> ListConstant(const <A>[const B<dynamic>{}])
Extra constant evaluation: evaluated: 2, effectively constant: 1

View file

@ -0,0 +1,30 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor •({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir() → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>();
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::B<self::B::X%>
: super core::Object::•()
;
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order.dart:15:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,12 @@
class C {
List<A> field;
C({this.field = const [A.redir()]});
}
abstract class A {
const factory A.redir() = B;
}
class B<X> implements A {
const B();
}

View file

@ -0,0 +1,12 @@
abstract class A {
const factory A.redir() = B;
}
class B<X> implements A {
const B();
}
class C {
C({this.field = const [A.redir()]});
List<A> field;
}

View file

@ -0,0 +1,23 @@
// Copyright (c) 2024, 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.
class C {
List<A> field;
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
}
abstract class A {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<X> implements A {
const B(int x, {required String s});
}
test() {
new A.redir2(0, s: "");
new A.redir2(s: "", 0);
}

View file

@ -0,0 +1,39 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor named1({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir1(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
static factory redir2(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::X%>
: super core::Object::•()
;
}
static method test() → dynamic {
new self::B::•<dynamic>(0, s: "");
let final core::String #t1 = "" in new self::B::•<dynamic>(0, s: #t1);
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,39 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor named1({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir1(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
static factory redir2(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::X%>
: super core::Object::•()
;
}
static method test() → dynamic {
new self::B::•<dynamic>(0, s: "");
let final core::String #t1 = "" in new self::B::•<dynamic>(0, s: #t1);
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,30 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor named1({core::List<self::A> field = const <self::A>[const self::B::•<dynamic>(0, s: "")]}) → self::C
;
constructor named2({core::List<self::A> field = const <self::A>[const self::B::•<dynamic>(0, s: "")]}) → self::C
;
}
abstract class A extends core::Object {
static factory redir1(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
static factory redir2(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::X%>
: super core::Object::•()
;
}
static method test() → dynamic
;
Extra constant evaluation status:
Evaluated: ListLiteral @ org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:7:26 -> ListConstant(const <A>[const B<dynamic>{}])
Evaluated: ListLiteral @ org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:8:26 -> ListConstant(const <A>[const B<dynamic>{}])
Extra constant evaluation: evaluated: 8, effectively constant: 2

View file

@ -0,0 +1,43 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A> field;
constructor named1({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A extends core::Object {
static factory redir1(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
static factory redir2(core::int x, {required core::String s}) → self::A /* redirection-target: self::B::•<dynamic>*/
return new self::B::•<dynamic>(x, s: s);
}
class B<X extends core::Object? = dynamic> extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::X%>
: super core::Object::•()
;
}
static method test() → dynamic {
new self::B::•<dynamic>(0, s: "");
let final core::String #t1 = "" in new self::B::•<dynamic>(0, s: #t1);
}
constants {
#C1 = self::B<dynamic> {}
#C2 = <self::A>[#C1]
}
Extra constant evaluation status:
Evaluated: VariableGet @ org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:22:19 -> StringConstant("")
Extra constant evaluation: evaluated: 12, effectively constant: 1
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_2.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,16 @@
class C {
List<A> field;
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
}
abstract class A {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<X> implements A {
const B(int x, {required String s});
}
test() {}

View file

@ -0,0 +1,16 @@
abstract class A {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<X> implements A {
const B(int x, {required String s});
}
class C {
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
List<A> field;
}
test() {}

View file

@ -0,0 +1,23 @@
// Copyright (c) 2024, 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.
class C {
List<A<bool>> field;
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
}
abstract class A<X> {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<Y> implements A<Y> {
const B(int x, {required String s});
}
test() {
A<String> foo1 = new A.redir2(0, s: "");
A<num> foo2 = new A.redir2(s: "", 0);
}

View file

@ -0,0 +1,39 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A<core::bool>> field;
constructor named1({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A<X extends core::Object? = dynamic> extends core::Object {
static factory redir1<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir1::X%> /* redirection-target: self::B::•<self::A::redir1::X%>*/
return new self::B::•<self::A::redir1::X%>(x, s: s);
static factory redir2<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir2::X%> /* redirection-target: self::B::•<self::A::redir2::X%>*/
return new self::B::•<self::A::redir2::X%>(x, s: s);
}
class B<Y extends core::Object? = dynamic> extends core::Object implements self::A<self::B::Y%> /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::Y%>
: super core::Object::•()
;
}
static method test() → dynamic {
self::A<core::String> foo1 = new self::B::•<core::String>(0, s: "");
self::A<core::num> foo2 = let final core::String #t1 = "" in new self::B::•<core::num>(0, s: #t1);
}
constants {
#C1 = self::B<core::bool> {}
#C2 = <self::A<core::bool>>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,39 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A<core::bool>> field;
constructor named1({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A<X extends core::Object? = dynamic> extends core::Object {
static factory redir1<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir1::X%> /* redirection-target: self::B::•<self::A::redir1::X%>*/
return new self::B::•<self::A::redir1::X%>(x, s: s);
static factory redir2<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir2::X%> /* redirection-target: self::B::•<self::A::redir2::X%>*/
return new self::B::•<self::A::redir2::X%>(x, s: s);
}
class B<Y extends core::Object? = dynamic> extends core::Object implements self::A<self::B::Y%> /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::Y%>
: super core::Object::•()
;
}
static method test() → dynamic {
self::A<core::String> foo1 = new self::B::•<core::String>(0, s: "");
self::A<core::num> foo2 = let final core::String #t1 = "" in new self::B::•<core::num>(0, s: #t1);
}
constants {
#C1 = self::B<core::bool> {}
#C2 = <self::A<core::bool>>[#C1]
}
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,30 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A<core::bool>> field;
constructor named1({core::List<self::A<core::bool>> field = const <self::A<core::bool>>[const self::B::•<core::bool>(0, s: "")]}) → self::C
;
constructor named2({core::List<self::A<core::bool>> field = const <self::A<core::bool>>[const self::B::•<core::bool>(0, s: "")]}) → self::C
;
}
abstract class A<X extends core::Object? = dynamic> extends core::Object {
static factory redir1<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir1::X%> /* redirection-target: self::B::•<self::A::redir1::X%>*/
return new self::B::•<self::A::redir1::X%>(x, s: s);
static factory redir2<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir2::X%> /* redirection-target: self::B::•<self::A::redir2::X%>*/
return new self::B::•<self::A::redir2::X%>(x, s: s);
}
class B<Y extends core::Object? = dynamic> extends core::Object implements self::A<self::B::Y%> /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::Y%>
: super core::Object::•()
;
}
static method test() → dynamic
;
Extra constant evaluation status:
Evaluated: ListLiteral @ org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:7:26 -> ListConstant(const <A<bool>>[const B<bool>{}])
Evaluated: ListLiteral @ org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:8:26 -> ListConstant(const <A<bool>>[const B<bool>{}])
Extra constant evaluation: evaluated: 8, effectively constant: 2

View file

@ -0,0 +1,43 @@
library;
import self as self;
import "dart:core" as core;
class C extends core::Object {
field core::List<self::A<core::bool>> field;
constructor named1({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
constructor named2({core::List<self::A<core::bool>> field = #C2}) → self::C
: self::C::field = field, super core::Object::•()
;
}
abstract class A<X extends core::Object? = dynamic> extends core::Object {
static factory redir1<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir1::X%> /* redirection-target: self::B::•<self::A::redir1::X%>*/
return new self::B::•<self::A::redir1::X%>(x, s: s);
static factory redir2<X extends core::Object? = dynamic>(core::int x, {required core::String s}) → self::A<self::A::redir2::X%> /* redirection-target: self::B::•<self::A::redir2::X%>*/
return new self::B::•<self::A::redir2::X%>(x, s: s);
}
class B<Y extends core::Object? = dynamic> extends core::Object implements self::A<self::B::Y%> /*hasConstConstructor*/ {
const constructor •(core::int x, {required core::String s}) → self::B<self::B::Y%>
: super core::Object::•()
;
}
static method test() → dynamic {
self::A<core::String> foo1 = new self::B::•<core::String>(0, s: "");
self::A<core::num> foo2 = let final core::String #t1 = "" in new self::B::•<core::num>(0, s: #t1);
}
constants {
#C1 = self::B<core::bool> {}
#C2 = <self::A<core::bool>>[#C1]
}
Extra constant evaluation status:
Evaluated: VariableGet @ org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:22:33 -> StringConstant("")
Extra constant evaluation: evaluated: 12, effectively constant: 1
Constructor coverage from constants:
org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:
- B. (from org-dartlang-testcase:///redirecting_constructors_declaration_order_3.dart:17:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)

View file

@ -0,0 +1,16 @@
class C {
List<A<bool>> field;
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
}
abstract class A<X> {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<Y> implements A<Y> {
const B(int x, {required String s});
}
test() {}

View file

@ -0,0 +1,16 @@
abstract class A<X> {
const factory A.redir1(int x, {required String s}) = B;
const factory A.redir2(int x, {required String s}) = B;
}
class B<Y> implements A<Y> {
const B(int x, {required String s});
}
class C {
C.named1({this.field = const [A.redir1(0, s: "")]});
C.named2({this.field = const [A.redir1(s: "", 0)]});
List<A<bool>> field;
}
test() {}

View file

@ -163,16 +163,16 @@ library;
// new T7(0); // Error // new T7(0); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// new T4(); // Error // new T4(); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// <T4>[]; // Error // <T4>[]; // Error

View file

@ -163,16 +163,16 @@ library;
// new T7(0); // Error // new T7(0); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// new T4(); // Error // new T4(); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// <T4>[]; // Error // <T4>[]; // Error

View file

@ -163,16 +163,16 @@ library;
// new T7(0); // Error // new T7(0); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:59:7: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// new T4(); // Error // new T4(); // Error
// ^ // ^
// //
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:63:10: Error: The argument type 'int' can't be assigned to the parameter type 'List<void Function<T>(T)>'.
// - 'List' is from 'dart:core'.
// new T7(0); // Error
// ^
//
// pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument. // pkg/front_end/testcases/generic_metadata/alias_from_opt_in.dart:60:4: Error: Generic function type 'void Function<T>(T)' inferred as a type argument.
// Try providing a non-generic function type explicitly. // Try providing a non-generic function type explicitly.
// <T4>[]; // Error // <T4>[]; // Error

View file

@ -2,26 +2,6 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -32,6 +12,16 @@ library;
// typedef B<X extends A<X>> = A<X>; // typedef B<X extends A<X>> = A<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -52,6 +42,16 @@ library;
// class A2<X extends A2<X>> { // class A2<X extends A2<X>> {
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -2,26 +2,6 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -32,6 +12,16 @@ library;
// typedef B<X extends A<X>> = A<X>; // typedef B<X extends A<X>> = A<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -52,6 +42,16 @@ library;
// class A2<X extends A2<X>> { // class A2<X extends A2<X>> {
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -2,26 +2,6 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:14:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'B'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -32,6 +12,16 @@ library;
// typedef B<X extends A<X>> = A<X>; // typedef B<X extends A<X>> = A<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:15:3: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'A'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
// class A<X extends A<X>> {}
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'. // pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:16:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'B2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'. // - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -52,6 +42,16 @@ library;
// class A2<X extends A2<X>> { // class A2<X extends A2<X>> {
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:17:3: Error: Inferred type argument 'A2<Object?>' doesn't conform to the bound 'A2<X>' of the type variable 'X' on 'A2'.
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A2(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
// class A2<X extends A2<X>> {
// ^
//
import self as self; import self as self;
import "dart:core" as core; import "dart:core" as core;

View file

@ -12,6 +12,16 @@ library;
// class A<X extends A<X>> {} // class A<X extends A<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
@ -76,16 +86,6 @@ library;
// instance2(() => captureTypeArgument()); // instance2(() => captureTypeArgument());
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.

View file

@ -12,6 +12,16 @@ library;
// class A<X extends A<X>> {} // class A<X extends A<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
@ -76,16 +86,6 @@ library;
// instance2(() => captureTypeArgument()); // instance2(() => captureTypeArgument());
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.

View file

@ -12,6 +12,16 @@ library;
// class A<X extends A<X>> {} // class A<X extends A<X>> {}
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'call'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
@ -76,16 +86,6 @@ library;
// instance2(() => captureTypeArgument()); // instance2(() => captureTypeArgument());
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:33:9: Error: Inferred type argument 'A<Object?>' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'C'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// new C();
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:14:11: Context: This is the type variable whose bound isn't conformed to.
// typedef C<X extends A<X>> = A<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A<X>' of the type variable 'X' on 'Subclass.instance1'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'.

View file

@ -2,6 +2,16 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -12,6 +22,16 @@ library;
// typedef A<X extends G<C<X>>> = C<X>; // typedef A<X extends G<C<X>>> = C<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -22,26 +42,6 @@ library;
// typedef B<X extends G<D<X>>> = D<X>; // typedef B<X extends G<D<X>>> = D<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.

View file

@ -2,6 +2,16 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -12,6 +22,16 @@ library;
// typedef A<X extends G<C<X>>> = C<X>; // typedef A<X extends G<C<X>>> = C<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -22,26 +42,6 @@ library;
// typedef B<X extends G<D<X>>> = D<X>; // typedef B<X extends G<D<X>>> = D<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.

View file

@ -2,6 +2,16 @@ library;
// //
// Problems in library: // Problems in library:
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:21:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -12,6 +22,16 @@ library;
// typedef A<X extends G<C<X>>> = C<X>; // typedef A<X extends G<C<X>>> = C<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:23:3: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.
@ -22,26 +42,6 @@ library;
// typedef B<X extends G<D<X>>> = D<X>; // typedef B<X extends G<D<X>>> = D<X>;
// ^ // ^
// //
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:20:3: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:22:5: Error: Inferred type argument 'C<Object?> Function(C<Never>)' doesn't conform to the bound 'C<X> Function(C<X>)' of the type variable 'X' on 'A'.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A.bar(); // Error.
// ^
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:16:11: Context: This is the type variable whose bound isn't conformed to.
// typedef A<X extends G<C<X>>> = C<X>;
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'. // pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart:24:5: Error: Inferred type argument 'D<Object?> Function(D<Never>)' doesn't conform to the bound 'D<X> Function(D<X>)' of the type variable 'X' on 'B'.
// - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'. // - 'D' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart'.
// - 'Object' is from 'dart:core'. // - 'Object' is from 'dart:core'.