Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
index 2f2b3191a999d7b34eaaed339e2af25e1be772f8..cbcaaf8f1be5504d218482eaba2f77e8468c1555 100644 |
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
@@ -1144,6 +1144,27 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase { |
"}")); |
assertErrors(libraryResult.getTypeErrors()); |
} |
+ |
+ public void test_constField() throws Exception { |
+ AnalyzeLibraryResult libraryResult = analyzeLibrary( |
+ getName(), |
+ makeCode( |
+ "// filler filler filler filler filler filler filler filler filler filler", |
+ "const f = 1;", |
+ "class A {", |
+ " const f = 1;", |
+ "}", |
+ "main() {", |
+ " f = 2;", |
+ " A a = new A();", |
+ " a.f = 2;", |
+ "}", |
+ "")); |
+ assertErrors( |
+ libraryResult.getErrors(), |
+ errEx(ResolverErrorCode.CANNOT_ASSIGN_TO_FINAL, 7, 3, 1), |
+ errEx(TypeErrorCode.FIELD_IS_FINAL, 9, 5, 1)); |
+ } |
/** |
* <p> |