diff --git a/compiler/dcalc/typing.ml b/compiler/dcalc/typing.ml index 3b3eefc0..a5c221be 100644 --- a/compiler/dcalc/typing.ml +++ b/compiler/dcalc/typing.ml @@ -128,8 +128,8 @@ let rec unify match Marked.unmark t1_repr, Marked.unmark t2_repr with | TLit tl1, TLit tl2 -> if tl1 <> tl2 then raise_type_error () | TArrow (t11, t12), TArrow (t21, t22) -> - unify e t11 t21; - unify e t12 t22 + unify e t12 t22; + unify e t11 t21 | TTuple ts1, TTuple ts2 -> if List.length ts1 = List.length ts2 then List.iter2 (unify e) ts1 ts2 else raise_type_error () diff --git a/tests/test_array/bad/fold_error.catala_en b/tests/test_array/bad/fold_error.catala_en index 9904f45d..4df68c4b 100644 --- a/tests/test_array/bad/fold_error.catala_en +++ b/tests/test_array/bad/fold_error.catala_en @@ -13,8 +13,8 @@ scope A: ```catala-test-inline $ catala Interpret -s A [ERROR] Error during typechecking, incompatible types: ---> money --> integer +--> money Error coming from typechecking the following expression: --> tests/test_array/bad/fold_error.catala_en @@ -23,18 +23,18 @@ Error coming from typechecking the following expression: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Article -Type money coming from expression: - --> tests/test_array/bad/fold_error.catala_en - | -10 | definition list_high_count equals number for m in list of (m >=$ $7) - | ^^ - + Article - Type integer coming from expression: --> tests/test_array/bad/fold_error.catala_en - | + | 5 | context list content collection integer | ^^^^^^^ + Article + +Type money coming from expression: + --> tests/test_array/bad/fold_error.catala_en + | +10 | definition list_high_count equals number for m in list of (m >=$ $7) + | ^^ + + Article #return code 255# ``` diff --git a/tests/test_bool/bad/test_xor_with_int.catala_en b/tests/test_bool/bad/test_xor_with_int.catala_en index fd6ecace..3529f8d8 100644 --- a/tests/test_bool/bad/test_xor_with_int.catala_en +++ b/tests/test_bool/bad/test_xor_with_int.catala_en @@ -32,7 +32,7 @@ Type integer coming from expression: --> tests/test_bool/bad/test_xor_with_int.catala_en | 8 | definition test_var equals 10 xor 20 - | ^^ + | ^^ + 'xor' should be a boolean operator #return code 255# ``` diff --git a/tests/test_typing/bad/err2.catala_en b/tests/test_typing/bad/err2.catala_en index 64afa818..c8cf7d51 100644 --- a/tests/test_typing/bad/err2.catala_en +++ b/tests/test_typing/bad/err2.catala_en @@ -13,7 +13,7 @@ scope S: ```catala-test-inline $ catala Typecheck [ERROR] Error during typechecking, incompatible types: ---> Structure array +--> any[10] array --> decimal Error coming from typechecking the following expression: @@ -23,11 +23,11 @@ Error coming from typechecking the following expression: | ^^^^^^^^ + -Type Structure array coming from expression: - --> tests/test_typing/bad/common.catala_en +Type any[10] array coming from expression: + --> tests/test_typing/bad/err2.catala_en | -14 | output z content collection Structure - | ^^^^^^^^^^^^^^^^^^^^ +10 | definition a equals number of (z ++ 1.1) / 2 + | ^^ + Type decimal coming from expression: diff --git a/tests/test_typing/bad/err3.catala_en b/tests/test_typing/bad/err3.catala_en index 91b536cd..ae41cfdc 100644 --- a/tests/test_typing/bad/err3.catala_en +++ b/tests/test_typing/bad/err3.catala_en @@ -35,7 +35,7 @@ Type integer coming from expression: --> tests/test_typing/bad/err3.catala_en | 10 | definition a equals number of (z ++ z) / 2 - | ^ + | ^^^^^^ + Type decimal coming from expression: