Skip to content

Quoted types fail unpickling #3823

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 Jan 13, 2018 · 0 comments
Closed

Quoted types fail unpickling #3823

nicolasstucki opened this issue Jan 13, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Jan 13, 2018

The following code fails when running the unpickling the quote inside the show

import dotty.tools.dotc.quoted.Runners._
import scala.quoted._
object Test {
  def main(args: Array[String]): Unit = {
    def f[T](x: Expr[T])(t: Type[T]) = '{//'
      val z: t.unary_~ = ~x
    }
    println(f('(2))('[Int]).show)
  }
}

It fails with

Caused by: scala.MatchError: 255 (of class java.lang.Integer)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthType$1(TreeUnpickler.scala:231)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readType(TreeUnpickler.scala:361)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1057)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:690)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:635)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedStat(TreeUnpickler.scala:813)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$readIndexedStats$1(TreeUnpickler.scala:851)
	at dotty.tools.dotc.core.tasty.TastyReader.until(TastyReader.scala:125)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedStats(TreeUnpickler.scala:851)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readStats(TreeUnpickler.scala:855)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readBlock$1(TreeUnpickler.scala:939)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:962)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1047)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$readNewDef$4(TreeUnpickler.scala:656)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$LazyReader.complete(TreeUnpickler.scala:1119)
	at dotty.tools.dotc.ast.Trees$WithLazyField.forceIfLazy(Trees.scala:800)
	at dotty.tools.dotc.ast.Trees$WithLazyField.forceIfLazy$(Trees.scala:798)
	at dotty.tools.dotc.ast.Trees$ValDef.forceIfLazy(Trees.scala:656)
	at dotty.tools.dotc.ast.Trees$ValOrDefDef.rhs(Trees.scala:346)
	at dotty.tools.dotc.ast.Trees$ValOrDefDef.rhs$(Trees.scala:346)
	at dotty.tools.dotc.ast.Trees$ValDef.rhs(Trees.scala:656)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickleQuote(PickledQuotes.scala:45)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.quotedToTree(PickledQuotes.scala:35)
	at dotty.tools.dotc.quoted.ExprCompiler$ExprFrontend.$anonfun$runOn$1(ExprCompiler.scala:61)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.quoted.ExprCompiler$ExprFrontend.runOn(ExprCompiler.scala:57)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:125)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:47)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:123)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:121)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:121)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:141)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:88)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:107)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:99)
	at dotty.tools.dotc.quoted.ExprCompiler$ExprRun.compileExpr(ExprCompiler.scala:91)
	at dotty.tools.dotc.quoted.QuoteDriver.show(QuoteDriver.scala:42)
	at dotty.tools.dotc.quoted.Runners$$anon$1.show(Runners.scala:27)
	at scala.quoted.Expr.show(Expr.scala:8)
...
@nicolasstucki nicolasstucki self-assigned this Jan 14, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 14, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 14, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 14, 2018
nicolasstucki added a commit that referenced this issue Jan 17, 2018
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