Open dark64 opened 1 year ago
Generic parameters are not propagated correctly when using structs
struct Foo<N> { field[N] inner; } def test<N>() -> Foo<N> { return Foo { inner: [0; N] }; } def main() -> Foo<2> { return test::<2>(); }
Fails to compile with message
Generic parameters must be compile-time constants, found test::<2>()
Assigning the result before returning works:
struct Foo<N> { field[N] inner; } def test<N>() -> Foo<N> { return Foo { inner: [0; N] }; } def main() -> Foo<2> { Foo<2> foo = test::<2>(); return foo; }
Using an array directly without the struct compiles fine as expected which might suggest something regarding structs is not right:
def test<N>() -> field[N] { return [0; N]; } def main() -> field[2] { return test::<2>(); }
Description
Generic parameters are not propagated correctly when using structs
Environment
Steps to Reproduce
Fails to compile with message
Assigning the result before returning works:
Using an array directly without the struct compiles fine as expected which might suggest something regarding structs is not right: