Is the ability to synthesize a polymorphic function lost in 3.4.0? #19832
-
I'm generating a polymorphic function by a macro. I cannot use a quote, because the number and kinds of type parameters are only known at macro expansion time. In 3.3.2, I use a refinement of val parents =
List(TypeTree.of[Object], TypeTree.of[PolyFunction])
val clsSym =
Symbol.newClass(
Symbol.spliceOwner,
name = "$anon",
parents = parents.map(_.tpe),
decls = cls => List(
Symbol.newMethod(
cls,
"apply",
// helper to create the type of the apply method
polyFunApplyMethodType(tParamNames, tParamBounds, vParamNames, vParamTypes, returnType),
),
),
selfType = None,
) However, in 3.4.0 this stopped working: it gives the following error:
Does that mean that the ability to synthesize a polymorphic function is lost, or is there another way? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
It should be allowed. We tightened the checks in the compiler to not allow users to write |
Beta Was this translation helpful? Give feedback.
-
It should be possible to directly use a |
Beta Was this translation helpful? Give feedback.
It should be possible to directly use a
Closure
node, these days. Like for regular functions.