-
Notifications
You must be signed in to change notification settings - Fork 222
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
Correctly handle type promoted module symbols [#332, #375, #401] #414
Correctly handle type promoted module symbols [#332, #375, #401] #414
Conversation
moduleSymbol = null; | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Looks like the other PR accidentally got merged in here... I'll clean it up and close the other PR - they touch similar code, so it's worth doing them together. |
2d9c7e6
to
77552b6
Compare
Rebased and merged everything into this single PR - I won't touch it again until I hear back from you. I've left the clean-up commits mostly in tact, I could squash them into the relevant other commits though if you'd prefer. |
Looks like this has some issues with converting things in the global namespace - I'll see if I can narrow down a test case and take a look at it tomorrow. |
Yep that easily surpasses my standards for git history tidiness, no need to do any more tidying. |
ea19a49
to
4bb8e7e
Compare
Global case is now handled, this should be good to go. |
Fixes #332
Fixes #375
Fixes #401
Problem
We get the incorrect type when analysing type promoted module symbols, causing the incorrect symbol to be used when qualifying names explicitly.
Additionally, renamed imports are removed when they match an import that's added automatically.
When an unqualified name is used in VB, the converted C# did not qualify it if it would become ambiguous.
Solution
Use the containing type of the symbol to determine the correct LHS for a
MemberAccessExpression
. This conveniently handles type promotion, so we can remove the special case.If there are multiple imports of the same namespace, prefer the import with an alias, and use that for name resolution.
When converting a generic name, qualify it if possible to ensure we select the right reference.