Index: tests/language_strong/covariant_subtyping_unsafe_call3_test.dart |
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..71143e696361c6e24338cf83fa3738c4dedf2dd1 |
--- /dev/null |
+++ b/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+import 'package:expect/expect.dart'; |
+ |
+class Implementation { |
+ dynamic method(int x) {} |
+} |
+ |
+abstract class Interface1<T> { |
+ dynamic method(T x); |
+} |
+ |
+abstract class Interface2<T> { |
+ dynamic method(T x); |
+} |
+ |
+class Subclass extends Implementation |
+ implements Interface1<int>, Interface2<int> {} |
+ |
+main() { |
+ Subclass subclass = new Subclass(); |
+ |
+ Interface1<int> intInterface1 = subclass; |
+ Interface1<num> numInterface1 = intInterface1; |
+ Expect.throws(() => numInterface1.method(2.5)); |
+ |
+ Interface2<int> intInterface2 = subclass; |
+ Interface2<num> numInterface2 = intInterface2; |
+ Expect.throws(() => numInterface2.method(2.5)); |
+} |