b821b26cfe
In case the cast value is used as a receiver to a private method call, the cast is actually necessary, see KT-48927. Also, this optimization has backfired once already (see kt48659_identityEqualsWithCastToAny.kt). It seems that the best way to optimize these casts is not to generate them in the first place, and/or use bytecode postprocessing. Apparently the only kind of casts which need to be eliminated are those which occur on an inline class to its supertype. Otherwise the unsafe-coerce intrinsic is inserted at the incorrect place, and several tests fail (uncastInlineClassToAnyAndBack.kt, genericOverride.kt, classGenericOverride.kt). #KT-48927 Fixed