Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 648d5f9

Browse files
author
Dart CI
committed
Version 2.13.0-37.0.dev
Merge commit '4216dc8d122f410d38d70ef6fc9bcedc5f2a0f0e' into 'dev'
2 parents c9b47ad + 4216dc8 commit 648d5f9

14 files changed

+784
-39
lines changed

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,9 @@ class BodyBuilder extends ScopeListener<JumpTarget>
12261226
replacementNode = buildStaticInvocation(
12271227
resolvedTarget,
12281228
forest.createArguments(noLocation, arguments.positional,
1229-
types: arguments.types, named: arguments.named),
1229+
types: arguments.types,
1230+
named: arguments.named,
1231+
hasExplicitTypeArguments: hasExplicitTypeArguments(arguments)),
12301232
constness:
12311233
isConst ? Constness.explicitConst : Constness.explicitNew,
12321234
charOffset: fileOffset);
@@ -1298,7 +1300,10 @@ class BodyBuilder extends ScopeListener<JumpTarget>
12981300
}
12991301
Arguments invocationArguments = forest.createArguments(
13001302
noLocation, invocation.arguments.positional,
1301-
types: invocationTypeArguments, named: invocation.arguments.named);
1303+
types: invocationTypeArguments,
1304+
named: invocation.arguments.named,
1305+
hasExplicitTypeArguments:
1306+
hasExplicitTypeArguments(invocation.arguments));
13021307
invocation.replaceWith(_resolveRedirectingFactoryTarget(invocation.target,
13031308
invocationArguments, invocation.fileOffset, invocation.isConst));
13041309
}
@@ -4162,7 +4167,8 @@ class BodyBuilder extends ScopeListener<JumpTarget>
41624167
isConst: isConst)
41634168
..fileOffset = charOffset;
41644169
libraryBuilder.checkBoundsInFactoryInvocation(
4165-
node, typeEnvironment, uri);
4170+
node, typeEnvironment, uri,
4171+
inferred: !hasExplicitTypeArguments(arguments));
41664172
} else {
41674173
node = new TypeAliasedFactoryInvocationJudgment(
41684174
typeAliasBuilder, target, arguments,

pkg/front_end/lib/src/fasta/kernel/forest.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ class Forest {
3030
const Forest();
3131

3232
Arguments createArguments(int fileOffset, List<Expression> positional,
33-
{List<DartType> types, List<NamedExpression> named}) {
34-
return new ArgumentsImpl(positional, types: types, named: named)
35-
..fileOffset = fileOffset ?? TreeNode.noOffset;
33+
{List<DartType> types,
34+
List<NamedExpression> named,
35+
bool hasExplicitTypeArguments = true}) {
36+
if (!hasExplicitTypeArguments) {
37+
ArgumentsImpl arguments =
38+
new ArgumentsImpl(positional, types: <DartType>[], named: named);
39+
arguments.types.addAll(types);
40+
return arguments;
41+
} else {
42+
return new ArgumentsImpl(positional, types: types, named: named)
43+
..fileOffset = fileOffset ?? TreeNode.noOffset;
44+
}
3645
}
3746

3847
Arguments createArgumentsForExtensionMethod(

pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ class InferenceVisitor
404404
ExpressionInferenceResult visitConstructorInvocation(
405405
ConstructorInvocation node, DartType typeContext) {
406406
inferrer.inferConstructorParameterTypes(node.target);
407-
bool hasExplicitTypeArguments =
408-
getExplicitTypeArguments(node.arguments) != null;
407+
bool hadExplicitTypeArguments = hasExplicitTypeArguments(node.arguments);
409408
FunctionType functionType = replaceReturnType(
410409
node.target.function
411410
.computeThisFunctionType(inferrer.library.nonNullable),
@@ -415,7 +414,7 @@ class InferenceVisitor
415414
isConst: node.isConst, staticTarget: node.target);
416415
if (!inferrer.isTopLevel) {
417416
SourceLibraryBuilder library = inferrer.library;
418-
if (!hasExplicitTypeArguments) {
417+
if (!hadExplicitTypeArguments) {
419418
library.checkBoundsInConstructorInvocation(
420419
node, inferrer.typeSchemaEnvironment, inferrer.helper.uri,
421420
inferred: true);
@@ -692,8 +691,7 @@ class InferenceVisitor
692691

693692
ExpressionInferenceResult visitFactoryConstructorInvocationJudgment(
694693
FactoryConstructorInvocationJudgment node, DartType typeContext) {
695-
bool hadExplicitTypeArguments =
696-
getExplicitTypeArguments(node.arguments) != null;
694+
bool hadExplicitTypeArguments = hasExplicitTypeArguments(node.arguments);
697695

698696
FunctionType functionType = replaceReturnType(
699697
node.target.function
@@ -740,7 +738,7 @@ class InferenceVisitor
740738
SourceLibraryBuilder library = inferrer.library;
741739
library.checkBoundsInType(result.inferredType,
742740
inferrer.typeSchemaEnvironment, inferrer.helper.uri, node.fileOffset,
743-
inferred: true);
741+
inferred: true, allowSuperBounded: false);
744742
if (inferrer.isNonNullableByDefault) {
745743
if (node.target == inferrer.coreTypes.listDefaultConstructor) {
746744
resultNode = inferrer.helper.wrapInProblem(node,
@@ -768,7 +766,7 @@ class InferenceVisitor
768766
SourceLibraryBuilder library = inferrer.library;
769767
library.checkBoundsInType(result.inferredType,
770768
inferrer.typeSchemaEnvironment, inferrer.helper.uri, node.fileOffset,
771-
inferred: true);
769+
inferred: true, allowSuperBounded: false);
772770
if (inferrer.isNonNullableByDefault) {
773771
if (node.target == inferrer.coreTypes.listDefaultConstructor) {
774772
resultNode = inferrer.helper.wrapInProblem(node,

pkg/front_end/lib/src/fasta/kernel/internal_ast.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ List<DartType> getExplicitTypeArguments(Arguments arguments) {
183183
}
184184
}
185185

186+
bool hasExplicitTypeArguments(Arguments arguments) {
187+
return getExplicitTypeArguments(arguments) != null;
188+
}
189+
186190
/// Information associated with a class during type inference.
187191
class ClassInferenceInfo {
188192
/// The builder associated with this class.

0 commit comments

Comments
 (0)