Skip to content

Commit ed235a8

Browse files
committed
internal/core/adt: reduce counter issues
Disjuncts holes and their associated close contexts will only reach a zero conjunctCount after all disjuncts were processed. Intermediate results will not pass the counter test. As individual disjuncts will have been finalized and checked anyway, we can just drop the checking of such nodes. We also do not have to check a node if it is shared. Issue #3635 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I0a769d08fd954538efa5453a9e12cbe62d354b0b Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207170 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Matthew Sackman <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 12437a2 commit ed235a8

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

internal/core/adt/eval_test.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,20 @@ var needFix = map[string]string{
7777
// TODO: These counters should all go to zero.
7878
var skipDebugDepErrors = map[string]int{
7979
"benchmarks/issue1684": 16,
80-
"benchmarks/disjunctelim": 1,
8180
"builtins/default": 1,
8281
"compile/scope": 1,
8382
"comprehensions/pushdown": 2,
8483
"cycle/comprehension": 2,
8584
"cycle/disjunction": 4,
8685
"cycle/evaluate": 1,
87-
"cycle/structural": 18,
88-
"disjunctions/edge": 1,
89-
"disjunctions/errors": 4,
86+
"cycle/structural": 17,
87+
"disjunctions/errors": 3,
9088
"disjunctions/elimination": 15,
91-
"disjunctions/embed": 12,
89+
"disjunctions/embed": 6,
9290
"disjunctions/nested": 1,
93-
"eval/conjuncts": 3,
9491
"eval/disjunctions": 3,
95-
"eval/notify": 18,
96-
"fulleval/054_issue312": 2,
92+
"eval/notify": 17,
93+
"fulleval/054_issue312": 1,
9794
"scalars/embed": 2,
9895
}
9996

internal/core/adt/unify.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,18 @@ func (v *Vertex) unify(c *OpContext, needs condition, mode runMode) bool {
405405
defer n.unmarkOptional(n.markOptional())
406406

407407
if DebugDeps {
408-
RecordDebugGraph(n.ctx, n.node, "Finalize")
408+
switch n.node.BaseValue.(type) {
409+
case *Disjunction:
410+
// If we have a disjunction, its individual disjuncts will
411+
// already have been checked. The node itself will likely have
412+
// spurious results, as it will contain unclosed holes.
413+
414+
case *Vertex:
415+
// No need to check dereferenced results.
416+
417+
default:
418+
RecordDebugGraph(n.ctx, n.node, "Finalize")
419+
}
409420
}
410421
}
411422

0 commit comments

Comments
 (0)