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

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

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 7 years, 5 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) 2013, 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 // Dart test program for constructors and initializers.
5
6 // Check function subtyping for local functions.
7
8 import 'package:expect/expect.dart';
9
10 typedef int Foo(bool a, [String b]);
11 typedef int Bar(bool a, [String b]);
12 typedef int Baz(bool a, {String b});
13 typedef int Boz(bool a);
14
15 main() {
16 int foo(bool a, [String b]) => null;
17 int baz(bool a, {String b}) => null;
18 int boz(bool a, {int b}) => null;
19
20 Expect.isTrue(foo is Foo, 'foo is Foo');
21 Expect.isTrue(foo is Bar, 'foo is Bar');
22 Expect.isFalse(foo is Baz, 'foo is Baz');
23 Expect.isTrue(foo is Boz, 'foo is Boz');
24
25 Expect.isFalse(baz is Foo, 'baz is Foo');
26 Expect.isFalse(baz is Bar, 'baz is Bar');
27 Expect.isTrue(baz is Baz, 'baz is Baz');
28 Expect.isTrue(baz is Boz, 'baz is Boz');
29
30 Expect.isFalse(boz is Foo, 'boz is Foo');
31 Expect.isFalse(boz is Bar, 'boz is Bar');
32 Expect.isFalse(boz is Baz, 'boz is Baz');
33 Expect.isTrue(boz is Boz, 'boz is Boz');
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698