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
-opt:l:inline breaks incremental compilation #4125
-opt:l:inline breaks incremental compilation #4125
Comments
Duplicate of sbt/zinc#227? Alternatively could you provide, please, a minimal-but-complete reproduction? For instance sbt version, scala version, scala options, the test, etc. Following our ISSUE_TEMPLATE, ideally 😀. |
That one looks a particular side-effect of "does not track dependencies introduced by inlining" related with singleton types and final vals being always inlined by the type checker. This is something wider: you simply cannot trust the incremental compiler at all when using the 2.12 optimizer.
There you go, not just that but a dedicated repo: |
Copying here the relevant portion of the link above; see ohnosequences/sbt4125 for more stepsOpen a shell and git checkout "x=1" Now run git checkout "x=2" Take a look at the test passing, and the definitions of ProblemIncremental compilation when used together with the optimizer generates incorrect bytecode: modifications in methods/vals are not propagated to wherever they are being inlined. ExpectationThe incremental compiler should not ever generate incorrect bytecode. Versionsbt |
@eparejatobes Thanks for the report and reproduction. |
I wasn't able to follow the instruction exactly:
but I got the gist of what's going on from manually changing: @inline
def x: Int = 1 to @inline
def x: Int = 2 |
My fault, forgot to push the tags; it should work now.
yes, that's it. I can understand that fixing this would involve considerable work in zinc; I think then that there should be a way (however hackish) of disabling incremental compilation. Note that (as this example shows) I could perfectly publish bytecode wildly different from what the source should generate. |
It can't be too difficult to invalidate everything whenever the flag is present, and show a warning saying "oh snap. you have inline flag on. we can't handle this." |
I've reported also to sbt/zinc#537 |
Given
changes in
x
above after a successful compilation will not propagate toz
; if we makedef x = 3
then we will havez == 3
, not4
.I'm aware of the 2.12 Release Notes stating that
but IMHO mentioning it upfront doesn't make it less of a bug: either incremental compilation works correctly when inlining is enabled (which it should), or we are given a way of disabling it (as it was already asked for in #1282).
The text was updated successfully, but these errors were encountered: