Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Test instantiation of object with malbounded types. | |
| 6 | |
| 7 class A< | |
| 8 T | |
| 9 extends num //# 01: compile-time error | |
|
eernst
2017/09/04 17:05:01
It seems wrong to mark this point as a compile-tim
| |
| 10 > {} | |
| 11 | |
| 12 class B<T> implements A<T> {} | |
| 13 | |
| 14 class C< | |
| 15 T | |
| 16 extends num //# 01: continued | |
| 17 > implements B<T> {} | |
| 18 | |
| 19 class Class<T> { | |
| 20 newA() { | |
| 21 new A<T>(); //# 01: continued | |
|
eernst
2017/09/04 17:05:00
During subtest none this is fine, so why omit this
| |
| 22 } | |
| 23 newB() { | |
| 24 new B<T>(); //# 01: continued | |
|
eernst
2017/09/04 17:05:01
Like line 21.
| |
| 25 } | |
| 26 newC() { | |
| 27 new C<T>(); //# 01: continued | |
|
eernst
2017/09/04 17:05:01
Like line 21.
| |
| 28 } | |
| 29 } | |
| 30 | |
| 31 void test(f()) { | |
| 32 var v = f(); | |
| 33 } | |
| 34 | |
| 35 void main() { | |
| 36 test(() => new A<int>()); | |
| 37 test(() => new B<int>()); | |
|
eernst
2017/09/04 17:05:01
In subtest 01, class B has a compile-time error. A
| |
| 38 test(() => new C<int>()); | |
|
eernst
2017/09/04 17:05:00
Same issue: In subtest 01, class C implements a cl
| |
| 39 | |
| 40 test(() => new A<String>()); //# 01: continued | |
| 41 test(() => new B<String>()); //# 01: continued | |
| 42 test(() => new C<String>()); //# 01: continued | |
|
eernst
2017/09/04 17:05:00
In subtest none, all instance creations in lines 4
| |
| 43 | |
| 44 dynamic c = new Class<int>(); | |
| 45 test(() => c.newA()); | |
| 46 test(() => c.newB()); | |
| 47 test(() => c.newC()); | |
| 48 | |
| 49 c = new Class<String>(); | |
| 50 test(() => c.newA()); //# 01: continued | |
| 51 test(() => c.newB()); //# 01: continued | |
| 52 test(() => c.newC()); //# 01: continued | |
|
eernst
2017/09/04 17:05:01
During subtest 01 we are expecting a compile-time
| |
| 53 } | |
| OLD | NEW |