I tested the code:
val a : Int = 0x01
val b : Int = 0x03
println(a and b)
and got:
1
But if I declare as Bytes:
val a : Byte = 0x01
val b : Byte = 0x03
println(a and b)
got error:
error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
@SinceKotlin @InlineOnly public inline infix fun BigInteger.and(other: BigInteger): BigInteger defined in kotlin
println(a and b)
^
I found the reference: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.experimental/and.html saying:
Platform and version requirements: Kotlin 1.1
I checked my version:
C:\>kotlinc.bat -version
info: kotlinc-jvm 1.2.30 (JRE 1.8.0_181-b13)
What does it mean?
You are missing the import statement:
import kotlin.experimental.and
Without the import the compiler tries to use the and found in BigIntegers.kt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With