diff options
author | Edwin Cheng <[email protected]> | 2019-12-19 04:45:07 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-19 04:45:07 +0000 |
commit | dddee23f43a0e1939124a607ba534e69a810843a (patch) | |
tree | 02fd55e52fcd54b43f218303b9a9fc2fd7d623b0 /crates/ra_hir_ty/src/infer | |
parent | 242f0ae1d8e6766091a6050431c3d417a43a2a3e (diff) |
Add std::ops::Index support for infering
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 924ad3e81..011c6c5c6 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -422,10 +422,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
422 | } | 422 | } |
423 | } | 423 | } |
424 | Expr::Index { base, index } => { | 424 | Expr::Index { base, index } => { |
425 | let _base_ty = self.infer_expr_inner(*base, &Expectation::none()); | 425 | let base_ty = self.infer_expr_inner(*base, &Expectation::none()); |
426 | let _index_ty = self.infer_expr(*index, &Expectation::none()); | 426 | let index_ty = self.infer_expr(*index, &Expectation::none()); |
427 | // FIXME: use `std::ops::Index::Output` to figure out the real return type | 427 | |
428 | Ty::Unknown | 428 | self.resolve_associated_type_with_params( |
429 | base_ty, | ||
430 | self.resolve_ops_index_output(), | ||
431 | &[index_ty], | ||
432 | ) | ||
429 | } | 433 | } |
430 | Expr::Tuple { exprs } => { | 434 | Expr::Tuple { exprs } => { |
431 | let mut tys = match &expected.ty { | 435 | let mut tys = match &expected.ty { |