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

Side by Side Diff: tests/language_strong/mixin_super_bound_test.dart

Issue 2861783002: fix more mixin tests to work in strong mode (Closed)
Patch Set: Created 3 years, 7 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
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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 bool inCheckedMode() { 7 bool inCheckedMode() {
8 try { 8 try {
9 var i = 42; 9 String s = 42 as dynamic;
10 String s = i;
11 } on TypeError catch (e) { 10 } on TypeError catch (e) {
12 return true; 11 return true;
13 } 12 }
14 return false; 13 return false;
15 } 14 }
16 15
17 class M<U extends V, V> {} 16 class M<U extends V, V> {}
18 17
19 class N<U, V extends U> {} 18 class N<U, V extends U> {}
20 19
21 class S<T> {} 20 class S<T> {}
22 21
23 class MNA<U, V, W> extends S<List<U>> with M<V, U>, N<List<W>, List<W>> {} 22 class MNA<U, V extends U, W> extends S<List<U>>
23 with M<V, U>, N<List<W>, List<W>> {}
24 24
25 class MNA2<U, V, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>; 25 class MNA2<U, V extends U, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>;
26 26
27 main() { 27 main() {
28 new MNA<num, int, bool>(); 28 new MNA<num, int, bool>();
29 new MNA2<num, int, bool>(); 29 new MNA2<num, int, bool>();
30 if (inCheckedMode()) { 30 if (inCheckedMode()) {
31 // Type parameter U of M must extend type parameter V, but 31 // Type parameter U of M must extend type parameter V, but
32 // type argument num is not a subtype of int. 32 // type argument num is not a subtype of int.
33 Expect.throws(() => new MNA<int, num, bool>(), (e) => e is TypeError); 33 Expect.throws(() => new MNA<int, num, bool>(), (e) => e is TypeError);
34 // Type parameter U of M must extend type parameter V, but 34 // Type parameter U of M must extend type parameter V, but
35 // type argument num is not a subtype of int. 35 // type argument num is not a subtype of int.
36 Expect.throws(() => new MNA2<int, num, bool>(), (e) => e is TypeError); 36 Expect.throws(() => new MNA2<int, num, bool>(), (e) => e is TypeError);
37 } else { 37 } else {
38 new MNA<int, num, bool>(); 38 new MNA<int, num, bool>();
39 new MNA2<int, num, bool>(); 39 new MNA2<int, num, bool>();
40 } 40 }
41 } 41 }
OLDNEW
« no previous file with comments | « tests/language_strong/mixin_method_test.dart ('k') | tests/language_strong/mixin_super_constructor2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698