Skip to content

Error while compiling macro inline argument used in quote #4455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolasstucki opened this issue May 4, 2018 · 0 comments
Closed

Error while compiling macro inline argument used in quote #4455

nicolasstucki opened this issue May 4, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

import scala.quoted._
object Macros {
  inline def foo(inline i: Int): Int = ~bar('(i))
  def bar(x: Expr[Int]): Expr[Int] = ???
}
exception while typing Macros.bar(i$1) of class class dotty.tools.dotc.ast.Trees$Apply # 175
exception while typing {
  val i$1: Int = x$0.apply(0).asInstanceOf[Int]
  Macros.bar(i$1)
} of class class dotty.tools.dotc.ast.Trees$Block # 176
exception while typing def $anonfun$1(x$0: Seq[Any]): quoted.Expr[Int] = 
  {
    val i$1: Int = x$0.apply(0).asInstanceOf[Int]
    Macros.bar(i$1)
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 180
exception while typing {
  def $anonfun$1(x$0: Seq[Any]): quoted.Expr[Int] = 
    {
      val i$1: Int = x$0.apply(0).asInstanceOf[Int]
      Macros.bar(i$1)
    }
  closure($anonfun$1)
}

We should probably add a .toExpr to inlined references that are inside of a quote https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala#L549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant