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:
Michael Bogdanov
2016-10-25 11:05:24 +03:00
parent e41cddd870
commit 1e59161e8f
5 changed files with 76 additions and 6 deletions
@@ -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()
}