タイプタグがタイプエイリアスで機能しないのはなぜですか。与えられた例
trait Foo
object Bar {
def apply[A](implicit tpe: reflect.runtime.universe.TypeTag[A]): Bar[A] = ???
}
trait Bar[A]
次のメソッド内でエイリアスを使用したいと思います。これは、A
約20回入力する必要があるためです。
def test {
type A = Foo
implicit val fooTpe = reflect.runtime.universe.typeOf[A] // no funciona
Bar[A] // no funciona
}
次の試み:
def test {
type A = Foo
implicit val fooTpe = reflect.runtime.universe.typeOf[Foo] // ok
Bar[A] // no funciona
}
そのため、エイリアスをまったく使用できないようです。