Skip to content

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

Merged
merged 5 commits into from
Jul 27, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Jul 24, 2018

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.

@smarter smarter requested a review from allanrenucci July 24, 2018 16:37
@smarter smarter force-pushed the build-stuff branch 8 times, most recently from 609d949 to f2f2da6 Compare July 26, 2018 12:34
@smarter smarter requested review from nicolasstucki and removed request for allanrenucci July 26, 2018 13:50
)

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
Copy link
Contributor

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?

Copy link
Member Author

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")
}
)
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

smarter added 5 commits July 27, 2018 00:31
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.
@nicolasstucki nicolasstucki merged commit 946ba3f into scala:master Jul 27, 2018
@allanrenucci allanrenucci deleted the build-stuff branch July 27, 2018 09:17
Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request Jul 29, 2018
`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.
Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request Jul 29, 2018
`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.
Blaisorblade added a commit that referenced this pull request Jul 29, 2018
* Reenable tests disabled/dropped in #4833

`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.

* Update comment
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.

3 participants