scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

by name implicits results in compiler crash unresolved symbols: value $_lazy_implicit_$1

Open eejbyfeldt opened this issue 9 months ago • 0 comments

Compiler version

3.4.2 but also crashes with 3.5.0-RC1, 3.3.3 and 3.0.0, probably others as well but did not test more.

Minimized code

trait Generic[T] {
  type Repr
}

object Generic {
  type Aux[T, R] = Generic[T] { type Repr = R }

  inline given [T <: Product](
    using m: scala.deriving.Mirror.ProductOf[T]
  ): Generic.Aux[T, m.MirroredElemTypes] = ???
}

trait Delta[In] {
  type Out
}

object Delta {
  type Aux[In, Out0] = Delta[In] { type Out = Out0 }

  given [T](using deltaT: Delta[T]): Delta.Aux[Option[T], deltaT.Out] = ???

  given [H, T <: Tuple, HO](using deltaH: => Delta.Aux[H, HO]): Delta.Aux[H *: T, H] = ???

  given [F, G, O]( using gen: Generic.Aux[F, G], genDelta: Delta.Aux[G, O]): Delta.Aux[F, O] = ???
}

object Test {
  case class Bar(of: Option[Bar])

  summon[Delta[Bar]]
}

Output (click arrow to expand)

  unhandled exception while running pickler on /scala3_crash.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Yno-enrich-error-messages.

     while compiling: /scala3_crash.scala
        during phase: pickler
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.2
            settings: 

Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value $_lazy_implicit_$1 (line -1) #15419 when pickling /home/eejbyfeldt/dev/eejbyfeldt/scala_playground/scala3_crash.scala
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:872)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:136)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:194)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:194)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:354)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:360)
	at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:211)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:337)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:350)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:360)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:360)
	at dotty.tools.dotc.Run.compileSources(Run.scala:261)
	at dotty.tools.dotc.Run.compile(Run.scala:246)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
	at dotty.tools.dotc.Driver.process(Driver.scala:196)
	at dotty.tools.dotc.Driver.process(Driver.scala:164)
	at dotty.tools.dotc.Driver.process(Driver.scala:176)
	at dotty.tools.dotc.Driver.main(Driver.scala:206)
	at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
	at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
	at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)

eejbyfeldt avatar May 21 '24 19:05 eejbyfeldt