Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/regressions/referenceToSelfInLocal.kt
T
Denis Zharkov f07566d30d Add warning for initializers with obsolete syntax
Expected 'init' keyword before class initializer
2015-03-11 17:45:26 +03:00

19 lines
436 B
Kotlin
Vendored

// KT-4351 Cannot resolve reference to self in init of class local to function
fun box(): String {
var accessedFromConstructor: Class<*>? = null
class MyClass() {
init {
accessedFromConstructor = javaClass<MyClass>()
}
}
MyClass()
if (accessedFromConstructor!!.getName().endsWith("MyClass")) {
return "OK"
} else {
return accessedFromConstructor.toString()
}
}