Files
kotlin/compiler/testData/codegen/box/objects/localFunctionInObjectInitializer_kt4516.kt
Alexander Udalov 81004889eb 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
2014-09-11 17:56:43 +04:00

19 lines
276 B
Kotlin

import java.util.HashMap
object O {
val mmmap = HashMap<String, Int>();
{
fun doStuff() {
mmmap.put("two", 2)
}
doStuff()
}
}
fun box(): String {
val r = O.mmmap["two"]
if (r != 2) return "Fail: $r"
return "OK"
}