Skip to content
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

handle internal names and JvmName annotations for name mangling. #1901

Merged
merged 1 commit into from
May 30, 2024

Conversation

neetopia
Copy link
Contributor

putting it in draft mode since this PR only fixes source symbols. Theoretically it should handle library symbols if psi stub creation for library symbols are in place (as per the document of the psi elements in analysis API symbols). The fix of this PR can be seen by enabling mangledNames test, JvmName annotations and internal names should be handled now.

Note that light class still won't handle inline names.

@neetopia neetopia requested a review from ting-yuan May 20, 2024 22:15
?.ktClassOrObjectSymbol?.psi as? KtClassOrObject
)?.toLightClass()?.allMethods?.filterIsInstance<SymbolLightSimpleMethod>()
?.singleOrNull {
(it.parameters.isNotEmpty() xor (accessor is KSPropertyGetter)) &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is very tricky, the idea is we don't have a way to tell if a light method is getter or setter, and both getter and setter shares a same property declaration as the kotlinOrigin, so we just check if an accessor has any parameters to determine whether it is a getter or setter.

@ting-yuan
Copy link
Collaborator

Theoretically it should handle library symbols if psi stub creation for library symbols are in place (as per the document of the psi elements in analysis API symbols)

Will this ever be available in standalone mode? Does it require indexing of binary dependencies?

@neetopia
Copy link
Contributor Author

neetopia commented May 20, 2024

Theoretically it should handle library symbols if psi stub creation for library symbols are in place (as per the document of the psi elements in analysis API symbols)

Will this ever be available in standalone mode? Does it require indexing of binary dependencies?

That's something we need to investigate further. Currently there are already library symbols with a stub in KSP2, see #1873

Copy link
Collaborator

@ting-yuan ting-yuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge this first and address the remaining cases later.

@neetopia neetopia marked this pull request as ready for review May 21, 2024 20:56
@neetopia neetopia merged commit 4b50035 into google:main May 30, 2024
3 checks passed
@neetopia neetopia deleted the mangled-name branch May 30, 2024 20:02
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.

2 participants