From 8bd42bd51e8b0f927e7d3aadaf2d49570e2693d6 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 16 Dec 2019 18:22:17 +0100 Subject: [PATCH] Docs value types --- docs/types/value-types.rst | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 760f82064..be7ca1d6e 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -154,7 +154,7 @@ Operators: defined in the latter. Generally, in floating point almost the entire space is used to represent the number, while only a small number of bits define where the decimal point is. -.. index:: address, balance, send, call, callcode, delegatecall, staticcall, transfer +.. index:: address, balance, send, call, delegatecall, staticcall, transfer .. _address: @@ -179,8 +179,10 @@ must be explicit via ``payable(
)``. Explicit conversions to and from ``address`` are allowed for integers, integer literals, ``bytes20`` and contract types with the following caveat: The result of a conversion of the form ``address(x)`` -has the type ``address payable``, if ``x`` is of integer or fixed bytes type, a literal or a contract with a payable fallback function. -If ``x`` is a contract without payable fallback function, then ``address(x)`` will be of type ``address``. +has the type ``address payable``, if ``x`` is of integer or fixed bytes type, +a literal or a contract with a receive or payable fallback function. +If ``x`` is a contract without a receive or payable fallback function, +then ``address(x)`` will be of type ``address``. In external function signatures ``address`` is used for both the ``address`` and the ``address payable`` type. Only expressions of type ``address`` can be converted to type ``address payable`` via ``payable(
)``. @@ -207,7 +209,7 @@ Operators: .. note:: The distinction between ``address`` and ``address payable`` was introduced with version 0.5.0. Also starting from that version, contracts do not derive from the address type, but can still be explicitly converted to - ``address`` or to ``address payable``, if they have a payable fallback function. + ``address`` or to ``address payable``, if they have a receive or payable fallback function. .. _members-of-addresses: @@ -313,8 +315,8 @@ You can implicitly convert contracts to contracts they inherit from. Contracts can be explicitly converted to and from the ``address`` type. Explicit conversion to and from the ``address payable`` type is only possible -if the contract type has a payable fallback function. The conversion is still -performed using ``address(x)``. If the contract type does not have a payable +if the contract type has a receive or payable fallback function. The conversion is still +performed using ``address(x)``. If the contract type does not have a receive or payable fallback function, the conversion to ``address payable`` can be done using ``payable(address(x))``. You can find more information in the section about @@ -410,7 +412,7 @@ Octal literals do not exist in Solidity and leading zeros are invalid. Decimal fraction literals are formed by a ``.`` with at least one number on one side. Examples include ``1.``, ``.1`` and ``1.3``. -Scientific notation is also supported, where the base can have fractions, while the exponent cannot. +Scientific notation is also supported, where the base can have fractions and the exponent cannot. Examples include ``2e10``, ``-2e10``, ``2e-10``, ``2.5e1``. Underscores can be used to separate the digits of a numeric literal to aid readability. @@ -557,6 +559,10 @@ subsequent unsigned integer values starting from ``0``. } } +.. note:: + Enums can also be declared on the file level, outside of contract or library definitions. + + .. index:: ! function type, ! type; function .. _function_types: