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

Unified Diff: tests/language/function_subtype3_test.dart

Issue 1180973003: dart2js cps: Support function types in 'is' and 'as' operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update doc comment for TypeCast Created 5 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
« no previous file with comments | « tests/isolate/isolate.status ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/function_subtype3_test.dart
diff --git a/tests/language/function_subtype3_test.dart b/tests/language/function_subtype3_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7b2acc30bdd8f678c87af2e413047473a9cd2265
--- /dev/null
+++ b/tests/language/function_subtype3_test.dart
@@ -0,0 +1,30 @@
+// 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';
+
+class FunctionLike<T> {
+ call(T arg) {
+ return arg;
+ }
+}
+
+class Foo<T> {
+ testString() => new FunctionLike<String>() is T;
+ testInt() => new FunctionLike<int>() is T;
+}
+
+typedef TakeString(String arg);
+typedef TakeInt(int arg);
+
+main() {
+ Foo<TakeString> stringFoo = new Foo<TakeString>();
+ Foo<TakeInt> intFoo = new Foo<TakeInt>();
+
+ Expect.isTrue(stringFoo.testString());
+ Expect.isFalse(stringFoo.testInt());
+
+ Expect.isFalse(intFoo.testString());
+ Expect.isTrue(intFoo.testInt());
+}
« no previous file with comments | « tests/isolate/isolate.status ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698