xls
xls copied to clipboard
[dslx] Allow struct parametrics to be types other than `u32`
Right now we evaluate all parametric expressions given to a struct as u32
s, but that's technically too strict a limitation -- although we only allow u32s to appear in e.g. array dimensions when building a type, you could imagine a use case like the following:
struct Point<N: u5, N_U32: u32 = {N as u32}> {
x: uN[N_U32],
}
fn f(p: Point<u5:3>) -> uN[3] {
p.y
}
Note that the value given as N is not used in any type definition, just as a value that we do some computation from.
Note that I'm going to land a change that overly restricts them to all be u32
s at first to fix #727, then we can loosen from there.