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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java

Issue 15316011: Report MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS and other redirection related. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 7 years, 7 months 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index 4095954e782e5faca04f97cb6b686dc27c5c382e..4f8f9a85bbd9e9513e8c5536252312dac53d3d4b 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -1152,7 +1152,31 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_fieldInitializerRedirectingConstructor() throws Exception {
+ public void test_fieldInitializerRedirectingConstructor_afterRedirection() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " int x;",
+ " A.named() {}",
+ " A() : this.named(), x = 42;",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR);
+ verify(source);
+ }
+
+ public void test_fieldInitializerRedirectingConstructor_beforeRedirection() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " int x;",
+ " A.named() {}",
+ " A() : x = 42, this.named();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR);
+ verify(source);
+ }
+
+ public void test_fieldInitializingFormalRedirectingConstructor() throws Exception {
Source source = addSource(createSource(//
"class A {",
" int x;",
@@ -1948,6 +1972,18 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_multipleRedirectingConstructorInvocations() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A() : this.a(), this.b();",
+ " A.a() {}",
+ " A.b() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS);
+ verify(source);
+ }
+
public void test_multipleSuperInitializers() throws Exception {
Source source = addSource(createSource(//
"class A {}",
@@ -2478,6 +2514,30 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
// no verify(), 'super.y' is not resolved
}
+ public void test_superInRedirectingConstructor_redirectionSuper() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {}",
+ "class B {",
+ " B() : this.name(), super();",
+ " B.name() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR);
+ verify(source);
+ }
+
+ public void test_superInRedirectingConstructor_superRedirection() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {}",
+ "class B {",
+ " B() : super(), this.name();",
+ " B.name() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR);
+ verify(source);
+ }
+
public void test_undefinedClass_const() throws Exception {
Source source = addSource(createSource(//
"f() {",

Powered by Google App Engine
This is Rietveld 408576698