dotnet / dotnet/csharpstandard
Please clarify "Inside of an async function" means not just the immediately enclosing
Open
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
See #25448 for context.
From [the spec](https://github.com/dotnet/csharplang/blob/7f39331672cf8edbda8867de004138e0f711c877/spec/expressions.md#await-expressions):
> Inside of an async function, `await` cannot be used as an identifier
A non-async local function that is inside an async method is still "inside" of an async function, and therefore `await` is a keyword there.
It would be nice to clarify that this does not apply just to the immediately enclosing function. If *any* enclosing function is async, then `await` is a keyword.
Contributor guide
Assessment
This issue has not been assessed yet.