Skip to content

Commit c1499a2

Browse files
authored
Merge pull request #20679 from A4-Tacks/no-comp-ty-in-nested-pat
Fix complete type in nested pattern
2 parents d6e14cc + 408b8bc commit c1499a2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/ide-completion/src/render/pattern.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ fn render_pat(
163163
PatternContext {
164164
param_ctx: Some(ParamContext { kind: ParamKind::Function(_), .. }),
165165
has_type_ascription: false,
166+
parent_pat: None,
166167
..
167168
}
168169
);

crates/ide-completion/src/tests/pattern.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,25 @@ fn foo($0) {}
398398
)
399399
}
400400

401+
#[test]
402+
fn completes_in_fn_param_in_nested_pattern() {
403+
check(
404+
r#"
405+
struct Foo { num: u32 }
406+
struct Bar(Foo);
407+
fn foo(Bar($0)) {}
408+
"#,
409+
expect![[r#"
410+
st Bar
411+
st Foo
412+
bn Bar(…) Bar($1)$0
413+
bn Foo {…} Foo { num$1 }$0
414+
kw mut
415+
kw ref
416+
"#]],
417+
)
418+
}
419+
401420
#[test]
402421
fn completes_in_closure_param() {
403422
check(

0 commit comments

Comments
 (0)