| OLD | NEW |
| (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. | |
| 7 | |
| 8 import 'package:expect/expect.dart'; | |
| 9 | |
| 10 typedef t__(); | |
| 11 typedef void t_void_(); | |
| 12 typedef void t_void_2(); | |
| 13 typedef int t_int_(); | |
| 14 typedef int t_int_2(); | |
| 15 typedef Object t_Object_(); | |
| 16 typedef double t_double_(); | |
| 17 typedef void t_void__int(int i); | |
| 18 typedef int t_int__int(int i); | |
| 19 typedef int t_int__int2(int i); | |
| 20 typedef int t_int__Object(Object o); | |
| 21 typedef Object t_Object__int(int i); | |
| 22 typedef int t_int__double(double d); | |
| 23 typedef int t_int__int_int(int i1, int i2); | |
| 24 typedef void t_inline_void_(void f()); | |
| 25 typedef void t_inline_void__int(void f(int i)); | |
| 26 | |
| 27 void _() => null; | |
| 28 void void_() {} | |
| 29 void void_2() {} | |
| 30 int int_() => 0; | |
| 31 int int_2() => 0; | |
| 32 Object Object_() => null; | |
| 33 double double_() => 0.0; | |
| 34 void void__int(int i) {} | |
| 35 int int__int(int i) => 0; | |
| 36 int int__int2(int i) => 0; | |
| 37 int int__Object(Object o) => 0; | |
| 38 Object Object__int(int i) => null; | |
| 39 int int__double(double d) => 0; | |
| 40 int int__int_int(int i1, int i2) => 0; | |
| 41 void inline_void_(void f()) {} | |
| 42 void inline_void__int(void f(int i)) {} | |
| 43 | |
| 44 main() { | |
| 45 // () -> int <: Function | |
| 46 Expect.isTrue(int_ is Function); | |
| 47 // () -> dynamic <: () -> dynamic | |
| 48 Expect.isTrue(_ is t__); | |
| 49 // () -> dynamic <: () -> void | |
| 50 Expect.isTrue(_ is t_void_); | |
| 51 // () -> void <: () -> dynamic | |
| 52 Expect.isTrue(void_ is t__); | |
| 53 // () -> int <: () -> void | |
| 54 Expect.isTrue(int_ is t_void_); | |
| 55 // () -> void <: () -> int | |
| 56 Expect.isFalse(void_ is t_int_); | |
| 57 // () -> void <: () -> void | |
| 58 Expect.isTrue(void_ is t_void_2); | |
| 59 // () -> int <: () -> int | |
| 60 Expect.isTrue(int_ is t_int_2); | |
| 61 // () -> int <: () -> Object | |
| 62 Expect.isTrue(int_ is t_Object_); | |
| 63 // () -> int <: () -> double | |
| 64 Expect.isFalse(int_ is t_double_); | |
| 65 // () -> int <: (int) -> void | |
| 66 Expect.isFalse(int_ is t_void__int); | |
| 67 // () -> void <: (int) -> int | |
| 68 Expect.isFalse(void_ is t_int__int); | |
| 69 // () -> void <: (int) -> void | |
| 70 Expect.isFalse(void_ is t_void__int); | |
| 71 // (int) -> int <: (int) -> int | |
| 72 Expect.isTrue(int__int is t_int__int2); | |
| 73 // (Object) -> int <: (int) -> Object | |
| 74 Expect.isTrue(int__Object is t_Object__int); | |
| 75 // (int) -> int <: (double) -> int | |
| 76 Expect.isFalse(int__int is t_int__double); | |
| 77 // () -> int <: (int) -> int | |
| 78 Expect.isFalse(int_ is t_int__int); | |
| 79 // (int) -> int <: (int,int) -> int | |
| 80 Expect.isFalse(int__int is t_int__int_int); | |
| 81 // (int,int) -> int <: (int) -> int | |
| 82 Expect.isFalse(int__int_int is t_int__int); | |
| 83 // (()->void) -> void <: ((int)->void) -> void | |
| 84 Expect.isFalse(inline_void_ is t_inline_void__int); | |
| 85 // ((int)->void) -> void <: (()->void) -> void | |
| 86 Expect.isFalse(inline_void__int is t_inline_void_); | |
| 87 } | |
| OLD | NEW |