Disable the type byte

This commit is contained in:
Alex Beregszaszi
2020-12-14 19:18:25 +00:00
parent 271a17d908
commit 15237c8404
8 changed files with 12 additions and 8 deletions
+2
View File
@@ -50,6 +50,8 @@ the compiler notifying you about it.
in all branches of the evaluation tree. Now, if constant variables are used as intermediate expressions,
their values will be properly rounded in the same way as when they are used in run-time expressions.
* The type ``byte`` has been removed. It was an alias of ``bytes1``.
New Restrictions
================
+1 -1
View File
@@ -159,7 +159,7 @@ Local Solidity variables are available for assignments, for example:
.. warning::
If you access variables of a type that spans less than 256 bits
(for example ``uint64``, ``address``, ``bytes16`` or ``byte``),
(for example ``uint64``, ``address``, or ``bytes16``),
you cannot make any assumptions about bits not part of the
encoding of the type. Especially, do not assume them to be zero.
To be safe, always clear the data properly before you use it
+1 -1
View File
@@ -261,7 +261,7 @@ which only need to be created if there is a dispute.
// can be pre-computed. It is just there for illustration.
// You actually only need ``new D{salt: salt}(arg)``.
address predictedAddress = address(uint160(uint(keccak256(abi.encodePacked(
byte(0xff),
bytes1(0xff),
address(this),
salt,
keccak256(abi.encodePacked(
+2 -3
View File
@@ -4,7 +4,7 @@ lexer grammar SolidityLexer;
* Keywords reserved for future use in Solidity.
*/
ReservedKeywords:
'after' | 'alias' | 'apply' | 'auto' | 'case' | 'copyof' | 'default' | 'define' | 'final'
'after' | 'alias' | 'apply' | 'auto' | 'byte' | 'case' | 'copyof' | 'default' | 'define' | 'final'
| 'implements' | 'in' | 'inline' | 'let' | 'macro' | 'match' | 'mutable' | 'null' | 'of'
| 'partial' | 'promise' | 'reference' | 'relocatable' | 'sealed' | 'sizeof' | 'static'
| 'supports' | 'switch' | 'typedef' | 'typeof' | 'var';
@@ -37,10 +37,9 @@ Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
From: 'from';
/**
* Bytes types of fixed length.
* byte is an alias of bytes1.
*/
FixedBytes:
'byte' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' |
'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' |
'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' |
'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' |
'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32';
+1 -1
View File
@@ -391,7 +391,7 @@ Array Members
// Create a dynamic byte array:
bytes memory b = new bytes(200);
for (uint i = 0; i < b.length; i++)
b[i] = byte(uint8(i));
b[i] = bytes1(uint8(i));
return b;
}
}
+3 -1
View File
@@ -369,7 +369,6 @@ Fixed-size byte arrays
The value types ``bytes1``, ``bytes2``, ``bytes3``, ..., ``bytes32``
hold a sequence of bytes from one to up to 32.
``byte`` is an alias for ``bytes1``.
Operators:
@@ -391,6 +390,9 @@ Members:
31 bytes of space for each element (except in storage). It is better to use the ``bytes``
type instead.
.. note::
Prior to version 0.8.0, ``byte`` used to be an alias for ``bytes1``.
Dynamically-sized byte array
----------------------------