blob: b72dd6e92a3a9b6dfd231db52bcc65817335742d [file]
// ISSUE: KT-77681
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
// TARGET_BACKEND: JS_IR
// TARGET_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
// ^^^ KT-77681: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl is not supported yet.
// Signature: null
// Private signature: [ File '.../main/app.kt' <- #7 ]
// Idealy, it must be an IrValidatorError , should `checkValueScopes=true` would be provided to IrValidator invocation right after Fir2IR.
// FILE: lib.kt
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlin.test.assertEquals
@Serializable
open class OpenBody {
var optional: String = "foo"
val field2: String = optional
}
// FILE: app.kt
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlin.test.assertEquals
@Serializable
class Test1: OpenBody()
fun test1() {
val json = Json { encodeDefaults = true }
val string = json.encodeToString(Test1.serializer(), Test1())
assertEquals("{\"optional\":\"foo\",\"field2\":\"foo\"}", string)
val reconstructed = json.decodeFromString(Test1.serializer(), string)
assertEquals("foo", reconstructed.field2)
}
fun box(): String {
test1()
return "OK"
}