Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: tests/language_strong/covariant_subtyping_test.dart

Issue 2995813002: fix #30423, covariant parameter tearoff type should be Object (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/language_strong/covariant_subtyping_test.dart
diff --git a/tests/language_strong/covariant_subtyping_test.dart b/tests/language_strong/covariant_subtyping_test.dart
index 552f0b54d5517983dc3328eeb2a39adaaa427e04..c17b23dc4ce1f63164ffb08877fbe9dc631b50d9 100644
--- a/tests/language_strong/covariant_subtyping_test.dart
+++ b/tests/language_strong/covariant_subtyping_test.dart
@@ -221,6 +221,32 @@ testCallMethod() {
}, isTypeError);
}
+class TearOff<T> {
+ method1(T t) => null; // needs check
+ method2(Function(T) takesT) => null;
+ method3(T Function() returnsT) => null; // needs check
+ method4(Function(Function(T)) takesTakesT) => null; // needs check
+ method5(Function(T Function()) takesReturnsT) => null;
+ method6(Function(T) Function() returnsTakesT) => null;
+ method7(T Function() Function() returnsReturnsT) => null; // needs check
+}
+
+testTearOffRuntimeType() {
+ expectRTTI(tearoff, type) => Expect.equals('${tearoff.runtimeType}', type,
+ 'covariant params should reify with Object as their type');
+
+ TearOff<num> t = new TearOff<int>();
+ expectRTTI(t.method1, '(Object) -> dynamic');
+
+ expectRTTI(t.method2, '((int) -> dynamic) -> dynamic');
+ expectRTTI(t.method3, '(Object) -> dynamic');
+
+ expectRTTI(t.method4, '(Object) -> dynamic');
+ expectRTTI(t.method5, '((() -> int) -> dynamic) -> dynamic');
+ expectRTTI(t.method6, '(() -> (int) -> dynamic) -> dynamic');
+ expectRTTI(t.method7, '(Object) -> dynamic');
+}
+
main() {
testField();
testPrivateFields();
@@ -232,4 +258,5 @@ main() {
testMixinApplication();
testGenericMethodBounds();
testCallMethod();
+ testTearOffRuntimeType();
}

Powered by Google App Engine
This is Rietveld 408576698