OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 bool get inCheckedMode { |
| 8 try { |
| 9 String a = 42; |
| 10 } catch (e) { |
| 11 return true; |
| 12 } |
| 13 return false; |
| 14 } |
| 15 |
| 16 class A<T> { |
| 17 A(f) { |
| 18 f(42); |
| 19 } |
| 20 } |
| 21 |
| 22 class B<T> extends A<T> { |
| 23 B() : super((T param) => 42); |
| 24 } |
| 25 |
| 26 main() { |
| 27 var t = new B<int>(); |
| 28 bool caughtException = false; |
| 29 |
| 30 try { |
| 31 new B<String>(); |
| 32 } on TypeError catch (e) { |
| 33 caughtException = true; |
| 34 } |
| 35 Expect.isTrue(!inCheckedMode || caughtException); |
| 36 } |
OLD | NEW |