Skip to content

Commit fdf8a16

Browse files
mpvlmvdan
authored andcommitted
internal/core/adt: add tests for 3958
Issue #3958 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I6d9ffc7dfa09fc27fdcba4a136dd123d1f357389 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1216864 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217390 Reviewed-by: Roger Peppe <[email protected]>
1 parent 65a5178 commit fdf8a16

File tree

1 file changed

+94
-23
lines changed

1 file changed

+94
-23
lines changed

cue/testdata/disjunctions/elimination.txtar

Lines changed: 94 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,18 @@ issue3784: variant2: {
647647
cname?: string
648648
}
649649
}
650+
-- issue3958.cue --
651+
issue3958: t1: {
652+
#schema: int | *1
653+
#schema: int | *3
654+
655+
test1: #schema & {int | *2}
656+
test2: #schema & {int | *4}
657+
}
658+
issue3958: t2: {
659+
a: (int | *4) & (int | *1) & (int | *3) & (int | *8)
660+
b: (int | *4) & (int | *1) & (int | *3)
661+
}
650662
-- out/evalalpha --
651663
(struct){
652664
disambiguateClosed: (struct){
@@ -1732,6 +1744,17 @@ issue3784: variant2: {
17321744
}
17331745
}
17341746
}
1747+
issue3958: (struct){
1748+
t1: (struct){
1749+
#schema: (int){ |((int){ int }, (int){ 3 }, (int){ 1 }) }
1750+
test1: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 2 }) }
1751+
test2: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 4 }) }
1752+
}
1753+
t2: (struct){
1754+
a: (int){ |((int){ int }, (int){ 8 }, (int){ 3 }, (int){ 1 }, (int){ 4 }) }
1755+
b: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 4 }) }
1756+
}
1757+
}
17351758
issue770: (struct){
17361759
#A: (#struct){
17371760
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
@@ -2608,7 +2631,23 @@ diff old new
26082631
}
26092632
}
26102633
}
2611-
@@ -1216,10 +1097,10 @@
2634+
@@ -1204,12 +1085,12 @@
2635+
issue3958: (struct){
2636+
t1: (struct){
2637+
#schema: (int){ |((int){ int }, (int){ 3 }, (int){ 1 }) }
2638+
- test1: (int){ |((int){ int }, (int){ 2 }, (int){ 3 }, (int){ 1 }) }
2639+
- test2: (int){ |((int){ int }, (int){ 4 }, (int){ 3 }, (int){ 1 }) }
2640+
+ test1: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 2 }) }
2641+
+ test2: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 4 }) }
2642+
}
2643+
t2: (struct){
2644+
a: (int){ |((int){ int }, (int){ 8 }, (int){ 3 }, (int){ 1 }, (int){ 4 }) }
2645+
- b: (int){ |((int){ int }, (int){ 3 }, (int){ 1 }, (int){ 4 }) }
2646+
+ b: (int){ |(*(int){ 3 }, (int){ int }, (int){ 1 }, (int){ 4 }) }
2647+
}
2648+
}
2649+
issue770: (struct){
2650+
@@ -1227,10 +1108,10 @@
26122651
v: (string){ |(*(string){ "a" }, (string){ "b" }, (string){ "c" }) }
26132652
}
26142653
c: (#struct){
@@ -2622,54 +2661,54 @@ diff old new
26222661
}
26232662
}
26242663
-- out/evalalpha/stats --
2625-
Leaks: 2786
2664+
Leaks: 2856
26262665
Freed: 0
26272666
Reused: 0
2628-
Allocs: 2786
2667+
Allocs: 2856
26292668
Retain: 0
26302669

2631-
Unifications: 686
2632-
Conjuncts: 2767
2633-
Disjuncts: 1290
2670+
Unifications: 694
2671+
Conjuncts: 2853
2672+
Disjuncts: 1352
26342673

26352674
CloseIDElems: 6129
2636-
NumCloseIDs: 317
2675+
NumCloseIDs: 321
26372676
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
26382677
diff old new
26392678
--- old
26402679
+++ new
26412680
@@ -1,9 +1,12 @@
26422681
-Leaks: 9
2643-
-Freed: 2786
2644-
-Reused: 2771
2682+
-Freed: 2856
2683+
-Reused: 2841
26452684
-Allocs: 24
26462685
-Retain: 123
26472686
-
2648-
-Unifications: 1427
2649-
-Conjuncts: 4068
2650-
-Disjuncts: 2909
2651-
+Leaks: 2786
2687+
-Unifications: 1435
2688+
-Conjuncts: 4154
2689+
-Disjuncts: 2979
2690+
+Leaks: 2856
26522691
+Freed: 0
26532692
+Reused: 0
2654-
+Allocs: 2786
2693+
+Allocs: 2856
26552694
+Retain: 0
26562695
+
2657-
+Unifications: 686
2658-
+Conjuncts: 2767
2659-
+Disjuncts: 1290
2696+
+Unifications: 694
2697+
+Conjuncts: 2853
2698+
+Disjuncts: 1352
26602699
+
26612700
+CloseIDElems: 6129
2662-
+NumCloseIDs: 317
2701+
+NumCloseIDs: 321
26632702
-- out/eval/stats --
26642703
Leaks: 9
2665-
Freed: 2786
2666-
Reused: 2771
2704+
Freed: 2856
2705+
Reused: 2841
26672706
Allocs: 24
26682707
Retain: 123
26692708

2670-
Unifications: 1427
2671-
Conjuncts: 4068
2672-
Disjuncts: 2909
2709+
Unifications: 1435
2710+
Conjuncts: 4154
2711+
Disjuncts: 2979
26732712
-- diff/todo/p2 --
26742713
noChildError.issue1808.#type: one disjunction options eliminated due to earlier detected structural cycle. May be okay, but investigate.
26752714
issue2209.simplified.full._X: ditto
@@ -3885,6 +3924,17 @@ Result:
38853924
}
38863925
}
38873926
}
3927+
issue3958: (struct){
3928+
t1: (struct){
3929+
#schema: (int){ |((int){ int }, (int){ 3 }, (int){ 1 }) }
3930+
test1: (int){ |((int){ int }, (int){ 2 }, (int){ 3 }, (int){ 1 }) }
3931+
test2: (int){ |((int){ int }, (int){ 4 }, (int){ 3 }, (int){ 1 }) }
3932+
}
3933+
t2: (struct){
3934+
a: (int){ |((int){ int }, (int){ 8 }, (int){ 3 }, (int){ 1 }, (int){ 4 }) }
3935+
b: (int){ |((int){ int }, (int){ 3 }, (int){ 1 }, (int){ 4 }) }
3936+
}
3937+
}
38883938
issue770: (struct){
38893939
#A: (#struct){
38903940
v: (string){ |((string){ "a" }, (string){ "b" }, (string){ "c" }) }
@@ -5153,6 +5203,27 @@ Result:
51535203
}
51545204
}
51555205
}
5206+
--- issue3958.cue
5207+
{
5208+
issue3958: {
5209+
t1: {
5210+
#schema: (int|*1)
5211+
#schema: (int|*3)
5212+
test1: (〈0;#schema〉 & {
5213+
(int|*2)
5214+
})
5215+
test2: (〈0;#schema〉 & {
5216+
(int|*4)
5217+
})
5218+
}
5219+
}
5220+
issue3958: {
5221+
t2: {
5222+
a: ((((int|*4) & (int|*1)) & (int|*3)) & (int|*8))
5223+
b: (((int|*4) & (int|*1)) & (int|*3))
5224+
}
5225+
}
5226+
}
51565227
--- issue770.cue
51575228
{
51585229
issue770: {

0 commit comments

Comments
 (0)