Skip to content

VB -> C#: private partial methods do not compile #1189

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrmoreno1
Copy link
Contributor

@jrmoreno1 jrmoreno1 commented Jul 18, 2025

  • Added unit test to SpecialConversionTests (not MethodStatementTests as there is no statements) -ISymbolExtensions.cs
    • CanHaveMethodBody & IsPartialMethodDefinition
    • Added check for IsPartialDefinition

#1097

Problem

Partial method declarations are including a body, which makes them partial method IMPLEMENTATIONS without declarations and so the resulting conversion does not compile

Solution

  • Changed the code as little as possible, I think it fits in with the existing code, could be broken up into multiple (shorter) lines, and negative pattern matching could probably be used, but didn't want to change too much.
  • Change to IsPartialMethodDefinition is unnecessary for this, not sure it should be included or not.
  • There is a test for problem, but there's not a test for the other end of it (i.e. that it correctly converts partial implementations, but I didn't have a problem with those).
  • At least one test covering the code changed

- Added unit test to SpecialConversionTests (not MethodStatementTests  as there is no statements)
-ISymbolExtensions.cs
  - CanHaveMethodBody & IsPartialMethodDefinition
  - Added check for IsPartialDefinition

icsharpcode#1097
@jrmoreno1
Copy link
Contributor Author

@GrahamTheCoder : no test results have changed, but I did add a unit test for it. Not sure it's where you'll want it.

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.

1 participant