Skip to content

Wrong owner after reify quotes #5152

Closed
Closed
@nicolasstucki

Description

@nicolasstucki
import scala.quoted._

object Test {
  implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make

  def eval1(ff: Expr[Int => Int]): Expr[Int => Int] = '(identity)

  def peval1(): Expr[Unit] = '{
    lazy val f: Int => Int = ~eval1('((y: Int) => f(y)))
  }

  def main(args: Array[String]): Unit = {
    val p = peval1()
    println(p.show)
  }
}

fails with

Exception in thread "main" java.lang.AssertionError: assertion failed: bad owner; method $anonfun$2 has owner method peval1, expected was method $anonfun$1
owner chain = method $anonfun$2, method peval1, object Test, package <empty>, package <root>, ctxOwners = method $anonfun$1, method $anonfun$1, method $anonfun$1, method $anonfun$1, method $anonfun$1, method $anonfun$1, method peval1, method peval1, method peval1, method peval1, method peval1, object Test, object Test, object Test, package <empty>, package <empty>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, <none>, <none>, <none>, <none>
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.transform.TreeChecker$Checker.checkOwner(TreeChecker.scala:372)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedStats$1(TreeChecker.scala:442)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedStats$1$adapted(TreeChecker.scala:441)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions