Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
index a32f355d63beba874062fa1be992e89abe852687..9c85d71723fc9ceb46dec1620eaa12d291ef2d2b 100644 |
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java |
@@ -297,8 +297,6 @@ public class ResolverTest extends ResolverTestCase { |
ResolverErrorCode.CYCLIC_CLASS, |
ResolverErrorCode.CYCLIC_CLASS |
); |
- |
- |
} |
public void testBadFactory() { |
@@ -310,6 +308,44 @@ public class ResolverTest extends ResolverTestCase { |
ResolverErrorCode.NO_SUCH_TYPE_CONSTRUCTOR); |
} |
+ public void testBadGenerativeConstructor() { |
+ resolveAndTest(Joiner.on("\n").join( |
+ "class Object { }", |
+ "class B { }", |
+ "class A {", |
+ " var val; ", |
+ " B.foo() : this.val = 1;", |
+ "}"), |
+ ResolverErrorCode.CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR); |
+ |
+ resolveAndTest(Joiner.on("\n").join( |
+ "class Object { }", |
+ "class A {", |
+ " var val; ", |
+ " A.foo.bar() : this.val = 1;", |
+ "}"), |
+ ResolverErrorCode.TOO_MANY_QUALIFIERS_FOR_METHOD); |
+ |
+ resolveAndTest(Joiner.on("\n").join( |
+ "class Object { }", |
+ "interface B { }", |
+ "class A extends B {", |
+ " var val; ", |
+ " B.foo() : this.val = 1;", |
+ "}"), |
+ ResolverErrorCode.NOT_A_CLASS, |
+ ResolverErrorCode.CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR); |
+ } |
+ |
+ public void testGenerativeConstructor() { |
+ resolveAndTest(Joiner.on("\n").join( |
+ "class Object {}", |
+ "class A {", |
+ " var val; ", |
+ " A.foo(arg) : this.val = arg;", |
+ "}")); |
+ } |
+ |
/** |
* Test that a class may implement the implied interface of another class and that interfaces may |
* extend the implied interface of a class. |