-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add -Yimports compiler flag #16218
Add -Yimports compiler flag #16218
Conversation
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.
Also, we should stick to how Scala 2 calls it, ie. -Yimports
I changed the name because it's really not clear how class Foo(myImports: List[String]) {
def noImports(): Foo = ???
def imports(packages: List[String]): Foo = ???
} What would you expect |
Hmm, if I'm reading the Scala 2 code right, |
Apologies, it appears that the other import flags mutate the |
Yeah, we should match the behaviour, whatever it is. Even if we don't like it any more, changing it would create more confusion so should only be done for a very good reason. |
I respectfully disagree -- it's not confusing when an old flag goes away and a new one with different behavior appears. But as it so happens, I'm mostly interested in the version where you would pair it with |
Okay, I made the changes. I left the move over to comment-based CLI args as a separate commit. |
FWIW, scala 2 Ideally it would be There is precedent for renaming a compiler option but keeping the old name as an alias. |
I'm happy with whatever will get approved! |
Friendly bump on this PR? |
Coincidentally ended up spending a long detour on imports in the REPL (#16389), which sets me up to be much better informed on imports. I'm reviewing this next. Sorry for the long delay 😞 |
This definitely does not qualify as a long delay in this repository. |
Matching Scala 2 behaviour.
And add its tests.
Fixes lampepfl/dotty-feature-requests#138. I was always unclear on the interaction between
-Yimports
and-Yno-imports
-- are they additive or redundant -- so I made the name of the flag-Yadditional-imports
so that its semantics are very clear.EDIT: Okay, I kept the original (confusing IMHO) behavior of
-Yimports
from Scala 2.I think this might be possibly controversial because it is a flag that technically affects typechecking, but I still think it would be quite handy to have.