[IR] Unify MFVC bridge redirection, fix related bugs, support MFVC overriding functions with default parameters
#KT-1179
This commit is contained in:
committed by
Space Team
parent
384ed9cc9e
commit
bf5fa61ffb
@@ -0,0 +1,50 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
interface I<T: A> {
|
||||
fun f(x: T) = println(x)
|
||||
fun g(x: T = error("OK")) = println(x)
|
||||
fun T.f(x: T) = println(x)
|
||||
fun T.g(x: T = error("OK")) = println(x)
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class A(val x: Int, val y: Int): I<Nothing>
|
||||
|
||||
@JvmInline
|
||||
value class B(val x: Int, val y: Int): I<Nothing> {
|
||||
override fun f(x: Nothing) = println(this)
|
||||
override fun g(x: Nothing) = println(this)
|
||||
fun h(x: Nothing) = println(this)
|
||||
fun t(x: Nothing = error("OK")) = println(this)
|
||||
override fun Nothing.f(x: Nothing) = println(this@B)
|
||||
override fun Nothing.g(x: Nothing) = println(this@B)
|
||||
fun Nothing.h(x: Nothing) = println(this@B)
|
||||
fun Nothing.t(x: Nothing = error("OK")) = println(this@B)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
require(runCatching { A(1, 2).f(error("OK1")) }.exceptionOrNull()!!.message!! == "OK1")
|
||||
require(runCatching { B(1, 2).f(error("OK2")) }.exceptionOrNull()!!.message!! == "OK2")
|
||||
require(runCatching { A(1, 2).g(error("OK3")) }.exceptionOrNull()!!.message!! == "OK3")
|
||||
require(runCatching { B(1, 2).g(error("OK4")) }.exceptionOrNull()!!.message!! == "OK4")
|
||||
require(runCatching { A(1, 2).g() }.exceptionOrNull()!!.message!! == "OK")
|
||||
require(runCatching { B(1, 2).g() }.exceptionOrNull()!!.message!! == "OK")
|
||||
require(runCatching { B(1, 2).h(error("OK5")) }.exceptionOrNull()!!.message!! == "OK5")
|
||||
require(runCatching { B(1, 2).t(error("OK6")) }.exceptionOrNull()!!.message!! == "OK6")
|
||||
require(runCatching { B(1, 2).t() }.exceptionOrNull()!!.message!! == "OK")
|
||||
|
||||
require(runCatching { A(1, 2).run { error("OK1").f(error("OK")) } }.exceptionOrNull()!!.message!! == "OK1")
|
||||
require(runCatching { B(1, 2).run { error("OK2").f(error("OK")) } }.exceptionOrNull()!!.message!! == "OK2")
|
||||
require(runCatching { A(1, 2).run { error("OK3").g(error("OK")) } }.exceptionOrNull()!!.message!! == "OK3")
|
||||
require(runCatching { B(1, 2).run { error("OK4").g(error("OK")) } }.exceptionOrNull()!!.message!! == "OK4")
|
||||
require(runCatching { A(1, 2).run { error("OK5").g() } }.exceptionOrNull()!!.message!! == "OK5")
|
||||
require(runCatching { B(1, 2).run { error("OK6").g() } }.exceptionOrNull()!!.message!! == "OK6")
|
||||
require(runCatching { B(1, 2).run { error("OK7").h(error("OK")) } }.exceptionOrNull()!!.message!! == "OK7")
|
||||
require(runCatching { B(1, 2).run { error("OK8").t(error("OK")) } }.exceptionOrNull()!!.message!! == "OK8")
|
||||
require(runCatching { B(1, 2).run { error("OK9").t() } }.exceptionOrNull()!!.message!! == "OK9")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+1
-3
@@ -2,9 +2,7 @@
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// Depends on KT-57973
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
|
||||
+1
-3
@@ -2,9 +2,7 @@
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// Depends on KT-57973
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
|
||||
@@ -154,11 +154,11 @@ public final class GenericFakeOverrideMFVC {
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: double, p1: double): int
|
||||
public synthetic bridge method setP(p0: java.lang.Object): void
|
||||
public method setP-nuuzChU(@org.jetbrains.annotations.NotNull p0: DPoint): void
|
||||
public static method setP-nuuzChU(p0: double, p1: double, p2: double, p3: double): void
|
||||
public method setP-nuuzChU(p0: java.lang.Object): void
|
||||
public synthetic bridge method setP1(p0: java.lang.Object): void
|
||||
public method setP1-nuuzChU(@org.jetbrains.annotations.NotNull p0: DPoint): void
|
||||
public static method setP1-nuuzChU(p0: double, p1: double, p2: double, p3: double): void
|
||||
public method setP1-nuuzChU(p0: java.lang.Object): void
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
public static method toString-impl(p0: double, p1: double): java.lang.String
|
||||
public synthetic final method unbox-impl-field1(): double
|
||||
|
||||
@@ -154,11 +154,11 @@ public final class GenericFakeOverrideMFVC {
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: double, p1: double): int
|
||||
public synthetic bridge method setP(p0: java.lang.Object): void
|
||||
public method setP-nuuzChU(@org.jetbrains.annotations.NotNull p0: DPoint): void
|
||||
public static method setP-nuuzChU(p0: double, p1: double, p2: double, p3: double): void
|
||||
public method setP-nuuzChU(p0: java.lang.Object): void
|
||||
public synthetic bridge method setP1(p0: java.lang.Object): void
|
||||
public method setP1-nuuzChU(@org.jetbrains.annotations.NotNull p0: DPoint): void
|
||||
public static method setP1-nuuzChU(p0: double, p1: double, p2: double, p3: double): void
|
||||
public method setP1-nuuzChU(p0: java.lang.Object): void
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
public static method toString-impl(p0: double, p1: double): java.lang.String
|
||||
public synthetic final method unbox-impl-field1(): double
|
||||
|
||||
@@ -64,10 +64,10 @@ public final class GenericFakeOverrideMFVC {
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: java.lang.Object, p1: java.lang.Object): int
|
||||
public synthetic bridge method setP(p0: java.lang.Object): void
|
||||
public method setP-E-wHi0Q(@org.jetbrains.annotations.NotNull p0: XPoint): void
|
||||
public method setP-E-wHi0Q(p0: java.lang.Object): void
|
||||
public static method setP-E-wHi0Q(p0: java.lang.Object, p1: java.lang.Object, p2: java.lang.Object, p3: java.lang.Object): void
|
||||
public synthetic bridge method setP1(p0: java.lang.Object): void
|
||||
public method setP1-E-wHi0Q(@org.jetbrains.annotations.NotNull p0: XPoint): void
|
||||
public method setP1-E-wHi0Q(p0: java.lang.Object): void
|
||||
public static method setP1-E-wHi0Q(p0: java.lang.Object, p1: java.lang.Object, p2: java.lang.Object, p3: java.lang.Object): void
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
public static method toString-impl(p0: java.lang.Object, p1: java.lang.Object): java.lang.String
|
||||
|
||||
Reference in New Issue
Block a user