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