From 6cb2d143d67f4d2750eef62f96ffb6377fbc3761 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 29 Sep 2026 13:09:19 +0200 Subject: [PATCH] Refuse own-family reads before any survey, and panic on a clash where readSurvey.edge enters a read's pins --- data.go | 3 +++ drawfence.go | 10 +++++++++- readsurvey.go | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/data.go b/data.go index c3fd37a..6c1b81b 100644 --- a/data.go +++ b/data.go @@ -257,6 +257,9 @@ func checkNodeFences(s nodeScope) error { return err } if refs { + if err := s(checkOwnFamilies); err != nil { + return err + } if err := s(fence.checkDraws); err != nil { return err } diff --git a/drawfence.go b/drawfence.go index 8f46f5d..8caffb7 100644 --- a/drawfence.go +++ b/drawfence.go @@ -24,7 +24,7 @@ func (f *drawFence) checkDrawGroup(path string, n node) error { return nil } -func (f *drawFence) checkDraws(path string, n node) error { +func checkOwnFamilies(path string, n node) error { t, ok := n.(*template) if !ok { return nil @@ -32,6 +32,14 @@ func (f *drawFence) checkDraws(path string, n node) error { if err := checkOwnFamily(t); err != nil { return fmt.Errorf("%s: %w", path, err) } + return nil +} + +func (f *drawFence) checkDraws(path string, n node) error { + t, ok := n.(*template) + if !ok { + return nil + } if !f.readsPath(t) { return nil } diff --git a/readsurvey.go b/readsurvey.go index 531e8c7..e77903c 100644 --- a/readsurvey.go +++ b/readsurvey.go @@ -122,7 +122,12 @@ func (s *readSurvey) edge(from node, e renderEdge, at surveyAt) { s.reads = append(s.reads, pathRead{at, a, tr}) } if tr != nil { - tr.pins.each(func(t *table, r int) { at.pins = at.pins.entered(t, r) }) + tr.pins.each(func(t *table, r int) { + if c := at.pins.clash(t, r); c != nil { + panic(internalError("%s reads %s past a pinned row of %s, which checkOwnFamily refuses", e.reached(), t.selectorSpelling(r), c.path)) + } + at.pins = at.pins.entered(t, r) + }) } } s.walk(e.to, at)