Skip to content

In splice reference to generic type at level 1 #14337

Closed
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.1.1

Minimized code

import scala.quoted.*

def foo(using Quotes): Expr[Int] = '{
  def f[T](x: T): T = ${ bar('x) }
  f[Int](1)
}

def bar[T: Type](x: Expr[T]): Expr[T] = x

Output (click arrow to expand)

4 |  def f[T](x: T): T = ${ bar('x) }
  |        ^
  |        pickling reference to as yet undefined T with symbol type T
exception occurred while compiling Foo.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: type T (line 3) #13985 when pickling Foo.scala
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:774)
        at dotty.tools.dotc.quoted.PickledQuotes$.pickle(PickledQuotes.scala:162)
        at dotty.tools.dotc.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:36)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.pickleAsTasty$1(PickleQuotes.scala:221)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.pickledQuote(PickleQuotes.scala:296)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transformQuotation(PickleQuotes.scala:141)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:118)
java.lang.AssertionError: assertion failed: unresolved symbols: type T (line 3) #13985 when pickling Foo.scala while compiling Foo.scala
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1493)
        at scala.collection.immutable.List.mapConserve(List.scala:472)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1493)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1389)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        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.Trees$Instance$TreeMap.transform(Trees.scala:1403)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:95)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:142)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transformWithCapturer(PickleQuotes.scala:412)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.body$8(PickleQuotes.scala:393)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.makeLambda$$anonfun$1(PickleQuotes.scala:403)
        at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:286)
        at dotty.tools.dotc.ast.tpd$.Closure(tpd.scala:121)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.makeLambda(PickleQuotes.scala:403)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.splitSplice(PickleQuotes.scala:433)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transformSplice(PickleQuotes.scala:315)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:129)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:513)
        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.Trees$Instance$TreeMap.transform(Trees.scala:1403)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:95)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:142)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.splitQuote(PickleQuotes.scala:428)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transformQuotation(PickleQuotes.scala:136)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:118)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1383)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1389)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:103)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        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:111)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1466)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        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.Trees$Instance$TreeMap.transform(Trees.scala:1477)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
        at dotty.tools.dotc.transform.TreeMapWithStages.mapOverTree$1(TreeMapWithStages.scala:89)
        at dotty.tools.dotc.transform.TreeMapWithStages.transform(TreeMapWithStages.scala:154)
        at dotty.tools.dotc.transform.PickleQuotes$QuoteReifier.transform(PickleQuotes.scala:515)
        at dotty.tools.dotc.transform.PickleQuotes$$anon$1.transform(PickleQuotes.scala:94)
        at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
        at dotty.tools.dotc.transform.PickleQuotes.run(PickleQuotes.scala:90)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:270)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:287)
        at dotty.tools.dotc.Run.compileSources(Run.scala:220)
        at dotty.tools.dotc.Run.compile(Run.scala:204)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
        at dotty.tools.dotc.Driver.process(Driver.scala:199)
        at dotty.tools.dotc.Driver.process(Driver.scala:167)
        at dotty.tools.dotc.Driver.process(Driver.scala:179)
        at dotty.tools.dotc.Driver.main(Driver.scala:209)
        at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions