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/language/switch_this_test.dart

Issue 10452032: Merge functionality of HExactType into HBoundedType and fix computation of unions and intersections. (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..fdbd834b42b8a85b4a7ffc4781e1c85e50d9d9e6
--- /dev/null
+++ b/tests/language/switch_this_test.dart
@@ -0,0 +1,28 @@
+// 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 comparison of this and a constant.
+
+class Foo {
+ static final C1 = const Foo('C1');
+ static final C2 = const Foo('C2');
+ static final C3 = const Foo('C3');
+
+ final 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());
+}

Powered by Google App Engine
This is Rietveld 408576698