this repo has no description
0
fork

Configure Feed

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

internal/core/adt: break notification dependency on structural cycle

This case is specifically is not handled if structure
sharing is off, or when a let is involved.

Consider, for instance, this case:

a: next: X
let X = a

Here, `a` is substituted for `X`, after which a
structural cycle is detected. At this point,
any notification resulting from X should be
cancelled. Basically, cycle detection followed
a different path, where this was not done.

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

+12 -8
+4
internal/core/adt/conjunct.go
··· 554 554 555 555 cc := c.cc 556 556 557 + // TODO: it should not be necessary to register for notifications for 558 + // let expressions, so we could also filter for !n.node.Label.IsLet(). 559 + // However, somehow this appears to result in slightly better error 560 + // messages. 557 561 if root.addNotifyDependency(n.ctx, cc) { 558 562 // TODO: this is mostly identical to the slice in the root closeContext. 559 563 // Use only one once V2 is removed.
+1 -4
internal/core/adt/eval_test.go
··· 76 76 // counter errors. 77 77 // TODO: These counters should all go to zero. 78 78 var skipDebugDepErrors = map[string]int{ 79 - "compile/scope": 1, 80 - "comprehensions/pushdown": 2, 81 79 "cycle/builtins": 2, 82 80 "cycle/comprehension": 1, 83 81 "cycle/disjunction": 4, 84 - "cycle/evaluate": 1, 85 82 "cycle/issue990": 1, 86 - "cycle/structural": 9, 83 + "cycle/structural": 7, 87 84 "disjunctions/errors": 3, 88 85 "disjunctions/elimination": 19, 89 86 "disjunctions/nested": 1,
+7 -4
internal/core/adt/unify.go
··· 285 285 case needs&subFieldsProcessed != 0: 286 286 switch { 287 287 case assertStructuralCycleV3(n): 288 + n.breakIncomingDeps() 288 289 // TODO: consider bailing on error if n.errs != nil. 289 290 case n.completeAllArcs(needs, mode): 290 291 } ··· 462 463 }() 463 464 } 464 465 465 - if p := v.Parent; p != nil && p.state != nil { 466 - if !v.IsDynamic && n.completed&allAncestorsProcessed == 0 { 467 - p.state.completeNodeTasks(mode) 466 + if !v.Label.IsLet() { 467 + if p := v.Parent; p != nil && p.state != nil { 468 + if !v.IsDynamic && n.completed&allAncestorsProcessed == 0 { 469 + p.state.completeNodeTasks(mode) 470 + } 468 471 } 469 472 } 470 473 471 - if v.IsDynamic || v.Parent.allChildConjunctsKnown() { 474 + if v.IsDynamic || v.Label.IsLet() || v.Parent.allChildConjunctsKnown() { 472 475 n.signal(allAncestorsProcessed) 473 476 } 474 477