Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: tests/language/cyclic_typedef_test.dart

Issue 27019003: Update check for cyclic typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add positive test Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Check that cyclic reference of a typedef is a compile-time error. 5 // Check that cyclic reference of a typedef is a compile-time error.
6 6
7 // To test various cyclic references the definition of the [:typedef A():] is 7 // To test various cyclic references the definition of the [:typedef A():] is
8 // split over several lines: 8 // split over several lines:
9 typedef 9 typedef
10 10
11 // Cyclic through return type. 11 // Cyclic through return type.
12 A /// 01: compile-time error 12 A /// 01: compile-time error
13 13
14 A // The name of the typedef 14 A // The name of the typedef
15 15
16 // Cyclic through type variable bound.
17 <T extends A> /// 10: compile-time error
18
19 // Cyclic through generic type variable bound.
20 <T extends List<A>> /// 11: compile-time error
21
16 ( // The left parenthesis of the typedef arguments. 22 ( // The left parenthesis of the typedef arguments.
17 23
18 // Cyclic through parameter type. 24 // Cyclic through parameter type.
19 A a /// 02: compile-time error 25 A a /// 02: compile-time error
20 26
21 // Cyclic through optional parameter type. 27 // Cyclic through optional parameter type.
22 [A a] /// 03: compile-time error 28 [A a] /// 03: compile-time error
23 29
24 // Cyclic through named parameter type. 30 // Cyclic through named parameter type.
25 {A a} /// 04: compile-time error 31 {A a} /// 04: compile-time error
26 32
27 // Cyclic through generic parameter type. 33 // Cyclic through generic parameter type.
28 List<A> a /// 05: compile-time error 34 List<A> a /// 05: compile-time error
29 35
30 // Cyclic through return type of function typed parameter. 36 // Cyclic through return type of function typed parameter.
31 A f() /// 06: compile-time error 37 A f() /// 06: compile-time error
32 38
33 // Cyclic through parameter type of function typed parameter. 39 // Cyclic through parameter type of function typed parameter.
34 f(A a) /// 07: compile-time error 40 f(A a) /// 07: compile-time error
35 41
36 // Cyclic through another typedef. 42 // Cyclic through another typedef.
37 B b /// 08: compile-time error 43 B b /// 08: compile-time error
38 44
39 // Cyclic through another more typedefs. 45 // Cyclic through another more typedefs.
40 C c /// 09: compile-time error 46 C c /// 09: compile-time error
41 47
48 // Reference through a class is not a cyclic self-reference.
49 Class c /// 12: ok
50
51 // Reference through a class type bound is not a cyclic self-reference.
52 Class c /// 13: ok
53
42 ); // The right parenthesis of the typedef arguments. 54 ); // The right parenthesis of the typedef arguments.
43 55
44 typedef B(A a); 56 typedef B(A a);
45 typedef C(B b); 57 typedef C(B b);
46 58
59 class Class
60 <T extends A> /// 13: continued
61 {
62 A a; /// 12: continued
63 }
64
47 void testA(A a) {} 65 void testA(A a) {}
48 66
49 void main() { 67 void main() {
50 testA(null); 68 testA(null);
51 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698