Skip to content

Commit e844ed6

Browse files
authored
Address a minor detail.
1 parent 75db35e commit e844ed6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

working/1661 - unawaited futures/proposal.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ and then it's a compile-time error if an expression *e* with a static type which
5656

5757
This would capture more positions of futures which might get dropped, and would even avoid `as void` being useful to avoid the warning. It avoids relying on the type of the expression propagating out to the place where the value is discarded. Example: `test ? Object() : Future.value(2);` is an expression-statement where the expression has static type `Object`, and if `test` is false, it does not await the future. Unless we make the context type of these expressions be `void`, and propagate that context type into the subexpressions in tail position (we currently don't), we won't be able to use static types alone to catch this example. Even if we did that, we couldn't/shouldn't propagate the context type past an `as` cast.
5858

59+
We'd also make it an error to use <code>unawaited *e*</code> when *e* does not have *any* expression *e*<sub>2</sub> in tail position which is potentially a future.
60+
5961
It's all about how *complete* we want to be vs. how complicated the analysis becomes&mdash;for tools and for users who need to understand the language.
6062

6163
### The false positive marker

0 commit comments

Comments
 (0)