cue: implement IsClosed and IsClosedRecursively
Implement IsClosed() and IsClosedRecursively() methods
for Value type. Both methods use DerefValue() to get the
non-forwarded node, ensuring correct behavior with
structure sharing.
IsClosed() returns true if the value is closed either
non-recursively (via close() builtin) or recursively
(via definition reference).
IsClosedRecursively() returns true only if the value is
recursively closed by being referenced as a definition.
Add comprehensive tests covering:
- Open vs closed structs
- close() builtin and definitions
- Structure sharing scenarios
- Disjunctions with various closedness combinations
- Pattern constraints
- Edge cases with scalars and lists
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I7e7ab1b152619bf034d0e01e338f2fb05577d610
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1224363
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
authored by