Skip to content

Extensions: keep round-tripped unnamed extension parameter unnamed#81311

Merged
jcouv merged 2 commits intodotnet:mainfrom
jcouv:named-argument
Nov 19, 2025
Merged

Extensions: keep round-tripped unnamed extension parameter unnamed#81311
jcouv merged 2 commits intodotnet:mainfrom
jcouv:named-argument

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Nov 18, 2025

Fixes #81251

Relates to test plan #76130

@jcouv jcouv self-assigned this Nov 18, 2025
@jcouv jcouv added Area-Compilers Feature - Extension Everything The extension everything feature labels Nov 18, 2025
@jcouv jcouv marked this pull request as ready for review November 18, 2025 08:55
@jcouv jcouv requested a review from a team as a code owner November 18, 2025 08:55
@jcouv jcouv requested a review from jjonescz November 18, 2025 09:12
}

var markerMethod = ((PENamedTypeSymbol)containingSymbol.ContainingType).GetMarkerMethodSymbol();
return markerMethod != null && object.ReferenceEquals(markerMethod, containingSymbol) && ordinal == 0;
Copy link
Contributor

@AlekseyTs AlekseyTs Nov 18, 2025

Choose a reason for hiding this comment

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

markerMethod != null

This condition looks unnecessary #Closed


static bool isExtensionMarkerParameter(Symbol containingSymbol, int ordinal)
{
if (containingSymbol.MetadataName != WellKnownMemberNames.ExtensionMarkerMethodName)
Copy link
Contributor

@AlekseyTs AlekseyTs Nov 18, 2025

Choose a reason for hiding this comment

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

containingSymbol.MetadataName != WellKnownMemberNames.ExtensionMarkerMethodName

We might also check for HasSpecialName and IsStatic and that containing symbol is a method. #ByDesign

Copy link
Member Author

Choose a reason for hiding this comment

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

The further optimization doesn't seem worthwhile. The method name check already does most of that work, and the remaining checks are built into GetMarkerMethodSymbol()

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 1)

@jcouv jcouv merged commit 5afbf53 into dotnet:main Nov 19, 2025
25 checks passed
@jcouv jcouv deleted the named-argument branch November 19, 2025 06:18
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 19, 2025
@davidwengier davidwengier modified the milestones: Next, 18.3 Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Feature - Extension Everything The extension everything feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error CS1744 when parameter is named value in extension in another project

4 participants