Skip to content

REPL crashes on raw type with AssertionError: unresolved symbols: type _ #10410

Closed
@mbloms

Description

@mbloms

Minimized code

object Main:
  def toRaw[T](arr: Array[T]) = arr match {case arr: Array[?] => arr}
  def main(argv: Array[String]) = println(toRaw(argv))

Output (click arrow to expand)

This compiles fine and runs without issues:

$ scala3 Main This is fine
[Ljava.lang.String;@74650e52

However, calling toRaw from the REPL crashes:

$ scala3
Starting scala3 REPL...
scala> :l Main.scala
// defined object Main


scala> Main.toRaw(Array("Oh","no!"))
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: type _(line 1) when pickling rs$line$2
        at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:765)
        at dotty.tools.dotc.transform.Pickler.run$$anonfun$3$$anonfun$2(Pickler.scala:69)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.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:105)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.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:105)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:296)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:297)
        at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:110)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$5(Run.scala:195)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:210)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:152)
        at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:151)
        at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:161)
        at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:234)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:197)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:130)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:133)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:152)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:133)
        at dotty.tools.repl.Main$.main(Main.scala:6)
        at dotty.tools.repl.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions