when calling extension function, correctly put receiver on top of stack if it was generated before the extension function object (KT-1918)

This commit is contained in:
Dmitry Jemerov
2012-06-02 19:50:14 +02:00
parent 46bc7cf12f
commit ba9c3d73e7
3 changed files with 59 additions and 5 deletions
@@ -0,0 +1,20 @@
class Bar {
}
trait Foo {
fun xyzzy(x: Any?): String
}
fun buildFoo(bar: Bar.() -> Unit): Foo {
return object : Foo {
override fun xyzzy(x: Any?): String {
(x as? Bar)?.bar()
return "OK"
}
}
}
fun box(): String {
val foo = buildFoo({})
return foo.xyzzy(Bar())
}