DefDef
/Lambda
takes continuation which assumes Tree
, not Term
#23038
Labels
DefDef
/Lambda
takes continuation which assumes Tree
, not Term
#23038
The API for both
DefDef
andLambda
inscala.quoted
take a function of the formList[List[Tree]] => Option[Term]
andList[Tree] => Term
, respectively. TheTree
s here are the parameters of the new function for use in the body. As such, I'm reasonably sure these are always justTerm
s (since they will be identifiers representing the parameters). This results in any use ofDefDef.apply
orLambda.apply
having to first cast theseTree
s into the more usefulTerm
by eitherasInstanceOf
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.The text was updated successfully, but these errors were encountered: