Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the way that async function returns are type-checked so that…
… the error messages become more clear. The newly introduced check models the legal return types from async code as a union type (which they essentially are) so that a subtype test is sufficient to verify them. There is a risk that synthesizing union types like these could lead to very verbose error messages, but it's thought that the error case being clarified (see bug) is more common. This CL also tightens the requirements on async function to return no kind of union, including unions with `null` or `undefined`. This was required to make the return type validation correct, but also deemed more accurate. Nullable unions were initially supported as a compromise but on consideration seemed not particularly valuable. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219873146
- Loading branch information
Showing
3 changed files
with
49 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters