Fix for KT-14201: UnsupportedOperationException: Don't know how to generate outer expression for anonymous object with invoke and non-trivial closure
#KT-14201 Fixed
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
interface Intf {
|
||||
val aValue: String
|
||||
}
|
||||
|
||||
class ClassB {
|
||||
val x = { "OK" }
|
||||
|
||||
val value: Intf = object : Intf {
|
||||
override val aValue = x()
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
return ClassB().value.aValue
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
class A {
|
||||
val z: String = "OK"
|
||||
}
|
||||
|
||||
class B {
|
||||
operator fun A.invoke(): String = z
|
||||
}
|
||||
|
||||
class ClassB {
|
||||
val x = A()
|
||||
|
||||
fun B.test(): String {
|
||||
val value = object {
|
||||
val z = x()
|
||||
}
|
||||
return value.z
|
||||
}
|
||||
|
||||
fun call(): String {
|
||||
return B().test()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return ClassB().call()
|
||||
}
|
||||
Reference in New Issue
Block a user