mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Handle tuple structs / enum variants properly in type inference
This commit is contained in:
parent
a725dd4f7a
commit
b82db68400
5 changed files with 95 additions and 37 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue