-
Notifications
You must be signed in to change notification settings - Fork 370
Open
Description
Aim
This is a test added in #11383 that should be fixed:
pub trait Foo {
type Bar;
fn foo() -> Self::Bar;
}
pub trait Qux: Foo {
type Bar;
// This is rejected by Rust as ambiguous, but is accepted by Noir.
fn qux() -> Self::Bar;
// This "works" in Noir: it is treated as `Self::Bar`, which in turn shouldn't work.
fn quy() -> <Self as Qux>::Bar;
// This is not working in Noir, but it should; it works in Rust.
fn quz() -> <Self as Foo>::Bar;
}Expected Behavior
Self::Barshould be rejected as ambiguous.<Self as Foo>::Barshould be handled and resolve to the parent's associated type
Bug
❯ cargo run -q -p nargo_cli -- compile --force
error: No matching impl found for `Self: Foo<Bar = _>`
┌─ src/main.nr:15:26
│
15 │ fn quz() -> <Self as Foo>::Bar;
│ --- No impl for `Self: Foo<Bar = _>`
│
Aborting due to 1 previous error
To Reproduce
Add the expected errors to this test:
cargo test -q -p noirc_frontend trait_inheritance_with_ambiguous_associated_type
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
nargo version = 1.0.0-beta.18 noirc version = 1.0.0-beta.18+ba442d489bdaf51c706115c159b52706365d493f (git version hash: 7b8bbde, is dirty: true)
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
Metadata
Metadata
Assignees
Labels
No labels