OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, 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 // Tests cyclic reference to type variables in type expressions | |
6 | |
7 class Base<T> {} | |
8 | |
9 class Derived extends Base<Derived> {} // legal | |
10 | |
11 typedef void funcType<T | |
12 extends T /// 01: static type warning | |
13 >(T arg); | |
14 | |
15 class DerivedFunc extends Base<funcType<DerivedFunc>> { } | |
16 | |
17 | |
18 interface A<S | |
19 extends S /// 02: static type warning | |
20 > { | |
21 S field; | |
22 } | |
23 | |
24 interface B<U extends Base<U>> { // legal | |
25 U field; | |
26 } | |
27 | |
28 class C1<V | |
29 extends V /// 03: static type warning | |
30 > { | |
31 V field; | |
32 } | |
33 | |
34 class C2<V | |
35 extends V /// 04: static type warning | |
36 > implements A<V> { | |
37 V field; | |
38 } | |
39 | |
40 class D1<W extends Base<W>> { // legal | |
41 W field; | |
42 } | |
43 | |
44 class D2<W extends Base<W>> implements B<W>{ // legal | |
45 W field; | |
46 } | |
47 | |
48 class E<X extends Base<funcType<X>>> { // legal | |
49 | |
50 X field; | |
51 } | |
52 | |
53 main() { | |
54 new C1<int>(); | |
55 new C2<int>(); | |
56 new D1<Derived>(); | |
57 new D2<Derived>(); | |
58 new E<DerivedFunc>(); | |
59 funcType<Object> val = null; | |
60 } | |
OLD | NEW |