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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 10716005: Fixes the scope of case labels so that duplicate case labels are properly detected (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
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/Scope.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
index 7730fcf1797107113a4b017ebb1b9250bc14c965..faa57aec7b3b40ee5087fed4ca904897856b1e47 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
@@ -4,8 +4,6 @@
package com.google.dart.compiler.resolver;
-import static com.google.dart.compiler.common.ErrorExpectation.errEx;
-
import com.google.common.base.Joiner;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.ErrorCode;
@@ -16,6 +14,8 @@ import com.google.dart.compiler.type.InterfaceType;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.Types;
+import static com.google.dart.compiler.common.ErrorExpectation.errEx;
+
import junit.framework.Assert;
import java.util.List;
@@ -960,6 +960,18 @@ public class ResolverTest extends ResolverTestCase {
ErrorExpectation.errEx(ResolverErrorCode.CANNOT_RESOLVE_LABEL, 6, 32, 1));
}
+ public void test_multipleLabelsSwitch() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "foo() {",
+ " switch(1) {",
+ " a: case (0): break;",
+ " a: case (1): break;",
+ " }",
+ "}"),
+ ErrorExpectation.errEx(ResolverErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, 5, 3, 2));
+ }
+
public void test_new_noSuchType() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -1347,7 +1359,7 @@ public class ResolverTest extends ResolverTestCase {
""),
errEx(ResolverErrorCode.INSTANCE_METHOD_FROM_INITIALIZER, 5, 13, 5));
}
-
+
/**
* "this" is not accessible to initializers, so reference of instance method is error.
* <p>
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/Scope.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698