Skip to content

Error reifying reference to method #5144

Closed
@nicolasstucki

Description

@nicolasstucki
object Main {

  def eval1(x: scala.quoted.Expr[Int => Int]): Expr[Int] = ???

  def peval1(): scala.quoted.Expr[Unit] = '{
    def f(x: Int): Int = ~eval1('(f))
  }

}

fails with

Exception in thread "main" java.lang.IllegalArgumentException: Could not find proxy for val f$1: scala.quoted.Expr in List(val f$1, method $anonfun$1, method peval1, module class Main$, module class <empty>, module class <root>), encl = method $anonfun$2, owners = method $anonfun$2, method peval1, object Main, package <empty>, package <root>; enclosures = method $anonfun$2, package <empty>, package <root>
        at dotty.tools.dotc.transform.LambdaLift$Lifter.searchIn$1(LambdaLift.scala:386)
        at dotty.tools.dotc.transform.LambdaLift$Lifter.proxy(LambdaLift.scala:399)
        at dotty.tools.dotc.transform.LambdaLift$Lifter.proxyRef(LambdaLift.scala:417)
        at dotty.tools.dotc.transform.LambdaLift.transformIdent(LambdaLift.scala:531)
        ...

At reify quotes f is suspicioucly lifted to an Expr[(x: Int): Int]

As noted by @benoitknuchel in https://github.com/benoitknuchel/Staged-Tagless-Interpreters-in-Dotty/blob/master/simplestagedinterpreter/src/main/scala/Main.scala

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions