Skip to content

Commit 2bf6665

Browse files
authored
Remove methods used only for tests and fix 'Overload resolution ambiguity' (#2751)
that happens with LV=2.1 (see https://youtrack.jetbrains.com/issue/KT-70201)
1 parent 46f406d commit 2bf6665

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

formats/cbor/commonMain/src/kotlinx/serialization/cbor/internal/Decoder.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ internal class CborParser(private val input: ByteArrayInput, private val verifyO
361361
return res
362362
}
363363

364-
fun nextDouble(tag: ULong) = nextDouble(ulongArrayOf(tag))
365-
366364
fun nextDouble(tags: ULongArray? = null): Double {
367365
processTags(tags)
368366
val res = when (curByte) {
@@ -411,7 +409,7 @@ internal class CborParser(private val input: ByteArrayInput, private val verifyO
411409
* been skipped, the "length stack" is [pruned][prune]. For indefinite length elements, a special marker is added to
412410
* the "length stack" which is only popped from the "length stack" when a CBOR [break][isEnd] is encountered.
413411
*/
414-
fun skipElement(tags: ULongArray? = null) {
412+
fun skipElement(tags: ULongArray?) {
415413
val lengthStack = mutableListOf<Int>()
416414

417415
processTags(tags)
@@ -441,8 +439,6 @@ internal class CborParser(private val input: ByteArrayInput, private val verifyO
441439
} while (lengthStack.isNotEmpty())
442440
}
443441

444-
fun skipElement(singleTag: ULong?) = skipElement(singleTag?.let { ulongArrayOf(it) })
445-
446442
/**
447443
* Removes an item from the top of the [lengthStack], cascading the removal if the item represents the last item
448444
* (i.e. a length value of `1`) at its stack depth.

formats/cbor/commonTest/src/kotlinx/serialization/cbor/CborParserTest.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,18 @@ class CborParserTest {
540540

541541
private fun CborParser.nextNumber(tag: ULong): Long = nextNumber(ulongArrayOf(tag))
542542

543+
private fun CborParser.nextDouble(tag: ULong) = nextDouble(ulongArrayOf(tag))
544+
543545
private fun CborParser.nextString(tag: ULong) = nextString(ulongArrayOf(tag))
544546

545547
private fun CborParser.startArray(tag: ULong): Int = startArray(ulongArrayOf(tag))
546548

547549
private fun CborParser.startMap(tag: ULong) = startMap(ulongArrayOf(tag))
548550

551+
private fun CborParser.skipElement(singleTag: ULong) = skipElement(ulongArrayOf(singleTag))
552+
553+
private fun CborParser.skipElement() = skipElement(null)
554+
549555
private fun CborParser.expect(expected: String, tag: ULong? = null) {
550556
assertEquals(expected, actual = nextString(tag?.let { ulongArrayOf(it) }), "string")
551557
}
@@ -556,4 +562,4 @@ private fun CborParser.expectMap(size: Int, tag: ULong? = null) {
556562

557563
private fun CborParser.expectEof() {
558564
assertTrue(isEof(), "Expected EOF.")
559-
}
565+
}

0 commit comments

Comments
 (0)