Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Jan 6, 2026

Fixes #81851 (conversion on extension receiver should be subject to same rules as conversion on this parameter). This is just a matter of passing the right flag indicating that the first argument is an extension receiver.

For readability, I switched usages of Action delegates to use named delegates.
I also switched usages of tuples to use named types (this made it easier to add an extra field).

Relates to #76130

@jcouv jcouv self-assigned this Jan 6, 2026
@jcouv jcouv added Area-Compilers Feature - Extension Everything The extension everything feature labels Jan 6, 2026
@jcouv jcouv force-pushed the extension-nullability branch 3 times, most recently from e03370c to 8fbdbbe Compare January 6, 2026 22:33
@jcouv jcouv force-pushed the extension-nullability branch from 8fbdbbe to 75cfef6 Compare January 6, 2026 23:29
@jcouv jcouv marked this pull request as ready for review January 7, 2026 05:17
@jcouv jcouv requested a review from a team as a code owner January 7, 2026 05:17
@jcouv jcouv requested a review from RikkiGibson January 7, 2026 05:17

void setAnalyzedNullabilityAndUpdateSymbol(BoundAssignmentOperator node, BoundObjectInitializerMember objectInitializer, Symbol? updatedSymbol)
{
// https://github.com/dotnet/roslyn/issues/35040: Should likely be setting _resultType in VisitObjectCreationInitializer
Copy link
Member

@RikkiGibson RikkiGibson Jan 7, 2026

Choose a reason for hiding this comment

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

Is this issue still valid? It seems like since we could be calling this from a continuation, the _resultType may have changed since then. Perhaps we should close that issue out and remove the reference to it. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the issue is still valid. The type from initial binding (stored in the bound node) wouldn't have the nullable-updated information.

Copy link
Member

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

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

Done review pass

@jcouv jcouv requested a review from a team January 8, 2026 05:41
@jcouv
Copy link
Member Author

jcouv commented Jan 8, 2026

@dotnet/roslyn-compiler for second review. Thanks

RikkiGibson
RikkiGibson previously approved these changes Jan 8, 2026
@jcouv jcouv marked this pull request as draft January 9, 2026 01:04
@jcouv jcouv changed the title Extensions: adjust nullability analysis of setters Extensions: apply same nullability checks on receiver as for classic extension methods Jan 9, 2026
@jcouv jcouv dismissed RikkiGibson’s stale review January 9, 2026 05:18

Reverted changes related to setters

@jcouv jcouv marked this pull request as ready for review January 9, 2026 17:06
if (isExtensionBlockMember)
{
Debug.Assert(symbol is not null);
refKindsOpt = AdjustArgumentRefKindsIfNeeded(refKindsOpt, isExtensionBlockMember, symbol, objectInitializer.Arguments.Length);
Copy link
Contributor

Choose a reason for hiding this comment

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

isExtensionBlockMember

true? Here and in other places in this block

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

@jcouv jcouv requested a review from RikkiGibson January 12, 2026 18:18
@jcouv jcouv merged commit 52e8114 into dotnet:main Jan 13, 2026
25 checks passed
@jcouv jcouv deleted the extension-nullability branch January 13, 2026 22:13
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 13, 2026
@davidwengier davidwengier modified the milestones: Next, 18.4 Jan 27, 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.

Missing nullability warning on tuple conversion for receiver of extension member

4 participants