-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Always run the compiler with a bootstrapped dotty-library #4833
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
Conversation
609d949
to
f2f2da6
Compare
) | ||
|
||
lazy val bootstrapedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq( | ||
packageAll := { | ||
packageAll.in(`dotty-compiler`).value ++ Seq( | ||
"dotty-compiler" -> packageBin.in(Compile).value.getAbsolutePath, | ||
"dotty-library" -> packageBin.in(`dotty-library-bootstrapped`, Compile).value.getAbsolutePath | ||
"dotty-compiler" -> packageBin.in(Compile).value.getAbsolutePath |
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.
Why is the library not packaged in this case?
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.
It is, note that we call packageAll.in(
dotty-compiler).value
a line above, which ends up getting the map from the non-bootstrapped version.
|
||
oldOptions.updated(i + 1, s"$sbtIo:$zincApiInfo:$oldValue") | ||
} | ||
) |
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.
Is there any way to add a test for this?
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.
If this wasn't correct, compilation would crash with a message saying we're trying to unpickle Scala 2 symbols from a JAR which is not on the whitelist
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.
Otherwise LGTM
The non-bootstrapped dotty-library may not be binary compatible with the compiler, this hasn't affected us so far because the non-bootstrapped dotty-library has always been compiled with Scala 2, but in the future it will be compiled by an old version of Dotty itself. To enforce this, I added a new flag -Yscala2-unpickler and set it so that scala-library is the only jar from which we're allowed to unpickle Scala 2 symbols in both the build and the tests.
The tests that import things defined in the dotty-compiler jar should only be run with a bootstrapped compiler.
Previously they were in dotty-compiler, which means that running `-Ycheck:reentrant` on a non-bootstrapped compiler would try to load symbols from the non-bootstrapped compiler itself.
`lazyValsSepComp` was dropped in c9f1754 without motivation. After readding it, `dotty-compiler-bootstrapped/testCompilation lazyValsSep` didn't find it; adding the forgotten `checkCompile` call fixed this as well.
`lazyValsSepComp` was dropped in c9f1754 without motivation. After readding it, `dotty-compiler-bootstrapped/testCompilation lazyValsSep` didn't find it; adding the forgotten `checkCompile` call fixed this as well.
The non-bootstrapped dotty-library may not be binary compatible with the
compiler, this hasn't affected us so far because the non-bootstrapped
dotty-library has always been compiled with Scala 2, but in the future
it will be compiled by an old version of Dotty itself.
To enforce this, I added a new flag -Yscala2-unpickler and set it so
that scala-library is the only jar from which we're allowed to unpickle
Scala 2 symbols in both the build and the tests.