Swap arguments to unify when inferring traces

The first argument shows as what the compiler expects in the error message. So it must be the correct one or the error is actually misleading.
This commit is contained in:
KtorZ 2023-02-16 14:50:45 +01:00 committed by Lucas
parent 8fabfd112e
commit 95e1442b49
1 changed files with 2 additions and 2 deletions

View File

@ -432,7 +432,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
let typed_value = self.infer(value)?; let typed_value = self.infer(value)?;
self.unify(typed_value.tipo(), bool(), typed_value.location(), false)?; self.unify(bool(), typed_value.tipo(), typed_value.location(), false)?;
match self.tracing { match self.tracing {
Tracing::NoTraces => Ok(typed_value), Tracing::NoTraces => Ok(typed_value),
@ -1944,7 +1944,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
text: UntypedExpr, text: UntypedExpr,
) -> Result<TypedExpr, Error> { ) -> Result<TypedExpr, Error> {
let text = self.infer(text)?; let text = self.infer(text)?;
self.unify(text.tipo(), string(), text.location(), false)?; self.unify(string(), text.tipo(), text.location(), false)?;
let then = self.infer(then)?; let then = self.infer(then)?;
let tipo = then.tipo(); let tipo = then.tipo();