Commit 25f2780
fix(simplecue): guard declareDisjunction against over-filtering when Equals() is unreliable in CUE v0.16
In CUE v0.16, Equals() returns true for structurally-equivalent open
lists regardless of their element type: [...bool].Equals([...string])
and [...bool].Equals([]) both return true. The implicit default for any
open list is the empty closed list [].
The existing filter that strips the "default branch" from a disjunction
used `branch.Equals(defaultAsCueValue)`. For `[...bool] | [...string]`,
hasDefault=true with defaultAsCueValue=[], and both branches compared
equal to [] — so both were filtered, leaving an empty branch list.
Fix: count how many branches match the default before filtering. Only
remove a branch when exactly one branch matches — the unambiguous case
where that branch IS the default. When multiple branches match (as with
open lists in v0.16), skip filtering entirely to preserve all branches.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent b0f7009 commit 25f2780
1 file changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
599 | 617 | | |
600 | 618 | | |
601 | | - | |
| 619 | + | |
602 | 620 | | |
603 | 621 | | |
604 | 622 | | |
| |||
0 commit comments