Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DoctorKrolic
Copy link
Contributor

Fixes: #81021

@DoctorKrolic DoctorKrolic requested review from a team as code owners November 4, 2025 19:25
@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 Nov 4, 2025
@AlekseyTs
Copy link
Contributor

AlekseyTs commented Nov 4, 2025

Done with review pass (commit 2) #Closed

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Nov 5, 2025

Done with review pass (commit 4) #Closed

object falseArg = op.Alternative.Display;
if (op.NoCommonTypeError == ErrorCode.ERR_InvalidQM && trueArg is Symbol trueSymbol && falseArg is Symbol falseSymbol)

if (!op.HasAnyErrors)
Copy link
Contributor Author

@DoctorKrolic DoctorKrolic Nov 5, 2025

Choose a reason for hiding this comment

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

@AlekseyTs On one hand, as I already stated, error reported in this branch, spans over the whole expression, so it makes sense to disable it if there are any other "more local" errors in the expression. On the other hand, logically this error is only related to true and false branches so it also makes sence to suppress it only if there are errors specifically in them. For instance, consider existing test with expression 1 ? null : null. It has error on 1 since it is not convertible to boolean, but also there is no conversion betwen nulls in both branches. How do you think, should we report error on the whole expression about no conversion between nulls in branches in such case?

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

@AlekseyTs AlekseyTs requested a review from a team November 6, 2025 14:50
@AlekseyTs
Copy link
Contributor

@dotnet/roslyn-compiler For a second review

@AlekseyTs
Copy link
Contributor

@dotnet/roslyn-compiler For a second review on a community PR

@jjonescz jjonescz merged commit 252fa60 into dotnet:main Nov 10, 2025
29 checks passed
@jjonescz
Copy link
Member

Thanks for the contribution @DoctorKrolic

@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 10, 2025
@DoctorKrolic DoctorKrolic deleted the target-typed-conditional-expression-recovery branch November 10, 2025 15:46
333fred added a commit to 333fred/roslyn that referenced this pull request Nov 10, 2025
* upstream/main:
  Simplify sequence point display (dotnet#81104)
  [main] Update dependencies from dotnet/arcade (dotnet#81129)
  [main] Update dependencies from dotnet/arcade (dotnet#81105)
  Target typed conditional expression recovery (dotnet#81025)
  dotnet#81118: Fix dropdown in "Move static members" dialog (dotnet#81119)
  Don't emit DebuggerStepThroughAttribute for runtime async methods (dotnet#81035)
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.

Target-typed conditional expression doesn't handle typing well

4 participants