Skip to content

Commit c479844

Browse files
committed
internal/core/adt: add test for issue 3824
Fixed by new closedness implementation. Closes #3824 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I3c74ba1299bd7f4ae37cfc1a974cbd3310c6e509 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211766 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 43ed667 commit c479844

File tree

1 file changed

+119
-24
lines changed

1 file changed

+119
-24
lines changed

Diff for: cue/testdata/eval/counters.txtar

+119-24
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,27 @@ issue3770: task: {
7979
m: null | { }
8080
out: m.x.a
8181
}
82+
-- issue3824.cue --
83+
issue3824: panic: {
84+
thing: {
85+
spec: name: string
86+
outputField: string
87+
}
88+
89+
val: string
90+
things: [_]: thing
91+
92+
things: [_]: {
93+
spec: *{
94+
name: "self-signed"
95+
} | {...}
96+
}
97+
98+
if true {
99+
things: "name": {}
100+
val: things["name"].outputField
101+
}
102+
}
82103
-- out/compile --
83104
--- issue3750.cue
84105
{
@@ -196,48 +217,80 @@ issue3770: task: {
196217
}
197218
}
198219
}
220+
--- issue3824.cue
221+
{
222+
issue3824: {
223+
panic: {
224+
thing: {
225+
spec: {
226+
name: string
227+
}
228+
outputField: string
229+
}
230+
val: string
231+
things: {
232+
[_]: 〈1;thing〉
233+
}
234+
things: {
235+
[_]: {
236+
spec: (*{
237+
name: "self-signed"
238+
}|{
239+
...
240+
})
241+
}
242+
}
243+
if true {
244+
things: {
245+
name: {}
246+
}
247+
val: 〈0;things〉["name"].outputField
248+
}
249+
}
250+
}
251+
}
199252
-- out/evalalpha/stats --
200-
Leaks: 229
253+
Leaks: 253
201254
Freed: 0
202255
Reused: 0
203-
Allocs: 229
256+
Allocs: 253
204257
Retain: 0
205258

206-
Unifications: 176
207-
Conjuncts: 265
208-
Disjuncts: 34
259+
Unifications: 192
260+
Conjuncts: 301
261+
Disjuncts: 38
209262
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
210263
diff old new
211264
--- old
212265
+++ new
213266
@@ -1,9 +1,9 @@
214-
-Leaks: 0
215-
-Freed: 151
216-
-Reused: 138
267+
-Leaks: 1
268+
-Freed: 165
269+
-Reused: 153
217270
-Allocs: 13
218-
-Retain: 35
219-
+Leaks: 229
271+
-Retain: 38
272+
+Leaks: 253
220273
+Freed: 0
221274
+Reused: 0
222-
+Allocs: 229
275+
+Allocs: 253
223276
+Retain: 0
224277

225-
-Unifications: 125
226-
-Conjuncts: 229
227-
-Disjuncts: 186
228-
+Unifications: 176
229-
+Conjuncts: 265
230-
+Disjuncts: 34
278+
-Unifications: 138
279+
-Conjuncts: 254
280+
-Disjuncts: 204
281+
+Unifications: 192
282+
+Conjuncts: 301
283+
+Disjuncts: 38
231284
-- out/eval/stats --
232-
Leaks: 0
233-
Freed: 151
234-
Reused: 138
285+
Leaks: 1
286+
Freed: 165
287+
Reused: 153
235288
Allocs: 13
236-
Retain: 35
289+
Retain: 38
237290

238-
Unifications: 125
239-
Conjuncts: 229
240-
Disjuncts: 186
291+
Unifications: 138
292+
Conjuncts: 254
293+
Disjuncts: 204
241294
-- out/evalalpha --
242295
(struct){
243296
issue3750: (struct){
@@ -386,6 +439,27 @@ Disjuncts: 186
386439
}
387440
}
388441
}
442+
issue3824: (struct){
443+
panic: (struct){
444+
thing: (struct){
445+
spec: (struct){
446+
name: (string){ string }
447+
}
448+
outputField: (string){ string }
449+
}
450+
val: (string){ string }
451+
things: (struct){
452+
name: (struct){
453+
spec: (struct){ |(*(struct){
454+
name: (string){ "self-signed" }
455+
}, (struct){
456+
name: (string){ string }
457+
}) }
458+
outputField: (string){ string }
459+
}
460+
}
461+
}
462+
}
389463
}
390464
-- diff/-out/evalalpha<==>+out/eval --
391465
diff old new
@@ -623,4 +697,25 @@ diff old new
623697
}
624698
}
625699
}
700+
issue3824: (struct){
701+
panic: (struct){
702+
thing: (struct){
703+
spec: (struct){
704+
name: (string){ string }
705+
}
706+
outputField: (string){ string }
707+
}
708+
val: (string){ string }
709+
things: (struct){
710+
name: (struct){
711+
spec: (struct){ |(*(struct){
712+
name: (string){ "self-signed" }
713+
}, (struct){
714+
name: (string){ string }
715+
}) }
716+
outputField: (string){ string }
717+
}
718+
}
719+
}
720+
}
626721
}

0 commit comments

Comments
 (0)