From 8f63bb646c412535eb547a5fdb244ebafb9a27e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 13 Apr 2023 17:01:36 +0200 Subject: [PATCH 1/3] docs: Hexadecimal string literals behave like string literals only in some aspects --- docs/types/value-types.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index a370cf70e..652f1686b 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -588,7 +588,8 @@ of the hexadecimal sequence. Multiple hexadecimal literals separated by whitespace are concatenated into a single literal: ``hex"00112233" hex"44556677"`` is equivalent to ``hex"0011223344556677"`` -Hexadecimal literals behave like :ref:`string literals ` and have the same convertibility restrictions. +Hexadecimal literals in some ways behave like :ref:`string literals ` but are not +implicitly convertible to the ``string`` type. .. index:: enum From bc18af91bbfdcf729400faae406c9ec3707b9f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 14 Apr 2023 16:21:43 +0200 Subject: [PATCH 2/3] docs: Fix index entry for receive --- docs/contracts/functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index 902ad1ce5..4794ccdd9 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -277,7 +277,7 @@ This behaviour is also in line with the ``STATICCALL`` opcode. Special Functions ================= -.. index:: ! receive ether function, function;receive ! receive +.. index:: ! receive ether function, function;receive, ! receive .. _receive-ether-function: From cab88290c2e36b0f83cb2c5edd401b9ce2da76d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 13 Apr 2023 17:12:35 +0200 Subject: [PATCH 3/3] docs: Consistent index entries for literals, denominations, free functions --- docs/contracts/functions.rst | 2 +- docs/contracts/using-for.rst | 2 +- docs/control-structures.rst | 1 - docs/types/conversion.rst | 5 +++++ docs/types/reference-types.rst | 2 +- docs/types/value-types.rst | 10 ++++++---- docs/units-and-global-variables.rst | 8 +++++--- docs/yul.rst | 2 ++ 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index 4794ccdd9..ba903dce1 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -1,4 +1,4 @@ -.. index:: ! functions +.. index:: ! functions, ! function;free .. _functions: diff --git a/docs/contracts/using-for.rst b/docs/contracts/using-for.rst index 2321e5c2d..a05cb277c 100644 --- a/docs/contracts/using-for.rst +++ b/docs/contracts/using-for.rst @@ -1,4 +1,4 @@ -.. index:: ! using for, library, ! operator; user-defined +.. index:: ! using for, library, ! operator;user-defined, function;free .. _using-for: diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 510948b55..88fb53a56 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -173,7 +173,6 @@ parameters from the function declaration, but can be in arbitrary order. function set(uint key, uint value) public { data[key] = value; } - } Omitted Names in Function Definitions diff --git a/docs/types/conversion.rst b/docs/types/conversion.rst index e6c68df41..02b1f2cb9 100644 --- a/docs/types/conversion.rst +++ b/docs/types/conversion.rst @@ -130,6 +130,7 @@ If the array is shorter than the target type, it will be padded with zeros at th } } +.. index:: ! literal;conversion, literal;rational, literal;hexadecimal number .. _types-conversion-literals: Conversions between Literals and Elementary Types @@ -152,6 +153,8 @@ that is large enough to represent it without truncation: converted to an integer type. From 0.8.0, such explicit conversions are as strict as implicit conversions, i.e., they are only allowed if the literal fits in the resulting range. +.. index:: literal;string, literal;hexadecimal + Fixed-Size Byte Arrays ---------------------- @@ -182,6 +185,8 @@ if their number of characters matches the size of the bytes type: bytes2 e = "x"; // not allowed bytes2 f = "xyz"; // not allowed +.. index:: literal;address + Addresses --------- diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 771fdecee..4ba2a65b1 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -235,7 +235,7 @@ with the :ref:`default value`. } } -.. index:: ! array;literals, ! inline;arrays +.. index:: ! literal;array, ! inline;arrays Array Literals ^^^^^^^^^^^^^^ diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 652f1686b..60a11d6c3 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -423,7 +423,7 @@ Dynamically-sized byte array ``string``: Dynamically-sized UTF-8-encoded string, see :ref:`arrays`. Not a value-type! -.. index:: address, literal;address +.. index:: address, ! literal;address .. _address_literals: @@ -439,7 +439,7 @@ an error. You can prepend (for integer types) or append (for bytesNN types) zero .. note:: The mixed-case address checksum format is defined in `EIP-55 `_. -.. index:: literal, literal;rational +.. index:: integer, rational number, ! literal;rational .. _rational_literals: @@ -517,7 +517,7 @@ regardless of the type of the right (exponent) operand. uint128 a = 1; uint128 b = 2.5 + a + 0.5; -.. index:: literal, literal;string, string +.. index:: ! literal;string, string .. _string_literals: String Literals and Types @@ -564,6 +564,8 @@ character sequence ``abcdef``. Any Unicode line terminator which is not a newline (i.e. LF, VF, FF, CR, NEL, LS, PS) is considered to terminate the string literal. Newline only terminates the string literal if it is not preceded by a ``\``. +.. index:: ! literal;unicode + Unicode Literals ---------------- @@ -574,7 +576,7 @@ They also support the very same escape sequences as regular string literals. string memory a = unicode"Hello 😃"; -.. index:: literal, bytes +.. index:: ! literal;hexadecimal, bytes Hexadecimal Literals -------------------- diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 80162a3b4..0da80822a 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -1,8 +1,10 @@ +.. index:: ! denomination + ************************************** Units and Globally Available Variables ************************************** -.. index:: wei, finney, szabo, gwei, ether +.. index:: ! wei, ! finney, ! szabo, ! gwei, ! ether, ! denomination;ether Ether Units =========== @@ -21,7 +23,7 @@ The only effect of the subdenomination suffix is a multiplication by a power of .. note:: The denominations ``finney`` and ``szabo`` have been removed in version 0.7.0. -.. index:: time, seconds, minutes, hours, days, weeks, years +.. index:: ! seconds, ! minutes, ! hours, ! days, ! weeks, ! years, ! denomination;time Time Units ========== @@ -52,7 +54,7 @@ interpret a function parameter in days, you can in the following way: function f(uint start, uint daysAfter) public { if (block.timestamp >= start + daysAfter * 1 days) { - // ... + // ... } } diff --git a/docs/yul.rst b/docs/yul.rst index 502ee6f52..2cea0260b 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -166,6 +166,8 @@ Inside a code block, the following elements can be used Multiple syntactical elements can follow each other simply separated by whitespace, i.e. there is no terminating ``;`` or newline required. +.. index:: ! literal;in Yul + Literals --------