Index: compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java |
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java |
index 8ff0774f66f750bd379ed55d6dc33e2e6aa80d1d..6ac64c57d15d05a49e7539949983ab589bfabb18 100644 |
--- a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java |
@@ -886,7 +886,7 @@ public class NegativeResolverTest extends CompilerTestCase { |
"class A {", |
" const A(x) : this.foo(x);", |
" A.foo(this.x) { }", |
- " var x;", |
+ " final x;", |
"}"), |
errEx(ResolverErrorCode.CONST_CONSTRUCTOR_MUST_CALL_CONST_SUPER, 3, 3, 25)); |
} |
@@ -895,6 +895,26 @@ public class NegativeResolverTest extends CompilerTestCase { |
checkNumErrors("RawTypesNegativeTest.dart", 6); |
} |
+ public void testConstConstructorNonFinalFieldsNegativeTest() { |
+ checkSourceErrors( |
+ makeCode( |
+ "class A extends B {", |
+ " const A();", |
+ " var x;", |
+ " final y = 10;", |
+ " set z(value) {}", |
+ "}", |
+ "class B implements C {", |
+ " final bar;", |
+ " var baz;", |
+ "}", |
+ "interface C {", |
+ " var x;", |
+ "}"), |
+ errEx(ResolverErrorCode.CONST_CLASS_WITH_NONFINAL_FIELDS, 3, 7, 1), |
+ errEx(ResolverErrorCode.CONST_CLASS_WITH_INHERITED_NONFINAL_FIELDS, 9, 7, 3)); |
+ } |
+ |
private TestCompilerContext getContext() { |
return new TestCompilerContext() { |
@Override |