catala/tests/test_typing/bad/err3.catala_en
2022-11-28 16:38:09 +01:00

72 lines
1.9 KiB
Plaintext

> Include: common.catala_en
```catala
scope S:
definition z equals [
Structure { -- i: 3 -- e: Int content x };
Structure { -- i: 4 -- e: y };
Structure { -- i: 5 -- e: Dat content |1970-01-01| }
]
definition a equals number of (z ++ z) / 2
```
```catala-test-inline
$ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
--> integer
--> decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.41-42:
└──┐
10 │ definition a equals number of (z ++ z) / 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.41-42:
└──┐
10 │ definition a equals number of (z ++ z) / 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.19-26:
└──┐
15 │ output a content decimal
│ ‾‾‾‾‾‾‾
#return code 255#
```
Re-putting the same check again, to ensure that the `Typecheck` and `ocaml` subcommands output the same type error consistently (bug pointed out and fixed in 498429e).
```catala-test-inline
$ catala ocaml
[ERROR] Error during typechecking, incompatible types:
--> integer
--> decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.41-42:
└──┐
10 │ definition a equals number of (z ++ z) / 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.41-42:
└──┐
10 │ definition a equals number of (z ++ z) / 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.19-26:
└──┐
15 │ output a content decimal
│ ‾‾‾‾‾‾‾
#return code 255#
```