Fence a record once per node, refuse a column reading its own record, and keep a bare reference independent as an operand
Tests / vet + fmt + tests (pull_request) Successful in 1m3s

This commit is contained in:
2026-09-04 09:32:29 +02:00
parent 78572ccbbc
commit 79827a66d6
6 changed files with 100 additions and 33 deletions
+3 -3
View File
@@ -274,10 +274,10 @@ func readField(s *session, t *template, held, refScope *draws, a arm) string {
}
return render(s, t.fields[a.key], refScope)
}
// A reference reads the caller's scope, so its draw outlives this expansion; a
// sibling stays local to it.
// A reference that reads a path reads the caller's scope, so its draw outlives
// this expansion; a sibling, and a reference read whole, stay local to it.
d := held
if isRef(a.key) && refScope != nil {
if isRef(a.key) && refScope != nil && len(a.tail) > 0 {
d = refScope
}
if v, read := d.value[a.path]; read {