Skip to content

Commit 22043f2

Browse files
authored
toml: fix float checker bug for -0.01 (#12590)
1 parent d52b62a commit 22043f2

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

vlib/toml/checker/checker.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ fn (c Checker) check_number(num ast.Number) ? {
118118
return error(@MOD + '.' + @STRUCT + '.' + @FN +
119119
' numbers like "$lit" (hex, octal and binary) can not start with `$ascii` in ...${c.excerpt(num.pos)}...')
120120
}
121-
// is_first_digit = byte(lit_sans_sign[0]).is_digit()
122-
if lit.len > 1 && lit_sans_sign.starts_with('0') {
121+
if lit.len > 1 && lit_sans_sign.starts_with('0') && !lit_sans_sign.starts_with('0.') {
123122
ascii = byte(lit_sans_sign[0]).ascii_str()
124123
return error(@MOD + '.' + @STRUCT + '.' + @FN +
125124
' numbers like "$lit" can not start with `$ascii` in ...${c.excerpt(num.pos)}...')

vlib/toml/tests/iarna.toml-spec-tests_test.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const (
1515

1616
// Kept for easier handling of future updates to the tests
1717
valid_exceptions = [
18-
'values/spec-float-3.toml',
1918
'values/spec-float-10.toml',
2019
'values/spec-float-11.toml',
2120
'values/spec-float-12.toml',

0 commit comments

Comments
 (0)