From 95e1442b4971bc17a828ceb433d5570883986ebb Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 16 Feb 2023 14:50:45 +0100 Subject: [PATCH] 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. --- crates/aiken-lang/src/tipo/expr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/aiken-lang/src/tipo/expr.rs b/crates/aiken-lang/src/tipo/expr.rs index a7a1a0a0..f2caea17 100644 --- a/crates/aiken-lang/src/tipo/expr.rs +++ b/crates/aiken-lang/src/tipo/expr.rs @@ -432,7 +432,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { 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 { Tracing::NoTraces => Ok(typed_value), @@ -1944,7 +1944,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { text: UntypedExpr, ) -> Result { 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 tipo = then.tipo();