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 cdd7f519eeecf2c6ed015b3aba5499852002ca1e..a402596b362329a5cf6001af812c0cb1440638ca 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 |
@@ -439,6 +439,34 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase { |
verify(source); |
} |
+ public void test_constConstructorWithFieldInitializedByNonConst() throws Exception { |
+ Source source = addSource(createSource(// |
+ "class A {", |
+ " final int i = f();", |
+ " const A();", |
+ "}", |
+ "int f() {", |
+ " return 3;", |
+ "}")); |
+ resolve(source); |
+ assertErrors(source, CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST); |
+ verify(source); |
+ } |
+ |
+ public void test_constConstructorWithFieldInitializedByNonConst_static() throws Exception { |
+ Source source = addSource(createSource(// |
+ "class A {", |
+ " static final int i = f();", |
+ " const A();", |
+ "}", |
+ "int f() {", |
+ " return 3;", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
public void test_constConstructorWithMixin() throws Exception { |
Source source = addSource(createSource(// |
"class M {", |