Files
sdk/pkg/front_end/testcases/nnbd/issue41437a.dart
T
Johnni Winther 34f5c9d0b4 [cfe] Implement new async return rules
Closes #41800
Closes #41900
Closes #42134
Closes #42282
Closes #42236
Closes #42169

Change-Id: Ia994bc07fba4e2342fcb59d44fc77608198a328b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152150
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-06 07:04:40 +00:00

41 lines
1.4 KiB
Dart

// Copyright (c) 2020, 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.
dynamic getNull() => null;
Future<dynamic> getFutureNull() async {
return null;
}
Future<bool> getFutureBool() async {
return true;
}
Future<bool> test1() async => await getNull(); // ok
Future<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Future<bool> test4() async => await getFutureNull(); // ok
Future<bool> test5() => getFutureNull(); // error
Future<bool> test6() => getFutureBool(); // ok
Future<bool> test7() async => getFutureBool(); // ok
test() async {
Future<bool> test1() async => await getNull(); // ok
Future<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Future<bool> test4() async => await getFutureNull(); // ok
Future<bool> test5() => getFutureNull(); // error
Future<bool> test6() => getFutureBool(); // ok
Future<bool> test7() async => getFutureBool(); // ok
Future<bool> var1 = (() async => await getNull())(); // error
Future<bool> var2 = (() => getNull())(); // ok
bool var3 = (() => getNull())(); // ok
Future<bool> var4 = (() async => await getFutureNull())(); // error
Future<bool> var5 = (() => getFutureNull())(); // error
Future<bool> var6 = (() => getFutureBool())(); // ok
Future<bool> var7 = (() async => getFutureBool())(); // ok
}
main() {}