Extract coercion logic to InferenceTable

To make it accessible without an InferenceContext.
This commit is contained in:
Florian Diebold 2022-03-20 13:42:47 +01:00
parent 6a0b199c82
commit 6133e6a002
2 changed files with 34 additions and 18 deletions

View file

@ -67,7 +67,7 @@ impl<'a> InferenceContext<'a> {
let ty = self.infer_expr_inner(expr, expected);
if let Some(target) = expected.only_has_type(&mut self.table) {
match self.coerce(Some(expr), &ty, &target) {
Ok(res) => res.value,
Ok(res) => res,
Err(_) => {
self.result
.type_mismatches