catala/tests/test_typing/bad/err3.catala_en
2023-04-27 12:09:22 +02:00

86 lines
2.4 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
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
└─┐
4 │ -- Dec content decimal
│ ‾‾‾
[ERROR] Error during typechecking, incompatible types:
--> integer
--> decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
└──┐
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
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
└─┐
4 │ -- Dec content decimal
│ ‾‾‾
[ERROR] Error during typechecking, incompatible types:
--> integer
--> decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
└──┐
15 │ output a content decimal
│ ‾‾‾‾‾‾‾
#return code 255#
```