cuelang.org/go@v0.13.0/cue/testdata/cycle/compbottom2.txtar (about) 1 -- in.cue -- 2 self: { 3 // This is an incomplete error, as it may succeed when the user 4 // explicitly specifies a value for fail.a.b. 5 fail: { 6 a: { 7 if a.b == _|_ { 8 b: 1 9 } 10 } 11 } 12 13 // This is an incomplete error, as it may succeed when the user 14 // explicitly specifies a value for a.b. 15 isConcreteFail: t1:{ 16 a: { 17 if a.b == _|_ { 18 b: 1 19 } 20 b: int 21 } 22 } 23 24 isConcreteFail: t2:{ 25 a: { 26 if a.b == _|_ { 27 b: 1 28 } 29 b?: int 30 } 31 } 32 33 // This is an incomplete error, as it may succeed when the user 34 // explicitly specifies a value for a.b. 35 // TODO: new builtin semantics. 36 // if isconcrete(a.b) -->> cyclic error evaluating isconcrete. 37 // if isdefined(a.b) -->> evaluate to true as a.b is int, result is 1 38 // if !isdefined(a.b) -->> evaluate to false, a.b remains int 39 isNotConcrete: t1: { 40 a: { 41 if a.b != _|_ { 42 b: 1 43 } 44 b: int 45 } 46 } 47 isNotConcrete: t2: { 48 a: { 49 if a.b != _|_ { 50 b: 1 51 } 52 b?: int 53 } 54 } 55 56 } 57 58 -- mutual.cue -- 59 mutual: { 60 noConflicts: { 61 a: {if b.foo == _|_ {new: ""}} 62 b: {if a.bar == _|_ {new: ""}} 63 } 64 65 mutualCycleFail: { 66 b: {if a.bar == _|_ {foo: ""}} 67 a: {if b.foo == _|_ {bar: ""}} 68 } 69 70 brokenCycleSuccess: { 71 a: { if b.foo == _|_ { foo: "" } } 72 b: { if a.bar == _|_ { bar: "" } } 73 a: bar: "" 74 } 75 76 allowOneDirectionalDependency: { 77 p1: { 78 a: { if b.foo == _|_ { bar: "" } } // added 79 b: { if a.bar == _|_ { new: "" } } // not added 80 } 81 p2: { 82 a: { if b.foo == _|_ { new: "" } } 83 b: { if a.bar == _|_ { foo: "" } } 84 } 85 } 86 87 oneDirectionalBrokenConflictSuccess: p1: { 88 b: foo: "" 89 a: { if b.foo == _|_ { bar: "" } } 90 b: { if a.bar == _|_ { new: "" } } 91 } 92 oneDirectionalBrokenConflictSuccess: p2: { 93 a: { if b.foo == _|_ { bar: "" } } 94 b: foo: "" 95 b: { if a.bar == _|_ { new: "" } } 96 } 97 oneDirectionalBrokenConflictSuccess: p3: { 98 a: { if b.foo == _|_ { bar: "" } } 99 b: { if a.bar == _|_ { new: "" } } 100 b: foo: "" 101 } 102 oneDirectionalBrokenConflictSuccess: p4: { 103 b: foo: "" 104 b: { if a.bar == _|_ { new: "" } } 105 a: { if b.foo == _|_ { bar: "" } } 106 } 107 oneDirectionalBrokenConflictSuccess: p5: { 108 b: { if a.bar == _|_ { new: "" } } 109 b: foo: "" 110 a: { if b.foo == _|_ { bar: "" } } 111 } 112 oneDirectionalBrokenConflictSuccess: p6: { 113 b: { if a.bar == _|_ { new: "" } } 114 a: { if b.foo == _|_ { bar: "" } } 115 b: foo: "" 116 } 117 } 118 119 -- mutualsamestruct.cue -- 120 sameStruct: { 121 chainSuccess: a: { 122 raises?: {} 123 if raises == _|_ { 124 ret: a: 1 125 } 126 ret?: {} 127 if ret != _|_ { 128 foo: a: 1 129 } 130 } 131 132 chainSuccess: b: { 133 if ret != _|_ { 134 foo: a: 1 135 } 136 raises?: {} 137 if raises == _|_ { 138 ret: a: 1 139 } 140 ret?: {} 141 } 142 143 cycleFail: t1: p1: { 144 raises?: {} 145 if raises == _|_ { 146 ret: a: 1 147 } 148 ret?: {} 149 if ret != _|_ { 150 raises: a: 1 151 } 152 } 153 154 cycleFail: t1: p2: { 155 ret?: {} 156 if ret != _|_ { 157 raises: a: 1 158 } 159 raises?: {} 160 if raises == _|_ { 161 ret: a: 1 162 } 163 } 164 165 // This test should fail with a cycle error. Even though raises and ret are 166 // both known to be defined, comparison against bottom requires that the 167 // structs be recursively checked for errors. We disallow that here, because 168 // the structs mutually depend on each other. 169 // TODO: consider allowing a specific postCheck for determining if an arc 170 // is erroneous. 171 cycleFail: t2: p1: { 172 raises: {} 173 if raises == _|_ { 174 ret: a: 1 175 } 176 ret: {} 177 if ret != _|_ { 178 raises: a: 1 179 } 180 } 181 182 // Same as above test, but different order. It may be that the specific 183 // fields that are added are different for the two cases. This is fine as 184 // long as the parent fails, as that error is ultimately what represents 185 // the value as a whole. 186 cycleFail: t2: p2: { 187 ret: {} 188 if ret != _|_ { 189 raises: a: 1 190 } 191 raises: {} 192 if raises == _|_ { 193 ret: a: 1 194 } 195 } 196 197 // This test should fail similarly to the above tests. The fields ret and 198 // raises are not concrete, but may still become a struct and thus need 199 // to be recursively checked. 200 cycleFail: t3: p1: { 201 raises: _ 202 if raises == _|_ { 203 ret: a: 1 204 } 205 ret: _ 206 if ret != _|_ { 207 raises: a: 1 208 } 209 } 210 211 cycleFail: t3: p2: { 212 ret: _ 213 if ret != _|_ { 214 raises: a: 1 215 } 216 raises: _ 217 if raises == _|_ { 218 ret: a: 1 219 } 220 } 221 222 defCloseSuccess: { 223 #Example: { 224 raises?: { 225 runtime?: string 226 } 227 228 if raises == _|_ { 229 ret?: _ 230 } 231 } 232 233 expr: #Example & { 234 ret: 2 235 } 236 } 237 } 238 239 -- nestedchain.cue -- 240 // Issue 241 nestedChain: { 242 cycleFail: { 243 if #E.x != _|_ { 244 #E: y: true 245 } 246 if #E.y == _|_ { 247 #E: x: true 248 } 249 #E: [_]: bool 250 } 251 252 brokenCycleSuccess: { 253 if #E.x != _|_ { 254 #E: y: true 255 } 256 if #E.y == _|_ { 257 #E: x: true 258 } 259 #E: [_]: bool 260 #E: x: true 261 } 262 263 doubleAddfail: { 264 if #E.x == _|_ { 265 #E: y: true 266 } 267 if #E.y == _|_ { 268 #E: x: true 269 } 270 #E: [_]: bool 271 } 272 273 trippleSuccess: { 274 if #E.x != _|_ { 275 #E: y: true 276 } 277 if #E.y != _|_ { 278 z: true 279 } 280 #E: x: true 281 } 282 } 283 -- issue3836.cue -- 284 issue3836: hidden: { 285 _Value: { 286 foo?: _ 287 bar?: _ 288 if (foo | bar) == _|_ { 289 bar: type: "bar" 290 } 291 out: [if bar != _|_ {"bar is set"}] 292 } 293 _Value.out 294 } 295 issue3836: exposed: { 296 foo?: _ 297 bar?: _ 298 if (foo | bar) == _|_ { 299 bar: type: "bar" 300 } 301 out: [if bar != _|_ {"bar is set"}] 302 } 303 -- issue3838.cue -- 304 issue3838: { 305 #T: { 306 subject: { 307 in: opt?: foo: int 308 out: [ 309 if in.opt != _|_ {in.opt.foo}, 310 0, 311 ][0] 312 } 313 _test: { 314 assert: { 315 pass: bool 316 } 317 assert: { 318 notOk: _ 319 pass: false 320 } | { 321 invoke: _ 322 res: subject.out 323 pass: true 324 } 325 } 326 results: _test.assert.pass 327 } 328 (#T & { 329 _test: assert: invoke: "foo" 330 }).results 331 } 332 -- out/eval/stats -- 333 Leaks: 29 334 Freed: 207 335 Reused: 201 336 Allocs: 35 337 Retain: 104 338 339 Unifications: 220 340 Conjuncts: 279 341 Disjuncts: 302 342 -- out/evalalpha -- 343 (struct){ 344 self: (struct){ 345 fail: (struct){ 346 a: (_|_){ 347 // [incomplete] self.fail.a.b: cyclic reference to field b: 348 // ./in.cue:6:4 349 } 350 } 351 isConcreteFail: (struct){ 352 t1: (struct){ 353 a: (struct){ 354 b: (int){ 1 } 355 } 356 } 357 t2: (struct){ 358 a: (_|_){ 359 // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation: 360 // ./in.cue:25:7 361 } 362 } 363 } 364 isNotConcrete: (struct){ 365 t1: (struct){ 366 a: (struct){ 367 b: (int){ int } 368 } 369 } 370 t2: (struct){ 371 a: (struct){ 372 b?: (int){ int } 373 } 374 } 375 } 376 } 377 issue3836: (struct){ 378 hidden: (#list){ 379 _Value: (_|_){ 380 // [incomplete] issue3836.hidden._Value.bar.type: cyclic reference to field type: 381 // ./issue3836.cue:5:3 382 foo?: (_){ _ } 383 bar?: (struct){ 384 } 385 out: (#list){ 386 } 387 } 388 } 389 exposed: (_|_){ 390 // [cycle] issue3836.exposed: circular dependency in evaluation of conditionals: (foo|bar) changed after evaluation: 391 // ./issue3836.cue:15:6 392 } 393 } 394 issue3838: (bool){ 395 true 396 #T: (#struct){ 397 subject: (#struct){ 398 in: (#struct){ 399 opt?: (#struct){ 400 foo: (int){ int } 401 } 402 } 403 out: (int){ 0 } 404 } 405 _test: (#struct){ 406 assert: (#struct){ |((#struct){ 407 pass: (bool){ false } 408 notOk: (_){ _ } 409 }, (#struct){ 410 pass: (bool){ true } 411 invoke: (_){ _ } 412 res: (int){ 0 } 413 }) } 414 } 415 results: (_|_){ 416 // [incomplete] issue3838.#T.results: unresolved disjunction {pass:false,notOk:_} | {pass:true,invoke:_,res:0} (type struct): 417 // ./issue3838.cue:23:12 418 } 419 } 420 } 421 mutual: (struct){ 422 noConflicts: (struct){ 423 a: (struct){ 424 new: (string){ "" } 425 } 426 b: (struct){ 427 new: (string){ "" } 428 } 429 } 430 mutualCycleFail: (struct){ 431 b: (_|_){ 432 // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo: 433 // ./mutual.cue:8:7 434 } 435 a: (_|_){ 436 // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar: 437 // ./mutual.cue:9:7 438 } 439 } 440 brokenCycleSuccess: (struct){ 441 a: (struct){ 442 foo: (string){ "" } 443 bar: (string){ "" } 444 } 445 b: (struct){ 446 } 447 } 448 allowOneDirectionalDependency: (struct){ 449 p1: (struct){ 450 a: (struct){ 451 bar: (string){ "" } 452 } 453 b: (struct){ 454 } 455 } 456 p2: (struct){ 457 a: (struct){ 458 } 459 b: (struct){ 460 foo: (string){ "" } 461 } 462 } 463 } 464 oneDirectionalBrokenConflictSuccess: (struct){ 465 p1: (struct){ 466 b: (struct){ 467 foo: (string){ "" } 468 new: (string){ "" } 469 } 470 a: (struct){ 471 } 472 } 473 p2: (struct){ 474 a: (struct){ 475 } 476 b: (struct){ 477 foo: (string){ "" } 478 new: (string){ "" } 479 } 480 } 481 p3: (struct){ 482 a: (struct){ 483 } 484 b: (struct){ 485 new: (string){ "" } 486 foo: (string){ "" } 487 } 488 } 489 p4: (struct){ 490 b: (struct){ 491 foo: (string){ "" } 492 new: (string){ "" } 493 } 494 a: (struct){ 495 } 496 } 497 p5: (struct){ 498 b: (struct){ 499 new: (string){ "" } 500 foo: (string){ "" } 501 } 502 a: (struct){ 503 } 504 } 505 p6: (struct){ 506 b: (struct){ 507 new: (string){ "" } 508 foo: (string){ "" } 509 } 510 a: (struct){ 511 } 512 } 513 } 514 } 515 sameStruct: (struct){ 516 chainSuccess: (struct){ 517 a: (struct){ 518 raises?: (struct){ 519 } 520 ret: (struct){ 521 a: (int){ 1 } 522 } 523 foo: (struct){ 524 a: (int){ 1 } 525 } 526 } 527 b: (struct){ 528 foo: (struct){ 529 a: (int){ 1 } 530 } 531 raises?: (struct){ 532 } 533 ret: (struct){ 534 a: (int){ 1 } 535 } 536 } 537 } 538 cycleFail: (struct){ 539 t1: (struct){ 540 p1: (_|_){ 541 // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 542 // ./mutualsamestruct.cue:26:6 543 } 544 p2: (_|_){ 545 // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 546 // ./mutualsamestruct.cue:37:6 547 } 548 } 549 t2: (struct){ 550 p1: (_|_){ 551 // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 552 // ./mutualsamestruct.cue:54:6 553 } 554 p2: (_|_){ 555 // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 556 // ./mutualsamestruct.cue:69:6 557 } 558 } 559 t3: (struct){ 560 p1: (_|_){ 561 // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 562 // ./mutualsamestruct.cue:83:6 563 } 564 p2: (_|_){ 565 // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 566 // ./mutualsamestruct.cue:94:6 567 } 568 } 569 } 570 defCloseSuccess: (struct){ 571 #Example: (#struct){ 572 raises?: (#struct){ 573 runtime?: (string){ string } 574 } 575 ret?: (_){ _ } 576 } 577 expr: (#struct){ 578 ret: (int){ 2 } 579 raises?: (#struct){ 580 runtime?: (string){ string } 581 } 582 } 583 } 584 } 585 nestedChain: (struct){ 586 cycleFail: (_|_){ 587 // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x: 588 // ./nestedchain.cue:7:3 589 #E: (#struct){ 590 } 591 } 592 brokenCycleSuccess: (struct){ 593 #E: (#struct){ 594 y: (bool){ true } 595 x: (bool){ true } 596 } 597 } 598 doubleAddfail: (_|_){ 599 // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y: 600 // ./nestedchain.cue:25:3 601 // nestedChain.doubleAddfail.#E.x: cyclic reference to field x: 602 // ./nestedchain.cue:28:3 603 #E: (#struct){ 604 } 605 } 606 trippleSuccess: (struct){ 607 #E: (#struct){ 608 y: (bool){ true } 609 x: (bool){ true } 610 } 611 z: (bool){ true } 612 } 613 } 614 } 615 -- diff/-out/evalalpha<==>+out/eval -- 616 diff old new 617 --- old 618 +++ new 619 @@ -2,14 +2,14 @@ 620 self: (struct){ 621 fail: (struct){ 622 a: (_|_){ 623 - // [cycle] self.fail.a: cycle with field a.b: 624 - // ./in.cue:6:7 625 + // [incomplete] self.fail.a.b: cyclic reference to field b: 626 + // ./in.cue:6:4 627 } 628 } 629 isConcreteFail: (struct){ 630 t1: (struct){ 631 - a: (_|_){ 632 - // [cycle] cycle error 633 + a: (struct){ 634 + b: (int){ 1 } 635 } 636 } 637 t2: (struct){ 638 @@ -21,8 +21,8 @@ 639 } 640 isNotConcrete: (struct){ 641 t1: (struct){ 642 - a: (_|_){ 643 - // [cycle] cycle error 644 + a: (struct){ 645 + b: (int){ int } 646 } 647 } 648 t2: (struct){ 649 @@ -35,10 +35,14 @@ 650 issue3836: (struct){ 651 hidden: (#list){ 652 _Value: (_|_){ 653 - // [cycle] issue3836.hidden._Value: circular dependency in evaluation of conditionals: (foo|bar) changed after evaluation: 654 - // ./issue3836.cue:5:7 655 - } 656 - 0: (string){ "bar is set" } 657 + // [incomplete] issue3836.hidden._Value.bar.type: cyclic reference to field type: 658 + // ./issue3836.cue:5:3 659 + foo?: (_){ _ } 660 + bar?: (struct){ 661 + } 662 + out: (#list){ 663 + } 664 + } 665 } 666 exposed: (_|_){ 667 // [cycle] issue3836.exposed: circular dependency in evaluation of conditionals: (foo|bar) changed after evaluation: 668 @@ -83,12 +87,12 @@ 669 } 670 mutualCycleFail: (struct){ 671 b: (_|_){ 672 - // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo: 673 - // ./mutual.cue:9:10 674 - } 675 - a: (_|_){ 676 - // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo: 677 - // ./mutual.cue:9:10 678 + // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo: 679 + // ./mutual.cue:8:7 680 + } 681 + a: (_|_){ 682 + // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar: 683 + // ./mutual.cue:9:7 684 } 685 } 686 brokenCycleSuccess: (struct){ 687 @@ -229,17 +233,19 @@ 688 ret?: (_){ _ } 689 } 690 expr: (#struct){ 691 - raises?: (#struct){ 692 - runtime?: (string){ string } 693 - } 694 ret: (int){ 2 } 695 + raises?: (#struct){ 696 + runtime?: (string){ string } 697 + } 698 } 699 } 700 } 701 nestedChain: (struct){ 702 cycleFail: (_|_){ 703 - // [cycle] nestedChain.cycleFail: cycle with field #E.y: 704 - // ./nestedchain.cue:7:6 705 + // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x: 706 + // ./nestedchain.cue:7:3 707 + #E: (#struct){ 708 + } 709 } 710 brokenCycleSuccess: (struct){ 711 #E: (#struct){ 712 @@ -248,8 +254,12 @@ 713 } 714 } 715 doubleAddfail: (_|_){ 716 - // [cycle] nestedChain.doubleAddfail: cycle with field #E.y: 717 - // ./nestedchain.cue:28:6 718 + // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y: 719 + // ./nestedchain.cue:25:3 720 + // nestedChain.doubleAddfail.#E.x: cyclic reference to field x: 721 + // ./nestedchain.cue:28:3 722 + #E: (#struct){ 723 + } 724 } 725 trippleSuccess: (struct){ 726 #E: (#struct){ 727 -- diff/explanation -- 728 self.isConcreteFail: t1: int value is not an error. 729 self.isNotConcrete: t1: int value is not an error. 730 -- out/eval -- 731 (struct){ 732 self: (struct){ 733 fail: (struct){ 734 a: (_|_){ 735 // [cycle] self.fail.a: cycle with field a.b: 736 // ./in.cue:6:7 737 } 738 } 739 isConcreteFail: (struct){ 740 t1: (struct){ 741 a: (_|_){ 742 // [cycle] cycle error 743 } 744 } 745 t2: (struct){ 746 a: (_|_){ 747 // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation: 748 // ./in.cue:25:7 749 } 750 } 751 } 752 isNotConcrete: (struct){ 753 t1: (struct){ 754 a: (_|_){ 755 // [cycle] cycle error 756 } 757 } 758 t2: (struct){ 759 a: (struct){ 760 b?: (int){ int } 761 } 762 } 763 } 764 } 765 issue3836: (struct){ 766 hidden: (#list){ 767 _Value: (_|_){ 768 // [cycle] issue3836.hidden._Value: circular dependency in evaluation of conditionals: (foo|bar) changed after evaluation: 769 // ./issue3836.cue:5:7 770 } 771 0: (string){ "bar is set" } 772 } 773 exposed: (_|_){ 774 // [cycle] issue3836.exposed: circular dependency in evaluation of conditionals: (foo|bar) changed after evaluation: 775 // ./issue3836.cue:15:6 776 } 777 } 778 issue3838: (bool){ 779 true 780 #T: (#struct){ 781 subject: (#struct){ 782 in: (#struct){ 783 opt?: (#struct){ 784 foo: (int){ int } 785 } 786 } 787 out: (int){ 0 } 788 } 789 _test: (#struct){ 790 assert: (#struct){ |((#struct){ 791 pass: (bool){ false } 792 notOk: (_){ _ } 793 }, (#struct){ 794 pass: (bool){ true } 795 invoke: (_){ _ } 796 res: (int){ 0 } 797 }) } 798 } 799 results: (_|_){ 800 // [incomplete] issue3838.#T.results: unresolved disjunction {pass:false,notOk:_} | {pass:true,invoke:_,res:0} (type struct): 801 // ./issue3838.cue:23:12 802 } 803 } 804 } 805 mutual: (struct){ 806 noConflicts: (struct){ 807 a: (struct){ 808 new: (string){ "" } 809 } 810 b: (struct){ 811 new: (string){ "" } 812 } 813 } 814 mutualCycleFail: (struct){ 815 b: (_|_){ 816 // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo: 817 // ./mutual.cue:9:10 818 } 819 a: (_|_){ 820 // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo: 821 // ./mutual.cue:9:10 822 } 823 } 824 brokenCycleSuccess: (struct){ 825 a: (struct){ 826 foo: (string){ "" } 827 bar: (string){ "" } 828 } 829 b: (struct){ 830 } 831 } 832 allowOneDirectionalDependency: (struct){ 833 p1: (struct){ 834 a: (struct){ 835 bar: (string){ "" } 836 } 837 b: (struct){ 838 } 839 } 840 p2: (struct){ 841 a: (struct){ 842 } 843 b: (struct){ 844 foo: (string){ "" } 845 } 846 } 847 } 848 oneDirectionalBrokenConflictSuccess: (struct){ 849 p1: (struct){ 850 b: (struct){ 851 foo: (string){ "" } 852 new: (string){ "" } 853 } 854 a: (struct){ 855 } 856 } 857 p2: (struct){ 858 a: (struct){ 859 } 860 b: (struct){ 861 foo: (string){ "" } 862 new: (string){ "" } 863 } 864 } 865 p3: (struct){ 866 a: (struct){ 867 } 868 b: (struct){ 869 new: (string){ "" } 870 foo: (string){ "" } 871 } 872 } 873 p4: (struct){ 874 b: (struct){ 875 foo: (string){ "" } 876 new: (string){ "" } 877 } 878 a: (struct){ 879 } 880 } 881 p5: (struct){ 882 b: (struct){ 883 new: (string){ "" } 884 foo: (string){ "" } 885 } 886 a: (struct){ 887 } 888 } 889 p6: (struct){ 890 b: (struct){ 891 new: (string){ "" } 892 foo: (string){ "" } 893 } 894 a: (struct){ 895 } 896 } 897 } 898 } 899 sameStruct: (struct){ 900 chainSuccess: (struct){ 901 a: (struct){ 902 raises?: (struct){ 903 } 904 ret: (struct){ 905 a: (int){ 1 } 906 } 907 foo: (struct){ 908 a: (int){ 1 } 909 } 910 } 911 b: (struct){ 912 foo: (struct){ 913 a: (int){ 1 } 914 } 915 raises?: (struct){ 916 } 917 ret: (struct){ 918 a: (int){ 1 } 919 } 920 } 921 } 922 cycleFail: (struct){ 923 t1: (struct){ 924 p1: (_|_){ 925 // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 926 // ./mutualsamestruct.cue:26:6 927 } 928 p2: (_|_){ 929 // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 930 // ./mutualsamestruct.cue:37:6 931 } 932 } 933 t2: (struct){ 934 p1: (_|_){ 935 // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 936 // ./mutualsamestruct.cue:54:6 937 } 938 p2: (_|_){ 939 // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 940 // ./mutualsamestruct.cue:69:6 941 } 942 } 943 t3: (struct){ 944 p1: (_|_){ 945 // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation: 946 // ./mutualsamestruct.cue:83:6 947 } 948 p2: (_|_){ 949 // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation: 950 // ./mutualsamestruct.cue:94:6 951 } 952 } 953 } 954 defCloseSuccess: (struct){ 955 #Example: (#struct){ 956 raises?: (#struct){ 957 runtime?: (string){ string } 958 } 959 ret?: (_){ _ } 960 } 961 expr: (#struct){ 962 raises?: (#struct){ 963 runtime?: (string){ string } 964 } 965 ret: (int){ 2 } 966 } 967 } 968 } 969 nestedChain: (struct){ 970 cycleFail: (_|_){ 971 // [cycle] nestedChain.cycleFail: cycle with field #E.y: 972 // ./nestedchain.cue:7:6 973 } 974 brokenCycleSuccess: (struct){ 975 #E: (#struct){ 976 y: (bool){ true } 977 x: (bool){ true } 978 } 979 } 980 doubleAddfail: (_|_){ 981 // [cycle] nestedChain.doubleAddfail: cycle with field #E.y: 982 // ./nestedchain.cue:28:6 983 } 984 trippleSuccess: (struct){ 985 #E: (#struct){ 986 y: (bool){ true } 987 x: (bool){ true } 988 } 989 z: (bool){ true } 990 } 991 } 992 } 993 -- out/compile -- 994 --- in.cue 995 { 996 self: { 997 fail: { 998 a: { 999 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) { 1000 b: 1 1001 } 1002 } 1003 } 1004 isConcreteFail: { 1005 t1: { 1006 a: { 1007 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) { 1008 b: 1 1009 } 1010 b: int 1011 } 1012 } 1013 } 1014 isConcreteFail: { 1015 t2: { 1016 a: { 1017 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) { 1018 b: 1 1019 } 1020 b?: int 1021 } 1022 } 1023 } 1024 isNotConcrete: { 1025 t1: { 1026 a: { 1027 if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) { 1028 b: 1 1029 } 1030 b: int 1031 } 1032 } 1033 } 1034 isNotConcrete: { 1035 t2: { 1036 a: { 1037 if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) { 1038 b: 1 1039 } 1040 b?: int 1041 } 1042 } 1043 } 1044 } 1045 } 1046 --- issue3836.cue 1047 { 1048 issue3836: { 1049 hidden: { 1050 _Value: { 1051 foo?: _ 1052 bar?: _ 1053 if ((〈0;foo〉|〈0;bar〉) == _|_(explicit error (_|_ literal) in source)) { 1054 bar: { 1055 type: "bar" 1056 } 1057 } 1058 out: [ 1059 if (〈1;bar〉 != _|_(explicit error (_|_ literal) in source)) { 1060 "bar is set" 1061 }, 1062 ] 1063 } 1064 〈0;_Value〉.out 1065 } 1066 } 1067 issue3836: { 1068 exposed: { 1069 foo?: _ 1070 bar?: _ 1071 if ((〈0;foo〉|〈0;bar〉) == _|_(explicit error (_|_ literal) in source)) { 1072 bar: { 1073 type: "bar" 1074 } 1075 } 1076 out: [ 1077 if (〈1;bar〉 != _|_(explicit error (_|_ literal) in source)) { 1078 "bar is set" 1079 }, 1080 ] 1081 } 1082 } 1083 } 1084 --- issue3838.cue 1085 { 1086 issue3838: { 1087 #T: { 1088 subject: { 1089 in: { 1090 opt?: { 1091 foo: int 1092 } 1093 } 1094 out: [ 1095 if (〈1;in〉.opt != _|_(explicit error (_|_ literal) in source)) { 1096 〈2;in〉.opt.foo 1097 }, 1098 0, 1099 ][0] 1100 } 1101 _test: { 1102 assert: { 1103 pass: bool 1104 } 1105 assert: ({ 1106 notOk: _ 1107 pass: false 1108 }|{ 1109 invoke: _ 1110 res: 〈2;subject〉.out 1111 pass: true 1112 }) 1113 } 1114 results: 〈0;_test〉.assert.pass 1115 } 1116 (〈0;#T〉 & { 1117 _test: { 1118 assert: { 1119 invoke: "foo" 1120 } 1121 } 1122 }).results 1123 } 1124 } 1125 --- mutual.cue 1126 { 1127 mutual: { 1128 noConflicts: { 1129 a: { 1130 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1131 new: "" 1132 } 1133 } 1134 b: { 1135 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1136 new: "" 1137 } 1138 } 1139 } 1140 mutualCycleFail: { 1141 b: { 1142 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1143 foo: "" 1144 } 1145 } 1146 a: { 1147 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1148 bar: "" 1149 } 1150 } 1151 } 1152 brokenCycleSuccess: { 1153 a: { 1154 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1155 foo: "" 1156 } 1157 } 1158 b: { 1159 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1160 bar: "" 1161 } 1162 } 1163 a: { 1164 bar: "" 1165 } 1166 } 1167 allowOneDirectionalDependency: { 1168 p1: { 1169 a: { 1170 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1171 bar: "" 1172 } 1173 } 1174 b: { 1175 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1176 new: "" 1177 } 1178 } 1179 } 1180 p2: { 1181 a: { 1182 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1183 new: "" 1184 } 1185 } 1186 b: { 1187 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1188 foo: "" 1189 } 1190 } 1191 } 1192 } 1193 oneDirectionalBrokenConflictSuccess: { 1194 p1: { 1195 b: { 1196 foo: "" 1197 } 1198 a: { 1199 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1200 bar: "" 1201 } 1202 } 1203 b: { 1204 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1205 new: "" 1206 } 1207 } 1208 } 1209 } 1210 oneDirectionalBrokenConflictSuccess: { 1211 p2: { 1212 a: { 1213 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1214 bar: "" 1215 } 1216 } 1217 b: { 1218 foo: "" 1219 } 1220 b: { 1221 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1222 new: "" 1223 } 1224 } 1225 } 1226 } 1227 oneDirectionalBrokenConflictSuccess: { 1228 p3: { 1229 a: { 1230 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1231 bar: "" 1232 } 1233 } 1234 b: { 1235 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1236 new: "" 1237 } 1238 } 1239 b: { 1240 foo: "" 1241 } 1242 } 1243 } 1244 oneDirectionalBrokenConflictSuccess: { 1245 p4: { 1246 b: { 1247 foo: "" 1248 } 1249 b: { 1250 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1251 new: "" 1252 } 1253 } 1254 a: { 1255 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1256 bar: "" 1257 } 1258 } 1259 } 1260 } 1261 oneDirectionalBrokenConflictSuccess: { 1262 p5: { 1263 b: { 1264 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1265 new: "" 1266 } 1267 } 1268 b: { 1269 foo: "" 1270 } 1271 a: { 1272 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1273 bar: "" 1274 } 1275 } 1276 } 1277 } 1278 oneDirectionalBrokenConflictSuccess: { 1279 p6: { 1280 b: { 1281 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) { 1282 new: "" 1283 } 1284 } 1285 a: { 1286 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) { 1287 bar: "" 1288 } 1289 } 1290 b: { 1291 foo: "" 1292 } 1293 } 1294 } 1295 } 1296 } 1297 --- mutualsamestruct.cue 1298 { 1299 sameStruct: { 1300 chainSuccess: { 1301 a: { 1302 raises?: {} 1303 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1304 ret: { 1305 a: 1 1306 } 1307 } 1308 ret?: {} 1309 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1310 foo: { 1311 a: 1 1312 } 1313 } 1314 } 1315 } 1316 chainSuccess: { 1317 b: { 1318 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1319 foo: { 1320 a: 1 1321 } 1322 } 1323 raises?: {} 1324 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1325 ret: { 1326 a: 1 1327 } 1328 } 1329 ret?: {} 1330 } 1331 } 1332 cycleFail: { 1333 t1: { 1334 p1: { 1335 raises?: {} 1336 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1337 ret: { 1338 a: 1 1339 } 1340 } 1341 ret?: {} 1342 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1343 raises: { 1344 a: 1 1345 } 1346 } 1347 } 1348 } 1349 } 1350 cycleFail: { 1351 t1: { 1352 p2: { 1353 ret?: {} 1354 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1355 raises: { 1356 a: 1 1357 } 1358 } 1359 raises?: {} 1360 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1361 ret: { 1362 a: 1 1363 } 1364 } 1365 } 1366 } 1367 } 1368 cycleFail: { 1369 t2: { 1370 p1: { 1371 raises: {} 1372 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1373 ret: { 1374 a: 1 1375 } 1376 } 1377 ret: {} 1378 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1379 raises: { 1380 a: 1 1381 } 1382 } 1383 } 1384 } 1385 } 1386 cycleFail: { 1387 t2: { 1388 p2: { 1389 ret: {} 1390 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1391 raises: { 1392 a: 1 1393 } 1394 } 1395 raises: {} 1396 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1397 ret: { 1398 a: 1 1399 } 1400 } 1401 } 1402 } 1403 } 1404 cycleFail: { 1405 t3: { 1406 p1: { 1407 raises: _ 1408 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1409 ret: { 1410 a: 1 1411 } 1412 } 1413 ret: _ 1414 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1415 raises: { 1416 a: 1 1417 } 1418 } 1419 } 1420 } 1421 } 1422 cycleFail: { 1423 t3: { 1424 p2: { 1425 ret: _ 1426 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) { 1427 raises: { 1428 a: 1 1429 } 1430 } 1431 raises: _ 1432 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1433 ret: { 1434 a: 1 1435 } 1436 } 1437 } 1438 } 1439 } 1440 defCloseSuccess: { 1441 #Example: { 1442 raises?: { 1443 runtime?: string 1444 } 1445 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) { 1446 ret?: _ 1447 } 1448 } 1449 expr: (〈0;#Example〉 & { 1450 ret: 2 1451 }) 1452 } 1453 } 1454 } 1455 --- nestedchain.cue 1456 { 1457 nestedChain: { 1458 cycleFail: { 1459 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) { 1460 #E: { 1461 y: true 1462 } 1463 } 1464 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) { 1465 #E: { 1466 x: true 1467 } 1468 } 1469 #E: { 1470 [_]: bool 1471 } 1472 } 1473 brokenCycleSuccess: { 1474 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) { 1475 #E: { 1476 y: true 1477 } 1478 } 1479 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) { 1480 #E: { 1481 x: true 1482 } 1483 } 1484 #E: { 1485 [_]: bool 1486 } 1487 #E: { 1488 x: true 1489 } 1490 } 1491 doubleAddfail: { 1492 if (〈0;#E〉.x == _|_(explicit error (_|_ literal) in source)) { 1493 #E: { 1494 y: true 1495 } 1496 } 1497 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) { 1498 #E: { 1499 x: true 1500 } 1501 } 1502 #E: { 1503 [_]: bool 1504 } 1505 } 1506 trippleSuccess: { 1507 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) { 1508 #E: { 1509 y: true 1510 } 1511 } 1512 if (〈0;#E〉.y != _|_(explicit error (_|_ literal) in source)) { 1513 z: true 1514 } 1515 #E: { 1516 x: true 1517 } 1518 } 1519 } 1520 }