cuelang.org/go@v0.10.1/cue/testdata/cycle/evaluate.txtar (about) 1 -- in.cue -- 2 // All these cases whose name end with cycle should fail with a structural 3 // error. These are all uncommon code paths, triggered when container types 4 // are evalated within a nested expression such as as an argument to a 5 // function call. 6 // 7 // The builtins are typically used to trigger the uncommon path. The choice of 8 // builtin is irrelevant, as long as they don't finalize args before processing. 9 10 // This is a resolvable reference cycle, were b is equated to c. 11 letCycleOK: t1: { 12 b: c 13 let X = b 14 c: X 15 } 16 17 // The let has structural cycle, but it is only used in a way that the 18 // structural cycle is avoided. 19 letCycleOK: t2: { 20 a: { 21 b: 1 22 let X = a 23 c: X.b 24 } 25 } 26 27 // Ensure that the cycle exemption algorithm does not bypass actual structural 28 // cycles. 29 letCycleFail: t1: { 30 a: { 31 b: 1 32 let X = a 33 c: X 34 } 35 } 36 37 // Cycles should also be detected in evaluation paths that descend into 38 // recursion at non-field boundaries. 39 letCycleFail: t2: { 40 a: { 41 let X = a 42 if X == _|_ { } 43 x: y: "" 44 } 45 } 46 47 listCycleOK: { 48 a: b 49 b: and([c]) 50 c: a 51 } 52 53 disjunctionCycle: { 54 a: b 55 b: and(1 | c) 56 c: a 57 } 58 59 forCycle: { 60 #A: a: #B // TODO(errors): Correct error position. 61 #B: or([for x in #A { b: x }]) 62 } 63 64 letCycleWithAnd: { 65 a: d: b 66 b: and([for x in a let y = x { y }]) 67 c: a 68 } 69 70 closeCycle: { 71 a: b 72 b: close({d: c}) 73 c: a 74 } 75 76 structCycle: { 77 a: b 78 b: and([{d: c}]) 79 c: a 80 } 81 82 embedCycle: { 83 a: b 84 b: close({c}) 85 c: a 86 } 87 88 listAddCycle: { 89 a: b 90 b: [c] + [c] 91 c: a 92 } 93 94 listMulCycle: { 95 a: b 96 b: 3 + [{a: b: c}] 97 c: a 98 } 99 100 // consult the correct closeness info in the face of it being passed down 101 // from parent. 102 closeFail: { 103 #T: [_]: _ 104 #T: close({"a": string}) 105 x: #T 106 x: b: "foo" 107 } 108 109 printCycle: { 110 a: { 111 X: a 112 if X { 113 } 114 } 115 } 116 -- out/eval/stats -- 117 Leaks: 59 118 Freed: 92 119 Reused: 89 120 Allocs: 62 121 Retain: 129 122 123 Unifications: 139 124 Conjuncts: 274 125 Disjuncts: 160 126 -- out/evalalpha -- 127 Errors: 128 letCycleOK.t2.a.X: structural cycle: 129 ./in.cue:22:6 130 letCycleFail.t1.a.X: structural cycle: 131 ./in.cue:32:6 132 listCycleOK.0: structural cycle: 133 ./in.cue:48:9 134 disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 135 ./in.cue:54:9 136 forCycle.0.b: structural cycle: 137 ./in.cue:60:9 138 letCycleWithAnd.0: structural cycle: 139 ./in.cue:65:9 140 closeCycle.d: structural cycle: 141 ./in.cue:71:11 142 structCycle.0.d: structural cycle: 143 ./in.cue:77:9 144 embedCycle: structural cycle: 145 ./in.cue:83:11 146 listAddCycle.0: structural cycle: 147 ./in.cue:89:5 148 listAddCycle.0: structural cycle: 149 ./in.cue:89:11 150 listMulCycle.0.a.b: structural cycle: 151 ./in.cue:95:9 152 closeFail.x.b: field not allowed: 153 ./in.cue:103:6 154 ./in.cue:102:6 155 ./in.cue:105:5 156 printCycle.a: cannot use {X:~(printCycle.a)} (type struct) as type bool: 157 ./in.cue:111:3 158 159 Result: 160 (_|_){ 161 // [eval] 162 letCycleOK: (_|_){ 163 // [structural cycle] 164 t1: (struct){ 165 b: (_){ _ } 166 let X#1 = (_){ _ } 167 c: (_){ _ } 168 } 169 t2: (_|_){ 170 // [structural cycle] 171 a: (_|_){ 172 // [structural cycle] 173 b: (int){ 1 } 174 let X#2 = (_|_){ 175 // [structural cycle] letCycleOK.t2.a.X: structural cycle 176 } 177 c: (_|_){ 178 // [structural cycle] letCycleOK.t2.a.X: structural cycle: 179 // ./in.cue:22:6 180 } 181 } 182 } 183 } 184 letCycleFail: (_|_){ 185 // [structural cycle] 186 t1: (_|_){ 187 // [structural cycle] 188 a: (_|_){ 189 // [structural cycle] 190 b: (int){ 1 } 191 let X#3 = (_|_){ 192 // [structural cycle] letCycleFail.t1.a.X: structural cycle 193 } 194 c: (_|_){ 195 // [structural cycle] letCycleFail.t1.a.X: structural cycle: 196 // ./in.cue:32:6 197 } 198 } 199 } 200 t2: (struct){ 201 a: (struct){ 202 let X#4 = (struct){ 203 let X#4 = (_|_){ 204 // [structural cycle] letCycleFail.t2.a.X.X: structural cycle: 205 // ./in.cue:41:6 206 } 207 x: (struct){ 208 y: (string){ "" } 209 } 210 } 211 x: (struct){ 212 y: (string){ "" } 213 } 214 } 215 } 216 } 217 listCycleOK: (_|_){ 218 // [structural cycle] 219 a: (_|_){ 220 // [structural cycle] listCycleOK.0: structural cycle: 221 // ./in.cue:48:9 222 } 223 b: (_|_){ 224 // [structural cycle] listCycleOK.0: structural cycle: 225 // ./in.cue:48:9 226 } 227 c: (_|_){ 228 // [structural cycle] listCycleOK.0: structural cycle: 229 // ./in.cue:48:9 230 } 231 } 232 disjunctionCycle: (_|_){ 233 // [eval] 234 a: (_|_){ 235 // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 236 // ./in.cue:54:9 237 } 238 b: (_|_){ 239 // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 240 // ./in.cue:54:9 241 } 242 c: (_|_){ 243 // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 244 // ./in.cue:54:9 245 } 246 } 247 forCycle: (_|_){ 248 // [structural cycle] 249 #A: (_|_){ 250 // [structural cycle] 251 a: (_|_){ 252 // [structural cycle] forCycle.0.b: structural cycle: 253 // ./in.cue:60:9 254 } 255 } 256 #B: (_|_){ 257 // [structural cycle] forCycle.0.b: structural cycle: 258 // ./in.cue:60:9 259 } 260 } 261 letCycleWithAnd: (_|_){ 262 // [structural cycle] 263 a: (_|_){ 264 // [structural cycle] 265 d: (_|_){ 266 // [structural cycle] letCycleWithAnd.0: structural cycle: 267 // ./in.cue:65:9 268 } 269 } 270 b: (_|_){ 271 // [structural cycle] letCycleWithAnd.0: structural cycle: 272 // ./in.cue:65:9 273 } 274 c: (_|_){ 275 // [structural cycle] 276 d: (_|_){ 277 // [structural cycle] letCycleWithAnd.0: structural cycle: 278 // ./in.cue:65:9 279 } 280 } 281 } 282 closeCycle: (_|_){ 283 // [structural cycle] 284 a: (_|_){ 285 // [structural cycle] closeCycle.d: structural cycle: 286 // ./in.cue:71:11 287 } 288 b: (_|_){ 289 // [structural cycle] closeCycle.d: structural cycle: 290 // ./in.cue:71:11 291 } 292 c: (_|_){ 293 // [structural cycle] closeCycle.d: structural cycle: 294 // ./in.cue:71:11 295 } 296 } 297 structCycle: (_|_){ 298 // [structural cycle] 299 a: (_|_){ 300 // [structural cycle] structCycle.0.d: structural cycle: 301 // ./in.cue:77:9 302 } 303 b: (_|_){ 304 // [structural cycle] structCycle.0.d: structural cycle: 305 // ./in.cue:77:9 306 } 307 c: (_|_){ 308 // [structural cycle] structCycle.0.d: structural cycle: 309 // ./in.cue:77:9 310 } 311 } 312 embedCycle: (_|_){ 313 // [structural cycle] 314 a: (_|_){ 315 // [structural cycle] embedCycle: structural cycle: 316 // ./in.cue:83:11 317 } 318 b: (_|_){ 319 // [structural cycle] embedCycle: structural cycle: 320 // ./in.cue:83:11 321 } 322 c: (_|_){ 323 // [structural cycle] embedCycle: structural cycle: 324 // ./in.cue:83:11 325 } 326 } 327 listAddCycle: (_|_){ 328 // [structural cycle] 329 a: (_|_){ 330 // [structural cycle] listAddCycle.0: structural cycle: 331 // ./in.cue:89:5 332 // listAddCycle.0: structural cycle: 333 // ./in.cue:89:11 334 } 335 b: (_|_){ 336 // [structural cycle] listAddCycle.0: structural cycle: 337 // ./in.cue:89:5 338 // listAddCycle.0: structural cycle: 339 // ./in.cue:89:11 340 } 341 c: (_|_){ 342 // [structural cycle] listAddCycle.0: structural cycle: 343 // ./in.cue:89:5 344 // listAddCycle.0: structural cycle: 345 // ./in.cue:89:11 346 } 347 } 348 listMulCycle: (_|_){ 349 // [structural cycle] 350 a: (_|_){ 351 // [structural cycle] listMulCycle.0.a.b: structural cycle: 352 // ./in.cue:95:9 353 } 354 b: (_|_){ 355 // [structural cycle] listMulCycle.0.a.b: structural cycle: 356 // ./in.cue:95:9 357 } 358 c: (_|_){ 359 // [structural cycle] listMulCycle.0.a.b: structural cycle: 360 // ./in.cue:95:9 361 } 362 } 363 closeFail: (_|_){ 364 // [eval] 365 #T: (#struct){ 366 a: (string){ string } 367 } 368 x: (_|_){ 369 // [eval] 370 b: (_|_){ 371 // [eval] closeFail.x.b: field not allowed: 372 // ./in.cue:103:6 373 // ./in.cue:102:6 374 // ./in.cue:105:5 375 } 376 a: (string){ string } 377 } 378 } 379 printCycle: (_|_){ 380 // [eval] 381 a: (_|_){ 382 // [eval] printCycle.a: cannot use {X:~(printCycle.a)} (type struct) as type bool: 383 // ./in.cue:111:3 384 X: ~(printCycle.a) 385 } 386 } 387 } 388 -- diff/-out/evalalpha<==>+out/eval -- 389 diff old new 390 --- old 391 +++ new 392 @@ -1,61 +1,57 @@ 393 Errors: 394 -closeCycle.a: structural cycle 395 -closeCycle.b.d: structural cycle 396 -closeFail.x.b: field not allowed: 397 - ./in.cue:102:6 398 - ./in.cue:103:12 399 - ./in.cue:104:6 400 - ./in.cue:105:5 401 -letCycleFail.t1.a.c: structural cycle 402 -listAddCycle.a: structural cycle 403 -listAddCycle.b.0.0: structural cycle 404 -listAddCycle.b.0.1: structural cycle 405 -structCycle.a: structural cycle 406 -structCycle.b.d: structural cycle 407 -disjunctionCycle.a: cannot use 1 (type int) as list in argument 1 to and: 408 - ./in.cue:54:9 409 +letCycleOK.t2.a.X: structural cycle: 410 + ./in.cue:22:6 411 +letCycleFail.t1.a.X: structural cycle: 412 + ./in.cue:32:6 413 +listCycleOK.0: structural cycle: 414 + ./in.cue:48:9 415 disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 416 ./in.cue:54:9 417 -disjunctionCycle.c: cannot use 1 (type int) as list in argument 1 to and: 418 - ./in.cue:54:9 419 -b: structural cycle: 420 - ./in.cue:60:6 421 -closeCycle.c: structural cycle: 422 - ./in.cue:71:15 423 -structCycle.c: structural cycle: 424 - ./in.cue:77:14 425 +forCycle.0.b: structural cycle: 426 + ./in.cue:60:9 427 +letCycleWithAnd.0: structural cycle: 428 + ./in.cue:65:9 429 +closeCycle.d: structural cycle: 430 + ./in.cue:71:11 431 +structCycle.0.d: structural cycle: 432 + ./in.cue:77:9 433 embedCycle: structural cycle: 434 ./in.cue:83:11 435 -listAddCycle.c: structural cycle: 436 - ./in.cue:89:6 437 -listMulCycle.a: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 438 - ./in.cue:95:5 439 - ./in.cue:95:9 440 -listMulCycle.b: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 441 - ./in.cue:95:5 442 - ./in.cue:95:9 443 -listMulCycle.c: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 444 - ./in.cue:95:5 445 - ./in.cue:95:9 446 -printCycle.a.X.X: structural cycle: 447 - ./in.cue:111:6 448 +listAddCycle.0: structural cycle: 449 + ./in.cue:89:5 450 +listAddCycle.0: structural cycle: 451 + ./in.cue:89:11 452 +listMulCycle.0.a.b: structural cycle: 453 + ./in.cue:95:9 454 +closeFail.x.b: field not allowed: 455 + ./in.cue:103:6 456 + ./in.cue:102:6 457 + ./in.cue:105:5 458 +printCycle.a: cannot use {X:~(printCycle.a)} (type struct) as type bool: 459 + ./in.cue:111:3 460 461 Result: 462 (_|_){ 463 // [eval] 464 - letCycleOK: (struct){ 465 + letCycleOK: (_|_){ 466 + // [structural cycle] 467 t1: (struct){ 468 b: (_){ _ } 469 let X#1 = (_){ _ } 470 c: (_){ _ } 471 } 472 - t2: (struct){ 473 - a: (struct){ 474 + t2: (_|_){ 475 + // [structural cycle] 476 + a: (_|_){ 477 + // [structural cycle] 478 b: (int){ 1 } 479 let X#2 = (_|_){ 480 // [structural cycle] letCycleOK.t2.a.X: structural cycle 481 } 482 - c: (int){ 1 } 483 + c: (_|_){ 484 + // [structural cycle] letCycleOK.t2.a.X: structural cycle: 485 + // ./in.cue:22:6 486 + } 487 } 488 } 489 } 490 @@ -70,7 +66,8 @@ 491 // [structural cycle] letCycleFail.t1.a.X: structural cycle 492 } 493 c: (_|_){ 494 - // [structural cycle] letCycleFail.t1.a.c: structural cycle 495 + // [structural cycle] letCycleFail.t1.a.X: structural cycle: 496 + // ./in.cue:32:6 497 } 498 } 499 } 500 @@ -91,23 +88,33 @@ 501 } 502 } 503 } 504 - listCycleOK: (struct){ 505 - a: (_){ _ } 506 - b: (_){ _ } 507 - c: (_){ _ } 508 + listCycleOK: (_|_){ 509 + // [structural cycle] 510 + a: (_|_){ 511 + // [structural cycle] listCycleOK.0: structural cycle: 512 + // ./in.cue:48:9 513 + } 514 + b: (_|_){ 515 + // [structural cycle] listCycleOK.0: structural cycle: 516 + // ./in.cue:48:9 517 + } 518 + c: (_|_){ 519 + // [structural cycle] listCycleOK.0: structural cycle: 520 + // ./in.cue:48:9 521 + } 522 } 523 disjunctionCycle: (_|_){ 524 // [eval] 525 a: (_|_){ 526 - // [eval] disjunctionCycle.a: cannot use 1 (type int) as list in argument 1 to and: 527 - // ./in.cue:54:9 528 - } 529 - b: (_|_){ 530 - // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 531 - // ./in.cue:54:9 532 - } 533 - c: (_|_){ 534 - // [eval] disjunctionCycle.c: cannot use 1 (type int) as list in argument 1 to and: 535 + // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 536 + // ./in.cue:54:9 537 + } 538 + b: (_|_){ 539 + // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 540 + // ./in.cue:54:9 541 + } 542 + c: (_|_){ 543 + // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 544 // ./in.cue:54:9 545 } 546 } 547 @@ -116,24 +123,33 @@ 548 #A: (_|_){ 549 // [structural cycle] 550 a: (_|_){ 551 - // [structural cycle] b: structural cycle: 552 - // ./in.cue:60:6 553 + // [structural cycle] forCycle.0.b: structural cycle: 554 + // ./in.cue:60:9 555 } 556 } 557 #B: (_|_){ 558 - // [structural cycle] b: structural cycle: 559 - // ./in.cue:60:6 560 - } 561 - } 562 - letCycleWithAnd: (struct){ 563 - a: (struct){ 564 - d: (struct){ 565 - } 566 - } 567 - b: (struct){ 568 - } 569 - c: (struct){ 570 - d: (struct){ 571 + // [structural cycle] forCycle.0.b: structural cycle: 572 + // ./in.cue:60:9 573 + } 574 + } 575 + letCycleWithAnd: (_|_){ 576 + // [structural cycle] 577 + a: (_|_){ 578 + // [structural cycle] 579 + d: (_|_){ 580 + // [structural cycle] letCycleWithAnd.0: structural cycle: 581 + // ./in.cue:65:9 582 + } 583 + } 584 + b: (_|_){ 585 + // [structural cycle] letCycleWithAnd.0: structural cycle: 586 + // ./in.cue:65:9 587 + } 588 + c: (_|_){ 589 + // [structural cycle] 590 + d: (_|_){ 591 + // [structural cycle] letCycleWithAnd.0: structural cycle: 592 + // ./in.cue:65:9 593 } 594 } 595 } 596 @@ -140,33 +156,31 @@ 597 closeCycle: (_|_){ 598 // [structural cycle] 599 a: (_|_){ 600 - // [structural cycle] closeCycle.a: structural cycle 601 - } 602 - b: (_|_){ 603 - // [structural cycle] 604 - d: (_|_){ 605 - // [structural cycle] closeCycle.b.d: structural cycle 606 - } 607 - } 608 - c: (_|_){ 609 - // [structural cycle] closeCycle.c: structural cycle: 610 - // ./in.cue:71:15 611 + // [structural cycle] closeCycle.d: structural cycle: 612 + // ./in.cue:71:11 613 + } 614 + b: (_|_){ 615 + // [structural cycle] closeCycle.d: structural cycle: 616 + // ./in.cue:71:11 617 + } 618 + c: (_|_){ 619 + // [structural cycle] closeCycle.d: structural cycle: 620 + // ./in.cue:71:11 621 } 622 } 623 structCycle: (_|_){ 624 // [structural cycle] 625 a: (_|_){ 626 - // [structural cycle] structCycle.a: structural cycle 627 - } 628 - b: (_|_){ 629 - // [structural cycle] 630 - d: (_|_){ 631 - // [structural cycle] structCycle.b.d: structural cycle 632 - } 633 - } 634 - c: (_|_){ 635 - // [structural cycle] structCycle.c: structural cycle: 636 - // ./in.cue:77:14 637 + // [structural cycle] structCycle.0.d: structural cycle: 638 + // ./in.cue:77:9 639 + } 640 + b: (_|_){ 641 + // [structural cycle] structCycle.0.d: structural cycle: 642 + // ./in.cue:77:9 643 + } 644 + c: (_|_){ 645 + // [structural cycle] structCycle.0.d: structural cycle: 646 + // ./in.cue:77:9 647 } 648 } 649 embedCycle: (_|_){ 650 @@ -187,43 +201,36 @@ 651 listAddCycle: (_|_){ 652 // [structural cycle] 653 a: (_|_){ 654 - // [structural cycle] listAddCycle.a: structural cycle 655 - } 656 - b: (_|_){ 657 - // [structural cycle] 658 - 0: (_|_){ 659 - // [structural cycle] 660 - 0: (_|_){ 661 - // [structural cycle] listAddCycle.b.0.0: structural cycle 662 - } 663 - 1: (_|_){ 664 - // [structural cycle] listAddCycle.b.0.1: structural cycle 665 - } 666 - } 667 - 1: (_|_){ 668 - // [structural cycle] 669 - } 670 - } 671 - c: (_|_){ 672 - // [structural cycle] listAddCycle.c: structural cycle: 673 - // ./in.cue:89:6 674 + // [structural cycle] listAddCycle.0: structural cycle: 675 + // ./in.cue:89:5 676 + // listAddCycle.0: structural cycle: 677 + // ./in.cue:89:11 678 + } 679 + b: (_|_){ 680 + // [structural cycle] listAddCycle.0: structural cycle: 681 + // ./in.cue:89:5 682 + // listAddCycle.0: structural cycle: 683 + // ./in.cue:89:11 684 + } 685 + c: (_|_){ 686 + // [structural cycle] listAddCycle.0: structural cycle: 687 + // ./in.cue:89:5 688 + // listAddCycle.0: structural cycle: 689 + // ./in.cue:89:11 690 } 691 } 692 listMulCycle: (_|_){ 693 - // [eval] 694 - a: (_|_){ 695 - // [eval] listMulCycle.a: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 696 - // ./in.cue:95:5 697 - // ./in.cue:95:9 698 - } 699 - b: (_|_){ 700 - // [eval] listMulCycle.b: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 701 - // ./in.cue:95:5 702 - // ./in.cue:95:9 703 - } 704 - c: (_|_){ 705 - // [eval] listMulCycle.c: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 706 - // ./in.cue:95:5 707 + // [structural cycle] 708 + a: (_|_){ 709 + // [structural cycle] listMulCycle.0.a.b: structural cycle: 710 + // ./in.cue:95:9 711 + } 712 + b: (_|_){ 713 + // [structural cycle] listMulCycle.0.a.b: structural cycle: 714 + // ./in.cue:95:9 715 + } 716 + c: (_|_){ 717 + // [structural cycle] listMulCycle.0.a.b: structural cycle: 718 // ./in.cue:95:9 719 } 720 } 721 @@ -234,21 +241,21 @@ 722 } 723 x: (_|_){ 724 // [eval] 725 - a: (string){ string } 726 b: (_|_){ 727 // [eval] closeFail.x.b: field not allowed: 728 + // ./in.cue:103:6 729 // ./in.cue:102:6 730 - // ./in.cue:103:12 731 - // ./in.cue:104:6 732 // ./in.cue:105:5 733 } 734 + a: (string){ string } 735 } 736 } 737 printCycle: (_|_){ 738 - // [structural cycle] 739 - a: (_|_){ 740 - // [structural cycle] printCycle.a.X.X: structural cycle: 741 - // ./in.cue:111:6 742 + // [eval] 743 + a: (_|_){ 744 + // [eval] printCycle.a: cannot use {X:~(printCycle.a)} (type struct) as type bool: 745 + // ./in.cue:111:3 746 + X: ~(printCycle.a) 747 } 748 } 749 } 750 -- diff/todo/p1 -- 751 letCycleOK.t2: spurious error 752 listCycleOK: spurious error ("and" function) 753 letCycleWithAnd: spurious error ("and" function) 754 -- out/eval -- 755 Errors: 756 closeCycle.a: structural cycle 757 closeCycle.b.d: structural cycle 758 closeFail.x.b: field not allowed: 759 ./in.cue:102:6 760 ./in.cue:103:12 761 ./in.cue:104:6 762 ./in.cue:105:5 763 letCycleFail.t1.a.c: structural cycle 764 listAddCycle.a: structural cycle 765 listAddCycle.b.0.0: structural cycle 766 listAddCycle.b.0.1: structural cycle 767 structCycle.a: structural cycle 768 structCycle.b.d: structural cycle 769 disjunctionCycle.a: cannot use 1 (type int) as list in argument 1 to and: 770 ./in.cue:54:9 771 disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 772 ./in.cue:54:9 773 disjunctionCycle.c: cannot use 1 (type int) as list in argument 1 to and: 774 ./in.cue:54:9 775 b: structural cycle: 776 ./in.cue:60:6 777 closeCycle.c: structural cycle: 778 ./in.cue:71:15 779 structCycle.c: structural cycle: 780 ./in.cue:77:14 781 embedCycle: structural cycle: 782 ./in.cue:83:11 783 listAddCycle.c: structural cycle: 784 ./in.cue:89:6 785 listMulCycle.a: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 786 ./in.cue:95:5 787 ./in.cue:95:9 788 listMulCycle.b: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 789 ./in.cue:95:5 790 ./in.cue:95:9 791 listMulCycle.c: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 792 ./in.cue:95:5 793 ./in.cue:95:9 794 printCycle.a.X.X: structural cycle: 795 ./in.cue:111:6 796 797 Result: 798 (_|_){ 799 // [eval] 800 letCycleOK: (struct){ 801 t1: (struct){ 802 b: (_){ _ } 803 let X#1 = (_){ _ } 804 c: (_){ _ } 805 } 806 t2: (struct){ 807 a: (struct){ 808 b: (int){ 1 } 809 let X#2 = (_|_){ 810 // [structural cycle] letCycleOK.t2.a.X: structural cycle 811 } 812 c: (int){ 1 } 813 } 814 } 815 } 816 letCycleFail: (_|_){ 817 // [structural cycle] 818 t1: (_|_){ 819 // [structural cycle] 820 a: (_|_){ 821 // [structural cycle] 822 b: (int){ 1 } 823 let X#3 = (_|_){ 824 // [structural cycle] letCycleFail.t1.a.X: structural cycle 825 } 826 c: (_|_){ 827 // [structural cycle] letCycleFail.t1.a.c: structural cycle 828 } 829 } 830 } 831 t2: (struct){ 832 a: (struct){ 833 let X#4 = (struct){ 834 let X#4 = (_|_){ 835 // [structural cycle] letCycleFail.t2.a.X.X: structural cycle: 836 // ./in.cue:41:6 837 } 838 x: (struct){ 839 y: (string){ "" } 840 } 841 } 842 x: (struct){ 843 y: (string){ "" } 844 } 845 } 846 } 847 } 848 listCycleOK: (struct){ 849 a: (_){ _ } 850 b: (_){ _ } 851 c: (_){ _ } 852 } 853 disjunctionCycle: (_|_){ 854 // [eval] 855 a: (_|_){ 856 // [eval] disjunctionCycle.a: cannot use 1 (type int) as list in argument 1 to and: 857 // ./in.cue:54:9 858 } 859 b: (_|_){ 860 // [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 861 // ./in.cue:54:9 862 } 863 c: (_|_){ 864 // [eval] disjunctionCycle.c: cannot use 1 (type int) as list in argument 1 to and: 865 // ./in.cue:54:9 866 } 867 } 868 forCycle: (_|_){ 869 // [structural cycle] 870 #A: (_|_){ 871 // [structural cycle] 872 a: (_|_){ 873 // [structural cycle] b: structural cycle: 874 // ./in.cue:60:6 875 } 876 } 877 #B: (_|_){ 878 // [structural cycle] b: structural cycle: 879 // ./in.cue:60:6 880 } 881 } 882 letCycleWithAnd: (struct){ 883 a: (struct){ 884 d: (struct){ 885 } 886 } 887 b: (struct){ 888 } 889 c: (struct){ 890 d: (struct){ 891 } 892 } 893 } 894 closeCycle: (_|_){ 895 // [structural cycle] 896 a: (_|_){ 897 // [structural cycle] closeCycle.a: structural cycle 898 } 899 b: (_|_){ 900 // [structural cycle] 901 d: (_|_){ 902 // [structural cycle] closeCycle.b.d: structural cycle 903 } 904 } 905 c: (_|_){ 906 // [structural cycle] closeCycle.c: structural cycle: 907 // ./in.cue:71:15 908 } 909 } 910 structCycle: (_|_){ 911 // [structural cycle] 912 a: (_|_){ 913 // [structural cycle] structCycle.a: structural cycle 914 } 915 b: (_|_){ 916 // [structural cycle] 917 d: (_|_){ 918 // [structural cycle] structCycle.b.d: structural cycle 919 } 920 } 921 c: (_|_){ 922 // [structural cycle] structCycle.c: structural cycle: 923 // ./in.cue:77:14 924 } 925 } 926 embedCycle: (_|_){ 927 // [structural cycle] 928 a: (_|_){ 929 // [structural cycle] embedCycle: structural cycle: 930 // ./in.cue:83:11 931 } 932 b: (_|_){ 933 // [structural cycle] embedCycle: structural cycle: 934 // ./in.cue:83:11 935 } 936 c: (_|_){ 937 // [structural cycle] embedCycle: structural cycle: 938 // ./in.cue:83:11 939 } 940 } 941 listAddCycle: (_|_){ 942 // [structural cycle] 943 a: (_|_){ 944 // [structural cycle] listAddCycle.a: structural cycle 945 } 946 b: (_|_){ 947 // [structural cycle] 948 0: (_|_){ 949 // [structural cycle] 950 0: (_|_){ 951 // [structural cycle] listAddCycle.b.0.0: structural cycle 952 } 953 1: (_|_){ 954 // [structural cycle] listAddCycle.b.0.1: structural cycle 955 } 956 } 957 1: (_|_){ 958 // [structural cycle] 959 } 960 } 961 c: (_|_){ 962 // [structural cycle] listAddCycle.c: structural cycle: 963 // ./in.cue:89:6 964 } 965 } 966 listMulCycle: (_|_){ 967 // [eval] 968 a: (_|_){ 969 // [eval] listMulCycle.a: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 970 // ./in.cue:95:5 971 // ./in.cue:95:9 972 } 973 b: (_|_){ 974 // [eval] listMulCycle.b: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 975 // ./in.cue:95:5 976 // ./in.cue:95:9 977 } 978 c: (_|_){ 979 // [eval] listMulCycle.c: invalid operands 3 and [{a:{b:c}}] to '+' (type int and list): 980 // ./in.cue:95:5 981 // ./in.cue:95:9 982 } 983 } 984 closeFail: (_|_){ 985 // [eval] 986 #T: (#struct){ 987 a: (string){ string } 988 } 989 x: (_|_){ 990 // [eval] 991 a: (string){ string } 992 b: (_|_){ 993 // [eval] closeFail.x.b: field not allowed: 994 // ./in.cue:102:6 995 // ./in.cue:103:12 996 // ./in.cue:104:6 997 // ./in.cue:105:5 998 } 999 } 1000 } 1001 printCycle: (_|_){ 1002 // [structural cycle] 1003 a: (_|_){ 1004 // [structural cycle] printCycle.a.X.X: structural cycle: 1005 // ./in.cue:111:6 1006 } 1007 } 1008 } 1009 -- out/compile -- 1010 --- in.cue 1011 { 1012 letCycleOK: { 1013 t1: { 1014 b: 〈0;c〉 1015 let X#1 = 〈0;b〉 1016 c: 〈0;let X#1〉 1017 } 1018 } 1019 letCycleOK: { 1020 t2: { 1021 a: { 1022 b: 1 1023 let X#2 = 〈1;a〉 1024 c: 〈0;let X#2〉.b 1025 } 1026 } 1027 } 1028 letCycleFail: { 1029 t1: { 1030 a: { 1031 b: 1 1032 let X#3 = 〈1;a〉 1033 c: 〈0;let X#3〉 1034 } 1035 } 1036 } 1037 letCycleFail: { 1038 t2: { 1039 a: { 1040 let X#4 = 〈1;a〉 1041 if (〈0;let X#4〉 == _|_(explicit error (_|_ literal) in source)) {} 1042 x: { 1043 y: "" 1044 } 1045 } 1046 } 1047 } 1048 listCycleOK: { 1049 a: 〈0;b〉 1050 b: and([ 1051 〈1;c〉, 1052 ]) 1053 c: 〈0;a〉 1054 } 1055 disjunctionCycle: { 1056 a: 〈0;b〉 1057 b: and((1|〈0;c〉)) 1058 c: 〈0;a〉 1059 } 1060 forCycle: { 1061 #A: { 1062 a: 〈1;#B〉 1063 } 1064 #B: or([ 1065 for _, x in 〈1;#A〉 { 1066 b: 〈1;x〉 1067 }, 1068 ]) 1069 } 1070 letCycleWithAnd: { 1071 a: { 1072 d: 〈1;b〉 1073 } 1074 b: and([ 1075 for _, x in 〈1;a〉 let y = 〈0;x〉 { 1076 〈1;y〉 1077 }, 1078 ]) 1079 c: 〈0;a〉 1080 } 1081 closeCycle: { 1082 a: 〈0;b〉 1083 b: close({ 1084 d: 〈1;c〉 1085 }) 1086 c: 〈0;a〉 1087 } 1088 structCycle: { 1089 a: 〈0;b〉 1090 b: and([ 1091 { 1092 d: 〈2;c〉 1093 }, 1094 ]) 1095 c: 〈0;a〉 1096 } 1097 embedCycle: { 1098 a: 〈0;b〉 1099 b: close({ 1100 〈1;c〉 1101 }) 1102 c: 〈0;a〉 1103 } 1104 listAddCycle: { 1105 a: 〈0;b〉 1106 b: ([ 1107 〈1;c〉, 1108 ] + [ 1109 〈1;c〉, 1110 ]) 1111 c: 〈0;a〉 1112 } 1113 listMulCycle: { 1114 a: 〈0;b〉 1115 b: (3 + [ 1116 { 1117 a: { 1118 b: 〈3;c〉 1119 } 1120 }, 1121 ]) 1122 c: 〈0;a〉 1123 } 1124 closeFail: { 1125 #T: { 1126 [_]: _ 1127 } 1128 #T: close({ 1129 a: string 1130 }) 1131 x: 〈0;#T〉 1132 x: { 1133 b: "foo" 1134 } 1135 } 1136 printCycle: { 1137 a: { 1138 X: 〈1;a〉 1139 if 〈0;X〉 {} 1140 } 1141 } 1142 }