Skip to content

Need some way to get newMethod tpt (MethodType, PolyType, ByNameType) of existing DefDef #16266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
deusaquilus opened this issue Nov 1, 2022 · 1 comment · Fixed by #16454
Assignees
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API
Milestone

Comments

@deusaquilus
Copy link
Contributor

deusaquilus commented Nov 1, 2022

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)

@nicolasstucki
Copy link
Contributor

Fixed with Symbol.info in f1cf6e7

@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants