From 2dbc9b1f9fb0a9018c7f0401e0f89c59d9b41471 Mon Sep 17 00:00:00 2001 From: M Date: Mon, 31 Aug 2026 13:41:46 +0200 Subject: [PATCH] Drop the unreachable reference-prefix checks A name starting with ".." also starts with ".", so loadDir's hidden-entry skip reaches it first and neither isRef branch could ever fire. Removed, and the comment in named now names the skip that actually holds the invariant it depends on. Co-Authored-By: Claude Opus 5 --- data.go | 6 ------ reference.go | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/data.go b/data.go index 457dce2..73ed80c 100644 --- a/data.go +++ b/data.go @@ -61,9 +61,6 @@ func loadDir(dir string) (*group, error) { } full := filepath.Join(dir, e.Name()) if e.IsDir() { - if isRef(e.Name()) { - return nil, fmt.Errorf("%s: folder %q starts with %q, which is reserved for {..path} bindings", full, e.Name(), refPrefix) - } child, err := loadDir(full) if err != nil { return nil, err @@ -81,9 +78,6 @@ func loadDir(dir string) (*group, error) { continue } name := strings.TrimSuffix(e.Name(), ".json") - if isRef(name) { - return nil, fmt.Errorf("%s: category %q starts with %q, which is reserved for {..path} bindings", full, name, refPrefix) - } if err := checkName(name); err != nil { return nil, fmt.Errorf("%s: category %w", full, err) } diff --git a/reference.go b/reference.go index 5bee46c..25d2a3d 100644 --- a/reference.go +++ b/reference.go @@ -170,8 +170,8 @@ func contained(n node) []namedNode { // named skips a bound {..path} key: it is a render edge, not containment, so using // it as a path segment would report a node under a path that does not reach it. Only -// a template's fields hold bindings — loadDir rejects a category or folder carrying -// the prefix — so this one skip serves a group's children too. +// a template's fields hold bindings — loadDir skips a dot-prefixed entry, so a +// group's children never carry the prefix — so this one skip serves both. func named(m map[string]node) []namedNode { out := make([]namedNode, 0, len(m)) for _, name := range sortedNames(m) {