Ovsyannikov Alexey
08/23/2020, 6:44 PMtmp0_subject
was set up from this._file_3
on line 98291 on screenshot. This value is absent, but there is value value._file_3
which is look like something what must be on place of tmp0_subject
Ovsyannikov Alexey
08/23/2020, 6:46 PMOvsyannikov Alexey
08/23/2020, 6:52 PMthis.file
which is absent, but target value is stored in in value.file_gskrkt$_0
fieldbashor
08/23/2020, 9:09 PMimport kotlinx.serialization.*
import kotlinx.serialization.json.Json
@Serializable
class A(val prop: String) {
val prop2: String = when(prop) {
"aaa" -> "222"
else -> {
println("AAA") // Side effect
"333"
}
}
val prop3 = prop.length // unexpected TypeError
}
fun test() {
val a = A("aaa")
println(JSON.stringify(a))
println(Json.encodeToString(a))
}
fun main() {
test()
}
On both JS BEs it leads to crash with TypeError
while serializing. I didn’t check it on other BEs.
Also, it looks strange to observe side effects from prop2 initializer during serialization, is it intended?
cc @sandwwraith @Vsevolod Tolstopyatov [JB]bashor
08/23/2020, 9:15 PMNoWhenBranchMatchedException
, but root of a problem is the same as in the simplified version.Vsevolod Tolstopyatov [JB]
08/24/2020, 7:42 AMbashor
08/24/2020, 10:39 AMAlso, it looks strange to observe side effects from prop2 initializer during serialization, is it intended?