Skip to content

unresolved symbol in REPL when referencing quoted type in another quote #9891

@bishabosha

Description

@bishabosha

Minimized code

The following example compiles with dotc 0.27.0-RC1, but crashes in the REPL

(it is part of the example taken from the docs for implementing type class derivation with macros)

import quoted._ import deriving.Mirror def derived[T: Type](using qctx: QuoteContext): Expr[Any] = { import qctx.tasty._ val ev: Expr[Mirror.Of[T]] = Expr.summon(using '[Mirror.Of[T]]).get '{null} }

Output [REPL crash] (click arrow to expand)

Starting dotty REPL... scala> import quoted._ | import deriving.Mirror | | def derived[T: Type](using qctx: QuoteContext): Expr[Any] = { | import qctx.tasty._ | val ev: Expr[Mirror.Of[T]] = Expr.summon(using '[Mirror.Of[T]]).get | '{null} | } Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: type T(line 3) when pickling rs$line$1	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:738)	at dotty.tools.dotc.quoted.PickledQuotes$.pickle(PickledQuotes.scala:168)	at dotty.tools.dotc.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:34)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickleAsTasty$1(ReifyQuotes.scala:173)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickledQuote(ReifyQuotes.scala:182)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformQuotation(ReifyQuotes.scala:139)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:114)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1262)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:121)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1268)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:121)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:104)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1367)	at scala.collection.immutable.List.mapConserve(List.scala:472)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1367)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1268)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:121)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1268)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:121)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1262)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:121)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1336)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:105)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1367)	at scala.collection.immutable.List.mapConserve(List.scala:472)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1367)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1365)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1282)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:92)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:136)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:100)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:112)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1345)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:105)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1367)	at scala.collection.immutable.List.mapConserve(List.scala:472)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1367)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1365)	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1352)	at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:105)	at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:85)	at dotty.tools.dotc.transform.TreeMapWithStages.op$proxy1$1(TreeMapWithStages.scala:148)	at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:150)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.op$proxy2$1(ReifyQuotes.scala:396)	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:398)	at dotty.tools.dotc.transform.ReifyQuotes$$anon$1.transform(ReifyQuotes.scala:92)	at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)	at dotty.tools.dotc.transform.ReifyQuotes.run(ReifyQuotes.scala:88)	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.Run.runPhases$4$$anonfun$4(Run.scala:180)	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:190)	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)	at dotty.tools.dotc.Run.compileUnits(Run.scala:147)	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:233)	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:196)	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:129)	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:132)	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:151)	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:132)	at dotty.tools.repl.Main$.main(Main.scala:6)	at dotty.tools.repl.Main.main(Main.scala) 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions