Merge pull request #20679 from A4-Tacks/no-comp-ty-in-nested-pat

Fix complete type in nested pattern
This commit is contained in:
Shoyu Vanilla (Flint) 2025-09-22 15:37:39 +00:00 committed by GitHub
commit 06ee0ef31f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -163,6 +163,7 @@ fn render_pat(
PatternContext {
param_ctx: Some(ParamContext { kind: ParamKind::Function(_), .. }),
has_type_ascription: false,
parent_pat: None,
..
}
);

View file

@ -398,6 +398,25 @@ fn foo($0) {}
)
}
#[test]
fn completes_in_fn_param_in_nested_pattern() {
check(
r#"
struct Foo { num: u32 }
struct Bar(Foo);
fn foo(Bar($0)) {}
"#,
expect![[r#"
st Bar
st Foo
bn Bar() Bar($1)$0
bn Foo {} Foo { num$1 }$0
kw mut
kw ref
"#]],
)
}
#[test]
fn completes_in_closure_param() {
check(