Closed martin-ockajak closed 4 months ago
This should have been fixed in https://github.com/lampepfl/dotty/pull/18848. Can you try the nightly or a recent release of Scala 3, such as 3.4.0-RC4.
Maybe the fix should be back-ported as well.
Related: #18407
@liufengyun I can confirm that the problem does not occur in the following compiler versions:
And indeed was this problem was previously detected by the community build in #18407 👍 and fixed in #18848.
It would be great to backport this fix to the upcoming 3.3.2 or 3.3.3 because as a library author I need to use the compiler version 3.3 (LTS) and safe initialization checking is a helpful feature which I would like to keep using. Thanks.
I'm not familiar with the process for back-porting. Could you please adivse? /cc: @Kordyjan
I'm not that familiar with -Ysafe-init
. I thought it was an unstable feature of the compiler and could only be used with the nightly releases.
If I was mistaken then it means that we should backport that fix to 3.3.3.
The compiler options documentation mentions that it's a private setting with limited support. If this means it should not be considered an official part of the compiler user interface then I can just stop using it and nothing needs to be done.
I asked people around and now I can confidently say that -Y
settings are indeed private and come without any guarantees.
There is ongoing discussion how should they be treated in LTS (supported, disabled, emitting warning or left as they are right now). I'm leaning on the side of supporting them. I'll update this comment when there will be a decision.
@Kordyjan Thanks for looking into it 😄
Given that https://github.com/scala/scala3/pull/20199 is merged, this can be closed.
Compiler version
The problem does not occur in the following compiler versions:
Compiler flags
-Ysafe-init
Minimized code
build.sbt
AB.scala
C.scala (test)
Output (click arrow to expand)
[Internal error] unexpected tree
Reproduce
Unpack the attached archive and run the tests:
safe-init-error.tar.gz
Note
Thanks for making a great compiler 😄 .