KT-53465, KT-53677 Get rid of unnecessary checkcasts to array of reified type

This commit is contained in:
Pavel Mikhailovskii
2022-09-06 11:12:42 +02:00
committed by teamcity
parent d8522a8967
commit a75d5ba4cf
17 changed files with 213 additions and 1 deletions
@@ -2,8 +2,13 @@ abstract class Base {
private fun test(): String = "OK"
fun test(d: Derived): String = (d as Base).test()
fun test(d: Array<out Derived>) = (d as Array<out Base>)[0].test()
}
class Derived : Base()
fun box(): String = Derived().test(Derived())
fun box(): String {
Derived().test(arrayOf(Derived()))
return Derived().test(Derived())
}