dimanche 30 octobre 2016

The AnnotatedType seems not work with ExistentialType in the scala runtime reflection

package noddle.test

object Entice with App {
  import scala.reflect.runtime.universe
  import scala.reflect.runtime.universe._

  val mir = universe.runtimeMirror(getClass.getClassLoader)
  val bootModule = mir.staticModule("noddle.test.Entice")

  def normal(x: (List[T] forSome { type T }) @SerialVersionUID(123456) with Int {def y: Int} ) = ???
  println(bootModule.info.member(TermName("normal")).info.paramLists.head.head.info.asInstanceOf[RefinedType].parents.head.getClass)

}

The output is class scala.reflect.internal.Types$ExistentialType, But If i change the normal method like this:

def normal(x: (List[Int] {def noway: String}) @SerialVersionUID(123456) with Int {def y: Int}) = ???

The output is class scala.reflect.internal.Types$AnnotatedType.

I can't understand why the output is ExistentialType in the fisrt code snippet, who can tell why?





Aucun commentaire:

Enregistrer un commentaire