-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
scala/scala
#8880Labels
Milestone
Description
2.13.1
scala> import scala.language.experimental.macros
import scala.language.experimental.macros
scala> import scala.reflect.macros.blackbox.Context
import scala.reflect.macros.blackbox.Context
scala> def fooMacro(c: Context): c.Tree = {import c.universe._; q"42"}
fooMacro: (c: scala.reflect.macros.whitebox.Context)c.Tree
scala> def foo: Int = macro fooMacro
defined term macro foo: Int
scala> foo
res3: Int = 42
2.13.2-bin-8ee21e7
scala> def foo: Int = macro fooMacro
^
error: macro implementation reference has wrong shape. required:
macro [<static object>].<method name>[[<type args>]] or
macro [<macro bundle>].<method name>[[<type args>]]
note: macro definition is not supported in the REPL when using -Yrepl-classbased.
2.13.2-bin-bc1cad4
scala> def foo: Int = macro fooMacro ^
error: macro is now a reserved word; usage as an identifier is disallowed