Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/funInterfaceDoubleSuffux.kt
T
Ilmir Usmanov 549ea1a3b9 If fun interface methods are already mangled, do not mangle them twice
There are two possible scenarios, when fun interface method with inline
class parameter can be compiled.

First is when we compile fun interface itself before SAM adapter. In
that case, fun interface is lowered before we lower SAM adapter. Thus,
its method is mangled and mangling in the second time is an error.

Second is when we compile SAM adapter before the fun interface. In that
case, fun interface is not lowered, and we have to mangle the method.

The only way to distinguish there two cases I can think of is to check
whether the overridden method is already mangled, in other words, check,
whether the overridden method's suffix is doubled.

 #KT-48499: Fixed
2021-12-28 17:35:12 +01:00

20 lines
394 B
Kotlin
Vendored

// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
// FILE: Kt15AbstractMethodError2.kt
OPTIONAL_JVM_INLINE_ANNOTATION
value class MyValueClazz(val base: Long)
fun interface MyInterface {
fun myMethod(x: MyValueClazz)
}
// FILE: Kt15AbstractMethodErrorRepro.kt
fun box(): String {
val foo = MyInterface { _ -> }
foo.myMethod(MyValueClazz(0L))
return "OK"
}