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

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

Issue 3007803002: Migrate block 162 to Dart 2.0.
Patch Set: Created 3 years, 3 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
(Empty)
1 // Copyright (c) 2012, 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
5 import "package:expect/expect.dart";
6
7 // Test of parameterized types with invalid bounds.
8
9 abstract class J<T> {}
10
11 abstract class K<T> {}
12
13 abstract class I<
14 T
15 extends num //# 00: continued
16 extends num //# 01: continued
17 extends num //# 02: continued
18 extends num //# 03: continued
19 extends num //# 04: continued
20 extends num //# 05: continued
21 extends num //# 06: continued
22 > {}
23
24 class A<T> implements I<T>, J<T> {}
25
26 main() {
27 var a = new A<String>();
28
29 {
30 I i = a; // //# 00: dynamic type error, static type warning
31 J j = a; // //# 01: static type warning
32 K k = a; // //# 02: dynamic type error, static type warning
33
34 // In production mode, A<String> is subtype of I, error in checked mode.
35 var x = a is I; // //# 03: dynamic type error, static type warning
36
37 // In both production and checked modes, A<String> is a subtype of J.
38 Expect.isTrue(a is J); // //# 04: static type warning
39
40 // In both production and checked modes, A<String> is not a subtype of K.
41 // However, while unsuccessfully trying to prove that A<String> is a K,
42 // a malformed type is encountered in checked mode, resulting in a dynamic
43 // type error.
44 Expect.isTrue(a is !K); // //# 05: dynamic type error, static type warning
45 }
46
47 a = new A<int>();
48
49 {
50 I i = a;
51 J j = a;
52 K k = a; // //# 06: dynamic type error, static type warning
53
54 // In both production and checked modes, A<int> is a subtype of I.
55 Expect.isTrue(a is I);
56
57 // In both production and checked modes, A<int> is a subtype of J.
58 Expect.isTrue(a is J);
59
60 // In both production and checked modes, A<int> is not a subtype of K.
61 Expect.isTrue(a is! K);
62 }
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698