This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
crates/ide-completion/src Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -1219,4 +1219,20 @@ fn foo() { S { field: || {} }.fi$0() }
12191219 "# ] ] ,
12201220 ) ;
12211221 }
1222+
1223+ #[ test]
1224+ fn test_tuple_function_field_completion ( ) {
1225+ check (
1226+ r#"
1227+ struct B(u32, fn())
1228+ fn foo() {
1229+ let b = B(0, || {});
1230+ b.$0()
1231+ }
1232+ "# ,
1233+ expect ! [ [ r#"
1234+ fd 1 fn()
1235+ "# ] ] ,
1236+ ) ;
1237+ }
12221238}
Original file line number Diff line number Diff line change @@ -1690,6 +1690,62 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 }
16901690 ) ;
16911691 }
16921692
1693+ #[ test]
1694+ fn expected_fn_type_ref ( ) {
1695+ check_kinds (
1696+ r#"
1697+ struct S { field: fn() }
1698+
1699+ fn foo() {
1700+ let foo: fn() = S { fields: || {}}.fi$0;
1701+ }
1702+ "# ,
1703+ & [ CompletionItemKind :: SymbolKind ( SymbolKind :: Field ) ] ,
1704+ expect ! [ [ r#"
1705+ [
1706+ CompletionItem {
1707+ label: "field",
1708+ source_range: 76..78,
1709+ text_edit: TextEdit {
1710+ indels: [
1711+ Indel {
1712+ insert: "(",
1713+ delete: 57..57,
1714+ },
1715+ Indel {
1716+ insert: ")",
1717+ delete: 75..75,
1718+ },
1719+ Indel {
1720+ insert: "field",
1721+ delete: 76..78,
1722+ },
1723+ ],
1724+ },
1725+ kind: SymbolKind(
1726+ Field,
1727+ ),
1728+ detail: "fn()",
1729+ relevance: CompletionRelevance {
1730+ exact_name_match: false,
1731+ type_match: Some(
1732+ Exact,
1733+ ),
1734+ is_local: false,
1735+ is_item_from_trait: false,
1736+ is_name_already_imported: false,
1737+ requires_import: false,
1738+ is_op_method: false,
1739+ is_private_editable: false,
1740+ postfix_match: None,
1741+ is_definite: false,
1742+ },
1743+ },
1744+ ]
1745+ "# ] ] ,
1746+ )
1747+ }
1748+
16931749 #[ test]
16941750 fn qualified_path_ref ( ) {
16951751 check_kinds (
You can’t perform that action at this time.
0 commit comments