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

44 lines
1.2 KiB
Plaintext

## Article
```catala
declaration scope A:
context x content integer
context y content integer
context z content integer
scope A:
definition y under condition x < 0 consequence equals - x
definition y under condition x >= 0 consequence equals x
definition z under condition y >= 1 consequence equals 10 / y
definition z under condition y < 1 consequence equals y
definition x equals z
```
```catala-test-inline
$ catala Interpret -s A
[ERROR] Cyclic dependency detected between the following variables of scope A:
z → x → y → z
z is used here in the definition of x:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:14.23-14.24:
└──┐
14 │ definition x equals z
│ ‾
└─ Article
x is used here in the definition of y:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:11.32-11.33:
└──┐
11 │ definition y under condition x >= 0 consequence equals x
│ ‾
└─ Article
y is used here in the definition of z:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:13.32-13.33:
└──┐
13 │ definition z under condition y < 1 consequence equals y
│ ‾
└─ Article
#return code 255#
```