catala/tests/test_typing/bad/err5.catala_en
Louis Gesbert 498429e4b7 Fix type-checking error getting delayed
The issue was coming from Bindlib: it stores variable bindings as closures, so
`Bindlib.box_apply f bx` actually delays the application of `f` until the term
is substituted or unboxed (likely long after we are out of the `try..with`
block).

The proposed fix is to make sure we run the wrapper outside of bindlib
applications, on explicitely unboxed terms.
2022-09-26 14:11:25 +02:00

41 lines
858 B
Plaintext

> Include: common.catala_en
```catala
scope S:
definition z equals [
Structure { -- i: 3 -- e: Int content x };
Structure { -- i: 4 -- e: y };
1040
]
definition a equals number of (z ++ z) / 2
```
```catala-test-inline
$ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
--> decimal
--> integer
Error coming from typechecking the following expression:
--> tests/test_typing/bad/common.catala_en
|
15 | output a content decimal
| ^
+
Type decimal coming from expression:
--> tests/test_typing/bad/common.catala_en
|
15 | output a content decimal
| ^^^^^^^
+
Type integer coming from expression:
--> tests/test_typing/bad/err5.catala_en
|
10 | definition a equals number of (z ++ z) / 2
| ^^^^^^
+
#return code 255#
```