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

Unified Diff: tests/language/closure_type_variables_test.dart

Issue 10915054: Mark the local for this as used if a constructor call needs type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test and address comments. Created 8 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
Index: tests/language/closure_type_variables_test.dart
diff --git a/tests/language/type_variable_static_context_negative_test.dart b/tests/language/closure_type_variables_test.dart
similarity index 57%
copy from tests/language/type_variable_static_context_negative_test.dart
copy to tests/language/closure_type_variables_test.dart
index 1ac8e25b975307fb453cb871ade1e58d97fa97b1..abe8589b64e3d3c77c80b000588ac761197adb14 100644
--- a/tests/language/type_variable_static_context_negative_test.dart
+++ b/tests/language/closure_type_variables_test.dart
@@ -2,14 +2,17 @@
// 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.
-// A type variable can't be referenced in a static class
+// Test that type variables are available in closures.
ngeoffray 2012/09/03 14:03:36 Maybe also add corner cases like doing it in a con
class A<T> {
- static int method() {
- var foo = new T(); // error, can't reference a type variable in a static context
+ foo() {
+ g() {
+ return new A<T>();
+ }
+ return g();
}
}
main() {
- A.method();
+ Expect.isTrue(new A<int>().foo() is A<int>);
}
« lib/compiler/implementation/closure.dart ('K') | « lib/compiler/implementation/tree/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698