xls icon indicating copy to clipboard operation
xls copied to clipboard

Type aliases cannot be used in parametric instantiations

Open mikex-oss opened this issue 1 year ago • 0 comments

Describe the bug DSLX parser stumbles on type aliases in parametric instantiations. It seems to parse the expression as multiple comparison operators after reaching the > after the parametric value when the type is not a builtin type.

To Reproduce Steps to reproduce the behavior:

  1. Compile below snippet:
type foo_t = bits[32];

fn f<N:u32>(x: u32) -> u32 { N + x }
fn main(x: u32) -> u32{ f<foo_t:1>(x) }
  1. Get error:
0002:
0003: fn f<N:u32>(x: u32) -> u32 { N + x }
0004: fn main(x: u32) { f<foo_t:1>(x) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ParseError: comparison operators cannot be chained
0005:
  1. Change foo_t:1 to bits[32]:1.
  2. Compile succeeds.
  3. Change foo_t:1 to u32:1.
  4. Compile succeeds.

Expected behavior

  1. should be equivalent to 3. and 5.

mikex-oss avatar Jun 18 '24 02:06 mikex-oss