Give arm its head as written, and spell readRow's selector from it
This commit is contained in:
@@ -308,6 +308,7 @@ func checkNoRepeatedArm(body string, names []string) error {
|
||||
type arm struct {
|
||||
spelling string // as written, for messages
|
||||
head string
|
||||
writtenHead string // head as written, sigil included
|
||||
tail []string
|
||||
levels []string // the path at each level the tail passes through, the head first
|
||||
path string // head and tail, the one path every way of writing this read shares
|
||||
@@ -325,21 +326,23 @@ func splitArm(name string, refs map[string]refBinding) arm {
|
||||
}
|
||||
return arm{spelling: name, head: head, path: head}
|
||||
}
|
||||
return pathArm(name, b.head, b.tail)
|
||||
sigil, rest, _ := refShape(name) // linkRefs proved it
|
||||
written, _ := splitPath(rest)
|
||||
return pathArm(name, b.head, sigil+joinSegments(written[:len(written)-len(b.tail)]), b.tail)
|
||||
}
|
||||
segs, err := splitPath(name)
|
||||
if err != nil || len(segs) == 1 {
|
||||
return arm{spelling: name, head: name, path: name}
|
||||
}
|
||||
return pathArm(name, segs[0], segs[1:])
|
||||
return pathArm(name, segs[0], segs[0], segs[1:])
|
||||
}
|
||||
|
||||
func pathArm(name, head string, segs []string) arm {
|
||||
func pathArm(name, head, writtenHead string, segs []string) arm {
|
||||
levels := []string{head}
|
||||
for i := 0; i < len(segs)-1; i++ {
|
||||
levels = append(levels, head+"."+strings.Join(segs[:i+1], "."))
|
||||
}
|
||||
return arm{spelling: name, head: head, tail: segs, levels: levels, path: head + "." + strings.Join(segs, ".")}
|
||||
return arm{spelling: name, head: head, writtenHead: writtenHead, tail: segs, levels: levels, path: head + "." + strings.Join(segs, ".")}
|
||||
}
|
||||
|
||||
// checkSegments rejects an unfinished path: "{a.}" and "{a..b}" each have a
|
||||
|
||||
@@ -333,8 +333,7 @@ func (w *pathProbe) readRow(t *table, tail []string, r tableRoute) error {
|
||||
case r.sel != "":
|
||||
if w.a != nil {
|
||||
walked := len(w.a.tail) - len(tail) + 1
|
||||
written := w.a.spelling[:len(w.a.spelling)-len(joinSegments(w.a.tail))]
|
||||
w.sels = append(w.sels, tableSel{t, written + joinSegments(w.a.tail[:walked])})
|
||||
w.sels = append(w.sels, tableSel{t, joinSegments(append([]string{w.a.writtenHead}, w.a.tail[:walked]...))})
|
||||
}
|
||||
return w.pins.selectRow(t, r.sel)
|
||||
case r.draw && w.a != nil:
|
||||
|
||||
@@ -31,9 +31,6 @@ on 2026-09-29 a third time (Navigation 7.0, Locality 5.6, Shape 6.3, Self-suffic
|
||||
|
||||
This round, in order:
|
||||
|
||||
- Give `arm` its head as written, set where `splitArm` splits, and build
|
||||
`pathProbe.readRow`'s selector spelling from it: six seats found the slice of
|
||||
`arm.spelling` by `len(joinSegments(tail))` resting on an invariant nothing states.
|
||||
- Pick `disagreement`'s fix through a named `itemKind` comparison: six seats could not
|
||||
see that the kinds' declaration order is the rule.
|
||||
- Give `tableSite` one test for a cell, and have `traceRead` report no row outside a
|
||||
|
||||
Reference in New Issue
Block a user