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

Compiler panics when using a type alias to a generic array with static length as argument in main #4545

Closed
aajj999 opened this issue Mar 13, 2024 · 0 comments · Fixed by #4547
Labels
bug Something isn't working

Comments

@aajj999
Copy link

aajj999 commented Mar 13, 2024

Aim

Compiler doesn't panic when run nargo compile on

type Outer<N> = [u8; N];
fn main(arg: Outer<1>) {}

Expected Behavior

Compiler throws an error or accepts (compiles) the code.

Bug

The application panicked (crashed).
Message: Cannot have variable sized arrays as a parameter to main
Location: compiler/noirc_frontend/src/hir_def/types.rs:121

To Reproduce

Run nargo compile on

type Outer<N> = [u8; N];
fn main(arg: Outer<1>) {}

Project Impact

Blocker

Impact Context

The core library we're using cannot be compiled on the new Noir version because of this issue.

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

Binary (noirup default)

Nargo Version

nargo version = 0.25.0 noirc version = 0.25.0+3f676051a6073d6eabdc7fee68e4b522334344f6

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@aajj999 aajj999 added the bug Something isn't working label Mar 13, 2024
@jfecher jfecher changed the title Compiler panics when using generic array with static length as argument in main Compiler panics when using a type alias to a generic array with static length as argument in main Mar 13, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 13, 2024
# Description

## Problem\*

Resolves #4545

## Summary\*

A prior assumption we had where we didn't need to bind generics just to
check how many fields a type can have turned out not to be true. Binding
generics is important for cases such as the new test case where generic
lengths are used.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant