OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Check that cyclic reference of a typedef is a compile-time error. |
| 6 |
| 7 // To test various cyclic references the definition of the [:typedef A():] is |
| 8 // split over several lines: |
| 9 typedef |
| 10 |
| 11 // Cyclic through return type. |
| 12 A /// 01: compile-time error |
| 13 |
| 14 A // The name of the typedef |
| 15 |
| 16 ( // The left parenthesis of the typedef arguments. |
| 17 |
| 18 // Cyclic through parameter type. |
| 19 A a /// 02: compile-time error |
| 20 |
| 21 // Cyclic through optional parameter type. |
| 22 [A a] /// 03: compile-time error |
| 23 |
| 24 // Cyclic through named parameter type. |
| 25 {A a} /// 04: compile-time error |
| 26 |
| 27 // Cyclic through generic parameter type. |
| 28 List<A> a /// 05: compile-time error |
| 29 |
| 30 // Cyclic through return type of function typed parameter. |
| 31 A f() /// 06: compile-time error |
| 32 |
| 33 // Cyclic through parameter type of function typed parameter. |
| 34 f(A a) /// 07: compile-time error |
| 35 |
| 36 // Cyclic through another typedef. |
| 37 B b /// 08: compile-time error |
| 38 |
| 39 // Cyclic through another more typedefs. |
| 40 C c /// 09: compile-time error |
| 41 |
| 42 ); // The right parenthesis of the typedef arguments. |
| 43 |
| 44 typedef B(A a); |
| 45 typedef C(B b); |
| 46 |
| 47 void testA(A a) {} |
| 48 |
| 49 void main() { |
| 50 testA(null); |
| 51 } |
OLD | NEW |