Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type aliases cannot be used in parametric instantiations #1486

Open
mikex-oss opened this issue Jun 18, 2024 · 0 comments
Open

Type aliases cannot be used in parametric instantiations #1486

mikex-oss opened this issue Jun 18, 2024 · 0 comments
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end

Comments

@mikex-oss
Copy link
Collaborator

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.
@proppy proppy added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end
Projects
None yet
Development

No branches or pull requests

2 participants