Marc
04/08/2024, 11:06 AMoverride suspend fun ArcherRaise.invoke(q: KeyQuery<K, out A>): A & Any =
println(q)
println(this)
println(this@invoke)
when (q) {
is Put -> {
q.value?.also { values[q.key] = it } ?: raise(DataNotFound)
}
is Get -> {
values[q.key] ?: raise(DataNotFound)
}
}
ArcherRaise
is a custom object that I use for scoping the invoke function of my class. The issue is that when I’m running the code println(q)
prints ArcherRaise(raise=0)
where q is a totally different type, a KeyQuery
. This is causing a runtime exception: kotlin.NoWhenBranchMatchedException
note: on JVM this works as expectedMarc
04/08/2024, 11:08 AMMarc
04/08/2024, 12:07 PM@JvmInline
class making the compiler get crazy and replace some parameters./