Skip to content

TASTY: no way to access variance of parameters of a TypeParamRef type constructor #16734

Closed
@neko-kai

Description

@neko-kai

This is a follow-up to #8520

As per @smarter's suggestion in #8520 (comment) there is now a method .typeMembers that can extract symbols for type parameters of a trait/class.

However, there's no exposed way to extract variance information of a type parameter, that is extract variance of parameters of F in trait K[F[+_, +_]]. @smarter describes a way to get this information in his post above:

(If I want the variance of the parameter of F itself, then I need to get the info of F which should be a TypeBounds whose upper-bound is an HKTypeLambda, once I get that I can finally call HKTypeLambda#declaredVariances on it.)

Right now I implemented the above procedure by accessing hidden methods TypeParamRef#underlying and HKTypeLambda#declaredVariances using Java reflection. (current usage)

But it would be great if Quotes interface exposed these methods non-reflectively, so that I could drop these workarounds. Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions