Remove default import of scala.Predef._ + new option ImportScalaPredef to reintroduce it.#180
Conversation
|
fixes #171 |
|
Hi @eed3si9n |
eed3si9n
left a comment
There was a problem hiding this comment.
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.Anybut 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.
Fixes #171
The
sbt-buildinfoplugin generates imports ofscala.Predef._andscala.Anythat are not necessary unless you use compiler option-Yno-importswhich the vast majority of projects don't. Furthermore, the first import:fails compilation with the Scala 3 compiler option
-source:futurebecause 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-importsand probably even fewer that also use-source:future. For backwards compatibility, the new optionSkipImportsprevents generation of the imports. Without using this new option, everything is as before.