Conversation
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
| { | ||
| // Operators defined on interfaces cannot be used with dynamic binding at runtime, | ||
| // so we don't consider them as applicable. | ||
| if (op.ContainingType.IsInterface) |
There was a problem hiding this comment.
@copilot Please combine interface check with condition in if (type.Kind != SymbolKind.NamedType) on line 1580 instead. #Closed
There was a problem hiding this comment.
Done in commit 3cf6ed6. The interface check is now combined with the SymbolKind.NamedType check at line 1580, and the redundant check inside hasApplicableBooleanOperator has been removed.
| } | ||
| }"; | ||
| CreateCompilation(source, targetFramework: TargetFramework.Net70).VerifyDiagnostics( | ||
| // (21,13): error CS7083: Expression must be implicitly convertible to Boolean or its type 'I1' must define operator 'false'. |
There was a problem hiding this comment.
Expression must be implicitly convertible to Boolean or its type 'I1' must define operator 'false'.
@copilot Please adjust corresponding resource string so that wording for this error message would be: "Expression must be implicitly convertible to Boolean or its type 'I1' must not be an interface and must define operator 'false'." #Closed
There was a problem hiding this comment.
Done in commit ee63d62. The error message now reads: "Expression must be implicitly convertible to Boolean or its type '{0}' must not be an interface and must define operator '{1}'." All test comments have been updated accordingly.
There was a problem hiding this comment.
Done in commit ee63d62. The error message now reads: "Expression must be implicitly convertible to Boolean or its type '{0}' must not be an interface and must define operator '{1}'." All test comments have been updated accordingly.
@copilot Please adjust the following test comments in a similar way:
src\Compilers\CSharp\Test\Emit3\Semantics\ExtensionOperatorsTests.cs(15848):// (26,13): error CS7083: Expression must be implicitly convertible to Boolean or its type 'object' must define operator 'false'.
src\Compilers\CSharp\Test\IOperation\IOperation\IOperationTests_IBinaryOperatorExpression.cs(6353):// file.cs(6,18): error CS7083: Expression must be implicitly convertible to Boolean or its type 'C' must define operator 'false'.
src\Compilers\CSharp\Test\IOperation\IOperation\IOperationTests_IBinaryOperatorExpression.cs(6865):// file.cs(6,18): error CS7083: Expression must be implicitly convertible to Boolean or its type 'C?' must define operator 'false'.
src\Compilers\CSharp\Test\IOperation\IOperation\IOperationTests_IBinaryOperatorExpression.cs(7586):// file.cs(6,18): error CS7083: Expression must be implicitly convertible to Boolean or its type 'C?' must define operator 'false'.
src\Compilers\CSharp\Test\IOperation\IOperation\IOperationTests_IBinaryOperatorExpression.cs(7695):// file.cs(6,18): error CS7083: Expression must be implicitly convertible to Boolean or its type 'C?' must define operator 'false'.
src\Compilers\CSharp\Test\IOperation\IOperation\IOperationTests_IBinaryOperatorExpression.cs(8017):// file.cs(6,18): error CS7083: Expression must be implicitly convertible to Boolean or its type 'bool?' must define operator 'false'.
src\Compilers\CSharp\Test\Semantic\Semantics\OperatorTests.cs(9274):// (27,37): error CS7083: Expression must be implicitly convertible to Boolean or its type 'S1?' must define operator 'false'.
src\Compilers\CSharp\Test\Semantic\Semantics\OperatorTests.cs(9319):// (27,37): error CS7083: Expression must be implicitly convertible to Boolean or its type 'S1?' must define operator 'false'.
There was a problem hiding this comment.
Done in commit 92e9427. Updated all 8 test comment occurrences across 3 files (ExtensionOperatorsTests.cs, IOperationTests_IBinaryOperatorExpression.cs, and OperatorTests.cs) to include "must not be an interface and" in the error message.
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
|
@copilot Please document the breaking change at the end of "roslyn\docs\compilers\CSharp\Compiler Breaking Changes - DotNet 11.md" file |
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
Done in commit fb27b79. The breaking change has been documented at the end of "Compiler Breaking Changes - DotNet 11.md" with a description of the issue, example code showing the error, a workaround, and a link to the GitHub issue. #Closed |
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
&&/|| when left operand is statically typed as an interface
|
@dotnet/roslyn-compiler Please review. |
|
@dotnet/roslyn-compiler Please review |
1 similar comment
|
@dotnet/roslyn-compiler Please review |
|
@dotnet/roslyn-compiler For a second review |
RikkiGibson
left a comment
There was a problem hiding this comment.
LGTM, comment is not blocking.
Co-authored-by: Rikki Gibson <rigibson@microsoft.com>
Plan for fixing interface operator with dynamic bug
Original prompt
&&/||when left operand is statically typed as an interface withtrue/falseoperator. #80954💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.