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

Unified Diff: tests/language/src/FBoundedQuantificationTest.dart

Issue 10243001: Support cyclic types and F-bounded quantification (issue 439). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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
« runtime/vm/class_finalizer.cc ('K') | « tests/language/language.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/FBoundedQuantificationTest.dart
===================================================================
--- tests/language/src/FBoundedQuantificationTest.dart (revision 7045)
+++ tests/language/src/FBoundedQuantificationTest.dart (working copy)
@@ -10,7 +10,42 @@
class SubBar extends Bar {}
+class Baz<T> extends FBound<Baz<T>> {}
+
+class SubBaz<T> extends Baz<T> {}
+
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } catch(var e) {
+ return true;
+ }
+}
+
main() {
FBound<Bar> fb = new FBound<Bar>();
- FBound<SubBar> fsb = new FBound<SubBar>(); /// 01: static type warning
+ {
+ bool got_type_error = false;
+ try {
+ FBound<SubBar> fsb = new FBound<SubBar>(); /// 01: static type warning
+ } catch (TypeError error) {
+ got_type_error = true;
+ }
+ // Type error in checked mode only.
+ Expect.isTrue(got_type_error == isCheckedMode()); /// 01: continued
+ }
+ FBound<Baz<Bar>> fbb = new FBound<Baz<Bar>>();
+ {
+ bool got_type_error = false;
+ try {
+ FBound<SubBaz<Bar>> fsb = new FBound<SubBaz<Bar>>(); /// 02: static type warning
+ } catch (TypeError error) {
+ got_type_error = true;
+ }
+ // Type error in checked mode only.
+ Expect.isTrue(got_type_error == isCheckedMode()); /// 02: continued
+ }
}
« runtime/vm/class_finalizer.cc ('K') | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698