OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Dart test for legally self referencing function type alias. | 4 // Dart test for legally self referencing function type alias. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 typedef F(List | 8 typedef F(List |
9 <F> // /// 00: compile-time error | 9 <F> // //# 00: compile-time error |
10 x); | 10 x); |
11 | 11 |
12 typedef D C(); | 12 typedef D C(); |
13 | 13 |
14 class D { | 14 class D { |
15 C foo() { } | 15 C foo() { } |
16 D bar() { } | 16 D bar() { } |
17 } | 17 } |
18 | 18 |
19 main() { | 19 main() { |
20 var f = (List x) { }; | 20 var f = (List x) { }; |
21 Expect.isTrue(f is F); | 21 Expect.isTrue(f is F); |
22 var g = (List<F> x) { }; | 22 var g = (List<F> x) { }; |
23 Expect.isTrue(g is F); | 23 Expect.isTrue(g is F); |
24 var d = new D(); | 24 var d = new D(); |
25 Expect.isTrue(d.foo is !C); | 25 Expect.isTrue(d.foo is !C); |
26 Expect.isTrue(d.bar is C); | 26 Expect.isTrue(d.bar is C); |
27 } | 27 } |
OLD | NEW |