From a651ed4b47153f7c8f0ff9958843b364fc8a6651 Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Wed, 8 May 2024 12:52:14 +0200 Subject: [PATCH] internal/core/adt: eliminate non-rooted indirections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: Iba414b9d1db6479274fe5b80574ae9704e4b0f6f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194446 TryBot-Result: CUEcueckoo Unity-Result: CUE porcuepine Reviewed-by: Daniel Martí --- internal/core/adt/context.go | 6 +++--- internal/core/dep/dep.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/core/adt/context.go b/internal/core/adt/context.go index 5b0c00b539d..9e42ba94022 100644 --- a/internal/core/adt/context.go +++ b/internal/core/adt/context.go @@ -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 } diff --git a/internal/core/dep/dep.go b/internal/core/dep/dep.go index ca939ac776f..ebdc8ca0b2a 100644 --- a/internal/core/dep/dep.go +++ b/internal/core/dep/dep.go @@ -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,