Foo[X] forSome {type X}. : , T , Foo [T]
T - . .
-Xprint:all
jatinpuri@jatin:~/Desktop$ scalac -Xprint:all T.scala
[[syntax trees at end of parser]]
package <empty> {
...
abstract trait Foo[A] extends scala.AnyRef {
val value: A;
def perform(v: A): Unit
};
val n: Foo[_$1] forSome {
<synthetic> type _$1
} = null;
n.perform(n.value)
}
}
n.value _$1. n.perform() . . :
scala> trait Foo[A] {
| val value: A
| def perform(v: A): Unit
| type i = A
| }
defined trait Foo
scala> type I = Foo[X] forSome {type X}
defined type alias I
scala> val n : I = null;
n: I = null
scala> n.value:(I#i)
<console>:16: error: type mismatch;
found : n.value.type (with underlying type X)
required: X
n.value:(I#i)
I # X. n.value -