Index: tests/language/function_subtype_setter0_test.dart |
diff --git a/tests/language/checked_setter_test.dart b/tests/language/function_subtype_setter0_test.dart |
similarity index 50% |
copy from tests/language/checked_setter_test.dart |
copy to tests/language/function_subtype_setter0_test.dart |
index 608a472f9c8dc27855c6bfa9650b6cfcec970635..9e6170b30a6b9712db3bbbe8de703073158b3007 100644 |
--- a/tests/language/checked_setter_test.dart |
+++ b/tests/language/function_subtype_setter0_test.dart |
@@ -1,25 +1,26 @@ |
// Copyright (c) 2013, 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. |
+// Dart test program for constructors and initializers. |
-// Test that implicit setters in checked mode do a type check. |
+// Check function subtyping for implicit setters. |
-import "package:expect/expect.dart"; |
+import 'package:expect/expect.dart'; |
-class A { |
- C c; |
-} |
- |
-class B extends A { |
-} |
+typedef void Foo(); |
+class A<T> {} |
class C { |
+ Foo foo; |
+ A<int> bar; |
} |
-var array = [new B()]; |
+class D { |
+ Foo foo; |
+ A<int> bar; |
+} |
-main() { |
- array[0].c = new C(); |
+test(var c) { |
bool inCheckedMode = false; |
try { |
String a = 42; |
karlklose
2013/06/20 13:11:04
Use
var x = 42;
String a = x;
to avoid warnings
Johnni Winther
2013/06/21 12:19:15
Done.
|
@@ -27,6 +28,12 @@ main() { |
inCheckedMode = true; |
} |
if (inCheckedMode) { |
- Expect.throws(() => array[0].c = new B(), (e) => e is TypeError); |
+ Expect.throws(() => c.foo = 1, (e) => true); |
} |
+ c.foo = () {}; |
+} |
+ |
+void main() { |
+ test(new C()); |
+ test(new D()); |
} |