cuelang.org/go@v0.13.0/cue/testdata/cycle/comprehension.txtar (about) 1 -- in.cue -- 2 import ( 3 "list" 4 "strings" 5 ) 6 7 // Allow lookup in partially evaluated struct as long as the end result is 8 // concrete. 9 A: { 10 a: { 11 parent: "" 12 children: [for k, v in A if v.parent == k {k}] 13 } 14 b: { 15 parent: "a" 16 children: [for k, v in A if v.parent == k {k}] 17 } 18 } 19 20 // This should result in an incomplete error (a reference cycle error classifies 21 // as incomplete). 22 B: { 23 a: { 24 parent: "" 25 children: [for k, v in B for _, w in v.children {k}] 26 } 27 } 28 29 // Issue #486 30 Issue486: { 31 A: { 32 a: { 33 parent: "" 34 children: [...string] 35 } 36 b: { 37 parent: "a" 38 children: [...string] 39 } 40 c: { 41 parent: "b" 42 children: [...string] 43 } 44 } 45 46 A: [Name=string]: { 47 children: [ 48 for k, v in A 49 if v.parent == Name { 50 k 51 }, 52 ] 53 } 54 } 55 56 // Issue #1666 57 issue1666: { 58 #E: { 59 f1: [string]: #E | [...#E] 60 f2: [string]: t: #E 61 } 62 63 _e: #E 64 _e: f2: a: _ 65 66 e: _e & { 67 f1: { 68 for fk, s in _e.f2 { 69 (fk): s.t 70 } 71 } 72 } 73 } 74 75 // Issue #779: bidirectional projection 76 // Should be allowed as long as the set of fields is not modified as a result 77 // of a comprehension. 78 issue779: { 79 X: Y.message 80 STATE: { 81 for k, v in Y { 82 if k != "message" { 83 "\(k)": v 84 } 85 } 86 } 87 Y: STATE & { message: X } 88 X: "test" 89 STATE: { code: 101 } 90 } 91 92 // Comprehension ends up inserting in the same arcs over which it 93 // is iterating. This is fine as long as the set is not altered. 94 // Issue #1934 95 selfReferential: T1: { 96 S: d: "bar" 97 98 T: e: S: a: "foo" 99 100 for s, v in S for t, _ in T { 101 T: (t): S: (s): v 102 } 103 } 104 105 // selfReferential comprehenion for list. 106 // Issue #1934 107 selfReferential: list: { 108 panels: [ 109 for i, _ in panels { 110 id: i 111 } 112 ] 113 panels: [{}, {}, {}] 114 } 115 116 selfReferential: insertionError: { 117 A: { 118 foo: 1 119 for x in A { 120 // May not insert foo3. Use dynamic references to force the 121 // comprehension to be evaluated in the struct in which it is 122 // defined. 123 ("foo3"): 1 124 } 125 } 126 } 127 128 // A comprehension should not recursively evaluated arcs, so that a 129 // structural cycle can be avoided when unnecessary. 130 selfReferential: acrossOr: t1: p1: { 131 o: #Output & { retry: reject: "ok" } 132 133 #AllOutputs: { 134 reject: string 135 resource: string 136 retry: #Output 137 } 138 139 #Output: or([for name, config in #AllOutputs { 140 (name): config 141 }]) 142 } 143 144 selfReferential: acrossOr: t1: p2: { 145 #Output: or([for name, config in #AllOutputs { 146 (name): config 147 }]) 148 149 o: #Output & { retry: reject: "ok" } 150 151 #AllOutputs: { 152 reject: string 153 resource: string 154 retry: #Output 155 } 156 } 157 158 selfReferential: acrossOr: t1: p3: { 159 #Output: or([for name, config in #AllOutputs { 160 (name): config 161 }]) 162 163 #AllOutputs: { 164 reject: string 165 resource: string 166 retry: #Output 167 } 168 169 o: #Output & { retry: reject: "ok" } 170 } 171 172 selfReferential: acrossOr: t2: p1: { 173 d: or([for x, y in #A { y }]) 174 o: d & { b: 2 } 175 #A: { 176 d1: int 177 d2: string 178 d3: b: d 179 } 180 } 181 182 selfReferential: acrossOr: t2: p2: { 183 o: d & { b: 2 } 184 d: or([for x, y in #A { y }]) 185 #A: { 186 d1: int 187 d2: string 188 d3: b: d 189 } 190 } 191 192 selfReferential: acrossOr: t2: p3: { 193 o: d & { b: 2 } 194 #A: { 195 d1: int 196 d2: string 197 d3: b: d 198 } 199 d: or([for x, y in #A { y }]) 200 } 201 202 issue1881: p1: { 203 o: #Output & { retry: output: reject: "ok" } 204 205 #AllOutputs: { 206 reject: string 207 resource: string 208 retry: output: #Output 209 } 210 211 #Output: or([for name, config in #AllOutputs { 212 (name): config 213 }]) 214 } 215 216 issue1881: p2: { 217 #AllOutputs: { 218 reject: string 219 resource: string 220 retry: output: #Output 221 } 222 223 o: #Output & { retry: output: reject: "ok" } 224 225 #Output: or([for name, config in #AllOutputs { 226 (name): config 227 }]) 228 } 229 230 issue1881: p3: { 231 #AllOutputs: { 232 reject: string 233 resource: string 234 retry: output: #Output 235 } 236 237 #Output: or([for name, config in #AllOutputs { 238 (name): config 239 }]) 240 241 o: #Output & { retry: output: reject: "ok" } 242 } 243 244 siblingInsertion: t1: p1: { 245 D: "logging": _ 246 deployment: _ 247 248 for k, v in deployment 249 for k1, v2 in v.env2 { 250 deployment: (k): env: (k1): v2 251 } 252 253 for id, v in D { 254 deployment: (id): env2: ENV: "True" 255 } 256 } 257 258 siblingInsertion: t1: p2: { 259 D: "logging": _ 260 deployment: _ 261 262 for id, v in D { 263 deployment: (id): env2: ENV: "True" 264 } 265 266 for k, v in deployment 267 for k1, v2 in v.env2 { 268 deployment: (k): env: (k1): v2 269 } 270 } 271 272 siblingInsertion: t2: p1: { 273 D: "logging": _ 274 deployment: _ 275 276 for k, v in deployment { 277 for k1, v2 in v.env2 { 278 deployment: (k): env: (k1): v2 279 } 280 } 281 282 for id, v in D { 283 deployment: (id): env2: ENV: "True" 284 } 285 } 286 287 siblingInsertion: t2: p2: { 288 D: "logging": _ 289 deployment: _ 290 291 for k, v in deployment { 292 for k1, v2 in v.env2 { 293 deployment: (k): env: (k1): v2 294 } 295 } 296 297 for id, v in D { 298 deployment: (id): env2: ENV: "True" 299 } 300 } 301 302 // Issue #1407 303 // Ensure there is a useful error message. 304 selfReferential: fail: { 305 a: {} 306 b: a.x != "" 307 if b { 308 } 309 } 310 311 // avoid infinite recursion 312 issue2367: { 313 a: _ 314 for x in [a] {a: x} 315 } 316 317 // evalv2 incorrectly reported structural cycles here. 318 issue2310: original: { 319 #s: {#_1: string, #_2: string, #_3: string, strings.Replace(#_1, #_2, #_3, -1)} 320 321 #sub: { 322 #a: string 323 324 // We can't use X=[#a, ...] yet because that is still disallowed 325 _#X: [#a, for i in list.Range(0, len(#subs), 1) {#subs[i] & {#_1: _#X[i], _}}] 326 327 // Embedding would not be necessary if the X=[] form was allowed 328 _#X[len(_#X)-1] 329 } 330 331 res: #sub & {#a: "aaa", _} 332 333 // subs is a series of string substitutions we want to apply 334 #subs: [ 335 #s & {#_2: "a", #_3: "b", _}, 336 #s & {#_2: "c", #_3: "d", _}, 337 #s & {#_2: "e", #_3: "f", _}, 338 ] 339 } 340 issue2310: reduced: { 341 res: { 342 #X[3] // Must be at least 3 to cause structural cycle. 343 344 // expanding comprehension eliminates cycle. 345 #X: ["X", for i, _ in #subs {#s, #str: #X[i]}] 346 } 347 348 #s: {#str: string, #str + "a"} 349 #subs: [0, 1, 2] 350 } 351 -- issue3903.cue -- 352 issue3903: reduced: { 353 s1: #Schema 354 s1: _deps: [#Schema] 355 #Schema: { 356 _deps: [...] 357 358 objs: [ 359 for dep in _deps 360 for obj in (dep & {}).objs { 361 obj 362 } 363 ] 364 } 365 } 366 issue3903: full: { 367 s1: #Schema & { 368 _deps: [s2] 369 _local: ["s1 local"] 370 } 371 s2: #Schema & { 372 _local: ["s2 local"] 373 } 374 375 #Schema: { 376 _local: [...string] 377 _deps: [...] 378 379 objs: [ 380 for obj in _local { obj }, 381 382 for dep in _deps 383 for obj in (dep & {}).objs { 384 obj 385 }, 386 ] 387 } 388 } 389 -- issue3941.cue -- 390 issue3941: full: { 391 #Metadata: name: string 392 #Resource: metadata: #Metadata 393 394 out: { 395 _metadata: name: "foo" 396 resource: [string]: [string]: #Resource 397 398 _names: [_metadata.name] 399 400 for name in _names { 401 resource: level1: (name): { 402 metadata: _metadata 403 } 404 } 405 } 406 } 407 -- out/evalalpha/stats -- 408 Leaks: 996 409 Freed: 0 410 Reused: 0 411 Allocs: 996 412 Retain: 0 413 414 Unifications: 625 415 Conjuncts: 1705 416 Disjuncts: 202 417 418 CloseIDElems: 10146 419 NumCloseIDs: 850 420 -- out/evalalpha -- 421 Errors: 422 selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 423 ./in.cue:122:14 424 425 Result: 426 (_|_){ 427 // [eval] 428 A: (struct){ 429 a: (struct){ 430 parent: (string){ "" } 431 children: (#list){ 432 } 433 } 434 b: (struct){ 435 parent: (string){ "a" } 436 children: (#list){ 437 } 438 } 439 } 440 B: (struct){ 441 a: (struct){ 442 parent: (string){ "" } 443 children: (_|_){ 444 // [incomplete] B.a.children: cannot range over v.children (incomplete type list): 445 // ./in.cue:24:40 446 } 447 } 448 } 449 Issue486: (struct){ 450 A: (struct){ 451 a: (struct){ 452 parent: (string){ "" } 453 children: (#list){ 454 0: (string){ "b" } 455 } 456 } 457 b: (struct){ 458 parent: (string){ "a" } 459 children: (#list){ 460 0: (string){ "c" } 461 } 462 } 463 c: (struct){ 464 parent: (string){ "b" } 465 children: (#list){ 466 } 467 } 468 } 469 } 470 issue1666: (struct){ 471 #E: (#struct){ 472 f1: (#struct){ 473 } 474 f2: (#struct){ 475 } 476 } 477 _e: (#struct){ 478 f2: (#struct){ 479 a: (#struct){ 480 t: ~(issue1666.#E) 481 } 482 } 483 f1: (#struct){ 484 } 485 } 486 e: (#struct){ 487 f1: (#struct){ 488 a: (#struct){ 489 f1: (#struct){ 490 } 491 f2: (#struct){ 492 } 493 } 494 } 495 f2: (#struct){ 496 a: (#struct){ 497 t: ~(issue1666.#E) 498 } 499 } 500 } 501 } 502 issue779: (struct){ 503 X: (string){ "test" } 504 STATE: (struct){ 505 code: (int){ 101 } 506 } 507 Y: (struct){ 508 message: (string){ "test" } 509 code: (int){ 101 } 510 } 511 } 512 selfReferential: (_|_){ 513 // [eval] 514 T1: (struct){ 515 S: (struct){ 516 d: (string){ "bar" } 517 } 518 T: (struct){ 519 e: (struct){ 520 S: (struct){ 521 a: (string){ "foo" } 522 d: (string){ "bar" } 523 } 524 } 525 } 526 } 527 list: (struct){ 528 panels: (#list){ 529 0: (struct){ 530 id: (int){ 0 } 531 } 532 1: (struct){ 533 id: (int){ 1 } 534 } 535 2: (struct){ 536 id: (int){ 2 } 537 } 538 } 539 } 540 insertionError: (_|_){ 541 // [eval] 542 A: (_|_){ 543 // [eval] selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 544 // ./in.cue:122:14 545 foo: (int){ 1 } 546 } 547 } 548 acrossOr: (struct){ 549 t1: (struct){ 550 p1: (struct){ 551 o: (#struct){ 552 retry: (#struct){ 553 reject: (string){ "ok" } 554 } 555 } 556 #AllOutputs: (#struct){ 557 reject: (string){ string } 558 resource: (string){ string } 559 retry: (#struct){ |((#struct){ 560 reject: (string){ string } 561 }, (#struct){ 562 resource: (string){ string } 563 }) } 564 } 565 #Output: (#struct){ |((#struct){ 566 reject: (string){ string } 567 }, (#struct){ 568 resource: (string){ string } 569 }) } 570 } 571 p2: (struct){ 572 #Output: (#struct){ |((#struct){ 573 reject: (string){ string } 574 }, (#struct){ 575 resource: (string){ string } 576 }) } 577 o: (#struct){ 578 retry: (#struct){ 579 reject: (string){ "ok" } 580 } 581 } 582 #AllOutputs: (#struct){ 583 reject: (string){ string } 584 resource: (string){ string } 585 retry: (#struct){ |((#struct){ 586 reject: (string){ string } 587 }, (#struct){ 588 resource: (string){ string } 589 }) } 590 } 591 } 592 p3: (struct){ 593 #Output: (#struct){ |((#struct){ 594 reject: (string){ string } 595 }, (#struct){ 596 resource: (string){ string } 597 }) } 598 #AllOutputs: (#struct){ 599 reject: (string){ string } 600 resource: (string){ string } 601 retry: (#struct){ |((#struct){ 602 reject: (string){ string } 603 }, (#struct){ 604 resource: (string){ string } 605 }) } 606 } 607 o: (#struct){ 608 retry: (#struct){ 609 reject: (string){ "ok" } 610 } 611 } 612 } 613 } 614 t2: (struct){ 615 p1: (struct){ 616 d: ((int|string)){ |((int){ int }, (string){ string }) } 617 o: (struct){ 618 b: (int){ 2 } 619 } 620 #A: (#struct){ 621 d1: (int){ int } 622 d2: (string){ string } 623 d3: (#struct){ 624 b: ((int|string)){ |((int){ int }, (string){ string }) } 625 } 626 } 627 } 628 p2: (struct){ 629 o: (struct){ 630 b: (int){ 2 } 631 } 632 d: ((int|string)){ |((int){ int }, (string){ string }) } 633 #A: (#struct){ 634 d1: (int){ int } 635 d2: (string){ string } 636 d3: (#struct){ 637 b: ((int|string)){ |((int){ int }, (string){ string }) } 638 } 639 } 640 } 641 p3: (struct){ 642 o: (struct){ 643 b: (int){ 2 } 644 } 645 #A: (#struct){ 646 d1: (int){ int } 647 d2: (string){ string } 648 d3: (#struct){ 649 b: ((int|string)){ |((int){ int }, (string){ string }) } 650 } 651 } 652 d: ((int|string)){ |((int){ int }, (string){ string }) } 653 } 654 } 655 } 656 fail: (_|_){ 657 // [incomplete] selfReferential.fail.b: undefined field: x: 658 // ./in.cue:305:7 659 a: (struct){ 660 } 661 b: (_|_){ 662 // [incomplete] selfReferential.fail.b: undefined field: x: 663 // ./in.cue:305:7 664 } 665 } 666 } 667 issue1881: (struct){ 668 p1: (struct){ 669 o: (#struct){ 670 retry: (#struct){ 671 output: (#struct){ 672 reject: (string){ "ok" } 673 } 674 } 675 } 676 #AllOutputs: (#struct){ 677 reject: (string){ string } 678 resource: (string){ string } 679 retry: (#struct){ 680 output: (#struct){ |((#struct){ 681 reject: (string){ string } 682 }, (#struct){ 683 resource: (string){ string } 684 }) } 685 } 686 } 687 #Output: (#struct){ |((#struct){ 688 reject: (string){ string } 689 }, (#struct){ 690 resource: (string){ string } 691 }) } 692 } 693 p2: (struct){ 694 #AllOutputs: (#struct){ 695 reject: (string){ string } 696 resource: (string){ string } 697 retry: (#struct){ 698 output: (#struct){ |((#struct){ 699 reject: (string){ string } 700 }, (#struct){ 701 resource: (string){ string } 702 }) } 703 } 704 } 705 o: (#struct){ 706 retry: (#struct){ 707 output: (#struct){ 708 reject: (string){ "ok" } 709 } 710 } 711 } 712 #Output: (#struct){ |((#struct){ 713 reject: (string){ string } 714 }, (#struct){ 715 resource: (string){ string } 716 }) } 717 } 718 p3: (struct){ 719 #AllOutputs: (#struct){ 720 reject: (string){ string } 721 resource: (string){ string } 722 retry: (#struct){ 723 output: (#struct){ |((#struct){ 724 reject: (string){ string } 725 }, (#struct){ 726 resource: (string){ string } 727 }) } 728 } 729 } 730 #Output: (#struct){ |((#struct){ 731 reject: (string){ string } 732 }, (#struct){ 733 resource: (string){ string } 734 }) } 735 o: (#struct){ 736 retry: (#struct){ 737 output: (#struct){ 738 reject: (string){ "ok" } 739 } 740 } 741 } 742 } 743 } 744 siblingInsertion: (struct){ 745 t1: (struct){ 746 p1: (struct){ 747 D: (struct){ 748 logging: (_){ _ } 749 } 750 deployment: (struct){ 751 logging: (struct){ 752 env2: (struct){ 753 ENV: (string){ "True" } 754 } 755 env: (struct){ 756 ENV: (string){ "True" } 757 } 758 } 759 } 760 } 761 p2: (struct){ 762 D: (struct){ 763 logging: (_){ _ } 764 } 765 deployment: (struct){ 766 logging: (struct){ 767 env2: (struct){ 768 ENV: (string){ "True" } 769 } 770 env: (struct){ 771 ENV: (string){ "True" } 772 } 773 } 774 } 775 } 776 } 777 t2: (struct){ 778 p1: (struct){ 779 D: (struct){ 780 logging: (_){ _ } 781 } 782 deployment: (struct){ 783 logging: (struct){ 784 env2: (struct){ 785 ENV: (string){ "True" } 786 } 787 env: (struct){ 788 ENV: (string){ "True" } 789 } 790 } 791 } 792 } 793 p2: (struct){ 794 D: (struct){ 795 logging: (_){ _ } 796 } 797 deployment: (struct){ 798 logging: (struct){ 799 env2: (struct){ 800 ENV: (string){ "True" } 801 } 802 env: (struct){ 803 ENV: (string){ "True" } 804 } 805 } 806 } 807 } 808 } 809 } 810 issue2367: (struct){ 811 a: (_){ _ } 812 } 813 issue2310: (struct){ 814 original: (struct){ 815 #s: (_|_){ 816 // [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 817 // ./in.cue:318:46 818 // ./in.cue:318:38 819 #_1: (string){ string } 820 #_2: (string){ string } 821 #_3: (string){ string } 822 } 823 #sub: (_|_){ 824 // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 825 // ./in.cue:318:46 826 // ./in.cue:318:12 827 #a: (string){ string } 828 _#X: (#list){ 829 0: (string){ string } 830 1: (_|_){ 831 // [incomplete] issue2310.original.#sub._#X.1: error in call to strings.Replace: non-concrete value string: 832 // ./in.cue:318:46 833 // ./in.cue:318:12 834 #_1: (string){ string } 835 #_2: (string){ "a" } 836 #_3: (string){ "b" } 837 } 838 2: (_|_){ 839 // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 840 // ./in.cue:318:46 841 // ./in.cue:318:12 842 #_1: (_|_){ 843 // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 844 // ./in.cue:318:46 845 // ./in.cue:318:12 846 #_1: (string){ string } 847 #_2: (string){ "a" } 848 #_3: (string){ "b" } 849 } 850 #_2: (string){ "c" } 851 #_3: (string){ "d" } 852 } 853 3: (_|_){ 854 // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 855 // ./in.cue:318:46 856 // ./in.cue:318:12 857 #_1: (_|_){ 858 // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 859 // ./in.cue:318:46 860 // ./in.cue:318:12 861 #_1: (_|_){ 862 // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 863 // ./in.cue:318:46 864 // ./in.cue:318:12 865 #_1: (string){ string } 866 #_2: (string){ "a" } 867 #_3: (string){ "b" } 868 } 869 #_2: (string){ "c" } 870 #_3: (string){ "d" } 871 } 872 #_2: (string){ "e" } 873 #_3: (string){ "f" } 874 } 875 } 876 #_1: (_|_){ 877 // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 878 // ./in.cue:318:46 879 // ./in.cue:318:12 880 #_1: (_|_){ 881 // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 882 // ./in.cue:318:46 883 // ./in.cue:318:12 884 #_1: (string){ string } 885 #_2: (string){ "a" } 886 #_3: (string){ "b" } 887 } 888 #_2: (string){ "c" } 889 #_3: (string){ "d" } 890 } 891 #_2: (string){ "e" } 892 #_3: (string){ "f" } 893 } 894 res: (string){ 895 "bbb" 896 #a: (string){ "aaa" } 897 _#X: (#list){ 898 0: (string){ "aaa" } 899 1: (string){ 900 "bbb" 901 #_1: (string){ "aaa" } 902 #_2: (string){ "a" } 903 #_3: (string){ "b" } 904 } 905 2: (string){ 906 "bbb" 907 #_1: (string){ 908 "bbb" 909 #_1: (string){ "aaa" } 910 #_2: (string){ "a" } 911 #_3: (string){ "b" } 912 } 913 #_2: (string){ "c" } 914 #_3: (string){ "d" } 915 } 916 3: (string){ 917 "bbb" 918 #_1: (string){ 919 "bbb" 920 #_1: (string){ 921 "bbb" 922 #_1: (string){ "aaa" } 923 #_2: (string){ "a" } 924 #_3: (string){ "b" } 925 } 926 #_2: (string){ "c" } 927 #_3: (string){ "d" } 928 } 929 #_2: (string){ "e" } 930 #_3: (string){ "f" } 931 } 932 } 933 #_1: (string){ 934 "bbb" 935 #_1: (string){ 936 "bbb" 937 #_1: (string){ "aaa" } 938 #_2: (string){ "a" } 939 #_3: (string){ "b" } 940 } 941 #_2: (string){ "c" } 942 #_3: (string){ "d" } 943 } 944 #_2: (string){ "e" } 945 #_3: (string){ "f" } 946 } 947 #subs: (#list){ 948 0: (_|_){ 949 // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 950 // ./in.cue:318:46 951 // ./in.cue:318:12 952 #_2: (string){ "a" } 953 #_3: (string){ "b" } 954 #_1: (string){ string } 955 } 956 1: (_|_){ 957 // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 958 // ./in.cue:318:46 959 // ./in.cue:318:12 960 #_2: (string){ "c" } 961 #_3: (string){ "d" } 962 #_1: (string){ string } 963 } 964 2: (_|_){ 965 // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 966 // ./in.cue:318:46 967 // ./in.cue:318:12 968 #_2: (string){ "e" } 969 #_3: (string){ "f" } 970 #_1: (string){ string } 971 } 972 } 973 } 974 reduced: (struct){ 975 res: (string){ 976 "Xaaa" 977 #X: (#list){ 978 0: (string){ "X" } 979 1: (string){ 980 "Xa" 981 #str: (string){ "X" } 982 } 983 2: (string){ 984 "Xaa" 985 #str: (string){ 986 "Xa" 987 #str: (string){ "X" } 988 } 989 } 990 3: (string){ 991 "Xaaa" 992 #str: (string){ 993 "Xaa" 994 #str: (string){ 995 "Xa" 996 #str: (string){ "X" } 997 } 998 } 999 } 1000 } 1001 #str: (string){ 1002 "Xaa" 1003 #str: (string){ 1004 "Xa" 1005 #str: (string){ "X" } 1006 } 1007 } 1008 } 1009 #s: (_|_){ 1010 // [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 1011 // ./in.cue:347:21 1012 // ./in.cue:347:13 1013 #str: (string){ string } 1014 } 1015 #subs: (#list){ 1016 0: (int){ 0 } 1017 1: (int){ 1 } 1018 2: (int){ 2 } 1019 } 1020 } 1021 } 1022 issue3903: (struct){ 1023 reduced: (struct){ 1024 s1: (#struct){ 1025 _deps: (#list){ 1026 0: (#struct){ 1027 _deps: (list){ 1028 } 1029 objs: (#list){ 1030 } 1031 } 1032 } 1033 objs: (#list){ 1034 } 1035 } 1036 #Schema: (#struct){ 1037 _deps: (list){ 1038 } 1039 objs: (#list){ 1040 } 1041 } 1042 } 1043 full: (struct){ 1044 s1: (#struct){ 1045 _deps: (#list){ 1046 0: (#struct){ 1047 _local: (#list){ 1048 0: (string){ "s2 local" } 1049 } 1050 _deps: (list){ 1051 } 1052 objs: (#list){ 1053 0: (string){ "s2 local" } 1054 } 1055 } 1056 } 1057 _local: (#list){ 1058 0: (string){ "s1 local" } 1059 } 1060 objs: (#list){ 1061 0: (string){ "s1 local" } 1062 1: (string){ "s2 local" } 1063 } 1064 } 1065 s2: (#struct){ 1066 _local: (#list){ 1067 0: (string){ "s2 local" } 1068 } 1069 _deps: (list){ 1070 } 1071 objs: (#list){ 1072 0: (string){ "s2 local" } 1073 } 1074 } 1075 #Schema: (#struct){ 1076 _local: (list){ 1077 } 1078 _deps: (list){ 1079 } 1080 objs: (#list){ 1081 } 1082 } 1083 } 1084 } 1085 issue3941: (struct){ 1086 full: (struct){ 1087 #Metadata: (#struct){ 1088 name: (string){ string } 1089 } 1090 #Resource: (#struct){ 1091 metadata: ~(issue3941.full.#Metadata) 1092 } 1093 out: (struct){ 1094 _metadata: (struct){ 1095 name: (string){ "foo" } 1096 } 1097 resource: (struct){ 1098 level1: (struct){ 1099 foo: (#struct){ 1100 metadata: (#struct){ 1101 name: (string){ "foo" } 1102 } 1103 } 1104 } 1105 } 1106 _names: (#list){ 1107 0: (string){ "foo" } 1108 } 1109 } 1110 } 1111 } 1112 } 1113 -- diff/-out/evalalpha<==>+out/eval -- 1114 diff old new 1115 --- old 1116 +++ new 1117 @@ -1,13 +1,6 @@ 1118 Errors: 1119 -selfReferential.insertionError.A: field foo3 not allowed by earlier comprehension or reference cycle 1120 -issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1121 - ./in.cue:318:62 1122 -issue2310.original.#sub._#X.3.#_1.#_1.#_1: structural cycle: 1123 - ./in.cue:318:62 1124 -issue2310.reduced.res.#X.3.#str.#str.#str: structural cycle: 1125 - ./in.cue:347:21 1126 -issue2310.reduced.res.#str.#str.#str: structural cycle: 1127 - ./in.cue:347:21 1128 +selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 1129 + ./in.cue:122:14 1130 1131 Result: 1132 (_|_){ 1133 @@ -27,7 +20,9 @@ 1134 B: (struct){ 1135 a: (struct){ 1136 parent: (string){ "" } 1137 - children: (#list){ 1138 + children: (_|_){ 1139 + // [incomplete] B.a.children: cannot range over v.children (incomplete type list): 1140 + // ./in.cue:24:40 1141 } 1142 } 1143 } 1144 @@ -60,17 +55,12 @@ 1145 } 1146 } 1147 _e: (#struct){ 1148 - f1: (#struct){ 1149 - } 1150 - f2: (#struct){ 1151 - a: (#struct){ 1152 - t: (#struct){ 1153 - f1: (#struct){ 1154 - } 1155 - f2: (#struct){ 1156 - } 1157 - } 1158 - } 1159 + f2: (#struct){ 1160 + a: (#struct){ 1161 + t: ~(issue1666.#E) 1162 + } 1163 + } 1164 + f1: (#struct){ 1165 } 1166 } 1167 e: (#struct){ 1168 @@ -84,12 +74,7 @@ 1169 } 1170 f2: (#struct){ 1171 a: (#struct){ 1172 - t: (#struct){ 1173 - f1: (#struct){ 1174 - } 1175 - f2: (#struct){ 1176 - } 1177 - } 1178 + t: ~(issue1666.#E) 1179 } 1180 } 1181 } 1182 @@ -135,9 +120,9 @@ 1183 insertionError: (_|_){ 1184 // [eval] 1185 A: (_|_){ 1186 - // [eval] selfReferential.insertionError.A: field foo3 not allowed by earlier comprehension or reference cycle 1187 + // [eval] selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 1188 + // ./in.cue:122:14 1189 foo: (int){ 1 } 1190 - foo3: (int){ 1 } 1191 } 1192 } 1193 acrossOr: (struct){ 1194 @@ -405,10 +390,8 @@ 1195 issue2367: (struct){ 1196 a: (_){ _ } 1197 } 1198 - issue2310: (_|_){ 1199 - // [structural cycle] 1200 - original: (_|_){ 1201 - // [structural cycle] 1202 + issue2310: (struct){ 1203 + original: (struct){ 1204 #s: (_|_){ 1205 // [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 1206 // ./in.cue:318:46 1207 @@ -418,14 +401,128 @@ 1208 #_3: (string){ string } 1209 } 1210 #sub: (_|_){ 1211 - // [structural cycle] issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1212 - // ./in.cue:318:62 1213 - } 1214 - res: (_|_){ 1215 - // [structural cycle] issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1216 - // ./in.cue:318:62 1217 - // issue2310.original.#sub._#X.3.#_1.#_1.#_1: structural cycle: 1218 - // ./in.cue:318:62 1219 + // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1220 + // ./in.cue:318:46 1221 + // ./in.cue:318:12 1222 + #a: (string){ string } 1223 + _#X: (#list){ 1224 + 0: (string){ string } 1225 + 1: (_|_){ 1226 + // [incomplete] issue2310.original.#sub._#X.1: error in call to strings.Replace: non-concrete value string: 1227 + // ./in.cue:318:46 1228 + // ./in.cue:318:12 1229 + #_1: (string){ string } 1230 + #_2: (string){ "a" } 1231 + #_3: (string){ "b" } 1232 + } 1233 + 2: (_|_){ 1234 + // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 1235 + // ./in.cue:318:46 1236 + // ./in.cue:318:12 1237 + #_1: (_|_){ 1238 + // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 1239 + // ./in.cue:318:46 1240 + // ./in.cue:318:12 1241 + #_1: (string){ string } 1242 + #_2: (string){ "a" } 1243 + #_3: (string){ "b" } 1244 + } 1245 + #_2: (string){ "c" } 1246 + #_3: (string){ "d" } 1247 + } 1248 + 3: (_|_){ 1249 + // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1250 + // ./in.cue:318:46 1251 + // ./in.cue:318:12 1252 + #_1: (_|_){ 1253 + // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1254 + // ./in.cue:318:46 1255 + // ./in.cue:318:12 1256 + #_1: (_|_){ 1257 + // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1258 + // ./in.cue:318:46 1259 + // ./in.cue:318:12 1260 + #_1: (string){ string } 1261 + #_2: (string){ "a" } 1262 + #_3: (string){ "b" } 1263 + } 1264 + #_2: (string){ "c" } 1265 + #_3: (string){ "d" } 1266 + } 1267 + #_2: (string){ "e" } 1268 + #_3: (string){ "f" } 1269 + } 1270 + } 1271 + #_1: (_|_){ 1272 + // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1273 + // ./in.cue:318:46 1274 + // ./in.cue:318:12 1275 + #_1: (_|_){ 1276 + // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1277 + // ./in.cue:318:46 1278 + // ./in.cue:318:12 1279 + #_1: (string){ string } 1280 + #_2: (string){ "a" } 1281 + #_3: (string){ "b" } 1282 + } 1283 + #_2: (string){ "c" } 1284 + #_3: (string){ "d" } 1285 + } 1286 + #_2: (string){ "e" } 1287 + #_3: (string){ "f" } 1288 + } 1289 + res: (string){ 1290 + "bbb" 1291 + #a: (string){ "aaa" } 1292 + _#X: (#list){ 1293 + 0: (string){ "aaa" } 1294 + 1: (string){ 1295 + "bbb" 1296 + #_1: (string){ "aaa" } 1297 + #_2: (string){ "a" } 1298 + #_3: (string){ "b" } 1299 + } 1300 + 2: (string){ 1301 + "bbb" 1302 + #_1: (string){ 1303 + "bbb" 1304 + #_1: (string){ "aaa" } 1305 + #_2: (string){ "a" } 1306 + #_3: (string){ "b" } 1307 + } 1308 + #_2: (string){ "c" } 1309 + #_3: (string){ "d" } 1310 + } 1311 + 3: (string){ 1312 + "bbb" 1313 + #_1: (string){ 1314 + "bbb" 1315 + #_1: (string){ 1316 + "bbb" 1317 + #_1: (string){ "aaa" } 1318 + #_2: (string){ "a" } 1319 + #_3: (string){ "b" } 1320 + } 1321 + #_2: (string){ "c" } 1322 + #_3: (string){ "d" } 1323 + } 1324 + #_2: (string){ "e" } 1325 + #_3: (string){ "f" } 1326 + } 1327 + } 1328 + #_1: (string){ 1329 + "bbb" 1330 + #_1: (string){ 1331 + "bbb" 1332 + #_1: (string){ "aaa" } 1333 + #_2: (string){ "a" } 1334 + #_3: (string){ "b" } 1335 + } 1336 + #_2: (string){ "c" } 1337 + #_3: (string){ "d" } 1338 + } 1339 + #_2: (string){ "e" } 1340 + #_3: (string){ "f" } 1341 } 1342 #subs: (#list){ 1343 0: (_|_){ 1344 @@ -432,33 +529,62 @@ 1345 // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 1346 // ./in.cue:318:46 1347 // ./in.cue:318:12 1348 - #_1: (string){ string } 1349 #_2: (string){ "a" } 1350 #_3: (string){ "b" } 1351 + #_1: (string){ string } 1352 } 1353 1: (_|_){ 1354 // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 1355 // ./in.cue:318:46 1356 // ./in.cue:318:12 1357 - #_1: (string){ string } 1358 - #_2: (string){ "c" } 1359 - #_3: (string){ "d" } 1360 + #_2: (string){ "c" } 1361 + #_3: (string){ "d" } 1362 + #_1: (string){ string } 1363 } 1364 2: (_|_){ 1365 // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 1366 // ./in.cue:318:46 1367 // ./in.cue:318:12 1368 - #_1: (string){ string } 1369 #_2: (string){ "e" } 1370 #_3: (string){ "f" } 1371 - } 1372 - } 1373 - } 1374 - reduced: (_|_){ 1375 - // [structural cycle] 1376 - res: (_|_){ 1377 - // [structural cycle] issue2310.reduced.res.#str.#str.#str: structural cycle: 1378 - // ./in.cue:347:21 1379 + #_1: (string){ string } 1380 + } 1381 + } 1382 + } 1383 + reduced: (struct){ 1384 + res: (string){ 1385 + "Xaaa" 1386 + #X: (#list){ 1387 + 0: (string){ "X" } 1388 + 1: (string){ 1389 + "Xa" 1390 + #str: (string){ "X" } 1391 + } 1392 + 2: (string){ 1393 + "Xaa" 1394 + #str: (string){ 1395 + "Xa" 1396 + #str: (string){ "X" } 1397 + } 1398 + } 1399 + 3: (string){ 1400 + "Xaaa" 1401 + #str: (string){ 1402 + "Xaa" 1403 + #str: (string){ 1404 + "Xa" 1405 + #str: (string){ "X" } 1406 + } 1407 + } 1408 + } 1409 + } 1410 + #str: (string){ 1411 + "Xaa" 1412 + #str: (string){ 1413 + "Xa" 1414 + #str: (string){ "X" } 1415 + } 1416 + } 1417 } 1418 #s: (_|_){ 1419 // [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 1420 @@ -496,9 +622,6 @@ 1421 } 1422 full: (struct){ 1423 s1: (#struct){ 1424 - _local: (#list){ 1425 - 0: (string){ "s1 local" } 1426 - } 1427 _deps: (#list){ 1428 0: (#struct){ 1429 _local: (#list){ 1430 @@ -511,6 +634,9 @@ 1431 } 1432 } 1433 } 1434 + _local: (#list){ 1435 + 0: (string){ "s1 local" } 1436 + } 1437 objs: (#list){ 1438 0: (string){ "s1 local" } 1439 1: (string){ "s2 local" } 1440 @@ -542,9 +668,7 @@ 1441 name: (string){ string } 1442 } 1443 #Resource: (#struct){ 1444 - metadata: (#struct){ 1445 - name: (string){ string } 1446 - } 1447 + metadata: ~(issue3941.full.#Metadata) 1448 } 1449 out: (struct){ 1450 _metadata: (struct){ 1451 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 1452 diff old new 1453 --- old 1454 +++ new 1455 @@ -1,9 +1,12 @@ 1456 -Leaks: 75 1457 -Freed: 1383 1458 -Reused: 1358 1459 -Allocs: 100 1460 -Retain: 479 1461 - 1462 -Unifications: 970 1463 -Conjuncts: 2973 1464 -Disjuncts: 1704 1465 +Leaks: 996 1466 +Freed: 0 1467 +Reused: 0 1468 +Allocs: 996 1469 +Retain: 0 1470 + 1471 +Unifications: 625 1472 +Conjuncts: 1705 1473 +Disjuncts: 202 1474 + 1475 +CloseIDElems: 10146 1476 +NumCloseIDs: 850 1477 -- out/eval/stats -- 1478 Leaks: 75 1479 Freed: 1383 1480 Reused: 1358 1481 Allocs: 100 1482 Retain: 479 1483 1484 Unifications: 970 1485 Conjuncts: 2973 1486 Disjuncts: 1704 1487 -- diff/explanation -- 1488 B.a.children: now correctly marked as incomplete 1489 -- out/eval -- 1490 Errors: 1491 selfReferential.insertionError.A: field foo3 not allowed by earlier comprehension or reference cycle 1492 issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1493 ./in.cue:318:62 1494 issue2310.original.#sub._#X.3.#_1.#_1.#_1: structural cycle: 1495 ./in.cue:318:62 1496 issue2310.reduced.res.#X.3.#str.#str.#str: structural cycle: 1497 ./in.cue:347:21 1498 issue2310.reduced.res.#str.#str.#str: structural cycle: 1499 ./in.cue:347:21 1500 1501 Result: 1502 (_|_){ 1503 // [eval] 1504 A: (struct){ 1505 a: (struct){ 1506 parent: (string){ "" } 1507 children: (#list){ 1508 } 1509 } 1510 b: (struct){ 1511 parent: (string){ "a" } 1512 children: (#list){ 1513 } 1514 } 1515 } 1516 B: (struct){ 1517 a: (struct){ 1518 parent: (string){ "" } 1519 children: (#list){ 1520 } 1521 } 1522 } 1523 Issue486: (struct){ 1524 A: (struct){ 1525 a: (struct){ 1526 parent: (string){ "" } 1527 children: (#list){ 1528 0: (string){ "b" } 1529 } 1530 } 1531 b: (struct){ 1532 parent: (string){ "a" } 1533 children: (#list){ 1534 0: (string){ "c" } 1535 } 1536 } 1537 c: (struct){ 1538 parent: (string){ "b" } 1539 children: (#list){ 1540 } 1541 } 1542 } 1543 } 1544 issue1666: (struct){ 1545 #E: (#struct){ 1546 f1: (#struct){ 1547 } 1548 f2: (#struct){ 1549 } 1550 } 1551 _e: (#struct){ 1552 f1: (#struct){ 1553 } 1554 f2: (#struct){ 1555 a: (#struct){ 1556 t: (#struct){ 1557 f1: (#struct){ 1558 } 1559 f2: (#struct){ 1560 } 1561 } 1562 } 1563 } 1564 } 1565 e: (#struct){ 1566 f1: (#struct){ 1567 a: (#struct){ 1568 f1: (#struct){ 1569 } 1570 f2: (#struct){ 1571 } 1572 } 1573 } 1574 f2: (#struct){ 1575 a: (#struct){ 1576 t: (#struct){ 1577 f1: (#struct){ 1578 } 1579 f2: (#struct){ 1580 } 1581 } 1582 } 1583 } 1584 } 1585 } 1586 issue779: (struct){ 1587 X: (string){ "test" } 1588 STATE: (struct){ 1589 code: (int){ 101 } 1590 } 1591 Y: (struct){ 1592 message: (string){ "test" } 1593 code: (int){ 101 } 1594 } 1595 } 1596 selfReferential: (_|_){ 1597 // [eval] 1598 T1: (struct){ 1599 S: (struct){ 1600 d: (string){ "bar" } 1601 } 1602 T: (struct){ 1603 e: (struct){ 1604 S: (struct){ 1605 a: (string){ "foo" } 1606 d: (string){ "bar" } 1607 } 1608 } 1609 } 1610 } 1611 list: (struct){ 1612 panels: (#list){ 1613 0: (struct){ 1614 id: (int){ 0 } 1615 } 1616 1: (struct){ 1617 id: (int){ 1 } 1618 } 1619 2: (struct){ 1620 id: (int){ 2 } 1621 } 1622 } 1623 } 1624 insertionError: (_|_){ 1625 // [eval] 1626 A: (_|_){ 1627 // [eval] selfReferential.insertionError.A: field foo3 not allowed by earlier comprehension or reference cycle 1628 foo: (int){ 1 } 1629 foo3: (int){ 1 } 1630 } 1631 } 1632 acrossOr: (struct){ 1633 t1: (struct){ 1634 p1: (struct){ 1635 o: (#struct){ 1636 retry: (#struct){ 1637 reject: (string){ "ok" } 1638 } 1639 } 1640 #AllOutputs: (#struct){ 1641 reject: (string){ string } 1642 resource: (string){ string } 1643 retry: (#struct){ |((#struct){ 1644 reject: (string){ string } 1645 }, (#struct){ 1646 resource: (string){ string } 1647 }) } 1648 } 1649 #Output: (#struct){ |((#struct){ 1650 reject: (string){ string } 1651 }, (#struct){ 1652 resource: (string){ string } 1653 }) } 1654 } 1655 p2: (struct){ 1656 #Output: (#struct){ |((#struct){ 1657 reject: (string){ string } 1658 }, (#struct){ 1659 resource: (string){ string } 1660 }) } 1661 o: (#struct){ 1662 retry: (#struct){ 1663 reject: (string){ "ok" } 1664 } 1665 } 1666 #AllOutputs: (#struct){ 1667 reject: (string){ string } 1668 resource: (string){ string } 1669 retry: (#struct){ |((#struct){ 1670 reject: (string){ string } 1671 }, (#struct){ 1672 resource: (string){ string } 1673 }) } 1674 } 1675 } 1676 p3: (struct){ 1677 #Output: (#struct){ |((#struct){ 1678 reject: (string){ string } 1679 }, (#struct){ 1680 resource: (string){ string } 1681 }) } 1682 #AllOutputs: (#struct){ 1683 reject: (string){ string } 1684 resource: (string){ string } 1685 retry: (#struct){ |((#struct){ 1686 reject: (string){ string } 1687 }, (#struct){ 1688 resource: (string){ string } 1689 }) } 1690 } 1691 o: (#struct){ 1692 retry: (#struct){ 1693 reject: (string){ "ok" } 1694 } 1695 } 1696 } 1697 } 1698 t2: (struct){ 1699 p1: (struct){ 1700 d: ((int|string)){ |((int){ int }, (string){ string }) } 1701 o: (struct){ 1702 b: (int){ 2 } 1703 } 1704 #A: (#struct){ 1705 d1: (int){ int } 1706 d2: (string){ string } 1707 d3: (#struct){ 1708 b: ((int|string)){ |((int){ int }, (string){ string }) } 1709 } 1710 } 1711 } 1712 p2: (struct){ 1713 o: (struct){ 1714 b: (int){ 2 } 1715 } 1716 d: ((int|string)){ |((int){ int }, (string){ string }) } 1717 #A: (#struct){ 1718 d1: (int){ int } 1719 d2: (string){ string } 1720 d3: (#struct){ 1721 b: ((int|string)){ |((int){ int }, (string){ string }) } 1722 } 1723 } 1724 } 1725 p3: (struct){ 1726 o: (struct){ 1727 b: (int){ 2 } 1728 } 1729 #A: (#struct){ 1730 d1: (int){ int } 1731 d2: (string){ string } 1732 d3: (#struct){ 1733 b: ((int|string)){ |((int){ int }, (string){ string }) } 1734 } 1735 } 1736 d: ((int|string)){ |((int){ int }, (string){ string }) } 1737 } 1738 } 1739 } 1740 fail: (_|_){ 1741 // [incomplete] selfReferential.fail.b: undefined field: x: 1742 // ./in.cue:305:7 1743 a: (struct){ 1744 } 1745 b: (_|_){ 1746 // [incomplete] selfReferential.fail.b: undefined field: x: 1747 // ./in.cue:305:7 1748 } 1749 } 1750 } 1751 issue1881: (struct){ 1752 p1: (struct){ 1753 o: (#struct){ 1754 retry: (#struct){ 1755 output: (#struct){ 1756 reject: (string){ "ok" } 1757 } 1758 } 1759 } 1760 #AllOutputs: (#struct){ 1761 reject: (string){ string } 1762 resource: (string){ string } 1763 retry: (#struct){ 1764 output: (#struct){ |((#struct){ 1765 reject: (string){ string } 1766 }, (#struct){ 1767 resource: (string){ string } 1768 }) } 1769 } 1770 } 1771 #Output: (#struct){ |((#struct){ 1772 reject: (string){ string } 1773 }, (#struct){ 1774 resource: (string){ string } 1775 }) } 1776 } 1777 p2: (struct){ 1778 #AllOutputs: (#struct){ 1779 reject: (string){ string } 1780 resource: (string){ string } 1781 retry: (#struct){ 1782 output: (#struct){ |((#struct){ 1783 reject: (string){ string } 1784 }, (#struct){ 1785 resource: (string){ string } 1786 }) } 1787 } 1788 } 1789 o: (#struct){ 1790 retry: (#struct){ 1791 output: (#struct){ 1792 reject: (string){ "ok" } 1793 } 1794 } 1795 } 1796 #Output: (#struct){ |((#struct){ 1797 reject: (string){ string } 1798 }, (#struct){ 1799 resource: (string){ string } 1800 }) } 1801 } 1802 p3: (struct){ 1803 #AllOutputs: (#struct){ 1804 reject: (string){ string } 1805 resource: (string){ string } 1806 retry: (#struct){ 1807 output: (#struct){ |((#struct){ 1808 reject: (string){ string } 1809 }, (#struct){ 1810 resource: (string){ string } 1811 }) } 1812 } 1813 } 1814 #Output: (#struct){ |((#struct){ 1815 reject: (string){ string } 1816 }, (#struct){ 1817 resource: (string){ string } 1818 }) } 1819 o: (#struct){ 1820 retry: (#struct){ 1821 output: (#struct){ 1822 reject: (string){ "ok" } 1823 } 1824 } 1825 } 1826 } 1827 } 1828 siblingInsertion: (struct){ 1829 t1: (struct){ 1830 p1: (struct){ 1831 D: (struct){ 1832 logging: (_){ _ } 1833 } 1834 deployment: (struct){ 1835 logging: (struct){ 1836 env2: (struct){ 1837 ENV: (string){ "True" } 1838 } 1839 env: (struct){ 1840 ENV: (string){ "True" } 1841 } 1842 } 1843 } 1844 } 1845 p2: (struct){ 1846 D: (struct){ 1847 logging: (_){ _ } 1848 } 1849 deployment: (struct){ 1850 logging: (struct){ 1851 env2: (struct){ 1852 ENV: (string){ "True" } 1853 } 1854 env: (struct){ 1855 ENV: (string){ "True" } 1856 } 1857 } 1858 } 1859 } 1860 } 1861 t2: (struct){ 1862 p1: (struct){ 1863 D: (struct){ 1864 logging: (_){ _ } 1865 } 1866 deployment: (struct){ 1867 logging: (struct){ 1868 env2: (struct){ 1869 ENV: (string){ "True" } 1870 } 1871 env: (struct){ 1872 ENV: (string){ "True" } 1873 } 1874 } 1875 } 1876 } 1877 p2: (struct){ 1878 D: (struct){ 1879 logging: (_){ _ } 1880 } 1881 deployment: (struct){ 1882 logging: (struct){ 1883 env2: (struct){ 1884 ENV: (string){ "True" } 1885 } 1886 env: (struct){ 1887 ENV: (string){ "True" } 1888 } 1889 } 1890 } 1891 } 1892 } 1893 } 1894 issue2367: (struct){ 1895 a: (_){ _ } 1896 } 1897 issue2310: (_|_){ 1898 // [structural cycle] 1899 original: (_|_){ 1900 // [structural cycle] 1901 #s: (_|_){ 1902 // [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 1903 // ./in.cue:318:46 1904 // ./in.cue:318:38 1905 #_1: (string){ string } 1906 #_2: (string){ string } 1907 #_3: (string){ string } 1908 } 1909 #sub: (_|_){ 1910 // [structural cycle] issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1911 // ./in.cue:318:62 1912 } 1913 res: (_|_){ 1914 // [structural cycle] issue2310.original.#sub.#_1.#_1.#_1: structural cycle: 1915 // ./in.cue:318:62 1916 // issue2310.original.#sub._#X.3.#_1.#_1.#_1: structural cycle: 1917 // ./in.cue:318:62 1918 } 1919 #subs: (#list){ 1920 0: (_|_){ 1921 // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 1922 // ./in.cue:318:46 1923 // ./in.cue:318:12 1924 #_1: (string){ string } 1925 #_2: (string){ "a" } 1926 #_3: (string){ "b" } 1927 } 1928 1: (_|_){ 1929 // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 1930 // ./in.cue:318:46 1931 // ./in.cue:318:12 1932 #_1: (string){ string } 1933 #_2: (string){ "c" } 1934 #_3: (string){ "d" } 1935 } 1936 2: (_|_){ 1937 // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 1938 // ./in.cue:318:46 1939 // ./in.cue:318:12 1940 #_1: (string){ string } 1941 #_2: (string){ "e" } 1942 #_3: (string){ "f" } 1943 } 1944 } 1945 } 1946 reduced: (_|_){ 1947 // [structural cycle] 1948 res: (_|_){ 1949 // [structural cycle] issue2310.reduced.res.#str.#str.#str: structural cycle: 1950 // ./in.cue:347:21 1951 } 1952 #s: (_|_){ 1953 // [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 1954 // ./in.cue:347:21 1955 // ./in.cue:347:13 1956 #str: (string){ string } 1957 } 1958 #subs: (#list){ 1959 0: (int){ 0 } 1960 1: (int){ 1 } 1961 2: (int){ 2 } 1962 } 1963 } 1964 } 1965 issue3903: (struct){ 1966 reduced: (struct){ 1967 s1: (#struct){ 1968 _deps: (#list){ 1969 0: (#struct){ 1970 _deps: (list){ 1971 } 1972 objs: (#list){ 1973 } 1974 } 1975 } 1976 objs: (#list){ 1977 } 1978 } 1979 #Schema: (#struct){ 1980 _deps: (list){ 1981 } 1982 objs: (#list){ 1983 } 1984 } 1985 } 1986 full: (struct){ 1987 s1: (#struct){ 1988 _local: (#list){ 1989 0: (string){ "s1 local" } 1990 } 1991 _deps: (#list){ 1992 0: (#struct){ 1993 _local: (#list){ 1994 0: (string){ "s2 local" } 1995 } 1996 _deps: (list){ 1997 } 1998 objs: (#list){ 1999 0: (string){ "s2 local" } 2000 } 2001 } 2002 } 2003 objs: (#list){ 2004 0: (string){ "s1 local" } 2005 1: (string){ "s2 local" } 2006 } 2007 } 2008 s2: (#struct){ 2009 _local: (#list){ 2010 0: (string){ "s2 local" } 2011 } 2012 _deps: (list){ 2013 } 2014 objs: (#list){ 2015 0: (string){ "s2 local" } 2016 } 2017 } 2018 #Schema: (#struct){ 2019 _local: (list){ 2020 } 2021 _deps: (list){ 2022 } 2023 objs: (#list){ 2024 } 2025 } 2026 } 2027 } 2028 issue3941: (struct){ 2029 full: (struct){ 2030 #Metadata: (#struct){ 2031 name: (string){ string } 2032 } 2033 #Resource: (#struct){ 2034 metadata: (#struct){ 2035 name: (string){ string } 2036 } 2037 } 2038 out: (struct){ 2039 _metadata: (struct){ 2040 name: (string){ "foo" } 2041 } 2042 resource: (struct){ 2043 level1: (struct){ 2044 foo: (#struct){ 2045 metadata: (#struct){ 2046 name: (string){ "foo" } 2047 } 2048 } 2049 } 2050 } 2051 _names: (#list){ 2052 0: (string){ "foo" } 2053 } 2054 } 2055 } 2056 } 2057 } 2058 -- out/compile -- 2059 --- in.cue 2060 { 2061 A: { 2062 a: { 2063 parent: "" 2064 children: [ 2065 for k, v in 〈3;A〉 if (〈0;v〉.parent == 〈0;k〉) { 2066 〈1;k〉 2067 }, 2068 ] 2069 } 2070 b: { 2071 parent: "a" 2072 children: [ 2073 for k, v in 〈3;A〉 if (〈0;v〉.parent == 〈0;k〉) { 2074 〈1;k〉 2075 }, 2076 ] 2077 } 2078 } 2079 B: { 2080 a: { 2081 parent: "" 2082 children: [ 2083 for k, v in 〈3;B〉 for _, w in 〈0;v〉.children { 2084 〈2;k〉 2085 }, 2086 ] 2087 } 2088 } 2089 Issue486: { 2090 A: { 2091 a: { 2092 parent: "" 2093 children: [ 2094 ...string, 2095 ] 2096 } 2097 b: { 2098 parent: "a" 2099 children: [ 2100 ...string, 2101 ] 2102 } 2103 c: { 2104 parent: "b" 2105 children: [ 2106 ...string, 2107 ] 2108 } 2109 } 2110 A: { 2111 [string]: { 2112 children: [ 2113 for k, v in 〈3;A〉 if (〈0;v〉.parent == 〈3;-〉) { 2114 〈1;k〉 2115 }, 2116 ] 2117 } 2118 } 2119 } 2120 issue1666: { 2121 #E: { 2122 f1: { 2123 [string]: (〈2;#E〉|[ 2124 ...〈3;#E〉, 2125 ]) 2126 } 2127 f2: { 2128 [string]: { 2129 t: 〈3;#E〉 2130 } 2131 } 2132 } 2133 _e: 〈0;#E〉 2134 _e: { 2135 f2: { 2136 a: _ 2137 } 2138 } 2139 e: (〈0;_e〉 & { 2140 f1: { 2141 for fk, s in 〈2;_e〉.f2 { 2142 〈1;fk〉: 〈1;s〉.t 2143 } 2144 } 2145 }) 2146 } 2147 issue779: { 2148 X: 〈0;Y〉.message 2149 STATE: { 2150 for k, v in 〈1;Y〉 { 2151 if (〈1;k〉 != "message") { 2152 "\(〈2;k〉)": 〈2;v〉 2153 } 2154 } 2155 } 2156 Y: (〈0;STATE〉 & { 2157 message: 〈1;X〉 2158 }) 2159 X: "test" 2160 STATE: { 2161 code: 101 2162 } 2163 } 2164 selfReferential: { 2165 T1: { 2166 S: { 2167 d: "bar" 2168 } 2169 T: { 2170 e: { 2171 S: { 2172 a: "foo" 2173 } 2174 } 2175 } 2176 for s, v in 〈0;S〉 for t, _ in 〈1;T〉 { 2177 T: { 2178 〈2;t〉: { 2179 S: { 2180 〈5;s〉: 〈5;v〉 2181 } 2182 } 2183 } 2184 } 2185 } 2186 } 2187 selfReferential: { 2188 list: { 2189 panels: [ 2190 for i, _ in 〈1;panels〉 { 2191 id: 〈1;i〉 2192 }, 2193 ] 2194 panels: [ 2195 {}, 2196 {}, 2197 {}, 2198 ] 2199 } 2200 } 2201 selfReferential: { 2202 insertionError: { 2203 A: { 2204 foo: 1 2205 for _, x in 〈1;A〉 { 2206 "foo3": 1 2207 } 2208 } 2209 } 2210 } 2211 selfReferential: { 2212 acrossOr: { 2213 t1: { 2214 p1: { 2215 o: (〈0;#Output〉 & { 2216 retry: { 2217 reject: "ok" 2218 } 2219 }) 2220 #AllOutputs: { 2221 reject: string 2222 resource: string 2223 retry: 〈1;#Output〉 2224 } 2225 #Output: or([ 2226 for name, config in 〈1;#AllOutputs〉 { 2227 〈1;name〉: 〈1;config〉 2228 }, 2229 ]) 2230 } 2231 } 2232 } 2233 } 2234 selfReferential: { 2235 acrossOr: { 2236 t1: { 2237 p2: { 2238 #Output: or([ 2239 for name, config in 〈1;#AllOutputs〉 { 2240 〈1;name〉: 〈1;config〉 2241 }, 2242 ]) 2243 o: (〈0;#Output〉 & { 2244 retry: { 2245 reject: "ok" 2246 } 2247 }) 2248 #AllOutputs: { 2249 reject: string 2250 resource: string 2251 retry: 〈1;#Output〉 2252 } 2253 } 2254 } 2255 } 2256 } 2257 selfReferential: { 2258 acrossOr: { 2259 t1: { 2260 p3: { 2261 #Output: or([ 2262 for name, config in 〈1;#AllOutputs〉 { 2263 〈1;name〉: 〈1;config〉 2264 }, 2265 ]) 2266 #AllOutputs: { 2267 reject: string 2268 resource: string 2269 retry: 〈1;#Output〉 2270 } 2271 o: (〈0;#Output〉 & { 2272 retry: { 2273 reject: "ok" 2274 } 2275 }) 2276 } 2277 } 2278 } 2279 } 2280 selfReferential: { 2281 acrossOr: { 2282 t2: { 2283 p1: { 2284 d: or([ 2285 for x, y in 〈1;#A〉 { 2286 〈1;y〉 2287 }, 2288 ]) 2289 o: (〈0;d〉 & { 2290 b: 2 2291 }) 2292 #A: { 2293 d1: int 2294 d2: string 2295 d3: { 2296 b: 〈2;d〉 2297 } 2298 } 2299 } 2300 } 2301 } 2302 } 2303 selfReferential: { 2304 acrossOr: { 2305 t2: { 2306 p2: { 2307 o: (〈0;d〉 & { 2308 b: 2 2309 }) 2310 d: or([ 2311 for x, y in 〈1;#A〉 { 2312 〈1;y〉 2313 }, 2314 ]) 2315 #A: { 2316 d1: int 2317 d2: string 2318 d3: { 2319 b: 〈2;d〉 2320 } 2321 } 2322 } 2323 } 2324 } 2325 } 2326 selfReferential: { 2327 acrossOr: { 2328 t2: { 2329 p3: { 2330 o: (〈0;d〉 & { 2331 b: 2 2332 }) 2333 #A: { 2334 d1: int 2335 d2: string 2336 d3: { 2337 b: 〈2;d〉 2338 } 2339 } 2340 d: or([ 2341 for x, y in 〈1;#A〉 { 2342 〈1;y〉 2343 }, 2344 ]) 2345 } 2346 } 2347 } 2348 } 2349 issue1881: { 2350 p1: { 2351 o: (〈0;#Output〉 & { 2352 retry: { 2353 output: { 2354 reject: "ok" 2355 } 2356 } 2357 }) 2358 #AllOutputs: { 2359 reject: string 2360 resource: string 2361 retry: { 2362 output: 〈2;#Output〉 2363 } 2364 } 2365 #Output: or([ 2366 for name, config in 〈1;#AllOutputs〉 { 2367 〈1;name〉: 〈1;config〉 2368 }, 2369 ]) 2370 } 2371 } 2372 issue1881: { 2373 p2: { 2374 #AllOutputs: { 2375 reject: string 2376 resource: string 2377 retry: { 2378 output: 〈2;#Output〉 2379 } 2380 } 2381 o: (〈0;#Output〉 & { 2382 retry: { 2383 output: { 2384 reject: "ok" 2385 } 2386 } 2387 }) 2388 #Output: or([ 2389 for name, config in 〈1;#AllOutputs〉 { 2390 〈1;name〉: 〈1;config〉 2391 }, 2392 ]) 2393 } 2394 } 2395 issue1881: { 2396 p3: { 2397 #AllOutputs: { 2398 reject: string 2399 resource: string 2400 retry: { 2401 output: 〈2;#Output〉 2402 } 2403 } 2404 #Output: or([ 2405 for name, config in 〈1;#AllOutputs〉 { 2406 〈1;name〉: 〈1;config〉 2407 }, 2408 ]) 2409 o: (〈0;#Output〉 & { 2410 retry: { 2411 output: { 2412 reject: "ok" 2413 } 2414 } 2415 }) 2416 } 2417 } 2418 siblingInsertion: { 2419 t1: { 2420 p1: { 2421 D: { 2422 logging: _ 2423 } 2424 deployment: _ 2425 for k, v in 〈0;deployment〉 for k1, v2 in 〈0;v〉.env2 { 2426 deployment: { 2427 〈3;k〉: { 2428 env: { 2429 〈4;k1〉: 〈4;v2〉 2430 } 2431 } 2432 } 2433 } 2434 for id, v in 〈0;D〉 { 2435 deployment: { 2436 〈2;id〉: { 2437 env2: { 2438 ENV: "True" 2439 } 2440 } 2441 } 2442 } 2443 } 2444 } 2445 } 2446 siblingInsertion: { 2447 t1: { 2448 p2: { 2449 D: { 2450 logging: _ 2451 } 2452 deployment: _ 2453 for id, v in 〈0;D〉 { 2454 deployment: { 2455 〈2;id〉: { 2456 env2: { 2457 ENV: "True" 2458 } 2459 } 2460 } 2461 } 2462 for k, v in 〈0;deployment〉 for k1, v2 in 〈0;v〉.env2 { 2463 deployment: { 2464 〈3;k〉: { 2465 env: { 2466 〈4;k1〉: 〈4;v2〉 2467 } 2468 } 2469 } 2470 } 2471 } 2472 } 2473 } 2474 siblingInsertion: { 2475 t2: { 2476 p1: { 2477 D: { 2478 logging: _ 2479 } 2480 deployment: _ 2481 for k, v in 〈0;deployment〉 { 2482 for k1, v2 in 〈1;v〉.env2 { 2483 deployment: { 2484 〈4;k〉: { 2485 env: { 2486 〈4;k1〉: 〈4;v2〉 2487 } 2488 } 2489 } 2490 } 2491 } 2492 for id, v in 〈0;D〉 { 2493 deployment: { 2494 〈2;id〉: { 2495 env2: { 2496 ENV: "True" 2497 } 2498 } 2499 } 2500 } 2501 } 2502 } 2503 } 2504 siblingInsertion: { 2505 t2: { 2506 p2: { 2507 D: { 2508 logging: _ 2509 } 2510 deployment: _ 2511 for k, v in 〈0;deployment〉 { 2512 for k1, v2 in 〈1;v〉.env2 { 2513 deployment: { 2514 〈4;k〉: { 2515 env: { 2516 〈4;k1〉: 〈4;v2〉 2517 } 2518 } 2519 } 2520 } 2521 } 2522 for id, v in 〈0;D〉 { 2523 deployment: { 2524 〈2;id〉: { 2525 env2: { 2526 ENV: "True" 2527 } 2528 } 2529 } 2530 } 2531 } 2532 } 2533 } 2534 selfReferential: { 2535 fail: { 2536 a: {} 2537 b: (〈0;a〉.x != "") 2538 if 〈0;b〉 {} 2539 } 2540 } 2541 issue2367: { 2542 a: _ 2543 for _, x in [ 2544 〈1;a〉, 2545 ] { 2546 a: 〈1;x〉 2547 } 2548 } 2549 issue2310: { 2550 original: { 2551 #s: { 2552 #_1: string 2553 #_2: string 2554 #_3: string 2555 〈import;strings〉.Replace(〈0;#_1〉, 〈0;#_2〉, 〈0;#_3〉, -1) 2556 } 2557 #sub: { 2558 #a: string 2559 _#X: [ 2560 〈1;#a〉, 2561 for _, i in 〈import;list〉.Range(0, len(〈2;#subs〉), 1) { 2562 (〈4;#subs〉[〈1;i〉] & { 2563 #_1: 〈4;_#X〉[〈2;i〉] 2564 _ 2565 }) 2566 }, 2567 ] 2568 〈0;_#X〉[(len(〈0;_#X〉) - 1)] 2569 } 2570 res: (〈0;#sub〉 & { 2571 #a: "aaa" 2572 _ 2573 }) 2574 #subs: [ 2575 (〈1;#s〉 & { 2576 #_2: "a" 2577 #_3: "b" 2578 _ 2579 }), 2580 (〈1;#s〉 & { 2581 #_2: "c" 2582 #_3: "d" 2583 _ 2584 }), 2585 (〈1;#s〉 & { 2586 #_2: "e" 2587 #_3: "f" 2588 _ 2589 }), 2590 ] 2591 } 2592 } 2593 issue2310: { 2594 reduced: { 2595 res: { 2596 〈0;#X〉[3] 2597 #X: [ 2598 "X", 2599 for i, _ in 〈2;#subs〉 { 2600 〈4;#s〉 2601 #str: 〈3;#X〉[〈1;i〉] 2602 }, 2603 ] 2604 } 2605 #s: { 2606 #str: string 2607 (〈0;#str〉 + "a") 2608 } 2609 #subs: [ 2610 0, 2611 1, 2612 2, 2613 ] 2614 } 2615 } 2616 } 2617 --- issue3903.cue 2618 { 2619 issue3903: { 2620 reduced: { 2621 s1: 〈0;#Schema〉 2622 s1: { 2623 _deps: [ 2624 〈2;#Schema〉, 2625 ] 2626 } 2627 #Schema: { 2628 _deps: [ 2629 ..., 2630 ] 2631 objs: [ 2632 for _, dep in 〈1;_deps〉 for _, obj in (〈0;dep〉 & {}).objs { 2633 〈1;obj〉 2634 }, 2635 ] 2636 } 2637 } 2638 } 2639 issue3903: { 2640 full: { 2641 s1: (〈0;#Schema〉 & { 2642 _deps: [ 2643 〈2;s2〉, 2644 ] 2645 _local: [ 2646 "s1 local", 2647 ] 2648 }) 2649 s2: (〈0;#Schema〉 & { 2650 _local: [ 2651 "s2 local", 2652 ] 2653 }) 2654 #Schema: { 2655 _local: [ 2656 ...string, 2657 ] 2658 _deps: [ 2659 ..., 2660 ] 2661 objs: [ 2662 for _, obj in 〈1;_local〉 { 2663 〈1;obj〉 2664 }, 2665 for _, dep in 〈1;_deps〉 for _, obj in (〈0;dep〉 & {}).objs { 2666 〈1;obj〉 2667 }, 2668 ] 2669 } 2670 } 2671 } 2672 } 2673 --- issue3941.cue 2674 { 2675 issue3941: { 2676 full: { 2677 #Metadata: { 2678 name: string 2679 } 2680 #Resource: { 2681 metadata: 〈1;#Metadata〉 2682 } 2683 out: { 2684 _metadata: { 2685 name: "foo" 2686 } 2687 resource: { 2688 [string]: { 2689 [string]: 〈3;#Resource〉 2690 } 2691 } 2692 _names: [ 2693 〈1;_metadata〉.name, 2694 ] 2695 for _, name in 〈0;_names〉 { 2696 resource: { 2697 level1: { 2698 〈3;name〉: { 2699 metadata: 〈5;_metadata〉 2700 } 2701 } 2702 } 2703 } 2704 } 2705 } 2706 } 2707 }