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

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: Rebased Created 7 years, 9 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
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..893946edd05c12b654e46c85c3db5ab976251b9e
--- /dev/null
+++ b/tests/language/cyclic_typedef_test.dart
@@ -0,0 +1,45 @@
+// 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.
+
+typedef /*A();*/
ahe 2013/04/02 08:22:39 These comments aren't helping. I think it would b
Johnni Winther 2013/04/02 09:40:14 It looked good in Sublime Text 2! Changed.
+
+// Cyclic through return type.
+/*typedef */ A /*A();*/ /// 01: compile-time error
+
+/*typedef*/ A( /*);*/
+
+// Cyclic through parameter type.
+/*typedef A(*/ A a /*);*/ /// 02: compile-time error
+
+// Cyclic through optional parameter type.
+/*typedef A(*/ [A a] /*);*/ /// 03: compile-time error
+
+// Cyclic through named parameter type.
+/*typedef A(*/ {A a} /*);*/ /// 04: compile-time error
+
+// Cyclic through generic parameter type.
+/*typedef A(*/ List<A> a /*);*/ /// 05: compile-time error
+
+// Cyclic through return type of function typed parameter.
+/*typedef A(*/ A f() /*);*/ /// 06: compile-time error
+
+// Cyclic through parameter type of function typed parameter.
+/*typedef A(*/ f(A a) /*);*/ /// 07: compile-time error
+
+// Cyclic through another typedef.
+/*typedef A(*/ B b /*);*/ /// 08: compile-time error
+
+// Cyclic through another more typedefs.
+/*typedef A(*/ C c /*);*/ /// 09: compile-time error
+
+/*typedef A(*/ );
+
+typedef B(A a);
+typedef C(B b);
+
+void testA(A a) {}
+
+void main() {
+ testA(null);
+}

Powered by Google App Engine
This is Rietveld 408576698