toml: fix float checker bug for `-0.01` (#12590)

pull/12592/head
Larpon 2021-11-27 20:03:26 +01:00 committed by GitHub
parent d52b62a4f4
commit 22043f2df1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View File

@ -118,8 +118,7 @@ fn (c Checker) check_number(num ast.Number) ? {
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' numbers like "$lit" (hex, octal and binary) can not start with `$ascii` in ...${c.excerpt(num.pos)}...')
}
// is_first_digit = byte(lit_sans_sign[0]).is_digit()
if lit.len > 1 && lit_sans_sign.starts_with('0') {
if lit.len > 1 && lit_sans_sign.starts_with('0') && !lit_sans_sign.starts_with('0.') {
ascii = byte(lit_sans_sign[0]).ascii_str()
return error(@MOD + '.' + @STRUCT + '.' + @FN +
' numbers like "$lit" can not start with `$ascii` in ...${c.excerpt(num.pos)}...')

View File

@ -15,7 +15,6 @@ const (
// Kept for easier handling of future updates to the tests
valid_exceptions = [
'values/spec-float-3.toml',
'values/spec-float-10.toml',
'values/spec-float-11.toml',
'values/spec-float-12.toml',