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 return local(); |
| 27 } |
| 28 C.internal(); |
| 29 } |
| 30 |
| 31 main(arguments) { |
| 32 print(new C<String, String>().foo(null)(arguments.first)); |
| 33 dynamic c = new C<int, int>().baz()()(); |
| 34 if (c is! C<int, int>) throw "$c fails type test 'is C<int, int>'"; |
| 35 if (c is C<String, String>) { |
| 36 throw "$c passes type test 'is C<String, String>'"; |
| 37 } |
| 38 print(c); |
| 39 } |
OLD | NEW |