Description
The API for both DefDef
and Lambda
in scala.quoted
take a function of the form List[List[Tree]] => Option[Term]
and List[Tree] => Term
, respectively. The Tree
s here are the parameters of the new function for use in the body. As such, I'm reasonably sure these are always just Term
s (since they will be identifiers representing the parameters). This results in any use of DefDef.apply
or Lambda.apply
having to first cast these Tree
s into the more useful Term
by either asInstanceOf
or .asExpr.asTerm
, which is not pleasant (especially as it gives the aura of unsafety in the macro code).
If I'm not overlooking something here, it would be good to switch these to use Term
. Thankfully, these are (erased) parameters to the =>
type, which means this change would be binary-compatible, and via contravariance, existing code passing a ...[Tree] => ...
function will continue to type check.