我测试了这段代码:
val a : Int = 0x01
val b : Int = 0x03
println(a and b)
并获得:
1
但如果我声明为 Byte
类型:
val a : Byte = 0x01
val b : Byte = 0x03
println(a and b)
出现错误:
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)
^
我找到了参考文献:https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.experimental/and.html,上面写着:
平台和版本要求:Kotlin 1.1
我查看了自己的版本:
C:\>kotlinc.bat -version
info: kotlinc-jvm 1.2.30 (JRE 1.8.0_181-b13)
这是什么意思?