Address comments: fix docs, add completion test for Self.

This commit is contained in:
ice1000 2019-10-08 07:25:37 -04:00
parent 6bad638928
commit b043358be9
4 changed files with 32 additions and 5 deletions

View file

@ -465,7 +465,7 @@ impl Enum {
// ...and add generic params, if present
let p = self.generic_params(db);
let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
r.push_scope(Scope::AdtScope(From::from(self)))
r.push_scope(Scope::AdtScope(self.into()))
}
}

View file

@ -45,7 +45,7 @@ pub(crate) enum Scope {
GenericParams(Arc<GenericParams>),
/// Brings `Self` in `impl` block into scope
ImplBlockScope(ImplBlock),
/// Brings `Self` in enum definition into scope
/// Brings `Self` in enum, struct and union definitions into scope
AdtScope(Adt),
/// Local bindings
ExprScope(ExprScope),

View file

@ -559,9 +559,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
match resolver.resolve_path_in_type_ns_fully(self.db, &path) {
Some(TypeNs::Adt(Adt::Struct(it))) => it.into(),
Some(TypeNs::Adt(Adt::Union(it))) => it.into(),
Some(TypeNs::AdtSelfType(Adt::Struct(it))) => it.into(),
Some(TypeNs::AdtSelfType(Adt::Union(it))) => it.into(),
Some(TypeNs::AdtSelfType(Adt::Enum(it))) => it.into(),
Some(TypeNs::AdtSelfType(adt)) => adt.into(),
Some(TypeNs::EnumVariant(it)) => it.into(),
Some(TypeNs::TypeAlias(it)) => it.into(),