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:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user