https://kotlinlang.org logo
j

Jason5lee

10/01/2021, 2:11 AM
I found bitwise-and operator having different behavior in calling via infix syntax and method. Is it expected behavior?
👍 1
e

ephemient

10/01/2021, 2:29 AM
yes, because they mean
Copy code
(-3).and(0xFF)
-(3.and(0xFF))
respectively
j

Jason5lee

10/01/2021, 2:31 AM
Ok thanks.
e

ephemient

10/01/2021, 2:31 AM
you can see this with all infix functions, for example
Copy code
-1 to 1 // Pair(-1, 1)
-<http://1.to|1.to>(1) // ERROR Unresolved reference, because -Pair(1, 1) doesn't work
👍 1
3 Views