OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016, 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.md file. | |
4 | |
5 class C<T, S> { | |
6 foo(S s) => (T x) { | |
7 T y = x; | |
8 Object z = y; | |
9 C<T, S> self = this; | |
10 return z as T; | |
11 }; | |
12 | |
13 bar() { | |
14 C<T, S> self = this; | |
15 } | |
16 | |
17 baz() { | |
18 return () => () => new C<T, S>(); | |
19 } | |
20 | |
21 factory C() { | |
22 local() { | |
23 C<T, S> self = new C<T, S>.internal(); | |
24 return self; | |
25 } | |
26 | |
27 return local(); | |
28 } | |
29 C.internal(); | |
30 } | |
31 | |
32 main(arguments) { | |
33 print(new C<String, String>().foo(null)(arguments.first)); | |
34 dynamic c = new C<int, int>().baz()()(); | |
35 if (c is! C<int, int>) throw "$c fails type test 'is C<int, int>'"; | |
36 if (c is C<String, String>) { | |
37 throw "$c passes type test 'is C<String, String>'"; | |
38 } | |
39 print(c); | |
40 } | |
OLD | NEW |