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

ParseErrors for unroll_for! with shorthand .. range using imported constant #1964

Open
mikex-oss opened this issue Feb 28, 2025 · 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

mikex-oss commented Feb 28, 2025

Describe the bug

proc Foo {
    config() {  }

    init { () }

    next(state: ()) {
        unroll_for! (i, _): (u32, ()) in u32:0..bar::N {
            let tok_ = join();
        }(());
    }
}

where in bar module:

pub const N = u32:32;

causes the error:

Expected 'identifier', got 'keyword:let': Expected struct instance's member name
=== Source Location Trace: === 
xls/dslx/frontend/bindings.h:59
xls/dslx/frontend/parser.cc:1079
...

Removing the statement inside interestingly causes a different error:

Expected '{', got ';'
=== Source Location Trace: === 
xls/dslx/frontend/bindings.h:59
xls/dslx/frontend/token_parser.cc:102
xls/dslx/frontend/parser.cc:3499

To Reproduce

Run the above proc through the DSLX formatter or compile it.

Expected behavior
This should work just as range(u32:0, bar::N) does.

@mikex-oss mikex-oss added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end labels Feb 28, 2025
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
Status: No status
Development

No branches or pull requests

1 participant