Skip to content

Commit 8f55942

Browse files
committed
internal/core/adt: add tests for Issue 3528
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]>
1 parent 80743ca commit 8f55942

File tree

2 files changed

+231
-8
lines changed

2 files changed

+231
-8
lines changed

cue/testdata/disjunctions/elimination.txtar

Lines changed: 230 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,40 @@ issue770: {
525525
h: c: _
526526
h: coo: _
527527
}
528+
-- issue3528.cue --
529+
issue3528: original: {
530+
workflows: [...#Workflow]
531+
workflows: [test]
532+
533+
test: #Workflow & {}
534+
535+
#Workflow: {
536+
container: [string]: string | #container
537+
#container: string | {volumes?: [...string]}
538+
}
539+
}
540+
issue3528: reduced: {
541+
a?: #A
542+
a: #A & {}
543+
#A: {
544+
A: [string]: 1 | #a
545+
#a: 2 | {v: 1}
546+
}
547+
}
548+
issue3528: counter: {
549+
}
550+
issue3528: nested: t1: {
551+
{v: 1} | (2 | 3)
552+
{v: 1} | (2 | 3)
553+
{v: 1} | (2 | 3)
554+
{v: 1} | (2 | 3)
555+
}
556+
issue3528: nested: t2: {
557+
{v: 1} | 2
558+
{v: 1} | (2 | 3)
559+
{v: 1} | 2
560+
{v: 1} | 2
561+
}
528562
-- out/evalalpha --
529563
(struct){
530564
disambiguateClosed: (struct){
@@ -1392,6 +1426,62 @@ issue770: {
13921426
}
13931427
}
13941428
}
1429+
issue3528: (struct){
1430+
original: (struct){
1431+
workflows: (#list){
1432+
0: (#struct){
1433+
container: (#struct){
1434+
}
1435+
#container: ((string|struct)){ |((string){ string }, (#struct){
1436+
volumes?: (list){
1437+
}
1438+
}) }
1439+
}
1440+
}
1441+
test: (#struct){
1442+
container: (#struct){
1443+
}
1444+
#container: ((string|struct)){ |((string){ string }, (#struct){
1445+
volumes?: (list){
1446+
}
1447+
}) }
1448+
}
1449+
#Workflow: (#struct){
1450+
container: (#struct){
1451+
}
1452+
#container: ((string|struct)){ |((string){ string }, (#struct){
1453+
volumes?: (list){
1454+
}
1455+
}) }
1456+
}
1457+
}
1458+
reduced: (struct){
1459+
a: (#struct){
1460+
A: (#struct){
1461+
}
1462+
#a: ((int|struct)){ |((int){ 2 }, (#struct){
1463+
v: (int){ 1 }
1464+
}) }
1465+
}
1466+
#A: (#struct){
1467+
A: (#struct){
1468+
}
1469+
#a: ((int|struct)){ |((int){ 2 }, (#struct){
1470+
v: (int){ 1 }
1471+
}) }
1472+
}
1473+
}
1474+
counter: (struct){
1475+
}
1476+
nested: (struct){
1477+
t1: ((int|struct)){ |((struct){
1478+
v: (int){ 1 }
1479+
}, (int){ 2 }, (int){ 3 }) }
1480+
t2: ((int|struct)){ |((struct){
1481+
v: (int){ 1 }
1482+
}, (int){ 2 }) }
1483+
}
1484+
}
13951485
issue770: (struct){
13961486
#A: (#struct){
13971487
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
@@ -2271,7 +2361,7 @@ diff old new
22712361
}
22722362
}
22732363
}
2274-
@@ -1078,10 +879,10 @@
2364+
@@ -1134,10 +935,10 @@
22752365
v: (string){ |(*(string){ "a" }, (string){ "b" }, (string){ "c" }) }
22762366
}
22772367
c: (#struct){
@@ -2286,14 +2376,14 @@ diff old new
22862376
}
22872377
-- out/eval/stats --
22882378
Leaks: 4
2289-
Freed: 2554
2290-
Reused: 2538
2379+
Freed: 2684
2380+
Reused: 2668
22912381
Allocs: 20
2292-
Retain: 115
2382+
Retain: 118
22932383

2294-
Unifications: 1292
2295-
Conjuncts: 3726
2296-
Disjuncts: 2669
2384+
Unifications: 1350
2385+
Conjuncts: 3905
2386+
Disjuncts: 2802
22972387
-- diff/todo/p1 --
22982388
issue2263.full: missing elimination, may be lack of closeContext
22992389
-- diff/todo/p2 --
@@ -3373,6 +3463,62 @@ Result:
33733463
}
33743464
}
33753465
}
3466+
issue3528: (struct){
3467+
original: (struct){
3468+
workflows: (#list){
3469+
0: (#struct){
3470+
container: (#struct){
3471+
}
3472+
#container: ((string|struct)){ |((string){ string }, (#struct){
3473+
volumes?: (list){
3474+
}
3475+
}) }
3476+
}
3477+
}
3478+
test: (#struct){
3479+
container: (#struct){
3480+
}
3481+
#container: ((string|struct)){ |((string){ string }, (#struct){
3482+
volumes?: (list){
3483+
}
3484+
}) }
3485+
}
3486+
#Workflow: (#struct){
3487+
container: (#struct){
3488+
}
3489+
#container: ((string|struct)){ |((string){ string }, (#struct){
3490+
volumes?: (list){
3491+
}
3492+
}) }
3493+
}
3494+
}
3495+
reduced: (struct){
3496+
a: (#struct){
3497+
A: (#struct){
3498+
}
3499+
#a: ((int|struct)){ |((int){ 2 }, (#struct){
3500+
v: (int){ 1 }
3501+
}) }
3502+
}
3503+
#A: (#struct){
3504+
A: (#struct){
3505+
}
3506+
#a: ((int|struct)){ |((int){ 2 }, (#struct){
3507+
v: (int){ 1 }
3508+
}) }
3509+
}
3510+
}
3511+
counter: (struct){
3512+
}
3513+
nested: (struct){
3514+
t1: ((int|struct)){ |((struct){
3515+
v: (int){ 1 }
3516+
}, (int){ 2 }, (int){ 3 }) }
3517+
t2: ((int|struct)){ |((struct){
3518+
v: (int){ 1 }
3519+
}, (int){ 2 }) }
3520+
}
3521+
}
33763522
issue770: (struct){
33773523
#A: (#struct){
33783524
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
@@ -4459,6 +4605,83 @@ Result:
44594605
]
44604606
}
44614607
}
4608+
--- issue3528.cue
4609+
{
4610+
issue3528: {
4611+
original: {
4612+
workflows: [
4613+
...〈1;#Workflow〉,
4614+
]
4615+
workflows: [
4616+
〈1;test〉,
4617+
]
4618+
test: (〈0;#Workflow〉 & {})
4619+
#Workflow: {
4620+
container: {
4621+
[string]: (string|〈1;#container〉)
4622+
}
4623+
#container: (string|{
4624+
volumes?: [
4625+
...string,
4626+
]
4627+
})
4628+
}
4629+
}
4630+
}
4631+
issue3528: {
4632+
reduced: {
4633+
a?: 〈0;#A〉
4634+
a: (〈0;#A〉 & {})
4635+
#A: {
4636+
A: {
4637+
[string]: (1|〈1;#a〉)
4638+
}
4639+
#a: (2|{
4640+
v: 1
4641+
})
4642+
}
4643+
}
4644+
}
4645+
issue3528: {
4646+
counter: {}
4647+
}
4648+
issue3528: {
4649+
nested: {
4650+
t1: {
4651+
({
4652+
v: 1
4653+
}|(2|3))
4654+
({
4655+
v: 1
4656+
}|(2|3))
4657+
({
4658+
v: 1
4659+
}|(2|3))
4660+
({
4661+
v: 1
4662+
}|(2|3))
4663+
}
4664+
}
4665+
}
4666+
issue3528: {
4667+
nested: {
4668+
t2: {
4669+
({
4670+
v: 1
4671+
}|2)
4672+
({
4673+
v: 1
4674+
}|(2|3))
4675+
({
4676+
v: 1
4677+
}|2)
4678+
({
4679+
v: 1
4680+
}|2)
4681+
}
4682+
}
4683+
}
4684+
}
44624685
--- issue770.cue
44634686
{
44644687
issue770: {

internal/core/adt/eval_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var skipDebugDepErrors = map[string]int{
8686
"cycle/disjunction": 4,
8787
"cycle/structural": 14,
8888
"disjunctions/edge": 1,
89-
"disjunctions/elimination": 8,
89+
"disjunctions/elimination": 11,
9090
"disjunctions/embed": 6,
9191
"eval/conjuncts": 4,
9292
"eval/notify": 17,

0 commit comments

Comments
 (0)