mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disable the type byte
This commit is contained in:
parent
271a17d908
commit
15237c8404
@ -15,6 +15,7 @@ Breaking Changes:
|
|||||||
* Standard JSON: Remove the ``legacyAST`` option.
|
* Standard JSON: Remove the ``legacyAST`` option.
|
||||||
* Type Checker: Function call options can only be given once.
|
* Type Checker: Function call options can only be given once.
|
||||||
* Type System: Declarations with the name ``this``, ``super`` and ``_`` are disallowed, with the exception of public functions and events.
|
* Type System: Declarations with the name ``this``, ``super`` and ``_`` are disallowed, with the exception of public functions and events.
|
||||||
|
* Type System: Disallow the ``byte`` type. It was an alias to ``bytes1``.
|
||||||
* Type System: Disallow ``msg.data`` in ``receive()`` function.
|
* Type System: Disallow ``msg.data`` in ``receive()`` function.
|
||||||
* Type System: Disallow ``type(super)``.
|
* Type System: Disallow ``type(super)``.
|
||||||
* Type System: Disallow enums with more than 256 members.
|
* Type System: Disallow enums with more than 256 members.
|
||||||
|
@ -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,
|
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.
|
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
|
New Restrictions
|
||||||
================
|
================
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ Local Solidity variables are available for assignments, for example:
|
|||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
If you access variables of a type that spans less than 256 bits
|
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
|
you cannot make any assumptions about bits not part of the
|
||||||
encoding of the type. Especially, do not assume them to be zero.
|
encoding of the type. Especially, do not assume them to be zero.
|
||||||
To be safe, always clear the data properly before you use it
|
To be safe, always clear the data properly before you use it
|
||||||
|
@ -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.
|
// can be pre-computed. It is just there for illustration.
|
||||||
// You actually only need ``new D{salt: salt}(arg)``.
|
// You actually only need ``new D{salt: salt}(arg)``.
|
||||||
address predictedAddress = address(uint160(uint(keccak256(abi.encodePacked(
|
address predictedAddress = address(uint160(uint(keccak256(abi.encodePacked(
|
||||||
byte(0xff),
|
bytes1(0xff),
|
||||||
address(this),
|
address(this),
|
||||||
salt,
|
salt,
|
||||||
keccak256(abi.encodePacked(
|
keccak256(abi.encodePacked(
|
||||||
|
@ -4,7 +4,7 @@ lexer grammar SolidityLexer;
|
|||||||
* Keywords reserved for future use in Solidity.
|
* Keywords reserved for future use in Solidity.
|
||||||
*/
|
*/
|
||||||
ReservedKeywords:
|
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'
|
| 'implements' | 'in' | 'inline' | 'let' | 'macro' | 'match' | 'mutable' | 'null' | 'of'
|
||||||
| 'partial' | 'promise' | 'reference' | 'relocatable' | 'sealed' | 'sizeof' | 'static'
|
| 'partial' | 'promise' | 'reference' | 'relocatable' | 'sealed' | 'sizeof' | 'static'
|
||||||
| 'supports' | 'switch' | 'typedef' | 'typeof' | 'var';
|
| 'supports' | 'switch' | 'typedef' | 'typeof' | 'var';
|
||||||
@ -37,10 +37,9 @@ Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
|
|||||||
From: 'from';
|
From: 'from';
|
||||||
/**
|
/**
|
||||||
* Bytes types of fixed length.
|
* Bytes types of fixed length.
|
||||||
* byte is an alias of bytes1.
|
|
||||||
*/
|
*/
|
||||||
FixedBytes:
|
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' |
|
'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' |
|
||||||
'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' |
|
'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' |
|
||||||
'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32';
|
'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32';
|
||||||
|
@ -391,7 +391,7 @@ Array Members
|
|||||||
// Create a dynamic byte array:
|
// Create a dynamic byte array:
|
||||||
bytes memory b = new bytes(200);
|
bytes memory b = new bytes(200);
|
||||||
for (uint i = 0; i < b.length; i++)
|
for (uint i = 0; i < b.length; i++)
|
||||||
b[i] = byte(uint8(i));
|
b[i] = bytes1(uint8(i));
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,6 @@ Fixed-size byte arrays
|
|||||||
|
|
||||||
The value types ``bytes1``, ``bytes2``, ``bytes3``, ..., ``bytes32``
|
The value types ``bytes1``, ``bytes2``, ``bytes3``, ..., ``bytes32``
|
||||||
hold a sequence of bytes from one to up to 32.
|
hold a sequence of bytes from one to up to 32.
|
||||||
``byte`` is an alias for ``bytes1``.
|
|
||||||
|
|
||||||
Operators:
|
Operators:
|
||||||
|
|
||||||
@ -391,6 +390,9 @@ Members:
|
|||||||
31 bytes of space for each element (except in storage). It is better to use the ``bytes``
|
31 bytes of space for each element (except in storage). It is better to use the ``bytes``
|
||||||
type instead.
|
type instead.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Prior to version 0.8.0, ``byte`` used to be an alias for ``bytes1``.
|
||||||
|
|
||||||
Dynamically-sized byte array
|
Dynamically-sized byte array
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
@ -212,7 +212,6 @@ namespace solidity::langutil
|
|||||||
K(Int, "int", 0) \
|
K(Int, "int", 0) \
|
||||||
K(UInt, "uint", 0) \
|
K(UInt, "uint", 0) \
|
||||||
K(Bytes, "bytes", 0) \
|
K(Bytes, "bytes", 0) \
|
||||||
K(Byte, "byte", 0) \
|
|
||||||
K(String, "string", 0) \
|
K(String, "string", 0) \
|
||||||
K(Address, "address", 0) \
|
K(Address, "address", 0) \
|
||||||
K(Bool, "bool", 0) \
|
K(Bool, "bool", 0) \
|
||||||
@ -242,6 +241,7 @@ namespace solidity::langutil
|
|||||||
K(Alias, "alias", 0) \
|
K(Alias, "alias", 0) \
|
||||||
K(Apply, "apply", 0) \
|
K(Apply, "apply", 0) \
|
||||||
K(Auto, "auto", 0) \
|
K(Auto, "auto", 0) \
|
||||||
|
K(Byte, "byte", 0) \
|
||||||
K(Case, "case", 0) \
|
K(Case, "case", 0) \
|
||||||
K(CopyOf, "copyof", 0) \
|
K(CopyOf, "copyof", 0) \
|
||||||
K(Default, "default", 0) \
|
K(Default, "default", 0) \
|
||||||
|
Loading…
Reference in New Issue
Block a user