I am unable to find out how to programatically construct existential types in Scala macros.
For example, let's assume that I have a ClassSymbol
that represents a class C[T]
that has one type parameter.
Now, how do I programatically construct the type C[_ <: java.lang.Number]
?
In particular, I have no idea how to use the ExistentialType
constructor object. Looking at its signature:
def apply(quantified: List[Symbol], underlying: Type): ExistentialType
What do I pass as quantified
?
From what I understand, you need to create quantified symbols yourself, setting their signatures manually. Here's an abridged and adapted version of what
-Ymacro-debug-lite
printed when I compiledtypeOf[C[_ <: Number]]
. Maybe Jason or Paul know a shortcut that avoids creating symbols manually, but I'm not sure the one exists in the public API.