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

Unified Diff: tests/language_strong/covariant_subtyping_test.dart

Issue 2998873002: fix #30427, casting tearoffs to the wrong type (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 d7ffbc5f49f3b86cad0d85314272526649bab438..552f0b54d5517983dc3328eeb2a39adaaa427e04 100644
--- a/tests/language_strong/covariant_subtyping_test.dart
+++ b/tests/language_strong/covariant_subtyping_test.dart
@@ -93,6 +93,15 @@ testReturnOfFunctionType() {
Expect.equals(cObj.getT(), 42);
}
+testTearoffReturningFunctionType() {
+ FnChecks<int> cInt = new FnChecks<int>();
+ FnChecks<Object> cObj = cInt;
+
+ Expect.throws(
+ () => cObj.setterForT, isTypeError, 'unsound tear-off throws at runtime');
+ Expect.equals(cInt.setterForT, cInt.setterForT, 'sound tear-off works');
+}
+
testFieldOfFunctionType() {
FnChecks<Object> c = new FnChecks<String>()..f = (String b) {};
Expect.throws(() {
@@ -217,6 +226,7 @@ main() {
testPrivateFields();
testClassBounds();
testReturnOfFunctionType();
+ testTearoffReturningFunctionType();
testFieldOfFunctionType();
testFieldOfGenericFunctionType();
testMixinApplication();

Powered by Google App Engine
This is Rietveld 408576698