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

Unified Diff: tests/compiler/dart2js/resolver_test.dart

Issue 184663004: Follow factory redirections when checking case expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. (500) Created 6 years, 10 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 | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/resolver_test.dart
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 5673e4a02a01cc010beac60786f3282fa793d0a5..5d448c8d92e670a8dc4e2d843b379db40f7611bf 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -72,6 +72,7 @@ main() {
testInitializers();
testThis();
testSuperCalls();
+ testSwitch();
testTypeVariables();
testToString();
testIndexedOperator();
@@ -203,6 +204,25 @@ testSuperCalls() {
Expect.equals(fooA, called);
}
+testSwitch() {
+ MockCompiler compiler = new MockCompiler();
+ compiler.parseScript("class Foo { foo() {"
+ "switch (null) { case '': break; case 2: break; } } }");
+ compiler.resolveStatement("Foo foo;");
+ ClassElement fooElement = compiler.mainApp.find("Foo");
+ FunctionElement funElement = fooElement.lookupLocalMember("foo");
+ compiler.processQueue(compiler.enqueuer.resolution, funElement);
+ Expect.equals(0, compiler.warnings.length);
+ Expect.equals(1, compiler.errors.length);
+ Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL,
+ compiler.errors[0].message.kind);
+ Expect.equals(2, compiler.infos.length);
+ Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ compiler.infos[0].message.kind);
+ Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ compiler.infos[1].message.kind);
+}
+
testThis() {
MockCompiler compiler = new MockCompiler();
compiler.parseScript("class Foo { foo() { return this; } }");
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698