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

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

Issue 15409002: Report CTEC.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 1c63f63be2f16ae67d5c8c9f381106701871c88b..22b66bfe35c484a63baedfc33872d776f328f3ba 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
@@ -1356,6 +1356,57 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_implicitThisReferenceInInitializer_field() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f;",
+ " var f;",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER);
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_invocation() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f();",
+ " f() {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER);
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_redirectingConstructorInvocation()
+ throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A(p) {}",
+ " A() : super(f);",
+ " var f;",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER);
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_superConstructorInvocation() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A(p) {}",
+ "}",
+ "class B extends A {",
+ " B() : super(f);",
+ " var f;",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER);
+ verify(source);
+ }
+
public void test_importOfNonLibrary() throws Exception {
Source source = addSource(createSource(//
"library lib;",

Powered by Google App Engine
This is Rietveld 408576698