Type arrow return types first

This commit is contained in:
Louis Gesbert 2022-09-16 18:15:30 +02:00
parent 2c3be946ec
commit 8bf6b5b821
5 changed files with 18 additions and 18 deletions

View File

@ -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 ()

View File

@ -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#
```

View File

@ -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#
```

View File

@ -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:

View File

@ -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: