Claude/fix issue 827 myclass backing field#1252
Open
GrahamTheCoder wants to merge 7 commits intoicsharpcode:masterfrom
Open
Claude/fix issue 827 myclass backing field#1252GrahamTheCoder wants to merge 7 commits intoicsharpcode:masterfrom
GrahamTheCoder wants to merge 7 commits intoicsharpcode:masterfrom
Conversation
This commit fixes issue icsharpcode#827 where accessing the auto-generated backing field (e.g. `_Prop`) of an overridable (virtual) property in VB.NET was incorrectly converted to the virtual property access (`Prop`) in C#. It now correctly maps these accesses to the explicitly generated non-virtual backing property `MyClassProp` and ensures that the MyClassProp property is correctly generated when such an access occurs. A test case has been added to MemberTests.cs to verify the correct translation of such field access. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit fixes issue icsharpcode#827 where accessing the auto-generated backing field (e.g. `_Prop`) of an overridable (virtual) property in VB.NET was incorrectly converted to the virtual property access (`Prop`) in C#. It now correctly maps these accesses to the explicitly generated non-virtual backing property `MyClassProp` and ensures that the MyClassProp property is correctly generated when such an access occurs. A test case has been added to MemberTests.cs to verify the correct translation of such field access. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…Prop for virtual auto-properties When VB accesses _Prop (the backing field of a virtual auto-property), the converter now emits MyClassProp instead of Prop, matching the C# backing property name and avoiding virtual dispatch to child class overrides. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
…ent indentation - Add TestOverridableAutoPropertyBackingFieldAccessAsync to Tests/CSharp/MemberTests/PropertyMemberTests.cs (VB->CS tests) covering the exact issue icsharpcode#827 scenario: _Prop = 10 converts to MyClassProp = 10 - Remove duplicate test from Tests/VB/MemberTests.cs where VB->CS tests do not belong - Fix indentation of comment in CommonConversions.cs https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
…yClassAccessedNames call The method was changed to instance method using _semanticModel directly, but the call site still passed _semanticModel as an argument causing a compilation error. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
…branch Tests TestCharDefaultValueForStringParameterAsync and TestCharLiteralDefaultValueForStringParameterAsync require the FixCharDefaultsForStringParams fix which is in a separate PR. Removing them from the issue-827 branch to prevent test failures. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
… access
When _Prop is accessed via MyClass._Prop, NameExpressionNodeVisitor.cs
already adds the MyClass prefix via "$MyClass{ConvertIdentifier(...).ValueText}".
The new ConvertIdentifier code was also returning MyClassProp for _Prop,
causing a double prefix MyClassMyClassProp.
Fix: detect when _Prop is part of a MyClass._Prop member access and
return the bare property name so NameExpressionNodeVisitor can prefix it.
https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #827