Skip to content

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

Closed
@bertlebee

Description

@bertlebee

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions