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

Wrong error generated in formatter (in parser) when missing constant definition inside parametric bindings (but not first) #1738

Open
mikex-oss opened this issue Nov 21, 2024 · 0 comments
Labels
dslx DSLX (domain specific language) implementation / front-end

Comments

@mikex-oss
Copy link
Collaborator

Describe the bug
You get misleading parse errors like "Expected start of an expression; got: {" or "Expected '}', got ','" from xls/dslx/frontend/bindings.h:58 in the following cases:

To Reproduce
First error:

fn foo<N: u32, M: u32>(a: u1) -> bits[M] {
    (a as bits[M]) >> N
}

const BAR = u32:1;

fn main() -> u32 {
    foo<BAR, BAZ>(u1:1)
}

Second error:

fn foo<N: u32, M: u32>(a: u1) -> bits[M] {
    (a as bits[M]) >> N
}

const BAR = u32:1;

fn main() -> u32 {
    foo<{BAR + u32:1}, BAZ>(u1:1)
}

Expected behavior

Similar to the following example, I'd expect to get an error like: Cannot find a definition for name: "BAZ"

fn foo<N: u32, M: u32>(a: u1) -> bits[M] {
    (a as bits[M]) >> N
}

const BAR = u32:1;

fn main() -> u32 {
    foo<BAZ, BAR>(u1:1)
}
@mikex-oss mikex-oss added dslx DSLX (domain specific language) implementation / front-end dslx:fmt DSLX auto-formatter labels Nov 21, 2024
@dplassgit dplassgit removed the dslx:fmt DSLX auto-formatter label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx DSLX (domain specific language) implementation / front-end
Projects
Status: No status
Development

No branches or pull requests

2 participants