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

ICE: Internal Consistency Evaluators Errors #4517

Closed
nventuro opened this issue Mar 8, 2024 · 1 comment
Closed

ICE: Internal Consistency Evaluators Errors #4517

nventuro opened this issue Mar 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nventuro
Copy link
Contributor

nventuro commented Mar 8, 2024

Aim

Trying to come up with a simpler example for #4497 I run into this other bug.

Expected Behavior

While modifying my example to try to trigger the bug in #4497 I arrived at this. The addition of the N type argument triggered this bug. I'm not entirely sure if the following code should compile or not given that N cannot be inferred, but is also unused.

struct Parameters<T, N> {
    values: BoundedVec<Option<T>, N>
}

impl<T, N> Parameters<T, N> {
    pub fn new() -> Self {
        Parameters { values: BoundedVec::new() }
    }
}

struct Struct<T> {}

impl<T> Struct<T> {
    pub fn call_fn<N>(self, parameters: Parameters<T, N>) -> [Option<T>; 5] {
        [Option::none(); 5]
    }
}

fn main() {
    let ztruct: Struct<Field> = Struct {};
    let parameters = Parameters::new();

    // Causes an ICE
    let _ = ztruct.call_fn(parameters);
}

Bug

error: Internal Consistency Evaluators Errors: 

                This is likely a bug. Consider opening an issue at https://github.com/noir-lang/noir/issues
  ┌─ std/collections/bounded_vec.nr:1:1
  │
1 │ struct BoundedVec<T, MaxLen> {
  │ - Length of generic array could not be determined.
  │
  = Call stack:
    1. std/collections/bounded_vec.nr:9:31

Installation Method

Compiled from source

Nargo Version

nargo version = 0.24.0 noirc version = 0.24.0+f3dfb453df81eee0f7c6d8dc37f998cd14d75004 (git version hash: f3dfb453df81eee0f7c6d8dc37f998cd14d75004, is dirty: false)

@nventuro nventuro added the bug Something isn't working label Mar 8, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Mar 8, 2024
@TomAFrench
Copy link
Member

struct Parameters<T, let N: u32> {
    values: BoundedVec<Option<T>, N>
}

impl<T, let N: u32> Parameters<T, N> {
    pub fn new() -> Self {
        Parameters { values: BoundedVec::new() }
    }
}

struct Struct<T> {}

impl<T> Struct<T> {
    pub fn call_fn<let N: u32>(self, parameters: Parameters<T, N>) -> [Option<T>; 5] {
        [Option::none(); 5]
    }
}

fn main() {
    let ztruct: Struct<Field> = Struct {};
    let parameters = Parameters::new();

    // Causes an ICE
    let _ = ztruct.call_fn(parameters);
}

This now fails to compile with

$ nargo compile
error: Type annotation needed
   ┌─ src/main.nr:21:34
   │
21 │     let parameters = Parameters::new();
   │                                  --- Could not determine type of generic argument
   │
   = Call stack:
     1. src/main.nr:21:34

Aborting due to 1 previous error

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 30, 2024
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

No branches or pull requests

2 participants