-
Notifications
You must be signed in to change notification settings - Fork 90
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
Remove default import of scala.Predef._
+ new option ImportScalaPredef to reintroduce it.
#180
Conversation
fixes #171 |
Hi @eed3si9n |
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.
Awesome. I wonder if we should flip the default and make it generate import scala.Predef
under some options?
I had the same thought (that the default should be not to generate these imports). However, I was afraid to break somebody's build when they upgraded the But yes, instead of what I have done now, it could be:
Let me know, if you think that it is better to flip it around. |
If something fails at build-time, then I think it's ok (as opposed to runtime).
So yeah. Let's do it.
|
Ok, I'll update the pull request tomorrow. Regarding the name of the option: import scala.Predef._
import scala.Any but I think I can get rid of the In that case, I like your suggestion |
It looks like almost all types are fully qualified in the generated code so there is also the possibility that it would be possible to change the code a little so it will compile with and without |
Ok, there are SO many things missing if
I will leave all the currently, fully qualified types ( |
Added option `ImportScalaPredef` to include import of `scala.Predef`.
4370ebc
to
965a7d0
Compare
@eed3si9n I have now updated the PR. I have squashed all changes into one commit.
Let me hear if it makes sense. :) |
-source:future
.scala.Predef._
+ new option ImportScalaPredef to reintroduce it.
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.
LGTM
Fixes #171
The
sbt-buildinfo
plugin generates imports ofscala.Predef._
andscala.Any
that are not necessary unless you use compiler option-Yno-imports
which the vast majority of projects don't. Furthermore, the first import:fails compilation with the Scala 3 compiler option
-source:future
because the_
should be replaced by a*
in Scala 3 syntax.I see (at least) these three options for fixing the issue:
*
instead of_
for the generated import.In this PR, I chose to go for 3) for the reasons described above: few projects use
-Yno-imports
and probably even fewer that also use-source:future
. For backwards compatibility, the new optionSkipImports
prevents generation of the imports. Without using this new option, everything is as before.