aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_api.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-02-17 16:29:51 +0000
committerFlorian Diebold <[email protected]>2019-02-17 19:53:13 +0000
commitb82db684003b817d47c1bc8c0d3c6afc88be2663 (patch)
tree7ec419545aee3e4f7297c6792eec1efebba4eb24 /crates/ra_hir/src/code_model_api.rs
parenta725dd4f7ac2b88541189f0f726ce86876c36add (diff)
Handle tuple structs / enum variants properly in type inference
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r--crates/ra_hir/src/code_model_api.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 26ebc445b..9da8a482d 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -290,7 +290,11 @@ impl Struct {
290 } 290 }
291 291
292 pub fn ty(&self, db: &impl HirDatabase) -> Ty { 292 pub fn ty(&self, db: &impl HirDatabase) -> Ty {
293 db.type_for_def((*self).into()) 293 db.type_for_def((*self).into(), Namespace::Types)
294 }
295
296 pub fn constructor_ty(&self, db: &impl HirDatabase) -> Ty {
297 db.type_for_def((*self).into(), Namespace::Values)
294 } 298 }
295 299
296 // TODO move to a more general type 300 // TODO move to a more general type
@@ -350,7 +354,7 @@ impl Enum {
350 } 354 }
351 355
352 pub fn ty(&self, db: &impl HirDatabase) -> Ty { 356 pub fn ty(&self, db: &impl HirDatabase) -> Ty {
353 db.type_for_def((*self).into()) 357 db.type_for_def((*self).into(), Namespace::Types)
354 } 358 }
355 359
356 // TODO: move to a more general type 360 // TODO: move to a more general type
@@ -425,7 +429,7 @@ pub struct Function {
425 pub(crate) id: FunctionId, 429 pub(crate) id: FunctionId,
426} 430}
427 431
428pub use crate::expr::ScopeEntryWithSyntax; 432pub use crate::{ nameres::Namespace, expr::ScopeEntryWithSyntax};
429 433
430/// The declared signature of a function. 434/// The declared signature of a function.
431#[derive(Debug, Clone, PartialEq, Eq)] 435#[derive(Debug, Clone, PartialEq, Eq)]