diff --git a/lynglib/src/commonMain/kotlin/net/sergeych/lyng/Script.kt b/lynglib/src/commonMain/kotlin/net/sergeych/lyng/Script.kt index 4f89647..bdad379 100644 --- a/lynglib/src/commonMain/kotlin/net/sergeych/lyng/Script.kt +++ b/lynglib/src/commonMain/kotlin/net/sergeych/lyng/Script.kt @@ -183,7 +183,7 @@ class Script( catch( e: ExecutionError ) { e.errorObject } - catch (e: ScriptError) { + catch (_: ScriptError) { ObjNull } result ?: raiseError(ObjAssertionFailedException(this,"Expected exception but nothing was thrown")) diff --git a/lynglib/src/commonMain/kotlin/net/sergeych/lynon/MemoryBitOutput.kt b/lynglib/src/commonMain/kotlin/net/sergeych/lynon/MemoryBitOutput.kt index 7dd8080..efb4ab3 100644 --- a/lynglib/src/commonMain/kotlin/net/sergeych/lynon/MemoryBitOutput.kt +++ b/lynglib/src/commonMain/kotlin/net/sergeych/lynon/MemoryBitOutput.kt @@ -81,7 +81,13 @@ class BitArray(val bytes: UByteArray, val lastByteBits: Int) : BitList { fun asUByteArray(): UByteArray = bytes override fun equals(other: Any?): Boolean { - return other is BitList && this.compareTo(other) == 0 + return when(other) { + is BitArray -> + // important: size must match as trailing zero bits will generate false eq otherwise: + size == other.size && bytes contentEquals other.bytes + is BitList -> compareTo(other) == 0 + else -> false + } } override fun hashCode(): Int {