Skip to content

Commit

Permalink
internal/core/adt: fix counter issue
Browse files Browse the repository at this point in the history
Use -- instead of ++. This did not cause any
issues as the disjunct counter is only used to
silence certain counter mismatches. So this
bug had the effect of missing failed
decremented counters. This is why the number
of counter errors significantly increases with
this change.

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I34da95f17ecf898b42e08ac59e4295459855ff41
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207441
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
mpvl committed Jan 20, 2025
1 parent c880efb commit 0efb5e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions internal/core/adt/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,28 @@ var needFix = map[string]string{
// counter errors.
// TODO: These counters should all go to zero.
var skipDebugDepErrors = map[string]int{
"benchmarks/disjunctelim": 1,
"benchmarks/issue1684": 16,
"builtins/default": 1,
"compile/scope": 1,
"comprehensions/pushdown": 2,
"cycle/comprehension": 2,
"cycle/builtins": 2,
"cycle/comprehension": 3,
"cycle/disjunction": 4,
"cycle/evaluate": 1,
"cycle/issue990": 1,
"cycle/structural": 17,
"disjunctions/edge": 1,
"disjunctions/errors": 3,
"disjunctions/elimination": 15,
"disjunctions/embed": 6,
"disjunctions/elimination": 19,
"disjunctions/embed": 12,
"disjunctions/nested": 1,
"eval/conjuncts": 3,
"eval/disjunctions": 3,
"eval/notify": 17,
"fulleval/054_issue312": 1,
"eval/issue545": 1,
"eval/notify": 22,
"export/030": 2,
"fulleval/054_issue312": 2,
"scalars/embed": 2,
}

Expand Down
2 changes: 1 addition & 1 deletion internal/core/adt/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ func (c *closeContext) decDisjunct(ctx *OpContext, kind depKind) {
// TODO: the counters are only used in debug mode and we could skip this
// if debug is disabled.
for ; c != nil; c = c.parent {
c.disjunctCount++
c.disjunctCount--
}
}

Expand Down

0 comments on commit 0efb5e8

Please sign in to comment.