Load each spelling that only restated a shorter one, as that shorter form

This commit is contained in:
2026-10-07 22:32:18 +02:00
committed by Lillem4n
parent 91b65e3ded
commit e63efe327f
19 changed files with 101 additions and 366 deletions
-14
View File
@@ -192,19 +192,5 @@ func Literal(text string) Facts {
if text != "true" && text != "false" {
v.Not[datatype.Boolean] = fmt.Sprintf("%q is not a boolean", text)
}
return signedZero(text, v)
}
// signedZero refuses a zero written with a sign as a typed value, naming it unsigned.
func signedZero(text string, v Facts) Facts {
mantissa, _, _ := strings.Cut(strings.ToLower(text), "e")
if !strings.HasPrefix(text, "-") || v.NotOperand != "" || strings.Trim(mantissa, "-0.") != "" {
return v
}
for _, d := range []datatype.DataType{datatype.Integer, datatype.Number} {
if v.Not[d] == "" {
v.Not[d] = fmt.Sprintf("%q is zero written with a sign; write %q", text, text[1:])
}
}
return v
}