Fix for KT-13374: CompilationException: Inline function call with anonymous object implementing an interface by delegation
#KT-13374 Fixed
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
interface IZ {
|
||||
fun z()
|
||||
}
|
||||
|
||||
interface IZZ : IZ {
|
||||
fun zz()
|
||||
}
|
||||
|
||||
inline fun implZZ(zImpl: IZ, crossinline zzImpl: () -> Unit): IZZ =
|
||||
object : IZZ, IZ by zImpl {
|
||||
override fun zz() = zzImpl()
|
||||
}
|
||||
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
var result = "fail";
|
||||
|
||||
object ZImpl : IZ {
|
||||
override fun z() {
|
||||
result = "O"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val zz = implZZ(ZImpl) { result += "K" }
|
||||
zz.z()
|
||||
zz.zz()
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user