Skip to content
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

-Ysafe-init crashes instead of reporting indirect initialization error #16438

Closed
robmwalsh opened this issue Nov 30, 2022 · 1 comment · Fixed by #16448
Closed

-Ysafe-init crashes instead of reporting indirect initialization error #16438

robmwalsh opened this issue Nov 30, 2022 · 1 comment · Fixed by #16448

Comments

@robmwalsh
Copy link

Compiler version

If you're not sure what version you're using, run print scalaVersion from sbt
(if you're running scalac manually, use scalac -version instead).

3.2.1

Minimized code

https://scastie.scala-lang.org/RfKNWVLgTtaa2M55IlyJ8g <--- crashes (see output below
https://scastie.scala-lang.org/QtU8dx5WS1Cv9AJkBFlYlQ <--- works as expected (-Ysafe-init disabled in build settings)

parameterized trait ATrait is indirectly implemented,
needs to be implemented directly so that arguments can be passed

Output (click arrow to expand)

``` java.lang.AssertionError: assertion failed: arguments = 0, params = 2 at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) at dotty.tools.dotc.transform.init.Semantic$Env$.apply(Semantic.scala:175) at dotty.tools.dotc.transform.init.Semantic$.given_Env$lzyINIT2$1(Semantic.scala:758) at dotty.tools.dotc.transform.init.Semantic$.given_Env$2(Semantic.scala:758) at dotty.tools.dotc.transform.init.Semantic$.$anonfun$15(Semantic.scala:761) at dotty.tools.dotc.transform.init.Semantic$.callConstructor(Semantic.scala:761) at dotty.tools.dotc.transform.init.Semantic$.superCall$1$$anonfun$1(Semantic.scala:1434) at dotty.tools.dotc.transform.init.Semantic$.init$$anonfun$3(Semantic.scala:1496) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563) at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561) at scala.collection.AbstractIterable.foreach(Iterable.scala:926) at dotty.tools.dotc.transform.init.Semantic$.init(Semantic.scala:1496) at dotty.tools.dotc.transform.init.Semantic$.cases(Semantic.scala:1299) at dotty.tools.dotc.transform.init.Semantic$.eval$$anonfun$1(Semantic.scala:1110) at dotty.tools.dotc.transform.init.Semantic$Cache$Cache.assume(Semantic.scala:311) ... ```
@robmwalsh robmwalsh added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 30, 2022
@liufengyun liufengyun self-assigned this Nov 30, 2022
@liufengyun liufengyun added area:initialization and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 30, 2022
liufengyun added a commit to dotty-staging/dotty that referenced this issue Nov 30, 2022
liufengyun added a commit to dotty-staging/dotty that referenced this issue Nov 30, 2022
liufengyun added a commit to dotty-staging/dotty that referenced this issue Nov 30, 2022
anatoliykmetyuk added a commit that referenced this issue Dec 6, 2022
…#16448)

Fix #16438: Supply dummy args for erroneous parent call in init check
@robmwalsh
Copy link
Author

Thanks for the quick fix :)

little-inferno pushed a commit to little-inferno/dotty that referenced this issue Jan 25, 2023
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants