trait
TypeTestsCasts
This transform normalizes type tests and type casts, also replacing type tests with singleton argument type with reference equality check Any remaining type tests - use the object methods $isInstanceOf and $asInstanceOf - have a reference type as receiver - can be translated directly to machine instructions
Unfortunately this phase ended up being not Y-checkable unless types are erased. A cast to an ConstantType(3) or x.type cannot be rewritten before erasure.