|
| 1 | +// Copyright (c) 2019, 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 | +// @dart = 2.7 |
| 6 | + |
| 7 | +import 'dart:async'; |
| 8 | + |
| 9 | +typedef Typedef(); |
| 10 | +typedef GenericTypedef<T> = void Function(T); |
| 11 | +typedef GenericFunctionTypedef = void Function<T>(T); |
| 12 | +typedef TypedefWithFutureOr = void Function<T>(FutureOr<T>); |
| 13 | + |
| 14 | +const typedef = /*cfe.TypeLiteral(dynamic Function())*/ Typedef; |
| 15 | +const genericTypedef = |
| 16 | + /*cfe.TypeLiteral(void Function(dynamic))*/ GenericTypedef; |
| 17 | +const genericFunctionTypedef = |
| 18 | + /*cfe.TypeLiteral(void Function<T>(T))*/ GenericFunctionTypedef; |
| 19 | +const typedefWithFutureOr = |
| 20 | + /*cfe.TypeLiteral(void Function<T>(FutureOr<T>))*/ TypedefWithFutureOr; |
| 21 | +const futureOr = /*cfe.TypeLiteral(FutureOr<dynamic>)*/ FutureOr; |
| 22 | +const null_ = /*cfe.TypeLiteral(Null)*/ Null; |
| 23 | + |
| 24 | +main() { |
| 25 | + print( |
| 26 | + /*analyzer.TypeLiteral(dynamic Function()*)*/ |
| 27 | + /*cfe.TypeLiteral(dynamic Function())*/ |
| 28 | + /*dart2js.TypeLiteral(()->dynamic)*/ |
| 29 | + typedef); |
| 30 | + |
| 31 | + print( |
| 32 | + /*analyzer.TypeLiteral(void Function(dynamic)*)*/ |
| 33 | + /*cfe.TypeLiteral(void Function(dynamic))*/ |
| 34 | + /*dart2js.TypeLiteral((dynamic)->void)*/ |
| 35 | + genericTypedef); |
| 36 | + |
| 37 | + print( |
| 38 | + /*analyzer.TypeLiteral(void Function<T>(T*)*)*/ |
| 39 | + /*cfe.TypeLiteral(void Function<T>(T))*/ |
| 40 | + /*dart2js.TypeLiteral((0)->void)*/ |
| 41 | + genericFunctionTypedef); |
| 42 | + |
| 43 | + print( |
| 44 | + /*analyzer.TypeLiteral(void Function<T>(FutureOr<T*>*)*)*/ |
| 45 | + /*cfe.TypeLiteral(void Function<T>(FutureOr<T>))*/ |
| 46 | + /*dart2js.TypeLiteral((FutureOr<0>)->void)*/ |
| 47 | + typedefWithFutureOr); |
| 48 | + |
| 49 | + print( |
| 50 | + /*analyzer.TypeLiteral(FutureOr<dynamic>*)*/ |
| 51 | + /*cfe.TypeLiteral(FutureOr<dynamic>)*/ |
| 52 | + /*dart2js.TypeLiteral(dynamic)*/ |
| 53 | + futureOr); |
| 54 | + |
| 55 | + print( |
| 56 | + /*analyzer.TypeLiteral(Null*)*/ |
| 57 | + /*cfe|dart2js.TypeLiteral(Null)*/ |
| 58 | + null_); |
| 59 | +} |
0 commit comments