Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions compiler/noirc_frontend/src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,3 +1245,51 @@ fn as_trait_path_in_expression() {
"#;
assert_no_errors(src);
}

// TODO: remove `should_panic` once fixed
#[test]
#[should_panic = "Expected no errors"]
fn allows_renaming_trait_during_import() {
// Regression test for https://github.com/noir-lang/noir/issues/7632
let src = r#"
mod trait_mod {
pub trait Foo {
fn foo(_: Self) {}
}

impl Foo for Field {}
}

use trait_mod::Foo as FooTrait;

fn main(x: Field) {
x.foo();
}
"#;
assert_no_errors(src);
}

// TODO: remove `should_panic` once fixed
#[test]
#[should_panic = "Expected no errors"]
fn renaming_trait_avoids_name_collisions() {
// Regression test for https://github.com/noir-lang/noir/issues/7632
let src = r#"
mod trait_mod {
pub trait Foo {
fn foo(_: Self) {}
}

impl Foo for Field {}
}

use trait_mod::Foo as FooTrait;

pub struct Foo {}

fn main(x: Field) {
x.foo();
}
"#;
assert_no_errors(src);
}
Loading