Files
sdk/pkg/front_end/testcases/nnbd/issue41437c.dart
T
Johnni Winther a9b81e18d9 [cfe] Handle dynamic return in async
Closes #41437

Change-Id: I493b516f0b72fc1da097b92bd75150aea8e60ba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145042
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-30 12:39:04 +00:00

63 lines
1.5 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;
Stream<dynamic> getStreamNull() async* {
yield null;
}
Stream<bool> getStreamBool() async* {
yield true;
}
Stream<bool> test1() async* {
yield getNull(); // ok
}
Stream<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Stream<bool> test4() async* {
yield* getStreamNull(); // error
}
Stream<bool> test5() => getStreamNull(); // error
Stream<bool> test6() => getStreamBool(); // ok
Stream<bool> test7() async* {
yield* getStreamBool(); // ok
}
test() async {
Stream<bool> test1() async* {
yield getNull(); // ok
}
Stream<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Stream<bool> test4() async* {
yield* getStreamNull(); // error
}
Stream<bool> test5() => getStreamNull(); // error
Stream<bool> test6() => getStreamBool(); // ok
Stream<bool> test7() async* {
yield* getStreamBool(); // ok
}
Stream<bool> var1 = (() async* {
yield getNull();
})(); // error
Stream<bool> var2 = (() => getNull())(); // ok
bool var3 = (() => getNull())(); // ok
Stream<bool> var4 = (() async* {
yield* getStreamNull();
})(); // error
Stream<bool> var5 = (() => getStreamNull())(); // error
Stream<bool> var6 = (() => getStreamBool())(); // ok
Stream<bool> var7 = (() async* {
yield* getStreamBool();
})(); // ok
}
main() {}