2021-05-26 21:48:44 +03:00
|
|
|
## 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
|
|
|
|
```
|
2022-07-08 17:23:09 +03:00
|
|
|
|
2022-09-23 15:04:13 +03:00
|
|
|
```catala-test-inline
|
|
|
|
$ catala Interpret -s A
|
|
|
|
[ERROR] Cyclic dependency detected between variables of scope A!
|
|
|
|
|
|
|
|
Cycle variable z, declared:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
7 | context z content integer
|
|
|
|
| ^
|
|
|
|
+ Article
|
|
|
|
|
|
|
|
Used here in the definition of another cycle variable x:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
14 | definition x equals z
|
|
|
|
| ^
|
|
|
|
+ Article
|
|
|
|
|
|
|
|
Cycle variable y, declared:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
6 | context y content integer
|
|
|
|
| ^
|
|
|
|
+ Article
|
|
|
|
|
|
|
|
Used here in the definition of another cycle variable z:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
13 | definition z under condition y < 1 consequence equals y
|
|
|
|
| ^
|
|
|
|
+ Article
|
|
|
|
|
|
|
|
Cycle variable x, declared:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
5 | context x content integer
|
|
|
|
| ^
|
|
|
|
+ Article
|
|
|
|
|
|
|
|
Used here in the definition of another cycle variable y:
|
|
|
|
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
|
|
|
|
|
|
|
|
11 | definition y under condition x >= 0 consequence equals x
|
|
|
|
| ^
|
|
|
|
+ Article
|
2022-07-08 17:23:09 +03:00
|
|
|
```
|