Skip to content

Commit

Permalink
chore: add test for isuee #7090 (#7091)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Jan 16, 2025
1 parent 15b8ca8 commit 9fa36e6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions compiler/noirc_frontend/src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,3 +1236,30 @@ fn warns_if_trait_is_not_in_scope_for_generic_function_call_and_there_is_only_on
assert_eq!(ident.to_string(), "foo");
assert_eq!(trait_name, "private_mod::Foo");
}

// See https://github.com/noir-lang/noir/issues/7090
#[test]
#[should_panic]
fn calls_trait_method_using_struct_name_when_multiple_impls_exist() {
let src = r#"
trait From2<T> {
fn from2(input: T) -> Self;
}
struct U60Repr {}
impl From2<[Field; 3]> for U60Repr {
fn from2(_: [Field; 3]) -> Self {
U60Repr {}
}
}
impl From2<Field> for U60Repr {
fn from2(_: Field) -> Self {
U60Repr {}
}
}
fn main() {
let _ = U60Repr::from2([1, 2, 3]);
let _ = U60Repr::from2(1);
}
"#;
assert_no_errors(src);
}

0 comments on commit 9fa36e6

Please sign in to comment.