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
|
|
|
|
2023-12-05 18:56:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
```catala-test-inline
|
2023-12-05 14:00:15 +03:00
|
|
|
$ catala Typecheck --check-invariants
|
2024-05-03 13:20:09 +03:00
|
|
|
┌─[WARNING]─
|
|
|
|
│
|
|
|
|
│ The structure "Bar" is never used; maybe it's unnecessary?
|
|
|
|
│
|
|
|
|
├─➤ tests/struct/good/same_name_fields.catala_en:7.23-7.26:
|
|
|
|
│ │
|
|
|
|
│ 7 │ declaration structure Bar:
|
|
|
|
│ │ ‾‾‾
|
|
|
|
└─ Article
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ All invariant checks passed
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ Typechecking successful!
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
2023-12-05 18:56:59 +03:00
|
|
|
```
|
|
|
|
|
2022-09-23 15:04:13 +03:00
|
|
|
```catala-test-inline
|
2024-02-26 12:18:08 +03:00
|
|
|
$ catala test-scope A
|
2024-05-03 13:20:09 +03:00
|
|
|
┌─[WARNING]─
|
|
|
|
│
|
|
|
|
│ The structure "Bar" is never used; maybe it's unnecessary?
|
|
|
|
│
|
|
|
|
├─➤ tests/struct/good/same_name_fields.catala_en:7.23-7.26:
|
|
|
|
│ │
|
|
|
|
│ 7 │ declaration structure Bar:
|
|
|
|
│ │ ‾‾‾
|
|
|
|
└─ Article
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ x = Foo { -- f: 1 }
|
|
|
|
│ y = 1
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
2023-04-14 18:59:08 +03:00
|
|
|
```
|