this repo has no description
1-- in.cue --
2import "list"
3
4issue563: {
5 #MyDef: {
6 name: string
7 ...
8 }
9
10 _all: [
11 _a,
12 _b,
13 ]
14
15 _a: [...#MyDef] & [
16 {name: "a"},
17 {name: "b"},
18 {name: "c"},
19 ]
20
21 _b: [...#MyDef] & [
22 {name: "1"},
23 {name: "2"},
24 {name: "3"},
25 ]
26
27 output: [...#MyDef] & list.FlattenN(_all, 1)
28}
29issue1404: {
30 a: *1 | 2
31 sum: list.Sum([a])
32}
33issue3541: {
34 _test: {
35 one: {
36 num: 2
37 test: num: 6
38 }
39 two: {
40 num: 3
41 test: num: 7
42 }
43 three: {
44 num: 4
45 test: num: 8
46 }
47 four: {
48 num: 5
49 test: num: 9
50 }
51 }
52
53 list.Sum([for key, val in _test {
54 val.num + val.test
55 }])
56}
57
58issue2594: sumFirst: {
59 #Def: {
60 number & list.Sum(#In)
61 #In: [...number]
62 }
63
64 x!: 6
65 x: #Def & {_
66 #In: [1, 2, 3]
67 }
68}
69issue2594: sumSecond: {
70 #Def: {
71 #In: [...number]
72 number & list.Sum(#In)
73 }
74
75 x!: 6
76 x: #Def & {_
77 #In: [1, 2, 3]
78 }
79}
80
81issue3416: sumFirst: {
82 a: b: {_, _c: x: 100}
83 a: b: {
84 list.Sum([for _, v in _c {v}])
85 _c: {
86 y: 1
87 z: 10
88 }
89 }
90}
91issue3416: sumSecond: {
92 a: b: {_, _c: x: 100}
93 a: b: {
94 _c: {
95 y: 1
96 z: 10
97 }
98 list.Sum([for _, v in _c {v}])
99 }
100}
101-- out/list-v3 --
102Errors:
103issue3541: error in call to list.Sum: invalid operands 2 and {num:6} to '+' (type int and struct):
104 ./in.cue:52:2
105 ./in.cue:35:9
106 ./in.cue:36:10
107 ./in.cue:53:3
108
109Result:
110issue563: {
111 #MyDef: {
112 name: string
113 }
114 output: [{
115 name: "a"
116 }, {
117 name: "b"
118 }, {
119 name: "c"
120 }, {
121 name: "1"
122 }, {
123 name: "2"
124 }, {
125 name: "3"
126 }]
127}
128issue1404: {
129 a: *1 | 2
130 sum: 1
131}
132issue3541: _|_ // issue3541: error in call to list.Sum: 0: invalid operands 2 and {num:6} to '+' (type int and struct)
133issue2594: {
134 sumFirst: {
135 #Def: {
136 0
137 #In: [...number]
138 }
139 x: {
140 6
141 #In: [1, 2, 3]
142 }
143 }
144 sumSecond: {
145 #Def: {
146 0
147 #In: [...number]
148 }
149 x: {
150 6
151 #In: [1, 2, 3]
152 }
153 }
154}
155issue3416: {
156 sumFirst: {
157 a: {
158 b: {
159 111
160 }
161 }
162 }
163 sumSecond: {
164 a: {
165 b: {
166 111
167 }
168 }
169 }
170}
171-- diff/-out/list-v3<==>+out/list --
172diff old new
173--- old
174+++ new
175@@ -1,11 +1,9 @@
176 Errors:
177-issue2594.sumSecond.x: conflicting values 0 and 6:
178- ./in.cue:71:3
179- ./in.cue:71:12
180- ./in.cue:74:6
181- ./in.cue:75:6
182-issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle
183-issue3416.sumFirst.a.b: field z not allowed by earlier comprehension or reference cycle
184+issue3541: error in call to list.Sum: invalid operands 2 and {num:6} to '+' (type int and struct):
185+ ./in.cue:52:2
186+ ./in.cue:35:9
187+ ./in.cue:36:10
188+ ./in.cue:53:3
189
190 Result:
191 issue563: {
192@@ -30,7 +28,7 @@
193 a: *1 | 2
194 sum: 1
195 }
196-issue3541: {}
197+issue3541: _|_ // issue3541: error in call to list.Sum: 0: invalid operands 2 and {num:6} to '+' (type int and struct)
198 issue2594: {
199 sumFirst: {
200 #Def: {
201@@ -47,13 +45,18 @@
202 0
203 #In: [...number]
204 }
205- x: _|_ // issue2594.sumSecond.x: conflicting values 0 and 6
206+ x: {
207+ 6
208+ #In: [1, 2, 3]
209+ }
210 }
211 }
212 issue3416: {
213 sumFirst: {
214 a: {
215- b: _|_ // issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle (and 1 more errors)
216+ b: {
217+ 111
218+ }
219 }
220 }
221 sumSecond: {
222-- diff/explanation --
223issue3541: evalv3 correctly spots an invalid operand error which evalv2 drops on the floor.
224issue2594: evalv3 fixes an ordering issue present in evalv2.
225-- out/list --
226Errors:
227issue2594.sumSecond.x: conflicting values 0 and 6:
228 ./in.cue:71:3
229 ./in.cue:71:12
230 ./in.cue:74:6
231 ./in.cue:75:6
232issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle
233issue3416.sumFirst.a.b: field z not allowed by earlier comprehension or reference cycle
234
235Result:
236issue563: {
237 #MyDef: {
238 name: string
239 }
240 output: [{
241 name: "a"
242 }, {
243 name: "b"
244 }, {
245 name: "c"
246 }, {
247 name: "1"
248 }, {
249 name: "2"
250 }, {
251 name: "3"
252 }]
253}
254issue1404: {
255 a: *1 | 2
256 sum: 1
257}
258issue3541: {}
259issue2594: {
260 sumFirst: {
261 #Def: {
262 0
263 #In: [...number]
264 }
265 x: {
266 6
267 #In: [1, 2, 3]
268 }
269 }
270 sumSecond: {
271 #Def: {
272 0
273 #In: [...number]
274 }
275 x: _|_ // issue2594.sumSecond.x: conflicting values 0 and 6
276 }
277}
278issue3416: {
279 sumFirst: {
280 a: {
281 b: _|_ // issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle (and 1 more errors)
282 }
283 }
284 sumSecond: {
285 a: {
286 b: {
287 111
288 }
289 }
290 }
291}