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: Missing trait impl - should be caught during type checking #3409

Closed
jfecher opened this issue Nov 2, 2023 · 0 comments · Fixed by #3440
Closed

ICE: Missing trait impl - should be caught during type checking #3409

jfecher opened this issue Nov 2, 2023 · 0 comments · Fixed by #3440
Labels
bug Something isn't working

Comments

@jfecher
Copy link
Contributor

jfecher commented Nov 2, 2023

Aim

Trying to run a program with generics and possibly multiple where clauses on functions or impls. E.g the impl_with_where_clause test:

fn main() {
    let array: [Field; 3] = [1, 2, 3];
    assert(array.eq(array));

    // Ensure this still works if we have to infer the type of the integer literals
    let array = [1, 2, 3];
    assert(array.eq(array));
}

trait Eq {
    fn eq(self, other: Self) -> bool;
}

impl<T> Eq for [T; 3] where T: Eq {
    fn eq(self, other: Self) -> bool {
        let mut ret = true;
        for i in 0 .. self.len() {
            ret &= self[i].eq(other[i]);
        }
        ret
    }
}

impl Eq for Field {
    fn eq(self, other: Field) -> bool {
        self == other
    }
}

Expected Behavior

The test to typecheck and execute successfully.

Bug

The application panicked (crashed).
Message:  ICE: missing trait impl - should be caught during type checking: [TraitConstraint { typ: NamedGeneric(Shared(RefCell { value: Bound(FieldElement) }), "T"), trait_id: TraitId(ModuleId { krate: Root(1), local_id: LocalModuleId(Index { index: 1, generation: 0 }) }) }]
Location: compiler/noirc_frontend/src/monomorphization/mod.rs:824

This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at https://github.com/noir-lang/noir/issues/.
If there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new?labels=bug&template=bug_report.yml
exit 101

Note that this is an existing issue, but the impl_with_where_clause test only started being affected by it after #3407 for unknown reasons.

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

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