Files
sdk/pkg/front_end/testcases/nnbd/issue41437b.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.6 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;
Iterable<dynamic> getIterableNull() sync* {
yield null;
}
Iterable<bool> getIterableBool() sync* {
yield true;
}
Iterable<bool> test1() sync* {
yield getNull(); // ok
}
Iterable<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Iterable<bool> test4() sync* {
yield* getIterableNull(); // error
}
Iterable<bool> test5() => getIterableNull(); // error
Iterable<bool> test6() => getIterableBool(); // ok
Iterable<bool> test7() sync* {
yield* getIterableBool(); // ok
}
test() async {
Iterable<bool> test1() sync* {
yield getNull(); // ok
}
Iterable<bool> test2() => getNull(); // ok
bool test3() => getNull(); // ok
Iterable<bool> test4() sync* {
yield* getIterableNull(); // error
}
Iterable<bool> test5() => getIterableNull(); // error
Iterable<bool> test6() => getIterableBool(); // ok
Iterable<bool> test7() sync* {
yield* getIterableBool(); // ok
}
Iterable<bool> var1 = (() sync* {
yield getNull();
})(); // error
Iterable<bool> var2 = (() => getNull())(); // ok
bool var3 = (() => getNull())(); // ok
Iterable<bool> var4 = (() sync* {
yield* getIterableNull();
})(); // error
Iterable<bool> var5 = (() => getIterableNull())(); // error
Iterable<bool> var6 = (() => getIterableBool())(); // ok
Iterable<bool> var7 = (() sync* {
yield* getIterableBool();
})(); // ok
}
main() {}