internal/core/adt: fix conjunction semantics for opened embeddings
When a conjunction is opened with `...` (e.g. `(#C1 & #C2)...`
or `#C...` where `#C: #C1 & #C2`), the conjunction operands
should still mutually constrain each other, while allowing
extra fields in the enclosing struct.
Add `ConjunctOpened` flag to `CloseInfo` to track conjunction
operands that are opened. In `hasEvidenceForOne`, use a
pre-scan to determine if a field is "known" to the
conjunction (has conjuncts from within the embedding scope).
If so, reject it when no operand accepts it. If not, the
field is external and should be allowed.
This fixes the case where `__closeAll` wraps an outer struct
containing a nested field with an opened conjunction
embedding.
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ic3f8b271da138017c756ca5e84d727d29b849766
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236311
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>