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

Unused impl generics only fail when the impl is used #6581

Open
michaeljklein opened this issue Nov 21, 2024 · 0 comments
Open

Unused impl generics only fail when the impl is used #6581

michaeljklein opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@michaeljklein
Copy link
Contributor

Aim

Attempted to compile the following program, where T and let N: u32 are unused in the impl for Foo:

trait Foo {
    fn foo(self) -> Self;
}

impl<T, let N: u32> Foo for () {
    fn foo(self) -> Self {
        ()
    }
}

fn main() {
    // only errors with this line
    println(().foo());
}

Expected Behavior

Expected the program to fail when the impl that cannot be instantiated was defined (i.e. without println(().foo());)

Bug

The program only fails when the impl is used:

error: Type annotation needed
    ┌─ src/main.nr:273:13
    │
273 │     println(().foo());
    │             ------ Could not determine type of generic argument
    │
    = Call stack:
      1. src/main.nr:273:13

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

nargo version = 0.39.0 noirc version = 0.39.0+68c32b4ffd9b069fe4b119327dbf4018c17ab9d4 (git version hash: 68c32b4, is dirty: false)

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@michaeljklein michaeljklein added the bug Something isn't working label Nov 21, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Nov 21, 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
Status: 📋 Backlog
Development

No branches or pull requests

1 participant