Pass correct outer instance in complex case of inheritance

#KT-5343 Fixed
This commit is contained in:
Alexander Udalov
2014-10-15 19:15:47 +04:00
parent 61674fb3d9
commit 159878e09d
4 changed files with 74 additions and 9 deletions
@@ -0,0 +1,17 @@
class A {
fun bar(): Any {
return {
{
class Local : Inner() {
override fun toString() = foo()
}
Local()
}()
}()
}
open inner class Inner
fun foo() = "OK"
}
fun box(): String = A().bar().toString()
@@ -0,0 +1,16 @@
class A {
fun bar(): Any {
return {
{
object : Inner() {
override fun toString() = foo()
}
}()
}()
}
open inner class Inner
fun foo() = "OK"
}
fun box(): String = A().bar().toString()