Files
kotlin-fork/compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt
T
vladislav.grechko 457837a255 Fix function invocation mangling rule
Mangle invocations of functions with value classes in signature which
override (directly or indirectly) a method declared in Kotlin code.
Otherwise, NoSuchMethodError is being thrown.

^KT-55945: Fixed
2023-06-15 09:34:21 +00:00

37 lines
679 B
Kotlin
Vendored

// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
// LANGUAGE: +ValueClasses
// FILE: Point.kt
@JvmInline
value class Point(val x: Int, val y: Int)
// FILE: KotlinInterface.kt
public interface KotlinInterface {
fun foo(x: Point): Int
}
// FILE: JavaInterface.java
public interface JavaInterface {
int foo(Point x);
}
// FILE: JavaInterfaceChildOfKotlin.java
public interface JavaInterfaceChildOfKotlin extends KotlinInterface {}
// FILE: KotlinChild.kt
class KotlinChild : JavaInterface, JavaInterfaceChildOfKotlin {
override fun foo(x: Point) = 42
}
// FILE: box.kt
fun box(): String {
if (KotlinChild().foo(Point(0, 0)) != 42) return "Fail"
return "OK"
}