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

Unified Diff: tests/language/cyclic_typedef_test.dart

Issue 13261008: Check for cyclic reference in typedefs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/cyclic_typedef_test.dart
diff --git a/tests/language/cyclic_typedef_test.dart b/tests/language/cyclic_typedef_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..61d8d0b8704d7d8cb05acf499ec6eed15f8ac7ed
--- /dev/null
+++ b/tests/language/cyclic_typedef_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Check that cyclic reference of a typedef is a compile-time error.
+
+// To test various cyclic references the definition of the [:typedef A():] is
+// split over several lines:
+typedef
+
+// Cyclic through return type.
+A /// 01: compile-time error
+
+A // The name of the typedef
+
+( // The left parenthesis of the typedef arguments.
+
+// Cyclic through parameter type.
+A a /// 02: compile-time error
+
+// Cyclic through optional parameter type.
+[A a] /// 03: compile-time error
+
+// Cyclic through named parameter type.
+{A a} /// 04: compile-time error
+
+// Cyclic through generic parameter type.
+List<A> a /// 05: compile-time error
+
+// Cyclic through return type of function typed parameter.
+A f() /// 06: compile-time error
+
+// Cyclic through parameter type of function typed parameter.
+f(A a) /// 07: compile-time error
+
+// Cyclic through another typedef.
+B b /// 08: compile-time error
+
+// Cyclic through another more typedefs.
+C c /// 09: compile-time error
+
+); // The right parenthesis of the typedef arguments.
+
+typedef B(A a);
+typedef C(B b);
+
+void testA(A a) {}
+
+void main() {
+ testA(null);
+}
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698