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

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

Issue 851473002: Use prototype inheritance to reduce number of is check properties. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments. Created 5 years, 11 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 | « pkg/compiler/lib/src/js_emitter/type_test_generator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/is_test_with_type_parameters_test.dart
diff --git a/tests/compiler/dart2js/is_test_with_type_parameters_test.dart b/tests/compiler/dart2js/is_test_with_type_parameters_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..76847d8ceabb91ca0a01e61ba98901259906692a
--- /dev/null
+++ b/tests/compiler/dart2js/is_test_with_type_parameters_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2015, 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.
+
+import "package:expect/expect.dart";
+
+// Tests that is-tests are also available for superclasses if the class is
+// never instantiated and not explicitly tested against.
+
+class A {
+}
+
+class B extends A {
+}
+
+class C<T> implements A {
+}
+
+class D<T,L> {
+}
+
+class F {
+}
+
+class E<T,L> extends D<L,T> {
+}
+
+class G extends F {
+}
+
+main () {
+ var l = [new A(), new B(), new C<E<G, G>>()];
+ Expect.isTrue(l[0] is A);
+ Expect.isTrue(l[1] is B);
+ Expect.isTrue(l[2] is C<D<F, G>>);
+ for (int i = 0; i < l.length; i++) {
+ var e = l[i];
+ Expect.isTrue(e is A);
+ Expect.equals(e is B, i == 1);
+ Expect.isFalse(e is C<String>);
+ Expect.equals(e is C<D<F, G>>, i == 2);
+ }
+}
+
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/type_test_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698