// 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(x) {} dynamic noSuchMethod(invocation) => null; MyFuture then(FutureOr f(T x), {Function onError}) => null; } Future g1(bool x) async { return /*info:DOWN_CAST_COMPOSITE*/ x ? 42 : new /*@ typeArgs=int* */ Future.value(42); } Future g2(bool x) async => /*info:DOWN_CAST_COMPOSITE*/ x ? 42 : new /*@ typeArgs=int* */ Future.value(42); Future g3(bool x) async { var /*@ type=Object* */ y = x ? 42 : new /*@ typeArgs=int* */ Future.value(42); return /*info:DOWN_CAST_COMPOSITE*/ y; } main() {}