aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r--crates/ra_hir/src/ty/infer.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index e975f9217..be74b9fa6 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -237,7 +237,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
237 match (&*ty1, &*ty2) { 237 match (&*ty1, &*ty2) {
238 (Ty::Unknown, ..) => true, 238 (Ty::Unknown, ..) => true,
239 (.., Ty::Unknown) => true, 239 (.., Ty::Unknown) => true,
240 (Ty::Apply(a_ty1), Ty::Apply(a_ty2)) if a_ty1.name == a_ty2.name => { 240 (Ty::Apply(a_ty1), Ty::Apply(a_ty2)) if a_ty1.ctor == a_ty2.ctor => {
241 self.unify_substs(&a_ty1.parameters, &a_ty2.parameters, depth + 1) 241 self.unify_substs(&a_ty1.parameters, &a_ty2.parameters, depth + 1)
242 } 242 }
243 (Ty::Infer(InferTy::TypeVar(tv1)), Ty::Infer(InferTy::TypeVar(tv2))) 243 (Ty::Infer(InferTy::TypeVar(tv1)), Ty::Infer(InferTy::TypeVar(tv2)))
@@ -278,11 +278,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
278 match ty { 278 match ty {
279 Ty::Unknown => self.new_type_var(), 279 Ty::Unknown => self.new_type_var(),
280 Ty::Apply(ApplicationTy { 280 Ty::Apply(ApplicationTy {
281 name: TypeCtor::Int(primitive::UncertainIntTy::Unknown), 281 ctor: TypeCtor::Int(primitive::UncertainIntTy::Unknown),
282 .. 282 ..
283 }) => self.new_integer_var(), 283 }) => self.new_integer_var(),
284 Ty::Apply(ApplicationTy { 284 Ty::Apply(ApplicationTy {
285 name: TypeCtor::Float(primitive::UncertainFloatTy::Unknown), 285 ctor: TypeCtor::Float(primitive::UncertainFloatTy::Unknown),
286 .. 286 ..
287 }) => self.new_float_var(), 287 }) => self.new_float_var(),
288 _ => ty, 288 _ => ty,
@@ -776,7 +776,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
776 Expr::Call { callee, args } => { 776 Expr::Call { callee, args } => {
777 let callee_ty = self.infer_expr(*callee, &Expectation::none()); 777 let callee_ty = self.infer_expr(*callee, &Expectation::none());
778 let (param_tys, ret_ty) = match &callee_ty { 778 let (param_tys, ret_ty) = match &callee_ty {
779 Ty::Apply(a_ty) => match a_ty.name { 779 Ty::Apply(a_ty) => match a_ty.ctor {
780 TypeCtor::FnPtr => { 780 TypeCtor::FnPtr => {
781 let sig = FnSig::from_fn_ptr_substs(&a_ty.parameters); 781 let sig = FnSig::from_fn_ptr_substs(&a_ty.parameters);
782 (sig.params().to_vec(), sig.ret().clone()) 782 (sig.params().to_vec(), sig.ret().clone())
@@ -823,7 +823,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
823 let method_ty = method_ty.apply_substs(substs); 823 let method_ty = method_ty.apply_substs(substs);
824 let method_ty = self.insert_type_vars(method_ty); 824 let method_ty = self.insert_type_vars(method_ty);
825 let (expected_receiver_ty, param_tys, ret_ty) = match &method_ty { 825 let (expected_receiver_ty, param_tys, ret_ty) = match &method_ty {
826 Ty::Apply(a_ty) => match a_ty.name { 826 Ty::Apply(a_ty) => match a_ty.ctor {
827 TypeCtor::FnPtr => { 827 TypeCtor::FnPtr => {
828 let sig = FnSig::from_fn_ptr_substs(&a_ty.parameters); 828 let sig = FnSig::from_fn_ptr_substs(&a_ty.parameters);
829 if !sig.params().is_empty() { 829 if !sig.params().is_empty() {
@@ -932,7 +932,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
932 let ty = receiver_ty 932 let ty = receiver_ty
933 .autoderef(self.db) 933 .autoderef(self.db)
934 .find_map(|derefed_ty| match derefed_ty { 934 .find_map(|derefed_ty| match derefed_ty {
935 Ty::Apply(a_ty) => match a_ty.name { 935 Ty::Apply(a_ty) => match a_ty.ctor {
936 TypeCtor::Tuple => { 936 TypeCtor::Tuple => {
937 let i = name.to_string().parse::<usize>().ok(); 937 let i = name.to_string().parse::<usize>().ok();
938 i.and_then(|i| a_ty.parameters.0.get(i).cloned()) 938 i.and_then(|i| a_ty.parameters.0.get(i).cloned())
@@ -988,7 +988,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
988 } 988 }
989 UnaryOp::Neg => { 989 UnaryOp::Neg => {
990 match &inner_ty { 990 match &inner_ty {
991 Ty::Apply(a_ty) => match a_ty.name { 991 Ty::Apply(a_ty) => match a_ty.ctor {
992 TypeCtor::Int(primitive::UncertainIntTy::Unknown) 992 TypeCtor::Int(primitive::UncertainIntTy::Unknown)
993 | TypeCtor::Int(primitive::UncertainIntTy::Signed(..)) 993 | TypeCtor::Int(primitive::UncertainIntTy::Signed(..))
994 | TypeCtor::Float(..) => inner_ty, 994 | TypeCtor::Float(..) => inner_ty,
@@ -1003,7 +1003,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1003 } 1003 }
1004 UnaryOp::Not => { 1004 UnaryOp::Not => {
1005 match &inner_ty { 1005 match &inner_ty {
1006 Ty::Apply(a_ty) => match a_ty.name { 1006 Ty::Apply(a_ty) => match a_ty.ctor {
1007 TypeCtor::Bool | TypeCtor::Int(_) => inner_ty, 1007 TypeCtor::Bool | TypeCtor::Int(_) => inner_ty,
1008 _ => Ty::Unknown, 1008 _ => Ty::Unknown,
1009 }, 1009 },
@@ -1043,7 +1043,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1043 } 1043 }
1044 Expr::Array { exprs } => { 1044 Expr::Array { exprs } => {
1045 let elem_ty = match &expected.ty { 1045 let elem_ty = match &expected.ty {
1046 Ty::Apply(a_ty) => match a_ty.name { 1046 Ty::Apply(a_ty) => match a_ty.ctor {
1047 TypeCtor::Slice | TypeCtor::Array => { 1047 TypeCtor::Slice | TypeCtor::Array => {
1048 Ty::clone(&a_ty.parameters.as_single()) 1048 Ty::clone(&a_ty.parameters.as_single())
1049 } 1049 }