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

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

Issue 10943034: Issue 5162. Report error when initializing already initialized final field (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 ee5860a488e46a358165c26c1279417fb4f30f4e..c08537efd47942c06dc294dcf81db3dbd7ca6121 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -4920,7 +4920,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
result.getErrors(),
errEx(ResolverErrorCode.FORMAL_PARAMETER_NAME_EXPECTED, 5, 4, 1));
}
-
+
/**
* <p>
* http://code.google.com/p/dart/issues/detail?id=5148
@@ -4937,6 +4937,23 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(ResolverErrorCode.STATIC_METHOD_MUST_HAVE_BODY, 3, 3, 13));
}
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=5162
+ */
+ public void test_initializeFinalInstanceVariable_atDeclaration_inInitializer() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " final f = 0;",
+ " A() : f = 1 {}",
+ "}",
+ "");
+ assertErrors(
+ result.getErrors(),
+ errEx(ResolverErrorCode.DUPLICATE_INITIALIZATION, 4, 9, 5));
+ }
+
private <T extends DartNode> T findNode(final Class<T> clazz, String pattern) {
final int index = testSource.indexOf(pattern);
assertTrue(index != -1);
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/Resolver.java ('k') | samples/ui_lib/observable/ChangeEvent.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698