#3847. Add function literal inference tests for return type. Part 2.#3939
#3847. Add function literal inference tests for return type. Part 2.#3939sgrekhov wants to merge 1 commit into
Conversation
eernstg
left a comment
There was a problem hiding this comment.
Almost every test in this PR depends on dart-lang/language#4718 (about the spurious ? which is added to the element type in all return types of generators when the end of the body can be reached).
Perhaps we should just block this until that issue has been clarified.
| /// super-interface of `S;` and update `T` to be `UP(E, T)`. | ||
| /// | ||
| /// @description Check that the return type of a `sync*` function with a single | ||
| /// `yield e;` is `Iterable<X>;`, where `X` is the static type of `e`. |
There was a problem hiding this comment.
I'd actually expect the current specification and implementation to make the return type Iterable<X?> because of the spurious Null mentioned in dart-lang/language#4718.
Perhaps this particular test should be postponed until this has been resolved? Otherwise, we should expect the ? to be included in all cases because all function bodies can be completed normally.
There was a problem hiding this comment.
The same consideration holds for the following tests about generators where the body can complete normally (I think that's all of them, they don't have any return statements or other constructs that prevent the body from completing normally).
|
Blocked by dart-lang/language#4718. |
For review it's enough to review top-level functions only. The other code repeats these functions as static and instance members in classes, mixins, mixin classes, enums, extensions and extension types.