# Note: the output here is wrong. Reported as cuelang.org/issue/2342
exec cue eval -i -c cycle.cue
cmp stdout expect-stdout-cue

-- frontmatter.toml --
title = "Reference Cycles"
description = ""

-- text.md --
CUE can handle many types of cycles just fine.
Because all values are final, a field with a concrete value of, say `200`,
can only be valid if it is that value.
So if it is unified with another expression, we can delay the evaluation of
this until later.

By postponing that evaluation, we can often break cycles.
This is very useful for template writers that may not know what fields
a user will want to fill out.

-- cycle.cue --
// CUE knows how to resolve the following:
x: 200
x: y + 100
y: x - 100

// If a cycle is not broken, CUE will just report it.
a: b + 100
b: a - 100

-- expect-stdout-cue --
x: 200
y: 100
a: b + 100
b: a - 100
