catala/tests/tuples/good/tuples.catala_en
2024-05-03 15:27:06 +02:00

50 lines
933 B
Plaintext

```catala
declaration structure Str:
data x1 content (integer, date)
declaration enumeration En:
-- One content Str
-- Two content (integer, Str)
declaration str content Str equals
Str { --x1: (12, |2001-01-01|) }
declaration f2 content decimal
depends on str content Str,
en content En
equals
match en with pattern
-- One of str1:
let a equals str.x1.1 in
let (b, w) equals str1.x1 in
a / b
-- Two of z:
let (z1, z2) equals z in z1 / 2
declaration scope Test:
output o content (date, decimal)
scope Test:
definition o equals
(|2001-01-03|,
f2 of str, Two content (12, str))
```
```catala-test-inline
$ catala typecheck --check-invariants
┌─[RESULT]─
│ All invariant checks passed
└─
┌─[RESULT]─
│ Typechecking successful!
└─
```
```catala-test-inline
$ catala test-scope Test
┌─[RESULT]─
│ o = (2001-01-03, 6.0)
└─
```