Fix initialization of object's INSTANCE$ field

Call object's constructor in <clinit> and ignore the result, but in the first
line of <init> save the current "this" to INSTANCE$

 #KT-4516 Fixed
 #KT-4543 Fixed
 #KT-5291 Fixed
 #KT-5523 Fixed
 #KT-5582 Fixed
This commit is contained in:
Alexander Udalov
2014-09-11 14:19:32 +04:00
parent b907f35995
commit 81004889eb
10 changed files with 175 additions and 34 deletions
@@ -0,0 +1,14 @@
trait T {
fun foo(): String
}
val o = object : T {
val a = "OK"
val f = {
a
}()
override fun foo() = f
}
fun box() = o.foo()