diff --git a/Changelog.md b/Changelog.md index 7bbb9e64c..76ddbdcaa 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ Breaking Changes: * Standard JSON: Remove the ``legacyAST`` option. * 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: Disallow the ``byte`` type. It was an alias to ``bytes1``. * Type System: Disallow ``msg.data`` in ``receive()`` function. * Type System: Disallow ``type(super)``. * Type System: Disallow enums with more than 256 members. diff --git a/docs/080-breaking-changes.rst b/docs/080-breaking-changes.rst index 4ac937ec5..e5a4b027c 100644 --- a/docs/080-breaking-changes.rst +++ b/docs/080-breaking-changes.rst @@ -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 ================ diff --git a/docs/assembly.rst b/docs/assembly.rst index 2b5731cbc..d5d73cfb1 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -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 diff --git a/docs/control-structures.rst b/docs/control-structures.rst index ccde0e1b0..76f2a7497 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -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( diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4 index 88a8611c0..d8e89b278 100644 --- a/docs/grammar/SolidityLexer.g4 +++ b/docs/grammar/SolidityLexer.g4 @@ -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'; diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 419d5dfc5..897539468 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -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; } } diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 0905820aa..3f74a7f5d 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -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 ---------------------------- diff --git a/liblangutil/Token.h b/liblangutil/Token.h index 2eb97054e..13f836589 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -212,7 +212,6 @@ namespace solidity::langutil K(Int, "int", 0) \ K(UInt, "uint", 0) \ K(Bytes, "bytes", 0) \ - K(Byte, "byte", 0) \ K(String, "string", 0) \ K(Address, "address", 0) \ K(Bool, "bool", 0) \ @@ -242,6 +241,7 @@ namespace solidity::langutil K(Alias, "alias", 0) \ K(Apply, "apply", 0) \ K(Auto, "auto", 0) \ + K(Byte, "byte", 0) \ K(Case, "case", 0) \ K(CopyOf, "copyof", 0) \ K(Default, "default", 0) \ diff --git a/test/cmdlineTests/too_long_line_multiline/err b/test/cmdlineTests/too_long_line_multiline/err index 6d8114ca8..6f5dcb71c 100644 --- a/test/cmdlineTests/too_long_line_multiline/err +++ b/test/cmdlineTests/too_long_line_multiline/err @@ -4,7 +4,7 @@ Warning: SPDX license identifier not provided in source file. Before publishing, Error: No visibility specified. Did you intend to add "public"? --> too_long_line_multiline/input.sol:2:5: | -2 | function f() returns (byte _b, byte ... _b7, bytes22 _b22, bytes32 _b32) { +2 | function f() returns (bytes1 _b, by ... _b7, bytes22 _b22, bytes32 _b32) { | ^ (Relevant source part starts here and spans across multiple lines). Warning: Source file does not specify required compiler version! diff --git a/test/cmdlineTests/too_long_line_multiline/input.sol b/test/cmdlineTests/too_long_line_multiline/input.sol index 6609e1257..107c6964b 100644 --- a/test/cmdlineTests/too_long_line_multiline/input.sol +++ b/test/cmdlineTests/too_long_line_multiline/input.sol @@ -1,5 +1,5 @@ contract C { - function f() returns (byte _b, bytes2 _b2, bytes3 _b3, bytes memory _blit, bytes5 _b5, bytes6 _b6, string memory _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) { + function f() returns (bytes1 _b, bytes2 _b2, bytes3 _b3, bytes memory _blit, bytes5 _b5, bytes6 _b6, string memory _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) { _b = 0x12; _b2 = 0x1223; _b5 = hex"043245"; diff --git a/test/compilationTests/milestonetracker/RLP.sol b/test/compilationTests/milestonetracker/RLP.sol index b58bbdf90..03aea6eb7 100644 --- a/test/compilationTests/milestonetracker/RLP.sol +++ b/test/compilationTests/milestonetracker/RLP.sol @@ -257,7 +257,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return data The decoded string. - function toByte(RLPItem memory self) internal view returns (byte data) { + function toByte(RLPItem memory self) internal view returns (bytes1 data) { if(!isData(self)) revert(); (uint rStartPos, uint len) = _decode(self); @@ -267,7 +267,7 @@ library RLP { assembly { temp := byte(0, mload(rStartPos)) } - return byte(temp); + return bytes1(temp); } /// @dev Decode an RLPItem into an int. This will not work if the diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 3f5bf5d2d..b5001a26a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2037,7 +2037,7 @@ BOOST_AUTO_TEST_CASE(event_indexed_string) for (uint i = 0; i < 90; i++) bytes(x).push(0); for (uint8 i = 0; i < 90; i++) - bytes(x)[i] = byte(i); + bytes(x)[i] = bytes1(i); y[0] = 4; y[1] = 5; y[2] = 6; @@ -3421,9 +3421,9 @@ BOOST_AUTO_TEST_CASE(library_call) BOOST_AUTO_TEST_CASE(library_function_external) { char const* sourceCode = R"( - library Lib { function m(bytes calldata b) external pure returns (byte) { return b[2]; } } + library Lib { function m(bytes calldata b) external pure returns (bytes1) { return b[2]; } } contract Test { - function f(bytes memory b) public pure returns (byte) { + function f(bytes memory b) public pure returns (bytes1) { return Lib.m(b); } } @@ -3786,7 +3786,7 @@ BOOST_AUTO_TEST_CASE(short_strings) if (data1[0] != "1") return 10; if (data1[4] != "4") return 11; for (uint i = 0; i < data1.length; i ++) - data1[i] = byte(uint8(i * 3)); + data1[i] = bytes1(uint8(i * 3)); if (uint8(data1[4]) != 4 * 3) return 12; if (uint8(data1[67]) != 67 * 3) return 13; // change length: long -> short diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 6aceea3b0..b9accf7bb 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -679,7 +679,7 @@ BOOST_AUTO_TEST_CASE(byte_access) char const* sourceCode = R"( contract C { - function f(bytes32 x) public returns (byte r) + function f(bytes32 x) public returns (bytes1 r) { assembly { r := and(byte(x, 31), 0xff) } } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 57adb3186..5443f7b39 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -491,6 +491,7 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved) "alias", "apply", "auto", + "byte", "case", "copyof", "default", diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index d9f72bbce..95288d85c 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -51,7 +51,6 @@ BOOST_AUTO_TEST_CASE(uint_types) BOOST_AUTO_TEST_CASE(byte_types) { - BOOST_CHECK(*TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken(Token::Byte, 0, 0)) == *TypeProvider::fixedBytes(1)); for (unsigned i = 1; i <= 32; i++) BOOST_CHECK(*TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken(Token::BytesM, i, 0)) == *TypeProvider::fixedBytes(i)); } @@ -162,7 +161,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers) StringLiteralType(Literal(++id, SourceLocation{}, Token::StringLiteral, make_shared("abc - def"))).identifier(), "t_stringliteral_196a9142ee0d40e274a6482393c762b16dd8315713207365e1e13d8d85b74fc4" ); - BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("byte")->identifier(), "t_bytes1"); + BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("bytes1")->identifier(), "t_bytes1"); BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("bytes8")->identifier(), "t_bytes8"); BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("bytes32")->identifier(), "t_bytes32"); BOOST_CHECK_EQUAL(TypeProvider::fromElementaryTypeName("bool")->identifier(), "t_bool"); diff --git a/test/libsolidity/semanticTests/abiEncoderV1/byte_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV1/byte_arrays.sol index 3eab393b5..ce2dbf861 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/byte_arrays.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/byte_arrays.sol @@ -1,11 +1,11 @@ contract C { function f(uint a, bytes memory b, uint c) - public pure returns (uint, uint, byte, uint) { + public pure returns (uint, uint, bytes1, uint) { return (a, b.length, b[3], c); } function f_external(uint a, bytes calldata b, uint c) - external pure returns (uint, uint, byte, uint) { + external pure returns (uint, uint, bytes1, uint) { return (a, b.length, b[3], c); } } diff --git a/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol b/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol index b0ba6dfaf..b86129d77 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol @@ -2,11 +2,11 @@ contract C { function f(bytes memory a, bytes calldata b, uint[] memory c) external pure - returns (uint, byte, uint, byte, uint, uint) + returns (uint, bytes1, uint, bytes1, uint, uint) { return (a.length, a[1], b.length, b[2], c.length, c[3]); } - function g() public returns (uint, byte, uint, byte, uint, uint) { + function g() public returns (uint, bytes1, uint, bytes1, uint, uint) { uint[] memory x = new uint[](4); x[3] = 7; return this.f("abc", "def", x); diff --git a/test/libsolidity/semanticTests/abiEncoderV2/byte_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV2/byte_arrays.sol index 2b9b5c5d3..c66c1692d 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/byte_arrays.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/byte_arrays.sol @@ -1,13 +1,13 @@ -pragma abicoder v2; +pragma abicoder v2; contract C { function f(uint a, bytes memory b, uint c) - public pure returns (uint, uint, byte, uint) { + public pure returns (uint, uint, bytes1, uint) { return (a, b.length, b[3], c); } function f_external(uint a, bytes calldata b, uint c) - external pure returns (uint, uint, byte, uint) { + external pure returns (uint, uint, bytes1, uint) { return (a, b.length, b[3], c); } } diff --git a/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol b/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol index 66a64e1f9..549838f95 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol @@ -1,14 +1,14 @@ -pragma abicoder v2; +pragma abicoder v2; contract C { function f(bytes memory a, bytes calldata b, uint[] memory c) external pure - returns (uint, byte, uint, byte, uint, uint) + returns (uint, bytes1, uint, bytes1, uint, uint) { return (a.length, a[1], b.length, b[2], c.length, c[3]); } - function g() public returns (uint, byte, uint, byte, uint, uint) { + function g() public returns (uint, bytes1, uint, bytes1, uint, uint) { uint[] memory x = new uint[](4); x[3] = 7; return this.f("abc", "def", x); diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol index 88d741654..5e0cae64d 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol @@ -1,5 +1,5 @@ contract c { - byte[10] data1; + bytes1[10] data1; bytes2[32] data2; function test() public returns (uint check, uint res1, uint res2) { uint i; @@ -7,7 +7,7 @@ contract c { data2[i] = 0xffff; check = uint(uint16(data2[31])) * 0x10000 | uint(uint16(data2[14])); for (i = 0; i < data1.length; ++i) - data1[i] = byte(uint8(1 + i)); + data1[i] = bytes1(uint8(1 + i)); data2 = data1; for (i = 0; i < 16; ++i) res1 |= uint(uint16(data2[i])) * 0x10000**i; diff --git a/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol index aad6e08d5..9cc10dfd5 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol @@ -1,6 +1,6 @@ contract C { bytes s; - function f() external returns (byte) { + function f() external returns (bytes1) { bytes memory data = "abcd"; s = data; return s[0]; diff --git a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol index 26972f1c4..7a52348c6 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol @@ -1,6 +1,6 @@ contract C { bytes s = "abcd"; - function f() external returns (byte) { + function f() external returns (bytes1) { bytes memory data = s; return data[0]; } diff --git a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol index aadd82cd9..8db478736 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol @@ -4,7 +4,7 @@ contract c { function f(uint len) public returns (bytes memory) { bytes memory x = new bytes(len); for (uint i = 0; i < len; i++) - x[i] = byte(uint8(i)); + x[i] = bytes1(uint8(i)); a = x; for (uint i = 0; i < len; i++) assert(a[i] == x[i]); diff --git a/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol b/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol index 2b9c2346f..88a544139 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol @@ -1,6 +1,6 @@ contract C { bytes s; - function f(bytes calldata data) external returns (byte) { + function f(bytes calldata data) external returns (bytes1) { s = data; return s[0]; } diff --git a/test/libsolidity/semanticTests/array/copying/empty_bytes_copy.sol b/test/libsolidity/semanticTests/array/copying/empty_bytes_copy.sol index 63ef7fba9..0f19eaa0a 100644 --- a/test/libsolidity/semanticTests/array/copying/empty_bytes_copy.sol +++ b/test/libsolidity/semanticTests/array/copying/empty_bytes_copy.sol @@ -1,7 +1,7 @@ contract C { bytes data; bytes otherData; - function fromMemory() public returns (byte) { + function fromMemory() public returns (bytes1) { bytes memory t; uint[2] memory x; x[0] = type(uint).max; @@ -9,12 +9,12 @@ contract C { data.push(); return data[0]; } - function fromCalldata(bytes calldata x) public returns (byte) { + function fromCalldata(bytes calldata x) public returns (bytes1) { data = x; data.push(); return data[0]; } - function fromStorage() public returns (byte) { + function fromStorage() public returns (bytes1) { // zero-length but dirty higher order bits assembly { sstore(otherData.slot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) } data = otherData; diff --git a/test/libsolidity/semanticTests/array/indexAccess/bytes_index_access_memory.sol b/test/libsolidity/semanticTests/array/indexAccess/bytes_index_access_memory.sol index 1c2824d7c..1dcd448b4 100644 --- a/test/libsolidity/semanticTests/array/indexAccess/bytes_index_access_memory.sol +++ b/test/libsolidity/semanticTests/array/indexAccess/bytes_index_access_memory.sol @@ -1,10 +1,10 @@ contract Main { - function f(bytes memory _s1, uint i1, uint i2, uint i3) public returns (byte c1, byte c2, byte c3) { + function f(bytes memory _s1, uint i1, uint i2, uint i3) public returns (bytes1 c1, bytes1 c2, bytes1 c3) { c1 = _s1[i1]; c2 = intern(_s1, i2); c3 = internIndirect(_s1)[i3]; } - function intern(bytes memory _s1, uint i) public returns (byte c) { + function intern(bytes memory _s1, uint i) public returns (bytes1 c) { return _s1[i]; } function internIndirect(bytes memory _s1) public returns (bytes memory) { diff --git a/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol b/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol index 2fc66ece4..27d7e241e 100644 --- a/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol +++ b/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol @@ -12,7 +12,7 @@ contract C { function abiEncode() public view returns (bytes memory) { return x; } function abiEncodePacked() public view returns (bytes memory) { return abi.encodePacked(x); } function copyToMemory() public view returns (bytes memory m) { m = x; } - function indexAccess() public view returns (byte) { return x[0]; } + function indexAccess() public view returns (bytes1) { return x[0]; } function assignTo() public { x = "def"; } function assignToLong() public { x = "1234567890123456789012345678901234567"; } function copyToStorage() public { y = x; } diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol index cbb25489d..b4d0adfc0 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol @@ -5,9 +5,9 @@ contract c { bytes data; function test() public returns (bool) { for (uint8 i = 0; i <= 40; i++) - data.push(byte(i+1)); + data.push(bytes1(i+1)); for (int8 j = 40; j >= 0; j--) { - require(data[uint8(j)] == byte(uint8(j+1))); + require(data[uint8(j)] == bytes1(uint8(j+1))); require(data.length == uint8(j+1)); data.pop(); } diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol index 9be9e8eab..f17ae4f10 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol @@ -2,7 +2,7 @@ contract CalldataTest { function test(bytes calldata x) public returns (bytes calldata) { return x; } - function tester(bytes calldata x) public returns (byte) { + function tester(bytes calldata x) public returns (bytes1) { return this.test(x)[2]; } } diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol index 3b39a51a4..a0384f887 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol @@ -1,8 +1,8 @@ contract C { - function f(bytes calldata b, uint i) internal pure returns (byte) { + function f(bytes calldata b, uint i) internal pure returns (bytes1) { return b[i]; } - function f(uint, bytes calldata b, uint) external pure returns (byte) { + function f(uint, bytes calldata b, uint) external pure returns (bytes1) { return f(b, 2); } } diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol index d7993cbd4..d6871d7e4 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol @@ -1,15 +1,15 @@ contract C { - function(bytes calldata) returns (byte) x; + function(bytes calldata) returns (bytes1) x; constructor() { x = f; } - function f(bytes calldata b) internal pure returns (byte) { + function f(bytes calldata b) internal pure returns (bytes1) { return b[2]; } - function h(bytes calldata b) external returns (byte) { + function h(bytes calldata b) external returns (bytes1) { return x(b); } - function g() external returns (byte) { + function g() external returns (bytes1) { bytes memory a = new bytes(34); - a[2] = byte(uint8(7)); + a[2] = bytes1(uint8(7)); return this.h(a); } } diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol index 90528fc70..fa44cc144 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol @@ -1,16 +1,16 @@ library L { - function f(uint, bytes calldata _x, uint) internal returns (byte) { + function f(uint, bytes calldata _x, uint) internal returns (bytes1) { return _x[2]; } } contract C { function f(bytes calldata a) external - returns (byte) + returns (bytes1) { return L.f(3, a, 9); } - function g() public returns (byte) { + function g() public returns (bytes1) { bytes memory x = new bytes(4); x[2] = 0x08; return this.f(x); diff --git a/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol b/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol index a87afac11..2798a6ab7 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol @@ -1,11 +1,11 @@ contract C { function f(bytes memory _a, bytes calldata _b, bytes memory _c) public - returns (uint, byte, byte, byte) + returns (uint, bytes1, bytes1, bytes1) { return (_a.length + _b.length + _c.length, _a[1], _b[1], _c[1]); } - function g() public returns (uint, byte, byte, byte) { + function g() public returns (uint, bytes1, bytes1, bytes1) { bytes memory x = new bytes(3); bytes memory y = new bytes(4); bytes memory z = new bytes(7); diff --git a/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol b/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol index 57c357eeb..048d5de3a 100644 --- a/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol +++ b/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol @@ -3,7 +3,7 @@ contract C { address constant e = 0x1212121212121212121212121000002134593163; - function f() public returns (byte z) { + function f() public returns (bytes1 z) { assembly { z := e } } } diff --git a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol index 35e69bf4e..1a9832e88 100644 --- a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol +++ b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol @@ -5,7 +5,7 @@ contract Base { m_x = x; m_s = s; } - function part(uint i) public returns (byte) { + function part(uint i) public returns (bytes1) { return m_s[i]; } } @@ -16,7 +16,7 @@ contract Main is Base { } } contract Creator { - function f(uint x, bytes memory s) public returns (uint r, byte ch) { + function f(uint x, bytes memory s) public returns (uint r, bytes1 ch) { Main c = new Main(s, x); r = c.m_x(); ch = c.part(x); diff --git a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol index 05d628d3d..09c3df576 100644 --- a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol +++ b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol @@ -1,6 +1,6 @@ contract C { function f(bytes calldata b) public returns (bool correct) { - byte a = b[3]; + bytes1 a = b[3]; uint r; assembly { r := a diff --git a/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol index 867fb7e8c..6cd9045b4 100644 --- a/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol +++ b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol @@ -9,7 +9,7 @@ library D { contract C { using D for bytes; - function f(bytes calldata _x) public pure returns (byte, byte) { + function f(bytes calldata _x) public pure returns (bytes1, bytes1) { return (_x.f()[0], _x.g()[0]); } } diff --git a/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol b/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol index f9808e100..ab953c310 100644 --- a/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol +++ b/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol @@ -9,7 +9,7 @@ library D { contract C { using D for bytes; - function f(bytes calldata _x) public pure returns (byte, byte) { + function f(bytes calldata _x) public pure returns (bytes1, bytes1) { return (_x.f()[0], _x.g()[0]); } } diff --git a/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol index 300fa8812..b80d2fdc7 100644 --- a/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol +++ b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol @@ -1,15 +1,15 @@ library D { - function f(bytes calldata _x) internal pure returns (byte) { + function f(bytes calldata _x) internal pure returns (bytes1) { return _x[0]; } - function g(bytes memory _x) internal pure returns (byte) { + function g(bytes memory _x) internal pure returns (bytes1) { return _x[0]; } } contract C { using D for bytes; - function f(bytes calldata _x) public pure returns (byte, byte) { + function f(bytes calldata _x) public pure returns (bytes1, bytes1) { return (_x.f(), _x.g()); } } diff --git a/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol b/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol index db5eaeea3..bd3cb3865 100644 --- a/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol +++ b/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol @@ -1,15 +1,15 @@ library D { - function f(bytes calldata _x) public pure returns (byte) { + function f(bytes calldata _x) public pure returns (bytes1) { return _x[0]; } - function g(bytes memory _x) public pure returns (byte) { + function g(bytes memory _x) public pure returns (bytes1) { return _x[0]; } } contract C { using D for bytes; - function f(bytes calldata _x) public pure returns (byte, byte) { + function f(bytes calldata _x) public pure returns (bytes1, bytes1) { return (_x.f(), _x.g()); } } diff --git a/test/libsolidity/semanticTests/literals/escape.sol b/test/libsolidity/semanticTests/literals/escape.sol index 1b9fdb4e1..846dcc793 100644 --- a/test/libsolidity/semanticTests/literals/escape.sol +++ b/test/libsolidity/semanticTests/literals/escape.sol @@ -1,8 +1,8 @@ -pragma abicoder v2; +pragma abicoder v2; contract C { - function f() public pure returns (uint, byte, byte) { + function f() public pure returns (uint, bytes1, bytes1) { bytes memory encoded = abi.encodePacked("\\\\"); return (encoded.length, encoded[0], encoded[1]); } diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_struct_member_dynamic.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_struct_member_dynamic.sol index 64baab7c8..b2a651504 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_struct_member_dynamic.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_struct_member_dynamic.sol @@ -14,7 +14,7 @@ contract C { function f(S1 calldata s1) external pure - returns (uint256 a, uint64 b0, byte b1, uint256 c) + returns (uint256 a, uint64 b0, bytes1 b1, uint256 c) { a = s1.a; b0 = s1.s.a; diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol index 9362d17be..fd9c570d0 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol @@ -1,4 +1,4 @@ -pragma abicoder v2; +pragma abicoder v2; contract C { struct S { @@ -7,7 +7,7 @@ contract C { bytes2 c; } - function f(S calldata s) external pure returns (uint256, uint256, byte) { + function f(S calldata s) external pure returns (uint256, uint256, bytes1) { S memory m = s; return (m.a, m.b, m.c[1]); } diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol index 1113c494d..643324705 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol @@ -1,4 +1,4 @@ -pragma abicoder v2; +pragma abicoder v2; contract C { struct S { @@ -10,7 +10,7 @@ contract C { uint[153] r; S s; - function f(uint32 a, S calldata c, uint256 b) external returns (uint256, uint256, byte) { + function f(uint32 a, S calldata c, uint256 b) external returns (uint256, uint256, bytes1) { s = c; return (s.a, s.b, s.c[1]); } diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol index fba9a8e72..f62742fa7 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol @@ -10,7 +10,7 @@ contract C { function f(S calldata c) external pure - returns (uint256, byte, byte, uint256) + returns (uint256, bytes1, bytes1, uint256) { S memory m = c; return (m.a, m.b[0], m.b[1], m.c); diff --git a/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol b/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol index 2ab4a8f36..e0f8d9fd9 100644 --- a/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol +++ b/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol @@ -16,7 +16,7 @@ contract c { delete data1; return true; } - function test(uint256 i) public returns (byte) { + function test(uint256 i) public returns (bytes1) { return data1.data[i]; } } diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol index 5a06e45d2..bf15d5f4d 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol @@ -4,7 +4,7 @@ contract C { assembly { sstore(b.slot, or("deadbeef", 0x08)) } - byte s = b[3]; + bytes1 s = b[3]; uint r; assembly { r := s diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol index 6770df0f3..31f77407d 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol @@ -6,7 +6,7 @@ contract C { mstore(0, b.slot) sstore(keccak256(0, 0x20), "deadbeefdeadbeefdeadbeefdeadbeef") } - byte s = b[31]; + bytes1 s = b[31]; uint r; assembly { r := s diff --git a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol index 15d04fff3..51ff343d8 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol @@ -1,10 +1,10 @@ contract C { uint16 x; - byte y; + bytes1 y; uint16 z; function f(uint8 a) public returns (uint _x) { x = a; - y = byte(uint8(x) + 1); + y = bytes1(uint8(x) + 1); z = uint8(y) + 1; x = z + 1; _x = x; diff --git a/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol b/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol index 3f4d586e6..d24bc04b5 100644 --- a/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol +++ b/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol @@ -32,9 +32,6 @@ contract C { function r_b1() public pure returns (bytes1) { return ~bytes1(hex"55"); } - function r_b() public pure returns (byte) { - return ~byte(hex"55"); - } function a_b32() public pure returns (bytes32) { bytes32 r = ~bytes32(hex"ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00"); @@ -56,14 +53,10 @@ contract C { bytes4 r = ~bytes4(hex"ff00ff00"); return r; } - function a_b1() public pure returns (byte) { + function a_b1() public pure returns (bytes1) { bytes1 r = ~bytes1(hex"55"); return r; } - function a_b() public pure returns (byte) { - byte r = ~byte(hex"55"); - return r; - } } // ==== // compileViaYul: also @@ -77,11 +70,9 @@ contract C { // r_b8() -> 0xff00ff00ff00ff000000000000000000000000000000000000000000000000 // r_b4() -> 0xff00ff00000000000000000000000000000000000000000000000000000000 // r_b1() -> 0xaa00000000000000000000000000000000000000000000000000000000000000 -// r_b() -> 0xaa00000000000000000000000000000000000000000000000000000000000000 // a_b32() -> 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff // a_b25() -> 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff0000000000000000 // a_b16() -> 0xff00ff00ff00ff00ff00ff00ff00ff00000000000000000000000000000000 // a_b8() -> 0xff00ff00ff00ff000000000000000000000000000000000000000000000000 // a_b4() -> 0xff00ff00000000000000000000000000000000000000000000000000000000 // a_b1() -> 0xaa00000000000000000000000000000000000000000000000000000000000000 -// a_b() -> 0xaa00000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/smtCheckerTests/functions/getters/fixed_bytes.sol b/test/libsolidity/smtCheckerTests/functions/getters/fixed_bytes.sol index 0109b8fde..ca40a5733 100644 --- a/test/libsolidity/smtCheckerTests/functions/getters/fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/functions/getters/fixed_bytes.sol @@ -1,11 +1,11 @@ pragma experimental SMTChecker; contract C { - byte public x; + bytes1 public x; bytes3 public y; function f() public view { - byte a = this.x(); + bytes1 a = this.x(); bytes3 b = this.y(); assert(a == x); // should hold assert(a == 'a'); // should fail @@ -14,5 +14,5 @@ contract C { } } // ---- -// Warning 6328: (188-204): CHC: Assertion violation happens here.\nCounterexample:\nx = 0, y = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\nf() -// Warning 6328: (256-274): CHC: Assertion violation happens here.\nCounterexample:\nx = 0, y = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\nf() +// Warning 6328: (192-208): CHC: Assertion violation happens here.\nCounterexample:\nx = 0, y = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\nf() +// Warning 6328: (260-278): CHC: Assertion violation happens here.\nCounterexample:\nx = 0, y = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\nf() diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol index 06626f67d..a4a9c5ac3 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol @@ -1,11 +1,11 @@ pragma experimental SMTChecker; contract C { function f() public pure { - assert(byte("") & ("") == byte(0)); // should hold - assert(byte(0xAA) & byte(0x55) == byte(0)); // should hold - assert(byte(0xFF) & byte(0xAA) == byte(0xAA)); // should hold - assert(byte(0xFF) & byte(0xAA) == byte(0)); // should fail + assert(bytes1("") & ("") == bytes1(0)); // should hold + assert(bytes1(0xAA) & bytes1(0x55) == bytes1(0)); // should hold + assert(bytes1(0xFF) & bytes1(0xAA) == bytes1(0xAA)); // should hold + assert(bytes1(0xFF) & bytes1(0xAA) == bytes1(0)); // should fail } } // ---- -// Warning 6328: (253-295): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (269-317): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_or_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_or_fixed_bytes.sol index 18d123113..3789eabd6 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_or_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_or_fixed_bytes.sol @@ -1,11 +1,11 @@ pragma experimental SMTChecker; contract C { - function f() public pure returns (byte) { - byte b = (byte(0x0F) | (byte(0xF0))); - assert(b == byte(0xFF)); // should hold - assert(b == byte(0x00)); // should fail + function f() public pure returns (bytes1) { + bytes1 b = (bytes1(0x0F) | (bytes1(0xF0))); + assert(b == bytes1(0xFF)); // should hold + assert(b == bytes1(0x00)); // should fail return b; } } // ---- -// Warning 6328: (172-195): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (182-207): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol index 07cf7d425..fd2ebf8d8 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol @@ -1,11 +1,11 @@ pragma experimental SMTChecker; contract Simp { - function f3() public pure returns (byte) { + function f3() public pure returns (bytes1) { bytes memory y = "def"; - assert(y[0] ^ "e" != byte(0)); // should hold - assert(y[1] ^ "e" != byte(0)); // should fail + assert(y[0] ^ "e" != bytes1(0)); // should hold + assert(y[1] ^ "e" != bytes1(0)); // should fail return y[0]; } } // ---- -// Warning 6328: (168-197): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf3() +// Warning 6328: (172-203): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf3() diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_fixed_bytes.sol index d4c28da29..b63317401 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_fixed_bytes.sol @@ -1,8 +1,8 @@ pragma experimental SMTChecker; contract C { - function f() public pure returns (byte) { - byte a = 0xff; - byte b = 0xf0; + function f() public pure returns (bytes1) { + bytes1 a = 0xff; + bytes1 b = 0xf0; a &= b; assert(a == b); @@ -11,5 +11,5 @@ contract C { } } // ---- -// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6328: (203-217): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() +// Warning 6321: (83-89): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. +// Warning 6328: (209-223): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_fixed_bytes.sol index c38bba2d2..fcbcd5d7a 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_fixed_bytes.sol @@ -1,8 +1,8 @@ pragma experimental SMTChecker; contract C { - function f() public pure returns (byte) { - byte a = 0xff; - byte b = 0xf0; + function f() public pure returns (bytes1) { + bytes1 a = 0xff; + bytes1 b = 0xf0; b |= a; assert(a == b); @@ -11,5 +11,5 @@ contract C { } } // ---- -// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6328: (203-217): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() +// Warning 6321: (83-89): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. +// Warning 6328: (209-223): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol index b95fe80c4..ef53b86f2 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol @@ -10,7 +10,7 @@ contract C { assert(y[0] == "d"); // fails y[0] ^= "f"; - assert(y[0] == (byte("d") | byte("e")) ^ byte("f")); + assert(y[0] == (bytes1("d") | bytes1("e")) ^ bytes1("f")); } } // ---- diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_fixed_bytes.sol index 62da8f2dc..46c43d96f 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_fixed_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_fixed_bytes.sol @@ -1,8 +1,8 @@ pragma experimental SMTChecker; contract C { - function f() public pure returns (byte) { - byte a = 0xff; - byte b = 0xf0; + function f() public pure returns (bytes1) { + bytes1 a = 0xff; + bytes1 b = 0xf0; a ^= ~b; assert(a == b); @@ -11,5 +11,5 @@ contract C { } } // ---- -// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6328: (204-221): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() +// Warning 6321: (83-89): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. +// Warning 6328: (210-227): CHC: Assertion violation happens here.\nCounterexample:\n\n\n = 0\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/typecast/implicit_cast_string_literal_byte.sol b/test/libsolidity/smtCheckerTests/typecast/implicit_cast_string_literal_byte.sol index 66e4020ed..849052a99 100644 --- a/test/libsolidity/smtCheckerTests/typecast/implicit_cast_string_literal_byte.sol +++ b/test/libsolidity/smtCheckerTests/typecast/implicit_cast_string_literal_byte.sol @@ -1,16 +1,16 @@ pragma experimental SMTChecker; contract C { - mapping (byte => uint) map; + mapping (bytes1 => uint) map; function f() public { map[""] = 2; uint x = map[""]; g(""); - byte b = ""; + bytes1 b = ""; assert(x == map[b]); assert(x == map["x"]); } - function g(byte b) internal pure {} + function g(bytes1 b) internal pure {} } // ---- -// Warning 6328: (182-203): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (186-207): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_dynamic_bytes.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_dynamic_bytes.sol index 009461c92..5fdd0b96c 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_dynamic_bytes.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_dynamic_bytes.sol @@ -4,9 +4,9 @@ contract C { function f() public pure { bytes memory b = bytes(hex"ffff"); assert(b.length == 2); // should hold - assert(b[0] == byte(uint8(255))); // should hold - assert(b[1] == byte(uint8(100))); // should fail + assert(b[0] == bytes1(uint8(255))); // should hold + assert(b[1] == bytes1(uint8(100))); // should fail } } // ---- -// Warning 6328: (204-236): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (206-240): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_4.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_4.sol index b5a8c2d4d..01f1746a9 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_4.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_4.sol @@ -3,8 +3,8 @@ pragma experimental SMTChecker; contract C { function f() public pure { bytes32 x = 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff; - byte z = 0x00; - byte o = 0xff; + bytes1 z = 0x00; + bytes1 o = 0xff; assert(x[0] == z); assert(x[31] == o); assert(x[0] == x[22]); @@ -12,4 +12,4 @@ contract C { } } // ---- -// Warning 6328: (260-281): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (264-285): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_5.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_5.sol index ac5137439..9afd9f56f 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_5.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_5.sol @@ -3,7 +3,7 @@ pragma experimental SMTChecker; contract C { function f() public pure { bytes4 x = 0x01020304; - byte b = 0x02; + bytes1 b = 0x02; assert(x[0] == b); // fails assert(x[1] == b); assert(x[2] == b); // fails @@ -11,6 +11,6 @@ contract C { } } // ---- -// Warning 6328: (118-135): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() -// Warning 6328: (169-186): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() -// Warning 6328: (199-216): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (120-137): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (171-188): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() +// Warning 6328: (201-218): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf() diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_6.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_6.sol index 8332d8117..0a0edf864 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_6.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_access_6.sol @@ -3,7 +3,7 @@ pragma experimental SMTChecker; contract C { function f() public pure { bytes4 x = 0x01020304; - byte b = x[3]; + bytes1 b = x[3]; assert(b == b[0]); assert(b == b[0][0]); assert(b == b[0][0][0][0][0][0][0][0][0][0][0]); diff --git a/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol b/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol index fac8cce48..779fb13f6 100644 --- a/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol +++ b/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract test { - struct s { uint a; uint b;} - function f() pure public returns (byte) { + struct s { uint a; uint b;} + function f() pure public returns (bytes1) { s; s(1,2); s[7]; @@ -10,13 +10,13 @@ contract test { } } // ---- -// Warning 6321: (115-119): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6133: (125-126): Statement has no effect. -// Warning 6133: (130-136): Statement has no effect. -// Warning 6133: (140-144): Statement has no effect. -// Warning 6133: (148-152): Statement has no effect. -// Warning 6133: (156-163): Statement has no effect. -// Warning 8364: (140-144): Assertion checker does not yet implement type type(struct test.s memory[7] memory) -// Warning 8364: (156-163): Assertion checker does not yet implement type type(uint256[7] memory) -// Warning 8364: (140-144): Assertion checker does not yet implement type type(struct test.s memory[7] memory) -// Warning 8364: (156-163): Assertion checker does not yet implement type type(uint256[7] memory) +// Warning 6321: (118-124): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. +// Warning 6133: (130-131): Statement has no effect. +// Warning 6133: (135-141): Statement has no effect. +// Warning 6133: (145-149): Statement has no effect. +// Warning 6133: (153-157): Statement has no effect. +// Warning 6133: (161-168): Statement has no effect. +// Warning 8364: (145-149): Assertion checker does not yet implement type type(struct test.s memory[7] memory) +// Warning 8364: (161-168): Assertion checker does not yet implement type type(uint256[7] memory) +// Warning 8364: (145-149): Assertion checker does not yet implement type type(struct test.s memory[7] memory) +// Warning 8364: (161-168): Assertion checker does not yet implement type type(uint256[7] memory) diff --git a/test/libsolidity/syntaxTests/array/invalidCopy/storage_to_storage_different_base.sol b/test/libsolidity/syntaxTests/array/invalidCopy/storage_to_storage_different_base.sol index b9f158697..d45a77182 100644 --- a/test/libsolidity/syntaxTests/array/invalidCopy/storage_to_storage_different_base.sol +++ b/test/libsolidity/syntaxTests/array/invalidCopy/storage_to_storage_different_base.sol @@ -1,9 +1,9 @@ contract C { - byte[32] data1; + bytes1[32] data1; bytes2[10] data2; function f() external { data1 = data2; } } // ---- -// TypeError 7407: (99-104): Type bytes2[10] storage ref is not implicitly convertible to expected type bytes1[32] storage ref. +// TypeError 7407: (101-106): Type bytes2[10] storage ref is not implicitly convertible to expected type bytes1[32] storage ref. diff --git a/test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol b/test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol index d68ec2d42..06caa0f22 100644 --- a/test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol +++ b/test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol @@ -1,8 +1,8 @@ // Used to cause ICE contract C { function f() public { - abi.decode("", (byte[999999999])); + abi.decode("", (bytes1[999999999])); } } // ---- -// TypeError 6118: (75-90): Type too large for memory. +// TypeError 6118: (75-92): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/fixed_size_multidim_zero_length.sol b/test/libsolidity/syntaxTests/array/length/fixed_size_multidim_zero_length.sol index 0b5ceafab..6a913d1e3 100644 --- a/test/libsolidity/syntaxTests/array/length/fixed_size_multidim_zero_length.sol +++ b/test/libsolidity/syntaxTests/array/length/fixed_size_multidim_zero_length.sol @@ -1,7 +1,7 @@ contract C { function a() public pure returns(int[0][500] memory) {} function b() public pure returns(uint[0][500] memory) {} - function c() public pure returns(byte[0][500] memory) {} + function c() public pure returns(bytes1[0][500] memory) {} function d() public pure returns(bytes32[0][500] memory) {} function e() public pure returns(bytes[0][500] memory) {} function e() public pure returns(string[0][500] memory) {} @@ -9,7 +9,7 @@ contract C { // ---- // TypeError 1406: (52-53): Array with zero length specified. // TypeError 1406: (111-112): Array with zero length specified. -// TypeError 1406: (170-171): Array with zero length specified. -// TypeError 1406: (232-233): Array with zero length specified. -// TypeError 1406: (292-293): Array with zero length specified. -// TypeError 1406: (353-354): Array with zero length specified. +// TypeError 1406: (172-173): Array with zero length specified. +// TypeError 1406: (234-235): Array with zero length specified. +// TypeError 1406: (294-295): Array with zero length specified. +// TypeError 1406: (355-356): Array with zero length specified. diff --git a/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol b/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol index cd7b8e47a..d268d75dd 100644 --- a/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol +++ b/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol @@ -1,7 +1,7 @@ contract C { int[0] a; uint[0] b; - byte[0] c; + bytes1[0] c; bytes32[0] d; bytes[0] e; string[0] f; @@ -9,7 +9,7 @@ contract C { // ---- // TypeError 1406: (19-20): Array with zero length specified. // TypeError 1406: (32-33): Array with zero length specified. -// TypeError 1406: (45-46): Array with zero length specified. -// TypeError 1406: (61-62): Array with zero length specified. -// TypeError 1406: (75-76): Array with zero length specified. -// TypeError 1406: (90-91): Array with zero length specified. +// TypeError 1406: (47-48): Array with zero length specified. +// TypeError 1406: (63-64): Array with zero length specified. +// TypeError 1406: (77-78): Array with zero length specified. +// TypeError 1406: (92-93): Array with zero length specified. diff --git a/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol b/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol index 024c58940..93222ec93 100644 --- a/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol +++ b/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol @@ -1,10 +1,10 @@ contract test { - struct s { uint a; uint b;} - function f() pure public returns (byte) { + struct s { uint a; uint b;} + function f() pure public returns (bytes1) { s[75555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555]; s[7]; } } // ---- -// TypeError 7407: (101-241): Type int_const 7555...(132 digits omitted)...5555 is not implicitly convertible to expected type uint256. Literal is too large to fit in uint256. +// TypeError 7407: (106-246): Type int_const 7555...(132 digits omitted)...5555 is not implicitly convertible to expected type uint256. Literal is too large to fit in uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/160_test_byte_is_alias_of_byte1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/160_test_byte_is_alias_of_byte1.sol index ced9fac34..4ab89a3a2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/160_test_byte_is_alias_of_byte1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/160_test_byte_is_alias_of_byte1.sol @@ -1,7 +1,7 @@ contract c { bytes arr; - function f() public { byte a = arr[0];} + function f() public { bytes1 a = arr[0];} } // ---- -// Warning 2072: (54-60): Unused local variable. -// Warning 2018: (32-71): Function state mutability can be restricted to view +// Warning 2072: (54-62): Unused local variable. +// Warning 2018: (32-73): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol index b3d8aea81..19920b50c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol @@ -36,15 +36,15 @@ contract C { // real is not there yet. // array - byte[2] memory a; - byte[2] memory b; - byte[2] memory k = true ? a : b; - k[0] = byte(0); //Avoid unused var warning + bytes1[2] memory a; + bytes1[2] memory b; + bytes1[2] memory k = true ? a : b; + k[0] = bytes1(0); //Avoid unused var warning bytes memory e; bytes memory f; bytes memory l = true ? e : f; - l[0] = byte(0); // Avoid unused var warning + l[0] = bytes1(0); // Avoid unused var warning // fixed bytes bytes2 c; @@ -84,6 +84,6 @@ contract C { } } // ---- -// Warning 2519: (1005-1019): This declaration shadows an existing declaration. +// Warning 2519: (1013-1027): This declaration shadows an existing declaration. // Warning 2018: (257-642): Function state mutability can be restricted to pure -// Warning 2018: (647-1227): Function state mutability can be restricted to pure +// Warning 2018: (647-1237): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol index 8cb32f72d..e7abd890d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol @@ -1,5 +1,5 @@ contract C { - function o(byte) public pure {} + function o(bytes1) public pure {} function f() public { o(true ? 99**99 : 99); o(true ? 99 : 99**99); @@ -8,9 +8,9 @@ contract C { } } // ---- -// TypeError 9717: (92-98): Invalid mobile type in true expression. -// TypeError 9553: (85-103): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. -// TypeError 3703: (128-134): Invalid mobile type in false expression. -// TypeError 9553: (116-134): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. -// TypeError 9717: (155-161): Invalid mobile type in true expression. -// TypeError 3703: (164-170): Invalid mobile type in false expression. +// TypeError 9717: (94-100): Invalid mobile type in true expression. +// TypeError 9553: (87-105): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. +// TypeError 3703: (130-136): Invalid mobile type in false expression. +// TypeError 9553: (118-136): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. +// TypeError 9717: (157-163): Invalid mobile type in true expression. +// TypeError 3703: (166-172): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol index 049834de9..5f5b9a130 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol @@ -1,6 +1,6 @@ contract test { struct s { uint a; uint b;} - function f() pure public returns (byte) { + function f() pure public returns (bytes1) { s; s(1,2); s[7]; @@ -9,9 +9,9 @@ contract test { } } // ---- -// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6133: (93-94): Statement has no effect. -// Warning 6133: (98-104): Statement has no effect. -// Warning 6133: (108-112): Statement has no effect. -// Warning 6133: (116-120): Statement has no effect. -// Warning 6133: (124-131): Statement has no effect. +// Warning 6321: (83-89): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. +// Warning 6133: (95-96): Statement has no effect. +// Warning 6133: (100-106): Statement has no effect. +// Warning 6133: (110-114): Statement has no effect. +// Warning 6133: (118-122): Statement has no effect. +// Warning 6133: (126-133): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol b/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol index 8993d87ec..bc5db10ba 100644 --- a/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol @@ -5,7 +5,7 @@ contract C { int256 payable d; uint payable e; uint256 payable f; - byte payable g; + bytes1 payable g; bytes payable h; bytes32 payable i; fixed payable j; @@ -20,10 +20,10 @@ contract C { // ParserError 9106: (85-92): State mutability can only be specified for address types. // ParserError 9106: (105-112): State mutability can only be specified for address types. // ParserError 9106: (128-135): State mutability can only be specified for address types. -// ParserError 9106: (148-155): State mutability can only be specified for address types. -// ParserError 9106: (169-176): State mutability can only be specified for address types. -// ParserError 9106: (192-199): State mutability can only be specified for address types. -// ParserError 9106: (213-220): State mutability can only be specified for address types. -// ParserError 9106: (239-246): State mutability can only be specified for address types. -// ParserError 9106: (261-268): State mutability can only be specified for address types. -// ParserError 9106: (288-295): State mutability can only be specified for address types. +// ParserError 9106: (150-157): State mutability can only be specified for address types. +// ParserError 9106: (171-178): State mutability can only be specified for address types. +// ParserError 9106: (194-201): State mutability can only be specified for address types. +// ParserError 9106: (215-222): State mutability can only be specified for address types. +// ParserError 9106: (241-248): State mutability can only be specified for address types. +// ParserError 9106: (263-270): State mutability can only be specified for address types. +// ParserError 9106: (290-297): State mutability can only be specified for address types. diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol index cc39855d4..7d26f74c0 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol @@ -5,7 +5,7 @@ contract C { function d(int256 payable) public pure {} function e(uint payable) public pure {} function f(uint256 payable) public pure {} - function g(byte payable) public pure {} + function g(bytes1 payable) public pure {} function h(bytes payable) public pure {} function i(bytes32 payable) public pure {} function j(fixed payable) public pure {} @@ -20,10 +20,10 @@ contract C { // ParserError 9106: (168-175): State mutability can only be specified for address types. // ParserError 9106: (212-219): State mutability can only be specified for address types. // ParserError 9106: (259-266): State mutability can only be specified for address types. -// ParserError 9106: (303-310): State mutability can only be specified for address types. -// ParserError 9106: (348-355): State mutability can only be specified for address types. -// ParserError 9106: (395-402): State mutability can only be specified for address types. -// ParserError 9106: (440-447): State mutability can only be specified for address types. -// ParserError 9106: (490-497): State mutability can only be specified for address types. -// ParserError 9106: (536-543): State mutability can only be specified for address types. -// ParserError 9106: (587-594): State mutability can only be specified for address types. +// ParserError 9106: (305-312): State mutability can only be specified for address types. +// ParserError 9106: (350-357): State mutability can only be specified for address types. +// ParserError 9106: (397-404): State mutability can only be specified for address types. +// ParserError 9106: (442-449): State mutability can only be specified for address types. +// ParserError 9106: (492-499): State mutability can only be specified for address types. +// ParserError 9106: (538-545): State mutability can only be specified for address types. +// ParserError 9106: (589-596): State mutability can only be specified for address types. diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol index b36f9e6d5..2aad9cd04 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol @@ -6,7 +6,7 @@ contract C { int256 payable d; uint payable e; uint256 payable f; - byte payable g; + bytes1 payable g; bytes payable h; bytes32 payable i; fixed payable j; @@ -22,10 +22,10 @@ contract C { // ParserError 9106: (132-139): State mutability can only be specified for address types. // ParserError 9106: (156-163): State mutability can only be specified for address types. // ParserError 9106: (183-190): State mutability can only be specified for address types. -// ParserError 9106: (207-214): State mutability can only be specified for address types. -// ParserError 9106: (232-239): State mutability can only be specified for address types. -// ParserError 9106: (259-266): State mutability can only be specified for address types. -// ParserError 9106: (284-291): State mutability can only be specified for address types. -// ParserError 9106: (314-321): State mutability can only be specified for address types. -// ParserError 9106: (340-347): State mutability can only be specified for address types. -// ParserError 9106: (371-378): State mutability can only be specified for address types. +// ParserError 9106: (209-216): State mutability can only be specified for address types. +// ParserError 9106: (234-241): State mutability can only be specified for address types. +// ParserError 9106: (261-268): State mutability can only be specified for address types. +// ParserError 9106: (286-293): State mutability can only be specified for address types. +// ParserError 9106: (316-323): State mutability can only be specified for address types. +// ParserError 9106: (342-349): State mutability can only be specified for address types. +// ParserError 9106: (373-380): State mutability can only be specified for address types. diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol index 5006936ef..026138cde 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol @@ -5,7 +5,7 @@ contract C { function d() public pure returns (int256 payable) {} function e() public pure returns (uint payable) {} function f() public pure returns (uint256 payable) {} - function g() public pure returns (byte payable) {} + function g() public pure returns (bytes1 payable) {} function h() public pure returns (bytes payable) {} function i() public pure returns (bytes32 payable) {} function j() public pure returns (fixed payable) {} @@ -20,10 +20,10 @@ contract C { // ParserError 9106: (224-231): State mutability can only be specified for address types. // ParserError 9106: (279-286): State mutability can only be specified for address types. // ParserError 9106: (337-344): State mutability can only be specified for address types. -// ParserError 9106: (392-399): State mutability can only be specified for address types. -// ParserError 9106: (448-455): State mutability can only be specified for address types. -// ParserError 9106: (506-513): State mutability can only be specified for address types. -// ParserError 9106: (562-569): State mutability can only be specified for address types. -// ParserError 9106: (623-630): State mutability can only be specified for address types. -// ParserError 9106: (680-687): State mutability can only be specified for address types. -// ParserError 9106: (742-749): State mutability can only be specified for address types. +// ParserError 9106: (394-401): State mutability can only be specified for address types. +// ParserError 9106: (450-457): State mutability can only be specified for address types. +// ParserError 9106: (508-515): State mutability can only be specified for address types. +// ParserError 9106: (564-571): State mutability can only be specified for address types. +// ParserError 9106: (625-632): State mutability can only be specified for address types. +// ParserError 9106: (682-689): State mutability can only be specified for address types. +// ParserError 9106: (744-751): State mutability can only be specified for address types. diff --git a/test/libsolidity/syntaxTests/types/byte.sol b/test/libsolidity/syntaxTests/types/byte.sol new file mode 100644 index 000000000..3945eda04 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/byte.sol @@ -0,0 +1,5 @@ +contract C { + byte public a; +} +// ---- +// ParserError 9182: (17-21): Function, variable, struct or modifier declaration expected. diff --git a/test/libsolidity/syntaxTests/types/bytesNN_upcasting.sol b/test/libsolidity/syntaxTests/types/bytesNN_upcasting.sol index 77ff75240..90f58de14 100644 --- a/test/libsolidity/syntaxTests/types/bytesNN_upcasting.sol +++ b/test/libsolidity/syntaxTests/types/bytesNN_upcasting.sol @@ -1,6 +1,5 @@ contract C { - byte b = byte(0x01); - bytes1 b1 = b; + bytes1 b1 = bytes1(0x01); bytes2 b2 = b1; bytes3 b3 = b2; bytes4 b4 = b3;