2021-05-26 21:48:44 +03:00
|
|
|
## Article
|
|
|
|
|
|
|
|
```catala
|
|
|
|
declaration structure Foo:
|
|
|
|
data f content integer
|
|
|
|
|
|
|
|
declaration structure Bar:
|
|
|
|
data f content integer
|
|
|
|
|
|
|
|
declaration scope A:
|
2022-02-07 14:04:48 +03:00
|
|
|
context output x content Foo
|
|
|
|
context output y content integer
|
2021-05-26 21:48:44 +03:00
|
|
|
|
|
|
|
scope A:
|
|
|
|
definition x equals Foo { -- f: 1 }
|
|
|
|
definition y equals x.Foo.f
|
|
|
|
```
|
2022-07-08 17:23:09 +03:00
|
|
|
|
2022-09-23 15:04:13 +03:00
|
|
|
```catala-test-inline
|
|
|
|
$ catala Interpret -s A
|
2023-03-31 18:56:45 +03:00
|
|
|
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
|
2023-03-31 15:01:04 +03:00
|
|
|
|
2023-09-26 12:42:46 +03:00
|
|
|
┌─⯈ tests/test_struct/good/same_name_fields.catala_en:7.23-7.26:
|
2023-03-31 15:01:04 +03:00
|
|
|
└─┐
|
2023-03-31 18:56:45 +03:00
|
|
|
7 │ declaration structure Bar:
|
|
|
|
│ ‾‾‾
|
2023-03-31 15:01:04 +03:00
|
|
|
└─ Article
|
2022-09-23 15:04:13 +03:00
|
|
|
[RESULT] Computation successful! Results:
|
2023-07-03 17:14:22 +03:00
|
|
|
[RESULT] x = Foo { -- f: 1 }
|
2022-09-23 15:04:13 +03:00
|
|
|
[RESULT] y = 1
|
2022-07-08 17:23:09 +03:00
|
|
|
```
|
2023-04-14 18:59:08 +03:00
|
|
|
```catala-test-inline
|
|
|
|
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
|
|
|
|
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
|
|
|
|
|
2023-09-26 12:42:46 +03:00
|
|
|
┌─⯈ tests/test_struct/good/same_name_fields.catala_en:7.23-7.26:
|
2023-04-14 18:59:08 +03:00
|
|
|
└─┐
|
|
|
|
7 │ declaration structure Bar:
|
|
|
|
│ ‾‾‾
|
|
|
|
└─ Article
|
|
|
|
[RESULT] Computation successful! Results:
|
2023-11-15 16:11:04 +03:00
|
|
|
[RESULT] x = Foo { -- f: 1 }
|
|
|
|
[RESULT] y = 1
|
2023-04-14 18:59:08 +03:00
|
|
|
```
|