lsp/eval: correct resolution of package-level fields
Despite the claim made in issue #4284, I have become convinced the
mistake lies not in comprehensions but in the rules surrounding
package-level fields. This is because in
{d: _} & {e: d}
the d path was resolving to the d field, which is incorrect, and there
are no comprehensions involved.
When resolving the first element of a path, we walk up the frames
looking for a match. If we reach the top (file frame) then we search for
a matching binding from any file in the current package. But we must
make sure that we find a match that is *not* embedded.
Fixes #4284
Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I4416d97e43e18837e3204dae60020eb03a580bcb
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1232329
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>