lsp/eval: fix field-value aliases
a: l={b: _, c: l.b}
d: a.b
`a.b` should resolve to the `b` field declaration within the inner
struct. That was not working because having resolved the `a`, the
navigable reached did not contain any bindings.
Find-references / usages of the `b` field within the inner struct must
be able to traverse past its name-less parent navigable in order to
ensure its parent navigable and frames are evaluated, which ensures the
usedBy field is correctly populated.
A number of different solutions are possible. The one chosen is to make
a frame-only binding for the alias ident `l` to an empty frame, who's
navigable then resolves back to the field's navigable. The alias's expr
is then added to the unprocessed worklist in the normal way. This seems
the most elegant: essentially the alias ident itself is the only thing
treated specially; its expr is just a normal expr within the field. No
changes to usages() and no weird and complex mutual resolvesTo setup is
needed.
Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I9dc2a0b45b1e919de986c49ddc39c6bde179f74c
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1231154
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>