Precompute each choice's shared paths so a dotted path stays O(1)

This commit is contained in:
Mikael Göransson
2026-08-27 23:45:08 +02:00
committed by lilleman-tw
parent af5b8c9abd
commit 1665b37cad
7 changed files with 57 additions and 41 deletions
+2 -4
View File
@@ -89,10 +89,8 @@ func TestDescendIntoLiteralErrors(t *testing.T) {
}
}
// TestPathThroughChoice pins the rule that makes a dotted path predictable: a
// choice consumes no segment, so a path may step through one only when every
// variant carries the rest of it. Otherwise the same path would render or fail
// depending on which variant the rng picked.
// TestPathThroughChoice pins the rule that keeps a dotted path from rendering on
// one call and failing on the next: every variant must carry the rest of the path.
func TestPathThroughChoice(t *testing.T) {
dir := writeData(t, map[string]string{
"every": `[{"format":"{f}","f":["1"]},{"format":"{f}","f":["2"]}]`,