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

.. range array does not type check correctly #1773

Open
mikex-oss opened this issue Dec 6, 2024 · 0 comments
Open

.. range array does not type check correctly #1773

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

Comments

@mikex-oss
Copy link
Collaborator

mikex-oss commented Dec 6, 2024

Describe the bug
When using .. to create an array, the array fails type checking even with the "mismatch" reporting exactly the same dimensions.

To Reproduce

const COUNT = u32:16;

fn foo(bar: u5[COUNT]) -> bool { bar[0] == bar[COUNT - u32:1] }

#[test]
fn foo_test() {
    let bar = u5:0..(COUNT as u5);
    // let bar = range(Index:0, COUNT as Index);
    // let bar = [
    //     Index:0, Index:1, Index:2, Index:3, Index:4, Index:5, Index:6, Index:7, Index:8, Index:9,
    //     Index:10, Index:11, Index:12, Index:13, Index:14, Index:15,
    // ];
    assert_eq(foo(bar), false);
    assert_eq(foo(bar), false);
}

fails with:

1000:     assert_eq(foo(bar), false);
~~~~~~~~~~~~~~~~~~~~~~~~^-^ XlsTypeError: Mismatch between parameter and argument types.
Type mismatch:
   uN[5][16]
vs uN[5][16]

Expected behavior
Behaves like creating the array explicitly or using the range builtin. The commented out versions both work.

@mikex-oss mikex-oss added the dslx DSLX (domain specific language) implementation / front-end label Dec 6, 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

1 participant