Handle tuple structs / enum variants properly in type inference

This commit is contained in:
Florian Diebold 2019-02-17 17:29:51 +01:00
parent a725dd4f7a
commit b82db68400
5 changed files with 95 additions and 37 deletions

View file

@ -290,7 +290,11 @@ impl Struct {
}
pub fn ty(&self, db: &impl HirDatabase) -> Ty {
db.type_for_def((*self).into())
db.type_for_def((*self).into(), Namespace::Types)
}
pub fn constructor_ty(&self, db: &impl HirDatabase) -> Ty {
db.type_for_def((*self).into(), Namespace::Values)
}
// TODO move to a more general type
@ -350,7 +354,7 @@ impl Enum {
}
pub fn ty(&self, db: &impl HirDatabase) -> Ty {
db.type_for_def((*self).into())
db.type_for_def((*self).into(), Namespace::Types)
}
// TODO: move to a more general type
@ -425,7 +429,7 @@ pub struct Function {
pub(crate) id: FunctionId,
}
pub use crate::expr::ScopeEntryWithSyntax;
pub use crate::{ nameres::Namespace, expr::ScopeEntryWithSyntax};
/// The declared signature of a function.
#[derive(Debug, Clone, PartialEq, Eq)]