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

Unified Diff: tests/language/smi_type_test.dart

Issue 18054022: Fix 11574: Smi is a subtype of parametrizable Compare. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« runtime/vm/flow_graph_compiler_mips.cc ('K') | « tests/language/language.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/smi_type_test.dart
===================================================================
--- tests/language/smi_type_test.dart (revision 0)
+++ tests/language/smi_type_test.dart (revision 0)
@@ -0,0 +1,36 @@
+// Copyright (c) 2013, 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.
+// VMOptions=--optimization-counter-threshold=8
+
+import "package:expect/expect.dart";
+
+main() {
+ // Make instance-of polymorphic.
+ isNum([]);
+ isNumRaw([]);
+ isNotNum([]);
+ isNotInt([]);
+ for (int i = 0; i < 20; i++) {
+ Expect.isTrue(isNum(i));
+ Expect.isTrue(isNumRaw(i));
+ Expect.isFalse(isNotNum(i));
+ Expect.isFalse(isNotInt(i));
+ }
+}
+
+isNum(a) {
+ return a is Comparable<num>;
+}
+
+isNumRaw(a) {
+ return a is Comparable;
+}
+
+isNotNum(a) {
+ return a is Comparable<String>;
+}
+
+isNotInt(a) {
+ return a is Comparable<double>;
+}
« runtime/vm/flow_graph_compiler_mips.cc ('K') | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698