-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Target typed conditional expression recovery #81025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Target typed conditional expression recovery #81025
Conversation
src/Compilers/CSharp/Test/Semantic/Semantics/TargetTypedConditionalOperatorTests.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/TargetTypedConditionalOperatorTests.cs
Outdated
Show resolved
Hide resolved
|
Done with review pass (commit 2) #Closed |
…evant branche of the conditional expression
src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/TargetTypedConditionalOperatorTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/TargetTypedConditionalOperatorTests.cs
Show resolved
Hide resolved
|
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) |
There was a problem hiding this comment.
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?
AlekseyTs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 7)
|
@dotnet/roslyn-compiler For a second review |
|
@dotnet/roslyn-compiler For a second review on a community PR |
|
Thanks for the contribution @DoctorKrolic |
* 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)
Fixes: #81021