Skip to content

Commit 392b187

Browse files
committed
docs: Disallow decimal literals with trailing dots
Currently the documentation suggests that a decimal literal can omit the fractional part [1]: > Decimal fractional literals are formed by a `.` with at least one > number on one side. Examples include `1.`, `.1` and `1.3`. However, commit ac68710 (May 30, 2018) disallowed trailing dots that are not followed by a number [2]. Using decimal literals of the form `1.` will actually result in a `ParserError` and so the docs should no longer recommend this form. [1] https://docs.soliditylang.org/en/v0.8.15/types.html#rational-and-integer-literals [2] ac68710
1 parent 02fdcb3 commit 392b187

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/types/value-types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ Integer literals are formed from a sequence of digits in the range 0-9.
448448
They are interpreted as decimals. For example, ``69`` means sixty nine.
449449
Octal literals do not exist in Solidity and leading zeros are invalid.
450450

451-
Decimal fractional literals are formed by a ``.`` with at least one number on
452-
one side. Examples include ``1.``, ``.1`` and ``1.3``.
451+
Decimal fractional literals are formed by a ``.`` with at least one number after the decimal point.
452+
Examples include ``.1`` and ``1.3`` (but not ``1.``).
453453

454454
Scientific notation in the form of ``2e10`` is also supported, where the
455455
mantissa can be fractional but the exponent has to be an integer.

0 commit comments

Comments
 (0)