Skip to content

Commit

Permalink
internal/core/adt: add tests for Issue 3528
Browse files Browse the repository at this point in the history
Issue #3528

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I39ccfcf56bc1651ad013edff3d29a859d75cce34
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1206177
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Matthew Sackman <[email protected]>
  • Loading branch information
mpvl committed Dec 20, 2024
1 parent 80743ca commit 8f55942
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 8 deletions.
237 changes: 230 additions & 7 deletions cue/testdata/disjunctions/elimination.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,40 @@ issue770: {
h: c: _
h: coo: _
}
-- issue3528.cue --
issue3528: original: {
workflows: [...#Workflow]
workflows: [test]

test: #Workflow & {}

#Workflow: {
container: [string]: string | #container
#container: string | {volumes?: [...string]}
}
}
issue3528: reduced: {
a?: #A
a: #A & {}
#A: {
A: [string]: 1 | #a
#a: 2 | {v: 1}
}
}
issue3528: counter: {
}
issue3528: nested: t1: {
{v: 1} | (2 | 3)
{v: 1} | (2 | 3)
{v: 1} | (2 | 3)
{v: 1} | (2 | 3)
}
issue3528: nested: t2: {
{v: 1} | 2
{v: 1} | (2 | 3)
{v: 1} | 2
{v: 1} | 2
}
-- out/evalalpha --
(struct){
disambiguateClosed: (struct){
Expand Down Expand Up @@ -1392,6 +1426,62 @@ issue770: {
}
}
}
issue3528: (struct){
original: (struct){
workflows: (#list){
0: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
}
test: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
#Workflow: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
}
reduced: (struct){
a: (#struct){
A: (#struct){
}
#a: ((int|struct)){ |((int){ 2 }, (#struct){
v: (int){ 1 }
}) }
}
#A: (#struct){
A: (#struct){
}
#a: ((int|struct)){ |((int){ 2 }, (#struct){
v: (int){ 1 }
}) }
}
}
counter: (struct){
}
nested: (struct){
t1: ((int|struct)){ |((struct){
v: (int){ 1 }
}, (int){ 2 }, (int){ 3 }) }
t2: ((int|struct)){ |((struct){
v: (int){ 1 }
}, (int){ 2 }) }
}
}
issue770: (struct){
#A: (#struct){
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
Expand Down Expand Up @@ -2271,7 +2361,7 @@ diff old new
}
}
}
@@ -1078,10 +879,10 @@
@@ -1134,10 +935,10 @@
v: (string){ |(*(string){ "a" }, (string){ "b" }, (string){ "c" }) }
}
c: (#struct){
Expand All @@ -2286,14 +2376,14 @@ diff old new
}
-- out/eval/stats --
Leaks: 4
Freed: 2554
Reused: 2538
Freed: 2684
Reused: 2668
Allocs: 20
Retain: 115
Retain: 118

Unifications: 1292
Conjuncts: 3726
Disjuncts: 2669
Unifications: 1350
Conjuncts: 3905
Disjuncts: 2802
-- diff/todo/p1 --
issue2263.full: missing elimination, may be lack of closeContext
-- diff/todo/p2 --
Expand Down Expand Up @@ -3373,6 +3463,62 @@ Result:
}
}
}
issue3528: (struct){
original: (struct){
workflows: (#list){
0: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
}
test: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
#Workflow: (#struct){
container: (#struct){
}
#container: ((string|struct)){ |((string){ string }, (#struct){
volumes?: (list){
}
}) }
}
}
reduced: (struct){
a: (#struct){
A: (#struct){
}
#a: ((int|struct)){ |((int){ 2 }, (#struct){
v: (int){ 1 }
}) }
}
#A: (#struct){
A: (#struct){
}
#a: ((int|struct)){ |((int){ 2 }, (#struct){
v: (int){ 1 }
}) }
}
}
counter: (struct){
}
nested: (struct){
t1: ((int|struct)){ |((struct){
v: (int){ 1 }
}, (int){ 2 }, (int){ 3 }) }
t2: ((int|struct)){ |((struct){
v: (int){ 1 }
}, (int){ 2 }) }
}
}
issue770: (struct){
#A: (#struct){
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
Expand Down Expand Up @@ -4459,6 +4605,83 @@ Result:
]
}
}
--- issue3528.cue
{
issue3528: {
original: {
workflows: [
...〈1;#Workflow〉,
]
workflows: [
〈1;test〉,
]
test: (〈0;#Workflow〉 & {})
#Workflow: {
container: {
[string]: (string|〈1;#container〉)
}
#container: (string|{
volumes?: [
...string,
]
})
}
}
}
issue3528: {
reduced: {
a?: 〈0;#A〉
a: (〈0;#A〉 & {})
#A: {
A: {
[string]: (1|〈1;#a〉)
}
#a: (2|{
v: 1
})
}
}
}
issue3528: {
counter: {}
}
issue3528: {
nested: {
t1: {
({
v: 1
}|(2|3))
({
v: 1
}|(2|3))
({
v: 1
}|(2|3))
({
v: 1
}|(2|3))
}
}
}
issue3528: {
nested: {
t2: {
({
v: 1
}|2)
({
v: 1
}|(2|3))
({
v: 1
}|2)
({
v: 1
}|2)
}
}
}
}
--- issue770.cue
{
issue770: {
Expand Down
2 changes: 1 addition & 1 deletion internal/core/adt/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var skipDebugDepErrors = map[string]int{
"cycle/disjunction": 4,
"cycle/structural": 14,
"disjunctions/edge": 1,
"disjunctions/elimination": 8,
"disjunctions/elimination": 11,
"disjunctions/embed": 6,
"eval/conjuncts": 4,
"eval/notify": 17,
Expand Down

0 comments on commit 8f55942

Please sign in to comment.