Do not propose assoc items without qualifiers
This commit is contained in:
parent
104a19853e
commit
81961dc035
@ -27,6 +27,7 @@ pub fn autoderef<'a>(
|
||||
krate: Option<CrateId>,
|
||||
ty: InEnvironment<Canonical<Ty>>,
|
||||
) -> impl Iterator<Item = Canonical<Ty>> + 'a {
|
||||
// from_chalk
|
||||
let InEnvironment { value: ty, environment } = ty;
|
||||
successors(Some(ty), move |ty| {
|
||||
deref(db, krate?, InEnvironment { value: ty, environment: environment.clone() })
|
||||
|
@ -943,6 +943,38 @@ impl Item {
|
||||
|
||||
fn main() {
|
||||
bar::Ass$0
|
||||
}"#,
|
||||
expect![[]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_assoc_items_are_omitted() {
|
||||
check(
|
||||
r#"
|
||||
mod something {
|
||||
pub trait BaseTrait {
|
||||
fn test_function() -> i32;
|
||||
}
|
||||
|
||||
pub struct Item1;
|
||||
pub struct Item2;
|
||||
|
||||
impl BaseTrait for Item1 {
|
||||
fn test_function() -> i32 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
impl BaseTrait for Item2 {
|
||||
fn test_function() -> i32 {
|
||||
2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test_f$0
|
||||
}"#,
|
||||
expect![[]],
|
||||
)
|
||||
|
@ -304,10 +304,12 @@ fn path_applicable_imports(
|
||||
return items_with_candidate_name
|
||||
.into_iter()
|
||||
.filter_map(|item| {
|
||||
let mut mod_path = mod_path(item)?;
|
||||
if let Some(assoc_item) = item_as_assoc(db, item) {
|
||||
mod_path.push_segment(assoc_item.name(db)?);
|
||||
if item_as_assoc(db, item).is_some() {
|
||||
// unqualified assoc items are not valid syntax
|
||||
return None;
|
||||
}
|
||||
|
||||
let mod_path = mod_path(item)?;
|
||||
Some(LocatedImport::new(mod_path.clone(), item, item, Some(mod_path)))
|
||||
})
|
||||
.collect();
|
||||
|
Loading…
Reference in New Issue
Block a user