Skip to content

Fix: Convert VB.Net 'Operator Xor' to C# 'operator ^'#1183

Merged
GrahamTheCoder merged 4 commits intoicsharpcode:masterfrom
GrahamTheCoder:fix-vbnet-xor-operator-to-csharp-caret
Jun 14, 2025
Merged

Fix: Convert VB.Net 'Operator Xor' to C# 'operator ^'#1183
GrahamTheCoder merged 4 commits intoicsharpcode:masterfrom
GrahamTheCoder:fix-vbnet-xor-operator-to-csharp-caret

Conversation

@GrahamTheCoder
Copy link
Copy Markdown
Member

@GrahamTheCoder GrahamTheCoder commented Jun 14, 2025

Fixes #1182

Implements the conversion for VB.Net Operator Xor overload declarations to their C# operator ^ equivalent.

The change involves modifying the ConvertToken method in CodeConverter/CSharp/SyntaxKindExtensions.cs to correctly map VBasic.SyntaxKind.XorKeyword (when used in an operator declaration context) to CSSyntaxKind.CaretToken. This addresses the issue where such declarations were previously causing a cast error due to being misinterpreted.

This was a test of Jules. I gave it the issue description for the simplest possible issue on this codebase. It:

  • Misformatted the given test case
  • Couldn't run the tests (despite there being a file here that shows how to run them in github actions
  • Did make the correct one line addition required.

Given that Jules doesn't officially support C#, this is still shows promise, but obviously is much slower than manually fixing right now.

google-labs-jules bot and others added 3 commits June 14, 2025 22:54
This commit implements the conversion for VB.Net `Operator Xor` overload declarations to their C# `operator ^` equivalent.

The change involves modifying the `ConvertToken` method in `CodeConverter/CSharp/SyntaxKindExtensions.cs` to correctly map `VBasic.SyntaxKind.XorKeyword` (when used in an operator declaration context) to `CSSyntaxKind.CaretToken`. This addresses the issue where such declarations were previously causing a cast error due to being misinterpreted.

I made extensive attempts to add or correct a unit test for this specific scenario in `Tests/CSharp/MemberTests/OperatorMemberTests.cs`. However, I encountered difficulties in reliably modifying the test file (`OperatorMemberTests.cs`) to bring it to a correct, compilable state to include the new test. It is therefore likely broken or does not contain the intended test for this fix.

The core `CodeConverter.csproj` containing this fix compiles successfully. The `Vsix.csproj` has an unrelated, persistent build issue (missing VSSDK targets).
@GrahamTheCoder GrahamTheCoder marked this pull request as ready for review June 14, 2025 23:31
@GrahamTheCoder GrahamTheCoder merged commit bd97bd1 into icsharpcode:master Jun 14, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VB -> C#: Xor operator overload CONVERSION ERROR

1 participant