Commit b0f7009
fix(simplecue): handle CUE v0.16 single-branch Expr() in getReference for Type | *Default structs
In CUE v0.11, Expr() on a value like `VariableOption | *{...}` returned
(NoOp, [typeVertex, defaultVertex]) — two expressions. getReference
relied on len(exprs) == 2 to detect this pattern and extract exprs[0]
as the named reference.
In CUE v0.16, when the default struct is subsumed by the named type,
Expr() filters the default branch and returns (NoOp, [typeVertex]) — a
single expression. The len(exprs) != 2 guard caused an early return of
false, so declareNode fell through to StructKind handling and iterated
the concrete default's fields instead of the abstract type's fields,
generating a wrong anonymous struct type rather than a reference to the
named type.
Fix: allow len(exprs) == 1 as a valid case when op == NoOp and the
single branch has a reference path. We additionally confirm v.Default()
succeeds to rule out unrelated single-expr NoOp values.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 2a988bb commit b0f7009
1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
436 | 439 | | |
437 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
438 | 449 | | |
439 | 450 | | |
440 | 451 | | |
441 | | - | |
442 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
443 | 456 | | |
444 | 457 | | |
445 | 458 | | |
| |||
0 commit comments