diff options
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index e33762e0d..718e193f7 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -26,7 +26,7 @@ use ena::unify::{InPlaceUnificationTable, UnifyKey, UnifyValue, NoError}; | |||
26 | 26 | ||
27 | use ra_db::{LocalSyntaxPtr, Cancelable}; | 27 | use ra_db::{LocalSyntaxPtr, Cancelable}; |
28 | use ra_syntax::{ | 28 | use ra_syntax::{ |
29 | ast::{self, AstNode, LoopBodyOwner, ArgListOwner, PrefixOp}, | 29 | ast::{self, AstNode, LoopBodyOwner, ArgListOwner, PrefixOp, BinOp}, |
30 | SyntaxNodeRef | 30 | SyntaxNodeRef |
31 | }; | 31 | }; |
32 | 32 | ||
@@ -906,7 +906,16 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
906 | } | 906 | } |
907 | } | 907 | } |
908 | ast::Expr::RangeExpr(_e) => Ty::Unknown, | 908 | ast::Expr::RangeExpr(_e) => Ty::Unknown, |
909 | ast::Expr::BinExpr(_e) => Ty::Unknown, | 909 | ast::Expr::BinExpr(e) => match e.op() { |
910 | Some(BinOp::BooleanOr) | ||
911 | | Some(BinOp::BooleanAnd) | ||
912 | | Some(BinOp::EqualityTest) | ||
913 | | Some(BinOp::LesserEqualTest) | ||
914 | | Some(BinOp::GreaterEqualTest) | ||
915 | | Some(BinOp::LesserTest) | ||
916 | | Some(BinOp::GreaterTest) => Ty::Bool, | ||
917 | _ => Ty::Unknown, | ||
918 | }, | ||
910 | ast::Expr::Literal(_e) => Ty::Unknown, | 919 | ast::Expr::Literal(_e) => Ty::Unknown, |
911 | }; | 920 | }; |
912 | // use a new type variable if we got Ty::Unknown here | 921 | // use a new type variable if we got Ty::Unknown here |