diff options
author | Hirokazu Hata <[email protected]> | 2019-01-13 12:00:27 +0000 |
---|---|---|
committer | Hirokazu Hata <[email protected]> | 2019-01-13 12:10:01 +0000 |
commit | 6e73cc89b6f2e0086a3261489811f221ee7deaa8 (patch) | |
tree | b5ebd108b601a3a89642d5ba077780f1d0bec07d /crates/ra_hir/src/ty.rs | |
parent | 6efda8f6cefdd69c3bae892eb168971a465d2a8b (diff) |
Implement tuple inference
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 5d5568d69..0692d3b2a 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -1040,6 +1040,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1040 | } | 1040 | } |
1041 | _ => Ty::Unknown, | 1041 | _ => Ty::Unknown, |
1042 | }, | 1042 | }, |
1043 | Expr::Tuple { exprs } => { | ||
1044 | let mut ty_vec = Vec::with_capacity(exprs.len()); | ||
1045 | for arg in exprs.iter() { | ||
1046 | ty_vec.push(self.infer_expr(*arg, &Expectation::none())?); | ||
1047 | } | ||
1048 | |||
1049 | Ty::Tuple(Arc::from(ty_vec)) | ||
1050 | } | ||
1043 | }; | 1051 | }; |
1044 | // use a new type variable if we got Ty::Unknown here | 1052 | // use a new type variable if we got Ty::Unknown here |
1045 | let ty = self.insert_type_vars_shallow(ty); | 1053 | let ty = self.insert_type_vars_shallow(ty); |