...
1# Note: the output here is wrong. Reported as cuelang.org/issue/2342
2exec cue eval -i -c cycle.cue
3cmp stdout expect-stdout-cue
4
5-- frontmatter.toml --
6title = "Reference Cycles"
7description = ""
8
9-- text.md --
10CUE can handle many types of cycles just fine.
11Because all values are final, a field with a concrete value of, say `200`,
12can only be valid if it is that value.
13So if it is unified with another expression, we can delay the evaluation of
14this until later.
15
16By postponing that evaluation, we can often break cycles.
17This is very useful for template writers that may not know what fields
18a user will want to fill out.
19
20-- cycle.cue --
21// CUE knows how to resolve the following:
22x: 200
23x: y + 100
24y: x - 100
25
26// If a cycle is not broken, CUE will just report it.
27a: b + 100
28b: a - 100
29
30-- expect-stdout-cue --
31x: 200
32y: 100
33a: b + 100
34b: a - 100
View as plain text