Skip to content

Crash while unpickling type quote #5247

Closed
@nicolasstucki

Description

@nicolasstucki
import scala.quoted._
object Test {
  def main(args: Array[String]): Unit = {
    implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make
    foo[Object].show
  }
  def foo[H : Type]: Expr[H] = {
    val t = '[H]
    '{ null.asInstanceOf[~t] }
  }
}

the compiler crashes while unpickling '[H] with

Caused by: scala.MatchError: 140 (of class java.lang.Integer)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthType$1(TreeUnpickler.scala:357)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readType(TreeUnpickler.scala:401)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1177)
	at dotty.tools.dotc.core.tasty.TreeUnpickler.unpickle(TreeUnpickler.scala:99)
	at dotty.tools.dotc.core.tasty.DottyUnpickler.computeRootTrees(DottyUnpickler.scala:61)
	at dotty.tools.dotc.ast.tpd$TreeProvider.rootTrees(tpd.scala:973)
	at dotty.tools.dotc.ast.tpd$TreeProvider.tree(tpd.scala:977)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickle(PickledQuotes.scala:113)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickleType(PickledQuotes.scala:76)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.quotedTypeToTree(PickledQuotes.scala:62)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readHole(TreeUnpickler.scala:1219)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthType$1(TreeUnpickler.scala:357)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readType(TreeUnpickler.scala:401)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1177)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$13(TreeUnpickler.scala:1056)
	at dotty.tools.dotc.core.tasty.TastyReader.until(TastyReader.scala:125)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1056)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1163)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1067)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1163)
	at dotty.tools.dotc.core.tasty.TreeUnpickler.unpickle(TreeUnpickler.scala:98)
	at dotty.tools.dotc.core.tasty.DottyUnpickler.computeRootTrees(DottyUnpickler.scala:61)
	at dotty.tools.dotc.ast.tpd$TreeProvider.rootTrees(tpd.scala:973)
	at dotty.tools.dotc.ast.tpd$TreeProvider.tree(tpd.scala:977)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickle(PickledQuotes.scala:113)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickleExpr(PickledQuotes.scala:70)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.quotedExprToTree(PickledQuotes.scala:44)
	at dotty.tools.dotc.quoted.QuoteCompiler$QuotedFrontend.runOn$$anonfun$1(QuoteCompiler.scala:53)
	...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions