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< | 18 class MS<U, V |
19 U, | |
20 V | |
21 extends U //# 01: static type warning | 19 extends U //# 01: static type warning |
22 > {} | 20 > { } |
23 | 21 |
24 class M< | 22 class M<U |
25 U | |
26 extends V //# 01: continued | 23 extends V //# 01: continued |
27 , | 24 , V> extends MS<V, U> { } |
28 V> extends MS<V, U> {} | |
29 | 25 |
30 class NS< | 26 class NS<U |
31 U | |
32 extends V //# 01: continued | 27 extends V //# 01: continued |
33 , | 28 , V> { } |
34 V> {} | |
35 | 29 |
36 class N< | 30 class N<U, V |
37 U, | |
38 V | |
39 extends U //# 01: continued | 31 extends U //# 01: continued |
40 > extends NS<V, U> {} | 32 > extends NS<V, U> { } |
41 | 33 |
42 class S<T> {} | 34 class S<T> { } |
43 | 35 |
44 class MNA<U, V, W> extends S<List<U>> | 36 class MNA<U, V, W> extends S<List<U>> |
45 with M<List<V>, List<U>>, N<List<W>, List<W>> {} | 37 with M<List<V>, List<U>>, N<List<W>, List<W>> { } |
46 | 38 |
47 class MNA2<U, V, W> = S<List<U>> with M<List<W>, List<W>>, N<List<U>, List<V>>; | 39 class MNA2<U, V, W> = S<List<U>> |
| 40 with M<List<W>, List<W>>, N<List<U>, List<V>>; |
48 | 41 |
49 class MNA3<U, V, W> extends S<List<U>> | 42 class MNA3<U, V, W> extends S<List<U>> |
50 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>> {} | 43 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>> { } |
51 | 44 |
52 class MNA4<U, V, W> = S<List<U>> | 45 class MNA4<U, V, W> = S<List<U>> |
53 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>>; | 46 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>>; |
54 | 47 |
55 main() { | 48 main() { |
56 new MNA<num, int, bool>(); | 49 new MNA<num, int, bool>(); |
57 new MNA2<num, int, bool>(); | 50 new MNA2<num, int, bool>(); |
58 new MNA3<num, int, bool>(); | 51 new MNA3<num, int, bool>(); |
59 new MNA4<num, int, bool>(); | 52 new MNA4<num, int, bool>(); |
60 bool shouldThrow = false | 53 bool shouldThrow = false |
(...skipping 12 matching lines...) Expand all Loading... |
73 // Type parameter V of N must extend type parameter U, but | 66 // Type parameter V of N must extend type parameter U, but |
74 // type argument List<List<num>> is not a subtype of List<List<int>>. | 67 // type argument List<List<num>> is not a subtype of List<List<int>>. |
75 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); | 68 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); |
76 } else { | 69 } else { |
77 new MNA<int, num, bool>(); | 70 new MNA<int, num, bool>(); |
78 new MNA2<int, num, bool>(); | 71 new MNA2<int, num, bool>(); |
79 new MNA3<int, num, bool>(); | 72 new MNA3<int, num, bool>(); |
80 new MNA4<int, num, bool>(); | 73 new MNA4<int, num, bool>(); |
81 } | 74 } |
82 } | 75 } |
| 76 |
OLD | NEW |