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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 8588038: Addresses a ClassCastException seen in the editor from MemberBuilder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Unit test added for 'internal error' case I removed. Created 9 years, 1 month 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: 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.
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698