cue/ast/astutil: fix false positive in label expression check for let clauses
The label expression check in pattern constraints walks up through
scopes to detect circular references. For field values, the inField
flag acts as a barrier to stop the walk. But for let clause values,
inField was never set, so the walk could escape beyond the let
clause's value into outer scopes and falsely flag identifiers there.
Set inField when walking let clause expressions, mirroring the
behavior for field values.
Fixes #4202
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I65152772657feaa36bac7aad269947d40367399a
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1231219
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>