diff options
author | Aleksey Kladov <[email protected]> | 2019-11-26 18:04:24 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-26 18:04:24 +0000 |
commit | 4e415a269e2d821f31963c05843517c6fde0132d (patch) | |
tree | 9acc9b8f635405f8c194cfd807927c45ee3fbb02 /crates/ra_hir/src/code_model.rs | |
parent | 475367d08a0b5e8ed4d6c7c7d43947fd11b26bb7 (diff) |
Remove ns-polymorphic type_for_def
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 7b5d78543..c5cf39ee1 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -28,8 +28,7 @@ use crate::{ | |||
28 | expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId}, | 28 | expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId}, |
29 | ty::display::HirFormatter, | 29 | ty::display::HirFormatter, |
30 | ty::{ | 30 | ty::{ |
31 | self, InEnvironment, InferenceResult, Namespace, TraitEnvironment, TraitRef, Ty, TypeCtor, | 31 | self, InEnvironment, InferenceResult, TraitEnvironment, TraitRef, Ty, TypeCtor, TypeWalk, |
32 | TypeWalk, | ||
33 | }, | 32 | }, |
34 | CallableDef, Either, HirDisplay, Name, Source, | 33 | CallableDef, Either, HirDisplay, Name, Source, |
35 | }; | 34 | }; |
@@ -354,11 +353,11 @@ impl Struct { | |||
354 | } | 353 | } |
355 | 354 | ||
356 | pub fn ty(self, db: &impl HirDatabase) -> Ty { | 355 | pub fn ty(self, db: &impl HirDatabase) -> Ty { |
357 | db.type_for_def(self.into(), Namespace::Types) | 356 | db.ty(self.id.into()) |
358 | } | 357 | } |
359 | 358 | ||
360 | pub fn constructor_ty(self, db: &impl HirDatabase) -> Ty { | 359 | pub fn constructor_ty(self, db: &impl HirDatabase) -> Ty { |
361 | db.type_for_def(self.into(), Namespace::Values) | 360 | db.value_ty(self.id.into()) |
362 | } | 361 | } |
363 | 362 | ||
364 | fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> { | 363 | fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> { |
@@ -381,7 +380,7 @@ impl Union { | |||
381 | } | 380 | } |
382 | 381 | ||
383 | pub fn ty(self, db: &impl HirDatabase) -> Ty { | 382 | pub fn ty(self, db: &impl HirDatabase) -> Ty { |
384 | db.type_for_def(self.into(), Namespace::Types) | 383 | db.ty(self.id.into()) |
385 | } | 384 | } |
386 | 385 | ||
387 | pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> { | 386 | pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> { |
@@ -442,7 +441,7 @@ impl Enum { | |||
442 | } | 441 | } |
443 | 442 | ||
444 | pub fn ty(self, db: &impl HirDatabase) -> Ty { | 443 | pub fn ty(self, db: &impl HirDatabase) -> Ty { |
445 | db.type_for_def(self.into(), Namespace::Types) | 444 | db.ty(self.id.into()) |
446 | } | 445 | } |
447 | } | 446 | } |
448 | 447 | ||
@@ -617,7 +616,7 @@ impl Function { | |||
617 | } | 616 | } |
618 | 617 | ||
619 | pub fn ty(self, db: &impl HirDatabase) -> Ty { | 618 | pub fn ty(self, db: &impl HirDatabase) -> Ty { |
620 | db.type_for_def(self.into(), Namespace::Values) | 619 | db.value_ty(self.id.into()) |
621 | } | 620 | } |
622 | 621 | ||
623 | pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> { | 622 | pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> { |
@@ -797,7 +796,7 @@ impl TypeAlias { | |||
797 | } | 796 | } |
798 | 797 | ||
799 | pub fn ty(self, db: &impl HirDatabase) -> Ty { | 798 | pub fn ty(self, db: &impl HirDatabase) -> Ty { |
800 | db.type_for_def(self.into(), Namespace::Types) | 799 | db.ty(self.id.into()) |
801 | } | 800 | } |
802 | 801 | ||
803 | pub fn name(self, db: &impl DefDatabase) -> Name { | 802 | pub fn name(self, db: &impl DefDatabase) -> Name { |