From 8d03ce34bb6a7f8f3d821765d1c3841461ad2871 Mon Sep 17 00:00:00 2001 From: M Date: Mon, 31 Aug 2026 21:19:17 +0200 Subject: [PATCH] Tests for a reference reaching into a calc operand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit {net.v} is a load error because the operand is also a path head, but {..cat.net.v} names the same node by another spelling and loads — and disagrees in 20 of 40 renders. Same shape, opposite verdicts, which is the thing this rule exists to remove. Co-Authored-By: Claude Opus 5 --- bound_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bound_test.go b/bound_test.go index 6a27ec0..72aa629 100644 --- a/bound_test.go +++ b/bound_test.go @@ -183,6 +183,23 @@ func TestACalcOperandIsHeldAgainstEveryRoute(t *testing.T) { }, `calc operand "b" renders "a"`, }, + // Reaching *into* the operand is the same shape as naming it: the draw the + // calc holds settled that value too. The token spelling {net.v} is already + // rejected, so the reference spelling has to be. + "a reference into the operand": { + map[string]string{ + "cat": `{"format":"{calc(net * 2, 2)}|{..cat.net.v}",` + + `"net":{"format":"{v}","v":["10.00","20.00"]}}`, + }, + `{..cat.net.v} renders "net"`, + }, + "a reference into the operand one level down": { + map[string]string{ + "cat": `{"format":"{calc(net * 2, 2)}|{q}","net":{"format":"{v}","v":["10.00","20.00"]},` + + `"q":{"format":"{..cat.net.v}"}}`, + }, + `{q} renders "net"`, + }, } for name, c := range rejected { _, err := New([]string{writeData(t, c.files)})