Skip to content

Proposal: Generalized generic type inference - #10311

Draft
MadsTorgersen wants to merge 2 commits into
mainfrom
madstorgersen-generalized-type-inference
Draft

Proposal: Generalized generic type inference#10311
MadsTorgersen wants to merge 2 commits into
mainfrom
madstorgersen-generalized-type-inference

Conversation

@MadsTorgersen

@MadsTorgersen MadsTorgersen commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a construct-neutral model for generic type inference inputs and outputs
  • add target-derived upper bounds for by-value results and exact bounds for by-reference results
  • define adapters for method invocation and method-group conversion, including return-type inference
  • document mixed argument/target inference, compatibility risks, alternatives, and unresolved ref/target questions
  • establish this proposal as the intended successor to target-typed-generic-type-inference.md under champion issue [Proposal]: Target-typed generic type inference #9626, without editing that earlier draft

Shared proposal series

Layer Generalized inference Type groups Constructor inference
csharplang proposal #10311 — generalized foundation #10310 #10312
csharpstandard specification #1 #2 #3

The csharplang proposal PRs are independent siblings based directly on main. The csharpstandard PRs are mechanically stacked in order: #2 on #1, then #3 on #2. This PR is the generalized foundation; constructor candidate construction and type-group lookup remain in their sibling proposals.

The older proposals/target-typed-generic-type-inference.md needs a later superseded banner or redirect. That cleanup is intentionally out of scope for this PR.

Compatibility and open design

This is not purely additive: target-derived bounds and method-group return inference can change inference success, candidate sets, ambiguities, overload selection, and failures. The proposal leaves the precise source of invocation target/ref-kind information, by-ref compatibility boundaries, method-group staging, and the split between user-facing behavior and standards refactoring as explicit open questions.

Validation

  • git diff --check
  • required proposal sections and repository-relative links checked
  • sibling proposal links checked against live PR URLs
  • design reviewed against the current csharpstandard Async Streams #1 diff
  • branch ancestry verified directly against origin/main

MadsTorgersen and others added 2 commits August 17, 2026 15:08
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant