Closed
Description
I am trying to make a copy of a method but I need to change its return-type, all of the arguments stay the same. I can't use DefDef.copy
because return-type is part of the symbol (as I saw in #7626) so instead I'm using DefDef.apply
(based on #8090) but I need to figure out what the tpt:MethodType | PolyType | ByNameType
is myself based on the paramss
etc... factoring in potential polymorphic type parameters. That's an awful lot of work just to copy a method! Is there some way to get the tpt
of an existing DefDef?
(Also, is there even a way to copy methods with given parameter clauses and parameters with default values? I don't see how to do that using the Symbol.newMethod
/ DefDef.apply
API)