this repo has no description
0
fork

Configure Feed

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

internal/core/adt: always mark let in comprehension as "complete"

Issue 2481 exposed that evaluation of let fields in
comprehensions may leave then as "ArcPending". The post-processing
code will then remove these arcs, causing the evaluation to fail.

We now always mark them as "Member". This may lead to let fields
that are erroneous, but that is fine as they are not considered
for the validity of a result, and having multiple let fields
(multi-mode) is already allowed anyway.

Fixes #2481

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

+84 -28
+8 -9
cue/testdata/comprehensions/issue2481.txtar
··· 75 75 Freed: 23 76 76 Reused: 17 77 77 Allocs: 9 78 - Retain: 57 78 + Retain: 58 79 79 80 80 Unifications: 26 81 - Conjuncts: 48 82 - Disjuncts: 55 81 + Conjuncts: 50 82 + Disjuncts: 56 83 83 -- out/eval -- 84 84 Errors: 85 85 out: cannot combine regular field "val" with "b": ··· 93 93 // ./in.cue:33:2 94 94 val: (string){ "b" } 95 95 } 96 - multiLets: (_|_){ 97 - // [cycle] multiLets: circular dependency in evaluation of conditionals: val changed after evaluation: 98 - // ./in.cue:23:7 96 + multiLets: (string){ 97 + "b" 98 + let val#1multi = 〈2;k〉 99 99 } 100 100 keys: (#list){ 101 101 0: (string){ "a" } ··· 106 106 c: (string){ "foo" } 107 107 } 108 108 full: (struct){ 109 - out: (_|_){ 110 - // [cycle] full.out: circular dependency in evaluation of conditionals: (val & string) changed after evaluation: 111 - // ./in.cue:54:25 109 + out: (struct){ 110 + let val#2multi = 〈4;values〉[〈2;k〉] 112 111 role: (string){ "member" } 113 112 } 114 113 #github_team_membership: (#struct){
+72 -18
cue/testdata/cycle/chain.txtar
··· 427 427 #func: (#struct){ 428 428 #in: (_){ _ } 429 429 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 430 - out: (int){ 1 } 430 + out: (int){ 431 + 1 432 + let depths#1 = (_){ _ } 433 + } 431 434 } 432 435 } 433 436 #Depth: (#struct){ ··· 437 440 #func: (#struct){ 438 441 #in: (_){ _ } 439 442 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 440 - out: (int){ 1 } 443 + out: (int){ 444 + 1 445 + let depths#1 = (_){ _ } 446 + } 441 447 } 442 448 } 443 449 #funcs: (#struct){ ··· 445 451 "0": (#struct){ 446 452 #in: (_){ _ } 447 453 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 448 - out: (int){ 1 } 454 + out: (int){ 455 + 1 456 + let depths#1 = (_){ _ } 457 + } 449 458 } 450 459 "1": (#struct){ 451 460 #in: (_){ _ } 452 461 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 453 - out: (int){ 1 } 462 + out: (int){ 463 + 1 464 + let depths#1 = (_){ _ } 465 + } 454 466 } 455 467 "2": (#struct){ 456 468 #in: (_){ _ } 457 469 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 458 - out: (int){ 1 } 470 + out: (int){ 471 + 1 472 + let depths#1 = (_){ _ } 473 + } 459 474 } 460 475 "3": (#struct){ 461 476 #in: (_){ _ } 462 477 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 463 - out: (int){ 1 } 478 + out: (int){ 479 + 1 480 + let depths#1 = (_){ _ } 481 + } 464 482 } 465 483 "4": (#struct){ 466 484 #in: (_){ _ } 467 485 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 468 - out: (int){ 1 } 486 + out: (int){ 487 + 1 488 + let depths#1 = (_){ _ } 489 + } 469 490 } 470 491 "5": (#struct){ 471 492 #in: (_){ _ } 472 493 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 473 - out: (int){ 1 } 494 + out: (int){ 495 + 1 496 + let depths#1 = (_){ _ } 497 + } 474 498 } 475 499 "6": (#struct){ 476 500 #in: (_){ _ } 477 501 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 478 - out: (int){ 1 } 502 + out: (int){ 503 + 1 504 + let depths#1 = (_){ _ } 505 + } 479 506 } 480 507 "7": (#struct){ 481 508 #in: (_){ _ } 482 509 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 483 - out: (int){ 1 } 510 + out: (int){ 511 + 1 512 + let depths#1 = (_){ _ } 513 + } 484 514 } 485 515 "8": (#struct){ 486 516 #in: (_){ _ } 487 517 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 488 - out: (int){ 1 } 518 + out: (int){ 519 + 1 520 + let depths#1 = (_){ _ } 521 + } 489 522 } 490 523 "9": (#struct){ 491 524 #in: (_){ _ } 492 525 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 493 - out: (int){ 1 } 526 + out: (int){ 527 + 1 528 + let depths#1 = (_){ _ } 529 + } 494 530 } 495 531 "10": (#struct){ 496 532 #in: (_){ _ } 497 533 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 498 - out: (int){ 1 } 534 + out: (int){ 535 + 1 536 + let depths#1 = (_){ _ } 537 + } 499 538 } 500 539 } 501 540 #in: (_){ _ } 502 541 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 503 - out: (int){ 1 } 542 + out: (int){ 543 + 1 544 + let depths#1 = (_){ _ } 545 + } 504 546 } 505 547 tree: (struct){ 506 548 a: (struct){ ··· 522 564 #func: (#struct){ 523 565 #in: (_){ _ } 524 566 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 525 - out: (int){ 1 } 567 + out: (int){ 568 + 1 569 + let depths#1 = (_){ _ } 570 + } 526 571 } 527 572 } 528 573 #funcs: (#struct){ ··· 531 576 "1": (#struct){ 532 577 #in: (_){ _ } 533 578 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 534 - out: (int){ 1 } 579 + out: (int){ 580 + 1 581 + let depths#1 = (_){ _ } 582 + } 535 583 } 536 584 "2": (#struct){ 537 585 #in: (_){ _ } 538 586 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 539 - out: (int){ 1 } 587 + out: (int){ 588 + 1 589 + let depths#1 = (_){ _ } 590 + } 540 591 } 541 592 "3": (#struct){ 542 593 #in: (_){ _ } 543 594 #basic: ((null|string|bytes|number)){ |((int){ int }, (number){ number }, (string){ string }, (bytes){ bytes }, (null){ null }) } 544 - out: (int){ 1 } 595 + out: (int){ 596 + 1 597 + let depths#1 = (_){ _ } 598 + } 545 599 } 546 600 } 547 601 #in: (#struct){
+2
cue/testdata/cycle/issue990.txtar
··· 232 232 } 233 233 dict: (#struct){ 234 234 } 235 + let subs#1 = (_){ _ } 235 236 } 236 237 _test: (struct){ 237 238 c1: (#struct){ ··· 502 503 } 503 504 } 504 505 } 506 + let subs#1 = (_){ _ } 505 507 } 506 508 } 507 509 }
+2 -1
internal/core/adt/comprehension.go
··· 203 203 } 204 204 205 205 conjunct := MakeConjunct(env, c, ci) 206 - n.node.state.insertFieldUnchecked(f.Label, ArcPending, conjunct) 206 + n.node.state.insertFieldUnchecked(f.Label, ArcMember, conjunct) 207 + 207 208 fields = append(fields, f) 208 209 209 210 default: