Index: tests/language/closure_in_field_test.dart |
diff --git a/tests/language/closure_in_field_test.dart b/tests/language/closure_in_field_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..95a7bd5a68d30c04c5170fa98d00d59ce342194a |
--- /dev/null |
+++ b/tests/language/closure_in_field_test.dart |
@@ -0,0 +1,22 @@ |
+// Copyright (c) 2017, 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. |
+ |
+// Test handling of type variable in field initializers. |
+ |
+import 'package:expect/expect.dart'; |
+ |
+class Mixin<S> { |
+ var field = (S s) => null; |
+} |
+ |
+class Class<T> extends Object with Mixin<T> {} |
+ |
+void main() { |
+ Expect.isTrue(test(new Mixin<int>())); |
+ Expect.isFalse(test(new Mixin<String>())); //# 01: ok |
+ Expect.isTrue(test(new Class<int>())); |
+ Expect.isFalse(test(new Class<String>())); //# 02: ok |
+} |
+ |
+test(o) => o.field is dynamic Function(int); |