// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // @dart=2.9 /*@testedFeatures=inference*/ library test; import 'dart:async'; class MyFuture implements Future { MyFuture() {} MyFuture.value(T x) {} dynamic noSuchMethod(invocation) => null; MyFuture then(FutureOr f(T x), {Function onError}) => null; } void test() { MyFuture f; Future t1 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async => await new Future.value(3)); Future t2 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async { return await new Future.value(3); }); Future t3 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async => 3); Future t4 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async { return 3; }); Future t5 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) => new Future.value(3)); Future t6 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) { return new Future.value(3); }); Future t7 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async => new Future.value(3)); Future t8 = f. /*@ typeArgs=int* */ /*@target=MyFuture.then*/ then( /*@ returnType=Future* */ (/*@ type=dynamic */ _) async { return new Future.value(3); }); } main() {}