From d50136223a8e60931de74a1b81e127721524d3aa Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 29 Sep 2026 11:58:44 +0200 Subject: [PATCH] Rank itemKind through a free declaresLess, named in the type's comment --- datatype.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/datatype.go b/datatype.go index f04ce26..07005f0 100644 --- a/datatype.go +++ b/datatype.go @@ -147,8 +147,7 @@ func columnItems(n node) (items []*template, nullable bool) { return items, nullable } -// itemKind is how a column item comes by its datatype: none, read from a typed column, or declared. -// The kinds are declared from the one that declares least. +// itemKind is how a column item comes by its datatype, ranked by declaresLess in this order: none, read from a typed column, or declared. type itemKind int const ( @@ -157,8 +156,8 @@ const ( kindDeclares ) -func (k itemKind) declaresLess(than itemKind) bool { - return k < than +func declaresLess(a, b itemKind) bool { + return a < b } func kindOf(t *template) itemKind { @@ -183,7 +182,7 @@ type itemPair struct { // the one that declares least, a when both declare alike. func disagreement(a *template, da DataType, b *template, db DataType) error { d := itemPair{first: da, second: db, fix: a, other: b, want: db} - if kindOf(b).declaresLess(kindOf(a)) { + if declaresLess(kindOf(b), kindOf(a)) { d.fix, d.other, d.want = b, a, da } proven := (&valueProof{}).proveColumnItem(d.fix).not[d.want] == ""