Closed
Description
The following code results in compilation error:
import scala.quoted._
import scala.tasty._
object scalatest {
// inline def assert(condition: => Boolean): Unit = // ok
// ~assertImpl('(condition), '(""))
inline def assert(condition: => Boolean): Unit = // error
~assertImpl('(condition), "".toExpr)
def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] =
'(())
}
Error message:
6 | inline def assert(condition: => Boolean): Unit = ~assertImpl('(condition), "".toExpr)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Malformed macro.
|
| Expected the ~ to be at the top of the RHS:
| inline def foo(inline x: X, ..., y: Y): Int = ~impl(x, ... '(y))
|
| * The contents of the splice must call a static method
| * All arguments must be quoted or inline