diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-13 13:25:33 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-13 13:25:33 +0000 |
commit | ff09d151241cf0bc14cd7ecb015350a77f882969 (patch) | |
tree | 54c6f372f0c5ae4ed91c4819182c1f2129da9141 /crates/ra_hir/src/ty.rs | |
parent | bd2658de2691cf6f322f525a60a0d84bc0b5efc6 (diff) | |
parent | 139da0841d720fc75a3c449c37f9e198cd7dcda9 (diff) |
Merge #520
520: Imprement tuple inference r=flodiebold a=h-michael
related #394
I'm sorry I'm late.
I try implementing array inference next.
Co-authored-by: Hirokazu Hata <[email protected]>
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); |