cuelang.org/go@v0.13.0/pkg/list/testdata/issues.txtar (about) 1 -- in.cue -- 2 import "list" 3 4 issue563: { 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 } 29 issue1404: { 30 a: *1 | 2 31 sum: list.Sum([a]) 32 } 33 issue3541: { 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 58 issue2594: 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 } 69 issue2594: 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 81 issue3416: 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 } 91 issue3416: 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 -- 102 Errors: 103 0: invalid operands 2 and {num:6} to '+' (type int and struct): 104 ./in.cue:53:3 105 ./in.cue:35:9 106 ./in.cue:36:10 107 108 Result: 109 issue563: { 110 #MyDef: { 111 name: string 112 } 113 output: [{ 114 name: "a" 115 }, { 116 name: "b" 117 }, { 118 name: "c" 119 }, { 120 name: "1" 121 }, { 122 name: "2" 123 }, { 124 name: "3" 125 }] 126 } 127 issue1404: { 128 a: *1 | 2 129 sum: 1 130 } 131 issue3541: _|_ // 0: invalid operands 2 and {num:6} to '+' (type int and struct) 132 issue2594: { 133 sumFirst: { 134 #Def: { 135 0 136 #In: [...number] 137 } 138 x: { 139 6 140 #In: [1, 2, 3] 141 } 142 } 143 sumSecond: { 144 #Def: { 145 0 146 #In: [...number] 147 } 148 x: { 149 6 150 #In: [1, 2, 3] 151 } 152 } 153 } 154 issue3416: { 155 sumFirst: { 156 a: { 157 b: { 158 111 159 } 160 } 161 } 162 sumSecond: { 163 a: { 164 b: { 165 111 166 } 167 } 168 } 169 } 170 -- diff/-out/list-v3<==>+out/list -- 171 diff old new 172 --- old 173 +++ new 174 @@ -1,11 +1,8 @@ 175 Errors: 176 -issue2594.sumSecond.x: conflicting values 0 and 6: 177 - ./in.cue:71:3 178 - ./in.cue:71:12 179 - ./in.cue:74:6 180 - ./in.cue:75:6 181 -issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle 182 -issue3416.sumFirst.a.b: field z not allowed by earlier comprehension or reference cycle 183 +0: invalid operands 2 and {num:6} to '+' (type int and struct): 184 + ./in.cue:53:3 185 + ./in.cue:35:9 186 + ./in.cue:36:10 187 188 Result: 189 issue563: { 190 @@ -30,7 +27,7 @@ 191 a: *1 | 2 192 sum: 1 193 } 194 -issue3541: {} 195 +issue3541: _|_ // 0: invalid operands 2 and {num:6} to '+' (type int and struct) 196 issue2594: { 197 sumFirst: { 198 #Def: { 199 @@ -47,13 +44,18 @@ 200 0 201 #In: [...number] 202 } 203 - x: _|_ // issue2594.sumSecond.x: conflicting values 0 and 6 204 + x: { 205 + 6 206 + #In: [1, 2, 3] 207 + } 208 } 209 } 210 issue3416: { 211 sumFirst: { 212 a: { 213 - b: _|_ // issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle (and 1 more errors) 214 + b: { 215 + 111 216 + } 217 } 218 } 219 sumSecond: { 220 -- diff/explanation -- 221 issue3541: evalv3 correctly spots an invalid operand error which evalv2 drops on the floor. 222 issue2594: evalv3 fixes an ordering issue present in evalv2. 223 -- out/list -- 224 Errors: 225 issue2594.sumSecond.x: conflicting values 0 and 6: 226 ./in.cue:71:3 227 ./in.cue:71:12 228 ./in.cue:74:6 229 ./in.cue:75:6 230 issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle 231 issue3416.sumFirst.a.b: field z not allowed by earlier comprehension or reference cycle 232 233 Result: 234 issue563: { 235 #MyDef: { 236 name: string 237 } 238 output: [{ 239 name: "a" 240 }, { 241 name: "b" 242 }, { 243 name: "c" 244 }, { 245 name: "1" 246 }, { 247 name: "2" 248 }, { 249 name: "3" 250 }] 251 } 252 issue1404: { 253 a: *1 | 2 254 sum: 1 255 } 256 issue3541: {} 257 issue2594: { 258 sumFirst: { 259 #Def: { 260 0 261 #In: [...number] 262 } 263 x: { 264 6 265 #In: [1, 2, 3] 266 } 267 } 268 sumSecond: { 269 #Def: { 270 0 271 #In: [...number] 272 } 273 x: _|_ // issue2594.sumSecond.x: conflicting values 0 and 6 274 } 275 } 276 issue3416: { 277 sumFirst: { 278 a: { 279 b: _|_ // issue3416.sumFirst.a.b: field y not allowed by earlier comprehension or reference cycle (and 1 more errors) 280 } 281 } 282 sumSecond: { 283 a: { 284 b: { 285 111 286 } 287 } 288 } 289 }