Skip to content

No way to list the type parameters from a quotes Symbol or TypeRepr #13947

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
cchantep opened this issue Nov 14, 2021 · 3 comments · Fixed by #14088
Closed

No way to list the type parameters from a quotes Symbol or TypeRepr #13947

cchantep opened this issue Nov 14, 2021 · 3 comments · Fixed by #14088
Assignees
Milestone

Comments

@cchantep
Copy link
Contributor

It's not possible in quotes to do something like:

def foo(s: Symbol): List[Symbol] = s.typeParams

In dotc it's possible to:

def foo(s: Symbol)(using Context): List[TypeSymbol] = s.denot.typeParams
@cchantep cchantep changed the title No way to list the type parameters from a quotes Symbol No way to list the type parameters from a quotes Symbol or TypeRepr Nov 14, 2021
cchantep added a commit to cchantep/dotty that referenced this issue Nov 14, 2021
cchantep added a commit to cchantep/dotty that referenced this issue Nov 14, 2021
@KacperFKorban KacperFKorban linked a pull request Nov 14, 2021 that will close this issue
cchantep added a commit to cchantep/dotty that referenced this issue Nov 15, 2021
cchantep added a commit to cchantep/dotty that referenced this issue Nov 15, 2021
@nicolasstucki
Copy link
Contributor

This is a bit trickier than it would seem. The assumption above is that there is a single type argument list. This is not necessarily true as some definitions can have multiple type parameter lists. For example

extension [A](a: A) def f[B](b: B): C = ???
// becomes internally
def f[A](a: A)[B](b: B): C

@nicolasstucki
Copy link
Contributor

Currently, the idea is to get the DefDef from the Symbol and then use one of the paramss, leadingTypeParams, trailingParamss, termParamss.

@cchantep
Copy link
Contributor Author

For me, the type arguments/parameters on the functions through extension don't correspond to the definition of resolving the type arguments/parameters.

nicolasstucki pushed a commit to dotty-staging/dotty that referenced this issue Dec 10, 2021
olsdavis pushed a commit to olsdavis/dotty that referenced this issue Apr 4, 2022
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants