| 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 C { | 7 class C {} |
| 8 } | |
| 9 | 8 |
| 10 class A<T> { | 9 class A<T> { |
| 11 var field; | 10 var field; |
| 12 A(this.field); | 11 A(this.field); |
| 13 T foo() => field; | 12 T foo() => field; |
| 14 int bar() => field; | 13 int bar() => field; |
| 15 } | 14 } |
| 16 | 15 |
| 17 class B extends A<C> { | 16 class B extends A<C> { |
| 18 B() : super(new C()); | 17 B() : super(new C()); |
| 19 } | 18 } |
| 20 | 19 |
| 21 main() { | 20 main() { |
| 22 B b = new B(); | 21 B b = new B(); |
| 23 Expect.equals(b.field, b.foo()); | 22 Expect.equals(b.field, b.foo()); |
| 24 bool isCheckedMode = false; | 23 bool isCheckedMode = false; |
| 25 try { | 24 try { |
| 26 String a = 42; | 25 String a = 42; |
| 27 } catch (e) { | 26 } catch (e) { |
| 28 isCheckedMode = true; | 27 isCheckedMode = true; |
| 29 } | 28 } |
| 30 if (isCheckedMode) { | 29 if (isCheckedMode) { |
| 31 Expect.throws(b.bar, (e) => e is TypeError); | 30 Expect.throws(b.bar, (e) => e is TypeError); |
| 32 } else { | 31 } else { |
| 33 Expect.equals(b.field, b.bar()); | 32 Expect.equals(b.field, b.bar()); |
| 34 } | 33 } |
| 35 } | 34 } |
| OLD | NEW |