I've simplified the code: what remains is the following issue. (Obviously, in this contrived example, N can just be replaced by 1), but for real-world code, I cannot.
fn reflectN1[T: DType]() -> Cube[T, 1] : alias N: Int = 1 var x : Cube[T, N] = Cube[T, N]() x.value[0] = 1 x.value[1] = 0 return x
fn reflectN1[T: DType]() -> Cube[T, 1] : alias N: Int = 1 var x : Cube[T, N] = Cube[T, N]() x.value[0] = 1 x.value[1] = 0 return x
Error:
cannot implicitly convert 'Cube[T, N]' value to 'Cube[T, 1]' in return value
cannot implicitly convert 'Cube[T, N]' value to 'Cube[T, 1]' in return value
mojo 0.4.0 (9e33b013)
Question: Does anyone know how to
cast
cast
my
x
x
(of type
Cube[T, N]
Cube[T, N]
to
Cube[T, 1]
Cube[T, 1]
? Or is there another way to get the type system to accept this?