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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10536164: Issue 3550. Initial understanding "const". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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: 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>
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698