Index: tests/language_2/type_variable_bounds4_test.dart |
diff --git a/tests/language_2/type_variable_bounds4_test.dart b/tests/language_2/type_variable_bounds4_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9e149b0817ff9df8c317a9a040efb3e6a9ffed98 |
--- /dev/null |
+++ b/tests/language_2/type_variable_bounds4_test.dart |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2013, 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. |
+ |
+// Test instantiation of object with malbounded types. |
+ |
+class A< |
+ T |
+ extends num //# 01: compile-time error |
eernst
2017/09/04 17:05:01
It seems wrong to mark this point as a compile-tim
|
+ > {} |
+ |
+class B<T> implements A<T> {} |
+ |
+class C< |
+ T |
+ extends num //# 01: continued |
+ > implements B<T> {} |
+ |
+class Class<T> { |
+ newA() { |
+ new A<T>(); //# 01: continued |
eernst
2017/09/04 17:05:00
During subtest none this is fine, so why omit this
|
+ } |
+ newB() { |
+ new B<T>(); //# 01: continued |
eernst
2017/09/04 17:05:01
Like line 21.
|
+ } |
+ newC() { |
+ new C<T>(); //# 01: continued |
eernst
2017/09/04 17:05:01
Like line 21.
|
+ } |
+} |
+ |
+void test(f()) { |
+ var v = f(); |
+} |
+ |
+void main() { |
+ test(() => new A<int>()); |
+ test(() => new B<int>()); |
eernst
2017/09/04 17:05:01
In subtest 01, class B has a compile-time error. A
|
+ test(() => new C<int>()); |
eernst
2017/09/04 17:05:00
Same issue: In subtest 01, class C implements a cl
|
+ |
+ test(() => new A<String>()); //# 01: continued |
+ test(() => new B<String>()); //# 01: continued |
+ test(() => new C<String>()); //# 01: continued |
eernst
2017/09/04 17:05:00
In subtest none, all instance creations in lines 4
|
+ |
+ dynamic c = new Class<int>(); |
+ test(() => c.newA()); |
+ test(() => c.newB()); |
+ test(() => c.newC()); |
+ |
+ c = new Class<String>(); |
+ test(() => c.newA()); //# 01: continued |
+ test(() => c.newB()); //# 01: continued |
+ test(() => c.newC()); //# 01: continued |
eernst
2017/09/04 17:05:01
During subtest 01 we are expecting a compile-time
|
+} |