this repo has no description
0
fork

Configure Feed

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

internal/core/adt: decrement DEFER dependencies in overlay

DEFER dependencies are matched in code, and not through
some data structure. We therefore eliminate DEFER
dependencies as we copy the graph for a disjunction.

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

+12 -4
+7
internal/core/adt/dep.go
··· 254 254 v := c.src 255 255 256 256 c.matchDecrement(ctx, v, kind, dependant) 257 + c.decDependentNoMatch(ctx, kind, dependant) 258 + } 257 259 260 + // decDependentNoMatch is like decDependent, but does not check for a matching 261 + // increment. This is useful when a decrement is triggered during creating 262 + // a disjunct overlay, as it obviates the need to create the matching debug 263 + // dependency. 264 + func (c *closeContext) decDependentNoMatch(ctx *OpContext, kind depKind, dependant *closeContext) { 258 265 if c.conjunctCount == 0 { 259 266 panic(fmt.Sprintf("negative reference counter %d %p", c.conjunctCount, c)) 260 267 }
-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 - "cycle/builtins": 2, 80 - "cycle/comprehension": 1, 81 79 "cycle/disjunction": 4, 82 - "cycle/issue990": 1, 83 80 "cycle/structural": 7, 84 81 "disjunctions/errors": 3, 85 82 "disjunctions/elimination": 19, ··· 87 84 "eval/disjunctions": 3, 88 85 "eval/issue545": 1, 89 86 "eval/notify": 3, 90 - "export/030": 2, 91 87 "scalars/embed": 2, 92 88 } 93 89
+5
internal/core/adt/overlay.go
··· 465 465 continue 466 466 } 467 467 468 + if d.kind == DEFER { 469 + o.decDependentNoMatch(ctx.ctx, DEFER, nil) 470 + continue 471 + } 472 + 468 473 if d.dependency.overlay == nil { 469 474 // This dependency is irrelevant for the current overlay. We can 470 475 // eliminate it as long as we decrement the accompanying counter.