Skip to content

Commit 70d16d3

Browse files
committed
Add unit test when we have a composite type of associated const and type
1 parent b3e0884 commit 70d16d3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

compiler/noirc_frontend/src/tests/traits/trait_associated_items.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,30 @@ fn associated_type_mismatch_with_inheritance() {
591591
check_errors(src);
592592
}
593593

594+
#[test]
595+
fn associated_type_and_constant_composite() {
596+
let src = r#"
597+
pub trait Foo {
598+
type Bar;
599+
let Baz: u32;
600+
fn foo(x: [Self::Bar; Self::Baz]) -> u32;
601+
}
602+
603+
impl Foo for () {
604+
type Bar = ();
605+
let Baz: u32 = 0;
606+
fn foo(_x: [Self::Bar; Self::Baz]) -> u32 {
607+
0
608+
}
609+
}
610+
611+
fn main() {
612+
let _ = <() as Foo>::foo([(); 0]);
613+
}
614+
"#;
615+
assert_no_errors(src);
616+
}
617+
594618
#[test]
595619
fn associated_type_behind_self_as_trait() {
596620
let src = r#"

0 commit comments

Comments
 (0)