Skip to content

Error unpickling complex type quotes #4591

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

Closed
nicolasstucki opened this issue May 28, 2018 · 0 comments
Closed

Error unpickling complex type quotes #4591

nicolasstucki opened this issue May 28, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

import dotty.tools.dotc.quoted.Toolbox._
import scala.quoted._

object Test {

  def foo[T: Type](init: Expr[T]): Expr[Unit] = '{
    var x = ~init
  }

  def main(args: Array[String]): Unit = {
    foo('(Option(9))).run
  }
}

crashes with

Exception in thread "main" scala.MatchError: AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Option),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Int))) (of class dotty.tools.dotc.core.Types$CachedAppliedType)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readPathTerm$1(TreeUnpickler.scala:936)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1099)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1105)
	at dotty.tools.dotc.core.tasty.TreeUnpickler.unpickleExpr(TreeUnpickler.scala:85)
	at dotty.tools.dotc.core.tasty.DottyUnpickler.unpickleExpr(DottyUnpickler.scala:50)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickle(PickledQuotes.scala:105)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickleType(PickledQuotes.scala:75)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.quotedTypeToTree(PickledQuotes.scala:61)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readHole(TreeUnpickler.scala:1158)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthType$1(TreeUnpickler.scala:314)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readType(TreeUnpickler.scala:386)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1119)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1093)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1105)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1116)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:767)

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 28, 2018
biboudis pushed a commit that referenced this issue May 29, 2018
Fix #4591: Unpickle type quotes with TreeReader.readTpt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant