You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phantom type are types for which values have no runtime use. For this
purose the phase PhantomErasure will remove all terms that derive from
PantomAny.
The latice bounded by PhantomAny and PhantomNothing is completely disjoint
of the runtime types (Any/Nothing). Therefore if PhantomNothing <: P <: PhantomAny
then Nothing <: P <: Any is false. Conversly if Nothing <: T <: Any then
PhantomNothing <: T <: PhantomAny is false.
PhantomErasure will remove:
* Parameters that are subtype of PhantomAny.
* Arguments that are subtype of PhantomAny.
* Calls to functions that return a value of subtype of PhantomAny.
* Value or method definitions that return a value of a subtype of PhantomAny.
Additional restrictions:
* In a curried function groups of parameters are either all Any or all PhantomAny.
* Expressions of phantom types cant be used in statement position.
* `var` and `lazy val` can not be phantom types.
* Mixing phantom types with types of `Any` using type bounds, `&` or `|` is not allowed.
0 commit comments