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 typedef T Func<T>(); | 7 typedef T Func<T>(); |
8 | 8 |
9 class Foo<S> { | 9 class Foo<S> { |
10 m(x) => x is Func<S>; | 10 m(x) => x is Func<S>; |
11 } | 11 } |
12 | 12 |
13 class Bar<T> { | 13 class Bar<T> { |
14 f() { | 14 f() { |
15 T local() {} | 15 T local() {} |
16 return local; | 16 return local; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 void main() { | 20 void main() { |
21 var x = new Foo<List<String>>(); | 21 dynamic x = new Foo<List<String>>(); |
22 if (new DateTime.now().millisecondsSinceEpoch == 42) x = new Foo<int>(); | 22 if (new DateTime.now().millisecondsSinceEpoch == 42) x = new Foo<int>(); |
23 Expect.isFalse(x.m(new Bar<String>().f())); | 23 Expect.isFalse(x.m(new Bar<String>().f())); |
24 Expect.isTrue(x.m(new Bar<List<String>>().f())); | 24 Expect.isTrue(x.m(new Bar<List<String>>().f())); |
25 } | 25 } |
OLD | NEW |