Closed
Description
Proposal: dotnet/csharplang#1407
Spec: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/async-method-builders.md
- Usage with type parameter:
[MyBuilderOverride<int>]
(currently disallowed) (clarifying message in PR Use specific error message for wrong arity in async builder #54632) - Update attribute type in BCL (issue API Proposal: AsyncMethodBuilderOverrideAttribute and PoolingAsyncValueTaskMethodBuilders runtime#49903, PR Add AsyncMethodBuilderOverride and PoolingAsyncValueTaskMethodBuilders runtime#50116)
- LDM confirm we need a fully functional task-like return type (answer: unused so unvalidated, but lambdas must have explicit return types)
- LDM confirm we keep the same validation rule on builder type (answer: no accessibility requirement)
- LDM confirm we keep the same validation rules on well-known members (answer: all must be public)
- LDM confirm that the builder factory vs. builder indirection only applies to overrides (answer: indirection is now out-of-scope)
- LangVer 😉
- No validation on builder of return type. The return type may not even be task-like.
- We also test with Task/ValueTask return types (that’s one of the primary scenarios)
- Nullability analysis of return statement
- Binding rules for return statement:
-
return
with no value and implicit return allowed if method-level builder is non-generic -
return
with value involves conversion to the type argument
-
- Attribute can be used on method, lambda with explicit type, and local function
- The type used as method-level builder must be a non-void non-error named type.
- We validate the builder the same way that we do for task-like types, except that we don’t care about the method-level builder’s accessibility.
- We validate numerous kinds of bad builders: missing members, incorrect signatures or return types, static, ref return, non-public accessibility, …
- Specifying the attribute more than once (first one is used)
- No IDE impact
Task-like types spec: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-7.0/task-types.md
Metadata
Metadata
Assignees
Type
Projects
Status
Done Umbrellas