Skip to content

Phase inconsistency for quoted references #3898

Closed
@nicolasstucki

Description

@nicolasstucki

When inlining the following ff macro, the varargs args is lifted out into a val which breaks phase consistency as takes it out of a quote.

import scala.quoted._
object Macro {
  inline def ff(args: Any*): String = ~impl('(args))
  def impl(args: Expr[Seq[Any]]): Expr[String] = ""
}
object Test {
  def main(args: Array[String]): Unit = {
    val x = 5
    Macro.ff(x)
  }
}

When inlined the code is

/* inlined from Macro*/ 
  {
    val args: Any* = [x : Any]: Any*
    Macro.impl(<special-ops>.'[Seq[Any] @Repeated](args)).unary_~
  }

and interpreted as to heal some phase inconsistencies

/* inlined from Macro*/ 
  {
    val args: Any* = [x : Any]: Any*
    Macro.impl(<special-ops>.'[Seq[Any] @Repeated](args))
  }.unary_~

Tis fails due to the x wich should be ouside the unary_~ or inside the <special-ops>.'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions