Skip to content

Fix #10868: Handle semantic name in Java source code #11472

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

Merged
merged 2 commits into from
Feb 24, 2021

Conversation

liufengyun
Copy link
Contributor

@liufengyun liufengyun commented Feb 19, 2021

Fix #10868: Handle semantic name in Java source code

@liufengyun liufengyun force-pushed the fix-10868 branch 3 times, most recently from 14f09b9 to b37f184 Compare February 19, 2021 17:36
@liufengyun liufengyun changed the title Fix #10868: add test Fix #10868: Handle semantic name in Java source code Feb 19, 2021
@liufengyun liufengyun requested a review from smarter February 22, 2021 08:03
Comment on lines 601 to 605
if !qual.symbol.is(JavaDefined) && tree.name.endsWith("$")
then
val nameOrig = tree.name.asSimpleName
val nameSemantic = nameOrig.slice(0, nameOrig.length - 1).moduleClassName
val tree2 = untpd.cpy.Select(tree)(qual, nameSemantic)
Copy link
Member

Choose a reason for hiding this comment

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

unmangleClassName in NameOps already has similar logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip 👍

@smarter smarter assigned liufengyun and unassigned smarter Feb 23, 2021
smarter
smarter previously approved these changes Feb 23, 2021
Comment on lines 601 to 602
if !qual.symbol.is(JavaDefined)
then
Copy link
Member

Choose a reason for hiding this comment

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

we usually put the then on the same line as the if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that looks better

@smarter smarter merged commit e886676 into scala:master Feb 24, 2021
@smarter smarter deleted the fix-10868 branch February 24, 2021 14:16
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

Mixed compileOrder error with scala 3.0.0-M3 but success with 2.13.4
3 participants