File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
crates/ide_completion/src Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -598,7 +598,8 @@ impl<'a> CompletionContext<'a> {
598598 . map( |c| ( Some ( c. return_type( ) ) , None ) )
599599 . unwrap_or( ( None , None ) )
600600 } ,
601- ast:: Stmt ( _it) => ( None , None ) ,
601+ ast:: ParamList ( __) => ( None , None ) ,
602+ ast:: Stmt ( __) => ( None , None ) ,
602603 ast:: Item ( __) => ( None , None ) ,
603604 _ => {
604605 match node. parent( ) {
@@ -1174,4 +1175,23 @@ fn foo() {
11741175 expect ! [ [ r#"ty: Foo, name: ?"# ] ] ,
11751176 ) ;
11761177 }
1178+
1179+ #[ test]
1180+ fn expected_type_param_pat ( ) {
1181+ check_expected_type_and_name (
1182+ r#"
1183+ struct Foo { field: u32 }
1184+ fn foo(a$0: Foo) {}
1185+ "# ,
1186+ expect ! [ [ r#"ty: Foo, name: ?"# ] ] ,
1187+ ) ;
1188+ check_expected_type_and_name (
1189+ r#"
1190+ struct Foo { field: u32 }
1191+ fn foo($0: Foo) {}
1192+ "# ,
1193+ // FIXME make this work, currently fails due to pattern recovery eating the `:`
1194+ expect ! [ [ r#"ty: ?, name: ?"# ] ] ,
1195+ ) ;
1196+ }
11771197}
You can’t perform that action at this time.
0 commit comments