You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[error] C:\Users\szeiger\code\macrostuff\src\main\scala\com\novocode\macrostuff\MacroStuff.scala:69: macro implementation has wrong shape:
[error] required: (c: scala.reflect.makro.Context)(f: c.Expr[=>Unit]): c.Expr[() =>Unit]
[error] found : (c: scala.reflect.makro.Context)(f: c.Expr[() =>Unit]): c.Expr[() =>Unit]
[error] typemismatchfor parameter f: c.Expr[=>Unit] does not conform to c.Expr[() =>Unit]
[error] defpublish2(f: =>Unit) = macro publish2Impl
[error] ^
There is no way to write the expected type Expr[=> Unit]. Since call-by-name arguments are converted to Function0 internally, the type Expr[Function0[Unit]] should be accepted as a surrogate.
The text was updated successfully, but these errors were encountered:
@xeno-by said:
In 2.11, it is possible to define macro impl parameters as c.Tree's, not c.Expr[T]'s, and that makes it possible to write a macro impl that matches a macro def featuring a by-name parameter, e.g. something like this:
Using the following code:
You get the error:
There is no way to write the expected type Expr[=> Unit]. Since call-by-name arguments are converted to Function0 internally, the type Expr[Function0[Unit]] should be accepted as a surrogate.
The text was updated successfully, but these errors were encountered: