KT-37861 'this' is uninitialized in constructor default parameters

This commit is contained in:
Dmitry Petrov
2020-03-30 14:12:09 +03:00
parent 078cf02c8a
commit cec64a2ec7
10 changed files with 102 additions and 0 deletions
@@ -0,0 +1,10 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND_FIR: JVM_IR
class Outer(val x: Any) {
inner class Inner(
val fn: () -> String = { x.toString() }
)
}
fun box() = Outer("OK").Inner().fn()
@@ -0,0 +1,15 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND_FIR: JVM_IR
class Outer(val x: Any) {
inner class Inner(
val fn: () -> String
) {
constructor(
unused: Int,
fn: () -> String = { x.toString() }
) : this(fn)
}
}
fun box() = Outer("OK").Inner(1).fn()