Skip to content

Conversation

@DoctorKrolic
Copy link
Contributor

Fixes: #80752

As I side effect, this also changed how membe name inference works for anonymous types as well. Declaring them with null suppression still errors, but the compiler guesses the most likely intended name. I don't think this is a bad side effect

@DoctorKrolic DoctorKrolic requested a review from a team as a code owner October 26, 2025 16:48
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 26, 2025
continue;

case SyntaxKind.SuppressNullableWarningExpression:
input = ((PostfixUnaryExpressionSyntax)input).Operand;
Copy link
Contributor

Choose a reason for hiding this comment

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

input = ((PostfixUnaryExpressionSyntax)input).Operand;

It looks like this potentially can introduce a breaking change for an existing code. Let's add test(s) demonstrating that. And also let's document the breaking change. Once that is done, we can start an internal process for approving the breaking change.

}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80752")]
public void ElementNameInference_FromLocal_NullSuppression()
Copy link
Contributor

Choose a reason for hiding this comment

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

ElementNameInference_FromLocal_NullSuppression

It would be good to add a test with a motivating scenario for adding the suppression. I.e. a scenario that benefits from adding !.

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 2)

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

Labels

Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null suppression breaks tuple element name inference

2 participants