This commit is contained in:
uHOOCCOOHu 2019-09-10 01:21:29 +08:00
parent 40f9134159
commit 5f48ef3902
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
2 changed files with 3 additions and 12 deletions

View file

@ -4,7 +4,8 @@ use crate::MacroDef;
pub enum Namespace {
Types,
Values,
Macro,
// Note that only type inference uses this enum, and it doesn't care about macros.
// Macro,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@ -79,14 +80,7 @@ impl<T> PerNs<T> {
}
}
pub fn and_then<U>(self, f: impl Fn(T) -> Option<U>) -> PerNs<U> {
PerNs {
types: self.types.and_then(&f),
values: self.values.and_then(&f),
macros: self.macros,
}
}
/// Map types and values. Leave macros unchanged.
pub fn map<U>(self, f: impl Fn(T) -> U) -> PerNs<U> {
PerNs { types: self.types.map(&f), values: self.values.map(&f), macros: self.macros }
}

View file

@ -429,9 +429,6 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace
(TypableDef::Const(_), Namespace::Types) => Ty::Unknown,
(TypableDef::Static(_), Namespace::Types) => Ty::Unknown,
(TypableDef::BuiltinType(_), Namespace::Values) => Ty::Unknown,
// Macro is not typeable
(_, Namespace::Macro) => Ty::Unknown,
}
}