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

Unified Diff: tests/language/switch_this_test.dart

Issue 10411094: Fix bug in combination of bounded and exact types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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: tests/language/switch_this_test.dart
diff --git a/tests/language/switch_this_test.dart b/tests/language/switch_this_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6bd5c7658815f0aa46e70f083c1082a10096729d
--- /dev/null
+++ b/tests/language/switch_this_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// 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.
+// Test that a new scope is introduced for each switch case.
ngeoffray 2012/05/23 14:09:45 Update comment.
karlklose 2012/05/24 12:37:49 Done.
+
+class Foo {
+ static final C1 = const Foo('C1');
+ static final C2 = const Foo('C2');
+ static final C3 = const Foo('C3');
+
+ var name;
+ const Foo(this.name);
+
+ foo() {
+ switch (this) {
+ case C1: return C1;
+ case C2: return C2;
+ default: return null;
+ }
+ }
+}
+
+main() {
+ Expect.equals(Foo.C1, Foo.C1.foo());
+ Expect.equals(Foo.C2, Foo.C2.foo());
+ Expect.equals(null, Foo.C3.foo());
+}
« lib/compiler/implementation/ssa/types.dart ('K') | « lib/compiler/implementation/ssa/types.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698