Skip to content

Commit

Permalink
internal/core/adt: eliminate non-rooted indirections
Browse files Browse the repository at this point in the history
Resolve now always derefences Vertex values that
do not contribute valuable information. This is also
the right granularity needed for the old evaluator, so
we make the change for both, simplifying the code.

We also remove the indirection in dep, which is now
no longer needed.

We could have merged this CL with the change in dep,
but we keep it as a separate CL so that if this change
causes issues, it can be safely rolled back without
compromising the fix in dep.

Issue #3060

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: Iba414b9d1db6479274fe5b80574ae9704e4b0f6f
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194446
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
mpvl committed May 8, 2024
1 parent 68efe82 commit a651ed4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/core/adt/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ func (c *OpContext) resolveState(x Conjunct, r Resolver, state combinedFlags) (*
return nil, arc.ChildErrors
}

if !c.isDevVersion() {
arc = arc.DerefValue()
}
// Dereference any vertices that do not contribute to more knownledge about
// the node.
arc = arc.DerefNonRooted()

return arc, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/core/dep/dep.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (c *visitor) reportDependency(env *adt.Environment, ref adt.Resolver, v *ad
c.numRefs++

d := Dependency{
Node: v.DerefNonRooted(),
Node: v,
Reference: altRef,
pkg: c.pkg,
top: c.top,
Expand Down

0 comments on commit a651ed4

Please sign in to comment.