Function `where` clauses with trait arguments fail
Closed this issue · 0 comments
michaeljklein commented
Aim
Attempted to use a trait in a function with a where
clause:
trait Foo<A> {
fn foo(self, x: A) -> bool;
}
// This works:
// fn bar<T, U>(x: T, y: U) -> bool where T: Foo<U> {
// x.foo(y)
// }
// This fails:
fn bar<T, U, V>(x: (T, U), y: V) -> bool where (T, U): Foo<V> {
x.foo(y)
}
Expected Behavior
Expected both functions to type check
Bug
The trait fails to resolve:
error: No method named 'foo' found for type '(T, U)'
┌─ /Users/michaelklein/Coding/noir/equiv_trait_scratch/src/main.nr:31:5
│
31 │ x.foo(y)
│ --------
│
Aborting due to 1 previous error
To Reproduce
Project Impact
Nice-to-have
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
None
Nargo Version
No response
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response