diff --git a/cue/testdata/eval/disjunctions.txtar b/cue/testdata/eval/disjunctions.txtar index 04dc7c90004..a633ac16703 100644 --- a/cue/testdata/eval/disjunctions.txtar +++ b/cue/testdata/eval/disjunctions.txtar @@ -161,16 +161,35 @@ issue3490: full: { #D2: "d2" } } +-- issue3434.cue -- +issue3434: t1: { + ({} | {}) + {["x"]: 1} + {["y"]: 2} +} +issue3434: full: { + out: #Schema & { + steps: [{run: "example"}] + } + #Schema: { + steps: [...{run: string}] + #matrixConfig: string | [...#matrixConfig] + matrix?: ({...} | string) & { + {[=~"^foo"]: [...{[string]: #matrixConfig}]} + {[=~"^bar"]: [...#matrixConfig] | string} + } + } +} -- out/eval/stats -- Leaks: 0 -Freed: 426 -Reused: 410 +Freed: 449 +Reused: 433 Allocs: 16 -Retain: 25 +Retain: 26 -Unifications: 197 -Conjuncts: 778 -Disjuncts: 427 +Unifications: 210 +Conjuncts: 817 +Disjuncts: 451 -- out/evalalpha -- Errors: f.name: conflicting values "int" and "str": @@ -353,6 +372,31 @@ Result: } }) } } + issue3434: (struct){ + t1: (struct){ + } + full: (struct){ + out: (#struct){ + steps: (#list){ + 0: (#struct){ + run: (string){ "example" } + } + } + #matrixConfig: ((string|list)){ |((string){ string }, (list){ + }) } + matrix?: (#struct){ + } + } + #Schema: (#struct){ + steps: (list){ + } + #matrixConfig: ((string|list)){ |((string){ string }, (list){ + }) } + matrix?: (#struct){ + } + } + } + } issue3490: (struct){ nested: (struct){ p1: (string){ |((string){ "a" }, (string){ "b" }) } @@ -635,6 +679,31 @@ Result: } }) } } + issue3434: (struct){ + t1: (struct){ + } + full: (struct){ + out: (#struct){ + steps: (#list){ + 0: (#struct){ + run: (string){ "example" } + } + } + #matrixConfig: ((string|list)){ |((string){ string }, (list){ + }) } + matrix?: (#struct){ + } + } + #Schema: (#struct){ + steps: (list){ + } + #matrixConfig: ((string|list)){ |((string){ string }, (list){ + }) } + matrix?: (#struct){ + } + } + } + } issue3490: (struct){ nested: (struct){ p1: (string){ |((string){ "a" }, (string){ "b" }) } @@ -886,6 +955,57 @@ Result: }) } } +--- issue3434.cue +{ + issue3434: { + t1: { + ({}|{}) + { + ["x"]: 1 + } + { + ["y"]: 2 + } + } + } + issue3434: { + full: { + out: (〈0;#Schema〉 & { + steps: [ + { + run: "example" + }, + ] + }) + #Schema: { + steps: [ + ...{ + run: string + }, + ] + #matrixConfig: (string|[ + ...〈1;#matrixConfig〉, + ]) + matrix?: (({ + ... + }|string) & { + { + [=~"^foo"]: [ + ...{ + [string]: 〈4;#matrixConfig〉 + }, + ] + } + { + [=~"^bar"]: ([ + ...〈3;#matrixConfig〉, + ]|string) + } + }) + } + } + } +} --- issue3490.cue { issue3490: { diff --git a/internal/core/adt/overlay.go b/internal/core/adt/overlay.go index 21619fce1c1..de680121a6f 100644 --- a/internal/core/adt/overlay.go +++ b/internal/core/adt/overlay.go @@ -344,14 +344,18 @@ func (ctx *overlayContext) initCloneCC(x *closeContext) { // necessary to use overlays. o.child = x.child if x.child != nil && x.child.overlay != nil { - // TODO: there seem to be situations where this is possible after all. - // See if this is really true, and we should remove this panic, or if - // this underlies a bug of sorts. + // TODO(evalv3): there seem to be situations where this is possible + // after all. See if this is really true, and we should remove this + // panic, or if this underlies a bug of sorts. // panic("unexpected overlay in child") } o.next = x.next if x.next != nil && x.next.overlay != nil { - panic("unexpected overlay in next") + // TODO(evalv3): there seem to be situations where this is possible + // after all. See if this is really true, and we should remove this + // panic, or if this underlies a bug of sorts. + // See Issue #3434. + // panic("unexpected overlay in next") } for _, d := range x.dependencies {