Skip to content

Commit 153818d

Browse files
committed
fix(json): bug in .copy functions
1 parent 46e4b47 commit 153818d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

module-extkt-json/src/commonMain/kotlin/JsonArrayLike.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import kotlinx.serialization.json.JsonPrimitive
2323

2424
/** return a copy of [this] with [block] applied to it. */
2525
fun JsonArrayLike.copy(block: MutableJsonArrayLike.() -> Unit): JsonArray {
26-
return JsonArray(buildList { addAll(this); block() })
26+
return JsonArray(buildList { addAll(this@copy); block() })
2727
}
2828

2929
//

module-extkt-json/src/commonMain/kotlin/JsonObjectLike.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import kotlin.jvm.JvmName
2424

2525
/** return a copy of [this] with [block] applied to it. */
2626
fun JsonObjectLike.copy(block: MutableJsonObjectLike.() -> Unit): JsonObject {
27-
return JsonObject(buildMap { putAll(this); block() })
27+
return JsonObject(buildMap { putAll(this@copy); block() })
2828
}
2929

3030
//

0 commit comments

Comments
 (0)