OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 class M<T> { | 7 class M<T> { |
8 bool matches(o) { | 8 bool matches(o) { |
9 bool isChecked = checkUsingIs(o); | 9 bool isChecked = checkUsingIs(o); |
10 if (checkedMode) { | 10 if (checkedMode) { |
(...skipping 19 matching lines...) Expand all Loading... |
30 static bool computeCheckedMode() { | 30 static bool computeCheckedMode() { |
31 try { | 31 try { |
32 int x = "foo"; | 32 int x = "foo"; |
33 } on Error { | 33 } on Error { |
34 return true; | 34 return true; |
35 } | 35 } |
36 return false; | 36 return false; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 class S { | 40 class S {} |
41 } | |
42 | 41 |
43 class C0<T> extends S with M { } | 42 class C0<T> extends S with M {} |
44 class C1<T> extends S with M<T> { } | 43 |
45 class C2<T> extends S with M<int> { } | 44 class C1<T> extends S with M<T> {} |
46 class C3 extends S with M<String> { } | 45 |
| 46 class C2<T> extends S with M<int> {} |
| 47 |
| 48 class C3 extends S with M<String> {} |
47 | 49 |
48 main() { | 50 main() { |
49 var c0 = new C0(); | 51 var c0 = new C0(); |
50 Expect.isTrue(c0 is M); | 52 Expect.isTrue(c0 is M); |
51 Expect.isTrue(c0 is M<int>); | 53 Expect.isTrue(c0 is M<int>); |
52 Expect.isTrue(c0 is M<String>); | 54 Expect.isTrue(c0 is M<String>); |
53 Expect.isTrue(c0.matches(c0)); | 55 Expect.isTrue(c0.matches(c0)); |
54 Expect.isTrue(c0.matches(42)); | 56 Expect.isTrue(c0.matches(42)); |
55 Expect.isTrue(c0.matches("hello")); | 57 Expect.isTrue(c0.matches("hello")); |
56 | 58 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 Expect.isFalse(c2_String.matches("hello")); | 121 Expect.isFalse(c2_String.matches("hello")); |
120 | 122 |
121 var c3 = new C3(); | 123 var c3 = new C3(); |
122 Expect.isTrue(c3 is M); | 124 Expect.isTrue(c3 is M); |
123 Expect.isFalse(c3 is M<int>); | 125 Expect.isFalse(c3 is M<int>); |
124 Expect.isTrue(c3 is M<String>); | 126 Expect.isTrue(c3 is M<String>); |
125 Expect.isFalse(c3.matches(c2)); | 127 Expect.isFalse(c3.matches(c2)); |
126 Expect.isFalse(c3.matches(42)); | 128 Expect.isFalse(c3.matches(42)); |
127 Expect.isTrue(c3.matches("hello")); | 129 Expect.isTrue(c3.matches("hello")); |
128 } | 130 } |
OLD | NEW |