Skip to content

Commit bdebb8a

Browse files
committed
internal/core/adt: add test for 3679
Issue #3679 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Icd25a06b45c3c7e88fa45f80c2167545d4167006 Reviewed-on: https://gerrithub.io/c/cue-lang/cue/+/1207339 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 5ce7ba4 commit bdebb8a

File tree

1 file changed

+56
-12
lines changed

1 file changed

+56
-12
lines changed

cue/testdata/eval/sharing.txtar

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,33 @@ issue3546: reduced: {
121121
out: #Network
122122
out: val
123123
}
124+
-- acrossdisjunction.cue --
125+
import "list"
126+
127+
issue3679: {
128+
// The result of list.Repeat is structure shared in env. This needs to be
129+
// "unshared" within the disjunction. Ensure that unsharing a shared Vertex
130+
// works arcross disjunction boundaries.
131+
b: null | [string]
132+
b: list.Repeat([for k, v in [0] { "bar" }], 1)
133+
}
124134
-- out/eval/stats --
125-
Leaks: 2
126-
Freed: 148
127-
Reused: 141
128-
Allocs: 9
129-
Retain: 19
135+
Leaks: 3
136+
Freed: 158
137+
Reused: 151
138+
Allocs: 10
139+
Retain: 21
130140

131-
Unifications: 150
132-
Conjuncts: 309
133-
Disjuncts: 165
141+
Unifications: 159
142+
Conjuncts: 331
143+
Disjuncts: 177
134144
-- out/evalalpha --
135145
(struct){
146+
issue3679: (struct){
147+
b: (#list){
148+
0: (string){ string }
149+
}
150+
}
136151
issue3641: (struct){
137152
simplified: (struct){
138153
t1: (struct){
@@ -359,7 +374,16 @@ Disjuncts: 165
359374
diff old new
360375
--- old
361376
+++ new
362-
@@ -11,102 +11,75 @@
377+
@@ -1,7 +1,7 @@
378+
(struct){
379+
issue3679: (struct){
380+
b: (#list){
381+
- 0: (string){ "bar" }
382+
+ 0: (string){ string }
383+
}
384+
}
385+
issue3641: (struct){
386+
@@ -16,102 +16,75 @@
363387
}
364388
}
365389
#Config1: (#struct){
@@ -531,7 +555,7 @@ diff old new
531555
}
532556
Config: (#struct){
533557
cfg: (#struct){
534-
@@ -132,24 +105,13 @@
558+
@@ -137,24 +110,13 @@
535559
}
536560
}
537561
#Config1: (#struct){
@@ -559,7 +583,7 @@ diff old new
559583
}
560584
#Config: (#struct){
561585
cfg: (#struct){
562-
@@ -157,12 +119,7 @@
586+
@@ -162,12 +124,7 @@
563587
}
564588
}
565589
}
@@ -573,7 +597,7 @@ diff old new
573597
out: (#struct){
574598
sch: (#struct){
575599
cfg: (#struct){
576-
@@ -231,9 +188,7 @@
600+
@@ -236,9 +193,7 @@
577601
}
578602
debug: (struct){
579603
sharingOn: (struct){
@@ -586,6 +610,11 @@ diff old new
586610
}
587611
-- out/eval --
588612
(struct){
613+
issue3679: (struct){
614+
b: (#list){
615+
0: (string){ "bar" }
616+
}
617+
}
589618
issue3641: (struct){
590619
simplified: (struct){
591620
t1: (struct){
@@ -854,6 +883,21 @@ diff old new
854883
}
855884
}
856885
-- out/compile --
886+
--- acrossdisjunction.cue
887+
{
888+
issue3679: {
889+
b: (null|[
890+
string,
891+
])
892+
b: 〈import;list〉.Repeat([
893+
for k, v in [
894+
0,
895+
] {
896+
"bar"
897+
},
898+
], 1)
899+
}
900+
}
857901
--- dupshare.cue
858902
{
859903
issue3641: {

0 commit comments

Comments
 (0)