@@ -79,15 +79,29 @@ issue3182: {
79
79
}.p.x.y
80
80
}
81
81
}
82
+ -- select.cue --
83
+ // The value of #Step should be consistent between these test cases.
84
+ select: direct: {
85
+ #Step: (#Job & {opt: _}).opt
86
+ #Job: matchN(1, [#NormalJob])
87
+ }
88
+ select: indirect: {
89
+ #Step: #Job.opt
90
+ #Job: matchN(1, [#NormalJob]) & {opt: _}
91
+ }
92
+ #NormalJob: {
93
+ req!: int
94
+ opt?: run?: string
95
+ }
82
96
-- out/evalalpha/stats --
83
- Leaks: 272
97
+ Leaks: 302
84
98
Freed: 0
85
99
Reused: 0
86
- Allocs: 272
100
+ Allocs: 302
87
101
Retain: 0
88
102
89
- Unifications: 251
90
- Conjuncts: 1299
103
+ Unifications: 280
104
+ Conjuncts: 1396
91
105
Disjuncts: 0
92
106
-- out/evalalpha --
93
107
Errors:
@@ -192,28 +206,57 @@ Result:
192
206
}
193
207
third: (int){ 1 }
194
208
}
209
+ select: (struct){
210
+ direct: (struct){
211
+ #Step: (_|_){
212
+ // [incomplete] invalid value {opt:_} (does not satisfy matchN(1, [~(#NormalJob)])): 0 matched, expected 1:
213
+ // ./select.cue:4:8
214
+ // ./select.cue:3:10
215
+ // ./select.cue:4:15
216
+ }
217
+ #Job: (_){ matchN(1, (#list){
218
+ 0: (_|_){// &[〈3;#NormalJob〉]
219
+ }
220
+ }) }
221
+ }
222
+ indirect: (struct){
223
+ #Step: (_){ _ }
224
+ #Job: (_|_){
225
+ // [incomplete] select.indirect.#Job: invalid value {opt:_} (does not satisfy matchN(1, [~(#NormalJob)])): 0 matched, expected 1:
226
+ // ./select.cue:8:8
227
+ // ./select.cue:8:15
228
+ opt: (_){ _ }
229
+ }
230
+ }
231
+ }
232
+ #NormalJob: (#struct){
233
+ req!: (int){ int }
234
+ opt?: (#struct){
235
+ run?: (string){ string }
236
+ }
237
+ }
195
238
}
196
239
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
197
240
diff old new
198
241
--- old
199
242
+++ new
200
243
@@ -1,9 +1,9 @@
201
- -Leaks: 306
202
- -Freed: 405
203
- -Reused: 401
204
- -Allocs: 310
205
- -Retain: 1066
206
- +Leaks: 272
244
+ -Leaks: 309
245
+ -Freed: 437
246
+ -Reused: 429
247
+ -Allocs: 317
248
+ -Retain: 1074
249
+ +Leaks: 302
207
250
+Freed: 0
208
251
+Reused: 0
209
- +Allocs: 272
252
+ +Allocs: 302
210
253
+Retain: 0
211
254
212
- -Unifications: 711
213
- -Conjuncts: 2759
214
- -Disjuncts: 1446
215
- +Unifications: 251
216
- +Conjuncts: 1299
255
+ -Unifications: 746
256
+ -Conjuncts: 2813
257
+ -Disjuncts: 1485
258
+ +Unifications: 280
259
+ +Conjuncts: 1396
217
260
+Disjuncts: 0
218
261
-- diff/-out/evalalpha<==>+out/eval --
219
262
diff old new
@@ -253,19 +296,47 @@ diff old new
253
296
}
254
297
}
255
298
}
299
+ @@ -102,9 +102,14 @@
300
+ }
301
+ select: (struct){
302
+ direct: (struct){
303
+ - #Step: (_){ _ }
304
+ + #Step: (_|_){
305
+ + // [incomplete] invalid value {opt:_} (does not satisfy matchN(1, [~(#NormalJob)])): 0 matched, expected 1:
306
+ + // ./select.cue:4:8
307
+ + // ./select.cue:3:10
308
+ + // ./select.cue:4:15
309
+ + }
310
+ #Job: (_){ matchN(1, (#list){
311
+ - 0: (_|_){// 〈3;#NormalJob〉
312
+ + 0: (_|_){// &[〈3;#NormalJob〉]
313
+ }
314
+ }) }
315
+ }
316
+ @@ -111,7 +116,7 @@
317
+ indirect: (struct){
318
+ #Step: (_){ _ }
319
+ #Job: (_|_){
320
+ - // [incomplete] select.indirect.#Job: invalid value {opt:_} (does not satisfy matchN(1, [{req!:int,opt?:{run?:string}}])): 0 matched, expected 1:
321
+ + // [incomplete] select.indirect.#Job: invalid value {opt:_} (does not satisfy matchN(1, [~(#NormalJob)])): 0 matched, expected 1:
322
+ // ./select.cue:8:8
323
+ // ./select.cue:8:15
324
+ opt: (_){ _ }
325
+ -- diff/todo/p1 --
326
+ select: values of #Step differ
256
327
-- diff/todo/p3 --
257
328
Error positions.
258
329
Incorrect path due to structure sharing.
259
330
-- out/eval/stats --
260
- Leaks: 306
261
- Freed: 405
262
- Reused: 401
263
- Allocs: 310
264
- Retain: 1066
331
+ Leaks: 309
332
+ Freed: 437
333
+ Reused: 429
334
+ Allocs: 317
335
+ Retain: 1074
265
336
266
- Unifications: 711
267
- Conjuncts: 2759
268
- Disjuncts: 1446
337
+ Unifications: 746
338
+ Conjuncts: 2813
339
+ Disjuncts: 1485
269
340
-- out/eval --
270
341
Errors:
271
342
issue3182.first.t2.x.b: structural cycle
@@ -369,6 +440,30 @@ Result:
369
440
}
370
441
third: (int){ 1 }
371
442
}
443
+ select: (struct){
444
+ direct: (struct){
445
+ #Step: (_){ _ }
446
+ #Job: (_){ matchN(1, (#list){
447
+ 0: (_|_){// 〈3;#NormalJob〉
448
+ }
449
+ }) }
450
+ }
451
+ indirect: (struct){
452
+ #Step: (_){ _ }
453
+ #Job: (_|_){
454
+ // [incomplete] select.indirect.#Job: invalid value {opt:_} (does not satisfy matchN(1, [{req!:int,opt?:{run?:string}}])): 0 matched, expected 1:
455
+ // ./select.cue:8:8
456
+ // ./select.cue:8:15
457
+ opt: (_){ _ }
458
+ }
459
+ }
460
+ }
461
+ #NormalJob: (#struct){
462
+ req!: (int){ int }
463
+ opt?: (#struct){
464
+ run?: (string){ string }
465
+ }
466
+ }
372
467
}
373
468
-- out/compile --
374
469
--- in.cue
@@ -525,3 +620,32 @@ Result:
525
620
}
526
621
}
527
622
}
623
+ --- select.cue
624
+ {
625
+ select: {
626
+ direct: {
627
+ #Step: (〈0;#Job〉 & {
628
+ opt: _
629
+ }).opt
630
+ #Job: matchN(1, [
631
+ 〈3;#NormalJob〉,
632
+ ])
633
+ }
634
+ }
635
+ select: {
636
+ indirect: {
637
+ #Step: 〈0;#Job〉.opt
638
+ #Job: (matchN(1, [
639
+ 〈3;#NormalJob〉,
640
+ ]) & {
641
+ opt: _
642
+ })
643
+ }
644
+ }
645
+ #NormalJob: {
646
+ req!: int
647
+ opt?: {
648
+ run?: string
649
+ }
650
+ }
651
+ }
0 commit comments