Skip to content

Commit

Permalink
internal/core/adt: disable possible assertion
Browse files Browse the repository at this point in the history
We will still need to investigate why exactly this
is possible, but it doesn't seem to harm to disable
the assertion.

Fixes #3434

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: If7aa4c18f4d0d4642cbeb65a85034e4b99c630ed
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202775
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mpvl committed Oct 21, 2024
1 parent 62865d3 commit 2fc301a
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 10 deletions.
132 changes: 126 additions & 6 deletions cue/testdata/eval/disjunctions.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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" }) }
Expand Down Expand Up @@ -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" }) }
Expand Down Expand Up @@ -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: {
Expand Down
12 changes: 8 additions & 4 deletions internal/core/adt/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2fc301a

Please sign in to comment.