Skip to content

[Version 9.0] Feature support for more partial methods#1468

Draft
BillWagner wants to merge 11 commits into
draft-v9from
v9-more-partial-methods
Draft

[Version 9.0] Feature support for more partial methods#1468
BillWagner wants to merge 11 commits into
draft-v9from
v9-more-partial-methods

Conversation

@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from 5e7986c to 9e0a0f2 Compare November 11, 2025 21:33
@RexJaeschke RexJaeschke added this to the C# 9.0 milestone Nov 12, 2025
@RexJaeschke RexJaeschke added type: feature This issue describes a new feature Review: pending Proposal is available for review labels Nov 12, 2025
@RexJaeschke RexJaeschke changed the title [Version 9.0] More partial methods [Version 9.0] Feature support for more partial methods Nov 14, 2025
@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from 9e0a0f2 to 13eca45 Compare January 8, 2026 21:28
@BillWagner BillWagner added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Jan 9, 2026
@BillWagner

BillWagner commented Jan 9, 2026

Copy link
Copy Markdown
Member Author

This is ready for a first look from the committee.

I addressed all the comments from #991. However, #991 (comment) is an instance where the spec language is correct, and the roslyn implementation has a parsing error. See dotnet/roslyn#81947.

Secondly, I made more substantial edits to the original PR. The draft retained a single clause for Partial methods. Looking ahead at the future versions (for the standard), I split this into three sections: General, restricted partial methods, and unrestricted partial methods. I think that makes the text easier to read, and provides the framework for future versions where there are more unrestricted partial methods.

Discussion question: I used the terms in the current PR of "restricted" and "unrestricted". I'm not convinced those are the best terms. It might be better to use "optional partial methods", and "required partial methods", respectively. I'm not sold on those either. Other thoughts?

@BillWagner
BillWagner marked this pull request as ready for review January 9, 2026 16:34
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md
Comment thread standard/classes.md Outdated
@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from df85388 to 5839c04 Compare January 16, 2026 16:10

@jskeet jskeet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall - either optional and required are the wrong way round here, or I think we should find another pair of terms. Sorry to throw a spanner in the works!

Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
- Corresponding type parameters in the declarations shall have the same constraints (modulo differences in type parameter names).
- The declarations shall have the same modifiers except for the `async` and `extern` modifiers. The `async` and `extern` modifiers are allowed only on the implementing partial method declaration.
- Corresponding parameters in the declarations shall have the same modifiers (although not necessarily in the same order) and the same types (modulo differences in type parameter names). Tuple types (§8.3.11) used as parameters or return types shall have the same item names in both the defining and implementing partial method declarations.
- Corresponding type parameters in the declarations shall have the same constraints. An implementation may choose to issue a warning if the type parameter names are different in the defining and implementing declarations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this bit about warnings? (I think we generally say implementations can issue warnings whenever they want.)

Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
Comment thread standard/classes.md Outdated
@BillWagner BillWagner removed the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Mar 11, 2026
@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from fbe81a5 to c403cee Compare April 10, 2026 21:09
BillWagner added a commit that referenced this pull request Apr 10, 2026
…review commits

Delta: 9 commits (16fa8b4..c403cee)
Original: 3563471 (alpha-v9) / 3eed3e3 (pr-1468)
Conflicts resolved: 2 in classes.md
  - Conflict 1: Replaced old 'two kinds' paragraph with new 'classified as follows' intro
  - Conflict 2: Replaced old 'restricted partial method' restrictions with 'default arguments' bullet (restrictions moved to §optional-partial-methods)
@RexJaeschke
RexJaeschke marked this pull request as draft May 5, 2026 14:51
@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from c403cee to 84fff65 Compare May 12, 2026 21:21
RexJaeschke and others added 5 commits June 24, 2026 13:39
fix md formatting

revert to previous text

handle imp/exp private

allow partial with ref_kind returns

change link's target name
Also, edit after moving text around.
Clean up a bit of language and flow.
Co-authored-by: Jon Skeet <jonskeet@google.com>
Investigate and respond to feedback from reviews.

Implement the proposed name change to "optional" and "required"
@BillWagner
BillWagner force-pushed the v9-more-partial-methods branch from 84fff65 to db72bd2 Compare June 24, 2026 17:40
@BillWagner

Copy link
Copy Markdown
Member Author

An earlier version of this feature is already present on alpha-v9 from a prior meeting. Edits made to this PR since then are not yet on alpha-v9; they will land at the next propagation. If you need them on alpha-v9 sooner, please open a separate PR targeting alpha-v9.
Thanks!

- Add that return types must match.
- Add rule on type parameter constraints.
- Add text for extern implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: pending Proposal is available for review type: feature This issue describes a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants