xls icon indicating copy to clipboard operation
xls copied to clipboard

Cannot map parametric function

Open grebe opened this issue 1 year ago • 4 comments

Mapping a parametric function doesn't work, e.g.

fn f<N:u32>(x: u32) -> u32 { N + x }
fn main() { map(u32[4]:[0, 1, 2, 3], f<u32:4>) }

grebe avatar May 16 '24 23:05 grebe

Note this fails with the following error:

0002: 
0003: fn f<N:u32>(x: u32) -> u32 { N + x }
0004: fn main() { map(u32[4]:[0, 1, 2, 3], f<u32:4>) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ParseError: Expected '(', got ')': Expected a '(' after parametrics for function invocation.

proppy avatar May 24 '24 18:05 proppy

Also duplicate of https://github.com/google/xls/issues/1063

hzeller avatar Jun 17 '24 17:06 hzeller

I think #1063 is a specific case of this bug for which there can be no available workaround. I.e. you can't simply wrap the parametric instantiation because it depends on parent parameters.

This more generalized issue can be worked around as indicated in https://github.com/google/xls/issues/1063#issuecomment-1633497494.

Not sure what this means for bug management...

mikex-oss avatar Jun 17 '24 22:06 mikex-oss

Let's keep this open then, and #1063 as "related" then.

Sorry for the noise :)

proppy avatar Jun 17 '24 23:06 proppy