Revert "JVM_IR KT-50076 avoid CHECKCAST on moved dispatch receiver parameter"

This reverts commit 627d838343.
This commit is contained in:
Dmitry Petrov
2021-12-13 09:58:45 +03:00
committed by Space
parent df50a8141f
commit 6f148c594f
12 changed files with 10 additions and 191 deletions
@@ -1,58 +1,15 @@
// WITH_STDLIB
interface IFoo {
fun foo(): String = "K"
interface A {
fun f(x: String) = x
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcStr(val y: String) : IFoo {
override fun foo(): String = y + super<IFoo>.foo()
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcInt(val i: Int) : IFoo {
override fun foo(): String = "O" + super<IFoo>.foo()
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcLong(val l: Long) : IFoo {
override fun foo(): String = "O" + super<IFoo>.foo()
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcAny(val a: Any?) : IFoo {
override fun foo(): String = "O" + super<IFoo>.foo()
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcOverIc(val o: IcLong) : IFoo {
override fun foo(): String = "O" + super<IFoo>.foo()
}
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class IcOverSuperInterface(val x: IFoo) : IFoo {
override fun foo(): String = "O" + super<IFoo>.foo()
}
fun check(message: String, iFoo: IFoo) {
val actual = iFoo.foo()
if (actual != "OK")
throw Exception("$message: \"$actual\" != OK")
value class B(val y: String) : A {
override fun f(x: String) = super.f(x + y)
}
fun box(): String {
check("IcStr", IcStr("O"))
check("IcInt", IcInt(42))
check("IcLong", IcLong(42L))
check("IcAny", IcAny(""))
check("IcOverIc", IcOverIc(IcLong(42L)))
check("IcOverSuperInterface", IcOverSuperInterface(IcInt(42)))
return "OK"
return B("K").f("O")
}