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

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

Issue 14951006: Report CTEC.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR (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 550d69e33cb07f5bc34e0192e8bac33a3ccb49df..a95c2e042fc48e9e79fd3e542899ba764d3e36f8 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
@@ -1102,6 +1102,17 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_fieldInitializerFactoryConstructor() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " int x;",
+ " factory A(this.x) {}",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR);
+ verify(source);
+ }
+
public void test_fieldInitializerOutsideConstructor() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -1124,6 +1135,18 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_fieldInitializerRedirectingConstructor() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " int x;",
+ " A.named() {}",
+ " A(this.x) : this.named();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR);
+ verify(source);
+ }
+
/**
* This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR code, but tests the
* FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provided here to show

Powered by Google App Engine
This is Rietveld 408576698