OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=--supermixin |
| 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 bool inCheckedMode() { |
| 9 try { |
| 10 var i = 42; |
| 11 String s = i; |
| 12 } on TypeError catch (e) { |
| 13 return true; |
| 14 } |
| 15 return false; |
| 16 } |
| 17 |
| 18 class MS<U, V extends U> { } |
| 19 |
| 20 class M<U extends V, V> extends MS<V, U> { } |
| 21 |
| 22 class NS<U extends V, V> { } |
| 23 |
| 24 class N<U, V extends U> extends NS<V, U> { } |
| 25 |
| 26 class S<T> { } |
| 27 |
| 28 class MNA<U, V, W> extends S<List<U>> |
| 29 with M<List<V>, List<U>>, N<List<W>, List<W>> { } |
| 30 |
| 31 class MNA2<U, V, W> = S<List<U>> |
| 32 with M<List<W>, List<W>>, N<List<U>, List<V>>; |
| 33 |
| 34 class MNA3<U, V, W> extends S<List<U>> |
| 35 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>> { } |
| 36 |
| 37 class MNA4<U, V, W> = S<List<U>> |
| 38 with MNA<U, V, W>, MNA2<List<U>, List<V>, List<W>>; |
| 39 |
| 40 main() { |
| 41 new MNA<num, int, bool>(); |
| 42 new MNA2<num, int, bool>(); |
| 43 new MNA3<num, int, bool>(); |
| 44 new MNA4<num, int, bool>(); |
| 45 if (inCheckedMode()) { |
| 46 Expect.throws(() => new MNA<int, num, bool>(), (e) => e is TypeError); |
| 47 Expect.throws(() => new MNA2<int, num, bool>(), (e) => e is TypeError); |
| 48 Expect.throws(() => new MNA3<int, num, bool>(), (e) => e is TypeError); |
| 49 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); |
| 50 } else { |
| 51 new MNA<int, num, bool>(); |
| 52 new MNA2<int, num, bool>(); |
| 53 new MNA3<int, num, bool>(); |
| 54 new MNA4<int, num, bool>(); |
| 55 } |
| 56 } |
| 57 |
OLD | NEW |