Skip to content

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

Open
BillWagner wants to merge 10 commits intodraft-v9from
v9-more-partial-methods
Open

[Version 9.0] Feature support for more partial methods#1468
BillWagner wants to merge 10 commits intodraft-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
Copy link
Member Author

BillWagner commented Jan 9, 2026

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
RexJaeschke and others added 3 commits January 16, 2026 11:09
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.
@BillWagner BillWagner force-pushed the v9-more-partial-methods branch from df85388 to 5839c04 Compare January 16, 2026 16:10
BillWagner and others added 3 commits January 29, 2026 11:23
Co-authored-by: Jon Skeet <jonskeet@google.com>
Investigate and respond to feedback from reviews.

Implement the proposed name change to "optional" and "required"
Copy link
Contributor

@jskeet jskeet left a comment

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!

- 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
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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meeting: discuss This issue should be discussed at the next TC49-TG2 meeting 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