swift
4af7f95f - Update error messages

Commit
5 years ago
Update error messages This patch restructures how we emit the effect errors for missing awaits. As we're traversing the expressions, we collect all of the locations where a missing await is, and metadata about the reason for the error, as well as the "anchor". The anchor is where the await should actually be placed in the expression to fix things. The error is emitted for the whole sub-expression instead of for the exact synchronization/call-site of the async function. This avoids the erroneous message for ``` _ = 32 + asyncFunc() ``` The old behaviour was to put the `await` between the `+` operator and the call to `asyncFunc()`, but this is not a valid place to put effects. Note; this issue is also present in the fix-it for `try` insertions and also needs to be fixed. Instead, the anchor points between the assignment expression and 32, labelling the whole right-side of the assignment as being the asynchronous function. We emit notes for each uncovered async point in the entire expression though, so that someone can see why the expression is async.
Author
Committer
Parents
Loading