| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, 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 class A<T> { |
| 6 Function closure; |
| 7 A._(this.closure); |
| 8 |
| 9 factory A() { |
| 10 return new A._(() => new Set<T>()); |
| 11 } |
| 12 |
| 13 A.bar() { |
| 14 closure = () => new Set<T>(); |
| 15 } |
| 16 |
| 17 static |
| 18 T /// 01: static type warning, dynamic type error |
| 19 staticMethod( |
| 20 T /// 02: static type warning, dynamic type error |
| 21 a) { |
| 22 final |
| 23 T /// 03: static type warning, dynamic type error |
| 24 a = null; |
| 25 print(a); |
| 26 } |
| 27 |
| 28 static final |
| 29 T /// 04: static type warning, dynamic type error |
| 30 staticField = null; |
| 31 } |
| 32 |
| 33 main() { |
| 34 var s = ((new A()).closure)(); |
| 35 Expect.isTrue(s is Set); |
| 36 |
| 37 s = ((new A.bar()).closure)(); |
| 38 Expect.isTrue(s is Set); |
| 39 |
| 40 s = ((new A<int>()).closure)(); |
| 41 Expect.isTrue(s is Set<int>); |
| 42 Expect.isFalse(s is Set<double>); |
| 43 |
| 44 s = ((new A<int>.bar()).closure)(); |
| 45 Expect.isTrue(s is Set<int>); |
| 46 Expect.isFalse(s is Set<double>); |
| 47 |
| 48 A.staticMethod(null); |
| 49 print(A.staticField); |
| 50 } |
| OLD | NEW |