Merge #6181
6181: Fix source_to_def for named enum variant fields r=jonas-schievink a=jonas-schievink
bors r+ 🤖
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
c1a8c03299
2 changed files with 21 additions and 0 deletions
|
@ -189,6 +189,10 @@ impl SourceToDefCtx<'_, '_> {
|
||||||
let def = self.type_alias_to_def(container.with_value(it))?;
|
let def = self.type_alias_to_def(container.with_value(it))?;
|
||||||
def.into()
|
def.into()
|
||||||
},
|
},
|
||||||
|
ast::Variant(it) => {
|
||||||
|
let def = self.enum_variant_to_def(container.with_value(it))?;
|
||||||
|
VariantId::from(def).into()
|
||||||
|
},
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -405,6 +405,23 @@ enum Foo {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_find_all_refs_enum_var_field() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
enum Foo {
|
||||||
|
A,
|
||||||
|
B { field<|>: u8 },
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
field RECORD_FIELD FileId(0) 26..35 26..31 Other
|
||||||
|
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_find_all_refs_two_modules() {
|
fn test_find_all_refs_two_modules() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Reference in a new issue