Closed
Description
Compiler version
3.2.0-RC1-bin-20220607-76a0b29-NIGHTLY
Minimized code
//> using scala "3.2.0-RC1-bin-20220607-76a0b29-NIGHTLY"
import scala.quoted.*
class Macro:
inline def foo = ${ Macro.fooImpl }
object Macro:
private def fooImpl(using Quotes) = '{}
Output
[error] MalformedMacro.scala:6:23: Malformed macro.
[error]
[error] Expected the splice ${...} to contain a single call to a static method.
[error] inline def foo = ${ Macro.fooImpl }
[error]
Expectation
This seems wrong to me although I'm not sure what the correct behaviour should be as I see two options:
- Fix the error message (currently it doesn't say that a macro implementation cannot be private)
- Make this compile
Note that if the inline def is inside the object, everything compiles successfully:
import scala.quoted.*
object Macro:
inline def foo = ${ Macro.fooImpl }
private def fooImpl(using Quotes) = '{}