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

Unified Diff: tests/compiler/dart2js_extra/type_constant_switch_test.dart

Issue 88433002: Emit a compile-time error when using type literals in case-expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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: tests/compiler/dart2js_extra/type_constant_switch_test.dart
diff --git a/tests/language/evaluation_redirecting_constructor_test.dart b/tests/compiler/dart2js_extra/type_constant_switch_test.dart
similarity index 51%
copy from tests/language/evaluation_redirecting_constructor_test.dart
copy to tests/compiler/dart2js_extra/type_constant_switch_test.dart
index 0fd04f66afb819a53474b56ea5cdf5c58b771a37..b28d6dc96b113e0477cc40b96b026c8f480200a9 100644
--- a/tests/language/evaluation_redirecting_constructor_test.dart
+++ b/tests/compiler/dart2js_extra/type_constant_switch_test.dart
@@ -2,23 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import "package:expect/expect.dart";
+// Test that switching on type literals leads to a compile time error in
+// dart2js since its implementation of [Type] implements 'operator =='.
-int counter = 0;
+class C {}
-class Bar {
- Bar() {
- counter++;
- }
-}
-
-class A {
- var _bar = new Bar();
- A() : this._();
- A._() {() => 42;}
-}
+var v;
main() {
- new A();
- Expect.equals(1, counter);
+ switch (v) {
+ case C: break; /// 01: compile-time error
+ }
}

Powered by Google App Engine
This is Rietveld 408576698