Dealiasing Types in Scala reflection -
how can resolve aliases given type? i.e.
import reflect.runtime.universe._ type alias[a] = option[option[a]] val tpe = typeof[alias[_]] val existentialtype(quantified, underlying) = tpe how option[option[_$1]] underlying (or tpe)? know typesymbol resolve aliases, seems lose parameters in 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)
the method turns out called normalize in 2.10 (deprecated , dealias added in 2.11). don't know how managed miss during first search.
Comments
Post a Comment