diff options
Diffstat (limited to 'crates/ra_hir/src/ty/op.rs')
-rw-r--r-- | crates/ra_hir/src/ty/op.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/crates/ra_hir/src/ty/op.rs b/crates/ra_hir/src/ty/op.rs index 1d089f1b0..1b30a5b9b 100644 --- a/crates/ra_hir/src/ty/op.rs +++ b/crates/ra_hir/src/ty/op.rs | |||
@@ -22,29 +22,29 @@ pub(super) fn binary_op_return_ty(op: BinaryOp, rhs_ty: Ty) -> Ty { | |||
22 | pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty { | 22 | pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty { |
23 | match op { | 23 | match op { |
24 | BinaryOp::LogicOp(..) => Ty::simple(TypeCtor::Bool), | 24 | BinaryOp::LogicOp(..) => Ty::simple(TypeCtor::Bool), |
25 | BinaryOp::Assignment { op: None } | 25 | BinaryOp::Assignment { op: None } | BinaryOp::CmpOp(CmpOp::Eq { negated: _ }) => { |
26 | | BinaryOp::CmpOp(CmpOp::Equal) | ||
27 | | BinaryOp::CmpOp(CmpOp::NotEqual) => match lhs_ty { | ||
28 | Ty::Apply(ApplicationTy { ctor, .. }) => match ctor { | ||
29 | TypeCtor::Int(..) | ||
30 | | TypeCtor::Float(..) | ||
31 | | TypeCtor::Str | ||
32 | | TypeCtor::Char | ||
33 | | TypeCtor::Bool => lhs_ty, | ||
34 | _ => Ty::Unknown, | ||
35 | }, | ||
36 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => lhs_ty, | ||
37 | _ => Ty::Unknown, | ||
38 | }, | ||
39 | BinaryOp::CmpOp(_) | BinaryOp::Assignment { op: Some(_) } | BinaryOp::ArithOp(_) => { | ||
40 | match lhs_ty { | 26 | match lhs_ty { |
41 | Ty::Apply(ApplicationTy { ctor, .. }) => match ctor { | 27 | Ty::Apply(ApplicationTy { ctor, .. }) => match ctor { |
42 | TypeCtor::Int(..) | TypeCtor::Float(..) => lhs_ty, | 28 | TypeCtor::Int(..) |
29 | | TypeCtor::Float(..) | ||
30 | | TypeCtor::Str | ||
31 | | TypeCtor::Char | ||
32 | | TypeCtor::Bool => lhs_ty, | ||
43 | _ => Ty::Unknown, | 33 | _ => Ty::Unknown, |
44 | }, | 34 | }, |
45 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => lhs_ty, | 35 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => lhs_ty, |
46 | _ => Ty::Unknown, | 36 | _ => Ty::Unknown, |
47 | } | 37 | } |
48 | } | 38 | } |
39 | BinaryOp::CmpOp(CmpOp::Ord { .. }) | ||
40 | | BinaryOp::Assignment { op: Some(_) } | ||
41 | | BinaryOp::ArithOp(_) => match lhs_ty { | ||
42 | Ty::Apply(ApplicationTy { ctor, .. }) => match ctor { | ||
43 | TypeCtor::Int(..) | TypeCtor::Float(..) => lhs_ty, | ||
44 | _ => Ty::Unknown, | ||
45 | }, | ||
46 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => lhs_ty, | ||
47 | _ => Ty::Unknown, | ||
48 | }, | ||
49 | } | 49 | } |
50 | } | 50 | } |