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

Unified Diff: tests/language/cyclic_type_test.dart

Issue 224793002: Simplify and fix instantiation of recursive types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/cyclic_type_test.dart
===================================================================
--- tests/language/cyclic_type_test.dart (revision 34737)
+++ tests/language/cyclic_type_test.dart (working copy)
@@ -10,23 +10,57 @@
get t => T;
}
-class Derived<T> extends Base<Derived<Derived<T>>> {}
+// Derived<T> is contractive.
+class Derived<T> extends Base<Derived<T>> {} /// 00: ok
-class Derived1<T> extends Base<Derived2<T>> {}
+// Derived<T> is contractive.
+class Derived<T> extends Base<Derived<Derived<int>>> {} /// 01: ok
-class Derived2<T> extends Base<Derived1<Derived2<T>>> {}
+// Derived<T> is non-contractive.
+class Derived<T> extends Base<Derived<Derived<T>>> {} /// 02: ok
+// Derived1<U> and Derived2<V> are contractive.
+class Derived1<U> extends Base<Derived2<U>> {} /// 03: ok
+class Derived2<V> extends Base<Derived1<V>> {} /// 03: ok
+
+// Derived1<U> and Derived2<V> are non-contractive.
+class Derived1<U> extends Base<Derived2<U>> {} /// 04: ok
+class Derived2<V> extends Base<Derived1<Derived2<V>>> {} /// 04: ok
+
main() {
- var d = new Derived();
- Expect.equals("Derived<Derived>", d.t.toString());
- d = new Derived<bool>();
- Expect.equals("Derived<Derived<bool>>", d.t.toString());
- d = new Derived<Derived>();
- Expect.equals("Derived<Derived<Derived>>", d.t.toString());
- d = new Derived1();
- Expect.equals("Derived2", d.t.toString());
- d = new Derived2();
- Expect.equals("Derived1<Derived2>", d.t.toString());
- d = new Derived2<Derived1<int>>();
- Expect.equals("Derived1<Derived2<Derived1<int>>>", d.t.toString());
+ var d;
+ d = new Derived(); /// 00: continued
+ Expect.equals("Derived", d.t.toString()); /// 00: continued
+ d = new Derived<bool>(); /// 00: continued
+ Expect.equals("Derived<bool>", d.t.toString()); /// 00: continued
+ d = new Derived<Derived>(); /// 00: continued
+ Expect.equals("Derived<Derived>", d.t.toString()); /// 00: continued
+
+ d = new Derived(); /// 01: continued
+ Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued
+ d = new Derived<bool>(); /// 01: continued
+ Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued
+ d = new Derived<Derived>(); /// 01: continued
+ Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued
+
+ d = new Derived(); /// 02: continued
+ Expect.equals("Derived<Derived>", d.t.toString()); /// 02: continued
+ d = new Derived<bool>(); /// 02: continued
+ Expect.equals("Derived<Derived<bool>>", d.t.toString()); /// 02: continued
+ d = new Derived<Derived>(); /// 02: continued
+ Expect.equals("Derived<Derived<Derived>>", d.t.toString()); /// 02: continued
+
+ d = new Derived1(); /// 03: continued
+ Expect.equals("Derived2", d.t.toString()); /// 03: continued
+ d = new Derived2(); /// 03: continued
+ Expect.equals("Derived1", d.t.toString()); /// 03: continued
+ d = new Derived2<Derived1<int>>(); /// 03: continued
+ Expect.equals("Derived1<Derived1<int>>", d.t.toString()); /// 03: continued
+
+ d = new Derived1(); /// 04: continued
+ Expect.equals("Derived2", d.t.toString()); /// 04: continued
+ d = new Derived2(); /// 04: continued
+ Expect.equals("Derived1<Derived2>", d.t.toString()); /// 04: continued
+ d = new Derived2<Derived1<int>>(); /// 04: continued
+ Expect.equals("Derived1<Derived2<Derived1<int>>>", d.t.toString()); /// 04: continued
}
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698