Skip to content

Commit

Permalink
Add a test for when struct pattern turbofish succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jul 26, 2024
1 parent 28010fb commit ec48f75
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions compiler/noirc_frontend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,22 @@ fn turbofish_in_struct_pattern() {
x: T
}
fn main() {
let value: Field = 0;
let Foo::<Field> { x } = Foo { x: value };
let _ = x;
}
"#;
assert_no_errors(src);
}

#[test]
fn turbofish_in_struct_pattern_errors_if_type_mismatch() {
let src = r#"
struct Foo<T> {
x: T
}
fn main() {
let value: Field = 0;
let Foo::<i32> { x } = Foo { x: value };
Expand Down

0 comments on commit ec48f75

Please sign in to comment.