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

Indexing (x[0]) should be disallowed on parametric signedness values #1836

Open
dank-openai opened this issue Jan 10, 2025 · 0 comments · May be fixed by #1837
Open

Indexing (x[0]) should be disallowed on parametric signedness values #1836

dank-openai opened this issue Jan 10, 2025 · 0 comments · May be fixed by #1837
Assignees
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end

Comments

@dank-openai
Copy link

dank-openai commented Jan 10, 2025

Describe the bug

Indexing (x[0]) should be disallowed on parametric signedness values, but no error is thrown.

Consider this code using parametric signedness:

fn is_even<S: bool, N: u32>(x: xN[S][N]) -> bool { x[0] == u1:0 }`
let e = is_even(1:s8);

error:
xN[is_signed=1] vs uN[1]: Could not deduce type for binary operation '=='

To Reproduce

Create a DSLX file with code like the above and try to build it as a library. Build before using is_even then try to build after using it.

Expected behavior

There should be an error like this: sN[8] Value to index is not an array.

@cdleary cdleary self-assigned this Jan 10, 2025
@cdleary cdleary added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end labels Jan 10, 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

Successfully merging a pull request may close this issue.

2 participants