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

Unified Diff: tests/language/type_variable_closure_test.dart

Issue 17262003: Fix type variables in closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Nicolas' comments. Created 7 years, 6 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/type_variable_closure_test.dart
diff --git a/tests/language/cascade_in_initializer_list_test.dart b/tests/language/type_variable_closure_test.dart
similarity index 51%
copy from tests/language/cascade_in_initializer_list_test.dart
copy to tests/language/type_variable_closure_test.dart
index 8e7e9ee11e9fa950fa4db917c36c135d5bec357f..883eaaccbc0d01ffe50baa1b08ee19840ff0765d 100644
--- a/tests/language/cascade_in_initializer_list_test.dart
+++ b/tests/language/type_variable_closure_test.dart
@@ -4,20 +4,19 @@
import "package:expect/expect.dart";
-class A {
- foo() {}
- bar() {}
-}
-
-class B {
+class C<T> {
+ C.foo() {
+ x = (a) => a is T;
+ }
+ C.bar() {
+ x = (a) => a is! T;
+ }
var x;
- final y;
-
- B(a) : x = a..foo()..bar(), y = a..foo()..bar() {}
}
main() {
- var a = new A(), b = new B(a);
- Expect.equals(a, b.x);
- Expect.equals(a, b.y);
-}
+ Expect.isTrue(new C<int>.foo().x(1));
+ Expect.isFalse(new C<int>.foo().x('1'));
+ Expect.isFalse(new C<int>.bar().x(1));
+ Expect.isTrue(new C<int>.bar().x('1'));
+}

Powered by Google App Engine
This is Rietveld 408576698