How can I resolve aliases given a Type
? I.e.
import reflect.runtime.universe._
type Alias[A] = Option[Option[A]]
val tpe = typeOf[Alias[_]]
val ExistentialType(quantified, underlying) = tpe
How do I get Option[Option[_$1]]
from underlying
(or from tpe
)? I know that typeSymbol
does resolve aliases, but it seems to lose the parameters in the process:
scala> val tT = typeOf[Alias[_]].typeSymbol
tT: reflect.runtime.universe.Symbol = class Option
scala> tT.asType.toType
res3: reflect.runtime.universe.Type = Option[A]
scala> tT.asType.typeParams
res4: List[reflect.runtime.universe.Symbol] = List(type A)
Aucun commentaire:
Enregistrer un commentaire