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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « tests/isolate/isolate.status ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:expect/expect.dart';
6
7 class FunctionLike<T> {
8 call(T arg) {
9 return arg;
10 }
11 }
12
13 class Foo<T> {
14 testString() => new FunctionLike<String>() is T;
15 testInt() => new FunctionLike<int>() is T;
16 }
17
18 typedef TakeString(String arg);
19 typedef TakeInt(int arg);
20
21 main() {
22 Foo<TakeString> stringFoo = new Foo<TakeString>();
23 Foo<TakeInt> intFoo = new Foo<TakeInt>();
24
25 Expect.isTrue(stringFoo.testString());
26 Expect.isFalse(stringFoo.testInt());
27
28 Expect.isFalse(intFoo.testString());
29 Expect.isTrue(intFoo.testInt());
30 }
OLDNEW
« 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