jeudi 5 octobre 2023

How to find out type args of a superclass?

I have

trait Foo[T]
class Bar extends Foo[String]

If I do typeOf[Foo[String]].typeArgs, I get String back.

But typeOf[Bar].baseClasses.flatMap(_.typeArgs) is empty.

Is it impossible to find the actual complete super-type and a given type? (If it helps, I am actually writing a macro, so all the compile-time info should still be there ... though I don't think it actually matters, because I am only looking at types here, not actual objects) ...





Aucun commentaire:

Enregistrer un commentaire