From 57f48631071f4cc2ace9cc4a4e2a1df5503df86b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 30 Sep 2026 20:51:35 +0200 Subject: [PATCH] Switch disagreement on the fixed item's kind, and rename its proven local to fits --- datatype.go | 26 ++++++++++++++++---------- todo.md | 3 --- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/datatype.go b/datatype.go index 1cc5251..432a7e9 100644 --- a/datatype.go +++ b/datatype.go @@ -174,19 +174,25 @@ func disagreement(a *template, da DataType, b *template, db DataType) error { fix, other, want = b, a, da } held := fmt.Sprintf("its items hold %s and %s; a column holds one datatype", da, db) - proven := (&valueProof{}).proveColumnItem(fix).not[want] == "" - switch { - case kindOf(fix) == kindDeclares: + fits := (&valueProof{}).proveColumnItem(fix).not[want] == "" + switch kindOf(fix) { + case kindDeclares: return errors.New(held) - case kindOf(fix) == kindReads && proven: - return fmt.Errorf("%s, so %s", held, typedAs(fix, want)) - case kindOf(fix) == kindReads: + case kindReads: + if fits { + return fmt.Errorf("%s, so %s", held, typedAs(fix, want)) + } return fmt.Errorf("%s, so to read %q as text, %s", held, fix.format, asText(fix)) - case kindOf(other) == kindText: + } + switch kindOf(other) { + case kindText: panic(internalError("two text items hold one datatype, so they never disagree")) - case kindOf(other) == kindReads && !proven: - return fmt.Errorf(`item %q is not %s, the datatype item %q takes from the column it reads; to read that column as text, %s`, fix.format, dataTypeNouns[want], other.format, asText(other)) - case fix.fromString: // an object may carry a weight, which this spelling would drop + case kindReads: + if !fits { + return fmt.Errorf(`item %q is not %s, the datatype item %q takes from the column it reads; to read that column as text, %s`, fix.format, dataTypeNouns[want], other.format, asText(other)) + } + } + if fix.fromString { // an object may carry a weight, which this spelling would drop return fmt.Errorf(`item %q declares no datatype, and a column holds one; write it as {"format":%q,"datatype":%q}`, fix.format, fix.format, want) } return fmt.Errorf(`item %q declares no datatype beside one holding %s; a column holds one, so give it "datatype": %q`, fix.format, want, want) diff --git a/todo.md b/todo.md index 9273f7a..29a3956 100644 --- a/todo.md +++ b/todo.md @@ -40,9 +40,6 @@ maintainer chose on 2026-09-30 to go on with the path steps regardless. This round, in order: -- Switch `disagreement` on the fixed item's kind, with the other item inside each arm, - and rename its `proven` local, which shadows the `proven` type: seven seats read the - seven-arm switch as a truth table without the table. - Say at `checkNodeFences` that its walks recurse unguarded, so a caller runs `checkNoCycles` first: five seats reconstructed the order, and the inline binding runs no cycle check.