Skip to content

Commit 2fc301a

Browse files
committed
internal/core/adt: disable possible assertion
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]>
1 parent 62865d3 commit 2fc301a

File tree

2 files changed

+134
-10
lines changed

2 files changed

+134
-10
lines changed

cue/testdata/eval/disjunctions.txtar

Lines changed: 126 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,35 @@ issue3490: full: {
161161
#D2: "d2"
162162
}
163163
}
164+
-- issue3434.cue --
165+
issue3434: t1: {
166+
({} | {})
167+
{["x"]: 1}
168+
{["y"]: 2}
169+
}
170+
issue3434: full: {
171+
out: #Schema & {
172+
steps: [{run: "example"}]
173+
}
174+
#Schema: {
175+
steps: [...{run: string}]
176+
#matrixConfig: string | [...#matrixConfig]
177+
matrix?: ({...} | string) & {
178+
{[=~"^foo"]: [...{[string]: #matrixConfig}]}
179+
{[=~"^bar"]: [...#matrixConfig] | string}
180+
}
181+
}
182+
}
164183
-- out/eval/stats --
165184
Leaks: 0
166-
Freed: 426
167-
Reused: 410
185+
Freed: 449
186+
Reused: 433
168187
Allocs: 16
169-
Retain: 25
188+
Retain: 26
170189

171-
Unifications: 197
172-
Conjuncts: 778
173-
Disjuncts: 427
190+
Unifications: 210
191+
Conjuncts: 817
192+
Disjuncts: 451
174193
-- out/evalalpha --
175194
Errors:
176195
f.name: conflicting values "int" and "str":
@@ -353,6 +372,31 @@ Result:
353372
}
354373
}) }
355374
}
375+
issue3434: (struct){
376+
t1: (struct){
377+
}
378+
full: (struct){
379+
out: (#struct){
380+
steps: (#list){
381+
0: (#struct){
382+
run: (string){ "example" }
383+
}
384+
}
385+
#matrixConfig: ((string|list)){ |((string){ string }, (list){
386+
}) }
387+
matrix?: (#struct){
388+
}
389+
}
390+
#Schema: (#struct){
391+
steps: (list){
392+
}
393+
#matrixConfig: ((string|list)){ |((string){ string }, (list){
394+
}) }
395+
matrix?: (#struct){
396+
}
397+
}
398+
}
399+
}
356400
issue3490: (struct){
357401
nested: (struct){
358402
p1: (string){ |((string){ "a" }, (string){ "b" }) }
@@ -635,6 +679,31 @@ Result:
635679
}
636680
}) }
637681
}
682+
issue3434: (struct){
683+
t1: (struct){
684+
}
685+
full: (struct){
686+
out: (#struct){
687+
steps: (#list){
688+
0: (#struct){
689+
run: (string){ "example" }
690+
}
691+
}
692+
#matrixConfig: ((string|list)){ |((string){ string }, (list){
693+
}) }
694+
matrix?: (#struct){
695+
}
696+
}
697+
#Schema: (#struct){
698+
steps: (list){
699+
}
700+
#matrixConfig: ((string|list)){ |((string){ string }, (list){
701+
}) }
702+
matrix?: (#struct){
703+
}
704+
}
705+
}
706+
}
638707
issue3490: (struct){
639708
nested: (struct){
640709
p1: (string){ |((string){ "a" }, (string){ "b" }) }
@@ -886,6 +955,57 @@ Result:
886955
})
887956
}
888957
}
958+
--- issue3434.cue
959+
{
960+
issue3434: {
961+
t1: {
962+
({}|{})
963+
{
964+
["x"]: 1
965+
}
966+
{
967+
["y"]: 2
968+
}
969+
}
970+
}
971+
issue3434: {
972+
full: {
973+
out: (〈0;#Schema〉 & {
974+
steps: [
975+
{
976+
run: "example"
977+
},
978+
]
979+
})
980+
#Schema: {
981+
steps: [
982+
...{
983+
run: string
984+
},
985+
]
986+
#matrixConfig: (string|[
987+
...〈1;#matrixConfig〉,
988+
])
989+
matrix?: (({
990+
...
991+
}|string) & {
992+
{
993+
[=~"^foo"]: [
994+
...{
995+
[string]: 〈4;#matrixConfig〉
996+
},
997+
]
998+
}
999+
{
1000+
[=~"^bar"]: ([
1001+
...〈3;#matrixConfig〉,
1002+
]|string)
1003+
}
1004+
})
1005+
}
1006+
}
1007+
}
1008+
}
8891009
--- issue3490.cue
8901010
{
8911011
issue3490: {

internal/core/adt/overlay.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,18 @@ func (ctx *overlayContext) initCloneCC(x *closeContext) {
344344
// necessary to use overlays.
345345
o.child = x.child
346346
if x.child != nil && x.child.overlay != nil {
347-
// TODO: there seem to be situations where this is possible after all.
348-
// See if this is really true, and we should remove this panic, or if
349-
// this underlies a bug of sorts.
347+
// TODO(evalv3): there seem to be situations where this is possible
348+
// after all. See if this is really true, and we should remove this
349+
// panic, or if this underlies a bug of sorts.
350350
// panic("unexpected overlay in child")
351351
}
352352
o.next = x.next
353353
if x.next != nil && x.next.overlay != nil {
354-
panic("unexpected overlay in next")
354+
// TODO(evalv3): there seem to be situations where this is possible
355+
// after all. See if this is really true, and we should remove this
356+
// panic, or if this underlies a bug of sorts.
357+
// See Issue #3434.
358+
// panic("unexpected overlay in next")
355359
}
356360

357361
for _, d := range x.dependencies {

0 commit comments

Comments
 (0)