cuelang.org/go@v0.10.1/cue/testdata/eval/conjuncts.txtar (about) 1 // These tests are related to issue 2351. 2 3 -- in.cue -- 4 5 conjunct: t1: { 6 #early: *"X" | string 7 #early 8 } & { 9 #early: *"X" | string 10 string 11 } 12 13 conjunct: t2: { 14 #early: *"X" | string 15 #early 16 } 17 conjunct: t2: { 18 #early: *"X" | string 19 string 20 } 21 22 // TODO: fix this test 23 conjunct: t3: conjunct.t1 & conjunct.t2 24 25 handleComprehensions: { 26 if false { 27 subs: #sub2 & 2 28 } 29 #sub2: 2 30 } 31 32 -- issue2351.cue -- 33 issue2351: let: { 34 let _param = "foo" 35 ({ 36 param: _param & [{}] 37 gen: [for p in param {p}] 38 }).gen 39 } 40 41 issue2351: hidden: { 42 _in1: ["foo"] 43 { 44 in2: _in1 45 out: [for x in in2 {x}] 46 }.out 47 } 48 49 -- issue2355.cue -- 50 issue2355: { 51 #GetF1: { 52 in: _ 53 out: in.f1 54 } 55 56 #PutOut1: { 57 in: _ 58 out: out1: "\(in)" 59 } 60 61 export: { 62 let data = {f1: "foo"} 63 (#PutOut1 & { 64 in: (#GetF1 & { 65 in: data 66 }).out 67 }).out 68 } 69 } 70 71 -- out/evalalpha/stats -- 72 Leaks: 235 73 Freed: 42 74 Reused: 42 75 Allocs: 235 76 Retain: 0 77 78 Unifications: 47 79 Conjuncts: 425 80 Disjuncts: 184 81 -- out/evalalpha -- 82 Errors: 83 issue2351.let.param: conflicting values [{}] and "foo" (mismatched types list and string): 84 ./issue2351.cue:2:15 85 ./issue2351.cue:4:19 86 87 Result: 88 (_|_){ 89 // [eval] 90 conjunct: (struct){ 91 t1: (string){ |(*(string){ 92 "X" 93 #early: (string){ |(*(string){ "X" }, (string){ string }) } 94 }, (string){ 95 string 96 #early: (string){ |(*(string){ "X" }, (string){ string }) } 97 }) } 98 t2: (string){ |(*(string){ 99 "X" 100 #early: (string){ |(*(string){ "X" }, (string){ string }) } 101 }, (string){ 102 string 103 #early: (string){ |(*(string){ "X" }, (string){ string }) } 104 }) } 105 t3: (string){ |(*(string){ 106 "X" 107 #early: (string){ |(*(string){ "X" }, (string){ string }) } 108 }, (string){ 109 string 110 #early: (string){ |(*(string){ "X" }, (string){ string }) } 111 }) } 112 } 113 handleComprehensions: (struct){ 114 #sub2: (int){ 2 } 115 } 116 issue2351: (_|_){ 117 // [eval] 118 let: (_|_){ 119 // [eval] issue2351.let.param: conflicting values [{}] and "foo" (mismatched types list and string): 120 // ./issue2351.cue:2:15 121 // ./issue2351.cue:4:19 122 let _param#1 = (string){ "foo" } 123 } 124 hidden: (#list){ 125 _in1: (#list){ 126 0: (string){ "foo" } 127 } 128 0: (string){ "foo" } 129 } 130 } 131 issue2355: (struct){ 132 #GetF1: (#struct){ 133 in: (_){ _ } 134 out: (_|_){ 135 // [incomplete] issue2355.#GetF1.out: in.f1 undefined as in is incomplete (type _): 136 // ./issue2355.cue:4:8 137 } 138 } 139 #PutOut1: (#struct){ 140 in: (_){ _ } 141 out: (#struct){ 142 out1: (_|_){ 143 // [incomplete] issue2355.#PutOut1.out.out1: invalid interpolation: non-concrete value _ (type _): 144 // ./issue2355.cue:9:14 145 } 146 } 147 } 148 export: (#struct){ 149 let data#2 = (struct){ 150 f1: (string){ "foo" } 151 } 152 out1: (string){ "foo" } 153 } 154 } 155 } 156 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 157 diff old new 158 --- old 159 +++ new 160 @@ -1,9 +1,9 @@ 161 -Leaks: 9 162 -Freed: 68 163 -Reused: 59 164 -Allocs: 18 165 -Retain: 22 166 +Leaks: 235 167 +Freed: 42 168 +Reused: 42 169 +Allocs: 235 170 +Retain: 0 171 172 -Unifications: 45 173 -Conjuncts: 135 174 -Disjuncts: 86 175 +Unifications: 47 176 +Conjuncts: 425 177 +Disjuncts: 184 178 -- diff/-out/evalalpha<==>+out/eval -- 179 diff old new 180 --- old 181 +++ new 182 @@ -1,7 +1,6 @@ 183 Errors: 184 -issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list): 185 +issue2351.let.param: conflicting values [{}] and "foo" (mismatched types list and string): 186 ./issue2351.cue:2:15 187 - ./issue2351.cue:3:2 188 ./issue2351.cue:4:19 189 190 Result: 191 @@ -22,14 +21,13 @@ 192 string 193 #early: (string){ |(*(string){ "X" }, (string){ string }) } 194 }) } 195 - t3: (_|_){ 196 - // [incomplete] conjunct.t3: 2 errors in empty disjunction: 197 - // conjunct.t3: cannot add field #early: was already used: 198 - // ./in.cue:6:2 199 - // conjunct.t3: cannot add field #early: was already used: 200 - // ./in.cue:15:2 201 - #early: (string){ |(*(string){ "X" }, (string){ string }) } 202 - } 203 + t3: (string){ |(*(string){ 204 + "X" 205 + #early: (string){ |(*(string){ "X" }, (string){ string }) } 206 + }, (string){ 207 + string 208 + #early: (string){ |(*(string){ "X" }, (string){ string }) } 209 + }) } 210 } 211 handleComprehensions: (struct){ 212 #sub2: (int){ 2 } 213 @@ -37,9 +35,8 @@ 214 issue2351: (_|_){ 215 // [eval] 216 let: (_|_){ 217 - // [eval] issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list): 218 + // [eval] issue2351.let.param: conflicting values [{}] and "foo" (mismatched types list and string): 219 // ./issue2351.cue:2:15 220 - // ./issue2351.cue:3:2 221 // ./issue2351.cue:4:19 222 let _param#1 = (string){ "foo" } 223 } 224 @@ -67,7 +64,7 @@ 225 } 226 } 227 } 228 - export: (struct){ 229 + export: (#struct){ 230 let data#2 = (struct){ 231 f1: (string){ "foo" } 232 } 233 -- out/eval/stats -- 234 Leaks: 9 235 Freed: 68 236 Reused: 59 237 Allocs: 18 238 Retain: 22 239 240 Unifications: 45 241 Conjuncts: 135 242 Disjuncts: 86 243 -- diff/todo/p3 -- 244 Missing error position. 245 -- diff/explanation -- 246 conjunct.t3: this used to be broken, but is now fixed. 247 issue2355.export: correctly closing in new evaluator. 248 -- out/eval -- 249 Errors: 250 issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list): 251 ./issue2351.cue:2:15 252 ./issue2351.cue:3:2 253 ./issue2351.cue:4:19 254 255 Result: 256 (_|_){ 257 // [eval] 258 conjunct: (struct){ 259 t1: (string){ |(*(string){ 260 "X" 261 #early: (string){ |(*(string){ "X" }, (string){ string }) } 262 }, (string){ 263 string 264 #early: (string){ |(*(string){ "X" }, (string){ string }) } 265 }) } 266 t2: (string){ |(*(string){ 267 "X" 268 #early: (string){ |(*(string){ "X" }, (string){ string }) } 269 }, (string){ 270 string 271 #early: (string){ |(*(string){ "X" }, (string){ string }) } 272 }) } 273 t3: (_|_){ 274 // [incomplete] conjunct.t3: 2 errors in empty disjunction: 275 // conjunct.t3: cannot add field #early: was already used: 276 // ./in.cue:6:2 277 // conjunct.t3: cannot add field #early: was already used: 278 // ./in.cue:15:2 279 #early: (string){ |(*(string){ "X" }, (string){ string }) } 280 } 281 } 282 handleComprehensions: (struct){ 283 #sub2: (int){ 2 } 284 } 285 issue2351: (_|_){ 286 // [eval] 287 let: (_|_){ 288 // [eval] issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list): 289 // ./issue2351.cue:2:15 290 // ./issue2351.cue:3:2 291 // ./issue2351.cue:4:19 292 let _param#1 = (string){ "foo" } 293 } 294 hidden: (#list){ 295 _in1: (#list){ 296 0: (string){ "foo" } 297 } 298 0: (string){ "foo" } 299 } 300 } 301 issue2355: (struct){ 302 #GetF1: (#struct){ 303 in: (_){ _ } 304 out: (_|_){ 305 // [incomplete] issue2355.#GetF1.out: in.f1 undefined as in is incomplete (type _): 306 // ./issue2355.cue:4:8 307 } 308 } 309 #PutOut1: (#struct){ 310 in: (_){ _ } 311 out: (#struct){ 312 out1: (_|_){ 313 // [incomplete] issue2355.#PutOut1.out.out1: invalid interpolation: non-concrete value _ (type _): 314 // ./issue2355.cue:9:14 315 } 316 } 317 } 318 export: (struct){ 319 let data#2 = (struct){ 320 f1: (string){ "foo" } 321 } 322 out1: (string){ "foo" } 323 } 324 } 325 } 326 -- out/compile -- 327 --- in.cue 328 { 329 conjunct: { 330 t1: ({ 331 #early: (*"X"|string) 332 〈0;#early〉 333 } & { 334 #early: (*"X"|string) 335 string 336 }) 337 } 338 conjunct: { 339 t2: { 340 #early: (*"X"|string) 341 〈0;#early〉 342 } 343 } 344 conjunct: { 345 t2: { 346 #early: (*"X"|string) 347 string 348 } 349 } 350 conjunct: { 351 t3: (〈1;conjunct〉.t1 & 〈1;conjunct〉.t2) 352 } 353 handleComprehensions: { 354 if false { 355 subs: (〈1;#sub2〉 & 2) 356 } 357 #sub2: 2 358 } 359 } 360 --- issue2351.cue 361 { 362 issue2351: { 363 let: { 364 let _param#1 = "foo" 365 { 366 param: (〈1;let _param#1〉 & [ 367 {}, 368 ]) 369 gen: [ 370 for _, p in 〈1;param〉 { 371 〈1;p〉 372 }, 373 ] 374 }.gen 375 } 376 } 377 issue2351: { 378 hidden: { 379 _in1: [ 380 "foo", 381 ] 382 { 383 in2: 〈1;_in1〉 384 out: [ 385 for _, x in 〈1;in2〉 { 386 〈1;x〉 387 }, 388 ] 389 }.out 390 } 391 } 392 } 393 --- issue2355.cue 394 { 395 issue2355: { 396 #GetF1: { 397 in: _ 398 out: 〈0;in〉.f1 399 } 400 #PutOut1: { 401 in: _ 402 out: { 403 out1: "\(〈1;in〉)" 404 } 405 } 406 export: { 407 let data#2 = { 408 f1: "foo" 409 } 410 (〈1;#PutOut1〉 & { 411 in: (〈2;#GetF1〉 & { 412 in: 〈2;let data#2〉 413 }).out 414 }).out 415 } 416 } 417 }