this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: strengthen field-set and arc-type checks

CompleteArcsOnly now waits for allKnown &^ subFieldsProcessed
rather than fieldSetKnown, so pending arcs are reliably
detected and reported as undefined fields.

unifyNode now requests arcTypeKnown|fieldSetKnown so that
resolving a selector also confirms the target's field set.

processAncestors: guard against a nil parent state. When
p.state is nil the parent has not entered evaluation yet.
The added fieldSetKnown condition causes handleParents to
reach processAncestors for nodes whose parents were never
unified; without the guard it crashes.
Reproducer: TestScript/cmd_typocheck.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ife4f4e10b2f1a51e9312ce45eee64f2032a35604
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236068
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>

+6 -3
+4 -1
internal/core/adt/composite.go
··· 1022 1022 func (v *Vertex) CompleteArcsOnly(c *OpContext) { 1023 1023 c.unify(v, Flags{ 1024 1024 status: conjuncts, 1025 - condition: fieldSetKnown, 1025 + condition: allKnown &^ subFieldsProcessed, 1026 1026 mode: finalize, 1027 1027 checkTypos: false, 1028 1028 }) 1029 + if v.ArcType == ArcPending { 1030 + c.undefinedFieldError(v, IncompleteError) 1031 + } 1029 1032 } 1030 1033 1031 1034 func (v *Vertex) AddErr(ctx *OpContext, b *Bottom) {
+2 -2
internal/core/adt/context.go
··· 927 927 } 928 928 929 929 // Always yield to not get spurious errors. 930 - n.process(arcTypeKnown, yield) 930 + n.process(arcTypeKnown|fieldSetKnown, yield) 931 931 // It is possible that the node is only midway through 932 932 // evaluating a disjunction. In this case, we want to ensure 933 933 // that disjunctions are finalized, so that disjunction shows 934 934 // up in BaseValue. 935 935 if len(n.disjuncts) > 0 { 936 - n.node.unify(c, Flags{condition: arcTypeKnown, mode: yield, checkTypos: false}) 936 + n.node.unify(c, Flags{condition: arcTypeKnown | fieldSetKnown, mode: yield, checkTypos: false}) 937 937 } 938 938 } 939 939