diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-28 20:43:13 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-28 20:43:13 +0000 |
commit | 48d2acb297459fb06cbb49bdce2eccb4c2591714 (patch) | |
tree | 8f447c656a44f77a512f8b02d505619895b79bfc /crates/ra_hir/src/ty.rs | |
parent | a238cb519a96642ab03ff989783bbee5149f9334 (diff) | |
parent | ec32b2e39cb95fc1a9015379de6fe71f230c873d (diff) |
Merge #698
698: Added support for primitive types type inference with std::ops::Not r=flodiebold a=WizardOfMenlo
On the guideline of #544 , this allows for type inference for all primitive types implementing [std::ops::Not](https://doc.rust-lang.org/beta/std/ops/trait.Not.html). I think this should be relevant #394 as well?
Co-authored-by: WizardOfMenlo <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 37715a903..7a5485698 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -1588,9 +1588,13 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1588 | _ => Ty::Unknown, | 1588 | _ => Ty::Unknown, |
1589 | } | 1589 | } |
1590 | } | 1590 | } |
1591 | UnaryOp::Not if inner_ty == Ty::Bool => Ty::Bool, | 1591 | UnaryOp::Not => { |
1592 | // TODO: resolve ops::Not trait for inner_ty | 1592 | match inner_ty { |
1593 | UnaryOp::Not => Ty::Unknown, | 1593 | Ty::Bool | Ty::Int(_) | Ty::Infer(InferTy::IntVar(..)) => inner_ty, |
1594 | // TODO: resolve ops::Not trait for inner_ty | ||
1595 | _ => Ty::Unknown, | ||
1596 | } | ||
1597 | } | ||
1594 | } | 1598 | } |
1595 | } | 1599 | } |
1596 | Expr::BinaryOp { lhs, rhs, op } => match op { | 1600 | Expr::BinaryOp { lhs, rhs, op } => match op { |