val cbfType =
appliedType(
typeOf[collection.generic.CanBuildFrom[_, _, _]].typeConstructor,
typeOf[List[_]].typeConstructor :: typeOf[String] :: typeOf[List[String]] :: Nil
)
println(cbfType)
val cbf = c.inferImplicitValue(cbfType)
println(cbf)
I am trying to infer an implicit CanBuildFrom
.
But the cbf
I got is empty tree
?
How can I get the implicit instance of CanBuildFrom in a scala macro?
您需要编写typeOf[List[_]]
而不是typeOf[List[_]].typeConstructor
: https : typeOf[List[_]].typeConstructor
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.