diff --git a/cue/testdata/eval/disjunctions.txtar b/cue/testdata/eval/disjunctions.txtar index 0c23a351f..5bb6fc2b4 100644 --- a/cue/testdata/eval/disjunctions.txtar +++ b/cue/testdata/eval/disjunctions.txtar @@ -132,16 +132,22 @@ issue641: { } } } +-- issue3406.cue -- +issue3406: { + out: d & { d } + d: kind: "foo" | "bar" + d: { kind: "foo" } | { kind: "bar" } +} -- out/eval/stats -- Leaks: 0 -Freed: 304 -Reused: 292 +Freed: 347 +Reused: 335 Allocs: 12 Retain: 0 -Unifications: 147 -Conjuncts: 564 -Disjuncts: 304 +Unifications: 158 +Conjuncts: 633 +Disjuncts: 347 -- out/evalalpha -- Errors: f.name: conflicting values "int" and "str": @@ -301,6 +307,18 @@ Result: } } } + issue3406: (struct){ + out: (struct){ |((struct){ + kind: (string){ "foo" } + }, (struct){ + kind: (string){ "bar" } + }) } + d: (struct){ |((struct){ + kind: (string){ "foo" } + }, (struct){ + kind: (string){ "bar" } + }) } + } } -- diff/-out/evalalpha<==>+out/eval -- diff old new @@ -530,6 +548,18 @@ Result: } } } + issue3406: (struct){ + out: (struct){ |((struct){ + kind: (string){ "foo" } + }, (struct){ + kind: (string){ "bar" } + }) } + d: (struct){ |((struct){ + kind: (string){ "foo" } + }, (struct){ + kind: (string){ "bar" } + }) } + } } -- out/compile -- --- in.cue @@ -716,3 +746,19 @@ Result: } } } +--- issue3406.cue +{ + issue3406: { + out: (〈0;d〉 & { + 〈1;d〉 + }) + d: { + kind: ("foo"|"bar") + } + d: ({ + kind: "foo" + }|{ + kind: "bar" + }) + } +} diff --git a/internal/core/adt/conjunct.go b/internal/core/adt/conjunct.go index 1ee029a1c..94bd08c7c 100644 --- a/internal/core/adt/conjunct.go +++ b/internal/core/adt/conjunct.go @@ -90,7 +90,13 @@ func (n *nodeContext) scheduleConjunct(c Conjunct, id CloseInfo) { } if id.cc.src != n.node { - panic("inconsistent state: nodes differ") + // TODO(#3406): raise a panic again. + // out: d & { d } + // d: { + // kind: "foo" | "bar" + // { kind: "foo" } | { kind: "bar" } + // } + // panic("inconsistent state: nodes differ") } default: