As per http://stackoverflow.com/questions/11681631/macro-return-type-and-higher-order-functions:
Macro definition:
def test(s:String) = macro testImpl
def testImpl(c:Context)(s:c.Expr[String]):c.Expr[Any] = {
import c.universe._
val list = reify(List(1)).tree
val function = reify((x:Int) => x).tree
val res =
Apply(
Select(
list,
newTermName("map")),
List(function)
)
c.Expr(res)
}
Macro call:
val list:List[Int] = test("")
Error message:
[error] found : Any
[error] required: List[Int]
[error] val list:List[Int] = test("")
[error] ^