| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=--enable_type_checks | 4 // VMOptions=--enable_type_checks |
| 5 // | 5 // |
| 6 // Dart test for function type alias. | 6 // Dart test for function type alias. |
| 7 | 7 |
| 8 typedef Fun(a, b); | 8 typedef Fun(a, b); |
| 9 | 9 |
| 10 typedef int IntFun(a, b); | 10 typedef int IntFun(a, b); |
| 11 | 11 |
| 12 typedef bool BoolFun(a, b); | 12 typedef bool BoolFun(a, b); |
| 13 | 13 |
| 14 typedef int CompareObj(Object a, Object b); | 14 typedef int CompareObj(Object a, Object b); |
| 15 | 15 |
| 16 typedef int CompareInt(int a, int b); | 16 typedef int CompareInt(int a, int b); |
| 17 | 17 |
| 18 typedef int CompareString(String a, String b, [bool swap]); | 18 typedef int CompareString(String a, String b, [bool swap]); |
| 19 | 19 |
| 20 typedef void Test(); | 20 typedef void Test(); |
| 21 | 21 |
| 22 typedef ParametrizedFun1<T, U extends bool, V>(T t, U u); | 22 typedef ParameterizedFun1<T, U extends bool, V>(T t, U u); |
| 23 | 23 |
| 24 typedef List<T> ParametrizedFun2<T, U, V extends Map<T, int>>( | 24 typedef List<T> ParameterizedFun2<T, U, V extends Map<T, int>>( |
| 25 Map<T, int> t, U u); | 25 Map<T, int> t, U u); |
| 26 | 26 |
| 27 typedef void BoundsCheck<T extends num>(T arg); | 27 typedef void BoundsCheck<T extends num>(T arg); |
| 28 | 28 |
| 29 class FunctionTypeAliasTest { | 29 class FunctionTypeAliasTest { |
| 30 FunctionTypeAliasTest() {} | 30 FunctionTypeAliasTest() {} |
| 31 static int test(CompareObj compare, Object a, Object b) { | 31 static int test(CompareObj compare, Object a, Object b) { |
| 32 return compare(a, b); | 32 return compare(a, b); |
| 33 } | 33 } |
| 34 foo(Test arg) {} | 34 foo(Test arg) {} |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 Function boundsTrue = void _(int arg) { }; | 99 Function boundsTrue = void _(int arg) { }; |
| 100 Function boundsFalse = void _(String arg) { }; | 100 Function boundsFalse = void _(String arg) { }; |
| 101 Expect.isTrue(boundsTrue is BoundsCheck<num>); | 101 Expect.isTrue(boundsTrue is BoundsCheck<num>); |
| 102 Expect.isFalse(boundsFalse is BoundsCheck<num>); | 102 Expect.isFalse(boundsFalse is BoundsCheck<num>); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 main() { | 106 main() { |
| 107 FunctionTypeAliasTest.testMain(); | 107 FunctionTypeAliasTest.testMain(); |
| 108 } | 108 } |
| OLD | NEW |