Skip to content

Unresolved symbol in quoted class with spliced field reference #7997

Closed
@nicolasstucki

Description

@nicolasstucki

minimized code

import scala.quoted._
def oops(using QuoteContext) = {
  val q = '{ class Foo { val x = 3; ${ val v = 'x; '{} }  }}
}
Compilation output
java.lang.AssertionError: assertion failed: unresolved symbols: class Foo(line 3) when pickling Foo.scala while compiling Foo.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: class Foo(line 3) when pickling Foo.scala
        at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:704)
        at dotty.tools.dotc.core.quoted.PickledQuotes$.pickle(PickledQuotes.scala:102)
        at dotty.tools.dotc.core.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:34)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickleAsTasty$1(ReifyQuotes.scala:236)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickledQuote(ReifyQuotes.scala:248)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformQuotation(ReifyQuotes.scala:196)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:93)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1251)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:117)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1257)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:117)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1320)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:101)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1347)
        at scala.collection.immutable.List.mapConserve(List.scala:444)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1347)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1345)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1271)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:105)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:97)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1347)
        at scala.collection.immutable.List.mapConserve(List.scala:444)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1347)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1345)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1271)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:105)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformWithCapturer(ReifyQuotes.scala:355)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.body$3(ReifyQuotes.scala:329)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.$anonfun$1(ReifyQuotes.scala:339)
        at dotty.tools.dotc.ast.tpd$.polyDefDef(tpd.scala:262)
        at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:221)
        at dotty.tools.dotc.ast.tpd$.Closure(tpd.scala:115)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.makeLambda(ReifyQuotes.scala:339)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.splitSplice(ReifyQuotes.scala:376)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformSplice(ReifyQuotes.scala:266)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:99)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:51)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:58)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:108)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:413)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1327)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:101)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:413)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1347)
        at scala.collection.immutable.List.mapConserve(List.scala:444)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1347)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1345)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1271)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:105)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.splitQuote(ReifyQuotes.scala:371)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformQuotation(ReifyQuotes.scala:191)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:93)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1251)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:117)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1257)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:117)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1320)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:101)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1347)
        at scala.collection.immutable.List.mapConserve(List.scala:444)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1347)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1345)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1271)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:105)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:97)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:51)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:58)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:108)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1327)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:101)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1347)
        at scala.collection.immutable.List.mapConserve(List.scala:444)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1347)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1345)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1333)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:101)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:76)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:126)
        at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transform(ReifyQuotes.scala:415)
        at dotty.tools.dotc.transform.ReifyQuotes$$anon$1.transform(ReifyQuotes.scala:93)
        at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
        at dotty.tools.dotc.transform.ReifyQuotes.run(ReifyQuotes.scala:89)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
        at scala.collection.immutable.List.map(List.scala:219)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
        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:177)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
        at dotty.tools.dotc.Run.compileSources(Run.scala:129)
        at dotty.tools.dotc.Run.compile(Run.scala:112)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
        at dotty.tools.dotc.Driver.process(Driver.scala:189)
        at dotty.tools.dotc.Driver.process(Driver.scala:158)
        at dotty.tools.dotc.Driver.process(Driver.scala:170)
        at dotty.tools.dotc.Driver.main(Driver.scala:197)
        at dotty.tools.dotc.Main.main(Main.scala)

expectation

Should compile

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions