Skip to content

Commit d7b0b51

Browse files
Dmitry Stefantsovcommit-bot@chromium.org
authored andcommitted
[cfe] Forbid super-bounded typedef types as constructors
Closes #45658. Closes #45670. Bug: #45658 Bug: #45670 Change-Id: I5b588794a63f7b0aef84c3731ca26624ca8ff23a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195518 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Dmitry Stefantsov <[email protected]>
1 parent 6c8f4aa commit d7b0b51

22 files changed

+394
-270
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,12 +1301,14 @@ class BodyBuilder extends ScopeListener<JumpTarget>
13011301
void _unaliasTypeAliasedConstructorInvocations() {
13021302
for (TypeAliasedConstructorInvocationJudgment invocation
13031303
in typeAliasedConstructorInvocations) {
1304+
bool inferred = !hasExplicitTypeArguments(invocation.arguments);
13041305
DartType aliasedType = new TypedefType(
13051306
invocation.typeAliasBuilder.typedef,
13061307
Nullability.nonNullable,
13071308
invocation.arguments.types);
13081309
libraryBuilder.checkBoundsInType(
1309-
aliasedType, typeEnvironment, uri, invocation.fileOffset);
1310+
aliasedType, typeEnvironment, uri, invocation.fileOffset,
1311+
allowSuperBounded: false, inferred: inferred);
13101312
DartType unaliasedType = aliasedType.unalias;
13111313
List<DartType> invocationTypeArguments = null;
13121314
if (unaliasedType is InterfaceType) {
@@ -1325,12 +1327,14 @@ class BodyBuilder extends ScopeListener<JumpTarget>
13251327
void _unaliasTypeAliasedFactoryInvocations() {
13261328
for (TypeAliasedFactoryInvocationJudgment invocation
13271329
in typeAliasedFactoryInvocations) {
1330+
bool inferred = !hasExplicitTypeArguments(invocation.arguments);
13281331
DartType aliasedType = new TypedefType(
13291332
invocation.typeAliasBuilder.typedef,
13301333
Nullability.nonNullable,
13311334
invocation.arguments.types);
13321335
libraryBuilder.checkBoundsInType(
1333-
aliasedType, typeEnvironment, uri, invocation.fileOffset);
1336+
aliasedType, typeEnvironment, uri, invocation.fileOffset,
1337+
allowSuperBounded: false, inferred: inferred);
13341338
DartType unaliasedType = aliasedType.unalias;
13351339
List<DartType> invocationTypeArguments = null;
13361340
if (unaliasedType is InterfaceType) {

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,6 @@ class InferenceVisitor
817817
node.hasBeenInferred = true;
818818
Expression resultNode = node;
819819
if (!inferrer.isTopLevel) {
820-
SourceLibraryBuilder library = inferrer.library;
821-
library.checkBoundsInType(result.inferredType,
822-
inferrer.typeSchemaEnvironment, inferrer.helper.uri, node.fileOffset,
823-
inferred: true, allowSuperBounded: false);
824820
if (inferrer.isNonNullableByDefault) {
825821
if (node.target == inferrer.coreTypes.listDefaultConstructor) {
826822
resultNode = inferrer.helper.wrapInProblem(node,
@@ -845,10 +841,6 @@ class InferenceVisitor
845841
node.hasBeenInferred = true;
846842
Expression resultNode = node;
847843
if (!inferrer.isTopLevel) {
848-
SourceLibraryBuilder library = inferrer.library;
849-
library.checkBoundsInType(result.inferredType,
850-
inferrer.typeSchemaEnvironment, inferrer.helper.uri, node.fileOffset,
851-
inferred: true, allowSuperBounded: false);
852844
if (inferrer.isNonNullableByDefault) {
853845
if (node.target == inferrer.coreTypes.listDefaultConstructor) {
854846
resultNode = inferrer.helper.wrapInProblem(node,

pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.strong.expect

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,51 @@ library /*isNonNullableByDefault*/;
22
//
33
// Problems in library:
44
//
5-
// 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 'A'.
5+
// 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'.
66
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
77
// - 'Object' is from 'dart:core'.
88
// Try specifying type arguments explicitly so that they conform to the bounds.
9-
// B(); // Error.
9+
// A(); // Error.
1010
// ^
1111
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
1212
// class A<X extends A<X>> {}
1313
// ^
1414
//
15-
// 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'.
15+
// 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'.
16+
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
17+
// - 'Object' is from 'dart:core'.
18+
// Try specifying type arguments explicitly so that they conform to the bounds.
19+
// A2(); // Error.
20+
// ^
21+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
22+
// class A2<X extends A2<X>> {
23+
// ^
24+
//
25+
// 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'.
1626
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
1727
// - 'Object' is from 'dart:core'.
1828
// Try specifying type arguments explicitly so that they conform to the bounds.
19-
// A(); // Error.
29+
// B(); // Error.
2030
// ^
21-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
22-
// class A<X extends A<X>> {}
23-
// ^
31+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:6:11: Context: This is the type variable whose bound isn't conformed to.
32+
// typedef B<X extends A<X>> = A<X>;
33+
// ^
2434
//
25-
// 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 'A2'.
35+
// 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'.
2636
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
2737
// - 'Object' is from 'dart:core'.
2838
// Try specifying type arguments explicitly so that they conform to the bounds.
2939
// B2(); // Error.
3040
// ^
31-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
32-
// class A2<X extends A2<X>> {
33-
// ^
41+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:11:12: Context: This is the type variable whose bound isn't conformed to.
42+
// typedef B2<X extends A2<X>> = A2<X>;
43+
// ^
3444
//
35-
// 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'.
45+
// 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 'A2'.
3646
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
3747
// - 'Object' is from 'dart:core'.
3848
// Try specifying type arguments explicitly so that they conform to the bounds.
39-
// A2(); // Error.
49+
// B2(); // Error.
4050
// ^
4151
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
4252
// class A2<X extends A2<X>> {

pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.strong.transformed.expect

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,51 @@ library /*isNonNullableByDefault*/;
22
//
33
// Problems in library:
44
//
5-
// 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 'A'.
5+
// 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'.
66
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
77
// - 'Object' is from 'dart:core'.
88
// Try specifying type arguments explicitly so that they conform to the bounds.
9-
// B(); // Error.
9+
// A(); // Error.
1010
// ^
1111
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
1212
// class A<X extends A<X>> {}
1313
// ^
1414
//
15-
// 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'.
15+
// 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'.
16+
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
17+
// - 'Object' is from 'dart:core'.
18+
// Try specifying type arguments explicitly so that they conform to the bounds.
19+
// A2(); // Error.
20+
// ^
21+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
22+
// class A2<X extends A2<X>> {
23+
// ^
24+
//
25+
// 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'.
1626
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
1727
// - 'Object' is from 'dart:core'.
1828
// Try specifying type arguments explicitly so that they conform to the bounds.
19-
// A(); // Error.
29+
// B(); // Error.
2030
// ^
21-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
22-
// class A<X extends A<X>> {}
23-
// ^
31+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:6:11: Context: This is the type variable whose bound isn't conformed to.
32+
// typedef B<X extends A<X>> = A<X>;
33+
// ^
2434
//
25-
// 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 'A2'.
35+
// 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'.
2636
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
2737
// - 'Object' is from 'dart:core'.
2838
// Try specifying type arguments explicitly so that they conform to the bounds.
2939
// B2(); // Error.
3040
// ^
31-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
32-
// class A2<X extends A2<X>> {
33-
// ^
41+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:11:12: Context: This is the type variable whose bound isn't conformed to.
42+
// typedef B2<X extends A2<X>> = A2<X>;
43+
// ^
3444
//
35-
// 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'.
45+
// 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 'A2'.
3646
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
3747
// - 'Object' is from 'dart:core'.
3848
// Try specifying type arguments explicitly so that they conform to the bounds.
39-
// A2(); // Error.
49+
// B2(); // Error.
4050
// ^
4151
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
4252
// class A2<X extends A2<X>> {

pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.weak.expect

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,51 @@ library /*isNonNullableByDefault*/;
22
//
33
// Problems in library:
44
//
5-
// 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 'A'.
5+
// 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'.
66
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
77
// - 'Object' is from 'dart:core'.
88
// Try specifying type arguments explicitly so that they conform to the bounds.
9-
// B(); // Error.
9+
// A(); // Error.
1010
// ^
1111
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
1212
// class A<X extends A<X>> {}
1313
// ^
1414
//
15-
// 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'.
15+
// 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'.
16+
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
17+
// - 'Object' is from 'dart:core'.
18+
// Try specifying type arguments explicitly so that they conform to the bounds.
19+
// A2(); // Error.
20+
// ^
21+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
22+
// class A2<X extends A2<X>> {
23+
// ^
24+
//
25+
// 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'.
1626
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
1727
// - 'Object' is from 'dart:core'.
1828
// Try specifying type arguments explicitly so that they conform to the bounds.
19-
// A(); // Error.
29+
// B(); // Error.
2030
// ^
21-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
22-
// class A<X extends A<X>> {}
23-
// ^
31+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:6:11: Context: This is the type variable whose bound isn't conformed to.
32+
// typedef B<X extends A<X>> = A<X>;
33+
// ^
2434
//
25-
// 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 'A2'.
35+
// 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'.
2636
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
2737
// - 'Object' is from 'dart:core'.
2838
// Try specifying type arguments explicitly so that they conform to the bounds.
2939
// B2(); // Error.
3040
// ^
31-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
32-
// class A2<X extends A2<X>> {
33-
// ^
41+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:11:12: Context: This is the type variable whose bound isn't conformed to.
42+
// typedef B2<X extends A2<X>> = A2<X>;
43+
// ^
3444
//
35-
// 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'.
45+
// 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 'A2'.
3646
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
3747
// - 'Object' is from 'dart:core'.
3848
// Try specifying type arguments explicitly so that they conform to the bounds.
39-
// A2(); // Error.
49+
// B2(); // Error.
4050
// ^
4151
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
4252
// class A2<X extends A2<X>> {

pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.weak.transformed.expect

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,51 @@ library /*isNonNullableByDefault*/;
22
//
33
// Problems in library:
44
//
5-
// 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 'A'.
5+
// 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'.
66
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
77
// - 'Object' is from 'dart:core'.
88
// Try specifying type arguments explicitly so that they conform to the bounds.
9-
// B(); // Error.
9+
// A(); // Error.
1010
// ^
1111
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
1212
// class A<X extends A<X>> {}
1313
// ^
1414
//
15-
// 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'.
15+
// 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'.
16+
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
17+
// - 'Object' is from 'dart:core'.
18+
// Try specifying type arguments explicitly so that they conform to the bounds.
19+
// A2(); // Error.
20+
// ^
21+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
22+
// class A2<X extends A2<X>> {
23+
// ^
24+
//
25+
// 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'.
1626
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
1727
// - 'Object' is from 'dart:core'.
1828
// Try specifying type arguments explicitly so that they conform to the bounds.
19-
// A(); // Error.
29+
// B(); // Error.
2030
// ^
21-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
22-
// class A<X extends A<X>> {}
23-
// ^
31+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:6:11: Context: This is the type variable whose bound isn't conformed to.
32+
// typedef B<X extends A<X>> = A<X>;
33+
// ^
2434
//
25-
// 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 'A2'.
35+
// 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'.
2636
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
2737
// - 'Object' is from 'dart:core'.
2838
// Try specifying type arguments explicitly so that they conform to the bounds.
2939
// B2(); // Error.
3040
// ^
31-
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
32-
// class A2<X extends A2<X>> {
33-
// ^
41+
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:11:12: Context: This is the type variable whose bound isn't conformed to.
42+
// typedef B2<X extends A2<X>> = A2<X>;
43+
// ^
3444
//
35-
// 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'.
45+
// 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 'A2'.
3646
// - 'A2' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart'.
3747
// - 'Object' is from 'dart:core'.
3848
// Try specifying type arguments explicitly so that they conform to the bounds.
39-
// A2(); // Error.
49+
// B2(); // Error.
4050
// ^
4151
// pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart:8:10: Context: This is the type variable whose bound isn't conformed to.
4252
// class A2<X extends A2<X>> {

0 commit comments

Comments
 (0)