Skip to content

Commit

Permalink
fix(json): bug in .copy functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lsafer-meemer committed Dec 19, 2024
1 parent 46e4b47 commit 153818d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion module-extkt-json/src/commonMain/kotlin/JsonArrayLike.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import kotlinx.serialization.json.JsonPrimitive

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

//
Expand Down
2 changes: 1 addition & 1 deletion module-extkt-json/src/commonMain/kotlin/JsonObjectLike.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import kotlin.jvm.JvmName

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

//
Expand Down

0 comments on commit 153818d

Please sign in to comment.