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

Side by Side Diff: tests/language/src/TypeVariableBounds2Test.dart

Issue 9565016: Check type argument bounds of interfaces in type tests (work in progress). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/src/Prefix22Test.dart ('k') | tests/language/src/TypeVariableBoundsTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Test of parameterized types with invalid bounds.
6
7 interface I<T extends num> { }
8
9 interface J<T> { }
10
11 interface K<T> { }
12
13 class A<T> implements I<T>, J<T> {
14 }
15
16 main() {
17 var a = new A<String>();
18
19 {
20 I i = a; /// 00: dynamic type error
21 J j = a; /// 01: static type error
22 K k = a; /// 02: dynamic type error
23
24 // In production mode, A<String> is subtype of I, but error in checked mode.
25 var x = a is I; /// 03: dynamic type error
26
27 // In both production and checked modes, A<String> is a subtype of I.
28 Expect.isTrue(a is J); /// 04: static type error
29
30 // In both production and checked modes, A<String> is not a subtype of K.
31 Expect.isTrue(a is !K); /// 05: static type error
32 }
33
34 a = new A<int>();
35
36 {
37 I i = a;
38 J j = a;
39 K k = a; /// 06: dynamic type error
40
41 // In both production and checked modes, A<int> is a subtype of I.
42 Expect.isTrue(a is I);
43
44 // In both production and checked modes, A<int> is a subtype of J.
45 Expect.isTrue(a is J);
46
47 // In both production and checked modes, A<int> is not a subtype of K.
48 Expect.isTrue(a is !K);
49 }
50 }
OLDNEW
« no previous file with comments | « tests/language/src/Prefix22Test.dart ('k') | tests/language/src/TypeVariableBoundsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698