Only complete type annotations for patterns in function params

This commit is contained in:
Lukas Wirth 2021-08-14 18:18:18 +02:00
parent d07f4e4c35
commit bf918046fa
5 changed files with 67 additions and 19 deletions

View file

@ -309,3 +309,41 @@ fn outer(Foo { bar$0 }: Foo) {}
expect![[r#""#]],
)
}
#[test]
fn completes_in_fn_param() {
check_empty(
r#"
struct Foo { bar: Bar }
struct Bar(u32);
fn foo($0) {}
"#,
expect![[r#"
kw mut
bn Foo Foo { bar$1 }: Foo$0
st Foo
bn Bar Bar($1): Bar$0
st Bar
"#]],
)
}
#[test]
fn completes_in_closure_param() {
check_empty(
r#"
struct Foo { bar: Bar }
struct Bar(u32);
fn foo() {
|$0| {};
}
"#,
expect![[r#"
kw mut
bn Foo Foo { bar$1 }$0
st Foo
bn Bar Bar($1)$0
st Bar
"#]],
)
}