Fix coercion of last expression in function body

This commit is contained in:
Florian Diebold 2019-12-20 18:27:51 +01:00
parent 99d6f544f2
commit 9c3f00a906
3 changed files with 18 additions and 2 deletions

View file

@ -41,7 +41,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
/// Infer type of expression with possibly implicit coerce to the expected type.
/// Return the type after possible coercion.
fn infer_expr_coerce(&mut self, expr: ExprId, expected: &Expectation) -> Ty {
pub(super) fn infer_expr_coerce(&mut self, expr: ExprId, expected: &Expectation) -> Ty {
let ty = self.infer_expr_inner(expr, &expected);
let ty = if !self.coerce(&ty, &expected.ty) {
self.result