You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for delay to signal intention to leave awaitables un-awaited
Summary:
Add `delay` keyword that signals intentions to leave an awaitable unawaited (typically an anti-pattern, but valid in certain cases). Similar to `await`, `delay` is only permitted in async functions, and its operand must be an Awaitable<T>. Unlike await, which unwraps to T, delay preserves the Awaitable<T> type and is a runtime no-op.
This change doesn't impose any restrictions on unawaited awaitables without `delay`, yet. Will build on top of this to typecheck unawaited awaitables (D93179385) after addressing rollout concerns.
TODO: RFC: I still need to add a check that `delay` is only used in assignment (e.g. `$x = delay foo()`, and not `foo(delay $bar)`. The latter isn't dangerous, but it is useless. Should I add an explicit check for this, or just let it be innocuous?
Reviewed By: vassilmladenov
Differential Revision: D93162973
fbshipit-source-id: 6424b937b1f41954863c04a2e4c96b0740461039
0 commit comments