github.com/solo-io/cue@v0.4.7/cue/testdata/cycle/structural.txtar (about) 1 -- in.cue -- 2 a1: { 3 f: [f] 4 } 5 6 a2: { 7 f: f 8 } 9 10 a3: { 11 f: { g: f } 12 } 13 14 a4: { 15 a: [a|int] 16 } 17 18 a5: { 19 a: b: a | int 20 } 21 22 a6: { 23 a: a | int 24 } 25 26 a7: { 27 a: c.x 28 b: { 29 x: c 30 y: "foo" 31 } 32 c: { 33 x: b.y 34 y: 3 35 } 36 } 37 38 b1: { 39 b: a & [1] 40 a: [a|int] 41 } 42 43 b2: { 44 a: [a|int] 45 b: a & [1] 46 } 47 48 b3: { 49 x: a: [a|int] 50 b: x & {a: [1]} 51 } 52 53 b4: { 54 b: x.y & [1] 55 x: y: [y] 56 } 57 58 b5: { 59 b: x.y & {a: [1]} 60 x: y: a: [a|int] 61 } 62 63 b6: { 64 b: x & {a: [1]} 65 x: a: [a] 66 } 67 68 // TODO: erroneous: b should be an error. My suspicion is that `a` is detected 69 // as a reference cycle, because list don't introduce a new scope, allowing 70 // `1` to unify with the equivalent of `a: a` (which normally would be okay). 71 b7: { 72 b: a & [[1]] 73 a: [a] 74 } 75 76 // Issue #555 77 b8: { 78 x: a 79 a: f: b 80 b: a | string 81 } 82 83 // Issue #555 84 b9: { 85 #a: string | #b | #ref 86 #b: { 87 c: [#a, #a, #a] 88 } 89 #ref: ref: string 90 x: #b | #ref 91 } 92 93 // Issue #534 94 b10: { 95 a: close({ 96 b: string | a | c 97 }) 98 c: close({ 99 d: string | a 100 }) 101 } 102 103 // Issue #509 -- with comprehension 104 b11: { 105 #list: { 106 tail: #list | *null 107 if tail != null { 108 } 109 } 110 } 111 112 // Issue #509 -- with comprehension 113 b12: { 114 #list: { 115 V=value: int 116 T=tail: #list|*null 117 if T != null { 118 sum: V + T.sum 119 } 120 if T == null { 121 sum: V 122 } 123 } 124 125 list1: #list 126 list1: { 127 value: 1, 128 tail: { 129 value: 2 130 tail: { 131 value: 3 132 tail: { 133 value: 4 134 } 135 } 136 } 137 } 138 } 139 140 // More trigger happy on stack overflows. 141 b12b: { 142 #list: { 143 tail: #list 144 145 if tail != null { 146 sum: tail.sum 147 } 148 } 149 150 list1: #list 151 list1: { 152 tail: { 153 tail: { 154 } 155 } 156 } 157 } 158 159 // Issue #587 160 b13: root: a: [ for x in root {x} ] 161 162 // Issue #587 163 b14: { 164 root: { 165 a: [...int] 166 167 for x in a { 168 "\(x)": {} 169 } 170 171 b: [ for x in root {x}] 172 } 173 } 174 175 // This is okay 176 // Issue #587 177 b15: root: a: { for x in root {x} } 178 179 // Issue #502 -- unused bulk constraints are not cyclic 180 p1: { 181 #T: { 182 a: [string]: link: #T 183 } 184 185 a: #T & { 186 a: one: link: a: two: {} 187 } 188 } 189 190 // Issue #502 -- but they are if it is invoked within the struct. 191 p2: { 192 #T: { 193 a: [string]: link: #T 194 a: b: {} 195 } 196 197 a: #T & { 198 a: one: link: a: two: {} 199 } 200 } 201 202 // Issue #502 -- or added later. 203 p3: { 204 #S: #T: { 205 a: [string]: link: #T 206 } 207 208 #U: { 209 #S 210 #T: a: b: {} 211 } 212 213 a: #U.#T & { 214 a: one: link: a: two: {} 215 } 216 } 217 218 // Issue #502 -- unused bulk constraints are not cyclic 219 p4: { 220 #T: { 221 a: [...{link: #T}] 222 } 223 224 a: #T & { 225 a: [{link: a: [{}]}] 226 } 227 } 228 229 // Issue #502 -- but they are if it is invoked within the struct. 230 p5: { 231 #T: { 232 a: [...{link: #T}] 233 a: [{}] 234 } 235 236 a: #T & { 237 a: [{link: a: [{}]}] 238 } 239 } 240 241 // Issue #502 -- or added later. 242 p6: { 243 #S: #T: { 244 a: [...{link: #T}] 245 } 246 247 #U: { 248 #S 249 #T: a: [{}] 250 } 251 252 a: #U.#T & { 253 a: [{link: a: [{}]}] 254 } 255 } 256 257 258 c1: { 259 a: { 260 b: {} 261 c: a & b 262 } 263 } 264 265 // indirection 266 d1: { 267 a: b: c: d: { h: int, t: r } 268 r: a.b 269 270 x: a.b.c 271 } 272 273 d2: { 274 x: a.b.c 275 276 r: a.b 277 a: b: c: d: { h: int, t: r } 278 } 279 280 d3: { 281 // TODO(errors): correct position reporting in structural cycle. 282 config: { 283 a: b: c: indirect 284 indirect: [a.b, null][i] 285 i: int | *1 286 } 287 x: config & { i: 0 } 288 } 289 290 291 // combining structural with reference cycles 292 e1: { 293 a: a 294 a: c: a 295 296 b: c: b 297 b: b 298 } 299 300 e2: { 301 a: {a} 302 a: c: a 303 304 b: c: b 305 b: {b} 306 } 307 308 e3: { 309 a: [a] 310 a: c: a 311 312 b: [b] 313 b: c: b 314 } 315 316 e4: { 317 a: [a | {}] 318 a: [[{c: 1}]] 319 320 b: [[{c: 1}]] 321 b: [b | {}] 322 } 323 324 325 e5: { 326 a: c: a | int 327 a: a | int 328 329 b: b | int 330 b: c: b | int 331 } 332 333 334 // validating values 335 v1: { 336 x: [x | int, 1] 337 y: x & [[[2], 1], 1] 338 } 339 340 v2: { 341 y: x & [[[2], 1], 1] 342 x: [x | int, 1] 343 } 344 345 v3: { 346 list: { 347 head: int 348 tail: list | null 349 } 350 351 myList: list 352 myList: { 353 head: 2 354 tail: { 355 head: 3 356 tail: { 357 head: 4 358 } 359 } 360 } 361 } 362 363 v4: { 364 list: { 365 head: int 366 tail: list | 1 367 } 368 369 myList: list 370 myList: { 371 head: 2 372 tail: head: 3 373 } 374 } 375 376 v5: { 377 list: { 378 head: int 379 tail: list | {} 380 } 381 382 myList: list 383 myList: { 384 head: 2 385 tail: head: 3 386 } 387 } 388 389 390 391 // Example from "The Logic of Type Feature Structures" (Bob Carpenter)/ 392 z1: { 393 y: { 394 f: h: g 395 g: _ 396 } 397 x: { 398 f: _ 399 g: f 400 } 401 z: x & y 402 } 403 404 405 // Ensure these are NOT treated as structural errors. 406 407 n1: a: b: int 408 n2: n1 & { a: n1 } 409 n3: n1 & { n1 } 410 n4: n1 & { x: n1 & { y: n1 & { z: int }}} 411 412 413 -- out/eval -- 414 Errors: 415 a1.f.0: structural cycle 416 a3.f.g: structural cycle 417 b12b.#list.tail.tail: structural cycle 418 b13.root.a.0.0: structural cycle 419 b14.root.b.1.1: structural cycle 420 b4.x.y.0: structural cycle 421 b6.b.a.0: conflicting values 1 and [1] (mismatched types int and list): 422 ./in.cue:63:8 423 ./in.cue:63:16 424 ./in.cue:63:17 425 ./in.cue:64:12 426 b6.b.a.0.0: structural cycle 427 b6.x.a.0: structural cycle 428 b7.a.0: structural cycle 429 c1.a.c.c: structural cycle 430 d1.a.b.c.d.t: structural cycle 431 d1.r: structural cycle 432 d2.r.c.d.t: structural cycle 433 d2.x.d.t.c.d.t: structural cycle 434 e1.a.c: structural cycle 435 e1.b.c: structural cycle 436 e2.a.c: structural cycle 437 e2.b.c: structural cycle 438 e3.a: conflicting values [a] and {c:a} (mismatched types list and struct): 439 ./in.cue:308:8 440 ./in.cue:309:8 441 e3.a.0: conflicting values [a] and {c:a} (mismatched types list and struct): 442 ./in.cue:308:8 443 ./in.cue:308:9 444 ./in.cue:309:8 445 e3.a.0: structural cycle 446 e3.a.c: conflicting values [a] and {c:a} (mismatched types list and struct): 447 ./in.cue:308:8 448 ./in.cue:309:8 449 ./in.cue:309:11 450 e3.a.c: structural cycle 451 e3.b: conflicting values [b] and {c:b} (mismatched types list and struct): 452 ./in.cue:311:8 453 ./in.cue:312:8 454 e3.b.0: conflicting values [b] and {c:b} (mismatched types list and struct): 455 ./in.cue:311:8 456 ./in.cue:311:9 457 ./in.cue:312:8 458 e3.b.0: structural cycle 459 e3.b.c: conflicting values [b] and {c:b} (mismatched types list and struct): 460 ./in.cue:311:8 461 ./in.cue:312:8 462 ./in.cue:312:11 463 e3.b.c: structural cycle 464 e4.a.0: 4 errors in empty disjunction: 465 e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 466 ./in.cue:316:13 467 ./in.cue:317:9 468 e4.a.0.0: 2 errors in empty disjunction: 469 e4.a.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct): 470 ./in.cue:317:9 471 ./in.cue:317:10 472 e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 473 ./in.cue:316:9 474 ./in.cue:316:13 475 ./in.cue:317:9 476 e4.b.0: 4 errors in empty disjunction: 477 e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 478 ./in.cue:319:9 479 ./in.cue:320:13 480 e4.b.0.0: 2 errors in empty disjunction: 481 e4.b.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct): 482 ./in.cue:319:9 483 ./in.cue:319:10 484 e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 485 ./in.cue:319:9 486 ./in.cue:320:9 487 ./in.cue:320:13 488 p2.#T.a.b.link: structural cycle 489 p3.#U.#T.a.b.link: structural cycle 490 p5.#T.a.0.link: structural cycle 491 p6.#U.#T.a.0.link: structural cycle 492 z1.z.f.h.h: structural cycle 493 z1.z.g.h: structural cycle 494 cycle error: 495 ./in.cue:144:10 496 0: structural cycle: 497 ./in.cue:283:19 498 499 Result: 500 (_|_){ 501 // [eval] 502 a1: (_|_){ 503 // [structural cycle] 504 f: (_|_){ 505 // [structural cycle] 506 0: (_|_){ 507 // [structural cycle] a1.f.0: structural cycle 508 } 509 } 510 } 511 a2: (struct){ 512 f: (_){ _ } 513 } 514 a3: (_|_){ 515 // [structural cycle] 516 f: (_|_){ 517 // [structural cycle] 518 g: (_|_){ 519 // [structural cycle] a3.f.g: structural cycle 520 } 521 } 522 } 523 a4: (struct){ 524 a: (#list){ 525 0: (int){ int } 526 } 527 } 528 a5: (struct){ 529 a: (struct){ 530 b: (int){ int } 531 } 532 } 533 a6: (struct){ 534 a: (_){ |((_){ _ }, (int){ int }) } 535 } 536 a7: (struct){ 537 a: (string){ "foo" } 538 b: (struct){ 539 x: (struct){ 540 x: (string){ "foo" } 541 y: (int){ 3 } 542 } 543 y: (string){ "foo" } 544 } 545 c: (struct){ 546 x: (string){ "foo" } 547 y: (int){ 3 } 548 } 549 } 550 b1: (struct){ 551 b: (#list){ 552 0: (int){ 1 } 553 } 554 a: (#list){ 555 0: (int){ int } 556 } 557 } 558 b2: (struct){ 559 a: (#list){ 560 0: (int){ int } 561 } 562 b: (#list){ 563 0: (int){ 1 } 564 } 565 } 566 b3: (struct){ 567 x: (struct){ 568 a: (#list){ 569 0: (int){ int } 570 } 571 } 572 b: (struct){ 573 a: (#list){ 574 0: (int){ 1 } 575 } 576 } 577 } 578 b4: (_|_){ 579 // [structural cycle] 580 b: (#list){ 581 0: (int){ 1 } 582 } 583 x: (_|_){ 584 // [structural cycle] 585 y: (_|_){ 586 // [structural cycle] 587 0: (_|_){ 588 // [structural cycle] b4.x.y.0: structural cycle 589 } 590 } 591 } 592 } 593 b5: (struct){ 594 b: (struct){ 595 a: (#list){ 596 0: (int){ 1 } 597 } 598 } 599 x: (struct){ 600 y: (struct){ 601 a: (#list){ 602 0: (int){ int } 603 } 604 } 605 } 606 } 607 b6: (_|_){ 608 // [eval] 609 b: (_|_){ 610 // [eval] 611 a: (_|_){ 612 // [eval] 613 0: (_|_){ 614 // [eval] b6.b.a.0: conflicting values 1 and [1] (mismatched types int and list): 615 // ./in.cue:63:8 616 // ./in.cue:63:16 617 // ./in.cue:63:17 618 // ./in.cue:64:12 619 0: (_|_){ 620 // [structural cycle] b6.b.a.0.0: structural cycle 621 } 622 } 623 } 624 } 625 x: (_|_){ 626 // [structural cycle] 627 a: (_|_){ 628 // [structural cycle] 629 0: (_|_){ 630 // [structural cycle] b6.x.a.0: structural cycle 631 } 632 } 633 } 634 } 635 b7: (_|_){ 636 // [structural cycle] 637 b: (#list){ 638 0: (#list){ 639 0: (int){ 1 } 640 } 641 } 642 a: (_|_){ 643 // [structural cycle] 644 0: (_|_){ 645 // [structural cycle] b7.a.0: structural cycle 646 } 647 } 648 } 649 b8: (struct){ 650 x: (struct){ 651 f: (string){ string } 652 } 653 a: (struct){ 654 f: (string){ string } 655 } 656 b: (string){ string } 657 } 658 b9: (struct){ 659 #a: ((string|struct)){ |((string){ string }, (#struct){ 660 ref: (string){ string } 661 }) } 662 #b: (#struct){ 663 c: (#list){ 664 0: ((string|struct)){ |((string){ string }, (#struct){ 665 ref: (string){ string } 666 }) } 667 1: ((string|struct)){ |((string){ string }, (#struct){ 668 ref: (string){ string } 669 }) } 670 2: ((string|struct)){ |((string){ string }, (#struct){ 671 ref: (string){ string } 672 }) } 673 } 674 } 675 #ref: (#struct){ 676 ref: (string){ string } 677 } 678 x: (#struct){ |((#struct){ 679 c: (#list){ 680 0: ((string|struct)){ |((string){ string }, (#struct){ 681 ref: (string){ string } 682 }) } 683 1: ((string|struct)){ |((string){ string }, (#struct){ 684 ref: (string){ string } 685 }) } 686 2: ((string|struct)){ |((string){ string }, (#struct){ 687 ref: (string){ string } 688 }) } 689 } 690 }, (#struct){ 691 ref: (string){ string } 692 }) } 693 } 694 b10: (struct){ 695 a: (#struct){ 696 b: ((string|struct)){ |((string){ string }, (#struct){ 697 d: (string){ string } 698 }) } 699 } 700 c: (#struct){ 701 d: ((string|struct)){ |((string){ string }, (#struct){ 702 b: (string){ string } 703 }) } 704 } 705 } 706 b11: (struct){ 707 #list: (#struct){ 708 tail: ((null|struct)){ |(*(null){ null }, (#struct){ 709 tail: (null){ null } 710 }) } 711 } 712 } 713 b12: (struct){ 714 #list: (#struct){ 715 value: (int){ int } 716 tail: ((null|struct)){ |(*(null){ null }, (#struct){ 717 value: (int){ int } 718 tail: (null){ null } 719 sum: (int){ int } 720 }) } 721 sum: (int){ int } 722 } 723 list1: (#struct){ 724 value: (int){ 1 } 725 tail: (#struct){ 726 value: (int){ 2 } 727 tail: (#struct){ 728 value: (int){ 3 } 729 tail: (#struct){ 730 value: (int){ 4 } 731 tail: (null){ null } 732 sum: (int){ 4 } 733 } 734 sum: (int){ 7 } 735 } 736 sum: (int){ 9 } 737 } 738 sum: (int){ 10 } 739 } 740 } 741 b12b: (_|_){ 742 // [structural cycle] 743 #list: (_|_){ 744 // [structural cycle] cycle error: 745 // ./in.cue:144:10 746 tail: (_|_){ 747 // [structural cycle] cycle error: 748 // ./in.cue:144:10 749 tail: (_|_){ 750 // [structural cycle] b12b.#list.tail.tail: structural cycle 751 } 752 } 753 } 754 list1: (_|_){ 755 // [structural cycle] cycle error: 756 // ./in.cue:144:10 757 tail: (struct){ 758 tail: (struct){ 759 } 760 } 761 } 762 } 763 b13: (_|_){ 764 // [structural cycle] 765 root: (_|_){ 766 // [structural cycle] 767 a: (_|_){ 768 // [structural cycle] 769 0: (_|_){ 770 // [structural cycle] 771 0: (_|_){ 772 // [structural cycle] b13.root.a.0.0: structural cycle 773 } 774 } 775 } 776 } 777 } 778 b14: (_|_){ 779 // [structural cycle] 780 root: (_|_){ 781 // [structural cycle] 782 a: (list){ 783 } 784 b: (_|_){ 785 // [structural cycle] 786 0: (list){ 787 } 788 1: (_|_){ 789 // [structural cycle] 790 0: (list){ 791 } 792 1: (_|_){ 793 // [structural cycle] b14.root.b.1.1: structural cycle 794 } 795 } 796 } 797 } 798 } 799 b15: (struct){ 800 root: (struct){ 801 a: (struct){ 802 } 803 } 804 } 805 p1: (struct){ 806 #T: (#struct){ 807 a: (#struct){ 808 } 809 } 810 a: (#struct){ 811 a: (#struct){ 812 one: (#struct){ 813 link: (#struct){ 814 a: (#struct){ 815 two: (#struct){ 816 link: (#struct){ 817 a: (#struct){ 818 } 819 } 820 } 821 } 822 } 823 } 824 } 825 } 826 } 827 p2: (_|_){ 828 // [structural cycle] 829 #T: (_|_){ 830 // [structural cycle] 831 a: (_|_){ 832 // [structural cycle] 833 b: (_|_){ 834 // [structural cycle] 835 link: (_|_){ 836 // [structural cycle] p2.#T.a.b.link: structural cycle 837 } 838 } 839 } 840 } 841 a: (_|_){ 842 // [structural cycle] 843 a: (struct){ 844 one: (struct){ 845 link: (struct){ 846 a: (struct){ 847 two: (struct){ 848 } 849 } 850 } 851 } 852 } 853 } 854 } 855 p3: (_|_){ 856 // [structural cycle] 857 #S: (#struct){ 858 #T: (#struct){ 859 a: (#struct){ 860 } 861 } 862 } 863 #U: (_|_){ 864 // [structural cycle] 865 #T: (_|_){ 866 // [structural cycle] 867 a: (_|_){ 868 // [structural cycle] 869 b: (_|_){ 870 // [structural cycle] 871 link: (_|_){ 872 // [structural cycle] p3.#U.#T.a.b.link: structural cycle 873 } 874 } 875 } 876 } 877 } 878 a: (_|_){ 879 // [structural cycle] p3.#U.#T.a.b.link: structural cycle 880 a: (struct){ 881 one: (struct){ 882 link: (struct){ 883 a: (struct){ 884 two: (struct){ 885 } 886 } 887 } 888 } 889 } 890 } 891 } 892 p4: (struct){ 893 #T: (#struct){ 894 a: (list){ 895 } 896 } 897 a: (#struct){ 898 a: (#list){ 899 0: (#struct){ 900 link: (#struct){ 901 a: (#list){ 902 0: (#struct){ 903 link: (#struct){ 904 a: (list){ 905 } 906 } 907 } 908 } 909 } 910 } 911 } 912 } 913 } 914 p5: (_|_){ 915 // [structural cycle] 916 #T: (_|_){ 917 // [structural cycle] 918 a: (_|_){ 919 // [structural cycle] 920 0: (_|_){ 921 // [structural cycle] 922 link: (_|_){ 923 // [structural cycle] p5.#T.a.0.link: structural cycle 924 } 925 } 926 } 927 } 928 a: (_|_){ 929 // [structural cycle] 930 a: (#list){ 931 0: (struct){ 932 link: (struct){ 933 a: (#list){ 934 0: (struct){ 935 } 936 } 937 } 938 } 939 } 940 } 941 } 942 p6: (_|_){ 943 // [structural cycle] 944 #S: (#struct){ 945 #T: (#struct){ 946 a: (list){ 947 } 948 } 949 } 950 #U: (_|_){ 951 // [structural cycle] 952 #T: (_|_){ 953 // [structural cycle] 954 a: (_|_){ 955 // [structural cycle] 956 0: (_|_){ 957 // [structural cycle] 958 link: (_|_){ 959 // [structural cycle] p6.#U.#T.a.0.link: structural cycle 960 } 961 } 962 } 963 } 964 } 965 a: (_|_){ 966 // [structural cycle] p6.#U.#T.a.0.link: structural cycle 967 a: (#list){ 968 0: (struct){ 969 link: (struct){ 970 a: (#list){ 971 0: (struct){ 972 } 973 } 974 } 975 } 976 } 977 } 978 } 979 c1: (_|_){ 980 // [structural cycle] 981 a: (_|_){ 982 // [structural cycle] 983 b: (struct){ 984 } 985 c: (_|_){ 986 // [structural cycle] 987 b: (struct){ 988 } 989 c: (_|_){ 990 // [structural cycle] c1.a.c.c: structural cycle 991 } 992 } 993 } 994 } 995 d1: (_|_){ 996 // [structural cycle] 997 a: (_|_){ 998 // [structural cycle] 999 b: (_|_){ 1000 // [structural cycle] 1001 c: (_|_){ 1002 // [structural cycle] 1003 d: (_|_){ 1004 // [structural cycle] 1005 h: (int){ int } 1006 t: (_|_){ 1007 // [structural cycle] d1.a.b.c.d.t: structural cycle 1008 } 1009 } 1010 } 1011 } 1012 } 1013 r: (_|_){ 1014 // [structural cycle] d1.r: structural cycle 1015 } 1016 x: (_|_){ 1017 // [structural cycle] d1.a.b.c.d.t: structural cycle 1018 } 1019 } 1020 d2: (_|_){ 1021 // [structural cycle] 1022 x: (_|_){ 1023 // [structural cycle] 1024 d: (_|_){ 1025 // [structural cycle] 1026 h: (int){ int } 1027 t: (_|_){ 1028 // [structural cycle] 1029 c: (_|_){ 1030 // [structural cycle] 1031 d: (_|_){ 1032 // [structural cycle] 1033 h: (int){ int } 1034 t: (_|_){ 1035 // [structural cycle] d2.x.d.t.c.d.t: structural cycle 1036 } 1037 } 1038 } 1039 } 1040 } 1041 } 1042 r: (_|_){ 1043 // [structural cycle] 1044 c: (_|_){ 1045 // [structural cycle] 1046 d: (_|_){ 1047 // [structural cycle] 1048 h: (int){ int } 1049 t: (_|_){ 1050 // [structural cycle] d2.r.c.d.t: structural cycle 1051 } 1052 } 1053 } 1054 } 1055 a: (_|_){ 1056 // [structural cycle] 1057 b: (_|_){ 1058 // [structural cycle] 1059 c: (_|_){ 1060 // [structural cycle] 1061 d: (_|_){ 1062 // [structural cycle] 1063 h: (int){ int } 1064 t: (_|_){ 1065 // [structural cycle] 1066 } 1067 } 1068 } 1069 } 1070 } 1071 } 1072 d3: (_|_){ 1073 // [structural cycle] 1074 config: (_|_){ 1075 // [structural cycle] 1076 a: (_|_){ 1077 // [structural cycle] 1078 b: (_|_){ 1079 // [structural cycle] 1080 c: (_|_){ 1081 // [structural cycle] 0: structural cycle: 1082 // ./in.cue:283:19 1083 } 1084 } 1085 } 1086 indirect: (_|_){ 1087 // [structural cycle] 0: structural cycle: 1088 // ./in.cue:283:19 1089 } 1090 i: (int){ |(*(int){ 1 }, (int){ int }) } 1091 } 1092 x: (_|_){ 1093 // [structural cycle] 0: structural cycle: 1094 // ./in.cue:283:19 1095 i: (int){ 0 } 1096 } 1097 } 1098 e1: (_|_){ 1099 // [structural cycle] 1100 a: (_|_){ 1101 // [structural cycle] 1102 c: (_|_){ 1103 // [structural cycle] e1.a.c: structural cycle 1104 } 1105 } 1106 b: (_|_){ 1107 // [structural cycle] 1108 c: (_|_){ 1109 // [structural cycle] e1.b.c: structural cycle 1110 } 1111 } 1112 } 1113 e2: (_|_){ 1114 // [structural cycle] 1115 a: (_|_){ 1116 // [structural cycle] 1117 c: (_|_){ 1118 // [structural cycle] e2.a.c: structural cycle 1119 } 1120 } 1121 b: (_|_){ 1122 // [structural cycle] 1123 c: (_|_){ 1124 // [structural cycle] e2.b.c: structural cycle 1125 } 1126 } 1127 } 1128 e3: (_|_){ 1129 // [eval] 1130 a: (_|_){ 1131 // [eval] e3.a: conflicting values [a] and {c:a} (mismatched types list and struct): 1132 // ./in.cue:308:8 1133 // ./in.cue:309:8 1134 c: (_|_){ 1135 // [eval] e3.a.c: conflicting values [a] and {c:a} (mismatched types list and struct): 1136 // ./in.cue:308:8 1137 // ./in.cue:309:8 1138 // ./in.cue:309:11 1139 // e3.a.c: structural cycle 1140 } 1141 0: (_|_){ 1142 // [eval] e3.a.0: conflicting values [a] and {c:a} (mismatched types list and struct): 1143 // ./in.cue:308:8 1144 // ./in.cue:308:9 1145 // ./in.cue:309:8 1146 // e3.a.0: structural cycle 1147 } 1148 } 1149 b: (_|_){ 1150 // [eval] e3.b: conflicting values [b] and {c:b} (mismatched types list and struct): 1151 // ./in.cue:311:8 1152 // ./in.cue:312:8 1153 c: (_|_){ 1154 // [eval] e3.b.c: conflicting values [b] and {c:b} (mismatched types list and struct): 1155 // ./in.cue:311:8 1156 // ./in.cue:312:8 1157 // ./in.cue:312:11 1158 // e3.b.c: structural cycle 1159 } 1160 0: (_|_){ 1161 // [eval] e3.b.0: conflicting values [b] and {c:b} (mismatched types list and struct): 1162 // ./in.cue:311:8 1163 // ./in.cue:311:9 1164 // ./in.cue:312:8 1165 // e3.b.0: structural cycle 1166 } 1167 } 1168 } 1169 e4: (_|_){ 1170 // [eval] 1171 a: (_|_){ 1172 // [eval] 1173 0: (_|_){ 1174 // [eval] e4.a.0: 4 errors in empty disjunction: 1175 // e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 1176 // ./in.cue:316:13 1177 // ./in.cue:317:9 1178 // e4.a.0.0: 2 errors in empty disjunction: 1179 // e4.a.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct): 1180 // ./in.cue:317:9 1181 // ./in.cue:317:10 1182 // e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 1183 // ./in.cue:316:9 1184 // ./in.cue:316:13 1185 // ./in.cue:317:9 1186 0: (struct){ 1187 c: (int){ 1 } 1188 } 1189 } 1190 } 1191 b: (_|_){ 1192 // [eval] 1193 0: (_|_){ 1194 // [eval] e4.b.0: 4 errors in empty disjunction: 1195 // e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 1196 // ./in.cue:319:9 1197 // ./in.cue:320:13 1198 // e4.b.0.0: 2 errors in empty disjunction: 1199 // e4.b.0.0: conflicting values [{c:1}] and {c:1} (mismatched types list and struct): 1200 // ./in.cue:319:9 1201 // ./in.cue:319:10 1202 // e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): 1203 // ./in.cue:319:9 1204 // ./in.cue:320:9 1205 // ./in.cue:320:13 1206 0: (struct){ 1207 c: (int){ 1 } 1208 } 1209 } 1210 } 1211 } 1212 e5: (struct){ 1213 a: (struct){ 1214 c: (int){ int } 1215 } 1216 b: (struct){ 1217 c: (int){ int } 1218 } 1219 } 1220 v1: (struct){ 1221 x: (#list){ 1222 0: (int){ int } 1223 1: (int){ 1 } 1224 } 1225 y: (#list){ 1226 0: (#list){ 1227 0: (#list){ 1228 0: (int){ 2 } 1229 } 1230 1: (int){ 1 } 1231 } 1232 1: (int){ 1 } 1233 } 1234 } 1235 v2: (struct){ 1236 y: (#list){ 1237 0: (#list){ 1238 0: (#list){ 1239 0: (int){ 2 } 1240 } 1241 1: (int){ 1 } 1242 } 1243 1: (int){ 1 } 1244 } 1245 x: (#list){ 1246 0: (int){ int } 1247 1: (int){ 1 } 1248 } 1249 } 1250 v3: (struct){ 1251 list: (struct){ 1252 head: (int){ int } 1253 tail: (null){ null } 1254 } 1255 myList: (struct){ 1256 head: (int){ 2 } 1257 tail: (struct){ 1258 head: (int){ 3 } 1259 tail: (struct){ 1260 head: (int){ 4 } 1261 tail: (null){ null } 1262 } 1263 } 1264 } 1265 } 1266 v4: (struct){ 1267 list: (struct){ 1268 head: (int){ int } 1269 tail: (int){ 1 } 1270 } 1271 myList: (struct){ 1272 head: (int){ 2 } 1273 tail: (struct){ 1274 head: (int){ 3 } 1275 tail: (int){ 1 } 1276 } 1277 } 1278 } 1279 v5: (struct){ 1280 list: (struct){ 1281 head: (int){ int } 1282 tail: (struct){ 1283 } 1284 } 1285 myList: (struct){ 1286 head: (int){ 2 } 1287 tail: (struct){ |((struct){ 1288 head: (int){ 3 } 1289 tail: (struct){ 1290 } 1291 }, (struct){ 1292 head: (int){ 3 } 1293 }) } 1294 } 1295 } 1296 z1: (_|_){ 1297 // [structural cycle] 1298 y: (struct){ 1299 f: (struct){ 1300 h: (_){ _ } 1301 } 1302 g: (_){ _ } 1303 } 1304 x: (struct){ 1305 f: (_){ _ } 1306 g: (_){ _ } 1307 } 1308 z: (_|_){ 1309 // [structural cycle] 1310 f: (_|_){ 1311 // [structural cycle] 1312 h: (_|_){ 1313 // [structural cycle] 1314 h: (_|_){ 1315 // [structural cycle] z1.z.f.h.h: structural cycle 1316 } 1317 } 1318 } 1319 g: (_|_){ 1320 // [structural cycle] 1321 h: (_|_){ 1322 // [structural cycle] z1.z.g.h: structural cycle 1323 } 1324 } 1325 } 1326 } 1327 n1: (struct){ 1328 a: (struct){ 1329 b: (int){ int } 1330 } 1331 } 1332 n2: (struct){ 1333 a: (struct){ 1334 b: (int){ int } 1335 a: (struct){ 1336 b: (int){ int } 1337 } 1338 } 1339 } 1340 n3: (struct){ 1341 a: (struct){ 1342 b: (int){ int } 1343 } 1344 } 1345 n4: (struct){ 1346 a: (struct){ 1347 b: (int){ int } 1348 } 1349 x: (struct){ 1350 a: (struct){ 1351 b: (int){ int } 1352 } 1353 y: (struct){ 1354 a: (struct){ 1355 b: (int){ int } 1356 } 1357 z: (int){ int } 1358 } 1359 } 1360 } 1361 } 1362 -- out/compile -- 1363 --- in.cue 1364 { 1365 a1: { 1366 f: [ 1367 〈0;f〉, 1368 ] 1369 } 1370 a2: { 1371 f: 〈0;f〉 1372 } 1373 a3: { 1374 f: { 1375 g: 〈1;f〉 1376 } 1377 } 1378 a4: { 1379 a: [ 1380 (〈0;a〉|int), 1381 ] 1382 } 1383 a5: { 1384 a: { 1385 b: (〈1;a〉|int) 1386 } 1387 } 1388 a6: { 1389 a: (〈0;a〉|int) 1390 } 1391 a7: { 1392 a: 〈0;c〉.x 1393 b: { 1394 x: 〈1;c〉 1395 y: "foo" 1396 } 1397 c: { 1398 x: 〈1;b〉.y 1399 y: 3 1400 } 1401 } 1402 b1: { 1403 b: (〈0;a〉 & [ 1404 1, 1405 ]) 1406 a: [ 1407 (〈0;a〉|int), 1408 ] 1409 } 1410 b2: { 1411 a: [ 1412 (〈0;a〉|int), 1413 ] 1414 b: (〈0;a〉 & [ 1415 1, 1416 ]) 1417 } 1418 b3: { 1419 x: { 1420 a: [ 1421 (〈0;a〉|int), 1422 ] 1423 } 1424 b: (〈0;x〉 & { 1425 a: [ 1426 1, 1427 ] 1428 }) 1429 } 1430 b4: { 1431 b: (〈0;x〉.y & [ 1432 1, 1433 ]) 1434 x: { 1435 y: [ 1436 〈0;y〉, 1437 ] 1438 } 1439 } 1440 b5: { 1441 b: (〈0;x〉.y & { 1442 a: [ 1443 1, 1444 ] 1445 }) 1446 x: { 1447 y: { 1448 a: [ 1449 (〈0;a〉|int), 1450 ] 1451 } 1452 } 1453 } 1454 b6: { 1455 b: (〈0;x〉 & { 1456 a: [ 1457 1, 1458 ] 1459 }) 1460 x: { 1461 a: [ 1462 〈0;a〉, 1463 ] 1464 } 1465 } 1466 b7: { 1467 b: (〈0;a〉 & [ 1468 [ 1469 1, 1470 ], 1471 ]) 1472 a: [ 1473 〈0;a〉, 1474 ] 1475 } 1476 b8: { 1477 x: 〈0;a〉 1478 a: { 1479 f: 〈1;b〉 1480 } 1481 b: (〈0;a〉|string) 1482 } 1483 b9: { 1484 #a: (string|〈0;#b〉|〈0;#ref〉) 1485 #b: { 1486 c: [ 1487 〈1;#a〉, 1488 〈1;#a〉, 1489 〈1;#a〉, 1490 ] 1491 } 1492 #ref: { 1493 ref: string 1494 } 1495 x: (〈0;#b〉|〈0;#ref〉) 1496 } 1497 b10: { 1498 a: close({ 1499 b: (string|〈1;a〉|〈1;c〉) 1500 }) 1501 c: close({ 1502 d: (string|〈1;a〉) 1503 }) 1504 } 1505 b11: { 1506 #list: { 1507 tail: (〈1;#list〉|*null) 1508 if (〈0;tail〉 != null) {} 1509 } 1510 } 1511 b12: { 1512 #list: { 1513 value: int 1514 tail: (〈1;#list〉|*null) 1515 if (〈0;tail〉 != null) { 1516 sum: (〈1;value〉 + 〈1;tail〉.sum) 1517 } 1518 if (〈0;tail〉 == null) { 1519 sum: 〈1;value〉 1520 } 1521 } 1522 list1: 〈0;#list〉 1523 list1: { 1524 value: 1 1525 tail: { 1526 value: 2 1527 tail: { 1528 value: 3 1529 tail: { 1530 value: 4 1531 } 1532 } 1533 } 1534 } 1535 } 1536 b12b: { 1537 #list: { 1538 tail: 〈1;#list〉 1539 if (〈0;tail〉 != null) { 1540 sum: 〈1;tail〉.sum 1541 } 1542 } 1543 list1: 〈0;#list〉 1544 list1: { 1545 tail: { 1546 tail: {} 1547 } 1548 } 1549 } 1550 b13: { 1551 root: { 1552 a: [ 1553 for _, x in 〈1;root〉 { 1554 〈1;x〉 1555 }, 1556 ] 1557 } 1558 } 1559 b14: { 1560 root: { 1561 a: [ 1562 ...int, 1563 ] 1564 for _, x in 〈0;a〉 { 1565 "\(〈1;x〉)": {} 1566 } 1567 b: [ 1568 for _, x in 〈1;root〉 { 1569 〈1;x〉 1570 }, 1571 ] 1572 } 1573 } 1574 b15: { 1575 root: { 1576 a: { 1577 for _, x in 〈2;root〉 { 1578 〈1;x〉 1579 } 1580 } 1581 } 1582 } 1583 p1: { 1584 #T: { 1585 a: { 1586 [string]: { 1587 link: 〈3;#T〉 1588 } 1589 } 1590 } 1591 a: (〈0;#T〉 & { 1592 a: { 1593 one: { 1594 link: { 1595 a: { 1596 two: {} 1597 } 1598 } 1599 } 1600 } 1601 }) 1602 } 1603 p2: { 1604 #T: { 1605 a: { 1606 [string]: { 1607 link: 〈3;#T〉 1608 } 1609 } 1610 a: { 1611 b: {} 1612 } 1613 } 1614 a: (〈0;#T〉 & { 1615 a: { 1616 one: { 1617 link: { 1618 a: { 1619 two: {} 1620 } 1621 } 1622 } 1623 } 1624 }) 1625 } 1626 p3: { 1627 #S: { 1628 #T: { 1629 a: { 1630 [string]: { 1631 link: 〈3;#T〉 1632 } 1633 } 1634 } 1635 } 1636 #U: { 1637 〈1;#S〉 1638 #T: { 1639 a: { 1640 b: {} 1641 } 1642 } 1643 } 1644 a: (〈0;#U〉.#T & { 1645 a: { 1646 one: { 1647 link: { 1648 a: { 1649 two: {} 1650 } 1651 } 1652 } 1653 } 1654 }) 1655 } 1656 p4: { 1657 #T: { 1658 a: [ 1659 ...{ 1660 link: 〈2;#T〉 1661 }, 1662 ] 1663 } 1664 a: (〈0;#T〉 & { 1665 a: [ 1666 { 1667 link: { 1668 a: [ 1669 {}, 1670 ] 1671 } 1672 }, 1673 ] 1674 }) 1675 } 1676 p5: { 1677 #T: { 1678 a: [ 1679 ...{ 1680 link: 〈2;#T〉 1681 }, 1682 ] 1683 a: [ 1684 {}, 1685 ] 1686 } 1687 a: (〈0;#T〉 & { 1688 a: [ 1689 { 1690 link: { 1691 a: [ 1692 {}, 1693 ] 1694 } 1695 }, 1696 ] 1697 }) 1698 } 1699 p6: { 1700 #S: { 1701 #T: { 1702 a: [ 1703 ...{ 1704 link: 〈2;#T〉 1705 }, 1706 ] 1707 } 1708 } 1709 #U: { 1710 〈1;#S〉 1711 #T: { 1712 a: [ 1713 {}, 1714 ] 1715 } 1716 } 1717 a: (〈0;#U〉.#T & { 1718 a: [ 1719 { 1720 link: { 1721 a: [ 1722 {}, 1723 ] 1724 } 1725 }, 1726 ] 1727 }) 1728 } 1729 c1: { 1730 a: { 1731 b: {} 1732 c: (〈1;a〉 & 〈0;b〉) 1733 } 1734 } 1735 d1: { 1736 a: { 1737 b: { 1738 c: { 1739 d: { 1740 h: int 1741 t: 〈4;r〉 1742 } 1743 } 1744 } 1745 } 1746 r: 〈0;a〉.b 1747 x: 〈0;a〉.b.c 1748 } 1749 d2: { 1750 x: 〈0;a〉.b.c 1751 r: 〈0;a〉.b 1752 a: { 1753 b: { 1754 c: { 1755 d: { 1756 h: int 1757 t: 〈4;r〉 1758 } 1759 } 1760 } 1761 } 1762 } 1763 d3: { 1764 config: { 1765 a: { 1766 b: { 1767 c: 〈2;indirect〉 1768 } 1769 } 1770 indirect: [ 1771 〈0;a〉.b, 1772 null, 1773 ][〈0;i〉] 1774 i: (int|*1) 1775 } 1776 x: (〈0;config〉 & { 1777 i: 0 1778 }) 1779 } 1780 e1: { 1781 a: 〈0;a〉 1782 a: { 1783 c: 〈1;a〉 1784 } 1785 b: { 1786 c: 〈1;b〉 1787 } 1788 b: 〈0;b〉 1789 } 1790 e2: { 1791 a: { 1792 〈1;a〉 1793 } 1794 a: { 1795 c: 〈1;a〉 1796 } 1797 b: { 1798 c: 〈1;b〉 1799 } 1800 b: { 1801 〈1;b〉 1802 } 1803 } 1804 e3: { 1805 a: [ 1806 〈0;a〉, 1807 ] 1808 a: { 1809 c: 〈1;a〉 1810 } 1811 b: [ 1812 〈0;b〉, 1813 ] 1814 b: { 1815 c: 〈1;b〉 1816 } 1817 } 1818 e4: { 1819 a: [ 1820 (〈0;a〉|{}), 1821 ] 1822 a: [ 1823 [ 1824 { 1825 c: 1 1826 }, 1827 ], 1828 ] 1829 b: [ 1830 [ 1831 { 1832 c: 1 1833 }, 1834 ], 1835 ] 1836 b: [ 1837 (〈0;b〉|{}), 1838 ] 1839 } 1840 e5: { 1841 a: { 1842 c: (〈1;a〉|int) 1843 } 1844 a: (〈0;a〉|int) 1845 b: (〈0;b〉|int) 1846 b: { 1847 c: (〈1;b〉|int) 1848 } 1849 } 1850 v1: { 1851 x: [ 1852 (〈0;x〉|int), 1853 1, 1854 ] 1855 y: (〈0;x〉 & [ 1856 [ 1857 [ 1858 2, 1859 ], 1860 1, 1861 ], 1862 1, 1863 ]) 1864 } 1865 v2: { 1866 y: (〈0;x〉 & [ 1867 [ 1868 [ 1869 2, 1870 ], 1871 1, 1872 ], 1873 1, 1874 ]) 1875 x: [ 1876 (〈0;x〉|int), 1877 1, 1878 ] 1879 } 1880 v3: { 1881 list: { 1882 head: int 1883 tail: (〈1;list〉|null) 1884 } 1885 myList: 〈0;list〉 1886 myList: { 1887 head: 2 1888 tail: { 1889 head: 3 1890 tail: { 1891 head: 4 1892 } 1893 } 1894 } 1895 } 1896 v4: { 1897 list: { 1898 head: int 1899 tail: (〈1;list〉|1) 1900 } 1901 myList: 〈0;list〉 1902 myList: { 1903 head: 2 1904 tail: { 1905 head: 3 1906 } 1907 } 1908 } 1909 v5: { 1910 list: { 1911 head: int 1912 tail: (〈1;list〉|{}) 1913 } 1914 myList: 〈0;list〉 1915 myList: { 1916 head: 2 1917 tail: { 1918 head: 3 1919 } 1920 } 1921 } 1922 z1: { 1923 y: { 1924 f: { 1925 h: 〈1;g〉 1926 } 1927 g: _ 1928 } 1929 x: { 1930 f: _ 1931 g: 〈0;f〉 1932 } 1933 z: (〈0;x〉 & 〈0;y〉) 1934 } 1935 n1: { 1936 a: { 1937 b: int 1938 } 1939 } 1940 n2: (〈0;n1〉 & { 1941 a: 〈1;n1〉 1942 }) 1943 n3: (〈0;n1〉 & { 1944 〈1;n1〉 1945 }) 1946 n4: (〈0;n1〉 & { 1947 x: (〈1;n1〉 & { 1948 y: (〈2;n1〉 & { 1949 z: int 1950 }) 1951 }) 1952 }) 1953 }