Skip to content

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #78841

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 26, 2025 19:43
@CyrusNajmabadi CyrusNajmabadi requested a review from akhera99 June 26, 2025 20:07
{
void M()
{
int x = (a + b) ?? c;
Copy link
Member

Choose a reason for hiding this comment

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

where in the code does it decide to parenthesize like this rather than a + (b ?? c)

// only add parentheses within the same precedence band.
if (childEquivalenceKey != parentEquivalenceKey)
{
if (IsClearPrecedenceBoundary())
Copy link
Member Author

Choose a reason for hiding this comment

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

@akhera99 here. we view the precedence as unclear. the fixer then actually wraps with parens (that fixer didn't need to change, it just trusts what the analyzer reports).

@CyrusNajmabadi CyrusNajmabadi merged commit 64af44c into dotnet:main Jun 26, 2025
26 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the coalesceClarity branch June 26, 2025 22:58
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 26, 2025
akoeplinger added a commit to dkurepa/dotnet that referenced this pull request Jul 8, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE0048 not issued for chained arithmetic and null-coalescing operator
3 participants