Files
sdk/pkg/front_end/testcases/future_or_test.dart
T
Dmitry Stefantsov 22447b9516 Fix bug in assignability check for return expressions of async bodies
Change-Id: Iaab2466ac1c9766861e72e9224a3206da6c42d45
Reviewed-on: https://dart-review.googlesource.com/42743
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-22 13:15:14 +00:00

28 lines
601 B
Dart

// Copyright (c) 2018, 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.
// The test checks that an expression with static type Future<dynamic> is
// accepted as a return expression of a method with an async body and the
// declared return type Future<int>.
import 'dart:async';
class A {
dynamic foo() => null;
}
class B {
A a;
Future<dynamic> bar() async => a.foo();
}
class C {
B b = B();
Future<int> baz() async => b.bar();
}
main() {}