Open YichengDWu opened 6 months ago
Error is: error: invalid call to 'lt': right side cannot be converted from 'SIMD[ui32, 1]' to 'Int' var c = a < b
@JoeLoser Library or not?
@JoeLoser Library or not?
Probably library only, yeah.
I think #2346 also referred to SIMD compare operator @VMois
@zhoujingya I don't think they are related at all.
Mojo (just like Python) has left biased operators. b < a
doesn't work because less than is not a free function but a method, and Int
doesn't have a SIMD
overload. I'm not sure we want to add the overload to Int
though.
Update with UInt
fn main():
var a: Int = 1
var b: UInt32 = 2
# var c = b < a # compile error
var c = a < b # compile error
print(c)
Does this mean there is no sign promotion whatsoever? Is this intended?
Bug description
I'm not sure how arithmetic operations between Int and UInt32 types are supposed to behave, but it seems strange to me that the following code results in an error.
Steps to reproduce
System information