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

Side by Side Diff: tests/language/function_propagation_test.dart

Issue 147743005: classes with call-methods were not recognized as Functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: A classelement can't be a typedef. Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 A {
8 int call(String str) => 499;
9 }
10
11 typedef int F(String str);
12
13 main() {
14 var a = new A();
15 if (a is Function) {
16 Expect.isTrue(a is A);
17 } else {
18 Expect.fail("a should be a Function");
19 }
20
21 var a2 = new A();
22 if (a2 is F) {
23 Expect.isTrue(a2 is A);
24 } else {
25 Expect.fail("a2 should be an F");
26 }
27
28 Function a3 = new A();
29 // Dart2Js mistakenly assumed that Function and A couldn't be related and
30 // returned false for a is A.
31 Expect.isTrue(a3 is A);
32
33 F a4 = new A();
34 Expect.isTrue(a4 is A);
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698