Closed helehex closed 1 week ago
It's not exclusive to to_int
. Many other methods on SIMD
don't work in parameter context as well.
Repros with
fn main():
let myint : MyInt[1] = MyInt[1](6)
let myfloat: MyFloat[1] = MyFloat[1](myint) # this works
let mysimd : MyInt64[1] = MyInt64[1](myint) # this doesnt
@value
struct MyInt[param: Int]:
var value: Int
struct MyFloat[param: FloatLiteral]:
var value: FloatLiteral
fn __init__(inout self, other: MyInt[int(param)]):
self.value = other.value
struct MyInt64[param: Int64]:
var value: Int64
fn __init__(inout self, other: MyInt[int(param)]):
self.value = other.value
now since to_int
got removed in favor of int(…)
.
fn main():
alias param = Float64(1)
var myint = MyInt[int(param)](6)
var myf64 = MyFloat64[param](myint)
print(myf64.value)
# prints: '6'
@value
struct MyInt[param: Int]:
var value: Int
struct MyFloat64[param: Float64]:
var value: Float64
fn __init__(inout self, other: MyInt[int(param)]):
self.value = other.value
Reusing an alias value like this can work
The reproduction is getting very outdated (wasn't very good to begin with), but everything seems to work now so I'm closing this.
Bug description
This works for FloatLiteral, but not for any SIMD.
Steps to reproduce
System information