Skip to content

Pickling error with quoted path dependent types #7323

Closed
@anatoliykmetyuk

Description

@anatoliykmetyuk
trait Foo { type X }
def f[T](given scala.quoted.Type[T]) = ???
def g(m: Foo) = f[m.X]

Says:

Crash
exception occurred while compiling ../pg/i1.scala
java.lang.AssertionError: assertion failed: unresolved symbols: value m(line 2) when pickling ../pg/i1.scala while compiling ../pg/i1.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value m(line 2) when pickling ../pg/i1.scala
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:697)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.pickle(PickledQuotes.scala:101)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:33)
	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickleAsTasty$1(ReifyQuotes.scala:236)
	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.pickledQuote(ReifyQuotes.scala:244)
	at dotty.tools.dotc.transform.ReifyQuotes$QuoteReifier.transformQuotation(ReifyQuotes.scala:194)
	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$$anonfun$2(Trees.scala:1352)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1352)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1262)
	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.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:1332)
	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:1352)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1352)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1350)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1338)
	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:159)
	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:169)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
	at dotty.tools.dotc.Run.compileSources(Run.scala:121)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:178)
	at dotty.tools.dotc.Driver.process(Driver.scala:147)
	at dotty.tools.dotc.Driver.process(Driver.scala:159)
	at dotty.tools.dotc.Driver.main(Driver.scala:186)
	at dotty.tools.dotc.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1

The following works:

trait Foo { type X }
def f[T](given scala.quoted.Type[T]) = ???
def g(m: Foo)(given scala.quoted.Type[m.X]) = f[m.X]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions