| 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 bool get inCheckedMode { | 7 bool get inCheckedMode { |
| 8 try { | 8 try { |
| 9 String a = 42; | 9 var i = 42; |
| 10 String a = i; |
| 10 } catch (e) { | 11 } catch (e) { |
| 11 return true; | 12 return true; |
| 12 } | 13 } |
| 13 return false; | 14 return false; |
| 14 } | 15 } |
| 15 | 16 |
| 16 class A<T> { | 17 class A<T> { |
| 17 T field; | 18 T field; |
| 18 } | 19 } |
| 19 | 20 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 if (inCheckedMode) { | 32 if (inCheckedMode) { |
| 32 Expect.throws(() => a.field = 42, (e) => e is TypeError); | 33 Expect.throws(() => a.field = 42, (e) => e is TypeError); |
| 33 Expect.throws(() => new B<String>(), (e) => e is TypeError); | 34 Expect.throws(() => new B<String>(), (e) => e is TypeError); |
| 34 Expect.throws(() => c.field = 'foo', (e) => e is TypeError); | 35 Expect.throws(() => c.field = 'foo', (e) => e is TypeError); |
| 35 } else { | 36 } else { |
| 36 a.field = 42; | 37 a.field = 42; |
| 37 new B<String>(); | 38 new B<String>(); |
| 38 c.field = 'foo'; | 39 c.field = 'foo'; |
| 39 } | 40 } |
| 40 } | 41 } |
| OLD | NEW |