Index: test/codegen/type_no_hoisting.dart |
diff --git a/test/codegen/type_no_hoisting.dart b/test/codegen/type_no_hoisting.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..602b9b4254e8d13c941a381e120b3c700e4d4cc0 |
--- /dev/null |
+++ b/test/codegen/type_no_hoisting.dart |
@@ -0,0 +1,60 @@ |
+// compile options: --no-hoist-signature-types --no-hoist-instance-creation --name-type-tests |
+import "package:expect/expect.dart"; |
+ |
+class A<T> { |
+ A(this.x, T z); |
+ A.make(); |
+ void f(T x) {} |
+ static String g(String x) {return x;} |
+ T x; |
+} |
+ |
+class B extends A<int> { |
+ B(int x, int z) : super(x, z); |
+ B.make(); |
+ void f(int x) {} |
+ static int g(int x) {return x;} |
+} |
+ |
+class C { |
+ C(this.x, int z); |
+ void f(int x) {} |
+ static int g(int x) {return x;} |
+ int x = 0; |
+} |
+typedef void ToVoid<T>(T x); |
+typedef T Id<T>(T x); |
+ |
+void main() { |
+ { |
+ A<String> a = new A<String>("hello", "world"); |
+ Expect.isTrue(new A.make<String>() is! A<int>); |
+ Expect.isTrue(new A.make() is! A<int>); |
+ Expect.isTrue(a is! A<int>); |
+ Expect.isTrue(a is A<String>); |
+ Expect.isTrue(a.f is ToVoid<String>); |
+ Expect.isTrue(a.f is! ToVoid<int>); |
+ Expect.isTrue(A.g is Id<String>); |
+ Expect.isTrue(A.g is! Id<int>); |
+ } |
+ { |
+ B b = new B(0, 1); |
+ Expect.isTrue(new B.make() is B); |
+ Expect.isTrue(new B.make() is A<int>); |
+ Expect.isTrue(b is B); |
+ Expect.isTrue(b is! B); |
+ Expect.isTrue(b.f is! ToVoid<String>); |
+ Expect.isTrue(b.f is ToVoid<int>); |
+ Expect.isTrue(B.g is! Id<String>); |
+ Expect.isTrue(B.g is Id<int>); |
+ } |
+ { |
+ C c = new C(0, 1); |
+ Expect.isTrue(c is C); |
+ Expect.isTrue(c is! C); |
+ Expect.isTrue(c.f is! ToVoid<String>); |
+ Expect.isTrue(c.f is ToVoid<int>); |
+ Expect.isTrue(C.g is! Id<String>); |
+ Expect.isTrue(C.g is Id<int>); |
+ } |
+} |