Skip to content

Commit 96e0ebc

Browse files
mpvlmvdan
authored andcommitted
internal/core/adt: fix Vertex dereferencing for disjunctions
When creating disjuncts, the Vertex values created so far are copied for each disjunct. We must take this into account when copying over Conjuncts as well: their Environments may still point to original nodes, rather than the copied ones, which may lead to incomplete data. We originally replaced Environments only superficially. This mostly worked. However, we forgot to also update the Environment for tasks. A straightforward update, however, seems to fix the outstanding bugs, but introduces some new ones. We now take a more complete approach where every Environment is recursively updated with any new Vertex. Here are a few key properties of the new approach: - We track all Vertex values that are copied and make no assumptions that some of them will never appear in Environment values. - When unifying multiple disjunctions, we carry over the full Vertex map, to be sure we have a complete dereference graph. - We replace the Vertex values only after all Vertex values have been cloned. This prevents us from accidentally missing some replacements. Fixes #3850 Fixes #3875 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I20102183c4ed1e903157909a739d164a8a64ce9b Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1213570 Reviewed-by: Matthew Sackman <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 7cfe774 commit 96e0ebc

File tree

6 files changed

+431
-226
lines changed

6 files changed

+431
-226
lines changed

0 commit comments

Comments
 (0)