-
Notifications
You must be signed in to change notification settings - Fork 232
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
feat: resolve generic length of slice inconsistency #4232
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…er, add wip test case
… in nargo_fmt, fix lexing, debugging
…where else This reverts commit c3b67aa.
…ts, add assertion that prevent_numeric is retained for different copies of generic with same name
…x lexing test, add noirc_frontend test (passing locally), add mock stdlib option for noirc_frontend unit tests
Also resolves #2540? |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 19, 2024
# Description Replacement for #4232. Holding off on closing it to possibly port fixes from it, but wanted to start fresh because this approach is quite different. ## Problem\* Resolves #4220 ## Summary\* - Removes `NotConstant` - Separate syntax for slice literals: `&[..]` - Separate AST/type constructors for slices Notes: - I removed several broken links that were blocking updating the docs: + A few were to a missing `reference` docs folder, likely from an in-progress branch + One was to some `base_order_curve`, which has been moved to reference the `BigInt` struct ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [x] 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. --------- Co-authored-by: Jake Fecher <[email protected]> Co-authored-by: jfecher <[email protected]>
replaced by #4504 |
TomAFrench
pushed a commit
that referenced
this pull request
Apr 3, 2024
# Description Replacement for #4232. Holding off on closing it to possibly port fixes from it, but wanted to start fresh because this approach is quite different. ## Problem\* Resolves #4220 ## Summary\* - Removes `NotConstant` - Separate syntax for slice literals: `&[..]` - Separate AST/type constructors for slices Notes: - I removed several broken links that were blocking updating the docs: + A few were to a missing `reference` docs folder, likely from an in-progress branch + One was to some `base_order_curve`, which has been moved to reference the `BigInt` struct ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [x] 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. --------- Co-authored-by: Jake Fecher <[email protected]> Co-authored-by: jfecher <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Resolve generic
N
parameters applying inconsistently to arrays and slices.Problem*
Resolves #4220
Summary*
In general, generic
N
parameters are expected to be able to be instantiated to any specificType::Constant(n)
orType::NotConstant
, however these two cases have slightly different semantics.For example, the
map
definition uses the array lengthN
from the type to pick the size of the new array, but this isn't known for slices, leading to a panic:In a new approach
fn foo<T, N?>(x: [T; N])
would be needed to operate on slices as well. This would preventN
from being used as a numeric.Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.