[cfe] Augment test to use nonfunction type alias
Change-Id: I478d1abf75f8a9a9d162a75f9885545d61c9d5ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242541
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart
index 9a5768c..2375a98 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart
@@ -6,8 +6,12 @@
typedef G<X> = X Function(X);
typedef A<X extends G<C<X>>> = C<X>;
+typedef H<X> = C<X Function(X)>;
+typedef B<X extends H<X>> = C<X>;
+
test() {
A a = throw 42; // Error.
+ B b = throw 42; // Error.
}
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.expect
index 0d5fcd0..1722631 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:10:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart:13:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A a = throw 42; // Error.
@@ -10,7 +10,7 @@
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:7: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.dart:10:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
+// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:13:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart'.
// A a = throw 42; // Error.
// ^
@@ -20,6 +20,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
: super core::Object::•()
@@ -27,7 +29,12 @@
}
static method test() → dynamic {
self::C<(self::C<dynamic>) → self::C<dynamic>> a = throw 42;
+ self::C<self::C<(dynamic) → dynamic>> b = throw 42;
}
static method main() → dynamic {}
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.transformed.expect
index 0d5fcd0..1722631 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.strong.transformed.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:10:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart:13:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A a = throw 42; // Error.
@@ -10,7 +10,7 @@
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:7: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.dart:10:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
+// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:13:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart'.
// A a = throw 42; // Error.
// ^
@@ -20,6 +20,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
: super core::Object::•()
@@ -27,7 +29,12 @@
}
static method test() → dynamic {
self::C<(self::C<dynamic>) → self::C<dynamic>> a = throw 42;
+ self::C<self::C<(dynamic) → dynamic>> b = throw 42;
}
static method main() → dynamic {}
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
index a5f4a20..d9a88db 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
@@ -2,5 +2,7 @@
typedef G<X> = X Function(X);
typedef A<X extends G<C<X>>> = C<X>;
+typedef H<X> = C<X Function(X)>;
+typedef B<X extends H<X>> = C<X>;
test() {}
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect
index edec24e..b338a07 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect
@@ -3,4 +3,6 @@
main() {}
test() {}
typedef A<X extends G<C<X>>> = C<X>;
+typedef B<X extends H<X>> = C<X>;
typedef G<X> = X Function(X);
+typedef H<X> = C<X Function(X)>;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.expect
index 0d5fcd0..1722631 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:10:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart:13:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A a = throw 42; // Error.
@@ -10,7 +10,7 @@
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:7: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.dart:10:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
+// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:13:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart'.
// A a = throw 42; // Error.
// ^
@@ -20,6 +20,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
: super core::Object::•()
@@ -27,7 +29,12 @@
}
static method test() → dynamic {
self::C<(self::C<dynamic>) → self::C<dynamic>> a = throw 42;
+ self::C<self::C<(dynamic) → dynamic>> b = throw 42;
}
static method main() → dynamic {}
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.modular.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.modular.expect
index 0d5fcd0..1722631 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.modular.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:10:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart:13:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A a = throw 42; // Error.
@@ -10,7 +10,7 @@
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:7: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.dart:10:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
+// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:13:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart'.
// A a = throw 42; // Error.
// ^
@@ -20,6 +20,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
: super core::Object::•()
@@ -27,7 +29,12 @@
}
static method test() → dynamic {
self::C<(self::C<dynamic>) → self::C<dynamic>> a = throw 42;
+ self::C<self::C<(dynamic) → dynamic>> b = throw 42;
}
static method main() → dynamic {}
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.outline.expect
index 88c365f..d28fc07 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.outline.expect
@@ -4,6 +4,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
;
@@ -14,3 +16,7 @@
;
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.transformed.expect
index 0d5fcd0..1722631 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.weak.transformed.expect
@@ -2,7 +2,7 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:10:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart:13:3: Error: Inferred type argument 'C<dynamic> Function(C<dynamic>)' 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.dart'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// A a = throw 42; // Error.
@@ -10,7 +10,7 @@
// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:7: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.dart:10:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
+// pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart:13:3: Context: If you want 'A<C<dynamic> Function(C<dynamic>)>' to be a super-bounded type, note that the inverted type 'A<G<C<Never>>>' must then satisfy its bounds, which it does not.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart'.
// A a = throw 42; // Error.
// ^
@@ -20,6 +20,8 @@
typedef G<invariant X extends core::Object? = dynamic> = (X%) → X%;
typedef A<X extends (self::C<X>) → self::C<X> = (self::C<dynamic>) → self::C<dynamic>> = self::C<X>;
+typedef H<invariant X extends core::Object? = dynamic> = self::C<(X%) → X%>;
+typedef B<X extends self::C<(X) → X> = self::C<(dynamic) → dynamic>> = self::C<X>;
class C<X extends core::Object? = dynamic> extends core::Object {
synthetic constructor •() → self::C<self::C::X%>
: super core::Object::•()
@@ -27,7 +29,12 @@
}
static method test() → dynamic {
self::C<(self::C<dynamic>) → self::C<dynamic>> a = throw 42;
+ self::C<self::C<(dynamic) → dynamic>> b = throw 42;
}
static method main() → dynamic {}
static method _#A#new#tearOff<X extends (self::C<self::_#A#new#tearOff::X>) → self::C<self::_#A#new#tearOff::X> = (self::C<dynamic>) → self::C<dynamic>>() → self::C<self::_#A#new#tearOff::X>
return new self::C::•<self::_#A#new#tearOff::X>();
+static method _#H#new#tearOff<invariant X extends core::Object? = dynamic>() → self::C<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>
+ return new self::C::•<(self::_#H#new#tearOff::X%) → self::_#H#new#tearOff::X%>();
+static method _#B#new#tearOff<X extends self::C<(self::_#B#new#tearOff::X) → self::_#B#new#tearOff::X> = self::C<(dynamic) → dynamic>>() → self::C<self::_#B#new#tearOff::X>
+ return new self::C::•<self::_#B#new#tearOff::X>();