JS: fix absence of temporary variable in secondary constructors. See KT-16377
This commit is contained in:
committed by
Alexey Andreev
parent
3b222f13f3
commit
86d1c7b7ec
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// HAS_NO_CAPTURED_VARS: function=A_init except=Kotlin;A
|
||||
|
||||
class A() {
|
||||
var y: String? = null
|
||||
var z: Any? = null
|
||||
|
||||
constructor(x: Any) : this() {
|
||||
y = if (x == "foo") "!!!" else { z = x; ">>>" }
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A("foo")
|
||||
if (a.y != "!!!") return "fail1: ${a.y}"
|
||||
if (a.z != null) return "fail2: ${a.z}"
|
||||
|
||||
val b = A(23)
|
||||
if (b.y != ">>>") return "fail3: ${b.y}"
|
||||
if (b.z != 23) return "fail4: ${b.z}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user