Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: tests/language/mixin_super_bound2_test.dart

Issue 1254933003: Modify DEP 34 language tests in preparation for adding analyzer support. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/mixin_super_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // VMOptions=--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 extends U> { } 18 class MS<U, V
19 extends U /// 01: static type warning
20 > { }
19 21
20 class M<U extends V, V> extends MS<V, U> { } 22 class M<U
23 extends V /// 01: continued
24 , V> extends MS<V, U> { }
21 25
22 class NS<U extends V, V> { } 26 class NS<U
27 extends V /// 01: continued
28 , V> { }
23 29
24 class N<U, V extends U> extends NS<V, U> { } 30 class N<U, V
31 extends U /// 01: continued
32 > extends NS<V, U> { }
25 33
26 class S<T> { } 34 class S<T> { }
27 35
28 class MNA<U, V, W> extends S<List<U>> 36 class MNA<U, V, W> extends S<List<U>>
29 with M<List<V>, List<U>>, N<List<W>, List<W>> { } 37 with M<List<V>, List<U>>, N<List<W>, List<W>> { }
30 38
31 class MNA2<U, V, W> = S<List<U>> 39 class MNA2<U, V, W> = S<List<U>>
32 with M<List<W>, List<W>>, N<List<U>, List<V>>; 40 with M<List<W>, List<W>>, N<List<U>, List<V>>;
33 41
34 class MNA3<U, V, W> extends S<List<U>> 42 class MNA3<U, V, W> extends S<List<U>>
35 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>> { }
36 44
37 class MNA4<U, V, W> = S<List<U>> 45 class MNA4<U, V, W> = S<List<U>>
38 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>>;
39 47
40 main() { 48 main() {
41 new MNA<num, int, bool>(); 49 new MNA<num, int, bool>();
42 new MNA2<num, int, bool>(); 50 new MNA2<num, int, bool>();
43 new MNA3<num, int, bool>(); 51 new MNA3<num, int, bool>();
44 new MNA4<num, int, bool>(); 52 new MNA4<num, int, bool>();
45 if (inCheckedMode()) { 53 bool shouldThrow = false
54 || inCheckedMode() /// 01: continued
55 ;
56 if (shouldThrow) {
46 // Type parameter U of M must extend type parameter V, but 57 // Type parameter U of M must extend type parameter V, but
47 // type argument List<num> is not a subtype of List<int>. 58 // type argument List<num> is not a subtype of List<int>.
48 Expect.throws(() => new MNA<int, num, bool>(), (e) => e is TypeError); 59 Expect.throws(() => new MNA<int, num, bool>(), (e) => e is TypeError);
49 // Type parameter V of N must extend type parameter U, but 60 // Type parameter V of N must extend type parameter U, but
50 // type argument List<num> is not a subtype of List<int>. 61 // type argument List<num> is not a subtype of List<int>.
51 Expect.throws(() => new MNA2<int, num, bool>(), (e) => e is TypeError); 62 Expect.throws(() => new MNA2<int, num, bool>(), (e) => e is TypeError);
52 // Type parameter V of N must extend type parameter U, but 63 // Type parameter V of N must extend type parameter U, but
53 // 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>>.
54 Expect.throws(() => new MNA3<int, num, bool>(), (e) => e is TypeError); 65 Expect.throws(() => new MNA3<int, num, bool>(), (e) => e is TypeError);
55 // Type parameter V of N must extend type parameter U, but 66 // Type parameter V of N must extend type parameter U, but
56 // 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>>.
57 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError); 68 Expect.throws(() => new MNA4<int, num, bool>(), (e) => e is TypeError);
58 } else { 69 } else {
59 new MNA<int, num, bool>(); 70 new MNA<int, num, bool>();
60 new MNA2<int, num, bool>(); 71 new MNA2<int, num, bool>();
61 new MNA3<int, num, bool>(); 72 new MNA3<int, num, bool>();
62 new MNA4<int, num, bool>(); 73 new MNA4<int, num, bool>();
63 } 74 }
64 } 75 }
65 76
OLDNEW
« no previous file with comments | « no previous file | tests/language/mixin_super_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698