| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, 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 for a function type test that cannot be eliminated at compile time. | |
| 5 | |
| 6 import "package:expect/expect.dart"; | |
| 7 | |
| 8 class A {} | |
| 9 | |
| 10 typedef int F(); | |
| 11 | |
| 12 typedef G = F; /// 00: compile-time error | |
| 13 typedef H = int; /// 01: compile-time error | |
| 14 typedef I = A; /// 02: compile-time error | |
| 15 typedef J = List<int>; /// 03: compile-time error | |
| 16 typedef K = Function(Function<A>(A | |
| 17 <int> /// 04: static type warning | |
| 18 )); | |
| 19 typedef L = Function({ | |
| 20 /* /// 05: compile-time error | |
| 21 bool | |
| 22 */ /// 05: compile-time error | |
| 23 x}); | |
| 24 | |
| 25 typedef M = Function({ | |
| 26 /* /// 06: compile-time error | |
| 27 bool | |
| 28 */ /// 06: compile-time error | |
| 29 int}); | |
| 30 | |
| 31 foo({bool int}) {} | |
| 32 main() { | |
| 33 bool b = true; | |
| 34 Expect.isFalse(b is G); /// 00: continued | |
| 35 Expect.isFalse(b is H); /// 01: continued | |
| 36 Expect.isFalse(b is I); /// 02: continued | |
| 37 Expect.isFalse(b is J); /// 03: continued | |
| 38 Expect.isFalse(b is K); /// 04: continued | |
| 39 Expect.isFalse(b is L); | |
| 40 Expect.isFalse(b is M); | |
| 41 Expect.isTrue(foo is M); | |
| 42 } | |
| OLD | NEW |