File tree 2 files changed +54
-3
lines changed
crates/ide-completion/src
2 files changed +54
-3
lines changed Original file line number Diff line number Diff line change @@ -675,10 +675,10 @@ fn classify_name_ref(
675
675
{
676
676
if let Some ( item) = ast:: Item :: cast ( n) {
677
677
let is_inbetween = match & item {
678
- ast:: Item :: Const ( it) => it. body ( ) . is_none ( ) ,
678
+ ast:: Item :: Const ( it) => it. body ( ) . is_none ( ) && it . semicolon_token ( ) . is_none ( ) ,
679
679
ast:: Item :: Enum ( it) => it. variant_list ( ) . is_none ( ) ,
680
680
ast:: Item :: ExternBlock ( it) => it. extern_item_list ( ) . is_none ( ) ,
681
- ast:: Item :: Fn ( it) => it. body ( ) . is_none ( ) ,
681
+ ast:: Item :: Fn ( it) => it. body ( ) . is_none ( ) && it . semicolon_token ( ) . is_none ( ) ,
682
682
ast:: Item :: Impl ( it) => it. assoc_item_list ( ) . is_none ( ) ,
683
683
ast:: Item :: Module ( it) => {
684
684
it. item_list ( ) . is_none ( ) && it. semicolon_token ( ) . is_none ( )
@@ -688,7 +688,7 @@ fn classify_name_ref(
688
688
it. field_list ( ) . is_none ( ) && it. semicolon_token ( ) . is_none ( )
689
689
}
690
690
ast:: Item :: Trait ( it) => it. assoc_item_list ( ) . is_none ( ) ,
691
- ast:: Item :: TypeAlias ( it) => it. ty ( ) . is_none ( ) ,
691
+ ast:: Item :: TypeAlias ( it) => it. ty ( ) . is_none ( ) && it . semicolon_token ( ) . is_none ( ) ,
692
692
ast:: Item :: Union ( it) => it. record_field_list ( ) . is_none ( ) ,
693
693
_ => false ,
694
694
} ;
Original file line number Diff line number Diff line change @@ -214,6 +214,57 @@ fn in_trait_assoc_item_list() {
214
214
) ;
215
215
}
216
216
217
+ #[ test]
218
+ fn in_trait_assoc_fn_missing_body ( ) {
219
+ check (
220
+ r#"trait Foo { fn function(); $0 }"# ,
221
+ expect ! [ [ r#"
222
+ ma makro!(…) macro_rules! makro
223
+ md module
224
+ kw const
225
+ kw crate::
226
+ kw fn
227
+ kw self::
228
+ kw type
229
+ kw unsafe
230
+ "# ] ] ,
231
+ ) ;
232
+ }
233
+
234
+ #[ test]
235
+ fn in_trait_assoc_const_missing_body ( ) {
236
+ check (
237
+ r#"trait Foo { const CONST: (); $0 }"# ,
238
+ expect ! [ [ r#"
239
+ ma makro!(…) macro_rules! makro
240
+ md module
241
+ kw const
242
+ kw crate::
243
+ kw fn
244
+ kw self::
245
+ kw type
246
+ kw unsafe
247
+ "# ] ] ,
248
+ ) ;
249
+ }
250
+
251
+ #[ test]
252
+ fn in_trait_assoc_type_aliases_missing_ty ( ) {
253
+ check (
254
+ r#"trait Foo { type Type; $0 }"# ,
255
+ expect ! [ [ r#"
256
+ ma makro!(…) macro_rules! makro
257
+ md module
258
+ kw const
259
+ kw crate::
260
+ kw fn
261
+ kw self::
262
+ kw type
263
+ kw unsafe
264
+ "# ] ] ,
265
+ ) ;
266
+ }
267
+
217
268
#[ test]
218
269
fn in_trait_impl_assoc_item_list ( ) {
219
270
check (
You can’t perform that action at this time.
0 commit comments