Adaptation of an expression e
to an expected type PT
, applying the following
rewritings exhaustively as long as the type of e
is not a subtype of PT
.
Adaptation of an expression e
to an expected type PT
, applying the following
rewritings exhaustively as long as the type of e
is not a subtype of PT
.
e -> e() if e
appears not as the function part of an application
e -> box(e) if e
is of erased value type
e -> unbox(e, PT) otherwise, if PT
is an erased value type
e -> box(e) if e
is of primitive type and PT
is not a primitive type
e -> unbox(e, PT) if PT
is a primitive type and e
is not of primitive type
e -> cast(e, PT) otherwise
Generate a synthetic cast operation from tree.tpe to pt.
Generate a synthetic cast operation from tree.tpe to pt. Does not do any boxing/unboxing (this is handled upstream). Casts from and to ErasedValueType are special, see the explanation in ExtensionMethods#transform.