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.
@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?
|
@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