this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: add tests for 3967

Issue #3967

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I67807947ff65936f92bab9b54d5385d6b1392f33
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217085
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+963
+963
cue/testdata/eval/disjunctioncross.txtar
··· 1 + -- in.cue -- 2 + #OneOrTwo: #One | #Two 3 + #One: { 4 + kind: "one" 5 + one: oneField: "value" 6 + } 7 + #Two: { 8 + kind: "two" 9 + two: optional?: string 10 + } 11 + _appDefaults: two: two: optional: *"optional set" | string 12 + 13 + // Use a discriminator field to disambiguation additional per-disjunct 14 + // information. 15 + valueDiscriminator: crossing: { 16 + out: #Application & { oneOrTwo: kind: "two" } 17 + #Application: { 18 + oneOrTwo: #OneOrTwo 19 + // oneOrTwo.kind resolves will resolve to "two" regardless of whether 20 + // it resolves to the original oneOrTwo or the disjunct that is being 21 + // processed. 22 + oneOrTwo: *_appDefaults[oneOrTwo.kind] | _ 23 + } 24 + } 25 + 26 + valueDiscriminator: local: { 27 + out: #Application & { oneOrTwo: kind: "two" } 28 + #Application: { 29 + oneOrTwo: #OneOrTwo 30 + // oneOrTwo.kind always resolves to the value of the disjunct. 31 + // Alternative writing for future features based on various proposals: 32 + // oneOrTwo~X: *_appDefaults[X.kind] | _ 33 + // oneOrTwo: *_appDefaults[self.kind] | _ 34 + // try { oneOrTwo: _appDefaults.(self.kind)? } 35 + oneOrTwo: X={ *_appDefaults[X.kind] | _ } 36 + } 37 + } 38 + 39 + // Use a value that is available AFTER a disjunction is resolved to augment 40 + // values. We may not want to support this in perpetuity, as this relies on 41 + // closedness to discrimnate the disjuncts. But for now, as there is no 42 + // alternative to discriminating based on fields, we will support it. 43 + fieldDiscriminator: crossing:{ 44 + out: #Application & { oneOrTwo: two: {} } 45 + #Application: { 46 + oneOrTwo: #OneOrTwo 47 + // The value of oneOrTwo.kind depends on whether oneOrTwo resolves 48 + // to the disjunct currently being processed, the original before 49 + // a disjunct has been selected, or a disjunct after it has been 50 + // selected. 51 + oneOrTwo: *_appDefaults[oneOrTwo.kind] | _ 52 + } 53 + } 54 + 55 + fieldDiscriminator: local:{ 56 + out: #Application & { oneOrTwo: two: {} } 57 + #Application: { 58 + oneOrTwo: #OneOrTwo 59 + // oneOrTwo.kind always resolves to the value of the disjunct. 60 + oneOrTwo: X={ *_appDefaults[X.kind] | _ } 61 + } 62 + } 63 + 64 + // Do not hide error messages. Here, the inner failure of both disjuncts means 65 + // that an enclosing field cannot be resolved as it needs to look up a value 66 + // inside the disjunction. The failure to do this lookup is not the underlying 67 + // cause, though: the inner failure is. For this reason, we should report all 68 + // errors. 69 + issue3967: error: nested: { 70 + out: #Application & { 71 + oneOrTwo: two: {} 72 + } 73 + #Application: X={ 74 + oneOrTwo: #OneOrTwo & { 75 + if X.oneOrTwo.kind == "two" { 76 + two: { 77 + if X.oneOrTwo.two.optional == _|_ { 78 + optional: "optional set" 79 + } 80 + } 81 + } 82 + } 83 + if X.oneOrTwo.kind == "never" { 84 + } 85 + } 86 + } 87 + issue3967: error: local: { 88 + out: #Application & { 89 + oneOrTwo: two: {} 90 + } 91 + #Application: { 92 + oneOrTwo: X= { #OneOrTwo & { 93 + if X.kind == "two" { 94 + two: { 95 + if X.two.optional == _|_ { 96 + optional: "optional set" 97 + } 98 + } 99 + } 100 + if X.kind == "never" { 101 + } 102 + }} 103 + } 104 + } 105 + -- out/evalalpha/stats -- 106 + Leaks: 282 107 + Freed: 0 108 + Reused: 0 109 + Allocs: 282 110 + Retain: 0 111 + 112 + Unifications: 162 113 + Conjuncts: 364 114 + Disjuncts: 68 115 + 116 + CloseIDElems: 1555 117 + NumCloseIDs: 88 118 + -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 119 + diff old new 120 + --- old 121 + +++ new 122 + @@ -1,12 +1,12 @@ 123 + -Leaks: 16 124 + -Freed: 292 125 + -Reused: 281 126 + -Allocs: 27 127 + -Retain: 28 128 + - 129 + -Unifications: 220 130 + -Conjuncts: 388 131 + -Disjuncts: 299 132 + - 133 + -CloseIDElems: 0 134 + -NumCloseIDs: 8 135 + +Leaks: 282 136 + +Freed: 0 137 + +Reused: 0 138 + +Allocs: 282 139 + +Retain: 0 140 + + 141 + +Unifications: 162 142 + +Conjuncts: 364 143 + +Disjuncts: 68 144 + + 145 + +CloseIDElems: 1555 146 + +NumCloseIDs: 88 147 + -- out/eval/stats -- 148 + Leaks: 16 149 + Freed: 292 150 + Reused: 281 151 + Allocs: 27 152 + Retain: 28 153 + 154 + Unifications: 220 155 + Conjuncts: 388 156 + Disjuncts: 299 157 + 158 + CloseIDElems: 0 159 + NumCloseIDs: 8 160 + -- out/evalalpha -- 161 + (struct){ 162 + #OneOrTwo: (#struct){ |((#struct){ 163 + kind: (string){ "one" } 164 + one: (#struct){ 165 + oneField: (string){ "value" } 166 + } 167 + }, (#struct){ 168 + kind: (string){ "two" } 169 + two: (#struct){ 170 + optional?: (string){ string } 171 + } 172 + }) } 173 + #One: (#struct){ 174 + kind: (string){ "one" } 175 + one: (#struct){ 176 + oneField: (string){ "value" } 177 + } 178 + } 179 + #Two: (#struct){ 180 + kind: (string){ "two" } 181 + two: (#struct){ 182 + optional?: (string){ string } 183 + } 184 + } 185 + _appDefaults: (struct){ 186 + two: (struct){ 187 + two: (struct){ 188 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 189 + } 190 + } 191 + } 192 + valueDiscriminator: (struct){ 193 + crossing: (struct){ 194 + out: (#struct){ 195 + oneOrTwo: (#struct){ |(*(#struct){ 196 + kind: (string){ "two" } 197 + two: (#struct){ 198 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 199 + } 200 + }, (#struct){ 201 + kind: (string){ "two" } 202 + two: (#struct){ 203 + optional?: (string){ string } 204 + } 205 + }) } 206 + } 207 + #Application: (#struct){ 208 + oneOrTwo: (#struct){ |(*(#struct){ 209 + kind: (string){ "one" } 210 + one: (#struct){ 211 + oneField: (string){ "value" } 212 + } 213 + }, *(#struct){ 214 + kind: (string){ "two" } 215 + two: (#struct){ 216 + optional?: (string){ string } 217 + } 218 + }) } 219 + } 220 + } 221 + local: (struct){ 222 + out: (#struct){ 223 + oneOrTwo: (#struct){ |(*(#struct){ 224 + kind: (string){ "two" } 225 + two: (#struct){ 226 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 227 + } 228 + }, (#struct){ 229 + kind: (string){ "two" } 230 + two: (#struct){ 231 + optional?: (string){ string } 232 + } 233 + }) } 234 + } 235 + #Application: (#struct){ 236 + oneOrTwo: (#struct){ |(*(#struct){ 237 + kind: (string){ "one" } 238 + one: (#struct){ 239 + oneField: (string){ "value" } 240 + } 241 + }, *(#struct){ 242 + kind: (string){ "two" } 243 + two: (#struct){ 244 + optional?: (string){ string } 245 + } 246 + }) } 247 + } 248 + } 249 + } 250 + fieldDiscriminator: (struct){ 251 + crossing: (struct){ 252 + out: (#struct){ 253 + oneOrTwo: (#struct){ 254 + two: (#struct){ 255 + optional?: (string){ string } 256 + } 257 + kind: (string){ "two" } 258 + } 259 + } 260 + #Application: (#struct){ 261 + oneOrTwo: (#struct){ |(*(#struct){ 262 + kind: (string){ "one" } 263 + one: (#struct){ 264 + oneField: (string){ "value" } 265 + } 266 + }, *(#struct){ 267 + kind: (string){ "two" } 268 + two: (#struct){ 269 + optional?: (string){ string } 270 + } 271 + }) } 272 + } 273 + } 274 + local: (struct){ 275 + out: (#struct){ 276 + oneOrTwo: (#struct){ 277 + two: (#struct){ 278 + optional?: (string){ string } 279 + } 280 + kind: (string){ "two" } 281 + } 282 + } 283 + #Application: (#struct){ 284 + oneOrTwo: (#struct){ |(*(#struct){ 285 + kind: (string){ "one" } 286 + one: (#struct){ 287 + oneField: (string){ "value" } 288 + } 289 + }, *(#struct){ 290 + kind: (string){ "two" } 291 + two: (#struct){ 292 + optional?: (string){ string } 293 + } 294 + }) } 295 + } 296 + } 297 + } 298 + issue3967: (struct){ 299 + error: (struct){ 300 + nested: (struct){ 301 + out: (_|_){ 302 + // [incomplete] issue3967.error.nested.out: undefined field: kind: 303 + // ./in.cue:82:17 304 + oneOrTwo: (_|_){ 305 + // [cycle] issue3967.error.nested.out.oneOrTwo.two: circular dependency in evaluation of conditionals: X.oneOrTwo.two.optional changed after evaluation: 306 + // ./in.cue:76:9 307 + // issue3967.error.nested.out.oneOrTwo: 2 errors in empty disjunction:: 308 + // ./in.cue:82:6 309 + // issue3967.error.nested.out.oneOrTwo.two: field not allowed: 310 + // ./in.cue:82:6 311 + // ./in.cue:70:13 312 + // ./in.cue:75:5 313 + } 314 + } 315 + #Application: (#struct){ 316 + oneOrTwo: (#struct){ 317 + kind: (string){ "one" } 318 + one: (#struct){ 319 + oneField: (string){ "value" } 320 + } 321 + } 322 + } 323 + } 324 + local: (struct){ 325 + out: (#struct){ 326 + oneOrTwo: (_|_){ 327 + // [cycle] issue3967.error.local.out.oneOrTwo.two: circular dependency in evaluation of conditionals: X.two.optional changed after evaluation: 328 + // ./in.cue:94:9 329 + // issue3967.error.local.out.oneOrTwo: 2 errors in empty disjunction:: 330 + // ./in.cue:99:7 331 + // issue3967.error.local.out.oneOrTwo.two: field not allowed: 332 + // ./in.cue:99:7 333 + // ./in.cue:88:13 334 + // ./in.cue:93:5 335 + } 336 + } 337 + #Application: (#struct){ 338 + oneOrTwo: (#struct){ 339 + kind: (string){ "one" } 340 + one: (#struct){ 341 + oneField: (string){ "value" } 342 + } 343 + } 344 + } 345 + } 346 + } 347 + } 348 + } 349 + -- diff/-out/evalalpha<==>+out/eval -- 350 + diff old new 351 + --- old 352 + +++ new 353 + @@ -46,49 +46,39 @@ 354 + } 355 + #Application: (#struct){ 356 + oneOrTwo: (#struct){ |(*(#struct){ 357 + - kind: (string){ "two" } 358 + - two: (#struct){ 359 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 360 + - } 361 + - }, (#struct){ 362 + - kind: (string){ "one" } 363 + - one: (#struct){ 364 + - oneField: (string){ "value" } 365 + - } 366 + - }, (#struct){ 367 + - kind: (string){ "two" } 368 + - two: (#struct){ 369 + - optional?: (string){ string } 370 + - } 371 + - }) } 372 + - } 373 + - } 374 + - local: (struct){ 375 + - out: (#struct){ 376 + - oneOrTwo: (#struct){ |(*(#struct){ 377 + - kind: (string){ "two" } 378 + - two: (#struct){ 379 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 380 + - } 381 + - }, (#struct){ 382 + - kind: (string){ "two" } 383 + - two: (#struct){ 384 + - optional?: (string){ string } 385 + - } 386 + - }) } 387 + - } 388 + - #Application: (#struct){ 389 + - oneOrTwo: (#struct){ |(*(#struct){ 390 + - kind: (string){ "two" } 391 + - two: (#struct){ 392 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 393 + - } 394 + - }, (#struct){ 395 + - kind: (string){ "one" } 396 + - one: (#struct){ 397 + - oneField: (string){ "value" } 398 + - } 399 + - }, (#struct){ 400 + + kind: (string){ "one" } 401 + + one: (#struct){ 402 + + oneField: (string){ "value" } 403 + + } 404 + + }, *(#struct){ 405 + + kind: (string){ "two" } 406 + + two: (#struct){ 407 + + optional?: (string){ string } 408 + + } 409 + + }) } 410 + + } 411 + + } 412 + + local: (struct){ 413 + + out: (#struct){ 414 + + oneOrTwo: (#struct){ |(*(#struct){ 415 + + kind: (string){ "two" } 416 + + two: (#struct){ 417 + + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 418 + + } 419 + + }, (#struct){ 420 + + kind: (string){ "two" } 421 + + two: (#struct){ 422 + + optional?: (string){ string } 423 + + } 424 + + }) } 425 + + } 426 + + #Application: (#struct){ 427 + + oneOrTwo: (#struct){ |(*(#struct){ 428 + + kind: (string){ "one" } 429 + + one: (#struct){ 430 + + oneField: (string){ "value" } 431 + + } 432 + + }, *(#struct){ 433 + kind: (string){ "two" } 434 + two: (#struct){ 435 + optional?: (string){ string } 436 + @@ -100,63 +90,43 @@ 437 + fieldDiscriminator: (struct){ 438 + crossing: (struct){ 439 + out: (#struct){ 440 + - oneOrTwo: (#struct){ |(*(#struct){ 441 + - two: (#struct){ 442 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 443 + - } 444 + - kind: (string){ "two" } 445 + - }, (#struct){ 446 + - two: (#struct){ 447 + - optional?: (string){ string } 448 + - } 449 + - kind: (string){ "two" } 450 + - }) } 451 + - } 452 + - #Application: (#struct){ 453 + - oneOrTwo: (#struct){ |(*(#struct){ 454 + - kind: (string){ "two" } 455 + - two: (#struct){ 456 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 457 + - } 458 + - }, (#struct){ 459 + - kind: (string){ "one" } 460 + - one: (#struct){ 461 + - oneField: (string){ "value" } 462 + - } 463 + - }, (#struct){ 464 + - kind: (string){ "two" } 465 + - two: (#struct){ 466 + - optional?: (string){ string } 467 + - } 468 + - }) } 469 + - } 470 + - } 471 + - local: (struct){ 472 + - out: (#struct){ 473 + - oneOrTwo: (#struct){ |(*(#struct){ 474 + - two: (#struct){ 475 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 476 + - } 477 + - kind: (string){ "two" } 478 + - }, (#struct){ 479 + - two: (#struct){ 480 + - optional?: (string){ string } 481 + - } 482 + - kind: (string){ "two" } 483 + - }) } 484 + - } 485 + - #Application: (#struct){ 486 + - oneOrTwo: (#struct){ |(*(#struct){ 487 + - kind: (string){ "two" } 488 + - two: (#struct){ 489 + - optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 490 + - } 491 + - }, (#struct){ 492 + - kind: (string){ "one" } 493 + - one: (#struct){ 494 + - oneField: (string){ "value" } 495 + - } 496 + - }, (#struct){ 497 + + oneOrTwo: (#struct){ 498 + + two: (#struct){ 499 + + optional?: (string){ string } 500 + + } 501 + + kind: (string){ "two" } 502 + + } 503 + + } 504 + + #Application: (#struct){ 505 + + oneOrTwo: (#struct){ |(*(#struct){ 506 + + kind: (string){ "one" } 507 + + one: (#struct){ 508 + + oneField: (string){ "value" } 509 + + } 510 + + }, *(#struct){ 511 + + kind: (string){ "two" } 512 + + two: (#struct){ 513 + + optional?: (string){ string } 514 + + } 515 + + }) } 516 + + } 517 + + } 518 + + local: (struct){ 519 + + out: (#struct){ 520 + + oneOrTwo: (#struct){ 521 + + two: (#struct){ 522 + + optional?: (string){ string } 523 + + } 524 + + kind: (string){ "two" } 525 + + } 526 + + } 527 + + #Application: (#struct){ 528 + + oneOrTwo: (#struct){ |(*(#struct){ 529 + + kind: (string){ "one" } 530 + + one: (#struct){ 531 + + oneField: (string){ "value" } 532 + + } 533 + + }, *(#struct){ 534 + kind: (string){ "two" } 535 + two: (#struct){ 536 + optional?: (string){ string } 537 + @@ -168,45 +138,48 @@ 538 + issue3967: (struct){ 539 + error: (struct){ 540 + nested: (struct){ 541 + - out: (#struct){ 542 + - oneOrTwo: (#struct){ 543 + - two: (#struct){ 544 + - optional?: (string){ string } 545 + - } 546 + - kind: (string){ "two" } 547 + - } 548 + - } 549 + - #Application: (_|_){ 550 + - // [incomplete] issue3967.error.nested.#Application: unresolved disjunction {kind:"one",one:{oneField:"value"}} | {two:{optional?:string},kind:"two"} (type struct): 551 + - // ./in.cue:82:6 552 + - oneOrTwo: (#struct){ |((#struct){ 553 + - kind: (string){ "one" } 554 + - one: (#struct){ 555 + - oneField: (string){ "value" } 556 + - } 557 + - }, (#struct){ 558 + - two: (#struct){ 559 + - optional?: (string){ string } 560 + - } 561 + - kind: (string){ "two" } 562 + - }) } 563 + + out: (_|_){ 564 + + // [incomplete] issue3967.error.nested.out: undefined field: kind: 565 + + // ./in.cue:82:17 566 + + oneOrTwo: (_|_){ 567 + + // [cycle] issue3967.error.nested.out.oneOrTwo.two: circular dependency in evaluation of conditionals: X.oneOrTwo.two.optional changed after evaluation: 568 + + // ./in.cue:76:9 569 + + // issue3967.error.nested.out.oneOrTwo: 2 errors in empty disjunction:: 570 + + // ./in.cue:82:6 571 + + // issue3967.error.nested.out.oneOrTwo.two: field not allowed: 572 + + // ./in.cue:82:6 573 + + // ./in.cue:70:13 574 + + // ./in.cue:75:5 575 + + } 576 + + } 577 + + #Application: (#struct){ 578 + + oneOrTwo: (#struct){ 579 + + kind: (string){ "one" } 580 + + one: (#struct){ 581 + + oneField: (string){ "value" } 582 + + } 583 + + } 584 + } 585 + } 586 + local: (struct){ 587 + out: (#struct){ 588 + oneOrTwo: (_|_){ 589 + - // [incomplete] issue3967.error.local.out.oneOrTwo: cycle error referencing kind: 590 + - // ./in.cue:99:9 591 + - two: (#struct){ 592 + - optional?: (string){ string } 593 + - } 594 + - kind: (string){ "two" } 595 + - } 596 + - } 597 + - #Application: (#struct){ 598 + - oneOrTwo: (_|_){ 599 + - // [incomplete] issue3967.error.local.#Application.oneOrTwo: cycle error referencing kind: 600 + - // ./in.cue:99:9 601 + + // [cycle] issue3967.error.local.out.oneOrTwo.two: circular dependency in evaluation of conditionals: X.two.optional changed after evaluation: 602 + + // ./in.cue:94:9 603 + + // issue3967.error.local.out.oneOrTwo: 2 errors in empty disjunction:: 604 + + // ./in.cue:99:7 605 + + // issue3967.error.local.out.oneOrTwo.two: field not allowed: 606 + + // ./in.cue:99:7 607 + + // ./in.cue:88:13 608 + + // ./in.cue:93:5 609 + + } 610 + + } 611 + + #Application: (#struct){ 612 + + oneOrTwo: (#struct){ 613 + + kind: (string){ "one" } 614 + + one: (#struct){ 615 + + oneField: (string){ "value" } 616 + + } 617 + } 618 + } 619 + } 620 + -- out/eval -- 621 + (struct){ 622 + #OneOrTwo: (#struct){ |((#struct){ 623 + kind: (string){ "one" } 624 + one: (#struct){ 625 + oneField: (string){ "value" } 626 + } 627 + }, (#struct){ 628 + kind: (string){ "two" } 629 + two: (#struct){ 630 + optional?: (string){ string } 631 + } 632 + }) } 633 + #One: (#struct){ 634 + kind: (string){ "one" } 635 + one: (#struct){ 636 + oneField: (string){ "value" } 637 + } 638 + } 639 + #Two: (#struct){ 640 + kind: (string){ "two" } 641 + two: (#struct){ 642 + optional?: (string){ string } 643 + } 644 + } 645 + _appDefaults: (struct){ 646 + two: (struct){ 647 + two: (struct){ 648 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 649 + } 650 + } 651 + } 652 + valueDiscriminator: (struct){ 653 + crossing: (struct){ 654 + out: (#struct){ 655 + oneOrTwo: (#struct){ |(*(#struct){ 656 + kind: (string){ "two" } 657 + two: (#struct){ 658 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 659 + } 660 + }, (#struct){ 661 + kind: (string){ "two" } 662 + two: (#struct){ 663 + optional?: (string){ string } 664 + } 665 + }) } 666 + } 667 + #Application: (#struct){ 668 + oneOrTwo: (#struct){ |(*(#struct){ 669 + kind: (string){ "two" } 670 + two: (#struct){ 671 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 672 + } 673 + }, (#struct){ 674 + kind: (string){ "one" } 675 + one: (#struct){ 676 + oneField: (string){ "value" } 677 + } 678 + }, (#struct){ 679 + kind: (string){ "two" } 680 + two: (#struct){ 681 + optional?: (string){ string } 682 + } 683 + }) } 684 + } 685 + } 686 + local: (struct){ 687 + out: (#struct){ 688 + oneOrTwo: (#struct){ |(*(#struct){ 689 + kind: (string){ "two" } 690 + two: (#struct){ 691 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 692 + } 693 + }, (#struct){ 694 + kind: (string){ "two" } 695 + two: (#struct){ 696 + optional?: (string){ string } 697 + } 698 + }) } 699 + } 700 + #Application: (#struct){ 701 + oneOrTwo: (#struct){ |(*(#struct){ 702 + kind: (string){ "two" } 703 + two: (#struct){ 704 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 705 + } 706 + }, (#struct){ 707 + kind: (string){ "one" } 708 + one: (#struct){ 709 + oneField: (string){ "value" } 710 + } 711 + }, (#struct){ 712 + kind: (string){ "two" } 713 + two: (#struct){ 714 + optional?: (string){ string } 715 + } 716 + }) } 717 + } 718 + } 719 + } 720 + fieldDiscriminator: (struct){ 721 + crossing: (struct){ 722 + out: (#struct){ 723 + oneOrTwo: (#struct){ |(*(#struct){ 724 + two: (#struct){ 725 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 726 + } 727 + kind: (string){ "two" } 728 + }, (#struct){ 729 + two: (#struct){ 730 + optional?: (string){ string } 731 + } 732 + kind: (string){ "two" } 733 + }) } 734 + } 735 + #Application: (#struct){ 736 + oneOrTwo: (#struct){ |(*(#struct){ 737 + kind: (string){ "two" } 738 + two: (#struct){ 739 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 740 + } 741 + }, (#struct){ 742 + kind: (string){ "one" } 743 + one: (#struct){ 744 + oneField: (string){ "value" } 745 + } 746 + }, (#struct){ 747 + kind: (string){ "two" } 748 + two: (#struct){ 749 + optional?: (string){ string } 750 + } 751 + }) } 752 + } 753 + } 754 + local: (struct){ 755 + out: (#struct){ 756 + oneOrTwo: (#struct){ |(*(#struct){ 757 + two: (#struct){ 758 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 759 + } 760 + kind: (string){ "two" } 761 + }, (#struct){ 762 + two: (#struct){ 763 + optional?: (string){ string } 764 + } 765 + kind: (string){ "two" } 766 + }) } 767 + } 768 + #Application: (#struct){ 769 + oneOrTwo: (#struct){ |(*(#struct){ 770 + kind: (string){ "two" } 771 + two: (#struct){ 772 + optional: (string){ |(*(string){ "optional set" }, (string){ string }) } 773 + } 774 + }, (#struct){ 775 + kind: (string){ "one" } 776 + one: (#struct){ 777 + oneField: (string){ "value" } 778 + } 779 + }, (#struct){ 780 + kind: (string){ "two" } 781 + two: (#struct){ 782 + optional?: (string){ string } 783 + } 784 + }) } 785 + } 786 + } 787 + } 788 + issue3967: (struct){ 789 + error: (struct){ 790 + nested: (struct){ 791 + out: (#struct){ 792 + oneOrTwo: (#struct){ 793 + two: (#struct){ 794 + optional?: (string){ string } 795 + } 796 + kind: (string){ "two" } 797 + } 798 + } 799 + #Application: (_|_){ 800 + // [incomplete] issue3967.error.nested.#Application: unresolved disjunction {kind:"one",one:{oneField:"value"}} | {two:{optional?:string},kind:"two"} (type struct): 801 + // ./in.cue:82:6 802 + oneOrTwo: (#struct){ |((#struct){ 803 + kind: (string){ "one" } 804 + one: (#struct){ 805 + oneField: (string){ "value" } 806 + } 807 + }, (#struct){ 808 + two: (#struct){ 809 + optional?: (string){ string } 810 + } 811 + kind: (string){ "two" } 812 + }) } 813 + } 814 + } 815 + local: (struct){ 816 + out: (#struct){ 817 + oneOrTwo: (_|_){ 818 + // [incomplete] issue3967.error.local.out.oneOrTwo: cycle error referencing kind: 819 + // ./in.cue:99:9 820 + two: (#struct){ 821 + optional?: (string){ string } 822 + } 823 + kind: (string){ "two" } 824 + } 825 + } 826 + #Application: (#struct){ 827 + oneOrTwo: (_|_){ 828 + // [incomplete] issue3967.error.local.#Application.oneOrTwo: cycle error referencing kind: 829 + // ./in.cue:99:9 830 + } 831 + } 832 + } 833 + } 834 + } 835 + } 836 + -- out/compile -- 837 + --- in.cue 838 + { 839 + #OneOrTwo: (〈0;#One〉|〈0;#Two〉) 840 + #One: { 841 + kind: "one" 842 + one: { 843 + oneField: "value" 844 + } 845 + } 846 + #Two: { 847 + kind: "two" 848 + two: { 849 + optional?: string 850 + } 851 + } 852 + _appDefaults: { 853 + two: { 854 + two: { 855 + optional: (*"optional set"|string) 856 + } 857 + } 858 + } 859 + valueDiscriminator: { 860 + crossing: { 861 + out: (〈0;#Application〉 & { 862 + oneOrTwo: { 863 + kind: "two" 864 + } 865 + }) 866 + #Application: { 867 + oneOrTwo: 〈3;#OneOrTwo〉 868 + oneOrTwo: (*〈3;_appDefaults〉[〈0;oneOrTwo〉.kind]|_) 869 + } 870 + } 871 + } 872 + valueDiscriminator: { 873 + local: { 874 + out: (〈0;#Application〉 & { 875 + oneOrTwo: { 876 + kind: "two" 877 + } 878 + }) 879 + #Application: { 880 + oneOrTwo: 〈3;#OneOrTwo〉 881 + oneOrTwo: { 882 + (*〈4;_appDefaults〉[〈1〉.kind]|_) 883 + } 884 + } 885 + } 886 + } 887 + fieldDiscriminator: { 888 + crossing: { 889 + out: (〈0;#Application〉 & { 890 + oneOrTwo: { 891 + two: {} 892 + } 893 + }) 894 + #Application: { 895 + oneOrTwo: 〈3;#OneOrTwo〉 896 + oneOrTwo: (*〈3;_appDefaults〉[〈0;oneOrTwo〉.kind]|_) 897 + } 898 + } 899 + } 900 + fieldDiscriminator: { 901 + local: { 902 + out: (〈0;#Application〉 & { 903 + oneOrTwo: { 904 + two: {} 905 + } 906 + }) 907 + #Application: { 908 + oneOrTwo: 〈3;#OneOrTwo〉 909 + oneOrTwo: { 910 + (*〈4;_appDefaults〉[〈1〉.kind]|_) 911 + } 912 + } 913 + } 914 + } 915 + issue3967: { 916 + error: { 917 + nested: { 918 + out: (〈0;#Application〉 & { 919 + oneOrTwo: { 920 + two: {} 921 + } 922 + }) 923 + #Application: { 924 + oneOrTwo: (〈4;#OneOrTwo〉 & { 925 + if (〈2〉.oneOrTwo.kind == "two") { 926 + two: { 927 + if (〈4〉.oneOrTwo.two.optional == _|_(explicit error (_|_ literal) in source)) { 928 + optional: "optional set" 929 + } 930 + } 931 + } 932 + }) 933 + if (〈1〉.oneOrTwo.kind == "never") {} 934 + } 935 + } 936 + } 937 + } 938 + issue3967: { 939 + error: { 940 + local: { 941 + out: (〈0;#Application〉 & { 942 + oneOrTwo: { 943 + two: {} 944 + } 945 + }) 946 + #Application: { 947 + oneOrTwo: { 948 + (〈5;#OneOrTwo〉 & { 949 + if (〈2〉.kind == "two") { 950 + two: { 951 + if (〈4〉.two.optional == _|_(explicit error (_|_ literal) in source)) { 952 + optional: "optional set" 953 + } 954 + } 955 + } 956 + if (〈2〉.kind == "never") {} 957 + }) 958 + } 959 + } 960 + } 961 + } 962 + } 963 + }