OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // SharedOptions=--supermixin | 4 // SharedOptions=--supermixin |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 bool inCheckedMode() { | 8 bool inCheckedMode() { |
9 try { | 9 try { |
10 var i = 42; | 10 var i = 42; |
11 String s = i; | 11 String s = i; |
12 } on TypeError catch (e) { | 12 } on TypeError catch (e) { |
13 return true; | 13 return true; |
14 } | 14 } |
15 return false; | 15 return false; |
16 } | 16 } |
17 | 17 |
18 class MS<U, V | 18 class MS< |
| 19 U, |
| 20 V |
19 extends U //# 01: static type warning | 21 extends U //# 01: static type warning |
20 > { } | 22 > {} |
21 | 23 |
22 class M<U | 24 class M< |
| 25 U |
23 extends V //# 01: continued | 26 extends V //# 01: continued |
24 , V> extends MS<V, U> { } | 27 , |
| 28 V> extends MS<V, U> {} |
25 | 29 |
26 class NS<U | 30 class NS< |
| 31 U |
27 extends V //# 01: continued | 32 extends V //# 01: continued |
28 , V> { } | 33 , |
| 34 V> {} |
29 | 35 |
30 class N<U, V | 36 class N< |
| 37 U, |
| 38 V |
31 extends U //# 01: continued | 39 extends U //# 01: continued |
32 > extends NS<V, U> { } | 40 > extends NS<V, U> {} |
33 | 41 |
34 class S<T> { } | 42 class S<T> {} |
35 | 43 |
36 class MNA<U, V, W> extends S<List<U>> | 44 class MNA<U, V, W> extends S<List<U>> |
37 with M<List<V>, List<U>>, N<List<W>, List<W>> { } | 45 with M<List<V>, List<U>>, N<List<W>, List<W>> {} |
38 | 46 |
39 class MNA2<U, V, W> = S<List<U>> | 47 class MNA2<U, V, W> = S<List<U>> with M<List<W>, List<W>>, N<List<U>, List<V>>; |
40 with M<List<W>, List<W>>, N<List<U>, List<V>>; | |
41 | 48 |
42 class MNA3<U, V, W> extends S<List<U>> | 49 class MNA3<U, V, W> extends S<List<U>> |
43 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>> { } | 50 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>> {} |
44 | 51 |
45 class MNA4<U, V, W> = S<List<U>> | 52 class MNA4<U, V, W> = S<List<U>> |
46 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>>; | 53 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>>; |
47 | 54 |
48 main() { | 55 main() { |
49 new MNA<num, int, bool>(); | 56 new MNA<num, int, bool>(); |
50 new MNA2<num, int, bool>(); | 57 new MNA2<num, int, bool>(); |
51 new MNA3<num, int, bool>(); | 58 new MNA3<num, int, bool>(); |
52 new MNA4<num, int, bool>(); | 59 new MNA4<num, int, bool>(); |
53 bool shouldThrow = false | 60 bool shouldThrow = false |
(...skipping 12 matching lines...) Expand all Loading... |
66 // Type parameter V of N must extend type parameter U, but | 73 // Type parameter V of N must extend type parameter U, but |
67 // type argument List<List<num>> is not a subtype of List<List<int>>. | 74 // type argument List<List<num>> is not a subtype of List<List<int>>. |
68 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); | 75 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); |
69 } else { | 76 } else { |
70 new MNA<int, num, bool>(); | 77 new MNA<int, num, bool>(); |
71 new MNA2<int, num, bool>(); | 78 new MNA2<int, num, bool>(); |
72 new MNA3<int, num, bool>(); | 79 new MNA3<int, num, bool>(); |
73 new MNA4<int, num, bool>(); | 80 new MNA4<int, num, bool>(); |
74 } | 81 } |
75 } | 82 } |
76 | |
OLD | NEW |