KT-37861 'this' is uninitialized in constructor default parameters
This commit is contained in:
+10
@@ -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()
|
||||
+15
@@ -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()
|
||||
Reference in New Issue
Block a user