mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
When mapping callable method signature for erased inline class methods, use original function descriptor instead of super declaration (otherwise it would map to a default interface method with mismatching signature). When generating delegates to Kotlin default interface methods, keep track of the original Kotlin types for delegating method arguments and interface method arguments. 'original' for value parameters of fake overrides points to the overridden function value parameters instead of the value parameter of the unsubstituted function. This causes inconsistent type mapping for inline classes implementing generic interfaces with default methods. #KT-25295 Fixed Target versions 1.3.20 #KT-26931 Fixed Target versions 1.3.20
24 lines
460 B
Kotlin
Vendored
24 lines
460 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// IGNORE_BACKEND: JVM_IR
|
|
|
|
interface IBase {
|
|
fun foo() = "BAD"
|
|
}
|
|
|
|
interface IFoo : IBase {
|
|
override fun foo() = "OK"
|
|
}
|
|
|
|
inline class Z(val x: Int) : IFoo
|
|
|
|
inline class L(val x: Long) : IFoo
|
|
|
|
inline class S(val x: String) : IFoo
|
|
|
|
fun box(): String {
|
|
if (Z(42).foo() != "OK") throw AssertionError()
|
|
if (L(4L).foo() != "OK") throw AssertionError()
|
|
if (S("").foo() != "OK") throw AssertionError()
|
|
|
|
return "OK"
|
|
} |