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> = S with M; | 42 class C0<T> = S with M; |
44 class C1<T> = S with M<T>; | 43 class C1<T> = S with M<T>; |
45 class C2<T> = S with M<int>; | 44 class C2<T> = S with M<int>; |
46 class C3 = S with M<String>; | 45 class C3 = S with M<String>; |
47 | 46 |
48 main() { | 47 main() { |
49 var c0 = new C0(); | 48 var c0 = new C0(); |
50 Expect.isTrue(c0 is M); | 49 Expect.isTrue(c0 is M); |
51 Expect.isTrue(c0 is M<int>); | 50 Expect.isTrue(c0 is M<int>); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 Expect.isFalse(c2_String.matches("hello")); | 118 Expect.isFalse(c2_String.matches("hello")); |
120 | 119 |
121 var c3 = new C3(); | 120 var c3 = new C3(); |
122 Expect.isTrue(c3 is M); | 121 Expect.isTrue(c3 is M); |
123 Expect.isFalse(c3 is M<int>); | 122 Expect.isFalse(c3 is M<int>); |
124 Expect.isTrue(c3 is M<String>); | 123 Expect.isTrue(c3 is M<String>); |
125 Expect.isFalse(c3.matches(c2)); | 124 Expect.isFalse(c3.matches(c2)); |
126 Expect.isFalse(c3.matches(42)); | 125 Expect.isFalse(c3.matches(42)); |
127 Expect.isTrue(c3.matches("hello")); | 126 Expect.isTrue(c3.matches("hello")); |
128 } | 127 } |
OLD | NEW |