aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs1
-rw-r--r--crates/ra_hir_ty/src/lib.rs17
-rw-r--r--crates/ra_hir_ty/src/lower.rs10
3 files changed, 17 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 00ae35953..3c9c02d03 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -587,7 +587,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
587 self.write_method_resolution(tgt_expr, func); 587 self.write_method_resolution(tgt_expr, func);
588 (ty, self.db.value_ty(func.into()), Some(generics(self.db, func.into()))) 588 (ty, self.db.value_ty(func.into()), Some(generics(self.db, func.into())))
589 } 589 }
590 // TODO fix this
591 None => (receiver_ty, Binders::new(0, Ty::Unknown), None), 590 None => (receiver_ty, Binders::new(0, Ty::Unknown), None),
592 }; 591 };
593 let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty); 592 let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty);
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 68c2f0b06..c5fe18c85 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -287,17 +287,20 @@ pub enum Ty {
287 /// trait and all its parameters are fully known. 287 /// trait and all its parameters are fully known.
288 Projection(ProjectionTy), 288 Projection(ProjectionTy),
289 289
290 /// A type parameter; for example, `T` in `fn f<T>(x: T) {} 290 /// A placeholder for a type parameter; for example, `T` in `fn f<T>(x: T)
291 // TODO fix documentation 291 /// {}` when we're type-checking the body of that function. In this
292 /// situation, we know this stands for *some* type, but don't know the exact
293 /// type.
292 Param(TypeParamId), 294 Param(TypeParamId),
293 295
294 /// A bound type variable. Used during trait resolution to represent Chalk 296 /// A bound type variable. This is used in various places: when representing
295 /// variables, and in `Dyn` and `Opaque` bounds to represent the `Self` type. 297 /// some polymorphic type like the type of function `fn f<T>`, the type
296 // TODO fix documentation 298 /// parameters get turned into variables; during trait resolution, inference
299 /// variables get turned into bound variables and back; and in `Dyn` the
300 /// `Self` type is represented with a bound variable as well.
297 Bound(u32), 301 Bound(u32),
298 302
299 /// A type variable used during type checking. Not to be confused with a 303 /// A type variable used during type checking.
300 /// type parameter.
301 Infer(InferTy), 304 Infer(InferTy),
302 305
303 /// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust). 306 /// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust).
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs
index d2df3fe2b..c68c5852b 100644
--- a/crates/ra_hir_ty/src/lower.rs
+++ b/crates/ra_hir_ty/src/lower.rs
@@ -890,9 +890,13 @@ pub(crate) fn ty_query(db: &impl HirDatabase, def: TyDefId) -> Binders<Ty> {
890 } 890 }
891} 891}
892 892
893pub(crate) fn ty_recover(_db: &impl HirDatabase, _cycle: &[String], _def: &TyDefId) -> Binders<Ty> { 893pub(crate) fn ty_recover(db: &impl HirDatabase, _cycle: &[String], def: &TyDefId) -> Binders<Ty> {
894 // TODO still need correct number of binders here 894 let num_binders = match *def {
895 Binders::new(0, Ty::Unknown) 895 TyDefId::BuiltinType(_) => 0,
896 TyDefId::AdtId(it) => generics(db, it.into()).len(),
897 TyDefId::TypeAliasId(it) => generics(db, it.into()).len(),
898 };
899 Binders::new(num_binders, Ty::Unknown)
896} 900}
897 901
898pub(crate) fn value_ty_query(db: &impl HirDatabase, def: ValueTyDefId) -> Binders<Ty> { 902pub(crate) fn value_ty_query(db: &impl HirDatabase, def: ValueTyDefId) -> Binders<Ty> {