Skip to content

Fix #7312: Choose root imports based on the source file #9394

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 1 commit into from
Aug 10, 2020

Conversation

TheElectronWill
Copy link
Contributor

@TheElectronWill TheElectronWill commented Jul 20, 2020

Use different root imports for java and scala files, so that (for instance) Long means java.lang.Long when parsing java files (unless scala.Long is imported, of course).
This also paves the way for -Yimports.

@TheElectronWill TheElectronWill linked an issue Jul 20, 2020 that may be closed by this pull request
@TheElectronWill TheElectronWill marked this pull request as draft July 20, 2020 12:25
@TheElectronWill TheElectronWill force-pushed the fix/7312 branch 5 times, most recently from d3e1ae6 to 7e05e1e Compare July 21, 2020 17:12
@TheElectronWill TheElectronWill marked this pull request as ready for review July 21, 2020 18:57
@smarter smarter requested a review from odersky July 21, 2020 19:47
Instead of setting the scala root imports in the rootContext,
set them later and choose the right imports depending on the language (java or scala).
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Very nicely done!

@odersky odersky merged commit 7735c04 into scala:master Aug 10, 2020
@TheElectronWill TheElectronWill deleted the fix/7312 branch August 10, 2020 14:07
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.

Do not autoimport scala.* when parsing .java files
2 participants