From 2c478e85e2a9313d5b0df0e3938e52d20ddd9e06 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Wed, 18 Dec 2019 16:43:31 +0100 Subject: [PATCH 001/479] Sets project version to 0.7.0 --- CMakeLists.txt | 2 +- Changelog.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb8c1a49c811..1bb982ab85e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.1") +set(PROJECT_VERSION "0.7.0") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) include(TestBigEndian) diff --git a/Changelog.md b/Changelog.md index 9b4d81ff7fb5..77faf65048bc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,15 @@ +### 0.7.0 (unreleased) + +Language Features: + + +Compiler Features: + + +Bugfixes: + + + ### 0.6.1 (unreleased) Language Features: From fe1676203d765f7987c6e8d3ae60fbb0a929945f Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Fri, 10 Jan 2020 18:13:34 +0100 Subject: [PATCH 002/479] Updates documentation to 0.7.0. --- docs/050-breaking-changes.rst | 6 ++-- docs/abi-spec.rst | 6 ++-- docs/assembly.rst | 10 +++---- docs/common-patterns.rst | 8 +++--- docs/contracts/abstract-contracts.rst | 4 +-- docs/contracts/constant-state-variables.rst | 2 +- docs/contracts/creating-contracts.rst | 2 +- docs/contracts/events.rst | 4 +-- docs/contracts/function-modifiers.rst | 2 +- docs/contracts/functions.rst | 20 ++++++------- docs/contracts/inheritance.rst | 26 ++++++++--------- docs/contracts/interfaces.rst | 2 +- docs/contracts/libraries.rst | 6 ++-- docs/contracts/using-for.rst | 4 +-- docs/contracts/visibility-and-getters.rst | 12 ++++---- docs/contributing.rst | 2 +- docs/control-structures.rst | 26 ++++++++--------- docs/examples/blind-auction.rst | 4 +-- docs/examples/micropayment.rst | 4 +-- docs/examples/modular.rst | 2 +- docs/examples/safe-remote.rst | 2 +- docs/examples/voting.rst | 2 +- docs/introduction-to-smart-contracts.rst | 4 +-- docs/layout-of-source-files.rst | 2 +- docs/miscellaneous.rst | 4 +-- docs/natspec-format.rst | 2 +- docs/security-considerations.rst | 12 ++++---- docs/structure-of-a-contract.rst | 12 ++++---- docs/style-guide.rst | 32 ++++++++++----------- docs/types/mapping-types.rst | 6 ++-- docs/types/operators.rst | 2 +- docs/types/reference-types.rst | 14 ++++----- docs/types/value-types.rst | 8 +++--- 33 files changed, 127 insertions(+), 127 deletions(-) diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index 497936f31078..383d2440eb3e 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -308,7 +308,7 @@ This will no longer compile with Solidity v0.5.0. However, you can define a comp :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; interface OldContract { function someOldFunction(uint8 a) external; function anotherOldFunction() external returns (bool); @@ -325,7 +325,7 @@ Given the interface defined above, you can now easily use the already deployed p :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; interface OldContract { function someOldFunction(uint8 a) external; @@ -431,7 +431,7 @@ New version: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract OtherContract { uint x; diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst index a3bd78319a5d..f4bfc6b70530 100644 --- a/docs/abi-spec.rst +++ b/docs/abi-spec.rst @@ -232,7 +232,7 @@ Given the contract: :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract Foo { @@ -532,7 +532,7 @@ For example, :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Test { @@ -580,7 +580,7 @@ As an example, the code :: - pragma solidity >=0.4.19 <0.7.0; + pragma solidity >=0.4.19 <0.8.0; pragma experimental ABIEncoderV2; diff --git a/docs/assembly.rst b/docs/assembly.rst index 2bc89ad57aa2..632a892d1e8f 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -72,7 +72,7 @@ without a compiler change. .. code:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; library GetCode { function at(address _addr) public view returns (bytes memory o_code) { @@ -97,7 +97,7 @@ efficient code, for example: .. code:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; library VectorSum { @@ -385,7 +385,7 @@ Local Solidity variables are available for assignments, for example: .. code:: - pragma solidity >=0.4.11 <0.7.0; + pragma solidity >=0.4.11 <0.8.0; contract C { uint b; @@ -425,7 +425,7 @@ declaration visible in the scope of the inline assembly block. .. code:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { function f(uint x) public view returns (uint b) { @@ -689,7 +689,7 @@ Example: We will follow an example compilation from Solidity to assembly. We consider the runtime bytecode of the following Solidity program:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index ab25cb4b9ec9..9c0a0dbc30b2 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -27,7 +27,7 @@ you receive the funds of the person who is now the richest. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract WithdrawalContract { address public richest; @@ -60,7 +60,7 @@ This is as opposed to the more intuitive sending pattern: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract SendContract { address payable public richest; @@ -121,7 +121,7 @@ restrictions highly readable. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract AccessRestriction { // These will be assigned at the construction @@ -273,7 +273,7 @@ function finishes. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract StateMachine { enum Stages { diff --git a/docs/contracts/abstract-contracts.rst b/docs/contracts/abstract-contracts.rst index 51db0dfbedeb..b23cc9e8cecb 100644 --- a/docs/contracts/abstract-contracts.rst +++ b/docs/contracts/abstract-contracts.rst @@ -13,7 +13,7 @@ This can be done by using the ``abstract`` keyword as shown in the following exa defined as abstract, because the function ``utterance()`` was defined, but no implementation was provided (no implementation body ``{ }`` was given).:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; abstract contract Feline { function utterance() public virtual returns (bytes32); @@ -22,7 +22,7 @@ provided (no implementation body ``{ }`` was given).:: Such abstract contracts can not be instantiated directly. This is also true, if an abstract contract itself does implement all defined functions. The usage of an abstract contract as a base class is shown in the following example:: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; abstract contract Feline { function utterance() public virtual returns (bytes32); diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst index 2b4b7ff5b462..5a50ee6e6d79 100644 --- a/docs/contracts/constant-state-variables.rst +++ b/docs/contracts/constant-state-variables.rst @@ -26,7 +26,7 @@ value types and strings. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { uint constant x = 32**22 + 8; diff --git a/docs/contracts/creating-contracts.rst b/docs/contracts/creating-contracts.rst index 90578f784768..504acb9cb6d3 100644 --- a/docs/contracts/creating-contracts.rst +++ b/docs/contracts/creating-contracts.rst @@ -34,7 +34,7 @@ This means that cyclic creation dependencies are impossible. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract OwnedToken { diff --git a/docs/contracts/events.rst b/docs/contracts/events.rst index 46b426d8e66b..b2e3c72d0afc 100644 --- a/docs/contracts/events.rst +++ b/docs/contracts/events.rst @@ -65,7 +65,7 @@ is that they are cheaper to deploy and call. :: - pragma solidity >=0.4.21 <0.7.0; + pragma solidity >=0.4.21 <0.8.0; contract ClientReceipt { event Deposit( @@ -138,7 +138,7 @@ as topics. The event call above can be performed in the same way as :: - pragma solidity >=0.4.10 <0.7.0; + pragma solidity >=0.4.10 <0.8.0; contract C { function f() public payable { diff --git a/docs/contracts/function-modifiers.rst b/docs/contracts/function-modifiers.rst index ad2804302feb..26082226be60 100644 --- a/docs/contracts/function-modifiers.rst +++ b/docs/contracts/function-modifiers.rst @@ -17,7 +17,7 @@ if they are marked ``virtual``. For details, please see :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract owned { constructor() public { owner = msg.sender; } diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index 717961b7c09d..7b04285b74e9 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -23,7 +23,7 @@ unused parameters can be omitted. For example, if you want your contract to accept one kind of external call with two integers, you would use something like the following:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract Simple { uint sum; @@ -55,7 +55,7 @@ Function return variables are declared with the same syntax after the For example, suppose you want to return two results: the sum and the product of two integers passed as function parameters, then you use something like:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract Simple { function arithmetic(uint _a, uint _b) @@ -79,7 +79,7 @@ or you can provide return values (either a single or :ref:`multiple ones`) directly with the ``return`` statement:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract Simple { function arithmetic(uint _a, uint _b) @@ -142,7 +142,7 @@ The following statements are considered modifying the state: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract C { function f(uint a, uint b) public view returns (uint) { @@ -187,7 +187,7 @@ In addition to the list of state modifying statements explained above, the follo :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract C { function f(uint a, uint b) public pure returns (uint) { @@ -280,7 +280,7 @@ Below you can see an example of a Sink contract that uses function ``receive``. :: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; // This contract keeps all Ether sent to it with no way // to get it back. @@ -335,7 +335,7 @@ operations as long as there is enough gas passed on to it. :: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; contract Test { // This function is called for all messages sent to @@ -407,7 +407,7 @@ The following example shows overloading of the function :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract A { function f(uint _in) public pure returns (uint out) { @@ -425,7 +425,7 @@ externally visible functions differ by their Solidity types but not by their ext :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; // This will not compile contract A { @@ -458,7 +458,7 @@ candidate, resolution fails. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract A { function f(uint8 _in) public pure returns (uint8 out) { diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index ee766e474e41..6d4ae725fabd 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -38,7 +38,7 @@ Details are given in the following example. :: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; contract Owned { @@ -125,7 +125,7 @@ Note that above, we call ``mortal.kill()`` to "forward" the destruction request. The way this is done is problematic, as seen in the following example:: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; contract owned { constructor() public { owner = msg.sender; } @@ -154,7 +154,7 @@ A call to ``Final.kill()`` will call ``Base2.kill`` because we specify it explicitly in the final override, but this function will bypass ``Base1.kill``. The way around this is to use ``super``:: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract owned { constructor() public { owner = msg.sender; } @@ -204,7 +204,7 @@ use the ``override`` keyword in the function header as shown in this example: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Base { @@ -227,7 +227,7 @@ bases, it has to explicitly override it: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Base1 { @@ -253,7 +253,7 @@ that already overrides all other functions. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract A { function f() public pure{} } contract B is A {} @@ -293,7 +293,7 @@ of the variable: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract A { @@ -324,7 +324,7 @@ and the ``override`` keyword must be used in the overriding modifier: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Base { @@ -342,7 +342,7 @@ explicitly: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Base1 { @@ -389,7 +389,7 @@ equivalent to ``constructor() public {}``. For example: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract A { uint public a; @@ -419,7 +419,7 @@ The constructors of all the base contracts will be called following the linearization rules explained below. If the base constructors have arguments, derived contracts need to specify all of them. This can be done in two ways:: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract Base { uint x; @@ -478,7 +478,7 @@ error "Linearization of inheritance graph impossible". :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract X {} contract A is X {} @@ -498,7 +498,7 @@ One area where inheritance linearization is especially important and perhaps not :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Base1 { constructor() public {} diff --git a/docs/contracts/interfaces.rst b/docs/contracts/interfaces.rst index 69d4917ccadc..8c4fb25e0535 100644 --- a/docs/contracts/interfaces.rst +++ b/docs/contracts/interfaces.rst @@ -22,7 +22,7 @@ Interfaces are denoted by their own keyword: :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; interface Token { enum TokenType { Fungible, NonFungible } diff --git a/docs/contracts/libraries.rst b/docs/contracts/libraries.rst index 803e53f081df..f1d48855f59f 100644 --- a/docs/contracts/libraries.rst +++ b/docs/contracts/libraries.rst @@ -47,7 +47,7 @@ more advanced example to implement a set). :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; // We define a new struct datatype that will be used to @@ -123,7 +123,7 @@ custom types without the overhead of external function calls: :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; struct bigint { uint[] limbs; @@ -237,7 +237,7 @@ Its value can be obtained from Solidity using the ``.selector`` member as follow :: - pragma solidity >0.5.13 <0.7.0; + pragma solidity >0.5.13 <0.8.0; library L { function f(uint256) external {} diff --git a/docs/contracts/using-for.rst b/docs/contracts/using-for.rst index 32aa71799822..151ad3b72e02 100644 --- a/docs/contracts/using-for.rst +++ b/docs/contracts/using-for.rst @@ -29,7 +29,7 @@ may only be used inside a contract, not inside any of its functions. Let us rewrite the set example from the :ref:`libraries` in this way:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; // This is the same code as before, just without comments @@ -81,7 +81,7 @@ Let us rewrite the set example from the It is also possible to extend elementary types in that way:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; library Search { function indexOf(uint[] storage self, uint value) diff --git a/docs/contracts/visibility-and-getters.rst b/docs/contracts/visibility-and-getters.rst index 3a0905155f10..bf37bc5daa18 100644 --- a/docs/contracts/visibility-and-getters.rst +++ b/docs/contracts/visibility-and-getters.rst @@ -54,7 +54,7 @@ return parameter list for functions. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { function f(uint a) private pure returns (uint b) { return a + 1; } @@ -68,7 +68,7 @@ In the following example, ``D``, can call ``c.getData()`` to retrieve the value :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { uint private data; @@ -112,7 +112,7 @@ when they are declared. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { uint public data = 42; @@ -132,7 +132,7 @@ it evaluates to a state variable. If it is accessed externally :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { uint public data; @@ -151,7 +151,7 @@ to write a function, for example: :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract arrayExample { // public state variable @@ -177,7 +177,7 @@ The next example is more complex: :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Complex { struct Data { diff --git a/docs/contributing.rst b/docs/contributing.rst index 1b50ccaaada3..735e52e4fa1d 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -422,7 +422,7 @@ or ``interface`` using the ``./test/cmdlineTests.sh`` script when you create a P ensure they work and pass tests before creating the PR. Ensure that all code examples begin with a ``pragma`` version that spans the largest where the contract code is valid. -For example ``pragma solidity >=0.4.0 <0.7.0;``. +For example ``pragma solidity >=0.4.0 <0.8.0;``. Running Documentation Tests --------------------------- diff --git a/docs/control-structures.rst b/docs/control-structures.rst index d962a4e26e57..31df68767772 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -41,7 +41,7 @@ Internal Function Calls Functions of the current contract can be called directly ("internally"), also recursively, as seen in this nonsensical example:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { function g(uint a) public pure returns (uint ret) { return a + f(); } @@ -81,7 +81,7 @@ of the contract: :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract InfoFeed { function info() public payable returns (uint ret) { return 42; } @@ -131,7 +131,7 @@ parameters from the function declaration, but can be in arbitrary order. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { mapping(uint => uint) data; @@ -154,7 +154,7 @@ Those parameters will still be present on the stack, but they are inaccessible. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { // omitted name for parameter @@ -177,7 +177,7 @@ is compiled so recursive creation-dependencies are not possible. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract D { uint public x; @@ -237,7 +237,7 @@ groupings of expressions. :: - pragma solidity >0.4.23 <0.7.0; + pragma solidity >0.4.23 <0.8.0; contract C { uint index; @@ -292,7 +292,7 @@ because only a reference and not a copy is passed. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { uint[20] x; @@ -350,7 +350,7 @@ the two variables have the same name but disjoint scopes. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract C { function minimalScoping() pure public { { @@ -371,7 +371,7 @@ In any case, you will get a warning about the outer variable being shadowed. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; // This will report a warning contract C { function f() pure public returns (uint) { @@ -392,7 +392,7 @@ In any case, you will get a warning about the outer variable being shadowed. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; // This will not compile contract C { function f() pure public returns (uint) { @@ -480,7 +480,7 @@ and ``assert`` for internal error checking. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Sharer { function sendHalf(address payable addr) public payable returns (uint balance) { @@ -524,7 +524,7 @@ The following example shows how to use an error string together with ``revert`` :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract VendingMachine { function buy(uint amount) public payable { @@ -567,7 +567,7 @@ A failure in an external call can be caught using a try/catch statement, as foll :: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; interface DataFeed { function getData(address token) external returns (uint value); } diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst index 92a7559738f8..185b1a3426c1 100644 --- a/docs/examples/blind-auction.rst +++ b/docs/examples/blind-auction.rst @@ -24,7 +24,7 @@ to receive their money - contracts cannot activate themselves. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract SimpleAuction { // Parameters of the auction. Times are either @@ -184,7 +184,7 @@ invalid bids. :: - pragma solidity >0.4.23 <0.7.0; + pragma solidity >0.4.23 <0.8.0; contract BlindAuction { struct Bid { diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst index f675586ddfec..f6e8e02c1e7d 100644 --- a/docs/examples/micropayment.rst +++ b/docs/examples/micropayment.rst @@ -142,7 +142,7 @@ The full contract :: - pragma solidity >=0.4.24 <0.7.0; + pragma solidity >=0.4.24 <0.8.0; contract ReceiverPays { address owner = msg.sender; @@ -338,7 +338,7 @@ The full contract :: - pragma solidity >=0.4.24 <0.7.0; + pragma solidity >=0.4.24 <0.8.0; contract SimplePaymentChannel { address payable public sender; // The account sending payments. diff --git a/docs/examples/modular.rst b/docs/examples/modular.rst index a3d932b099e6..0e2dcb10601f 100644 --- a/docs/examples/modular.rst +++ b/docs/examples/modular.rst @@ -19,7 +19,7 @@ and the sum of all balances is an invariant across the lifetime of the contract. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; library Balances { function move(mapping(address => uint256) storage balances, address from, address to, uint amount) internal { diff --git a/docs/examples/safe-remote.rst b/docs/examples/safe-remote.rst index d79c6526e36f..84a7aace414d 100644 --- a/docs/examples/safe-remote.rst +++ b/docs/examples/safe-remote.rst @@ -25,7 +25,7 @@ you can use state machine-like constructs inside a contract. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract Purchase { uint public value; diff --git a/docs/examples/voting.rst b/docs/examples/voting.rst index e4b6da200809..0859d290ec87 100644 --- a/docs/examples/voting.rst +++ b/docs/examples/voting.rst @@ -32,7 +32,7 @@ of votes. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; /// @title Voting with delegation. contract Ballot { diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index fada5d2916af..1f337bae69e9 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -17,7 +17,7 @@ Storage Example :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract SimpleStorage { uint storedData; @@ -77,7 +77,7 @@ registering with a username and password, all you need is an Ethereum keypair. :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Coin { // The keyword "public" makes variables diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 1fec22aec7ea..dc9bc8287a1e 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -284,7 +284,7 @@ for the two function parameters and two return variables. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; /** @title Shape calculator. */ contract ShapeCalculator { diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 085bf99e7638..09978023cec3 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -75,7 +75,7 @@ So for the following contract snippet the position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint256(4) . uint256(1))) + 1``:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { @@ -175,7 +175,7 @@ value and reference types, types that are encoded packed, and nested types. .. code:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { struct S { uint128 a; diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index ae429580a3ce..6f241eda3216 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -49,7 +49,7 @@ The following example shows a contract and a function using all available tags. .. code:: solidity - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; /// @title A simulator for trees /// @author Larry A. Gardner diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 96187403be6f..c18163184d3c 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -58,7 +58,7 @@ complete contract): :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Fund { @@ -81,7 +81,7 @@ as it uses ``call`` which forwards all remaining gas by default: :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Fund { @@ -100,7 +100,7 @@ outlined further below: :: - pragma solidity >=0.4.11 <0.7.0; + pragma solidity >=0.4.11 <0.8.0; contract Fund { /// Mapping of ether shares of the contract. @@ -197,7 +197,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract TxUserWallet { @@ -217,7 +217,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet: :: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; interface TxUserWallet { function transferTo(address payable dest, uint amount) external; @@ -277,7 +277,7 @@ field of a ``struct`` that is the base type of a dynamic storage array. The :: - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >=0.5.0 <0.8.0; contract Map { mapping (uint => uint)[] array; diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst index b6d70c5a3250..e2b43239bf41 100644 --- a/docs/structure-of-a-contract.rst +++ b/docs/structure-of-a-contract.rst @@ -26,7 +26,7 @@ storage. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract SimpleStorage { uint storedData; // State variable @@ -46,7 +46,7 @@ Functions are the executable units of code within a contract. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract SimpleAuction { function bid() public payable { // Function @@ -74,7 +74,7 @@ Like functions, modifiers can be :ref:`overridden `. :: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract Purchase { address public seller; @@ -101,7 +101,7 @@ Events are convenience interfaces with the EVM logging facilities. :: - pragma solidity >=0.4.21 <0.7.0; + pragma solidity >=0.4.21 <0.8.0; contract SimpleAuction { event HighestBidIncreased(address bidder, uint amount); // Event @@ -125,7 +125,7 @@ Structs are custom defined types that can group several variables (see :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Ballot { struct Voter { // Struct @@ -146,7 +146,7 @@ Enums can be used to create custom types with a finite set of 'constant values' :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Purchase { enum State { Created, Locked, Inactive } // Enum diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 84602542f9e3..840e2b331ce8 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -52,7 +52,7 @@ Surround top level declarations in solidity source with two blank lines. Yes:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { // ... @@ -70,7 +70,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { // ... @@ -89,7 +89,7 @@ Blank lines may be omitted between groups of related one-liners (such as stub fu Yes:: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; abstract contract A { function spam() public virtual pure; @@ -109,7 +109,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; abstract contract A { function spam() virtual pure public; @@ -243,7 +243,7 @@ Import statements should always be placed at the top of the file. Yes:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; import "./Owned.sol"; @@ -257,7 +257,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { // ... @@ -290,7 +290,7 @@ Within a grouping, place the ``view`` and ``pure`` functions last. Yes:: - pragma solidity ^0.6.0; + pragma solidity >=0.6.0 <0.8.0; contract A { constructor() public { @@ -326,7 +326,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { @@ -434,7 +434,7 @@ should: Yes:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Coin { struct Bank { @@ -445,7 +445,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract Coin { @@ -745,7 +745,7 @@ manner as modifiers if the function declaration is long or hard to read. Yes:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // Base contracts just to make this compile contract B { @@ -777,7 +777,7 @@ Yes:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // Base contracts just to make this compile @@ -1000,7 +1000,7 @@ As shown in the example below, if the contract name is `Congress` and the librar Yes:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // Owned.sol @@ -1023,7 +1023,7 @@ Yes:: and in ``Congress.sol``:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; import "./Owned.sol"; @@ -1034,7 +1034,7 @@ and in ``Congress.sol``:: No:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // owned.sol @@ -1138,7 +1138,7 @@ multiline comment starting with `/**` and ending with `*/`. For example, the contract from `a simple smart contract `_ with the comments added looks like the one below:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; /// @author The Solidity Team diff --git a/docs/types/mapping-types.rst b/docs/types/mapping-types.rst index 5b41d4bd0cc8..e77dc4911904 100644 --- a/docs/types/mapping-types.rst +++ b/docs/types/mapping-types.rst @@ -42,7 +42,7 @@ contract that returns the value at the specified address. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract MappingExample { mapping(address => uint) public balances; @@ -67,7 +67,7 @@ The example below uses ``_allowances`` to record the amount someone else is allo :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract MappingExample { @@ -121,7 +121,7 @@ the ``sum`` function iterates over to sum all the values. :: - pragma solidity >=0.5.99 <0.7.0; + pragma solidity >=0.5.99 <0.8.0; struct IndexValue { uint keyIndex; uint value; } struct KeyFlag { uint key; bool deleted; } diff --git a/docs/types/operators.rst b/docs/types/operators.rst index c65e545c5446..753a42bf5d24 100644 --- a/docs/types/operators.rst +++ b/docs/types/operators.rst @@ -42,7 +42,7 @@ value it referred to previously. :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract DeleteExample { uint data; diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 15cd110ddc1d..ce9ef9b3a129 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -57,7 +57,7 @@ Data locations are not only relevant for persistency of data, but also for the s :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { // The data location of x is storage. @@ -161,7 +161,7 @@ or create a new memory array and copy every element. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { function f(uint len) public pure { @@ -192,7 +192,7 @@ the first element to ``uint``. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract C { function f() public pure { @@ -208,7 +208,7 @@ memory arrays, i.e. the following is not possible: :: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; // This will not compile. contract C { @@ -268,7 +268,7 @@ Array Members :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract ArrayContract { uint[2**20] m_aLotOfIntegers; @@ -400,7 +400,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete :: - pragma solidity >=0.4.99 <0.7.0; + pragma solidity >=0.4.99 <0.8.0; contract Proxy { /// Address of the client contract managed by proxy i.e., this contract @@ -437,7 +437,7 @@ shown in the following example: :: - pragma solidity >=0.4.11 <0.7.0; + pragma solidity >=0.4.11 <0.8.0; // Defines a new type with two fields. // Declaring a struct outside of a contract allows diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index be7ca1d6e8be..627dc2502482 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -534,7 +534,7 @@ subsequent unsigned integer values starting from ``0``. :: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } @@ -640,7 +640,7 @@ External (or public) functions have the following members: Example that shows how to use the members:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; contract Example { @@ -656,7 +656,7 @@ Example that shows how to use the members:: Example that shows how to use internal function types:: - pragma solidity >=0.4.16 <0.7.0; + pragma solidity >=0.4.16 <0.8.0; library ArrayUtils { @@ -714,7 +714,7 @@ Example that shows how to use internal function types:: Another example that uses external function types:: - pragma solidity >=0.4.22 <0.7.0; + pragma solidity >=0.4.22 <0.8.0; contract Oracle { From 729b47e641c43323671e75c2564788ad47a69903 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Fri, 10 Jan 2020 18:13:57 +0100 Subject: [PATCH 003/479] Updates semantic tests to 0.7.0. --- test/contracts/AuctionRegistrar.cpp | 2 +- test/contracts/FixedFeeRegistrar.cpp | 2 +- test/contracts/Wallet.cpp | 2 +- test/libsolidity/GasCosts.cpp | 18 +++++++++--------- .../uninitializedFunctionPointer/store2.sol | 2 +- .../libsolidity/semanticTests/viaYul/erc20.sol | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index ffe1c349590f..4459b3e67d98 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -42,7 +42,7 @@ namespace { static char const* registrarCode = R"DELIMITER( -pragma solidity >=0.4.0 <0.7.0; +pragma solidity >=0.4.0 <0.8.0; abstract contract NameRegister { function addr(string memory _name) public virtual view returns (address o_owner); diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index acc51c2b9de6..658f41fbd0ce 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -53,7 +53,7 @@ static char const* registrarCode = R"DELIMITER( // @authors: // Gav Wood -pragma solidity >=0.4.0 <0.7.0; +pragma solidity >=0.4.0 <0.8.0; abstract contract Registrar { event Changed(string indexed name); diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 25b81d4d9114..01e07482cea4 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -56,7 +56,7 @@ static char const* walletCode = R"DELIMITER( // some number (specified in constructor) of the set of owners (specified in the constructor, modifiable) before the // interior is executed. -pragma solidity >=0.4.0 <0.7.0; +pragma solidity >=0.4.0 <0.8.0; contract multiowned { diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index de90c9076bf8..1e1edb7c6d98 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(string_storage) auto evmVersion = dev::test::Options::get().evmVersion(); if (evmVersion <= EVMVersion::byzantium()) - CHECK_DEPLOY_GAS(134209, 130895, evmVersion); + CHECK_DEPLOY_GAS(134145, 130831, evmVersion); // This is only correct on >=Constantinople. else if (Options::get().useABIEncoderV2) { @@ -107,22 +107,22 @@ BOOST_AUTO_TEST_CASE(string_storage) { // Costs with 0 are cases which cannot be triggered in tests. if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(0, 124033, evmVersion); + CHECK_DEPLOY_GAS(0, 123969, evmVersion); else - CHECK_DEPLOY_GAS(0, 110981, evmVersion); + CHECK_DEPLOY_GAS(0, 110969, evmVersion); } else { if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(147835, 131687, evmVersion); + CHECK_DEPLOY_GAS(147835, 123969, evmVersion); else - CHECK_DEPLOY_GAS(131871, 117231, evmVersion); + CHECK_DEPLOY_GAS(131871, 110969, evmVersion); } } else if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(126993, 119723, evmVersion); + CHECK_DEPLOY_GAS(126929, 119659, evmVersion); else - CHECK_DEPLOY_GAS(114357, 107347, evmVersion); + CHECK_DEPLOY_GAS(114345, 107335, evmVersion); if (evmVersion >= EVMVersion::byzantium()) { @@ -142,9 +142,9 @@ BOOST_AUTO_TEST_CASE(string_storage) else { if (evmVersion < EVMVersion::istanbul()) - CHECK_GAS(21707, 21635, 20); + CHECK_GAS(21707, 21559, 20); else - CHECK_GAS(21499, 21431, 20); + CHECK_GAS(21499, 21351, 20); } } else if (evmVersion < EVMVersion::istanbul()) diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol index 527ec52c1484..8351565679ee 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol @@ -1,4 +1,4 @@ -pragma solidity >=0.5.7 <0.7.0; +pragma solidity >=0.4.0 <0.8.0; contract InvalidTest { diff --git a/test/libsolidity/semanticTests/viaYul/erc20.sol b/test/libsolidity/semanticTests/viaYul/erc20.sol index 6b524e0bf4be..2ba09521cd7e 100644 --- a/test/libsolidity/semanticTests/viaYul/erc20.sol +++ b/test/libsolidity/semanticTests/viaYul/erc20.sol @@ -1,4 +1,4 @@ -pragma solidity >=0.4.0 <0.7.0; +pragma solidity >=0.4.0 <0.8.0; contract ERC20 { event Transfer(address indexed from, address indexed to, uint256 value); From c62048a50a397da1294a5122bbc4b07bac1d9cf7 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Fri, 10 Jan 2020 18:55:28 +0100 Subject: [PATCH 004/479] Updates readme to 0.7.0. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4729c95c067b..8eef61b829c4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ found in the [Solidity documentation](https://solidity.readthedocs.io/en/latest/ A "Hello World" program in Solidity is of even less use than in other languages, but still: ```solidity -pragma solidity ^0.6.0; +pragma solidity >=0.6.0 <0.8.0; contract HelloWorld { function helloWorld() external pure returns (string memory) { From 7fec5f9548ab9cb99c08d77b52b3b2daf0bfa20f Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Sat, 11 Jan 2020 16:53:28 +0100 Subject: [PATCH 005/479] Fixes unused variables that break osx build. --- test/libsolidity/SolidityEndToEndTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 72772f048620..c1ed1d67e95b 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -14319,8 +14319,6 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name) )"; compileAndRun(sourceCode, 0, "ClientReceipt", bytes()); compileAndRun(sourceCode, 0, "Test", bytes(), map{{"ClientReceipt", m_contractAddress}}); - u256 value(18); - u256 id(0x1234); callContractFunction("f()"); BOOST_REQUIRE_EQUAL(numLogs(), 1); From 3beaae682219f0cee054f2c76804e779bc552b87 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 24 Mar 2020 15:21:35 +0100 Subject: [PATCH 006/479] Fix pragma. --- docs/using-the-compiler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 12fe4b3f9917..d143dc484270 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -687,7 +687,7 @@ The command above applies all changes as shown below. Please review them careful .. code-block:: none - pragma solidity >=0.6.0 <0.7.0; + pragma solidity >=0.6.0 <0.8.0; abstract contract Updateable { function run() public view virtual returns (bool); From 042ccd24ab43396d1144abcbe438e74a7c7d9143 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 3 Apr 2020 13:26:57 +0530 Subject: [PATCH 007/479] Added error message for virtual (library) functions; test case --- libsolidity/analysis/TypeChecker.cpp | 2 ++ .../syntaxTests/inheritance/virtual/library_err.sol | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 1345fbf90008..9ddc766b88ce 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -332,6 +332,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function) m_errorReporter.warning(_function.location(), "Interface functions are implicitly \"virtual\""); if (_function.visibility() == Visibility::Private) m_errorReporter.typeError(_function.location(), "\"virtual\" and \"private\" cannot be used together."); + if (isLibraryFunction) + m_errorReporter.typeError(_function.location(), "Library functions cannot be \"virtual\"."); } if (_function.isPayable()) diff --git a/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol b/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol new file mode 100644 index 000000000000..627be82ffbd6 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol @@ -0,0 +1,5 @@ +library L { + function f() internal pure virtual returns (uint) { return 0; } +} +// ---- +// TypeError: (16-79): Library functions cannot be "virtual". From 35a743e2224f1da14566dae331c16bb9056ca10b Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 3 Apr 2020 15:11:22 +0530 Subject: [PATCH 008/479] Added a changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index de4596433c67..e5822af12c46 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ Bugfixes: * Inline Assembly: Fix internal error when accessing incorrect constant variables. * Inheritance: Allow public state variables to override functions with dynamic memory types in their return values. * JSON AST: Always add pointer suffix for memory reference types. + * Type Checker: Disallow virtual for library functions. ### 0.6.4 (2020-03-10) From 7e2cb9b57c59c41ef0383b4133ae1270297360ed Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 3 Apr 2020 15:49:50 +0530 Subject: [PATCH 009/479] Removed virtual from a library function in gnosis test --- test/compilationTests/gnosis/Utils/Math.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 93e2375c28d2..090c935ec5d3 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -177,7 +177,6 @@ library Math { /// @param nums Numbers to look through /// @return max Maximum number function max(int[] memory nums) - virtual public pure returns (int max) From 532214f5e13910fbdbb0d1121efe8422ff10e056 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Mon, 6 Apr 2020 14:21:19 +0530 Subject: [PATCH 010/479] Moved changelog entry to 0.7.0 --- Changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index e5822af12c46..1b974d6565f9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### 0.7.0 (unreleased) +Breaking changes: + * Type Checker: Disallow virtual for library functions. + Language Features: @@ -21,7 +24,6 @@ Bugfixes: * Inline Assembly: Fix internal error when accessing incorrect constant variables. * Inheritance: Allow public state variables to override functions with dynamic memory types in their return values. * JSON AST: Always add pointer suffix for memory reference types. - * Type Checker: Disallow virtual for library functions. ### 0.6.4 (2020-03-10) From abee23251b386ef430aba5599726c0ee6bccf1d4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Apr 2020 11:52:01 +0200 Subject: [PATCH 011/479] Fix pragma requirement. --- docs/contracts/constant-state-variables.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst index 7a0a7380a555..b706e5fcfcf9 100644 --- a/docs/contracts/constant-state-variables.rst +++ b/docs/contracts/constant-state-variables.rst @@ -17,7 +17,7 @@ Not all types for constants and immutables are implemented at this time. The onl :: - pragma solidity >0.6.4 <0.7.0; + pragma solidity >0.6.4 <0.8.0; contract C { uint constant X = 32**22 + 8; From 051eec5c51d3a4d1756b396b9595ef65c55f93e5 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 3 Apr 2020 17:13:33 +0530 Subject: [PATCH 012/479] Converted warnings for .gas and .value into an error --- libsolidity/analysis/TypeChecker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 3112e6d0e383..2316ceb21334 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2526,7 +2526,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) !annotation.referencedDeclaration && (memberName == "value" || memberName == "gas") ) - m_errorReporter.warning( + m_errorReporter.typeError( _memberAccess.location(), "Using \"." + memberName + "(...)\" is deprecated. Use \"{" + memberName + ": ...}\" instead." ); From eb4cff56f7c6cd8c3ac1ffc9f4d28bd681d643c8 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Wed, 22 Apr 2020 21:56:59 +0530 Subject: [PATCH 013/479] Upgrade dot syntax for gas and value --- tools/CMakeLists.txt | 1 + tools/solidityUpgrade/SourceTransform.h | 74 +++++++++++++++++++++++++ tools/solidityUpgrade/SourceUpgrade.cpp | 2 + tools/solidityUpgrade/SourceUpgrade.h | 13 ++++- tools/solidityUpgrade/Upgrade070.cpp | 42 ++++++++++++++ tools/solidityUpgrade/Upgrade070.h | 35 ++++++++++++ tools/solidityUpgrade/main.cpp | 13 ++++- 7 files changed, 175 insertions(+), 5 deletions(-) create mode 100644 tools/solidityUpgrade/Upgrade070.cpp create mode 100644 tools/solidityUpgrade/Upgrade070.h diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 241a80f46e89..e2e701542797 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -5,6 +5,7 @@ add_executable(solidity-upgrade solidityUpgrade/UpgradeSuite.h solidityUpgrade/Upgrade050.cpp solidityUpgrade/Upgrade060.cpp + solidityUpgrade/Upgrade070.cpp solidityUpgrade/SourceTransform.h solidityUpgrade/SourceUpgrade.cpp ) diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index 2b42471c15f5..08dfa3f35772 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -19,11 +19,32 @@ #include +#include #include namespace solidity::tools { +/** + * Helper for displaying location during asserts + */ +class LocationHelper +{ + std::stringstream m_stream; + +public: + + template + LocationHelper& operator<<(T const& data) + { + m_stream << data; + return *this; + } + + operator std::string() { return m_stream.str(); } +}; + + /** * Helper that provides functions which analyze certain source locations * on a textual base. They utilize regular expression to search for @@ -154,6 +175,59 @@ class SourceTransform _expression ); } + + static std::string gasUpdate(langutil::SourceLocation const& _location) + { + // dot, "gas", any number of whitespaces, left bracket + std::regex gasReg{"\\.gas\\s*\\("}; + + if (regex_search(_location.text(), gasReg)) + { + std::string out = regex_replace( + _location.text(), + gasReg, + "{gas: ", + std::regex_constants::format_first_only + ); + return regex_replace(out, std::regex{"\\)$"}, "}"); + } + else + solAssert( + false, + LocationHelper() + << "Regex count not match: " << _location.text() << " at " << _location + << "\nNeeds to be fixed manually." + ); + + + return ""; + } + + static std::string valueUpdate(langutil::SourceLocation const& _location) + { + // dot, "value", any number of whitespaces, left bracket + std::regex valueReg{"\\.value\\s*\\("}; + + if (regex_search(_location.text(), valueReg)) + { + std::string out = regex_replace( + _location.text(), + valueReg, + "{value: ", + std::regex_constants::format_first_only + ); + return regex_replace(out, std::regex{"\\)$"}, "}"); + } + else + solAssert( + false, + LocationHelper() + << "Regex count not match: " << _location.text() << " at " << _location + << "\nNeeds to be fixed manually" + ); + + return ""; + } }; } diff --git a/tools/solidityUpgrade/SourceUpgrade.cpp b/tools/solidityUpgrade/SourceUpgrade.cpp index 8c05ecc9fda2..04f83eeeec92 100644 --- a/tools/solidityUpgrade/SourceUpgrade.cpp +++ b/tools/solidityUpgrade/SourceUpgrade.cpp @@ -194,6 +194,8 @@ Allowed options)", m_suite.activateModule(Module::OverridingFunction); else if (module == "virtual") m_suite.activateModule(Module::VirtualFunction); + else if (module == "dotsyntax") + m_suite.activateModule(Module::DotSyntax); else { error() << "Unknown upgrade module \"" + module + "\"" << endl; diff --git a/tools/solidityUpgrade/SourceUpgrade.h b/tools/solidityUpgrade/SourceUpgrade.h index 9ace60e575af..9fb7a5ee224e 100644 --- a/tools/solidityUpgrade/SourceUpgrade.h +++ b/tools/solidityUpgrade/SourceUpgrade.h @@ -1,4 +1,4 @@ -/* +/* This file is part of solidity. solidity is free software: you can redistribute it and/or modify @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,8 @@ class SourceUpgrade VisibilitySpecifier, AbstractContract, OverridingFunction, - VirtualFunction + VirtualFunction, + DotSyntax }; /// Upgrade suite that hosts all available modules. @@ -78,6 +80,10 @@ class SourceUpgrade OverridingFunction{m_changes}.analyze(_sourceUnit); if (isActivated(Module::VirtualFunction)) VirtualFunction{m_changes}.analyze(_sourceUnit); + + /// Solidity 0.7.0 + if (isActivated(Module::DotSyntax)) + DotSyntax{m_changes}.analyze(_sourceUnit); } void activateModule(Module _module) { m_modules.insert(_module); } @@ -96,7 +102,8 @@ class SourceUpgrade Module::VisibilitySpecifier, Module::AbstractContract, Module::OverridingFunction, - Module::VirtualFunction + Module::VirtualFunction, + Module::DotSyntax }; }; diff --git a/tools/solidityUpgrade/Upgrade070.cpp b/tools/solidityUpgrade/Upgrade070.cpp new file mode 100644 index 000000000000..c38ae2b97331 --- /dev/null +++ b/tools/solidityUpgrade/Upgrade070.cpp @@ -0,0 +1,42 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +n You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +#include +#include + +using namespace solidity::frontend; +using namespace solidity::tools; + +void DotSyntax::endVisit(FunctionCall const& _functionCall) +{ + TypePointer type = _functionCall.annotation().type; + if (auto const funcType = dynamic_cast(type)) + { + if (funcType->valueSet()) + m_changes.emplace_back( + UpgradeChange::Level::Safe, + _functionCall.location(), + SourceTransform::valueUpdate(_functionCall.location()) + ); + + if (funcType->gasSet()) + m_changes.emplace_back( + UpgradeChange::Level::Safe, + _functionCall.location(), + SourceTransform::gasUpdate(_functionCall.location()) + ); + } +} diff --git a/tools/solidityUpgrade/Upgrade070.h b/tools/solidityUpgrade/Upgrade070.h new file mode 100644 index 000000000000..29d689f974c2 --- /dev/null +++ b/tools/solidityUpgrade/Upgrade070.h @@ -0,0 +1,35 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +#pragma once + +#include + +#include + +namespace solidity::tools +{ + +class DotSyntax: public AnalysisUpgrade +{ +public: + using AnalysisUpgrade::AnalysisUpgrade; + void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } +private: + void endVisit(frontend::FunctionCall const& _expression) override; +}; + +} diff --git a/tools/solidityUpgrade/main.cpp b/tools/solidityUpgrade/main.cpp index 0f2b7a473500..9bbc3a0afcd3 100644 --- a/tools/solidityUpgrade/main.cpp +++ b/tools/solidityUpgrade/main.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -74,8 +75,16 @@ int main(int argc, char** argv) if (!upgrade.parseArguments(argc, argv)) return 1; upgrade.printPrologue(); - if (!upgrade.processInput()) - return 1; + + try + { + if (!upgrade.processInput()) + return 1; + } + catch (boost::exception const& _exception) + { + cerr << "Exception while processing input: " << boost::diagnostic_information(_exception) << endl; + } return 0; } From 644ae320a46a81c7e317fc5af34a68249330d92e Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 24 Apr 2020 15:40:04 +0530 Subject: [PATCH 014/479] Fixed infinite loops --- tools/solidityUpgrade/SourceTransform.h | 87 ++++++++++++++++++------- 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index 08dfa3f35772..b9250ae6a050 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -50,7 +50,8 @@ class LocationHelper * on a textual base. They utilize regular expression to search for * keywords or to determine formatting. */ -class SourceAnalysis { +class SourceAnalysis +{ public: static bool isMultilineKeyword( langutil::SourceLocation const& _location, @@ -103,6 +104,7 @@ class SourceGeneration for (auto inheritedContract: _contracts) overrideList += inheritedContract->name() + ","; + // Note: Can create incorrect replacements return "override(" + overrideList.substr(0, overrideList.size() - 1) + ")"; } }; @@ -123,11 +125,21 @@ class SourceTransform std::string const& _expression ) { - return regex_replace( - _location.text(), - std::regex{"(\\b" + _keyword + "\\b)"}, - _expression + " " + _keyword - ); + auto _regex = std::regex{"(\\b" + _keyword + "\\b)"}; + if (regex_search(_location.text(), _regex)) + return regex_replace( + _location.text(), + _regex, + _expression + " " + _keyword + ); + else + solAssert( + false, + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." + ); + + return ""; } /// Searches for the keyword given and appends the expression. @@ -142,7 +154,17 @@ class SourceTransform std::string toAppend = isMultiline ? ("\n " + _expression) : (" " + _expression); std::regex keyword{"(\\b" + _keyword + "\\b)"}; - return regex_replace(_location.text(), keyword, _keyword + toAppend); + if (regex_search(_location.text(), keyword)) + return regex_replace(_location.text(), keyword, _keyword + toAppend); + else + solAssert( + false, + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." + ); + + return ""; + } /// Searches for the first right parenthesis and appends the expression @@ -153,11 +175,21 @@ class SourceTransform std::string const& _expression ) { - return regex_replace( - _location.text(), - std::regex{"(\\))"}, - ") " + _expression - ); + auto _regex = std::regex{"(\\))"}; + if (regex_search(_location.text(), _regex)) + return regex_replace( + _location.text(), + std::regex{"(\\))"}, + ") " + _expression + ); + else + solAssert( + false, + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." + ); + + return ""; } /// Searches for the `function` keyword and its identifier and replaces @@ -169,11 +201,21 @@ class SourceTransform std::string const& _expression ) { - return regex_replace( - _location.text(), - std::regex{"(\\bfunction\\s*" + _name + "\\b)"}, - _expression - ); + auto _regex = std::regex{ "(\\bfunction\\s*" + _name + "\\b)"}; + if (regex_search(_location.text(), _regex)) + return regex_replace( + _location.text(), + _regex, + _expression + ); + else + solAssert( + false, + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." + ); + + return ""; } static std::string gasUpdate(langutil::SourceLocation const& _location) @@ -194,12 +236,10 @@ class SourceTransform else solAssert( false, - LocationHelper() - << "Regex count not match: " << _location.text() << " at " << _location - << "\nNeeds to be fixed manually." + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." ); - return ""; } @@ -221,9 +261,8 @@ class SourceTransform else solAssert( false, - LocationHelper() - << "Regex count not match: " << _location.text() << " at " << _location - << "\nNeeds to be fixed manually" + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." ); return ""; From bd0b06e8dbb86252357a0771be25b9879731caba Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Fri, 3 Apr 2020 19:59:17 +0530 Subject: [PATCH 015/479] Tests, Docs and Changelog --- Changelog.md | 1 + docs/control-structures.rst | 8 +++---- docs/types/value-types.rst | 21 +++++++++---------- .../MultiSigWallet/MultiSigWallet.sol | 2 +- .../MultiSigWalletWithDailyLimit.sol | 2 +- .../milestonetracker/MilestoneTracker.sol | 2 +- test/contracts/Wallet.cpp | 4 ++-- test/externalTests/solc-js/DAO/DAO.sol | 6 +++--- .../solc-js/DAO/ManagedAccount.sol | 2 +- .../solc-js/DAO/TokenCreation.sol | 4 ++-- test/libsolidity/SolidityEndToEndTest.cpp | 8 +++---- .../calling_nonexisting_contract_throws.sol | 2 +- .../functionCall/gas_and_value_basic.sol | 4 ++-- .../intheritance/value_for_constructor.sol | 2 +- .../semanticTests/various/value_complex.sol | 2 +- .../semanticTests/various/value_insane.sol | 2 +- .../types/function_type_members.sol | 5 ----- .../functionCalls/calloptions_repeated.sol | 9 +++----- ...all_value_on_non_payable_function_type.sol | 4 ++-- ...n.sol => error_deprecate_gas_function.sol} | 2 +- ... => error_deprecate_value_constructor.sol} | 2 +- ...sol => error_deprecate_value_function.sol} | 2 +- .../348_unused_return_value_call_value.sol | 5 +---- .../361_calling_payable.sol | 4 ---- .../363_non_payable_constructor.sol | 4 ++-- .../gas_value_without_call.sol | 12 ----------- .../gas_with_call_nonpayable.sol | 19 ++--------------- .../viewPureChecker/staticcall_gas_view.sol | 4 ---- .../value_with_call_nonpayable.sol | 17 ++------------- 29 files changed, 51 insertions(+), 110 deletions(-) rename test/libsolidity/syntaxTests/functionTypes/{warn_deprecate_gas_function.sol => error_deprecate_gas_function.sol} (60%) rename test/libsolidity/syntaxTests/functionTypes/{warn_deprecate_value_constructor.sol => error_deprecate_value_constructor.sol} (66%) rename test/libsolidity/syntaxTests/functionTypes/{warn_deprecate_value_function.sol => error_deprecate_value_function.sol} (60%) diff --git a/Changelog.md b/Changelog.md index d62d7ca06b40..ff85e9e14d9d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ Breaking changes: * Type Checker: Disallow virtual for library functions. + * Deprecated dot syntax for `value` and `gas`. Language Features: diff --git a/docs/control-structures.rst b/docs/control-structures.rst index a633b9b96dbd..f098e1a11129 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -123,9 +123,9 @@ throws an exception or goes out of gas. so your contract is not vulnerable to a reentrancy exploit. .. note:: - Before Solidity 0.6.2, the recommended way to specify the value and gas - was to use ``f.value(x).gas(g)()``. This is still possible but deprecated - and will be removed with Solidity 0.7.0. + Before Solidity 0.6.2, the recommended way to specify the value and gas was to + use ``f.value(x).gas(g)()``. This was deprecated in Solidity 0.6.2 and is no + longer possible since Solidity 0.7.0. Named Calls and Anonymous Function Parameters --------------------------------------------- @@ -716,4 +716,4 @@ in scope in the block that follows. out-of-gas situation and not a deliberate error condition: The caller always retains 63/64th of the gas in a call and thus even if the called contract goes out of gas, the caller still - has some gas left. \ No newline at end of file + has some gas left. diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index ba79adcb7218..521f5e1ef794 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -641,17 +641,18 @@ External (or public) functions have the following members: * ``.address`` returns the address of the contract of the function. * ``.selector`` returns the :ref:`ABI function selector ` -* ``.gas(uint)`` returns a callable function object which, when called, will send - the specified amount of gas to the target function. Deprecated - use ``{gas: ...}`` instead. - See :ref:`External Function Calls ` for more information. -* ``.value(uint)`` returns a callable function object which, when called, will - send the specified amount of wei to the target function. Deprecated - use ``{value: ...}`` instead. - See :ref:`External Function Calls ` for more information. + +.. note:: + External (or public) functions used to have the additional members + ``.gas(uint)`` and ``.value(uint)``. These were deprecated in Solidity 0.6.2 + and removed in Solidity 0.7.0. Instead use ``{gas: ...}`` and ``{value: ...}`` + to specify the amount of gas or the amount of wei sent to a function, + respectively. See :ref:`External Function Calls ` for + more information. Example that shows how to use the members:: - pragma solidity >=0.6.0 <0.8.0; - // This will report a warning + pragma solidity >=0.6.4 <0.8.0; contract Example { function f() public payable returns (bytes4) { @@ -660,9 +661,7 @@ Example that shows how to use the members:: } function g() public { - this.f.gas(10).value(800)(); - // New syntax: - // this.f{gas: 10, value: 800}() + this.f{gas: 10, value: 800}(); } } diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol index 8bf4ebe4bcca..cbb4355e8a8a 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol @@ -227,7 +227,7 @@ contract MultiSigWallet { { if (isConfirmed(transactionId)) { Transaction storage tx = transactions[transactionId]; - (tx.executed,) = tx.destination.call.value(tx.value)(tx.data); + (tx.executed,) = tx.destination.call{value: tx.value}(tx.data); if (tx.executed) emit Execution(transactionId); else diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol index 65116d9f05c5..9cb9a259fd70 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol @@ -48,7 +48,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) { if (!confirmed) spentToday += tx.value; - (tx.executed,) = tx.destination.call.value(tx.value)(tx.data); + (tx.executed,) = tx.destination.call{value: tx.value}(tx.data); if (tx.executed) emit Execution(transactionId); else { diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index c222d0a9deb7..d20a8d969ee0 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -360,7 +360,7 @@ contract MilestoneTracker { // Recheck again to not pay twice if (milestone.status == MilestoneStatus.AuthorizedForPayment) revert(); milestone.status = MilestoneStatus.AuthorizedForPayment; - (bool success,) = milestone.paymentSource.call.value(0)(milestone.payData); + (bool success,) = milestone.paymentSource.call{value: 0}(milestone.payData); require(success); emit ProposalStatusChanged(_idMilestone, milestone.status); } diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 033920dfa9ae..b219c3ec6910 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -395,7 +395,7 @@ contract Wallet is multisig, multiowned, daylimit { if (underLimit(_value)) { emit SingleTransact(msg.sender, _value, _to, _data); // yes - just execute the call. - _to.call.value(_value)(_data); + _to.call{value: _value}(_data); return 0; } // determine our operation hash. @@ -412,7 +412,7 @@ contract Wallet is multisig, multiowned, daylimit { // to determine the body of the transaction from the hash provided. function confirm(bytes32 _h) onlymanyowners(_h) public override returns (bool) { if (m_txs[_h].to != 0x0000000000000000000000000000000000000000) { - m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data); + m_txs[_h].to.call{value: m_txs[_h].value}(m_txs[_h].data); emit MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data); delete m_txs[_h]; return true; diff --git a/test/externalTests/solc-js/DAO/DAO.sol b/test/externalTests/solc-js/DAO/DAO.sol index 46b68bf2a264..0153db9d7bb6 100644 --- a/test/externalTests/solc-js/DAO/DAO.sol +++ b/test/externalTests/solc-js/DAO/DAO.sol @@ -587,7 +587,7 @@ contract DAO is DAOInterface, Token, TokenCreation { // multiple times out of the DAO p.proposalPassed = true; - (bool success,) = p.recipient.call.value(p.amount)(_transactionData); + (bool success,) = p.recipient.call{value: p.amount}(_transactionData); if (!success) revert(); @@ -663,7 +663,7 @@ contract DAO is DAOInterface, Token, TokenCreation { uint fundsToBeMoved = (balances[msg.sender] * p.splitData[0].splitBalance) / p.splitData[0].totalSupply; - if (p.splitData[0].newDAO.createTokenProxy.value(fundsToBeMoved)(msg.sender) == false) + if (p.splitData[0].newDAO.createTokenProxy{value: fundsToBeMoved}(msg.sender) == false) revert(); @@ -697,7 +697,7 @@ contract DAO is DAOInterface, Token, TokenCreation { function newContract(address payable _newContract) public override { if (msg.sender != address(this) || !allowedRecipients[_newContract]) return; // move all ether - (bool success,) = _newContract.call.value(address(this).balance)(""); + (bool success,) = _newContract.call{value: address(this).balance}(""); if (!success) { revert(); } diff --git a/test/externalTests/solc-js/DAO/ManagedAccount.sol b/test/externalTests/solc-js/DAO/ManagedAccount.sol index 0b334d2aa1a0..11b0b3c326c6 100644 --- a/test/externalTests/solc-js/DAO/ManagedAccount.sol +++ b/test/externalTests/solc-js/DAO/ManagedAccount.sol @@ -57,7 +57,7 @@ contract ManagedAccount is ManagedAccountInterface{ function payOut(address payable _recipient, uint _amount) public override returns (bool) { if (msg.sender != owner || (payOwnerOnly && _recipient != owner)) revert(); - (bool success,) = _recipient.call.value(_amount)(""); + (bool success,) = _recipient.call{value: _amount}(""); if (success) { emit PayOut(_recipient, _amount); return true; diff --git a/test/externalTests/solc-js/DAO/TokenCreation.sol b/test/externalTests/solc-js/DAO/TokenCreation.sol index d85cb50b9167..489ce3902e28 100644 --- a/test/externalTests/solc-js/DAO/TokenCreation.sol +++ b/test/externalTests/solc-js/DAO/TokenCreation.sol @@ -106,7 +106,7 @@ override returns (bool success) { && (privateCreation == 0x0000000000000000000000000000000000000000 || privateCreation == msg.sender)) { uint token = (msg.value * 20) / divisor(); - address(extraBalance).call.value(msg.value - token)(""); + address(extraBalance).call{value: msg.value - token}(""); balances[_tokenHolder] += token; totalSupply += token; weiGiven[_tokenHolder] += msg.value; @@ -127,7 +127,7 @@ override returns (bool success) { extraBalance.payOut(address(this), extraBalance.accumulatedInput()); // Execute refund - (bool success,) = msg.sender.call.value(weiGiven[msg.sender])(""); + (bool success,) = msg.sender.call{value: weiGiven[msg.sender]}(""); if (success) { emit Refund(msg.sender, weiGiven[msg.sender]); totalSupply -= balances[msg.sender]; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 69e645494cec..40923032c779 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2382,7 +2382,7 @@ BOOST_AUTO_TEST_CASE(generic_call) function doSend(address rec) public returns (uint d) { bytes4 signature = bytes4(bytes32(keccak256("recv(uint256)"))); - rec.call.value(2)(abi.encodeWithSelector(signature, 23)); + rec.call{value: 2}(abi.encodeWithSelector(signature, 23)); return receiver(rec).received(); } } @@ -5210,7 +5210,7 @@ BOOST_AUTO_TEST_CASE(failed_create) constructor() public payable {} function f(uint amount) public returns (D) { x++; - return (new D).value(amount)(); + return (new D){value: amount}(); } function stack(uint depth) public returns (address) { if (depth < 1024) @@ -5278,7 +5278,7 @@ BOOST_AUTO_TEST_CASE(mutex) // NOTE: It is very bad practice to write this function this way. // Please refer to the documentation of how to do this properly. if (amount > shares) revert(); - (bool success,) = msg.sender.call.value(amount)(""); + (bool success,) = msg.sender.call{value: amount}(""); require(success); shares -= amount; return shares; @@ -5287,7 +5287,7 @@ BOOST_AUTO_TEST_CASE(mutex) // NOTE: It is very bad practice to write this function this way. // Please refer to the documentation of how to do this properly. if (amount > shares) revert(); - (bool success,) = msg.sender.call.value(amount)(""); + (bool success,) = msg.sender.call{value: amount}(""); require(success); shares -= amount; return shares; diff --git a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol index 2ccfc064c81d..5215c9ccb5f4 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol @@ -12,7 +12,7 @@ contract C { } function g() public returns (uint256) { - d.g.gas(200)(); + d.g{gas: 200}(); return 7; } diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol index aaafb6f28293..d7c48d42b395 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol @@ -23,11 +23,11 @@ contract test { } function sendAmount(uint256 amount) public payable returns (uint256 bal) { - return h.getBalance.value(amount)(); + return h.getBalance{value: amount}(); } function outOfGas() public returns (bool ret) { - h.setFlag.gas(2)(); // should fail due to OOG + h.setFlag{gas: 2}(); // should fail due to OOG return true; } diff --git a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol index 5cd0bc1772f8..141dbae2f296 100644 --- a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol +++ b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol @@ -21,7 +21,7 @@ contract Main { Helper h; constructor() public payable { - h = (new Helper).value(10)("abc", true); + h = (new Helper){value: 10}("abc", true); } function getFlag() public returns (bool ret) { diff --git a/test/libsolidity/semanticTests/various/value_complex.sol b/test/libsolidity/semanticTests/various/value_complex.sol index 19d11342f3cc..b5be00ff5692 100644 --- a/test/libsolidity/semanticTests/various/value_complex.sol +++ b/test/libsolidity/semanticTests/various/value_complex.sol @@ -14,7 +14,7 @@ contract test { function sendAmount(uint256 amount) public payable returns (uint256 bal) { uint256 someStackElement = 20; - return h.getBalance.value(amount).gas(1000).value(amount + 3)(); + return h.getBalance{value: amount + 3, gas: 1000}(); } } diff --git a/test/libsolidity/semanticTests/various/value_insane.sol b/test/libsolidity/semanticTests/various/value_insane.sol index d74a0f7f455d..2e6622325266 100644 --- a/test/libsolidity/semanticTests/various/value_insane.sol +++ b/test/libsolidity/semanticTests/various/value_insane.sol @@ -13,7 +13,7 @@ contract test { } function sendAmount(uint256 amount) public returns (uint256 bal) { - return h.getBalance.value(amount).gas(1000).value(amount + 3)(); // overwrite value + return h.getBalance{value: amount + 3, gas: 1000}(); } } diff --git a/test/libsolidity/smtCheckerTests/types/function_type_members.sol b/test/libsolidity/smtCheckerTests/types/function_type_members.sol index 923767dd7366..4b116503c91f 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_members.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_members.sol @@ -2,13 +2,8 @@ pragma experimental SMTChecker; contract C { function f(function(uint) external payable g) internal { g.selector; - g.gas(2).value(3)(4); g{gas: 2, value: 3}(4); } } // ---- -// Warning: (122-127): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (122-136): Using ".value(...)" is deprecated. Use "{value: ...}" instead. // Warning: (108-118): Assertion checker does not yet support this expression. -// Warning: (122-130): Assertion checker does not yet implement this type of function call. -// Warning: (122-139): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol index 181b325b05f4..460c2c51cca6 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol @@ -4,7 +4,6 @@ contract C { this.foo{value:2, gas: 5}{gas:2}; (this.foo{value:2, gas: 5}){gas:2}; this.foo{value:2, gas: 5}{value:6}; - this.foo.value(4){value:2, gas: 5}; this.foo{gas:2, value: 5}{value:2, gas:5}; new D{salt:"abc"}{salt:"a"}(); } @@ -15,8 +14,6 @@ contract C { // TypeError: (78-110): Option "gas" has already been set. // TypeError: (120-154): Option "gas" has already been set. // TypeError: (164-198): Option "value" has already been set. -// Warning: (208-222): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// TypeError: (208-242): Option "value" has already been set. -// TypeError: (252-293): Option "value" has already been set. -// TypeError: (252-293): Option "gas" has already been set. -// TypeError: (303-330): Option "salt" has already been set. +// TypeError: (208-249): Option "value" has already been set. +// TypeError: (208-249): Option "gas" has already been set. +// TypeError: (259-286): Option "salt" has already been set. diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol index 822d3eb28e5b..05ef696fb398 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol @@ -1,8 +1,8 @@ contract C { function (uint) external returns (uint) x; function f() public { - x.value(2)(1); + x{value: 2}(1); } } // ---- -// TypeError: (94-101): Member "value" is only available for payable functions. +// TypeError: (94-105): Cannot set option "value" on a non-payable function type. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol similarity index 60% rename from test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol rename to test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol index 36d42e3499ec..6b49c2463ebf 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// TypeError: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol similarity index 66% rename from test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol rename to test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol index 28a573c93ee4..49a8a1a60e78 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol @@ -8,4 +8,4 @@ contract D { } } // ---- -// Warning: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol similarity index 60% rename from test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol rename to test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol index 854ea28fafaa..bc856e70af27 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol index dffa55fdfff9..15da6802ff00 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol @@ -1,10 +1,7 @@ contract test { function f() public { - address(0x12).call.value(2)("abc"); address(0x12).call{value: 2}("abc"); } } // ---- -// Warning: (50-74): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (50-84): Return value of low-level calls not used. -// Warning: (94-129): Return value of low-level calls not used. +// Warning: (50-85): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol index a3c5a5f3085e..cefd2514ef39 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol @@ -1,11 +1,7 @@ contract receiver { function pay() payable public {} } contract test { function f() public { (new receiver()).pay{value: 10}(); } - function g() public { (new receiver()).pay.value(10)(); } receiver r = new receiver(); function h() public { r.pay{value: 10}(); } - function i() public { r.pay.value(10)(); } } // ---- -// Warning: (160-186): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (303-314): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol index 944bda0d9ecf..850e9d69095c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol @@ -3,9 +3,9 @@ contract C { } contract D { function f() public returns (uint) { - (new C).value(2)(); + (new C){value: 2}(); return 2; } } // ---- -// TypeError: (106-119): Constructor for contract C must be payable for member "value" to be available. +// TypeError: (106-123): Cannot set option "value", since the constructor of contract C is not payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol index 77dab9af27c1..41120bf08111 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol @@ -1,26 +1,14 @@ contract C { function f() external payable {} function g(address a) external pure { - a.call.value(42); a.call{value: 42}; - a.call.gas(42); a.call{gas: 42}; - a.staticcall.gas(42); a.staticcall{gas: 42}; - a.delegatecall.gas(42); a.delegatecall{gas: 42}; } function h() external view { - this.f.value(42); this.f{value: 42}; - this.f.gas(42); this.f{gas: 42}; } } // ---- -// Warning: (91-103): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (132-142): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (169-185): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (218-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (304-316): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (345-355): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol index 4a0da038ed83..d302ad454d26 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol @@ -1,27 +1,12 @@ contract C { function f(address a) external view returns (bool success) { - (success,) = a.call.gas(42)(""); - (success,) = a.call{gas: 42}(""); - } - function g(address a) external view returns (bool success) { - (success,) = a.call.gas(42)(""); (success,) = a.call{gas: 42}(""); } function h() external payable {} function i() external view { - this.h.gas(42)(); - } - function j() external view { this.h{gas: 42}(); } } // ---- -// Warning: (90-100): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (226-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (351-361): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// TypeError: (90-108): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (125-144): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (226-244): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (261-280): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (351-367): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (404-421): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError: (90-109): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError: (180-197): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol index 2b4821c53aa9..f49327a92114 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol @@ -2,14 +2,10 @@ contract C { function f() external view {} function test(address a) external view returns (bool status) { // This used to incorrectly raise an error about violating the view mutability. - (status,) = a.staticcall.gas(42)(""); (status,) = a.staticcall{gas: 42}(""); - this.f.gas(42)(); this.f{gas: 42}(); } } // ==== // EVMVersion: >=byzantium // ---- -// Warning: (207-223): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (276-286): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol index 6b82f2fab2b8..3b39c95eae29 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol @@ -1,25 +1,12 @@ contract C { function f(address a) external view returns (bool success) { - (success,) = a.call.value(42)(""); - (success,) = a.call{value: 42}(""); - } - function g(address a) external view returns (bool success) { - (success,) = a.call.value(42)(""); (success,) = a.call{value: 42}(""); } function h() external payable {} function i() external view { - this.h.value(42)(); this.h{value: 42}(); } } // ---- -// Warning: (90-102): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (230-242): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (359-371): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// TypeError: (90-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (127-148): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (230-250): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (267-288): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (359-377): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (381-400): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError: (90-111): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError: (182-201): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. From a58b5b2bbea0a49e598313e15cfb6fe72b1e0a50 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Wed, 8 Apr 2020 15:26:26 +0530 Subject: [PATCH 016/479] Changed repo to upstream; branches to latest --- test/externalTests/colony.sh | 4 ++-- test/externalTests/gnosis.sh | 5 ++--- test/externalTests/zeppelin.sh | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index 66231eb99125..559703ae78dc 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -34,12 +34,12 @@ function colony_test FORCE_ABIv2=false CONFIG="truffle.js" - truffle_setup https://github.com/erak/colonyNetwork.git develop_060 + truffle_setup https://github.com/solidity-external-tests/colonyNetwork.git develop_060 run_install install_fn cd lib rm -Rf dappsys - git clone https://github.com/erak/dappsys-monolithic.git -b master_060 dappsys + git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_060 dappsys cd .. truffle_run_test compile_fn test_fn diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index b2bb657cb220..480d2b4b8f21 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -33,10 +33,10 @@ function gnosis_safe_test OPTIMIZER_LEVEL=1 CONFIG="truffle.js" - truffle_setup https://github.com/erak/safe-contracts.git development_060 + truffle_setup https://github.com/solidity-external-tests/safe-contracts.git development_060 force_truffle_version - sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:erak/mock-contract#master_060|g' package.json + sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json run_install install_fn replace_libsolc_call @@ -45,4 +45,3 @@ function gnosis_safe_test } external_test Gnosis-Safe gnosis_safe_test - diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index 49b6c3e42940..51051f3344e5 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -33,7 +33,7 @@ function zeppelin_test OPTIMIZER_LEVEL=1 CONFIG="truffle-config.js" - truffle_setup https://github.com/erak/openzeppelin-contracts.git master_060 + truffle_setup https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0 run_install install_fn truffle_run_test compile_fn test_fn From ba538c9f75090eebf2b264bb68dfb0bb08d27cc5 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Thu, 30 Apr 2020 13:35:29 +0530 Subject: [PATCH 017/479] Update documentation for solidity-upgrade 0.7.0 --- docs/070-breaking-changes.rst | 17 +++++++++++++++++ docs/index.rst | 1 + docs/internals/layout_in_storage.rst | 4 ++-- docs/using-the-compiler.rst | 16 ++++++++++++---- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 docs/070-breaking-changes.rst diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst new file mode 100644 index 000000000000..1d8dd695dd0a --- /dev/null +++ b/docs/070-breaking-changes.rst @@ -0,0 +1,17 @@ +******************************** +Solidity v0.7.0 Breaking Changes +******************************** + +This section highlights the main breaking changes introduced in Solidity +version 0.7.0, along with the reasoning behind the changes and how to update +affected code. +For the full list check +`the release changelog `_. + +How to update your code +======================= + +This section gives detailed instructions on how to update prior code for every breaking change. + +* Change ``f.value(...)()`` to ``f{value: ...}()``. Similarly ``(new C).value(...)()`` to + ``(new C){value: ...}()`` and ``f.gas(...)()`` to ``f{gas: ...}()``. diff --git a/docs/index.rst b/docs/index.rst index 89976a8d4e91..0fc2dcaf3175 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -127,6 +127,7 @@ Contents 050-breaking-changes.rst 060-breaking-changes.rst + 070-breaking-changes.rst natspec-format.rst security-considerations.rst resources.rst diff --git a/docs/internals/layout_in_storage.rst b/docs/internals/layout_in_storage.rst index 0101556ef836..d7aef8b25e7e 100644 --- a/docs/internals/layout_in_storage.rst +++ b/docs/internals/layout_in_storage.rst @@ -71,7 +71,7 @@ So for the following contract snippet the position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint256(4) . uint256(1))) + 1``:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { @@ -171,7 +171,7 @@ value and reference types, types that are encoded packed, and nested types. .. code:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { struct S { uint128 a; diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 3151480c306c..eaebb65df08a 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -571,9 +571,16 @@ Available upgrade modules | ``override`` | 0.6.0 | When overriding a function or modifier, the new | | | | keyword ``override`` must be used. | +-----------------+---------+--------------------------------------------------+ +| ``dotsyntax`` | 0.7.0 | The following syntax is deprecated: | +| | | ``f.gas(...)()``, ``f.value(...)()`` and | +| | | ``(new C).value(...)()``. Replace these calls by | +| | | ``f{gas: ..., value: ...}()`` and | +| | | ``(new C){value: ...}()``. | ++-----------------+---------+--------------------------------------------------+ -Please read :doc:`0.5.0 release notes <050-breaking-changes>` and -:doc:`0.6.0 release notes <060-breaking-changes>` for further details. +Please read :doc:`0.5.0 release notes <050-breaking-changes>`, +:doc:`0.6.0 release notes <060-breaking-changes>` and +:doc:`0.7.0 release notes <070-breaking-changes>` for further details. Synopsis ~~~~~~~~ @@ -668,8 +675,9 @@ do not need to specify the ``--modules`` option. Found 0 errors. Found 0 upgrades. -The above performs a dry-ran upgrade on the given file and logs statistics after all. -In this case, the upgrade was successful and no further adjustments are needed. +The above performs a dry-run upgrade on the given file and logs statistics at +the end. In this case, the upgrade was successful and no further adjustments are +needed. Finally, you can run the upgrade and also write to the source file. From aa65e9423c21d65d72bc47bc4c896749b1de1ef3 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Thu, 30 Apr 2020 16:36:05 +0530 Subject: [PATCH 018/479] Uniform output in functions and constructor NatSpec --- Changelog.md | 2 +- docs/internals/layout_in_storage.rst | 4 ++-- libsolidity/interface/Natspec.cpp | 6 +++++- test/libsolidity/SolidityNatspecJSON.cpp | 18 +++++++++++------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Changelog.md b/Changelog.md index 2eadcbe121ac..cc23c3a6dcda 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,7 +11,7 @@ Compiler Features: Bugfixes: - + * NatSpec: Constructors and functions have consistent userdoc output. ### 0.6.7 (unreleased) diff --git a/docs/internals/layout_in_storage.rst b/docs/internals/layout_in_storage.rst index 0101556ef836..d7aef8b25e7e 100644 --- a/docs/internals/layout_in_storage.rst +++ b/docs/internals/layout_in_storage.rst @@ -71,7 +71,7 @@ So for the following contract snippet the position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint256(4) . uint256(1))) + 1``:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { @@ -171,7 +171,7 @@ value and reference types, types that are encoded packed, and nested types. .. code:: - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract A { struct S { uint128 a; diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index b78e46081e82..42fcb7dee6a1 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -42,8 +42,12 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) { string value = extractDoc(constructorDefinition->annotation().docTags, "notice"); if (!value.empty()) + { // add the constructor, only if we have any documentation to add - methods["constructor"] = Json::Value(value); + Json::Value user; + user["notice"] = Json::Value(value); + methods["constructor"] = user; + } } string notice = extractDoc(_contractDef.annotation().docTags, "notice"); diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 13bd1f3b06f2..acb25fe291fe 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -849,16 +849,18 @@ BOOST_AUTO_TEST_CASE(dev_documenting_no_param_description) BOOST_AUTO_TEST_CASE(user_constructor) { - char const *sourceCode = R"( + char const* sourceCode = R"( contract test { /// @notice this is a really nice constructor constructor(uint a, uint second) public { } } )"; - char const *natspec = R"ABCDEF({ - "methods" : { - "constructor" : "this is a really nice constructor" + char const* natspec = R"ABCDEF({ + "methods": { + "constructor" : { + "notice": "this is a really nice constructor" + } } })ABCDEF"; @@ -867,7 +869,7 @@ BOOST_AUTO_TEST_CASE(user_constructor) BOOST_AUTO_TEST_CASE(user_constructor_and_function) { - char const *sourceCode = R"( + char const* sourceCode = R"( contract test { /// @notice this is a really nice constructor constructor(uint a, uint second) public { } @@ -876,12 +878,14 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function) } )"; - char const *natspec = R"ABCDEF({ + char const* natspec = R"ABCDEF({ "methods" : { "mul(uint256,uint256)" : { "notice" : "another multiplier" }, - "constructor" : "this is a really nice constructor" + "constructor" : { + "notice" : "this is a really nice constructor" + } } })ABCDEF"; From b5612f96c97dd6fc77fda7179f85d31a38a8cd1e Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 5 May 2020 14:26:18 +0530 Subject: [PATCH 019/479] Deprecated identifier now --- libsolidity/analysis/TypeChecker.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index e626dac2cf35..ecafd1dae32e 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2908,6 +2908,20 @@ bool TypeChecker::visit(Identifier const& _identifier) ); } + if ( + MagicVariableDeclaration const* magicVar = + dynamic_cast(annotation.referencedDeclaration) + ) + if (magicVar->type()->category() == Type::Category::Integer) + { + solAssert(_identifier.name() == "now", ""); + m_errorReporter + .typeError( + _identifier.location(), + "\"now\" has been deprecated. Use \"block.timestamp\" instead." + ); + } + return false; } From a207613f17140a6ece853de9254c8a0d354c3e3c Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 5 May 2020 14:26:31 +0530 Subject: [PATCH 020/479] Docs, changelog and tests --- Changelog.md | 1 + docs/cheatsheet.rst | 7 ++++--- docs/contracts/constant-state-variables.rst | 2 +- docs/contracts/functions.rst | 2 +- docs/examples/blind-auction.rst | 14 +++++++------- docs/examples/micropayment.rst | 4 ++-- docs/units-and-global-variables.rst | 8 +++----- .../MultiSigWalletWithDailyLimit.sol | 6 +++--- .../syntaxTests/globalFunctions/now_deprecate.sol | 7 +++++++ .../syntaxTests/globalFunctions/now_override.sol | 8 ++++++++ .../syntaxTests/viewPureChecker/smoke_test.sol | 2 +- 11 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol create mode 100644 test/libsolidity/syntaxTests/globalFunctions/now_override.sol diff --git a/Changelog.md b/Changelog.md index 32abfb14286a..b134d8801387 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ Breaking changes: * Type Checker: Disallow virtual for library functions. * Deprecated dot syntax for `value` and `gas`. + * Deprecated the identifier `now`. Language Features: diff --git a/docs/cheatsheet.rst b/docs/cheatsheet.rst index 5d6169a48251..4d0854ca9dc1 100644 --- a/docs/cheatsheet.rst +++ b/docs/cheatsheet.rst @@ -67,7 +67,7 @@ The following is the order of precedence for operators, listed in order of evalu | *15* | Comma operator | ``,`` | +------------+-------------------------------------+--------------------------------------------+ -.. index:: assert, block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, now, gas price, origin, revert, require, keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, send +.. index:: assert, block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, gas price, origin, revert, require, keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, send Global Variables ================ @@ -91,7 +91,6 @@ Global Variables - ``msg.data`` (``bytes``): complete calldata - ``msg.sender`` (``address payable``): sender of the message (current call) - ``msg.value`` (``uint``): number of wei sent with the message -- ``now`` (``uint``): current block timestamp (alias for ``block.timestamp``) - ``tx.gasprice`` (``uint``): gas price of the transaction - ``tx.origin`` (``address payable``): sender of the transaction (full call chain) - ``assert(bool condition)``: abort execution and revert state changes if condition is ``false`` (use for internal error) @@ -124,7 +123,7 @@ Global Variables - ``type(I).interfaceId`` (``bytes4``): value containing the EIP-165 interface identifier of the given interface, see :ref:`Type Information`. .. note:: - Do not rely on ``block.timestamp``, ``now`` and ``blockhash`` as a source of randomness, + Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness, unless you know what you are doing. Both the timestamp and the block hash can be influenced by miners to some degree. @@ -144,6 +143,8 @@ Global Variables In version 0.5.0, the following aliases were removed: ``suicide`` as alias for ``selfdestruct``, ``msg.gas`` as alias for ``gasleft``, ``block.blockhash`` as alias for ``blockhash`` and ``sha3`` as alias for ``keccak256``. +.. note:: + In version 0.7.0, the alias ``now`` (for ``block.timestamp``) was removed. .. index:: visibility, public, private, external, internal diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst index b706e5fcfcf9..b2694b8b8608 100644 --- a/docs/contracts/constant-state-variables.rst +++ b/docs/contracts/constant-state-variables.rst @@ -44,7 +44,7 @@ Constant For ``constant`` variables, the value has to be a constant at compile time and it has to be assigned where the variable is declared. Any expression -that accesses storage, blockchain data (e.g. ``now``, ``address(this).balance`` or +that accesses storage, blockchain data (e.g. ``block.timestamp``, ``address(this).balance`` or ``block.number``) or execution data (``msg.value`` or ``gasleft()``) or makes calls to external contracts is disallowed. Expressions that might have a side-effect on memory allocation are allowed, but those that diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index 5557aea87a93..d8e8fe740679 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -146,7 +146,7 @@ The following statements are considered modifying the state: contract C { function f(uint a, uint b) public view returns (uint) { - return a * (b + 42) + now; + return a * (b + 42) + block.timestamp; } } diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst index ec61172d257d..e017a2dacfe7 100644 --- a/docs/examples/blind-auction.rst +++ b/docs/examples/blind-auction.rst @@ -61,7 +61,7 @@ to receive their money - contracts cannot activate themselves. address payable _beneficiary ) public { beneficiary = _beneficiary; - auctionEndTime = now + _biddingTime; + auctionEndTime = block.timestamp + _biddingTime; } /// Bid on the auction with the value sent @@ -78,7 +78,7 @@ to receive their money - contracts cannot activate themselves. // Revert the call if the bidding // period is over. require( - now <= auctionEndTime, + block.timestamp <= auctionEndTime, "Auction already ended." ); @@ -140,7 +140,7 @@ to receive their money - contracts cannot activate themselves. // external contracts. // 1. Conditions - require(now >= auctionEndTime, "Auction not yet ended."); + require(block.timestamp >= auctionEndTime, "Auction not yet ended."); require(!ended, "auctionEnd has already been called."); // 2. Effects @@ -211,8 +211,8 @@ invalid bids. /// functions. `onlyBefore` is applied to `bid` below: /// The new function body is the modifier's body where /// `_` is replaced by the old function body. - modifier onlyBefore(uint _time) { require(now < _time); _; } - modifier onlyAfter(uint _time) { require(now > _time); _; } + modifier onlyBefore(uint _time) { require(block.timestamp < _time); _; } + modifier onlyAfter(uint _time) { require(block.timestamp > _time); _; } constructor( uint _biddingTime, @@ -220,7 +220,7 @@ invalid bids. address payable _beneficiary ) public { beneficiary = _beneficiary; - biddingEnd = now + _biddingTime; + biddingEnd = block.timestamp + _biddingTime; revealEnd = biddingEnd + _revealTime; } @@ -326,4 +326,4 @@ invalid bids. highestBidder = bidder; return true; } - } \ No newline at end of file + } diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst index 477246e0e764..2fad5283a268 100644 --- a/docs/examples/micropayment.rst +++ b/docs/examples/micropayment.rst @@ -351,7 +351,7 @@ The full contract { sender = msg.sender; recipient = _recipient; - expiration = now + duration; + expiration = block.timestamp + duration; } /// the recipient can close the channel at any time by presenting a @@ -376,7 +376,7 @@ The full contract /// if the timeout is reached without the recipient closing the channel, /// then the Ether is released back to the sender. function claimTimeout() public { - require(now >= expiration); + require(block.timestamp >= expiration); selfdestruct(sender); } diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 54eed07a9799..d2750c6d33be 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -47,7 +47,7 @@ These suffixes cannot be applied to variables. For example, if you want to interpret a function parameter in days, you can in the following way:: function f(uint start, uint daysAfter) public { - if (now >= start + daysAfter * 1 days) { + if (block.timestamp >= start + daysAfter * 1 days) { // ... } } @@ -61,7 +61,7 @@ There are special variables and functions which always exist in the global namespace and are mainly used to provide information about the blockchain or are general-use utility functions. -.. index:: abi, block, coinbase, difficulty, encode, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, now, gas price, origin +.. index:: abi, block, coinbase, difficulty, encode, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, gas price, origin Block and Transaction Properties @@ -78,7 +78,6 @@ Block and Transaction Properties - ``msg.sender`` (``address payable``): sender of the message (current call) - ``msg.sig`` (``bytes4``): first four bytes of the calldata (i.e. function identifier) - ``msg.value`` (``uint``): number of wei sent with the message -- ``now`` (``uint``): current block timestamp (alias for ``block.timestamp``) - ``tx.gasprice`` (``uint``): gas price of the transaction - ``tx.origin`` (``address payable``): sender of the transaction (full call chain) @@ -88,7 +87,7 @@ Block and Transaction Properties This includes calls to library functions. .. note:: - Do not rely on ``block.timestamp``, ``now`` and ``blockhash`` as a source of randomness, + Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness, unless you know what you are doing. Both the timestamp and the block hash can be influenced by miners to some degree. @@ -327,4 +326,3 @@ for an interface type ``I``: A ``bytes4`` value containing the `EIP-165 `_ interface identifier of the given interface ``I``. This identifier is defined as the ``XOR`` of all function selectors defined within the interface itself - excluding all inherited functions. - diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol index 9cb9a259fd70..bb85c46d0103 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol @@ -69,8 +69,8 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { internal returns (bool) { - if (now > lastDay + 24 hours) { - lastDay = now; + if (block.timestamp > lastDay + 24 hours) { + lastDay = block.timestamp; spentToday = 0; } if (spentToday + amount > dailyLimit || spentToday + amount < spentToday) @@ -88,7 +88,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { view returns (uint) { - if (now > lastDay + 24 hours) + if (block.timestamp > lastDay + 24 hours) return dailyLimit; if (dailyLimit < spentToday) return 0; diff --git a/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol b/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol new file mode 100644 index 000000000000..5864b224ee7b --- /dev/null +++ b/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + now; + } +} +// ---- +// TypeError: (38-41): "now" has been deprecated. Use "block.timestamp" instead. diff --git a/test/libsolidity/syntaxTests/globalFunctions/now_override.sol b/test/libsolidity/syntaxTests/globalFunctions/now_override.sol new file mode 100644 index 000000000000..c3db19f45b1c --- /dev/null +++ b/test/libsolidity/syntaxTests/globalFunctions/now_override.sol @@ -0,0 +1,8 @@ +contract C { + function f() public view { + uint now = block.timestamp; + now; + } +} +// ---- +// Warning: (43-51): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/smoke_test.sol b/test/libsolidity/syntaxTests/viewPureChecker/smoke_test.sol index 0e397efcc161..c6eec48b107d 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/smoke_test.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/smoke_test.sol @@ -1,7 +1,7 @@ contract C { uint x; function g() pure public {} - function f() view public returns (uint) { return now; } + function f() view public returns (uint) { return block.timestamp; } function h() public { x = 2; } function i() payable public { x = 2; } } From aed6c22318dcc763342d434b2b85e125d1d02610 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 5 May 2020 16:34:01 +0530 Subject: [PATCH 021/479] solidity-upgrade can now change now to block.timestamp --- docs/070-breaking-changes.rst | 1 + docs/using-the-compiler.rst | 6 ++++++ tools/solidityUpgrade/SourceTransform.h | 18 ++++++++++++++++++ tools/solidityUpgrade/SourceUpgrade.cpp | 2 ++ tools/solidityUpgrade/SourceUpgrade.h | 8 ++++++-- tools/solidityUpgrade/Upgrade070.cpp | 19 +++++++++++++++++++ tools/solidityUpgrade/Upgrade070.h | 9 +++++++++ 7 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 1d8dd695dd0a..f273dcd0b9eb 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -15,3 +15,4 @@ This section gives detailed instructions on how to update prior code for every b * Change ``f.value(...)()`` to ``f{value: ...}()``. Similarly ``(new C).value(...)()`` to ``(new C){value: ...}()`` and ``f.gas(...)()`` to ``f{gas: ...}()``. +* Change ``now`` to ``block.timestamp``. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index e409323fa166..08f8176703bb 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -580,6 +580,12 @@ Available upgrade modules | | | ``f{gas: ..., value: ...}()`` and | | | | ``(new C){value: ...}()``. | +-----------------+---------+--------------------------------------------------+ +| ``now`` | 0.7.0 | The ``now`` keyword is deprecated. Use | +| | | ``block.timestamp`` instead. | +| | | | +| | | | +| | | | ++-----------------+---------+--------------------------------------------------+ Please read :doc:`0.5.0 release notes <050-breaking-changes>`, :doc:`0.6.0 release notes <060-breaking-changes>` and diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index b9250ae6a050..200c20e5b410 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -267,6 +267,24 @@ class SourceTransform return ""; } + + static std::string nowUpdate(langutil::SourceLocation const& _location) + { + std::regex nowRegex{"now"}; + + if (regex_search(_location.text(), nowRegex)) + { + return regex_replace(_location.text(), nowRegex, "block.timestamp"); + } + else + solAssert( + false, + LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << + "\nNeeds to be fixed manually." + ); + + return ""; + } }; } diff --git a/tools/solidityUpgrade/SourceUpgrade.cpp b/tools/solidityUpgrade/SourceUpgrade.cpp index 04f83eeeec92..6fffc074d6b3 100644 --- a/tools/solidityUpgrade/SourceUpgrade.cpp +++ b/tools/solidityUpgrade/SourceUpgrade.cpp @@ -196,6 +196,8 @@ Allowed options)", m_suite.activateModule(Module::VirtualFunction); else if (module == "dotsyntax") m_suite.activateModule(Module::DotSyntax); + else if (module == "now") + m_suite.activateModule(Module::NowKeyword); else { error() << "Unknown upgrade module \"" + module + "\"" << endl; diff --git a/tools/solidityUpgrade/SourceUpgrade.h b/tools/solidityUpgrade/SourceUpgrade.h index 9fb7a5ee224e..8b82b310e4b2 100644 --- a/tools/solidityUpgrade/SourceUpgrade.h +++ b/tools/solidityUpgrade/SourceUpgrade.h @@ -58,7 +58,8 @@ class SourceUpgrade AbstractContract, OverridingFunction, VirtualFunction, - DotSyntax + DotSyntax, + NowKeyword }; /// Upgrade suite that hosts all available modules. @@ -84,6 +85,8 @@ class SourceUpgrade /// Solidity 0.7.0 if (isActivated(Module::DotSyntax)) DotSyntax{m_changes}.analyze(_sourceUnit); + if (isActivated(Module::NowKeyword)) + NowKeyword{m_changes}.analyze(_sourceUnit); } void activateModule(Module _module) { m_modules.insert(_module); } @@ -103,7 +106,8 @@ class SourceUpgrade Module::AbstractContract, Module::OverridingFunction, Module::VirtualFunction, - Module::DotSyntax + Module::DotSyntax, + Module::NowKeyword }; }; diff --git a/tools/solidityUpgrade/Upgrade070.cpp b/tools/solidityUpgrade/Upgrade070.cpp index c38ae2b97331..8e921ce119cc 100644 --- a/tools/solidityUpgrade/Upgrade070.cpp +++ b/tools/solidityUpgrade/Upgrade070.cpp @@ -40,3 +40,22 @@ void DotSyntax::endVisit(FunctionCall const& _functionCall) ); } } + +void NowKeyword::endVisit(Identifier const& _identifier) +{ + IdentifierAnnotation& annotation = _identifier.annotation(); + + if (MagicVariableDeclaration const* magicVar + = dynamic_cast(annotation.referencedDeclaration)) + { + if (magicVar->type()->category() == Type::Category::Integer) + { + solAssert(_identifier.name() == "now", ""); + m_changes.emplace_back( + UpgradeChange::Level::Safe, + _identifier.location(), + SourceTransform::nowUpdate(_identifier.location()) + ); + } + } +} diff --git a/tools/solidityUpgrade/Upgrade070.h b/tools/solidityUpgrade/Upgrade070.h index 29d689f974c2..bfa07ce51788 100644 --- a/tools/solidityUpgrade/Upgrade070.h +++ b/tools/solidityUpgrade/Upgrade070.h @@ -32,4 +32,13 @@ class DotSyntax: public AnalysisUpgrade void endVisit(frontend::FunctionCall const& _expression) override; }; +class NowKeyword: public AnalysisUpgrade +{ +public: + using AnalysisUpgrade::AnalysisUpgrade; + void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } +private: + void endVisit(frontend::Identifier const& _expression) override; +}; + } From 92cf61d4f998690a665857f319d1b639b94f4789 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 5 May 2020 17:03:28 +0530 Subject: [PATCH 022/479] fixed compilation tests and upgraded ext. tests branch --- docs/common-patterns.rst | 10 ++--- docs/units-and-global-variables.rst | 3 ++ docs/using-the-compiler.rst | 3 -- test/compilationTests/corion/provider.sol | 4 +- .../gnosis/Markets/Campaign.sol | 4 +- .../gnosis/Oracles/FutarchyOracle.sol | 4 +- .../gnosis/Oracles/UltimateOracle.sol | 10 ++--- .../milestonetracker/MilestoneTracker.sol | 8 ++-- test/contracts/AuctionRegistrar.cpp | 9 ++--- test/contracts/Wallet.cpp | 3 +- test/externalTests/colony.sh | 2 +- test/externalTests/gnosis.sh | 2 +- test/externalTests/solc-js/DAO/DAO.sol | 40 +++++++++---------- .../solc-js/DAO/TokenCreation.sol | 10 ++--- test/libsolidity/SolidityEndToEndTest.cpp | 23 ----------- test/libsolidity/SolidityOptimizer.cpp | 4 +- .../smtCheckerTests/special/many.sol | 6 +-- tools/solidityUpgrade/SourceTransform.h | 15 +------ tools/solidityUpgrade/Upgrade070.cpp | 8 ++-- 19 files changed, 65 insertions(+), 103 deletions(-) diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 9c0a0dbc30b2..4e34cd60fc89 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -128,7 +128,7 @@ restrictions highly readable. // phase, where `msg.sender` is the account // creating this contract. address public owner = msg.sender; - uint public creationTime = now; + uint public creationTime = block.timestamp; // Modifiers can be used to change // the body of a function. @@ -159,7 +159,7 @@ restrictions highly readable. modifier onlyAfter(uint _time) { require( - now >= _time, + block.timestamp >= _time, "Function called too early." ); _; @@ -287,7 +287,7 @@ function finishes. // This is the current stage. Stages public stage = Stages.AcceptingBlindedBids; - uint public creationTime = now; + uint public creationTime = block.timestamp; modifier atStage(Stages _stage) { require( @@ -306,10 +306,10 @@ function finishes. // will not take the new stage into account. modifier timedTransitions() { if (stage == Stages.AcceptingBlindedBids && - now >= creationTime + 10 days) + block.timestamp >= creationTime + 10 days) nextStage(); if (stage == Stages.RevealBids && - now >= creationTime + 12 days) + block.timestamp >= creationTime + 12 days) nextStage(); // The other stages transition by transaction _; diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index d2750c6d33be..ddfae269e527 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -111,6 +111,9 @@ Block and Transaction Properties The function ``gasleft`` was previously known as ``msg.gas``, which was deprecated in version 0.4.21 and removed in version 0.5.0. +.. note:: + In version 0.7.0, the alias ``now`` (for ``block.timestamp``) was removed. + .. index:: abi, encoding, packed ABI Encoding and Decoding Functions diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 08f8176703bb..b868d91649ed 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -582,9 +582,6 @@ Available upgrade modules +-----------------+---------+--------------------------------------------------+ | ``now`` | 0.7.0 | The ``now`` keyword is deprecated. Use | | | | ``block.timestamp`` instead. | -| | | | -| | | | -| | | | +-----------------+---------+--------------------------------------------------+ Please read :doc:`0.5.0 release notes <050-breaking-changes>`, diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 0b9f4ac1c097..8b8761179c3d 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -256,7 +256,7 @@ contract provider is module, safeMath, announcementTypes { providers[msg.sender].data[currHeight].country = country; providers[msg.sender].data[currHeight].info = info; providers[msg.sender].data[currHeight].currentRate = rate; - providers[msg.sender].data[currHeight].create = now; + providers[msg.sender].data[currHeight].create = block.timestamp; providers[msg.sender].data[currHeight].lastPaidRate = rate; providers[msg.sender].data[currHeight].priv = priv; providers[msg.sender].data[currHeight].lastSupplyID = currentSchellingRound; @@ -436,7 +436,7 @@ contract provider is module, safeMath, announcementTypes { clients[msg.sender].lastSupplyID = currentSchellingRound; clients[msg.sender].paidUpTo = currentSchellingRound; clients[msg.sender].lastRate = providers[provider].data[currHeight].currentRate; - clients[msg.sender].providerConnected = now; + clients[msg.sender].providerConnected = block.timestamp; emit ENewClient(msg.sender, provider, currHeight, bal); } function partProvider() isReady external { diff --git a/test/compilationTests/gnosis/Markets/Campaign.sol b/test/compilationTests/gnosis/Markets/Campaign.sol index 451eef9edf93..a4aa97134bf9 100644 --- a/test/compilationTests/gnosis/Markets/Campaign.sol +++ b/test/compilationTests/gnosis/Markets/Campaign.sol @@ -55,7 +55,7 @@ contract Campaign { } modifier timedTransitions() { - if (stage == Stages.AuctionStarted && deadline < now) + if (stage == Stages.AuctionStarted && deadline < block.timestamp) stage = Stages.AuctionFailed; _; } @@ -86,7 +86,7 @@ contract Campaign { && address(_marketMaker) != address(0) && _fee < FEE_RANGE && _funding > 0 - && now < _deadline); + && block.timestamp < _deadline); eventContract = _eventContract; marketFactory = _marketFactory; marketMaker = _marketMaker; diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol index 84675ba965b0..1f92bcd9c057 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol @@ -71,7 +71,7 @@ contract FutarchyOracle is Oracle { public { // Deadline is in the future - require(_deadline > now); + require(_deadline > block.timestamp); // Create decision event categoricalEvent = eventFactory.createCategoricalEvent(collateralToken, this, outcomeCount); // Create outcome events @@ -131,7 +131,7 @@ contract FutarchyOracle is Oracle { public { // Outcome is not set yet and deadline has passed - require(!isSet && deadline <= now); + require(!isSet && deadline <= block.timestamp); // Find market with highest marginal price for long outcome tokens uint highestMarginalPrice = markets[0].marketMaker().calcMarginalPrice(markets[0], LONG); uint highestIndex = 0; diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol index 94b57ca8190a..9b8b982904e1 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol @@ -80,7 +80,7 @@ contract UltimateOracle is Oracle { && forwardedOutcomeSetTimestamp == 0 && forwardedOracle.isOutcomeSet()); forwardedOutcome = forwardedOracle.getOutcome(); - forwardedOutcomeSetTimestamp = now; + forwardedOutcomeSetTimestamp = block.timestamp; emit ForwardedOracleOutcomeAssignment(forwardedOutcome); } @@ -97,7 +97,7 @@ contract UltimateOracle is Oracle { totalOutcomeAmounts[_outcome] = challengeAmount; totalAmount = challengeAmount; frontRunner = _outcome; - frontRunnerSetTimestamp = now; + frontRunnerSetTimestamp = block.timestamp; emit OutcomeChallenge(msg.sender, _outcome); } @@ -120,7 +120,7 @@ contract UltimateOracle is Oracle { if (_outcome != frontRunner && totalOutcomeAmounts[_outcome] > totalOutcomeAmounts[frontRunner]) { frontRunner = _outcome; - frontRunnerSetTimestamp = now; + frontRunnerSetTimestamp = block.timestamp; } emit OutcomeVote(msg.sender, _outcome, amount); } @@ -147,7 +147,7 @@ contract UltimateOracle is Oracle { view returns (bool) { - return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod; + return forwardedOutcomeSetTimestamp != 0 && (block.timestamp).sub(forwardedOutcomeSetTimestamp) > challengePeriod; } /// @dev Checks if time to overbid the front runner is over @@ -157,7 +157,7 @@ contract UltimateOracle is Oracle { view returns (bool) { - return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod; + return frontRunnerSetTimestamp != 0 && (block.timestamp).sub(frontRunnerSetTimestamp) > frontRunnerPeriod; } /// @dev Checks if outcome was challenged diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index d20a8d969ee0..70ded719fde1 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -264,10 +264,10 @@ contract MilestoneTracker { &&(msg.sender != recipient)) revert(); if (milestone.status != MilestoneStatus.AcceptedAndInProgress) revert(); - if (now < milestone.minCompletionDate) revert(); - if (now > milestone.maxCompletionDate) revert(); + if (block.timestamp < milestone.minCompletionDate) revert(); + if (block.timestamp > milestone.maxCompletionDate) revert(); milestone.status = MilestoneStatus.Completed; - milestone.doneTime = now; + milestone.doneTime = block.timestamp; emit ProposalStatusChanged(_idMilestone, milestone.status); } @@ -312,7 +312,7 @@ contract MilestoneTracker { &&(msg.sender != recipient)) revert(); if ((milestone.status != MilestoneStatus.Completed) || - (now < milestone.doneTime + milestone.reviewTime)) + (block.timestamp < milestone.doneTime + milestone.reviewTime)) revert(); authorizePayment(_idMilestone); diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index 526137d08205..5eb780ee38be 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -38,7 +38,6 @@ namespace solidity::frontend::test namespace { - static char const* registrarCode = R"DELIMITER( pragma solidity >=0.4.0 <0.8.0; @@ -68,7 +67,7 @@ abstract contract AuctionSystem { function bid(string memory _name, address payable _bidder, uint _value) internal { Auction storage auction = m_auctions[_name]; - if (auction.endDate > 0 && now > auction.endDate) + if (auction.endDate > 0 && block.timestamp > auction.endDate) { emit AuctionEnded(_name, auction.highestBidder); onAuctionEnd(_name); @@ -82,7 +81,7 @@ abstract contract AuctionSystem { auction.sumOfBids += _value; auction.highestBid = _value; auction.highestBidder = _bidder; - auction.endDate = now + c_biddingTime; + auction.endDate = block.timestamp + c_biddingTime; emit NewBid(_name, _bidder, _value); } @@ -120,7 +119,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem { Auction storage auction = m_auctions[_name]; Record storage record = m_toRecord[_name]; address previousOwner = record.owner; - record.renewalDate = now + c_renewalInterval; + record.renewalDate = block.timestamp + c_renewalInterval; record.owner = auction.highestBidder; emit Changed(_name); if (previousOwner != 0x0000000000000000000000000000000000000000) { @@ -138,7 +137,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem { bool needAuction = requiresAuction(_name); if (needAuction) { - if (now < m_toRecord[_name].renewalDate) + if (block.timestamp < m_toRecord[_name].renewalDate) revert(); bid(_name, msg.sender, msg.value); } else { diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index b219c3ec6910..163f0755a3be 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -40,7 +40,6 @@ using namespace solidity::util; namespace solidity::frontend::test { - static char const* walletCode = R"DELIMITER( //sol Wallet // Multi-sig, daily-limited account proxy/wallet. @@ -317,7 +316,7 @@ abstract contract daylimit is multiowned { return false; } // determines today's index. - function today() private view returns (uint) { return now / 1 days; } + function today() private view returns (uint) { return block.timestamp / 1 days; } // FIELDS diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index 559703ae78dc..6a246b2b9d7b 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -34,7 +34,7 @@ function colony_test FORCE_ABIv2=false CONFIG="truffle.js" - truffle_setup https://github.com/solidity-external-tests/colonyNetwork.git develop_060 + truffle_setup https://github.com/solidity-external-tests/colonyNetwork.git develop_070 run_install install_fn cd lib diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 480d2b4b8f21..436942d2d6bf 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -33,7 +33,7 @@ function gnosis_safe_test OPTIMIZER_LEVEL=1 CONFIG="truffle.js" - truffle_setup https://github.com/solidity-external-tests/safe-contracts.git development_060 + truffle_setup https://github.com/solidity-external-tests/safe-contracts.git development_070 force_truffle_version sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json diff --git a/test/externalTests/solc-js/DAO/DAO.sol b/test/externalTests/solc-js/DAO/DAO.sol index 0153db9d7bb6..56e50d23d676 100644 --- a/test/externalTests/solc-js/DAO/DAO.sol +++ b/test/externalTests/solc-js/DAO/DAO.sol @@ -381,7 +381,7 @@ contract DAO is DAOInterface, Token, TokenCreation { revert(); if (address(DAOrewardAccount) == 0x0000000000000000000000000000000000000000) revert(); - lastTimeMinQuorumMet = now; + lastTimeMinQuorumMet = block.timestamp; minQuorumDivisor = 5; // sets the minimal quorum to 20% proposals.push(); // avoids a proposal with ID 0 because it is used @@ -390,7 +390,7 @@ contract DAO is DAOInterface, Token, TokenCreation { } receive() external payable override(DAOInterface, TokenCreation) { - if (now < closingTime + creationGracePeriod && msg.sender != address(extraBalance)) + if (block.timestamp < closingTime + creationGracePeriod && msg.sender != address(extraBalance)) createTokenProxy(msg.sender); else receiveEther(); @@ -430,13 +430,13 @@ contract DAO is DAOInterface, Token, TokenCreation { revert(); if (!isFueled - || now < closingTime + || block.timestamp < closingTime || (msg.value < proposalDeposit && !_newCurator)) { revert(); } - if (now + _debatingPeriod < now) // prevents overflow + if (block.timestamp + _debatingPeriod < block.timestamp) // prevents overflow revert(); // to prevent a 51% attacker to convert the ether into deposit @@ -445,7 +445,7 @@ contract DAO is DAOInterface, Token, TokenCreation { // to prevent curator from halving quorum before first proposal if (proposals.length == 1) // initial length is 1 (see constructor) - lastTimeMinQuorumMet = now; + lastTimeMinQuorumMet = block.timestamp; Proposal storage p = proposals.push(); _proposalID = proposals.length - 1; @@ -453,7 +453,7 @@ contract DAO is DAOInterface, Token, TokenCreation { p.amount = _amount; p.description = _description; p.proposalHash = keccak256(abi.encodePacked(_recipient, _amount, _transactionData)); - p.votingDeadline = now + _debatingPeriod; + p.votingDeadline = block.timestamp + _debatingPeriod; p.open = true; //p.proposalPassed = False; // that's default p.newCurator = _newCurator; @@ -493,7 +493,7 @@ contract DAO is DAOInterface, Token, TokenCreation { Proposal storage p = proposals[_proposalID]; if (p.votedYes[msg.sender] || p.votedNo[msg.sender] - || now >= p.votingDeadline) { + || block.timestamp >= p.votingDeadline) { revert(); } @@ -529,13 +529,13 @@ contract DAO is DAOInterface, Token, TokenCreation { ? splitExecutionPeriod : executeProposalPeriod; // If we are over deadline and waiting period, assert proposal is closed - if (p.open && now > p.votingDeadline + waitPeriod) { + if (p.open && block.timestamp > p.votingDeadline + waitPeriod) { closeProposal(_proposalID); return false; } // Check if the proposal can be executed - if (now < p.votingDeadline // has the voting deadline arrived? + if (block.timestamp < p.votingDeadline // has the voting deadline arrived? // Have the votes been counted? || !p.open || p.proposalPassed // anyone trying to call us recursively? @@ -573,7 +573,7 @@ contract DAO is DAOInterface, Token, TokenCreation { if (!p.creator.send(p.proposalDeposit)) revert(); - lastTimeMinQuorumMet = now; + lastTimeMinQuorumMet = block.timestamp; // set the minQuorum to 20% again, in the case it has been reached if (quorum > totalSupply / 5) minQuorumDivisor = 5; @@ -628,9 +628,9 @@ contract DAO is DAOInterface, Token, TokenCreation { // Sanity check - if (now < p.votingDeadline // has the voting deadline arrived? + if (block.timestamp < p.votingDeadline // has the voting deadline arrived? //The request for a split expires XX days after the voting deadline - || now > p.votingDeadline + splitExecutionPeriod + || block.timestamp > p.votingDeadline + splitExecutionPeriod // Does the new Curator address match? || p.recipient != _newCurator // Is it a new curator proposal? @@ -759,7 +759,7 @@ override returns (bool _success) { function transfer(address _to, uint256 _value) public override returns (bool success) { if (isFueled - && now > closingTime + && block.timestamp > closingTime && !isBlocked(msg.sender) && _to != address(this) && transferPaidOut(msg.sender, _to, _value) @@ -782,7 +782,7 @@ override returns (bool _success) { function transferFrom(address _from, address _to, uint256 _value) public override returns (bool success) { if (isFueled - && now > closingTime + && block.timestamp > closingTime && !isBlocked(_from) && _to != address(this) && transferPaidOut(_from, _to, _value) @@ -869,11 +869,11 @@ override returns (bool _success) { // this can only be called after `quorumHalvingPeriod` has passed or at anytime after // fueling by the curator with a delay of at least `minProposalDebatePeriod` // between the calls - if ((lastTimeMinQuorumMet < (now - quorumHalvingPeriod) || msg.sender == curator) - && lastTimeMinQuorumMet < (now - minProposalDebatePeriod) - && now >= closingTime + if ((lastTimeMinQuorumMet < (block.timestamp - quorumHalvingPeriod) || msg.sender == curator) + && lastTimeMinQuorumMet < (block.timestamp - minProposalDebatePeriod) + && block.timestamp >= closingTime && proposals.length > 1) { - lastTimeMinQuorumMet = now; + lastTimeMinQuorumMet = block.timestamp; minQuorumDivisor *= 2; return true; } else { @@ -887,7 +887,7 @@ override returns (bool _success) { _newCurator, 0, 0, - now + splitExecutionPeriod, + block.timestamp + splitExecutionPeriod, name, symbol, decimals @@ -907,7 +907,7 @@ override returns (bool _success) { if (blocked[_account] == 0) return false; Proposal storage p = proposals[blocked[_account]]; - if (now > p.votingDeadline) { + if (block.timestamp > p.votingDeadline) { blocked[_account] = 0; return false; } else { diff --git a/test/externalTests/solc-js/DAO/TokenCreation.sol b/test/externalTests/solc-js/DAO/TokenCreation.sol index 489ce3902e28..cf0d27a537dd 100644 --- a/test/externalTests/solc-js/DAO/TokenCreation.sol +++ b/test/externalTests/solc-js/DAO/TokenCreation.sol @@ -102,7 +102,7 @@ contract TokenCreation is TokenCreationInterface, Token { function createTokenProxy(address payable _tokenHolder) payable public override returns (bool success) { - if (now < closingTime && msg.value > 0 + if (block.timestamp < closingTime && msg.value > 0 && (privateCreation == 0x0000000000000000000000000000000000000000 || privateCreation == msg.sender)) { uint token = (msg.value * 20) / divisor(); @@ -121,7 +121,7 @@ override returns (bool success) { } function refund() public override { - if (now > closingTime && !isFueled) { + if (block.timestamp > closingTime && !isFueled) { // Get extraBalance - will only succeed when called for the first time if (address(extraBalance).balance >= extraBalance.accumulatedInput()) extraBalance.payOut(address(this), extraBalance.accumulatedInput()); @@ -141,11 +141,11 @@ override returns (bool success) { // The number of (base unit) tokens per wei is calculated // as `msg.value` * 20 / `divisor` // The fueling period starts with a 1:1 ratio - if (closingTime - 2 weeks > now) { + if (closingTime - 2 weeks > block.timestamp) { return 20; // Followed by 10 days with a daily creation rate increase of 5% - } else if (closingTime - 4 days > now) { - return (20 + (now - (closingTime - 2 weeks)) / (1 days)); + } else if (closingTime - 4 days > block.timestamp) { + return (20 + (block.timestamp - (closingTime - 2 weeks)) / (1 days)); // The last 4 days there is a constant creation rate ratio of 1:1.5 } else { return 30; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index c4c337630f0f..c4adf0dd8ef5 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1025,29 +1025,6 @@ BOOST_AUTO_TEST_CASE(blockchain) ABI_CHECK(callContractFunctionWithValue("someInfo()", 28), encodeArgs(28, u256("0x1212121212121212121212121212121212121212"), 7)); } -BOOST_AUTO_TEST_CASE(now) -{ - char const* sourceCode = R"( - contract test { - function someInfo() public returns (bool equal, uint val) { - equal = block.timestamp == now; - val = now; - } - } - )"; - ALSO_VIA_YUL( - compileAndRun(sourceCode); - u256 startBlock = blockNumber(); - size_t startTime = blockTimestamp(startBlock); - auto ret = callContractFunction("someInfo()"); - u256 endBlock = blockNumber(); - size_t endTime = blockTimestamp(endBlock); - BOOST_CHECK(startBlock != endBlock); - BOOST_CHECK(startTime != endTime); - ABI_CHECK(ret, encodeArgs(true, endTime)); - ) -} - BOOST_AUTO_TEST_CASE(send_ether) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index fec67f0e6a18..36247322c156 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -346,9 +346,9 @@ BOOST_AUTO_TEST_CASE(incorrect_storage_access_bug) mapping(uint => uint) data; function f() public returns (uint) { - if (data[now] == 0) + if (data[block.timestamp] == 0) data[uint(-7)] = 5; - return data[now]; + return data[block.timestamp]; } } )"; diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol index a8ae53997a8e..535615a6cf85 100644 --- a/test/libsolidity/smtCheckerTests/special/many.sol +++ b/test/libsolidity/smtCheckerTests/special/many.sol @@ -10,7 +10,7 @@ contract C assert(tx.origin == msg.sender); uint x = block.number; assert(x + 2 > block.number); - assert(now > 10); + assert(block.timestamp > 10); assert(gasleft() > 100); } } @@ -22,5 +22,5 @@ contract C // Warning: (244-275): Assertion violation happens here // Warning: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here // Warning: (304-332): Assertion violation happens here -// Warning: (336-352): Assertion violation happens here -// Warning: (356-379): Assertion violation happens here +// Warning: (336-364): Assertion violation happens here +// Warning: (368-391): Assertion violation happens here diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index 200c20e5b410..0dd4fc00b398 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -270,20 +270,7 @@ class SourceTransform static std::string nowUpdate(langutil::SourceLocation const& _location) { - std::regex nowRegex{"now"}; - - if (regex_search(_location.text(), nowRegex)) - { - return regex_replace(_location.text(), nowRegex, "block.timestamp"); - } - else - solAssert( - false, - LocationHelper() << "Could not fix: " << _location.text() << " at " << _location << - "\nNeeds to be fixed manually." - ); - - return ""; + return regex_replace(_location.text(), std::regex{"now"}, "block.timestamp"); } }; diff --git a/tools/solidityUpgrade/Upgrade070.cpp b/tools/solidityUpgrade/Upgrade070.cpp index 8e921ce119cc..d71f3685df12 100644 --- a/tools/solidityUpgrade/Upgrade070.cpp +++ b/tools/solidityUpgrade/Upgrade070.cpp @@ -45,9 +45,10 @@ void NowKeyword::endVisit(Identifier const& _identifier) { IdentifierAnnotation& annotation = _identifier.annotation(); - if (MagicVariableDeclaration const* magicVar - = dynamic_cast(annotation.referencedDeclaration)) - { + if ( + MagicVariableDeclaration const* magicVar = + dynamic_cast(annotation.referencedDeclaration) + ) if (magicVar->type()->category() == Type::Category::Integer) { solAssert(_identifier.name() == "now", ""); @@ -57,5 +58,4 @@ void NowKeyword::endVisit(Identifier const& _identifier) SourceTransform::nowUpdate(_identifier.location()) ); } - } } From d5d9ff65138d2fd522c815ddad967e1987505de4 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Thu, 7 May 2020 18:49:54 +0200 Subject: [PATCH 023/479] Update picosha2 from upstream --- libsolutil/picosha2.h | 551 ++++++++++++++++++++++++----------------- scripts/check_style.sh | 25 +- 2 files changed, 340 insertions(+), 236 deletions(-) diff --git a/libsolutil/picosha2.h b/libsolutil/picosha2.h index 61aeb3b955d3..fdfabb5acac0 100644 --- a/libsolutil/picosha2.h +++ b/libsolutil/picosha2.h @@ -1,7 +1,7 @@ /* The MIT License (MIT) -Copyright (C) 2014 okdshin +Copyright (C) 2017 okdshin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,268 +21,365 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma once +#ifndef PICOSHA2_H +#define PICOSHA2_H +// picosha2:20140213 -//picosha2:20140213 -#include -#include -#include -#include +#ifndef PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR +#define PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR \ + 1048576 //=1024*1024: default is 1MB memory +#endif + +#include #include +#include #include -#include +#include +#include +namespace picosha2 { +typedef unsigned long word_t; +typedef unsigned char byte_t; + +static const size_t k_digest_size = 32; + +namespace detail { +inline byte_t mask_8bit(byte_t x) { return x & 0xff; } + +inline word_t mask_32bit(word_t x) { return x & 0xffffffff; } + +const word_t add_constant[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; + +const word_t initial_message_digest[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, + 0xa54ff53a, 0x510e527f, 0x9b05688c, + 0x1f83d9ab, 0x5be0cd19}; + +inline word_t ch(word_t x, word_t y, word_t z) { return (x & y) ^ ((~x) & z); } + +inline word_t maj(word_t x, word_t y, word_t z) { + return (x & y) ^ (x & z) ^ (y & z); +} -namespace picosha2 -{ +inline word_t rotr(word_t x, std::size_t n) { + assert(n < 32); + return mask_32bit((x >> n) | (x << (32 - n))); +} -namespace detail -{ +inline word_t bsig0(word_t x) { return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); } -inline uint8_t mask_8bit(uint8_t x) -{ - return x & 0xff; +inline word_t bsig1(word_t x) { return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); } + +inline word_t shr(word_t x, std::size_t n) { + assert(n < 32); + return x >> n; } -inline uint32_t mask_32bit(uint32_t x) -{ - return x & 0xffffffff; +inline word_t ssig0(word_t x) { return rotr(x, 7) ^ rotr(x, 18) ^ shr(x, 3); } + +inline word_t ssig1(word_t x) { return rotr(x, 17) ^ rotr(x, 19) ^ shr(x, 10); } + +template +void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) { + assert(first + 64 == last); + static_cast(last); // for avoiding unused-variable warning + word_t w[64]; + std::fill(w, w + 64, 0); + for (std::size_t i = 0; i < 16; ++i) { + w[i] = (static_cast(mask_8bit(*(first + i * 4))) << 24) | + (static_cast(mask_8bit(*(first + i * 4 + 1))) << 16) | + (static_cast(mask_8bit(*(first + i * 4 + 2))) << 8) | + (static_cast(mask_8bit(*(first + i * 4 + 3)))); + } + for (std::size_t i = 16; i < 64; ++i) { + w[i] = mask_32bit(ssig1(w[i - 2]) + w[i - 7] + ssig0(w[i - 15]) + + w[i - 16]); + } + + word_t a = *message_digest; + word_t b = *(message_digest + 1); + word_t c = *(message_digest + 2); + word_t d = *(message_digest + 3); + word_t e = *(message_digest + 4); + word_t f = *(message_digest + 5); + word_t g = *(message_digest + 6); + word_t h = *(message_digest + 7); + + for (std::size_t i = 0; i < 64; ++i) { + word_t temp1 = h + bsig1(e) + ch(e, f, g) + add_constant[i] + w[i]; + word_t temp2 = bsig0(a) + maj(a, b, c); + h = g; + g = f; + f = e; + e = mask_32bit(d + temp1); + d = c; + c = b; + b = a; + a = mask_32bit(temp1 + temp2); + } + *message_digest += a; + *(message_digest + 1) += b; + *(message_digest + 2) += c; + *(message_digest + 3) += d; + *(message_digest + 4) += e; + *(message_digest + 5) += f; + *(message_digest + 6) += g; + *(message_digest + 7) += h; + for (std::size_t i = 0; i < 8; ++i) { + *(message_digest + i) = mask_32bit(*(message_digest + i)); + } } -static uint32_t const add_constant[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; +} // namespace detail + +template +void output_hex(InIter first, InIter last, std::ostream& os) { + os.setf(std::ios::hex, std::ios::basefield); + while (first != last) { + os.width(2); + os.fill('0'); + os << static_cast(*first); + ++first; + } + os.setf(std::ios::dec, std::ios::basefield); +} -static uint32_t const initial_message_digest[8] = { - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -}; +template +void bytes_to_hex_string(InIter first, InIter last, std::string& hex_str) { + std::ostringstream oss; + output_hex(first, last, oss); + hex_str.assign(oss.str()); +} -inline uint32_t ch(uint32_t x, uint32_t y, uint32_t z) -{ - return (x & y) ^ ((~x) & z); +template +void bytes_to_hex_string(const InContainer& bytes, std::string& hex_str) { + bytes_to_hex_string(bytes.begin(), bytes.end(), hex_str); } -inline uint32_t maj(uint32_t x, uint32_t y, uint32_t z) -{ - return (x & y) ^ (x & z) ^ (y & z); +template +std::string bytes_to_hex_string(InIter first, InIter last) { + std::string hex_str; + bytes_to_hex_string(first, last, hex_str); + return hex_str; } -inline uint32_t rotr(uint32_t x, std::size_t n) -{ - assert(n < 32); - return mask_32bit((x >> n) | (x << (32 - n))); +template +std::string bytes_to_hex_string(const InContainer& bytes) { + std::string hex_str; + bytes_to_hex_string(bytes, hex_str); + return hex_str; } -inline uint32_t bsig0(uint32_t x) -{ - return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); +class hash256_one_by_one { + public: + hash256_one_by_one() { init(); } + + void init() { + buffer_.clear(); + std::fill(data_length_digits_, data_length_digits_ + 4, 0); + std::copy(detail::initial_message_digest, + detail::initial_message_digest + 8, h_); + } + + template + void process(RaIter first, RaIter last) { + add_to_data_length(static_cast(std::distance(first, last))); + std::copy(first, last, std::back_inserter(buffer_)); + std::size_t i = 0; + for (; i + 64 <= buffer_.size(); i += 64) { + detail::hash256_block(h_, buffer_.begin() + i, + buffer_.begin() + i + 64); + } + buffer_.erase(buffer_.begin(), buffer_.begin() + i); + } + + void finish() { + byte_t temp[64]; + std::fill(temp, temp + 64, 0); + std::size_t remains = buffer_.size(); + std::copy(buffer_.begin(), buffer_.end(), temp); + temp[remains] = 0x80; + + if (remains > 55) { + std::fill(temp + remains + 1, temp + 64, 0); + detail::hash256_block(h_, temp, temp + 64); + std::fill(temp, temp + 64 - 4, 0); + } else { + std::fill(temp + remains + 1, temp + 64 - 4, 0); + } + + write_data_bit_length(&(temp[56])); + detail::hash256_block(h_, temp, temp + 64); + } + + template + void get_hash_bytes(OutIter first, OutIter last) const { + for (const word_t* iter = h_; iter != h_ + 8; ++iter) { + for (std::size_t i = 0; i < 4 && first != last; ++i) { + *(first++) = detail::mask_8bit( + static_cast((*iter >> (24 - 8 * i)))); + } + } + } + + private: + void add_to_data_length(word_t n) { + word_t carry = 0; + data_length_digits_[0] += n; + for (std::size_t i = 0; i < 4; ++i) { + data_length_digits_[i] += carry; + if (data_length_digits_[i] >= 65536u) { + carry = data_length_digits_[i] >> 16; + data_length_digits_[i] &= 65535u; + } else { + break; + } + } + } + void write_data_bit_length(byte_t* begin) { + word_t data_bit_length_digits[4]; + std::copy(data_length_digits_, data_length_digits_ + 4, + data_bit_length_digits); + + // convert byte length to bit length (multiply 8 or shift 3 times left) + word_t carry = 0; + for (std::size_t i = 0; i < 4; ++i) { + word_t before_val = data_bit_length_digits[i]; + data_bit_length_digits[i] <<= 3; + data_bit_length_digits[i] |= carry; + data_bit_length_digits[i] &= 65535u; + carry = (before_val >> (16 - 3)) & 65535u; + } + + // write data_bit_length + for (int i = 3; i >= 0; --i) { + (*begin++) = static_cast(data_bit_length_digits[i] >> 8); + (*begin++) = static_cast(data_bit_length_digits[i]); + } + } + std::vector buffer_; + word_t data_length_digits_[4]; // as 64bit integer (16bit x 4 integer) + word_t h_[8]; +}; + +inline void get_hash_hex_string(const hash256_one_by_one& hasher, + std::string& hex_str) { + byte_t hash[k_digest_size]; + hasher.get_hash_bytes(hash, hash + k_digest_size); + return bytes_to_hex_string(hash, hash + k_digest_size, hex_str); } -inline uint32_t bsig1(uint32_t x) -{ - return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); +inline std::string get_hash_hex_string(const hash256_one_by_one& hasher) { + std::string hex_str; + get_hash_hex_string(hasher, hex_str); + return hex_str; } -inline uint32_t shr(uint32_t x, std::size_t n) -{ - assert(n < 32); - return x >> n; +namespace impl { +template +void hash256_impl(RaIter first, RaIter last, OutIter first2, OutIter last2, int, + std::random_access_iterator_tag) { + hash256_one_by_one hasher; + // hasher.init(); + hasher.process(first, last); + hasher.finish(); + hasher.get_hash_bytes(first2, last2); } -inline uint32_t ssig0(uint32_t x) -{ - return rotr(x, 7) ^ rotr(x, 18) ^ shr(x, 3); +template +void hash256_impl(InputIter first, InputIter last, OutIter first2, + OutIter last2, int buffer_size, std::input_iterator_tag) { + std::vector buffer(buffer_size); + hash256_one_by_one hasher; + // hasher.init(); + while (first != last) { + int size = buffer_size; + for (int i = 0; i != buffer_size; ++i, ++first) { + if (first == last) { + size = i; + break; + } + buffer[i] = *first; + } + hasher.process(buffer.begin(), buffer.begin() + size); + } + hasher.finish(); + hasher.get_hash_bytes(first2, last2); +} } -inline uint32_t ssig1(uint32_t x) -{ - return rotr(x, 17) ^ rotr(x, 19) ^ shr(x, 10); +template +void hash256(InIter first, InIter last, OutIter first2, OutIter last2, + int buffer_size = PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR) { + picosha2::impl::hash256_impl( + first, last, first2, last2, buffer_size, + typename std::iterator_traits::iterator_category()); } -template -void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) -{ - (void)last; // FIXME: check this is valid - uint32_t w[64]; - std::fill(w, w+64, 0); - for (std::size_t i = 0; i < 16; ++i) - w[i] = (static_cast(mask_8bit(*(first + i * 4))) << 24) - | (static_cast(mask_8bit(*(first + i * 4 + 1))) << 16) - | (static_cast(mask_8bit(*(first + i * 4 + 2))) << 8) - | (static_cast(mask_8bit(*(first + i * 4 + 3)))); - for (std::size_t i = 16; i < 64; ++i) - w[i] = mask_32bit(ssig1(w[i-2])+w[i-7]+ssig0(w[i-15])+w[i-16]); - - uint32_t a = *message_digest; - uint32_t b = *(message_digest + 1); - uint32_t c = *(message_digest + 2); - uint32_t d = *(message_digest + 3); - uint32_t e = *(message_digest + 4); - uint32_t f = *(message_digest + 5); - uint32_t g = *(message_digest + 6); - uint32_t h = *(message_digest + 7); - - for (std::size_t i = 0; i < 64; ++i) - { - uint32_t temp1 = h+bsig1(e)+ch(e,f,g)+add_constant[i]+w[i]; - uint32_t temp2 = bsig0(a)+maj(a,b,c); - h = g; - g = f; - f = e; - e = mask_32bit(d+temp1); - d = c; - c = b; - b = a; - a = mask_32bit(temp1+temp2); - } - *message_digest += a; - *(message_digest+1) += b; - *(message_digest+2) += c; - *(message_digest+3) += d; - *(message_digest+4) += e; - *(message_digest+5) += f; - *(message_digest+6) += g; - *(message_digest+7) += h; - for (std::size_t i = 0; i < 8; ++i) - *(message_digest+i) = mask_32bit(*(message_digest+i)); +template +void hash256(InIter first, InIter last, OutContainer& dst) { + hash256(first, last, dst.begin(), dst.end()); } -}//namespace detail +template +void hash256(const InContainer& src, OutIter first, OutIter last) { + hash256(src.begin(), src.end(), first, last); +} -class hash256_one_by_one -{ -public: - hash256_one_by_one() - { - init(); - } - - void init() - { - buffer_.clear(); - std::fill(data_length_digits_, data_length_digits_ + 4, 0); - std::copy(detail::initial_message_digest, detail::initial_message_digest+8, h_); - } - - template - void process(RaIter first, RaIter last) - { - add_to_data_length(std::distance(first, last)); - std::copy(first, last, std::back_inserter(buffer_)); - std::size_t i = 0; - for (;i + 64 <= buffer_.size(); i+=64) - detail::hash256_block(h_, buffer_.begin()+i, buffer_.begin()+i+64); - buffer_.erase(buffer_.begin(), buffer_.begin()+i); - } - - void finish() - { - uint8_t temp[64]; - std::fill(temp, temp+64, 0); - std::size_t remains = buffer_.size(); - std::copy(buffer_.begin(), buffer_.end(), temp); - temp[remains] = 0x80; - - if (remains > 55) - { - std::fill(temp+remains+1, temp+64, 0); - detail::hash256_block(h_, temp, temp+64); - std::fill(temp, temp+64-4, 0); - } - else - std::fill(temp+remains+1, temp+64-4, 0); - - write_data_bit_length(&(temp[56])); - detail::hash256_block(h_, temp, temp+64); - } - - template - void get_hash_bytes(OutIter first, OutIter last) const - { - for (uint32_t const* iter = h_; iter != h_ + 8; ++iter) - for (std::size_t i = 0; i < 4 && first != last; ++i) - *(first++) = detail::mask_8bit(static_cast(*iter >> (24 - 8 * i))); - } - -private: - void add_to_data_length(uint32_t n) - { - uint32_t carry = 0; - data_length_digits_[0] += n; - for (std::size_t i = 0; i < 4; ++i) - { - data_length_digits_[i] += carry; - if (data_length_digits_[i] >= 65536u) - { - carry = data_length_digits_[i] >> 16; - data_length_digits_[i] &= 65535u; - } - else - break; - } - } - void write_data_bit_length(uint8_t* begin) - { - uint32_t data_bit_length_digits[4]; - std::copy( - data_length_digits_, data_length_digits_ + 4, - data_bit_length_digits - ); - - // convert byte length to bit length (multiply 8 or shift 3 times left) - uint32_t carry = 0; - for (std::size_t i = 0; i < 4; ++i) - { - uint32_t before_val = data_bit_length_digits[i]; - data_bit_length_digits[i] <<= 3; - data_bit_length_digits[i] |= carry; - data_bit_length_digits[i] &= 65535u; - carry = (before_val >> (16-3)) & 65535u; - } - - // write data_bit_length - for (int i = 3; i >= 0; --i) - { - (*begin++) = static_cast(data_bit_length_digits[i] >> 8); - (*begin++) = static_cast(data_bit_length_digits[i]); - } - } - std::vector buffer_; - uint32_t data_length_digits_[4]; //as 64bit integer (16bit x 4 integer) - uint32_t h_[8]; -}; +template +void hash256(const InContainer& src, OutContainer& dst) { + hash256(src.begin(), src.end(), dst.begin(), dst.end()); +} -template -void hash256(RaIter first, RaIter last, OutIter first2, OutIter last2) -{ - hash256_one_by_one hasher; - //hasher.init(); - hasher.process(first, last); - hasher.finish(); - hasher.get_hash_bytes(first2, last2); +template +void hash256_hex_string(InIter first, InIter last, std::string& hex_str) { + byte_t hashed[k_digest_size]; + hash256(first, last, hashed, hashed + k_digest_size); + std::ostringstream oss; + output_hex(hashed, hashed + k_digest_size, oss); + hex_str.assign(oss.str()); } template std::vector hash256(RaContainer const& _src) { - std::vector ret(32); - hash256(_src.begin(), _src.end(), ret.begin(), ret.end()); - return ret; + std::vector ret(32); + hash256(_src.begin(), _src.end(), ret.begin(), ret.end()); + return ret; +} + +template +std::string hash256_hex_string(InIter first, InIter last) { + std::string hex_str; + hash256_hex_string(first, last, hex_str); + return hex_str; +} + +inline void hash256_hex_string(const std::string& src, std::string& hex_str) { + hash256_hex_string(src.begin(), src.end(), hex_str); } -}//namespace picosha2 +template +void hash256_hex_string(const InContainer& src, std::string& hex_str) { + hash256_hex_string(src.begin(), src.end(), hex_str); +} + +template +std::string hash256_hex_string(const InContainer& src) { + return hash256_hex_string(src.begin(), src.end()); +} +templatevoid hash256(std::ifstream& f, OutIter first, OutIter last){ + hash256(std::istreambuf_iterator(f), std::istreambuf_iterator(), first,last); + +} +}// namespace picosha2 +#endif // PICOSHA2_H diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 0bd6f6bc0252..f8f6e4a0e7a0 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -15,18 +15,25 @@ then exit 1 fi +function preparedGrep() +{ + git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "picosha2.h" + return $? +} + + FORMATERROR=$( ( - git grep -nIE "#include \"" -- '*.h' '*.cpp' | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters - git grep -nIE "\<(if|for|while|switch)\(" -- '*.h' '*.cpp' # no space after "if", "for", "while" or "switch" - git grep -nIE "\\s*\([^=]*\>\s:\s.*\)" -- '*.h' '*.cpp' # no space before range based for-loop - git grep -nIE "\\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for" - git grep -nIE "[,\(<]\s*const " -- '*.h' '*.cpp' # const on left side of type - git grep -nIE "^\s*(static)?\s*const " -- '*.h' '*.cpp' # const on left side of type (beginning of line) - git grep -nIE "^ [^*]|[^*] | [^*]" -- '*.h' '*.cpp' # uses spaces for indentation or mixes spaces and tabs - git grep -nIE "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return) + preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters + preparedGrep "\<(if|for|while|switch)\(" # no space after "if", "for", "while" or "switch" + preparedGrep "\\s*\([^=]*\>\s:\s.*\)" # no space before range based for-loop + preparedGrep "\\s*\(.*\)\s*\{\s*$" # "{\n" on same line as "if" / "for" + preparedGrep "[,\(<]\s*const " # const on left side of type + preparedGrep "^\s*(static)?\s*const " # const on left side of type (beginning of line) + preparedGrep "^ [^*]|[^*] | [^*]" # uses spaces for indentation or mixes spaces and tabs + preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return) # right-aligned reference pointer star (needs to exclude return and comments) - git grep -nIE "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*" + preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*" ) | egrep -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" ) From 749ec04708059ce70a57840a0322f9e14831c15b Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 09:53:15 -0400 Subject: [PATCH 024/479] Add empty LazyInit.h header --- libsolutil/CMakeLists.txt | 1 + libsolutil/LazyInit.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 libsolutil/LazyInit.h diff --git a/libsolutil/CMakeLists.txt b/libsolutil/CMakeLists.txt index 2c6b6b26fbca..3672657e8edb 100644 --- a/libsolutil/CMakeLists.txt +++ b/libsolutil/CMakeLists.txt @@ -19,6 +19,7 @@ set(sources JSON.h Keccak256.cpp Keccak256.h + LazyInit.h picosha2.h Result.h StringUtils.cpp diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h new file mode 100644 index 000000000000..39e4786df40d --- /dev/null +++ b/libsolutil/LazyInit.h @@ -0,0 +1,18 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ + +#pragma once From 472fb21ee00aeec35dd8726d9d7c3d7e23050c97 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Thu, 14 May 2020 12:34:37 +0200 Subject: [PATCH 025/479] [Sol->Yul] Enabling new bytes(n) --- libsolidity/codegen/YulUtilFunctions.cpp | 2 -- .../abiEncoderV1/abi_encode_calldata_slice.sol | 1 + .../abiEncoderV2/abi_encode_calldata_slice.sol | 1 + .../semanticTests/array/create_memory_byte_array.sol | 12 ++++++++++++ .../inlineAssembly/inline_assembly_memory_access.sol | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/array/create_memory_byte_array.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 4fd681e1fbf2..34b2e127930c 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1499,8 +1499,6 @@ string YulUtilFunctions::zeroComplexMemoryArrayFunction(ArrayType const& _type) string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type) { - solUnimplementedAssert(!_type.isByteArray(), ""); - string functionName = "allocate_and_zero_memory_array_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol index 917704e53a2e..aaffb5b4b861 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol @@ -56,6 +56,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // test_bytes() -> diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol index 1f14446723c7..6253039f125b 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol @@ -57,6 +57,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // test_bytes() -> diff --git a/test/libsolidity/semanticTests/array/create_memory_byte_array.sol b/test/libsolidity/semanticTests/array/create_memory_byte_array.sol new file mode 100644 index 000000000000..67dcbffc3f90 --- /dev/null +++ b/test/libsolidity/semanticTests/array/create_memory_byte_array.sol @@ -0,0 +1,12 @@ +contract C { + function f() public returns (bytes1) { + bytes memory x = new bytes(35); + assert(x.length == 35); + x[34] = "A"; + return (x[34]); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> "A" diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol index b43b5f611a02..857af4243b6c 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol @@ -9,5 +9,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // test() -> 0x20, 0x5, "12345" From e751a1c23d923ad67b9d8468b162faf4714d01ec Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 14 May 2020 11:56:10 +0200 Subject: [PATCH 026/479] Move scopes into resolver. --- libsolidity/analysis/NameAndTypeResolver.cpp | 5 +---- libsolidity/analysis/NameAndTypeResolver.h | 3 +-- libsolidity/interface/CompilerStack.cpp | 4 ++-- libsolidity/interface/CompilerStack.h | 2 -- test/libsolidity/Assembly.cpp | 3 +-- test/libsolidity/SolidityExpressionCompiler.cpp | 3 +-- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 87482b78c67d..fa1840d06a43 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -37,16 +37,13 @@ namespace solidity::frontend NameAndTypeResolver::NameAndTypeResolver( GlobalContext& _globalContext, langutil::EVMVersion _evmVersion, - map>& _scopes, ErrorReporter& _errorReporter ): - m_scopes(_scopes), m_evmVersion(_evmVersion), m_errorReporter(_errorReporter), m_globalContext(_globalContext) { - if (!m_scopes[nullptr]) - m_scopes[nullptr] = make_shared(); + m_scopes[nullptr] = make_shared(); for (Declaration const* declaration: _globalContext.declarations()) { solAssert(m_scopes[nullptr]->registerDeclaration(*declaration), "Unable to register global declaration."); diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h index 845b2870f796..8a315510fba8 100644 --- a/libsolidity/analysis/NameAndTypeResolver.h +++ b/libsolidity/analysis/NameAndTypeResolver.h @@ -56,7 +56,6 @@ class NameAndTypeResolver: private boost::noncopyable NameAndTypeResolver( GlobalContext& _globalContext, langutil::EVMVersion _evmVersion, - std::map>& _scopes, langutil::ErrorReporter& _errorReporter ); /// Registers all declarations found in the AST node, usually a source unit. @@ -123,7 +122,7 @@ class NameAndTypeResolver: private boost::noncopyable /// where nullptr denotes the global scope. Note that structs are not scope since they do /// not contain code. /// Aliases (for example `import "x" as y;`) create multiple pointers to the same scope. - std::map>& m_scopes; + std::map> m_scopes; langutil::EVMVersion m_evmVersion; DeclarationContainer* m_currentScope = nullptr; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index e50d8990ab1f..5b79aa0c6b80 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -214,7 +214,6 @@ void CompilerStack::reset(bool _keepSettings) m_metadataHash = MetadataHash::IPFS; } m_globalContext.reset(); - m_scopes.clear(); m_sourceOrder.clear(); m_contracts.clear(); m_errorReporter.clear(); @@ -314,7 +313,8 @@ bool CompilerStack::analyze() noErrors = false; m_globalContext = make_shared(); - NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_scopes, m_errorReporter); + // We need to keep the same resolver during the whole process. + NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter); for (Source const* source: m_sourceOrder) if (source->ast && !resolver.registerDeclarations(*source->ast)) return false; diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 8bc8828c6305..d66f003b7e63 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -447,8 +447,6 @@ class CompilerStack: boost::noncopyable std::map m_smtlib2Responses; std::shared_ptr m_globalContext; std::vector m_sourceOrder; - /// This is updated during compilation. - std::map> m_scopes; std::map m_contracts; langutil::ErrorList m_errorList; langutil::ErrorReporter m_errorReporter; diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 2af81c932d19..898de1427c0b 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -58,9 +58,8 @@ evmasm::AssemblyItems compileContract(std::shared_ptr _sourceCode) BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared(_sourceCode))); BOOST_CHECK(!!sourceUnit); - map> scopes; GlobalContext globalContext; - NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), scopes, errorReporter); + NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), errorReporter); DeclarationTypeChecker declarationTypeChecker(errorReporter, solidity::test::CommonOptions::get().evmVersion()); solAssert(Error::containsOnlyWarnings(errorReporter.errors()), ""); resolver.registerDeclarations(*sourceUnit); diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 875a042fd49f..d40e64ebf5fd 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -116,8 +116,7 @@ bytes compileFirstExpression( ErrorList errors; ErrorReporter errorReporter(errors); GlobalContext globalContext; - map> scopes; - NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), scopes, errorReporter); + NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), errorReporter); resolver.registerDeclarations(*sourceUnit); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) From 79e62f66008cff4b8c6c6bc1664b4958054bd735 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 14 May 2020 13:58:00 +0200 Subject: [PATCH 027/479] Set version to 0.6.9. --- CMakeLists.txt | 2 +- Changelog.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee698a715025..a5689009e03c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.8") +set(PROJECT_VERSION "0.6.9") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index 48eea359754e..31d1e43a68e4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,15 @@ +### 0.6.9 (unreleased) + +Language Features: + + +Compiler Features: + + +Bugfixes: + + + ### 0.6.8 (2020-05-14) Important Bugfixes: From a7f6a4bee644caee42780f55a9ee262c22bc3e11 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 13 May 2020 18:09:48 +0200 Subject: [PATCH 028/479] Update PPA scripts. --- scripts/deps-ppa/static_z3.sh | 14 +++++--------- scripts/release_ppa.sh | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/deps-ppa/static_z3.sh b/scripts/deps-ppa/static_z3.sh index 7eb461821068..c5f6d6ea4438 100755 --- a/scripts/deps-ppa/static_z3.sh +++ b/scripts/deps-ppa/static_z3.sh @@ -25,11 +25,9 @@ set -ev keyid=70D110489D66E2F6 email=builds@ethereum.org packagename=libz3-static-dev -# On the next version the git cherry-pick below should be removed and the patch suffix removed from the version string. -version=4.8.7 -version_patchsuffix=-1 +version=4.8.8 -DISTRIBUTIONS="bionic disco eoan focal" +DISTRIBUTIONS="bionic eoan focal" for distribution in $DISTRIBUTIONS do @@ -44,10 +42,8 @@ ppafilesurl=https://launchpad.net/~ethereum/+archive/ubuntu/${pparepo}/+files # Fetch source git clone --branch z3-${version} https://github.com/Z3Prover/z3.git cd z3 -# Patch build failure. -git cherry-pick e212159f4e -debversion="${version}${version_patchsuffix}" +debversion="${version}" CMAKE_OPTIONS="-DZ3_BUILD_LIBZ3_SHARED=OFF -DCMAKE_BUILD_TYPE=Release" @@ -181,7 +177,7 @@ This program is free software: you can redistribute it and/or modify Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". EOF cat < debian/changelog -libz3-static-dev (0.0.1-2ubuntu0) saucy; urgency=low +libz3-static-dev (0.0.1-1ubuntu0) saucy; urgency=low * Initial release. @@ -191,7 +187,7 @@ mkdir debian/source echo "3.0 (quilt)" > debian/source/format chmod +x debian/rules -versionsuffix=2ubuntu0~${distribution} +versionsuffix=1ubuntu0~${distribution} EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "build of ${version}" # build source package diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index d84b3fd3653f..6d50e00667b9 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -55,9 +55,9 @@ keyid=70D110489D66E2F6 email=builds@ethereum.org packagename=solc -static_build_distribution=disco +static_build_distribution=focal -DISTRIBUTIONS="bionic disco eoan focal" +DISTRIBUTIONS="bionic eoan focal" if is_release then @@ -85,7 +85,7 @@ else fi if [ $distribution = focal ] then - SMTDEPENDENCY="libz3-dev, + SMTDEPENDENCY="libz3-static-dev, libcvc4-dev, " elif [ $distribution = disco ] From b56536aeb27ed892ea9960e7264f16337a395be8 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 13 May 2020 18:16:21 +0200 Subject: [PATCH 029/479] Update Docker images. --- .circleci/config.yml | 4 ++-- .circleci/docker/Dockerfile.ubuntu2004 | 5 ++++- .circleci/docker/Dockerfile.ubuntu2004.clang | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 49f78fa19b11..0620cd6679ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,10 +12,10 @@ parameters: default: "4" ubuntu-2004-docker-image-rev: type: string - default: "1" + default: "2" ubuntu-2004-clang-docker-image-rev: type: string - default: "1" + default: "2" ubuntu-1604-clang-ossfuzz-docker-image-rev: type: string default: "2" diff --git a/.circleci/docker/Dockerfile.ubuntu2004 b/.circleci/docker/Dockerfile.ubuntu2004 index d39025809123..a021b6533486 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004 +++ b/.circleci/docker/Dockerfile.ubuntu2004 @@ -26,6 +26,9 @@ FROM buildpack-deps:focal AS base ARG DEBIAN_FRONTEND=noninteractive RUN set -ex; \ + dist=$(grep DISTRIB_CODENAME /etc/lsb-release | cut -d= -f2); \ + echo "deb http://ppa.launchpad.net/ethereum/cpp-build-deps/ubuntu $dist main" >> /etc/apt/sources.list ; \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1c52189c923f6ca9 ; \ apt-get update; \ apt-get install -qqy --no-install-recommends \ build-essential \ @@ -33,7 +36,7 @@ RUN set -ex; \ cmake ninja-build \ libboost-filesystem-dev libboost-test-dev libboost-system-dev \ libboost-program-options-dev \ - libcvc4-dev z3 libz3-dev \ + libcvc4-dev libz3-static-dev \ ; \ apt-get install -qy python3-pip python3-sphinx; \ pip3 install codecov; \ diff --git a/.circleci/docker/Dockerfile.ubuntu2004.clang b/.circleci/docker/Dockerfile.ubuntu2004.clang index f436c34b7647..c8d057eb11a0 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004.clang +++ b/.circleci/docker/Dockerfile.ubuntu2004.clang @@ -26,6 +26,9 @@ FROM buildpack-deps:focal AS base ARG DEBIAN_FRONTEND=noninteractive RUN set -ex; \ + dist=$(grep DISTRIB_CODENAME /etc/lsb-release | cut -d= -f2); \ + echo "deb http://ppa.launchpad.net/ethereum/cpp-build-deps/ubuntu $dist main" >> /etc/apt/sources.list ; \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1c52189c923f6ca9 ; \ apt-get update; \ apt-get install -qqy --no-install-recommends \ build-essential \ @@ -33,8 +36,8 @@ RUN set -ex; \ cmake ninja-build \ libboost-filesystem-dev libboost-test-dev libboost-system-dev \ libboost-program-options-dev \ - clang llvm-dev \ - z3 libz3-dev \ + clang \ + libz3-static-dev \ ; \ rm -rf /var/lib/apt/lists/* From 030390217393dbac1e78664b6b3f54accda2dca6 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 14 May 2020 14:09:27 +0200 Subject: [PATCH 030/479] Update smt test expectations. --- .../loops/for_loop_array_assignment_storage_memory.sol | 1 - .../loops/for_loop_array_assignment_storage_storage.sol | 1 - .../loops/while_loop_array_assignment_storage_storage.sol | 1 - .../operators/compound_assignment_division_1.sol | 2 ++ .../operators/compound_assignment_division_2.sol | 2 ++ .../operators/compound_assignment_division_3.sol | 2 ++ .../smtCheckerTests/operators/delete_array_index_2d.sol | 1 - .../operators/division_truncates_correctly_1.sol | 2 ++ .../operators/division_truncates_correctly_2.sol | 2 ++ .../operators/division_truncates_correctly_3.sol | 2 ++ .../operators/division_truncates_correctly_4.sol | 2 ++ .../operators/division_truncates_correctly_5.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_even.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_n.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol | 2 ++ 16 files changed, 24 insertions(+), 4 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol index 0b301505b4b0..2466e1efd28c 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol @@ -19,5 +19,4 @@ contract LoopFor2 { } } // ---- -// Warning: (316-336): Assertion violation happens here // Warning: (363-382): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index 333273781373..a90053024d47 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,6 +19,5 @@ contract LoopFor2 { } } // ---- -// Warning: (317-337): Assertion violation happens here // Warning: (341-360): Assertion violation happens here // Warning: (364-383): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol index 92d1ded3ee46..96f171054f78 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol @@ -21,6 +21,5 @@ contract LoopFor2 { } } // ---- -// Warning: (296-316): Assertion violation happens here // Warning: (320-339): Assertion violation happens here // Warning: (343-362): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol index 2e07fc9c1371..e3a8ea1fb75c 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol @@ -9,4 +9,6 @@ contract C { } } // ---- +// Warning: (129-143): Error trying to invoke SMT solver. +// Warning: (147-161): Error trying to invoke SMT solver. // Warning: (147-161): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol index f7c347047baa..83bd7cb6b0ae 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol @@ -10,4 +10,6 @@ contract C { } } // ---- +// Warning: (163-184): Error trying to invoke SMT solver. +// Warning: (188-209): Error trying to invoke SMT solver. // Warning: (188-209): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol index 5b466f1739df..b941a5767c40 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol @@ -10,4 +10,6 @@ contract C { } } // ---- +// Warning: (171-190): Error trying to invoke SMT solver. +// Warning: (194-213): Error trying to invoke SMT solver. // Warning: (194-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol index 8a1ba5e6ef90..a47763c03cf0 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol @@ -16,4 +16,3 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (174-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol index 6bbc56a402fe..b0ea1e34de0a 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol index 6478e3298952..e8afbdf59441 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (105-123): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol index 1e58d709a37f..81ab88a4eceb 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == -3); } } +// ---- +// Warning: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol index 9f8452bb2782..f6e6b57d140e 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == -3); } } +// ---- +// Warning: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol index 2ac47115633c..d93a508f3547 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod.sol b/test/libsolidity/smtCheckerTests/operators/mod.sol index 6a0730c01ed2..358b52df247c 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod.sol @@ -8,3 +8,5 @@ contract C { assert(z1 == z2); } } +// ---- +// Warning: (166-182): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_even.sol b/test/libsolidity/smtCheckerTests/operators/mod_even.sol index 184653eaca3a..1bbdc38b72b4 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_even.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_even.sol @@ -8,3 +8,5 @@ contract C assert((y % 2) == 0); } } +// ---- +// Warning: (122-142): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n.sol b/test/libsolidity/smtCheckerTests/operators/mod_n.sol index 8df3ac4be733..f4b1ee3e86b4 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n.sol @@ -8,3 +8,5 @@ contract C assert(z < y); } } +// ---- +// Warning: (126-139): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol index fc6c7a8d6675..9c4241f0bc58 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol @@ -8,3 +8,5 @@ contract C assert(z < 100_000); } } +// ---- +// Warning: (130-149): Error trying to invoke SMT solver. From af87d39bd67c79f78fdb2aae62616867be68e521 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 14 May 2020 14:53:38 +0200 Subject: [PATCH 031/479] Update osx deps script. --- .circleci/osx_install_dependencies.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/osx_install_dependencies.sh b/.circleci/osx_install_dependencies.sh index 2409cbad7da6..06468013980c 100755 --- a/.circleci/osx_install_dependencies.sh +++ b/.circleci/osx_install_dependencies.sh @@ -43,13 +43,13 @@ then ./scripts/install_obsolete_jsoncpp_1_7_4.sh # z3 - wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.7/z3-4.8.7-x64-osx-10.14.6.zip - unzip z3-4.8.7-x64-osx-10.14.6.zip - rm -f z3-4.8.7-x64-osx-10.14.6.zip - cp z3-4.8.7-x64-osx-10.14.6/bin/libz3.a /usr/local/lib - cp z3-4.8.7-x64-osx-10.14.6/bin/z3 /usr/local/bin - cp z3-4.8.7-x64-osx-10.14.6/include/* /usr/local/include - rm -rf z3-4.8.7-x64-osx-10.14.6 + wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-osx-10.14.6.zip + unzip z3-4.8.8-x64-osx-10.14.6.zip + rm -f z3-4.8.8-x64-osx-10.14.6.zip + cp z3-4.8.8-x64-osx-10.14.6/bin/libz3.a /usr/local/lib + cp z3-4.8.8-x64-osx-10.14.6/bin/z3 /usr/local/bin + cp z3-4.8.8-x64-osx-10.14.6/include/* /usr/local/include + rm -rf z3-4.8.8-x64-osx-10.14.6 # evmone wget https://github.com/ethereum/evmone/releases/download/v0.4.0/evmone-0.4.0-darwin-x86_64.tar.gz From 197f6bf3c895678e53797f2ac4a1c43102e08721 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 10:30:55 -0400 Subject: [PATCH 032/479] Add implementation of LazyInit --- libsolutil/LazyInit.h | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h index 39e4786df40d..92d28e0c21cb 100644 --- a/libsolutil/LazyInit.h +++ b/libsolutil/LazyInit.h @@ -16,3 +16,87 @@ */ #pragma once + +#include +#include + +#include +#include +#include +#include + +namespace solidity::util +{ + +DEV_SIMPLE_EXCEPTION(BadLazyInitAccess); + +/** + * Represents a lazy-initialized value. + * @tparam T the type of the lazy-initialized object; may not be a function, reference, array, or void type; may be const-qualified. + */ +template +class LazyInit +{ +public: + using value_type = T; + + static_assert(std::is_object_v, "Function, reference, and void types are not supported"); + static_assert(!std::is_array_v, "Array types are not supported."); + static_assert(!std::is_volatile_v, "Volatile-qualified types are not supported."); + + LazyInit() = default; + + LazyInit(LazyInit const&) = delete; + LazyInit& operator=(LazyInit const&) = delete; + + // Move constructor must be overridden to ensure that moved-from object is left empty. + constexpr LazyInit(LazyInit&& _other) noexcept: + m_value(std::move(_other.m_value)) + { + _other.m_value.reset(); + } + + // Copy and swap idiom. + LazyInit& operator=(LazyInit&& _other) noexcept + { + this->m_value.swap(_other.m_value); + _other.m_value.reset(); + } + + template + value_type& init(F&& _fun) + { + doInit(std::forward(_fun)); + return m_value.value(); + } + + template + value_type const& init(F&& _fun) const + { + doInit(std::forward(_fun)); + return m_value.value(); + } + +private: + constexpr void assertInitialized() const + { + assertThrow( + m_value.has_value(), + BadLazyInitAccess, + "Attempt to access an uninitialized LazyInit" + ); + } + + /// Although not quite logically const, this is marked const for pragmatic reasons. It doesn't change the platonic + /// value of the object (which is something that is initialized to some computed value on first use). + template + void doInit(F&& _fun) const + { + if (!m_value.has_value()) + m_value.emplace(std::forward(_fun)()); + } + + mutable std::optional m_value; +}; + +} From 0e26700f6521db81bfd43d7219b73b0d57965f45 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 13:53:36 -0400 Subject: [PATCH 033/479] Use LazyInit for MemberList::m_storageOffsets --- libsolidity/ast/Types.cpp | 31 ++++++++++++++++++------------- libsolidity/ast/Types.h | 5 ++++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index aa888d26bc09..4c9ef4776695 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -207,26 +207,31 @@ void MemberList::combine(MemberList const & _other) pair const* MemberList::memberStorageOffset(string const& _name) const { - if (!m_storageOffsets) - { - TypePointers memberTypes; - memberTypes.reserve(m_memberTypes.size()); - for (auto const& member: m_memberTypes) - memberTypes.push_back(member.type); - m_storageOffsets = std::make_unique(); - m_storageOffsets->computeOffsets(memberTypes); - } + StorageOffsets const& offsets = storageOffsets(); + for (size_t index = 0; index < m_memberTypes.size(); ++index) if (m_memberTypes[index].name == _name) - return m_storageOffsets->offset(index); + return offsets.offset(index); return nullptr; } u256 const& MemberList::storageSize() const { - // trigger lazy computation - memberStorageOffset(""); - return m_storageOffsets->storageSize(); + return storageOffsets().storageSize(); +} + +StorageOffsets const& MemberList::storageOffsets() const { + return m_storageOffsets.init([&]{ + TypePointers memberTypes; + memberTypes.reserve(m_memberTypes.size()); + for (auto const& member: m_memberTypes) + memberTypes.push_back(member.type); + + StorageOffsets storageOffsets; + storageOffsets.computeOffsets(memberTypes); + + return storageOffsets; + }); } /// Helper functions for type identifier diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index d549d4f24d25..cdccbc69b44b 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -139,8 +140,10 @@ class MemberList MemberMap::const_iterator end() const { return m_memberTypes.end(); } private: + StorageOffsets const& storageOffsets() const; + MemberMap m_memberTypes; - mutable std::unique_ptr m_storageOffsets; + util::LazyInit m_storageOffsets; }; static_assert(std::is_nothrow_move_constructible::value, "MemberList should be noexcept move constructible"); From 413fa92ceedec4d676632831e7c3fea71cfb0470 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 13:57:20 -0400 Subject: [PATCH 034/479] Use LazyInit for ContractDefinition::m_interfaceEvents --- libsolidity/ast/AST.cpp | 13 +++++++------ libsolidity/ast/AST.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 373a5a284158..c81f7d6be49b 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -153,10 +153,10 @@ FunctionDefinition const* ContractDefinition::receiveFunction() const vector const& ContractDefinition::interfaceEvents() const { - if (!m_interfaceEvents) - { + return m_interfaceEvents.init([&]{ set eventsSeen; - m_interfaceEvents = make_unique>(); + vector interfaceEvents; + for (ContractDefinition const* contract: annotation().linearizedBaseContracts) for (EventDefinition const* e: contract->events()) { @@ -169,11 +169,12 @@ vector const& ContractDefinition::interfaceEvents() cons if (eventsSeen.count(eventSignature) == 0) { eventsSeen.insert(eventSignature); - m_interfaceEvents->push_back(e); + interfaceEvents.push_back(e); } } - } - return *m_interfaceEvents; + + return interfaceEvents; + }); } vector, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 3c79912c2441..c1e90ba6f5d6 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -530,7 +531,7 @@ class ContractDefinition: public Declaration, public StructurallyDocumented bool m_abstract{false}; mutable std::unique_ptr, FunctionTypePointer>>> m_interfaceFunctionList[2]; - mutable std::unique_ptr> m_interfaceEvents; + util::LazyInit> m_interfaceEvents; }; class InheritanceSpecifier: public ASTNode From cffd1eaff160e1ed19abf4624795a5cc0f74cb2f Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 13:59:15 -0400 Subject: [PATCH 035/479] Use LazyInit for ContractDefinition::m_interfaceFunctionList --- libsolidity/ast/AST.cpp | 13 +++++++------ libsolidity/ast/AST.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index c81f7d6be49b..e553e45bd9e6 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -179,10 +179,10 @@ vector const& ContractDefinition::interfaceEvents() cons vector, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const { - if (!m_interfaceFunctionList[_includeInheritedFunctions]) - { + return m_interfaceFunctionList[_includeInheritedFunctions].init([&]{ set signaturesSeen; - m_interfaceFunctionList[_includeInheritedFunctions] = make_unique, FunctionTypePointer>>>(); + vector, FunctionTypePointer>> interfaceFunctionList; + for (ContractDefinition const* contract: annotation().linearizedBaseContracts) { if (_includeInheritedFunctions == false && contract != this) @@ -204,12 +204,13 @@ vector, FunctionTypePointer>> const& ContractDefinition: { signaturesSeen.insert(functionSignature); util::FixedHash<4> hash(util::keccak256(functionSignature)); - m_interfaceFunctionList[_includeInheritedFunctions]->emplace_back(hash, fun); + interfaceFunctionList.emplace_back(hash, fun); } } } - } - return *m_interfaceFunctionList[_includeInheritedFunctions]; + + return interfaceFunctionList; + }); } TypePointer ContractDefinition::type() const diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index c1e90ba6f5d6..285740f815b9 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -530,7 +530,7 @@ class ContractDefinition: public Declaration, public StructurallyDocumented ContractKind m_contractKind; bool m_abstract{false}; - mutable std::unique_ptr, FunctionTypePointer>>> m_interfaceFunctionList[2]; + util::LazyInit, FunctionTypePointer>>> m_interfaceFunctionList[2]; util::LazyInit> m_interfaceEvents; }; From 24dfa89ee7269b4293ffd8e080e0b9ddb811d196 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Tue, 12 May 2020 10:04:13 -0400 Subject: [PATCH 036/479] Use LazyInit for cached contract compilations --- test/contracts/AuctionRegistrar.cpp | 12 ++++++++---- test/contracts/FixedFeeRegistrar.cpp | 12 ++++++++---- test/contracts/Wallet.cpp | 12 ++++++++---- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index cf15f4ab421d..71e47aa0cd68 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -24,9 +24,12 @@ #include #include +#include + #include #include +#include using namespace std; using namespace solidity; @@ -212,17 +215,18 @@ contract GlobalRegistrar is Registrar, AuctionSystem { } )DELIMITER"; -static unique_ptr s_compiledRegistrar; +static LazyInit s_compiledRegistrar; class AuctionRegistrarTestFramework: public SolidityExecutionFramework { protected: void deployRegistrar() { - if (!s_compiledRegistrar) - s_compiledRegistrar = make_unique(compileContract(registrarCode, "GlobalRegistrar")); + bytes const& compiled = s_compiledRegistrar.init([&]{ + return compileContract(registrarCode, "GlobalRegistrar"); + }); - sendMessage(*s_compiledRegistrar, true); + sendMessage(compiled, true); BOOST_REQUIRE(m_transactionSuccessful); BOOST_REQUIRE(!m_output.empty()); } diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index 9535c1907054..a2998379fb96 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -20,8 +20,11 @@ * Tests for a fixed fee registrar contract. */ +#include + #include #include +#include #if defined(_MSC_VER) #pragma warning(push) @@ -122,17 +125,18 @@ contract FixedFeeRegistrar is Registrar { } )DELIMITER"; -static unique_ptr s_compiledRegistrar; +static LazyInit s_compiledRegistrar; class RegistrarTestFramework: public SolidityExecutionFramework { protected: void deployRegistrar() { - if (!s_compiledRegistrar) - s_compiledRegistrar = make_unique(compileContract(registrarCode, "FixedFeeRegistrar")); + bytes const& compiled = s_compiledRegistrar.init([&]{ + return compileContract(registrarCode, "FixedFeeRegistrar"); + }); - sendMessage(*s_compiledRegistrar, true); + sendMessage(compiled, true); BOOST_REQUIRE(m_transactionSuccessful); BOOST_REQUIRE(!m_output.empty()); } diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index b692b795463e..46800fa78522 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -20,8 +20,11 @@ * Tests for a (comparatively) complex multisig wallet contract. */ +#include + #include #include +#include #if defined(_MSC_VER) #pragma warning(push) @@ -435,7 +438,7 @@ contract Wallet is multisig, multiowned, daylimit { } )DELIMITER"; -static unique_ptr s_compiledWallet; +static LazyInit s_compiledWallet; class WalletTestFramework: public SolidityExecutionFramework { @@ -447,11 +450,12 @@ class WalletTestFramework: public SolidityExecutionFramework u256 _dailyLimit = 0 ) { - if (!s_compiledWallet) - s_compiledWallet = make_unique(compileContract(walletCode, "Wallet")); + bytes const& compiled = s_compiledWallet.init([&]{ + return compileContract(walletCode, "Wallet"); + }); bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners); - sendMessage(*s_compiledWallet + args, true, _value); + sendMessage(compiled + args, true, _value); BOOST_REQUIRE(m_transactionSuccessful); BOOST_REQUIRE(!m_output.empty()); } From eae31559be3cc83f2338eecc14f2928fa8a10ae6 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Wed, 13 May 2020 14:02:40 -0400 Subject: [PATCH 037/479] Use LazyInit for CompilerStack::Contract members --- libsolidity/interface/CompilerStack.cpp | 30 +++++-------------------- libsolidity/interface/CompilerStack.h | 11 ++++----- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index da561050bba0..76450cf60859 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -733,11 +733,7 @@ Json::Value const& CompilerStack::contractABI(Contract const& _contract) const solAssert(_contract.contract, ""); - // caches the result - if (!_contract.abi) - _contract.abi = make_unique(ABI::generate(*_contract.contract)); - - return *_contract.abi; + return _contract.abi.init([&]{ return ABI::generate(*_contract.contract); }); } Json::Value const& CompilerStack::storageLayout(string const& _contractName) const @@ -755,11 +751,7 @@ Json::Value const& CompilerStack::storageLayout(Contract const& _contract) const solAssert(_contract.contract, ""); - // caches the result - if (!_contract.storageLayout) - _contract.storageLayout = make_unique(StorageLayout().generate(*_contract.contract)); - - return *_contract.storageLayout; + return _contract.storageLayout.init([&]{ return StorageLayout().generate(*_contract.contract); }); } Json::Value const& CompilerStack::natspecUser(string const& _contractName) const @@ -777,11 +769,7 @@ Json::Value const& CompilerStack::natspecUser(Contract const& _contract) const solAssert(_contract.contract, ""); - // caches the result - if (!_contract.userDocumentation) - _contract.userDocumentation = make_unique(Natspec::userDocumentation(*_contract.contract)); - - return *_contract.userDocumentation; + return _contract.userDocumentation.init([&]{ return Natspec::userDocumentation(*_contract.contract); }); } Json::Value const& CompilerStack::natspecDev(string const& _contractName) const @@ -799,11 +787,7 @@ Json::Value const& CompilerStack::natspecDev(Contract const& _contract) const solAssert(_contract.contract, ""); - // caches the result - if (!_contract.devDocumentation) - _contract.devDocumentation = make_unique(Natspec::devDocumentation(*_contract.contract)); - - return *_contract.devDocumentation; + return _contract.devDocumentation.init([&]{ return Natspec::devDocumentation(*_contract.contract); }); } Json::Value CompilerStack::methodIdentifiers(string const& _contractName) const @@ -832,11 +816,7 @@ string const& CompilerStack::metadata(Contract const& _contract) const solAssert(_contract.contract, ""); - // cache the result - if (!_contract.metadata) - _contract.metadata = make_unique(createMetadata(_contract)); - - return *_contract.metadata; + return _contract.metadata.init([&]{ return createMetadata(_contract); }); } Scanner const& CompilerStack::scanner(string const& _sourceName) const diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 8bc8828c6305..e699101af826 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -342,11 +343,11 @@ class CompilerStack: boost::noncopyable std::string yulIROptimized; ///< Optimized experimental Yul IR code. std::string ewasm; ///< Experimental Ewasm text representation evmasm::LinkerObject ewasmObject; ///< Experimental Ewasm code - mutable std::unique_ptr metadata; ///< The metadata json that will be hashed into the chain. - mutable std::unique_ptr abi; - mutable std::unique_ptr storageLayout; - mutable std::unique_ptr userDocumentation; - mutable std::unique_ptr devDocumentation; + util::LazyInit metadata; ///< The metadata json that will be hashed into the chain. + util::LazyInit abi; + util::LazyInit storageLayout; + util::LazyInit userDocumentation; + util::LazyInit devDocumentation; mutable std::unique_ptr sourceMapping; mutable std::unique_ptr runtimeSourceMapping; }; From a392d5d63aa38e49d383855774046a97b0081242 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 14 May 2020 10:42:00 -0400 Subject: [PATCH 038/479] Remove misleading comment from LazyInit --- libsolutil/LazyInit.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h index 92d28e0c21cb..bc8c512d7084 100644 --- a/libsolutil/LazyInit.h +++ b/libsolutil/LazyInit.h @@ -56,7 +56,6 @@ class LazyInit _other.m_value.reset(); } - // Copy and swap idiom. LazyInit& operator=(LazyInit&& _other) noexcept { this->m_value.swap(_other.m_value); From 9d8ee5cc8f0d1dc1421e2c52368628651de6b5f9 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 14 May 2020 10:42:19 -0400 Subject: [PATCH 039/479] Remove unused assertInitialized from LazyInit --- libsolutil/LazyInit.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h index bc8c512d7084..aec126a65158 100644 --- a/libsolutil/LazyInit.h +++ b/libsolutil/LazyInit.h @@ -77,15 +77,6 @@ class LazyInit } private: - constexpr void assertInitialized() const - { - assertThrow( - m_value.has_value(), - BadLazyInitAccess, - "Attempt to access an uninitialized LazyInit" - ); - } - /// Although not quite logically const, this is marked const for pragmatic reasons. It doesn't change the platonic /// value of the object (which is something that is initialized to some computed value on first use). template From 648bb3aac77323090bbaa1458b778dea72ac96a2 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 14 May 2020 10:45:18 -0400 Subject: [PATCH 040/479] Update documentation of LazyInit --- libsolutil/LazyInit.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h index aec126a65158..fe2f6a916d22 100644 --- a/libsolutil/LazyInit.h +++ b/libsolutil/LazyInit.h @@ -31,8 +31,10 @@ namespace solidity::util DEV_SIMPLE_EXCEPTION(BadLazyInitAccess); /** - * Represents a lazy-initialized value. - * @tparam T the type of the lazy-initialized object; may not be a function, reference, array, or void type; may be const-qualified. + * A value that is initialized at some point after construction of the LazyInit. The stored value can only be accessed + * while calling "init", which initializes the stored value (if it has not already been initialized). + * + * @tparam T the type of the stored value; may not be a function, reference, array, or void type; may be const-qualified. */ template class LazyInit From 26406e40d0b1cb42793dc22d57bdf89ff345f17e Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 14 May 2020 10:48:50 -0400 Subject: [PATCH 041/479] Add empty LazyInit test suite --- test/CMakeLists.txt | 1 + test/libsolutil/LazyInit.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 test/libsolutil/LazyInit.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ff545faf3c08..1834d3b30d74 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,6 +34,7 @@ set(libsolutil_sources libsolutil/IterateReplacing.cpp libsolutil/JSON.cpp libsolutil/Keccak256.cpp + libsolutil/LazyInit.cpp libsolutil/StringUtils.cpp libsolutil/SwarmHash.cpp libsolutil/UTF8.cpp diff --git a/test/libsolutil/LazyInit.cpp b/test/libsolutil/LazyInit.cpp new file mode 100644 index 000000000000..22ee9d5412da --- /dev/null +++ b/test/libsolutil/LazyInit.cpp @@ -0,0 +1,28 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ + +#include + +namespace solidity::util::test +{ + +BOOST_AUTO_TEST_SUITE(LazyInit) + + +BOOST_AUTO_TEST_SUITE_END() + +} From a093962115cb9adf696def48da6b5f6772a64cfc Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 14 May 2020 11:27:56 -0400 Subject: [PATCH 042/479] Add tests --- test/libsolutil/LazyInit.cpp | 92 +++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/test/libsolutil/LazyInit.cpp b/test/libsolutil/LazyInit.cpp index 22ee9d5412da..346805c82093 100644 --- a/test/libsolutil/LazyInit.cpp +++ b/test/libsolutil/LazyInit.cpp @@ -15,13 +15,103 @@ along with solidity. If not, see . */ +#include + #include +#include + namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(LazyInit) +namespace +{ + +template +void assertInitCalled(LazyInit lazyInit, bool target) +{ + bool initCalled = false; + + lazyInit.init([&]{ + initCalled = true; + return T(); + }); + + BOOST_REQUIRE_EQUAL(initCalled, target); +} + +// Take ownership to ensure that it doesn't "mutate" +template +void assertNotEmpty(LazyInit _lazyInit) { assertInitCalled(std::move(_lazyInit), false); } + +// Take ownership to ensure that it doesn't "mutate" +template +void assertEmpty(LazyInit _lazyInit) { assertInitCalled(std::move(_lazyInit), true); } + +template +T valueOf(LazyInit _lazyInit) +{ + return _lazyInit.init([&]{ + BOOST_REQUIRE(false); // this should never be called + return T(); + }); +} + +} + +BOOST_AUTO_TEST_SUITE(LazyInitTests) + +BOOST_AUTO_TEST_CASE(default_constructed_is_empty) +{ + assertEmpty(LazyInit()); + assertEmpty(LazyInit()); +} + +BOOST_AUTO_TEST_CASE(initialized_is_not_empty) +{ + LazyInit lazyInit; + lazyInit.init([]{ return 12; }); + + assertNotEmpty(std::move(lazyInit)); +} + +BOOST_AUTO_TEST_CASE(init_returns_init_value) +{ + LazyInit lazyInit; + + BOOST_CHECK_EQUAL(lazyInit.init([]{ return 12; }), 12); + // A second call to init should not change the value + BOOST_CHECK_EQUAL(lazyInit.init([]{ return 42; }), 12); +} + +BOOST_AUTO_TEST_CASE(moved_from_is_empty) +{ + { + LazyInit lazyInit; + { [[maybe_unused]] auto pilfered = std::move(lazyInit); } + + assertEmpty(std::move(lazyInit)); + } + + { + LazyInit lazyInit; + lazyInit.init([]{ return 12; }); + + { [[maybe_unused]] auto pilfered = std::move(lazyInit); } + + assertEmpty(std::move(lazyInit)); + } +} + +BOOST_AUTO_TEST_CASE(move_constructed_has_same_value_as_original) +{ + LazyInit original; + original.init([]{ return 12; }); + + LazyInit moveConstructed = std::move(original); + BOOST_CHECK_EQUAL(valueOf(std::move(moveConstructed)), 12); +} BOOST_AUTO_TEST_SUITE_END() From 91e9d54c718b01bff740a93539e36d3513977f9f Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Mon, 4 May 2020 18:15:55 -0500 Subject: [PATCH 043/479] [Sol - Yul] Add support for ripemd160 & ecrecover. --- .../codegen/ir/IRGeneratorForStatements.cpp | 71 ++++++++++++++++--- .../builtinFunctions/ripemd160_empty.sol | 2 + .../builtinFunctions/sha256_empty.sol | 2 + .../semanticTests/ecrecover/ecrecover.sol | 2 + .../ecrecover/ecrecover_abiV2.sol | 2 + .../failing_ecrecover_invalid_input.sol | 2 + .../failing_ecrecover_invalid_input_asm.sol | 2 + ...failing_ecrecover_invalid_input_proper.sol | 2 + 8 files changed, 77 insertions(+), 8 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 553f618cd8cb..52852322721f 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -952,14 +952,6 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) "))\n"; break; } - case FunctionType::Kind::ECRecover: - case FunctionType::Kind::SHA256: - case FunctionType::Kind::RIPEMD160: - { - solAssert(!_functionCall.annotation().tryCall, ""); - appendExternalFunctionCall(_functionCall, arguments); - break; - } case FunctionType::Kind::ArrayPop: { auto const& memberAccessExpression = dynamic_cast(_functionCall.expression()).expression(); @@ -1153,6 +1145,69 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) break; } + case FunctionType::Kind::ECRecover: + case FunctionType::Kind::RIPEMD160: + case FunctionType::Kind::SHA256: + { + solAssert(!_functionCall.annotation().tryCall, ""); + solAssert(!functionType->valueSet(), ""); + solAssert(!functionType->gasSet(), ""); + solAssert(!functionType->bound(), ""); + + static map> precompiles = { + {FunctionType::Kind::ECRecover, std::make_tuple(1, 0)}, + {FunctionType::Kind::SHA256, std::make_tuple(2, 0)}, + {FunctionType::Kind::RIPEMD160, std::make_tuple(3, 12)}, + }; + auto [ address, offset ] = precompiles[functionType->kind()]; + TypePointers argumentTypes; + vector argumentStrings; + for (auto const& arg: arguments) + { + argumentTypes.emplace_back(&type(*arg)); + argumentStrings += IRVariable(*arg).stackSlots(); + } + Whiskers templ(R"( + let := () + let := ( ) + + mstore(0, 0) + + let := (,
, 0, , sub(, ), 0, 32) + if iszero() { () } + let := (mload(0)) + )"); + templ("call", m_context.evmVersion().hasStaticCall() ? "staticcall" : "call"); + templ("isCall", !m_context.evmVersion().hasStaticCall()); + templ("shl", m_utils.shiftLeftFunction(offset * 8)); + templ("allocateTemporary", m_utils.allocationTemporaryMemoryFunction()); + templ("pos", m_context.newYulVariable()); + templ("end", m_context.newYulVariable()); + templ("isECRecover", FunctionType::Kind::ECRecover == functionType->kind()); + if (FunctionType::Kind::ECRecover == functionType->kind()) + templ("encodeArgs", m_context.abiFunctions().tupleEncoder(argumentTypes, parameterTypes)); + else + templ("encodeArgs", m_context.abiFunctions().tupleEncoderPacked(argumentTypes, parameterTypes)); + templ("argumentString", joinHumanReadablePrefixed(argumentStrings)); + templ("address", toString(address)); + templ("success", m_context.newYulVariable()); + templ("retVars", IRVariable(_functionCall).commaSeparatedList()); + templ("forwardingRevert", m_utils.forwardingRevertFunction()); + if (m_context.evmVersion().canOverchargeGasForCall()) + // Send all gas (requires tangerine whistle EVM) + templ("gas", "gas()"); + else + { + // @todo The value 10 is not exact and this could be fine-tuned, + // but this has worked for years in the old code generator. + u256 gasNeededByCaller = evmasm::GasCosts::callGas(m_context.evmVersion()) + 10 + evmasm::GasCosts::callNewAccountGas; + templ("gas", "sub(gas(), " + formatNumber(gasNeededByCaller) + ")"); + } + + m_code << templ.render(); + + break; + } default: solUnimplemented("FunctionKind " + toString(static_cast(functionType->kind())) + " not yet implemented"); } diff --git a/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol b/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol index c79625d3cc5b..ea0fda8450a1 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol @@ -4,5 +4,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 0x9c1185a5c5e9fc54612808977ee8f548b2258d31000000000000000000000000 diff --git a/test/libsolidity/semanticTests/builtinFunctions/sha256_empty.sol b/test/libsolidity/semanticTests/builtinFunctions/sha256_empty.sol index bb9fc36161fa..ededa2fabf20 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/sha256_empty.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/sha256_empty.sol @@ -3,5 +3,7 @@ contract C { return sha256(""); } } +// ==== +// compileViaYul: also // ---- // f() -> 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 diff --git a/test/libsolidity/semanticTests/ecrecover/ecrecover.sol b/test/libsolidity/semanticTests/ecrecover/ecrecover.sol index 1beb451de8b0..1f462752b145 100644 --- a/test/libsolidity/semanticTests/ecrecover/ecrecover.sol +++ b/test/libsolidity/semanticTests/ecrecover/ecrecover.sol @@ -3,6 +3,8 @@ contract test { return ecrecover(h, v, r, s); } } +// ==== +// compileViaYul: also // ---- // a(bytes32,uint8,bytes32,bytes32): // 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c, diff --git a/test/libsolidity/semanticTests/ecrecover/ecrecover_abiV2.sol b/test/libsolidity/semanticTests/ecrecover/ecrecover_abiV2.sol index fa3adbff8e74..158a85a5e8dd 100644 --- a/test/libsolidity/semanticTests/ecrecover/ecrecover_abiV2.sol +++ b/test/libsolidity/semanticTests/ecrecover/ecrecover_abiV2.sol @@ -4,6 +4,8 @@ contract test { return ecrecover(h, v, r, s); } } +// ==== +// compileViaYul: also // ---- // a(bytes32,uint8,bytes32,bytes32): // 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c, diff --git a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input.sol b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input.sol index fe0cbf412065..6560baf6a68c 100644 --- a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input.sol +++ b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input.sol @@ -6,5 +6,7 @@ contract C { return ecrecover(bytes32(uint(-1)), 1, bytes32(uint(2)), bytes32(uint(3))); } } +// ==== +// compileViaYul: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_asm.sol b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_asm.sol index 5e8c3cdbf74f..607f3ec1ac08 100644 --- a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_asm.sol +++ b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_asm.sol @@ -11,5 +11,7 @@ contract C { ); } } +// ==== +// compileViaYul: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_proper.sol b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_proper.sol index 511bd4e41c19..4fa1ec514341 100644 --- a/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_proper.sol +++ b/test/libsolidity/semanticTests/ecrecover/failing_ecrecover_invalid_input_proper.sol @@ -16,5 +16,7 @@ contract C { return ecrecover(hash, v, r, s); } } +// ==== +// compileViaYul: also // ---- // f() -> 0 From 8fe27ac4b49f0848c374ca6c32e8d237814a0008 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 12 May 2020 14:52:21 +0200 Subject: [PATCH 044/479] Add Dockerfile for an Emscripten build environment and use it for CI runs. --- .circleci/config.yml | 14 +--- .circleci/docker/Dockerfile.emscripten | 66 +++++++++++++++++++ .../docker}/emscripten.jam | 8 +-- .travis.yml | 2 +- scripts/build_emscripten.sh | 4 +- scripts/travis-emscripten/build_emscripten.sh | 31 +-------- scripts/travis-emscripten/install_deps.sh | 49 -------------- 7 files changed, 74 insertions(+), 100 deletions(-) create mode 100644 .circleci/docker/Dockerfile.emscripten rename {scripts/travis-emscripten => .circleci/docker}/emscripten.jam (96%) delete mode 100755 scripts/travis-emscripten/install_deps.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 0620cd6679ed..81acd1383278 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -558,27 +558,15 @@ jobs: b_ems: docker: - - image: trzeci/emscripten:sdk-tag-1.39.3-64bit + - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 environment: TERM: xterm steps: - checkout - - restore_cache: - name: Restore Boost build - key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/build_emscripten.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }} - - run: - name: Bootstrap Boost - command: | - scripts/travis-emscripten/install_deps.sh - run: name: Build command: | scripts/travis-emscripten/build_emscripten.sh - - save_cache: - name: Save Boost build - key: *boost-cache-key - paths: - - boost_1_70_0_install - store_artifacts: path: emscripten_build/libsolc/soljson.js destination: soljson.js diff --git a/.circleci/docker/Dockerfile.emscripten b/.circleci/docker/Dockerfile.emscripten new file mode 100644 index 000000000000..67432f6c59a8 --- /dev/null +++ b/.circleci/docker/Dockerfile.emscripten @@ -0,0 +1,66 @@ +# vim:syntax=dockerfile +#------------------------------------------------------------------------------ +# Dockerfile for building and testing Solidity Compiler on CI +# Target: Emscripten +# URL: https://hub.docker.com/r/ethereum/solidity-buildpack-deps +# +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2016-2019 solidity contributors. +#------------------------------------------------------------------------------ +# +# The Emscripten SDK at https://github.com/emscripten-core/emsdk/ +# contains a Makefile in the docker/ subdirectory that can be used to create the +# required base image using: +# +# make version=1.39.15-fastcomp build +# +# TODO: switch to the upstream backend by removing "-fastcomp". +# +FROM emscripten/emsdk:1.39.15-fastcomp AS base + +ADD emscripten.jam /usr/src +RUN set -ex; \ + cd /usr/src; \ + git clone https://github.com/Z3Prover/z3.git -b z3-4.8.8 --depth 1 ; \ + cd z3; \ + mkdir build; \ + cd build; \ + emcmake cmake \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DCMAKE_INSTALL_PREFIX=/emsdk/emscripten/sdk/system/ \ + -DZ3_BUILD_LIBZ3_SHARED=OFF \ + -DZ3_ENABLE_EXAMPLE_TARGETS=OFF \ + -DZ3_BUILD_TEST_EXECUTABLES=OFF \ + -DZ3_BUILD_EXECUTABLE=OFF \ + -DZ3_SINGLE_THREADED=ON \ + ..; \ + make; make install; \ + rm -r /usr/src/z3; \ + cd /usr/src; \ + wget -q 'https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2' -O boost.tar.bz2; \ + test "$(sha256sum boost.tar.bz2)" = "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 boost.tar.bz2"; \ + tar -xf boost.tar.bz2; \ + rm boost.tar.bz2; \ + cd boost_1_73_0; \ + mv ../emscripten.jam .; \ + ./bootstrap.sh; \ + echo "using emscripten : : em++ ;" >> project-config.jam ; \ + ./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \ + --with-system --with-filesystem --with-test --with-program_options \ + cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ + --prefix=/emsdk/emscripten/sdk/system install; \ + rm -r /usr/src/boost_1_73_0 diff --git a/scripts/travis-emscripten/emscripten.jam b/.circleci/docker/emscripten.jam similarity index 96% rename from scripts/travis-emscripten/emscripten.jam rename to .circleci/docker/emscripten.jam index 0cc92bd564df..2d0ad524c0b6 100644 --- a/scripts/travis-emscripten/emscripten.jam +++ b/.circleci/docker/emscripten.jam @@ -79,10 +79,10 @@ rule init ( version ? : command * : options * ) # @todo this seems to be the right way, but this is a list somehow toolset.add-requirements emscripten:node ; - toolset.flags emscripten.compile STDHDRS $(condition) : /emsdk_portable/emscripten/sdk/system/include ; - toolset.flags emscripten.link STDLIBPATH $(condition) : /emsdk_portable/emscripten/sdk/system/lib ; - toolset.flags emscripten AR $(condition) : /emsdk_portable/emscripten/sdk/emar ; - toolset.flags emscripten RANLIB $(condition) : /emsdk_portable/emscripten/sdk/emranlib ; + toolset.flags emscripten.compile STDHDRS $(condition) : /emsdk/emscripten/sdk/system/include ; + toolset.flags emscripten.link STDLIBPATH $(condition) : /emsdk/emscripten/sdk/system/lib ; + toolset.flags emscripten AR $(condition) : /emsdk/emscripten/sdk/emar ; + toolset.flags emscripten RANLIB $(condition) : /emsdk/emscripten/sdk/emranlib ; } type.set-generated-target-suffix EXE : emscripten : js ; diff --git a/.travis.yml b/.travis.yml index 38d59fa931b1..36d3943df6fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -110,7 +110,7 @@ matrix: before_install: - nvm install 8 - nvm use 8 - - docker pull trzeci/emscripten:sdk-tag-1.39.3-64bit + - docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 env: - SOLC_EMSCRIPTEN=On - SOLC_INSTALL_DEPS_TRAVIS=Off diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index cf6cbdd790b9..3d6e1721073b 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -34,7 +34,5 @@ else BUILD_DIR="$1" fi -docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \ - ./scripts/travis-emscripten/install_deps.sh -docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \ +docker run -v $(pwd):/root/project -w /root/project ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 \ ./scripts/travis-emscripten/build_emscripten.sh $BUILD_DIR diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh index 7d3253515d39..c338a19772e4 100755 --- a/scripts/travis-emscripten/build_emscripten.sh +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -40,37 +40,8 @@ else BUILD_DIR="$1" fi -if ! type git &>/dev/null; then - # We need git for extracting the commit hash - apt-get update - apt-get -y install git-core -fi - -if ! type wget &>/dev/null; then - # We need wget to install cmake - apt-get update - apt-get -y install wget -fi - WORKSPACE=/root/project -# Boost -echo -en 'travis_fold:start:compiling_boost\\r' -test -e "$WORKSPACE"/boost_1_70_0_install/include/boost/version.hpp || ( -cd "$WORKSPACE"/boost_1_70_0 -./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \ - --with-system --with-filesystem --with-test --with-program_options cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ - --prefix="$WORKSPACE"/boost_1_70_0_install install -) -ln -sf "$WORKSPACE"/boost_1_70_0_install/lib/* /emsdk_portable/emscripten/sdk/system/lib -ln -sf "$WORKSPACE"/boost_1_70_0_install/include/* /emsdk_portable/emscripten/sdk/system/include -echo -en 'travis_fold:end:compiling_boost\\r' - -echo -en 'travis_fold:start:install_cmake.sh\\r' -source $WORKSPACE/scripts/install_cmake.sh -echo -en 'travis_fold:end:install_cmake.sh\\r' - -# Build dependent components and solidity itself echo -en 'travis_fold:start:compiling_solidity\\r' cd $WORKSPACE mkdir -p $BUILD_DIR @@ -82,7 +53,7 @@ cmake \ -DBoost_USE_STATIC_RUNTIME=1 \ -DTESTS=0 \ .. -make -j 4 +make -j 4 soljson cd .. mkdir -p upload diff --git a/scripts/travis-emscripten/install_deps.sh b/scripts/travis-emscripten/install_deps.sh deleted file mode 100755 index 7544da4e227d..000000000000 --- a/scripts/travis-emscripten/install_deps.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -#------------------------------------------------------------------------------ -# Bash script for installing pre-requisite packages for building solidity -# using Emscripten on Ubuntu Trusty. -# -# The documentation for solidity is hosted at: -# -# http://solidity.readthedocs.io/ -# -# ------------------------------------------------------------------------------ -# This file is part of solidity. -# -# solidity is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# solidity is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with solidity. If not, see -# -# (c) 2016 solidity contributors. -#------------------------------------------------------------------------------ - -set -ev - -SCRIPT_DIR="$(realpath $(dirname $0))" - -echo -en 'travis_fold:start:installing_dependencies\\r' -test -e boost_1_70_0_install/include/boost/version.hpp || ( -rm -rf boost_1_70_0 -rm -f boost.tar.gz -wget -q 'https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz/download'\ - -O boost.tar.gz -test "$(shasum boost.tar.gz)" = "7804c782deb00f36ac80b1000b71a3707eadb620 boost.tar.gz" -tar -xzf boost.tar.gz -rm boost.tar.gz -cd boost_1_70_0 -./bootstrap.sh -cp "${SCRIPT_DIR}/emscripten.jam" . -echo "using emscripten : : em++ ;" >> project-config.jam -) -cd .. -echo -en 'travis_fold:end:installing_dependencies\\r' From c6e2decc3fba6a127151d1ec69c8e3b2dc364d18 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Thu, 14 May 2020 17:47:43 +0200 Subject: [PATCH 045/479] Disable Z3 in fuzzer builds --- cmake/toolchains/ossfuzz.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/toolchains/ossfuzz.cmake b/cmake/toolchains/ossfuzz.cmake index 113b6b453c15..fb7b8d0b36cb 100644 --- a/cmake/toolchains/ossfuzz.cmake +++ b/cmake/toolchains/ossfuzz.cmake @@ -1,7 +1,8 @@ # Inherit default options include("${CMAKE_CURRENT_LIST_DIR}/default.cmake") -# Disable CVC4. +# Disable CVC4 and Z3. set(USE_CVC4 OFF CACHE BOOL "Disable CVC4" FORCE) +set(USE_Z3 OFF CACHE BOOL "Disable Z3" FORCE) # Enable fuzzers set(OSSFUZZ ON CACHE BOOL "Enable fuzzer build" FORCE) set(LIB_FUZZING_ENGINE $ENV{LIB_FUZZING_ENGINE} CACHE STRING "Use fuzzer back-end defined by environment variable" FORCE) From 7af7273b60235f5c9e9fa63938e55febfc398b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 13 May 2020 19:48:31 +0200 Subject: [PATCH 046/479] Move static functions for constructing names from IRGenerationContext into the new `Common` module --- libsolidity/CMakeLists.txt | 2 + libsolidity/codegen/ir/Common.cpp | 46 +++++++++++++++++++ libsolidity/codegen/ir/Common.h | 38 +++++++++++++++ .../codegen/ir/IRGenerationContext.cpp | 25 +--------- libsolidity/codegen/ir/IRGenerationContext.h | 7 +-- libsolidity/codegen/ir/IRGenerator.cpp | 12 ++--- .../codegen/ir/IRGeneratorForStatements.cpp | 4 +- 7 files changed, 97 insertions(+), 37 deletions(-) create mode 100644 libsolidity/codegen/ir/Common.cpp create mode 100644 libsolidity/codegen/ir/Common.h diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 96ccff9e4a06..7b66e533e9f1 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -79,6 +79,8 @@ set(sources codegen/ReturnInfo.cpp codegen/YulUtilFunctions.h codegen/YulUtilFunctions.cpp + codegen/ir/Common.cpp + codegen/ir/Common.h codegen/ir/IRGenerator.cpp codegen/ir/IRGenerator.h codegen/ir/IRGeneratorForStatements.cpp diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp new file mode 100644 index 000000000000..389b53333b13 --- /dev/null +++ b/libsolidity/codegen/ir/Common.cpp @@ -0,0 +1,46 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ + +#include + +#include + +using namespace std; +using namespace solidity::util; +using namespace solidity::frontend; + +string IRNames::function(FunctionDefinition const& _function) +{ + // @TODO previously, we had to distinguish creation context and runtime context, + // but since we do not work with jump positions anymore, this should not be a problem, right? + return "fun_" + _function.name() + "_" + to_string(_function.id()); +} + +string IRNames::function(VariableDeclaration const& _varDecl) +{ + return "getter_fun_" + _varDecl.name() + "_" + to_string(_varDecl.id()); +} + +string IRNames::creationObject(ContractDefinition const& _contract) +{ + return _contract.name() + "_" + toString(_contract.id()); +} + +string IRNames::runtimeObject(ContractDefinition const& _contract) +{ + return _contract.name() + "_" + toString(_contract.id()) + "_deployed"; +} diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h new file mode 100644 index 000000000000..323687618770 --- /dev/null +++ b/libsolidity/codegen/ir/Common.h @@ -0,0 +1,38 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +/** + * Miscellaneous utilities for use in IR generator. + */ + +#pragma once + +#include + +#include + +namespace solidity::frontend +{ + +struct IRNames +{ + static std::string function(FunctionDefinition const& _function); + static std::string function(VariableDeclaration const& _varDecl); + static std::string creationObject(ContractDefinition const& _contract); + static std::string runtimeObject(ContractDefinition const& _contract); +}; + +} diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index ed3b989d0ef9..8e01b83d5a73 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -36,7 +36,7 @@ using namespace solidity::frontend; string IRGenerationContext::enqueueFunctionForCodeGeneration(FunctionDefinition const& _function) { - string name = functionName(_function); + string name = IRNames::function(_function); if (!m_functions.contains(name)) m_functionGenerationQueue.insert(&_function); @@ -116,27 +116,6 @@ void IRGenerationContext::addStateVariable( m_stateVariables[&_declaration] = make_pair(move(_storageOffset), _byteOffset); } -string IRGenerationContext::functionName(FunctionDefinition const& _function) -{ - // @TODO previously, we had to distinguish creation context and runtime context, - // but since we do not work with jump positions anymore, this should not be a problem, right? - return "fun_" + _function.name() + "_" + to_string(_function.id()); -} - -string IRGenerationContext::functionName(VariableDeclaration const& _varDecl) -{ - return "getter_fun_" + _varDecl.name() + "_" + to_string(_varDecl.id()); -} - -string IRGenerationContext::creationObjectName(ContractDefinition const& _contract) const -{ - return _contract.name() + "_" + toString(_contract.id()); -} -string IRGenerationContext::runtimeObjectName(ContractDefinition const& _contract) const -{ - return _contract.name() + "_" + toString(_contract.id()) + "_deployed"; -} - string IRGenerationContext::newYulVariable() { return "_" + to_string(++m_varCounter); @@ -196,7 +175,7 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out) functions.emplace_back(map { { "funID", to_string(function->id()) }, - { "name", functionName(*function)} + { "name", IRNames::function(*function)} }); enqueueFunctionForCodeGeneration(*function); diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index a7eab7cebdf2..f38f75d86eb7 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -26,6 +26,7 @@ #include #include +#include #include @@ -99,12 +100,6 @@ class IRGenerationContext return m_stateVariables.at(&_varDecl); } - std::string functionName(FunctionDefinition const& _function); - std::string functionName(VariableDeclaration const& _varDecl); - - std::string creationObjectName(ContractDefinition const& _contract) const; - std::string runtimeObjectName(ContractDefinition const& _contract) const; - std::string newYulVariable(); std::string internalDispatch(size_t _in, size_t _out); diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index be878e739066..912a93ed0d0f 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -114,7 +114,7 @@ string IRGenerator::generate( for (VariableDeclaration const* var: ContractType(_contract).immutableVariables()) m_context.registerImmutableVariable(*var); - t("CreationObject", m_context.creationObjectName(_contract)); + t("CreationObject", IRNames::creationObject(_contract)); t("memoryInit", memoryInit()); t("notLibrary", !_contract.isLibrary()); @@ -127,7 +127,7 @@ string IRGenerator::generate( constructorParams.emplace_back(m_context.newYulVariable()); t( "copyConstructorArguments", - m_utils.copyConstructorArgumentsToMemoryFunction(_contract, m_context.creationObjectName(_contract)) + m_utils.copyConstructorArgumentsToMemoryFunction(_contract, IRNames::creationObject(_contract)) ); } t("constructorParams", joinHumanReadable(constructorParams)); @@ -142,7 +142,7 @@ string IRGenerator::generate( resetContext(_contract); // Do not register immutables to avoid assignment. - t("RuntimeObject", m_context.runtimeObjectName(_contract)); + t("RuntimeObject", IRNames::runtimeObject(_contract)); t("dispatch", dispatchRoutine(_contract)); generateQueuedFunctions(); t("runtimeFunctions", m_context.functionCollector().requestedFunctions()); @@ -166,7 +166,7 @@ void IRGenerator::generateQueuedFunctions() string IRGenerator::generateFunction(FunctionDefinition const& _function) { - string functionName = m_context.functionName(_function); + string functionName = IRNames::function(_function); return m_context.functionCollector().createFunction(functionName, [&]() { Whiskers t(R"( function () -> { @@ -195,7 +195,7 @@ string IRGenerator::generateFunction(FunctionDefinition const& _function) string IRGenerator::generateGetter(VariableDeclaration const& _varDecl) { - string functionName = m_context.functionName(_varDecl); + string functionName = IRNames::function(_varDecl); Type const* type = _varDecl.annotation().type; @@ -431,7 +431,7 @@ string IRGenerator::deployCode(ContractDefinition const& _contract) return(0, datasize("")) )X"); - t("object", m_context.runtimeObjectName(_contract)); + t("object", IRNames::runtimeObject(_contract)); vector> loadImmutables; vector> storeImmutables; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 52852322721f..eaabdd58eca3 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1103,7 +1103,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) t("memEnd", m_context.newYulVariable()); t("allocateTemporaryMemory", m_utils.allocationTemporaryMemoryFunction()); t("releaseTemporaryMemory", m_utils.releaseTemporaryMemoryFunction()); - t("object", m_context.creationObjectName(*contract)); + t("object", IRNames::creationObject(*contract)); t("abiEncode", m_context.abiFunctions().tupleEncoder(argumentTypes, functionType->parameterTypes(), false) ); @@ -1371,7 +1371,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) )") ("allocationFunction", m_utils.allocationFunction()) ("size", m_context.newYulVariable()) - ("objectName", m_context.creationObjectName(contract)) + ("objectName", IRNames::creationObject(contract)) ("result", IRVariable(_memberAccess).commaSeparatedList()).render(); } else if (member == "name") From e5da635c0c15d454df63eaefd6958cc070a038ef Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 14 May 2020 21:38:43 +0200 Subject: [PATCH 047/479] Add missing Changelog entry about soljson.js build changes. --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 31d1e43a68e4..e2bfde1108c0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Language Features: Compiler Features: + * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. Bugfixes: From a0c605aa85c0a18c2d3e9f614d120d6a089c460b Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 14 Apr 2020 11:09:38 +0200 Subject: [PATCH 048/479] [SMTChecker] Support array length --- Changelog.md | 1 + libsolidity/formal/CVC4Interface.cpp | 9 ++ libsolidity/formal/SMTEncoder.cpp | 60 ++++++++-- libsolidity/formal/SMTLib2Interface.cpp | 21 +++- libsolidity/formal/SSAVariable.cpp | 9 +- libsolidity/formal/SSAVariable.h | 7 +- libsolidity/formal/SolverInterface.h | 28 ++++- libsolidity/formal/SymbolicState.cpp | 8 +- libsolidity/formal/SymbolicTypes.cpp | 52 +++++++-- libsolidity/formal/SymbolicVariables.cpp | 107 +++++++++++------- libsolidity/formal/SymbolicVariables.h | 66 +++++------ libsolidity/formal/Z3Interface.cpp | 9 ++ ...ngth_1d_assignment_2d_memory_to_memory.sol | 10 ++ ...th_1d_assignment_2d_storage_to_storage.sol | 11 ++ .../length_1d_copy_2d_memory_to_storage.sol | 11 ++ .../length_1d_copy_2d_storage_to_memory.sol | 11 ++ .../length_1d_mapping_array_1.sol | 8 ++ .../length_1d_mapping_array_2.sol | 9 ++ .../length_1d_mapping_array_2d_1.sol | 9 ++ .../length_1d_struct_array_1.sol | 20 ++++ .../length_1d_struct_array_2d_1.sol | 22 ++++ .../length_assignment_2d_memory_to_memory.sol | 9 ++ .../length_assignment_memory_to_memory.sol | 8 ++ .../length_assignment_storage_to_storage.sol | 10 ++ .../array_members/length_basic.sol | 13 +++ .../length_copy_memory_to_storage.sol | 9 ++ .../length_copy_storage_to_memory.sol | 9 ++ .../array_members/length_function_call.sol | 10 ++ .../length_same_after_assignment.sol | 10 ++ .../length_same_after_assignment_2.sol | 15 +++ .../length_same_after_assignment_2_fail.sol | 19 ++++ .../length_same_after_assignment_3.sol | 17 +++ .../length_same_after_assignment_3_fail.sol | 22 ++++ .../smtCheckerTests/complex/MerkleProof.sol | 2 - .../compound_assignment_division_2.sol | 1 - .../compound_assignment_division_3.sol | 1 - .../operators/compound_mul_array_index.sol | 1 + .../operators/compound_mul_mapping.sol | 1 + .../operators/delete_array_index_2d.sol | 2 + .../smtCheckerTests/special/msg_data.sol | 1 - .../types/mapping_aliasing_2.sol | 1 + .../smtCheckerTests/types/string_1.sol | 2 - .../smtCheckerTestsJSON/multi.json | 4 +- .../smtCheckerTestsJSON/simple.json | 2 +- 44 files changed, 543 insertions(+), 114 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_memory_to_memory.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_storage_to_storage.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_memory_to_storage.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_storage_to_memory.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2d_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_assignment_2d_memory_to_memory.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_assignment_memory_to_memory.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_assignment_storage_to_storage.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_basic.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_copy_memory_to_storage.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_copy_storage_to_memory.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_function_call.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol diff --git a/Changelog.md b/Changelog.md index e2bfde1108c0..cf15659136bf 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Language Features: Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. + * SMTChecker: Support array ``length``. Bugfixes: diff --git a/libsolidity/formal/CVC4Interface.cpp b/libsolidity/formal/CVC4Interface.cpp index 06778606189d..86688e0b1476 100644 --- a/libsolidity/formal/CVC4Interface.cpp +++ b/libsolidity/formal/CVC4Interface.cpp @@ -206,6 +206,15 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) CVC4::Expr s = dt[0][index].getSelector(); return m_context.mkExpr(CVC4::kind::APPLY_SELECTOR, s, arguments[0]); } + else if (n == "tuple_constructor") + { + shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.sort); + solAssert(tupleSort, ""); + CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); + CVC4::Datatype const& dt = tt.getDatatype(); + CVC4::Expr c = dt[0].getConstructor(); + return m_context.mkExpr(CVC4::kind::APPLY_CONSTRUCTOR, c, arguments); + } solAssert(false, ""); } diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 8760c7b6b8e0..09c1884351bd 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -890,6 +890,33 @@ bool SMTEncoder::visit(MemberAccess const& _memberAccess) return false; } } + else if (exprType->category() == Type::Category::Array) + { + _memberAccess.expression().accept(*this); + if (_memberAccess.memberName() == "length") + { + auto symbArray = dynamic_pointer_cast(m_context.expression(_memberAccess.expression())); + solAssert(symbArray, ""); + defineExpr(_memberAccess, symbArray->length()); + m_uninterpretedTerms.insert(&_memberAccess); + setSymbolicUnknownValue( + expr(_memberAccess), + _memberAccess.annotation().type, + m_context + ); + } + else + { + auto const& name = _memberAccess.memberName(); + solAssert(name == "push" || name == "pop", ""); + m_errorReporter.warning( + 9098_error, + _memberAccess.location(), + "Assertion checker does not yet support array member \"" + name + "\"." + ); + } + return false; + } else m_errorReporter.warning( 7650_error, @@ -939,9 +966,10 @@ void SMTEncoder::endVisit(IndexAccess const& _indexAccess) return; } - solAssert(array, ""); + auto arrayVar = dynamic_pointer_cast(array); + solAssert(arrayVar, ""); defineExpr(_indexAccess, smt::Expression::select( - array->currentValue(), + arrayVar->elements(), expr(*_indexAccess.indexExpression()) )); setSymbolicUnknownValue( @@ -1013,16 +1041,20 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c return false; }); + auto symbArray = dynamic_pointer_cast(m_context.variable(*varDecl)); smt::Expression store = smt::Expression::store( - m_context.variable(*varDecl)->currentValue(), + symbArray->elements(), expr(*indexAccess->indexExpression()), toStore ); - m_context.addAssertion(m_context.newValue(*varDecl) == store); + auto oldLength = symbArray->length(); + symbArray->increaseIndex(); + m_context.addAssertion(symbArray->elements() == store); + m_context.addAssertion(symbArray->length() == oldLength); // Update the SMT select value after the assignment, // necessary for sound models. defineExpr(*indexAccess, smt::Expression::select( - m_context.variable(*varDecl)->currentValue(), + symbArray->elements(), expr(*indexAccess->indexExpression()) )); @@ -1030,7 +1062,12 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c } else if (auto base = dynamic_cast(&indexAccess->baseExpression())) { - toStore = smt::Expression::store(expr(*base), expr(*indexAccess->indexExpression()), toStore); + auto symbArray = dynamic_pointer_cast(m_context.expression(*base)); + solAssert(symbArray, ""); + toStore = smt::Expression::tuple_constructor( + smt::Expression(base->annotation().type), + {smt::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()} + ); indexAccess = base; } else @@ -1326,7 +1363,14 @@ smt::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment) void SMTEncoder::assignment(VariableDeclaration const& _variable, Expression const& _value) { - assignment(_variable, expr(_value, _variable.type())); + // In general, at this point, the SMT sorts of _variable and _value are the same, + // even if there is implicit conversion. + // This is a special case where the SMT sorts are different. + // For now we are unaware of other cases where this happens, but if they do appear + // we should extract this into an `implicitConversion` function. + if (_variable.type()->category() != Type::Category::Array || _value.annotation().type->category() != Type::Category::StringLiteral) + assignment(_variable, expr(_value, _variable.type())); + // TODO else { store each string literal byte into the array } } void SMTEncoder::assignment(VariableDeclaration const& _variable, smt::Expression const& _value) @@ -1616,7 +1660,7 @@ SMTEncoder::VariableIndices SMTEncoder::copyVariableIndices() void SMTEncoder::resetVariableIndices(VariableIndices const& _indices) { for (auto const& var: _indices) - m_context.variable(*var.first)->index() = var.second; + m_context.variable(*var.first)->setIndex(var.second); } void SMTEncoder::clearIndices(ContractDefinition const* _contract, FunctionDefinition const* _function) diff --git a/libsolidity/formal/SMTLib2Interface.cpp b/libsolidity/formal/SMTLib2Interface.cpp index 339a0a8ad393..97ccc2c913ea 100644 --- a/libsolidity/formal/SMTLib2Interface.cpp +++ b/libsolidity/formal/SMTLib2Interface.cpp @@ -153,7 +153,15 @@ string SMTLib2Interface::toSExpr(smt::Expression const& _expr) auto tupleSort = dynamic_pointer_cast(_expr.arguments.at(0).sort); unsigned index = std::stoi(_expr.arguments.at(1).name); solAssert(index < tupleSort->members.size(), ""); - sexpr += tupleSort->members.at(index) + " " + toSExpr(_expr.arguments.at(0)); + sexpr += "|" + tupleSort->members.at(index) + "| " + toSExpr(_expr.arguments.at(0)); + } + else if (_expr.name == "tuple_constructor") + { + auto tupleSort = dynamic_pointer_cast(_expr.sort); + solAssert(tupleSort, ""); + sexpr += "|" + tupleSort->name + "|"; + for (auto const& arg: _expr.arguments) + sexpr += " " + toSExpr(arg); } else { @@ -182,18 +190,19 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) case Kind::Tuple: { auto const& tupleSort = dynamic_cast(_sort); - if (!m_userSorts.count(tupleSort.name)) + string tupleName = "|" + tupleSort.name + "|"; + if (!m_userSorts.count(tupleName)) { - m_userSorts.insert(tupleSort.name); - string decl("(declare-datatypes ((" + tupleSort.name + " 0)) (((" + tupleSort.name); + m_userSorts.insert(tupleName); + string decl("(declare-datatypes ((" + tupleName + " 0)) (((" + tupleName); solAssert(tupleSort.members.size() == tupleSort.components.size(), ""); for (unsigned i = 0; i < tupleSort.members.size(); ++i) - decl += " (" + tupleSort.members.at(i) + " " + toSmtLibSort(*tupleSort.components.at(i)) + ")"; + decl += " (|" + tupleSort.members.at(i) + "| " + toSmtLibSort(*tupleSort.components.at(i)) + ")"; decl += "))))"; write(decl); } - return tupleSort.name; + return tupleName; } default: solAssert(false, "Invalid SMT sort"); diff --git a/libsolidity/formal/SSAVariable.cpp b/libsolidity/formal/SSAVariable.cpp index 90e77a050c1c..5569d8f36219 100644 --- a/libsolidity/formal/SSAVariable.cpp +++ b/libsolidity/formal/SSAVariable.cpp @@ -29,5 +29,12 @@ SSAVariable::SSAVariable() void SSAVariable::resetIndex() { m_currentIndex = 0; - m_nextFreeIndex = make_unique(1); + m_nextFreeIndex = 1; +} + +void SSAVariable::setIndex(unsigned _index) +{ + m_currentIndex = _index; + if (m_nextFreeIndex <= _index) + m_nextFreeIndex = _index + 1; } diff --git a/libsolidity/formal/SSAVariable.h b/libsolidity/formal/SSAVariable.h index 9c86af40b920..bad6fa80cce6 100644 --- a/libsolidity/formal/SSAVariable.h +++ b/libsolidity/formal/SSAVariable.h @@ -29,7 +29,10 @@ class SSAVariable { public: SSAVariable(); + /// Resets index to 0 and next index to 1. void resetIndex(); + /// Sets index to _index and only adjusts next if next <= _index. + void setIndex(unsigned _index); /// This function returns the current index of this SSA variable. unsigned index() const { return m_currentIndex; } @@ -37,12 +40,12 @@ class SSAVariable unsigned operator++() { - return m_currentIndex = (*m_nextFreeIndex)++; + return m_currentIndex = m_nextFreeIndex++; } private: unsigned m_currentIndex; - std::unique_ptr m_nextFreeIndex; + unsigned m_nextFreeIndex; }; } diff --git a/libsolidity/formal/SolverInterface.h b/libsolidity/formal/SolverInterface.h index cac412c4bb12..4532c1b3ed3e 100644 --- a/libsolidity/formal/SolverInterface.h +++ b/libsolidity/formal/SolverInterface.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,8 @@ class Expression friend class SolverInterface; public: explicit Expression(bool _v): Expression(_v ? "true" : "false", Kind::Bool) {} - explicit Expression(frontend::TypePointer _type): Expression(_type->toString(), {}, std::make_shared(smtSort(*_type))) {} + explicit Expression(frontend::TypePointer _type): Expression(_type->toString(true), {}, std::make_shared(smtSort(*_type))) {} + explicit Expression(std::shared_ptr _sort): Expression("", {}, _sort) {} Expression(size_t _number): Expression(std::to_string(_number), Kind::Int) {} Expression(u256 const& _number): Expression(_number.str(), Kind::Int) {} Expression(s256 const& _number): Expression(_number.str(), Kind::Int) {} @@ -76,6 +78,13 @@ class Expression bool hasCorrectArity() const { + if (name == "tuple_constructor") + { + auto tupleSort = std::dynamic_pointer_cast(sort); + solAssert(tupleSort, ""); + return arguments.size() == tupleSort->components.size(); + } + static std::map const operatorsArity{ {"ite", 3}, {"not", 1}, @@ -138,8 +147,7 @@ class Expression /// The function is pure and returns the modified array. static Expression store(Expression _array, Expression _index, Expression _element) { - solAssert(_array.sort->kind == Kind::Array, ""); - std::shared_ptr arraySort = std::dynamic_pointer_cast(_array.sort); + auto arraySort = std::dynamic_pointer_cast(_array.sort); solAssert(arraySort, ""); solAssert(_index.sort, ""); solAssert(_element.sort, ""); @@ -180,6 +188,20 @@ class Expression ); } + static Expression tuple_constructor(Expression _tuple, std::vector _arguments) + { + solAssert(_tuple.sort->kind == Kind::Sort, ""); + auto sortSort = std::dynamic_pointer_cast(_tuple.sort); + auto tupleSort = std::dynamic_pointer_cast(sortSort->inner); + solAssert(tupleSort, ""); + solAssert(_arguments.size() == tupleSort->components.size(), ""); + return Expression( + "tuple_constructor", + std::move(_arguments), + tupleSort + ); + } + friend Expression operator!(Expression _a) { return Expression("not", std::move(_a), Kind::Bool); diff --git a/libsolidity/formal/SymbolicState.cpp b/libsolidity/formal/SymbolicState.cpp index d38e79c54f39..5ae8922fb157 100644 --- a/libsolidity/formal/SymbolicState.cpp +++ b/libsolidity/formal/SymbolicState.cpp @@ -47,7 +47,7 @@ Expression SymbolicState::balance() Expression SymbolicState::balance(Expression _address) { - return Expression::select(m_balances.currentValue(), move(_address)); + return Expression::select(m_balances.elements(), move(_address)); } void SymbolicState::transfer(Expression _from, Expression _to, Expression _value) @@ -72,11 +72,13 @@ void SymbolicState::transfer(Expression _from, Expression _to, Expression _value void SymbolicState::addBalance(Expression _address, Expression _value) { auto newBalances = Expression::store( - m_balances.currentValue(), + m_balances.elements(), _address, balance(_address) + move(_value) ); + auto oldLength = m_balances.length(); m_balances.increaseIndex(); - m_context.addAssertion(newBalances == m_balances.currentValue()); + m_context.addAssertion(m_balances.elements() == newBalances); + m_context.addAssertion(m_balances.length() == oldLength); } diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index b8da5da0cd5e..be6cc1b37e4d 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -21,6 +21,7 @@ #include #include #include +#include using namespace std; @@ -55,17 +56,18 @@ SortPointer smtSort(frontend::Type const& _type) } case Kind::Array: { + shared_ptr array; if (isMapping(_type.category())) { auto mapType = dynamic_cast(&_type); solAssert(mapType, ""); - return make_shared(smtSortAbstractFunction(*mapType->keyType()), smtSortAbstractFunction(*mapType->valueType())); + array = make_shared(smtSortAbstractFunction(*mapType->keyType()), smtSortAbstractFunction(*mapType->valueType())); } else if (isStringLiteral(_type.category())) { auto stringLitType = dynamic_cast(&_type); solAssert(stringLitType, ""); - return make_shared(SortProvider::intSort, SortProvider::intSort); + array = make_shared(SortProvider::intSort, SortProvider::intSort); } else { @@ -78,8 +80,25 @@ SortPointer smtSort(frontend::Type const& _type) solAssert(false, ""); solAssert(arrayType, ""); - return make_shared(SortProvider::intSort, smtSortAbstractFunction(*arrayType->baseType())); + array = make_shared(SortProvider::intSort, smtSortAbstractFunction(*arrayType->baseType())); } + + string tupleName; + if ( + auto arrayType = dynamic_cast(&_type); + (arrayType && arrayType->isString()) || + _type.category() == frontend::Type::Category::ArraySlice || + _type.category() == frontend::Type::Category::StringLiteral + ) + tupleName = "bytes_tuple"; + else + tupleName = _type.toString(true) + "_tuple"; + + return make_shared( + tupleName, + vector{tupleName + "_accessor_array", tupleName + "_accessor_length"}, + vector{array, SortProvider::intSort} + ); } case Kind::Tuple: { @@ -219,9 +238,7 @@ pair> newSymbolicVariable( else var = make_shared(type, type, _uniqueName, _context); } - else if (isMapping(_type.category())) - var = make_shared(type, _uniqueName, _context); - else if (isArray(_type.category())) + else if (isMapping(_type.category()) || isArray(_type.category())) var = make_shared(type, type, _uniqueName, _context); else if (isTuple(_type.category())) var = make_shared(type, _uniqueName, _context); @@ -349,11 +366,26 @@ Expression zeroValue(frontend::TypePointer const& _type) return Expression(false); if (isArray(_type->category()) || isMapping(_type->category())) { + auto tupleSort = dynamic_pointer_cast(smtSort(*_type)); + solAssert(tupleSort, ""); + auto sortSort = make_shared(tupleSort->components.front()); + + std::optional zeroArray; + auto length = bigint(0); if (auto arrayType = dynamic_cast(_type)) - return Expression::const_array(Expression(arrayType), zeroValue(arrayType->baseType())); - auto mappingType = dynamic_cast(_type); - solAssert(mappingType, ""); - return Expression::const_array(Expression(mappingType), zeroValue(mappingType->valueType())); + { + zeroArray = Expression::const_array(Expression(sortSort), zeroValue(arrayType->baseType())); + if (!arrayType->isDynamicallySized()) + length = bigint(arrayType->length()); + } + else if (auto mappingType = dynamic_cast(_type)) + zeroArray = Expression::const_array(Expression(sortSort), zeroValue(mappingType->valueType())); + else + solAssert(false, ""); + + solAssert(zeroArray, ""); + return Expression::tuple_constructor(Expression(_type), vector{*zeroArray, length}); + } solAssert(false, ""); } diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index 35cd4f9c26c6..519588abd3b9 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -86,6 +86,12 @@ smt::Expression SymbolicVariable::resetIndex() return currentValue(); } +smt::Expression SymbolicVariable::setIndex(unsigned _index) +{ + m_ssa->setIndex(_index); + return currentValue(); +} + smt::Expression SymbolicVariable::increaseIndex() { ++(*m_ssa); @@ -179,6 +185,12 @@ smt::Expression SymbolicFunctionVariable::resetIndex() return m_abstract.resetIndex(); } +smt::Expression SymbolicFunctionVariable::setIndex(unsigned _index) +{ + SymbolicVariable::setIndex(_index); + return m_abstract.setIndex(_index); +} + smt::Expression SymbolicFunctionVariable::increaseIndex() { ++(*m_ssa); @@ -197,92 +209,111 @@ void SymbolicFunctionVariable::resetDeclaration() m_declaration = m_context.newVariable(currentName(), m_sort); } -SymbolicMappingVariable::SymbolicMappingVariable( +SymbolicEnumVariable::SymbolicEnumVariable( frontend::TypePointer _type, string _uniqueName, EncodingContext& _context ): SymbolicVariable(_type, _type, move(_uniqueName), _context) { - solAssert(isMapping(m_type->category()), ""); + solAssert(isEnum(m_type->category()), ""); } -SymbolicArrayVariable::SymbolicArrayVariable( +SymbolicTupleVariable::SymbolicTupleVariable( frontend::TypePointer _type, - frontend::TypePointer _originalType, string _uniqueName, EncodingContext& _context ): - SymbolicVariable(_type, _originalType, move(_uniqueName), _context) + SymbolicVariable(_type, _type, move(_uniqueName), _context) { - solAssert(isArray(m_type->category()), ""); + solAssert(isTuple(m_type->category()), ""); } -SymbolicArrayVariable::SymbolicArrayVariable( +SymbolicTupleVariable::SymbolicTupleVariable( SortPointer _sort, string _uniqueName, EncodingContext& _context ): SymbolicVariable(move(_sort), move(_uniqueName), _context) { - solAssert(m_sort->kind == Kind::Array, ""); + solAssert(m_sort->kind == Kind::Tuple, ""); } -smt::Expression SymbolicArrayVariable::currentValue(frontend::TypePointer const& _targetType) const +vector const& SymbolicTupleVariable::components() { - optional conversion = symbolicTypeConversion(m_originalType, _targetType); + auto tupleSort = dynamic_pointer_cast(m_sort); + solAssert(tupleSort, ""); + return tupleSort->components; +} + +smt::Expression SymbolicTupleVariable::component( + size_t _index, + TypePointer _fromType, + TypePointer _toType +) +{ + optional conversion = symbolicTypeConversion(_fromType, _toType); if (conversion) return *conversion; - return SymbolicVariable::currentValue(_targetType); + return smt::Expression::tuple_get(currentValue(), _index); } -SymbolicEnumVariable::SymbolicEnumVariable( +SymbolicArrayVariable::SymbolicArrayVariable( frontend::TypePointer _type, + frontend::TypePointer _originalType, string _uniqueName, EncodingContext& _context ): - SymbolicVariable(_type, _type, move(_uniqueName), _context) + SymbolicVariable(_type, _originalType, move(_uniqueName), _context), + m_pair( + smtSort(*_type), + m_uniqueName + "_length_pair", + m_context + ) { - solAssert(isEnum(m_type->category()), ""); + solAssert(isArray(m_type->category()) || isMapping(m_type->category()), ""); } -SymbolicTupleVariable::SymbolicTupleVariable( - frontend::TypePointer _type, +SymbolicArrayVariable::SymbolicArrayVariable( + SortPointer _sort, string _uniqueName, EncodingContext& _context ): - SymbolicVariable(_type, _type, move(_uniqueName), _context) + SymbolicVariable(move(_sort), move(_uniqueName), _context), + m_pair( + std::make_shared( + "array_length_pair", + std::vector{"array", "length"}, + std::vector{m_sort, SortProvider::intSort} + ), + m_uniqueName + "_array_length_pair", + m_context + ) { - solAssert(isTuple(m_type->category()), ""); + solAssert(m_sort->kind == Kind::Array, ""); } -SymbolicTupleVariable::SymbolicTupleVariable( - SortPointer _sort, - string _uniqueName, - EncodingContext& _context -): - SymbolicVariable(move(_sort), move(_uniqueName), _context) +smt::Expression SymbolicArrayVariable::currentValue(frontend::TypePointer const& _targetType) const { - solAssert(m_sort->kind == Kind::Tuple, ""); + optional conversion = symbolicTypeConversion(m_originalType, _targetType); + if (conversion) + return *conversion; + + return m_pair.currentValue(); } -vector const& SymbolicTupleVariable::components() +smt::Expression SymbolicArrayVariable::valueAtIndex(int _index) const { - auto tupleSort = dynamic_pointer_cast(m_sort); - solAssert(tupleSort, ""); - return tupleSort->components; + return m_pair.valueAtIndex(_index); } -smt::Expression SymbolicTupleVariable::component( - size_t _index, - TypePointer _fromType, - TypePointer _toType -) +smt::Expression SymbolicArrayVariable::elements() { - optional conversion = symbolicTypeConversion(_fromType, _toType); - if (conversion) - return *conversion; + return m_pair.component(0); +} - return smt::Expression::tuple_get(currentValue(), _index); +smt::Expression SymbolicArrayVariable::length() +{ + return m_pair.component(1); } diff --git a/libsolidity/formal/SymbolicVariables.h b/libsolidity/formal/SymbolicVariables.h index 6f7ad6ec4127..3f5379d9b09e 100644 --- a/libsolidity/formal/SymbolicVariables.h +++ b/libsolidity/formal/SymbolicVariables.h @@ -56,6 +56,7 @@ class SymbolicVariable virtual Expression valueAtIndex(int _index) const; virtual std::string nameAtIndex(int _index) const; virtual Expression resetIndex(); + virtual Expression setIndex(unsigned _index); virtual Expression increaseIndex(); virtual Expression operator()(std::vector /*_arguments*/) const { @@ -169,6 +170,7 @@ class SymbolicFunctionVariable: public SymbolicVariable Expression functionValueAtIndex(int _index) const; Expression resetIndex() override; + Expression setIndex(unsigned _index) override; Expression increaseIndex() override; Expression operator()(std::vector _arguments) const override; @@ -190,12 +192,12 @@ class SymbolicFunctionVariable: public SymbolicVariable }; /** - * Specialization of SymbolicVariable for Mapping + * Specialization of SymbolicVariable for Enum */ -class SymbolicMappingVariable: public SymbolicVariable +class SymbolicEnumVariable: public SymbolicVariable { public: - SymbolicMappingVariable( + SymbolicEnumVariable( frontend::TypePointer _type, std::string _uniqueName, EncodingContext& _context @@ -203,64 +205,62 @@ class SymbolicMappingVariable: public SymbolicVariable }; /** - * Specialization of SymbolicVariable for Array + * Specialization of SymbolicVariable for Tuple */ -class SymbolicArrayVariable: public SymbolicVariable +class SymbolicTupleVariable: public SymbolicVariable { public: - SymbolicArrayVariable( + SymbolicTupleVariable( frontend::TypePointer _type, - frontend::TypePointer _originalTtype, std::string _uniqueName, EncodingContext& _context ); - SymbolicArrayVariable( + SymbolicTupleVariable( SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); - SymbolicArrayVariable(SymbolicArrayVariable&&) = default; - - Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; -}; - -/** - * Specialization of SymbolicVariable for Enum - */ -class SymbolicEnumVariable: public SymbolicVariable -{ -public: - SymbolicEnumVariable( - frontend::TypePointer _type, - std::string _uniqueName, - EncodingContext& _context + std::vector const& components(); + Expression component( + size_t _index, + TypePointer _fromType = nullptr, + TypePointer _toType = nullptr ); }; /** - * Specialization of SymbolicVariable for Tuple + * Specialization of SymbolicVariable for Array */ -class SymbolicTupleVariable: public SymbolicVariable +class SymbolicArrayVariable: public SymbolicVariable { public: - SymbolicTupleVariable( + SymbolicArrayVariable( frontend::TypePointer _type, + frontend::TypePointer _originalTtype, std::string _uniqueName, EncodingContext& _context ); - SymbolicTupleVariable( + SymbolicArrayVariable( SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); - std::vector const& components(); - Expression component( - size_t _index, - TypePointer _fromType = nullptr, - TypePointer _toType = nullptr - ); + SymbolicArrayVariable(SymbolicArrayVariable&&) = default; + + Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; + Expression valueAtIndex(int _index) const override; + Expression resetIndex() override { SymbolicVariable::resetIndex(); return m_pair.resetIndex(); } + Expression setIndex(unsigned _index) override { SymbolicVariable::setIndex(_index); return m_pair.setIndex(_index); } + Expression increaseIndex() override { SymbolicVariable::increaseIndex(); return m_pair.increaseIndex(); } + Expression elements(); + Expression length(); + + SortPointer tupleSort() { return m_pair.sort(); } + +private: + SymbolicTupleVariable m_pair; }; } diff --git a/libsolidity/formal/Z3Interface.cpp b/libsolidity/formal/Z3Interface.cpp index a84f39bb1ff5..d49314b6c88b 100644 --- a/libsolidity/formal/Z3Interface.cpp +++ b/libsolidity/formal/Z3Interface.cpp @@ -198,6 +198,15 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) size_t index = std::stoi(_expr.arguments[1].name); return z3::func_decl(m_context, Z3_get_tuple_sort_field_decl(m_context, z3Sort(*_expr.arguments[0].sort), index))(arguments[0]); } + else if (n == "tuple_constructor") + { + auto constructor = z3::func_decl(m_context, Z3_get_tuple_sort_mk_decl(m_context, z3Sort(*_expr.sort))); + solAssert(constructor.arity() == arguments.size(), ""); + z3::expr_vector args(m_context); + for (auto const& arg: arguments) + args.push_back(arg); + return constructor(args); + } solAssert(false, ""); } diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_memory_to_memory.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_memory_to_memory.sol new file mode 100644 index 000000000000..2e3ef86fdd45 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_memory_to_memory.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; +pragma experimental ABIEncoderV2; + +contract C { + function f(uint[][] memory arr) public pure { + uint[][] memory arr2 = arr; + assert(arr2[0].length == arr[0].length); + assert(arr.length == arr2.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_storage_to_storage.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_storage_to_storage.sol new file mode 100644 index 000000000000..acf6a1e1d70a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_assignment_2d_storage_to_storage.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; +pragma experimental ABIEncoderV2; + +contract C { + uint[][] arr; + uint[][] arr2; + function f() public view { + assert(arr2[0].length == arr[0].length); + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_memory_to_storage.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_memory_to_storage.sol new file mode 100644 index 000000000000..ce0d9ef5dc0f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_memory_to_storage.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; +pragma experimental ABIEncoderV2; + +contract C { + uint[][] arr; + function f(uint[][] memory arr2) public { + arr = arr2; + assert(arr2[0].length == arr[0].length); + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_storage_to_memory.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_storage_to_memory.sol new file mode 100644 index 000000000000..4aa03c222b55 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_copy_2d_storage_to_memory.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; +pragma experimental ABIEncoderV2; + +contract C { + uint[][] arr; + function f() public view { + uint[][] memory arr2 = arr; + assert(arr2[0].length == arr[0].length); + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_1.sol new file mode 100644 index 000000000000..dbce0665cb50 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_1.sol @@ -0,0 +1,8 @@ +pragma experimental SMTChecker; + +contract C { + mapping (uint => uint[]) map; + function f() public view { + assert(map[0].length == map[1].length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2.sol new file mode 100644 index 000000000000..dc2305f79f24 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + mapping (uint => uint[]) map; + function f(uint x, uint y) public view { + require(x == y); + assert(map[x].length == map[y].length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2d_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2d_1.sol new file mode 100644 index 000000000000..bdc24df30d83 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_mapping_array_2d_1.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + mapping (uint => uint[][]) map; + function f(uint x, uint y) public view { + require(x == y); + assert(map[x][0].length == map[y][0].length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol new file mode 100644 index 000000000000..68be993a897f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol @@ -0,0 +1,20 @@ +pragma experimental SMTChecker; + +contract C { + struct S { + uint[] arr; + } + S s1; + S s2; + function f() public view { + assert(s1.arr.length == s2.arr.length); + } +} +// ---- +// Warning: (76-80): Assertion checker does not yet support the type of this variable. +// Warning: (83-87): Assertion checker does not yet support the type of this variable. +// Warning: (126-132): Assertion checker does not yet support this expression. +// Warning: (126-128): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (143-149): Assertion checker does not yet support this expression. +// Warning: (143-145): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (119-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol new file mode 100644 index 000000000000..bb248c43e5a4 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol @@ -0,0 +1,22 @@ +pragma experimental SMTChecker; + +contract C { + struct S { + uint[][] arr; + } + S s1; + S s2; + function f() public view { + assert(s1.arr[0].length == s2.arr[0].length); + } +} +// ---- +// Warning: (78-82): Assertion checker does not yet support the type of this variable. +// Warning: (85-89): Assertion checker does not yet support the type of this variable. +// Warning: (128-134): Assertion checker does not yet support this expression. +// Warning: (128-130): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (128-137): Assertion checker does not yet implement this expression. +// Warning: (148-154): Assertion checker does not yet support this expression. +// Warning: (148-150): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (148-157): Assertion checker does not yet implement this expression. +// Warning: (121-165): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_assignment_2d_memory_to_memory.sol b/test/libsolidity/smtCheckerTests/array_members/length_assignment_2d_memory_to_memory.sol new file mode 100644 index 000000000000..d85f011043e6 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_assignment_2d_memory_to_memory.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; +pragma experimental ABIEncoderV2; + +contract C { + function f(uint[][] memory arr) public pure { + uint[][] memory arr2 = arr; + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_assignment_memory_to_memory.sol b/test/libsolidity/smtCheckerTests/array_members/length_assignment_memory_to_memory.sol new file mode 100644 index 000000000000..66f6d1067292 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_assignment_memory_to_memory.sol @@ -0,0 +1,8 @@ +pragma experimental SMTChecker; + +contract C { + function f(uint[] memory arr) public pure { + uint[] memory arr2 = arr; + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_assignment_storage_to_storage.sol b/test/libsolidity/smtCheckerTests/array_members/length_assignment_storage_to_storage.sol new file mode 100644 index 000000000000..c379f3381507 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_assignment_storage_to_storage.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + uint[] arr2; + function f() public { + arr2 = arr; + assert(arr2.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_basic.sol b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol new file mode 100644 index 000000000000..cd1041f7c6aa --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol @@ -0,0 +1,13 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + function f() public view { + uint x = arr.length; + uint y = x; + assert(arr.length == y); + assert(arr.length != y); + } +} +// ---- +// Warning: (153-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_copy_memory_to_storage.sol b/test/libsolidity/smtCheckerTests/array_members/length_copy_memory_to_storage.sol new file mode 100644 index 000000000000..ec6c2a2f231b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_copy_memory_to_storage.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + function f(uint[] memory marr) public { + arr = marr; + assert(marr.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_copy_storage_to_memory.sol b/test/libsolidity/smtCheckerTests/array_members/length_copy_storage_to_memory.sol new file mode 100644 index 000000000000..20e83c908cb0 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_copy_storage_to_memory.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + function f() public view { + uint[] memory marr = arr; + assert(marr.length == arr.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_function_call.sol b/test/libsolidity/smtCheckerTests/array_members/length_function_call.sol new file mode 100644 index 000000000000..250c88666fc2 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_function_call.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + function f() public view { + assert(arr.length == g().length); + } + function g() internal pure returns (uint[] memory) { + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment.sol new file mode 100644 index 000000000000..e0d13b35ab08 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[] arr; + function f() public view { + uint[] memory arr2 = arr; + arr2[2] = 3; + assert(arr.length == arr2.length); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2.sol new file mode 100644 index 000000000000..9665c0317620 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2.sol @@ -0,0 +1,15 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] arr; + uint[][] arr2; + function f() public { + uint x = arr[2].length; + uint y = arr[3].length; + uint z = arr.length; + arr[2][333] = 444; + assert(arr[2].length == x); + assert(arr[3].length == y); + assert(arr.length == z); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol new file mode 100644 index 000000000000..e5356d24027c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol @@ -0,0 +1,19 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] arr; + uint[][] arr2; + function f() public { + uint x = arr[2].length; + uint y = arr[3].length; + uint z = arr.length; + arr[2][333] = 444; + assert(arr[2].length != x); + assert(arr[3].length != y); + assert(arr.length != z); + } +} +// ---- +// Warning: (198-224): Assertion violation happens here +// Warning: (228-254): Assertion violation happens here +// Warning: (258-281): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3.sol new file mode 100644 index 000000000000..c36d55e766cd --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3.sol @@ -0,0 +1,17 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] arr; + uint[][] arr2; + function f() public { + uint x = arr[2].length; + uint y = arr[3].length; + uint z = arr.length; + uint t = arr[5].length; + arr[5] = arr[8]; + assert(arr[2].length == x); + assert(arr[3].length == y); + assert(arr.length == z); + assert(arr[5].length == t); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol new file mode 100644 index 000000000000..92da0cf61937 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol @@ -0,0 +1,22 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] arr; + uint[][] arr2; + function f() public { + uint x = arr[2].length; + uint y = arr[3].length; + uint z = arr.length; + uint t = arr[5].length; + arr[5] = arr[8]; + assert(arr[2].length != x); + assert(arr[3].length != y); + assert(arr.length != z); + assert(arr[5].length != t); + } +} +// ---- +// Warning: (222-248): Assertion violation happens here +// Warning: (252-278): Assertion violation happens here +// Warning: (282-305): Assertion violation happens here +// Warning: (309-335): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol index 955d5fd1eaa2..aa69285ba289 100644 --- a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol +++ b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol @@ -34,9 +34,7 @@ library MerkleProof { } // ---- -// Warning: (755-767): Assertion checker does not yet support this expression. // Warning: (988-991): Assertion checker does not yet implement type abi // Warning: (988-1032): Assertion checker does not yet implement this type of function call. // Warning: (1175-1178): Assertion checker does not yet implement type abi // Warning: (1175-1219): Assertion checker does not yet implement this type of function call. -// Warning: (755-767): Assertion checker does not yet support this expression. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol index 83bd7cb6b0ae..230d5f33c63c 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol @@ -10,6 +10,5 @@ contract C { } } // ---- -// Warning: (163-184): Error trying to invoke SMT solver. // Warning: (188-209): Error trying to invoke SMT solver. // Warning: (188-209): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol index b941a5767c40..6449db84c91f 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol @@ -10,6 +10,5 @@ contract C { } } // ---- -// Warning: (171-190): Error trying to invoke SMT solver. // Warning: (194-213): Error trying to invoke SMT solver. // Warning: (194-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol index 110eb868e381..0c4fc0876be5 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol @@ -12,4 +12,5 @@ contract C } } // ---- +// Warning: (191-212): Error trying to invoke SMT solver. // Warning: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol index cd73bc6875aa..f7dcd1469268 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol @@ -12,4 +12,5 @@ contract C } } // ---- +// Warning: (197-216): Error trying to invoke SMT solver. // Warning: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol index a47763c03cf0..1892441cab51 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol @@ -4,6 +4,7 @@ contract C { uint[][] a; function f(bool b) public { + a[1][1] = 512; a[2][3] = 4; if (b) delete a; @@ -16,3 +17,4 @@ contract C // ==== // SMTSolvers: z3 // ---- +// Warning: (191-211): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_data.sol b/test/libsolidity/smtCheckerTests/special/msg_data.sol index dff997395c69..9db24dbcbc91 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_data.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_data.sol @@ -7,5 +7,4 @@ contract C } } // ---- -// Warning: (86-101): Assertion checker does not yet support this expression. // Warning: (79-106): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol index f31192b3a71e..6bf521749da9 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol @@ -30,6 +30,7 @@ contract C } } // ---- +// Warning: (670-690): Error trying to invoke SMT solver. // Warning: (397-417): Assertion violation happens here // Warning: (463-481): Assertion violation happens here // Warning: (533-557): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_1.sol b/test/libsolidity/smtCheckerTests/types/string_1.sol index 7f03c29da3ca..2f2f644886e5 100644 --- a/test/libsolidity/smtCheckerTests/types/string_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_1.sol @@ -7,6 +7,4 @@ contract C } } // ---- -// Warning: (117-133): Assertion checker does not yet support this expression. -// Warning: (137-153): Assertion checker does not yet support this expression. // Warning: (110-154): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTestsJSON/multi.json b/test/libsolidity/smtCheckerTestsJSON/multi.json index b1be750736c5..986429dac200 100644 --- a/test/libsolidity/smtCheckerTestsJSON/multi.json +++ b/test/libsolidity/smtCheckerTestsJSON/multi.json @@ -3,8 +3,8 @@ { "smtlib2responses": { - "0x9c50514d749eabf3c13d97ad7d787e682dd99a114bad652b10a01b8c6ad6c1fb": "sat\n((|EVALEXPR_0| 1))\n", - "0xb524e7c577188e2e36f0e67fead51269fa0f8b8fb41bff2d973dcf584d38cd1e": "sat\n((|EVALEXPR_0| 0))\n" + "0x45598870c7c0bc4c4f61acad7e0dd9399fb28aa3df198379dd36a95d70814ef8": "sat\n((|EVALEXPR_0| 1))\n", + "0xee335f8104fdb81b6e5fb418725923b81f7d78ffbd6bf95fb82e5593a1ac366a": "sat\n((|EVALEXPR_0| 0))\n" } } } diff --git a/test/libsolidity/smtCheckerTestsJSON/simple.json b/test/libsolidity/smtCheckerTestsJSON/simple.json index 89eac1b809d7..0b70ea24b2d9 100644 --- a/test/libsolidity/smtCheckerTestsJSON/simple.json +++ b/test/libsolidity/smtCheckerTestsJSON/simple.json @@ -3,7 +3,7 @@ { "smtlib2responses": { - "0x45c37a9829e623d7838d82b547d297cd446d6b5faff36c53a56862fcee50fb41": "sat\n((|EVALEXPR_0| 0))\n" + "0x535c76d6b87d14bd4b4bf1014d14b8e91b648f073a68f9f267c4fe1df570bc14": "sat\n((|EVALEXPR_0| 0))\n" } } } From 07bb1952a7f6fa7d2254177d3fb66ff59bd49b7b Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 14 May 2020 19:03:03 +0200 Subject: [PATCH 049/479] Test updates --- .../loops/for_loop_array_assignment_storage_storage.sol | 2 ++ .../operators/compound_assignment_division_2.sol | 1 + .../operators/compound_assignment_division_3.sol | 1 + .../smtCheckerTests/operators/compound_mul_array_index.sol | 1 - .../smtCheckerTests/operators/compound_mul_mapping.sol | 1 - test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol | 1 - 6 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index a90053024d47..5c664f214861 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,5 +19,7 @@ contract LoopFor2 { } } // ---- +// Warning: (317-337): Error trying to invoke SMT solver. +// Warning: (317-337): Assertion violation happens here // Warning: (341-360): Assertion violation happens here // Warning: (364-383): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol index 230d5f33c63c..83bd7cb6b0ae 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol @@ -10,5 +10,6 @@ contract C { } } // ---- +// Warning: (163-184): Error trying to invoke SMT solver. // Warning: (188-209): Error trying to invoke SMT solver. // Warning: (188-209): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol index 6449db84c91f..b941a5767c40 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol @@ -10,5 +10,6 @@ contract C { } } // ---- +// Warning: (171-190): Error trying to invoke SMT solver. // Warning: (194-213): Error trying to invoke SMT solver. // Warning: (194-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol index 0c4fc0876be5..110eb868e381 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol @@ -12,5 +12,4 @@ contract C } } // ---- -// Warning: (191-212): Error trying to invoke SMT solver. // Warning: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol index f7dcd1469268..cd73bc6875aa 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol @@ -12,5 +12,4 @@ contract C } } // ---- -// Warning: (197-216): Error trying to invoke SMT solver. // Warning: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol index 6bf521749da9..f31192b3a71e 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol @@ -30,7 +30,6 @@ contract C } } // ---- -// Warning: (670-690): Error trying to invoke SMT solver. // Warning: (397-417): Assertion violation happens here // Warning: (463-481): Assertion violation happens here // Warning: (533-557): Assertion violation happens here From 465e4d4088cf7a40e24778d567776279bbe81d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 14 May 2020 22:44:46 +0200 Subject: [PATCH 050/479] Extract more functions for generating function and variable names into IRNames --- libsolidity/codegen/ir/Common.cpp | 40 +++++++++++++++++++ libsolidity/codegen/ir/Common.h | 9 +++++ .../codegen/ir/IRGenerationContext.cpp | 11 ----- libsolidity/codegen/ir/IRGenerationContext.h | 4 -- libsolidity/codegen/ir/IRGenerator.cpp | 13 ++---- libsolidity/codegen/ir/IRGenerator.h | 2 - .../codegen/ir/IRGeneratorForStatements.cpp | 11 ++--- libsolidity/codegen/ir/IRVariable.cpp | 13 ++---- 8 files changed, 61 insertions(+), 42 deletions(-) diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index 389b53333b13..8b895596ad55 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -44,3 +44,43 @@ string IRNames::runtimeObject(ContractDefinition const& _contract) { return _contract.name() + "_" + toString(_contract.id()) + "_deployed"; } + +string IRNames::implicitConstructor(ContractDefinition const& _contract) +{ + return "constructor_" + _contract.name() + "_" + to_string(_contract.id()); +} + +string IRNames::constantValueFunction(VariableDeclaration const& _constant) +{ + solAssert(_constant.isConstant(), ""); + return "constant_" + _constant.name() + "_" + to_string(_constant.id()); +} + +string IRNames::localVariable(VariableDeclaration const& _declaration) +{ + return "vloc_" + _declaration.name() + '_' + std::to_string(_declaration.id()); +} + +string IRNames::localVariable(Expression const& _expression) +{ + return "expr_" + to_string(_expression.id()); +} + +string IRNames::trySuccessConditionVariable(Expression const& _expression) +{ + auto annotation = dynamic_cast(&_expression.annotation()); + solAssert(annotation, ""); + solAssert(annotation->tryCall, "Parameter must be a FunctionCall with tryCall-annotation set."); + + return "trySuccessCondition_" + to_string(_expression.id()); +} + +string IRNames::tupleComponent(size_t _i) +{ + return "component_" + to_string(_i + 1); +} + +string IRNames::zeroValue(Type const& _type, string const& _variableName) +{ + return "zero_value_for_type_" + _type.identifier() + _variableName; +} diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 323687618770..771dd0ab4d02 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -33,6 +33,15 @@ struct IRNames static std::string function(VariableDeclaration const& _varDecl); static std::string creationObject(ContractDefinition const& _contract); static std::string runtimeObject(ContractDefinition const& _contract); + static std::string implicitConstructor(ContractDefinition const& _contract); + static std::string constantValueFunction(VariableDeclaration const& _constant); + static std::string localVariable(VariableDeclaration const& _declaration); + static std::string localVariable(Expression const& _expression); + /// @returns the variable name that can be used to inspect the success or failure of an external + /// function call that was invoked as part of the try statement. + static std::string trySuccessConditionVariable(Expression const& _expression); + static std::string tupleComponent(size_t _i); + static std::string zeroValue(Type const& _type, std::string const& _variableName); }; } diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 8e01b83d5a73..ee477792f068 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -121,17 +121,6 @@ string IRGenerationContext::newYulVariable() return "_" + to_string(++m_varCounter); } -string IRGenerationContext::trySuccessConditionVariable(Expression const& _expression) const -{ - // NB: The TypeChecker already ensured that the Expression is of type FunctionCall. - solAssert( - static_cast(_expression.annotation()).tryCall, - "Parameter must be a FunctionCall with tryCall-annotation set." - ); - - return "trySuccessCondition_" + to_string(_expression.id()); -} - string IRGenerationContext::internalDispatch(size_t _in, size_t _out) { string funName = "dispatch_internal_in_" + to_string(_in) + "_out_" + to_string(_out); diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index f38f75d86eb7..ef6df190b03e 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -117,10 +117,6 @@ class IRGenerationContext RevertStrings revertStrings() const { return m_revertStrings; } - /// @returns the variable name that can be used to inspect the success or failure of an external - /// function call that was invoked as part of the try statement. - std::string trySuccessConditionVariable(Expression const& _expression) const; - std::set& subObjectsCreated() { return m_subObjects; } private: diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index 912a93ed0d0f..69aad0af62f6 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -132,7 +132,7 @@ string IRGenerator::generate( } t("constructorParams", joinHumanReadable(constructorParams)); t("constructorHasParams", !constructorParams.empty()); - t("implicitConstructor", implicitConstructorName(_contract)); + t("implicitConstructor", IRNames::implicitConstructor(_contract)); t("deploy", deployCode(_contract)); generateImplicitConstructors(_contract); @@ -378,7 +378,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra ContractDefinition const* contract = _contract.annotation().linearizedBaseContracts[i]; baseConstructorParams.erase(contract); - m_context.functionCollector().createFunction(implicitConstructorName(*contract), [&]() { + m_context.functionCollector().createFunction(IRNames::implicitConstructor(*contract), [&]() { Whiskers t(R"( function () { @@ -395,7 +395,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra vector baseParams = listAllParams(baseConstructorParams); t("baseParams", joinHumanReadable(baseParams)); t("comma", !params.empty() && !baseParams.empty() ? ", " : ""); - t("functionName", implicitConstructorName(*contract)); + t("functionName", IRNames::implicitConstructor(*contract)); pair>> evaluatedArgs = evaluateConstructorArguments(*contract); baseConstructorParams.insert(evaluatedArgs.second.begin(), evaluatedArgs.second.end()); t("evalBaseArguments", evaluatedArgs.first); @@ -403,7 +403,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra { t("hasNextConstructor", true); ContractDefinition const* nextContract = _contract.annotation().linearizedBaseContracts[i + 1]; - t("nextConstructor", implicitConstructorName(*nextContract)); + t("nextConstructor", IRNames::implicitConstructor(*nextContract)); t("nextParams", joinHumanReadable(listAllParams(baseConstructorParams))); } else @@ -462,11 +462,6 @@ string IRGenerator::callValueCheck() return "if callvalue() { revert(0, 0) }"; } -string IRGenerator::implicitConstructorName(ContractDefinition const& _contract) -{ - return "constructor_" + _contract.name() + "_" + to_string(_contract.id()); -} - string IRGenerator::dispatchRoutine(ContractDefinition const& _contract) { Whiskers t(R"X( diff --git a/libsolidity/codegen/ir/IRGenerator.h b/libsolidity/codegen/ir/IRGenerator.h index 642cfcdfbe27..bff0c0739a81 100644 --- a/libsolidity/codegen/ir/IRGenerator.h +++ b/libsolidity/codegen/ir/IRGenerator.h @@ -92,8 +92,6 @@ class IRGenerator std::string deployCode(ContractDefinition const& _contract); std::string callValueCheck(); - std::string implicitConstructorName(ContractDefinition const& _contract); - std::string dispatchRoutine(ContractDefinition const& _contract); std::string memoryInit(); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index eaabdd58eca3..c9f5d403ede2 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -181,7 +181,7 @@ IRVariable IRGeneratorForStatements::evaluateExpression(Expression const& _expre string IRGeneratorForStatements::constantValueFunction(VariableDeclaration const& _constant) { - string functionName = "constant_" + _constant.name() + "_" + to_string(_constant.id()); + string functionName = IRNames::constantValueFunction(_constant); return m_context.functionCollector().createFunction(functionName, [&] { Whiskers templ(R"( function () -> { @@ -1890,7 +1890,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall( templ("pos", m_context.newYulVariable()); templ("end", m_context.newYulVariable()); if (_functionCall.annotation().tryCall) - templ("success", m_context.trySuccessConditionVariable(_functionCall)); + templ("success", IRNames::trySuccessConditionVariable(_functionCall)); else templ("success", m_context.newYulVariable()); templ("freeMemory", freeMemory()); @@ -2125,10 +2125,7 @@ void IRGeneratorForStatements::declareAssign(IRVariable const& _lhs, IRVariable IRVariable IRGeneratorForStatements::zeroValue(Type const& _type, bool _splitFunctionTypes) { - IRVariable irVar{ - "zero_value_for_type_" + _type.identifier() + m_context.newYulVariable(), - _type - }; + IRVariable irVar{IRNames::zeroValue(_type, m_context.newYulVariable()), _type}; define(irVar) << m_utils.zeroValueFunction(_type, _splitFunctionTypes) << "()\n"; return irVar; } @@ -2447,7 +2444,7 @@ bool IRGeneratorForStatements::visit(TryStatement const& _tryStatement) Expression const& externalCall = _tryStatement.externalCall(); externalCall.accept(*this); - m_code << "switch iszero(" << m_context.trySuccessConditionVariable(externalCall) << ")\n"; + m_code << "switch iszero(" << IRNames::trySuccessConditionVariable(externalCall) << ")\n"; m_code << "case 0 { // success case\n"; TryCatchClause const& successClause = *_tryStatement.clauses().front(); diff --git a/libsolidity/codegen/ir/IRVariable.cpp b/libsolidity/codegen/ir/IRVariable.cpp index 1c5ed42bf805..8cb1896a6f12 100644 --- a/libsolidity/codegen/ir/IRVariable.cpp +++ b/libsolidity/codegen/ir/IRVariable.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +#include #include #include #include @@ -30,19 +31,13 @@ IRVariable::IRVariable(std::string _baseName, Type const& _type): } IRVariable::IRVariable(VariableDeclaration const& _declaration): - IRVariable( - "vloc_" + _declaration.name() + '_' + std::to_string(_declaration.id()), - *_declaration.annotation().type - ) + IRVariable(IRNames::localVariable(_declaration), *_declaration.annotation().type) { solAssert(!_declaration.isStateVariable(), ""); } IRVariable::IRVariable(Expression const& _expression): - IRVariable( - "expr_" + to_string(_expression.id()), - *_expression.annotation().type - ) + IRVariable(IRNames::localVariable(_expression), *_expression.annotation().type) { } @@ -99,7 +94,7 @@ IRVariable IRVariable::tupleComponent(size_t _i) const m_type.category() == Type::Category::Tuple, "Requested tuple component of non-tuple IR variable." ); - return part("component_" + std::to_string(_i + 1)); + return part(IRNames::tupleComponent(_i)); } string IRVariable::suffixedName(string const& _suffix) const From c6742e3752aea0bd80db42ae4e8774383310bb45 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Sun, 17 May 2020 23:24:31 +0200 Subject: [PATCH 051/479] Fix typo in correct error ids script --- scripts/correct_error_ids.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/correct_error_ids.py b/scripts/correct_error_ids.py index 9fd3547f009d..c5885fac6458 100644 --- a/scripts/correct_error_ids.py +++ b/scripts/correct_error_ids.py @@ -149,7 +149,7 @@ def main(): print("No incorrect IDs found") else: fix_ids(used_ids, source_file_names) - print("Fixing compteted") + print("Fixing completed") if __name__ == "__main__": From a9fa9429d51098c73e769b2b504798d8560dde54 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Fri, 15 May 2020 20:46:50 +0530 Subject: [PATCH 052/479] Fixed bug in BlockDeDuplicator --- libevmasm/BlockDeduplicator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index 9a26db8ca7aa..decfee65007f 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -113,6 +113,10 @@ bool BlockDeduplicator::applyTagReplacement( if (subId != _subId) continue; auto it = _replacements.find(tagId); + // Recursively look for the element replaced by tagId + for (auto _it = it; _it != _replacements.end(); _it = _replacements.find(_it->second)) + it = _it; + if (it != _replacements.end()) { changed = true; From 4a291f85512f534096f9e017202999d016f24fc1 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Mon, 18 May 2020 11:57:07 +0530 Subject: [PATCH 053/479] Changelog and test --- Changelog.md | 2 +- .../optimizer_BlockDeDuplicator/args | 1 + .../optimizer_BlockDeDuplicator/err | 11 ++ .../optimizer_BlockDeDuplicator/input.sol | 9 ++ .../optimizer_BlockDeDuplicator/output | 107 ++++++++++++++++++ 5 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 test/cmdlineTests/optimizer_BlockDeDuplicator/args create mode 100644 test/cmdlineTests/optimizer_BlockDeDuplicator/err create mode 100644 test/cmdlineTests/optimizer_BlockDeDuplicator/input.sol create mode 100644 test/cmdlineTests/optimizer_BlockDeDuplicator/output diff --git a/Changelog.md b/Changelog.md index cf15659136bf..cfd28189336e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,7 +9,7 @@ Compiler Features: Bugfixes: - + * Optimizer: Fixed a bug in BlockDeDuplicator. ### 0.6.8 (2020-05-14) diff --git a/test/cmdlineTests/optimizer_BlockDeDuplicator/args b/test/cmdlineTests/optimizer_BlockDeDuplicator/args new file mode 100644 index 000000000000..8942fcc3523a --- /dev/null +++ b/test/cmdlineTests/optimizer_BlockDeDuplicator/args @@ -0,0 +1 @@ +--optimize --asm --metadata-hash none diff --git a/test/cmdlineTests/optimizer_BlockDeDuplicator/err b/test/cmdlineTests/optimizer_BlockDeDuplicator/err new file mode 100644 index 000000000000..e29fc4fc3fd7 --- /dev/null +++ b/test/cmdlineTests/optimizer_BlockDeDuplicator/err @@ -0,0 +1,11 @@ +Warning: Statement has no effect. + --> optimizer_BlockDeDuplicator/input.sol:7:27: + | +7 | function f() public { true ? 1 : 3;} + | ^^^^^^^^^^^^ + +Warning: Function state mutability can be restricted to pure + --> optimizer_BlockDeDuplicator/input.sol:7:5: + | +7 | function f() public { true ? 1 : 3;} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/test/cmdlineTests/optimizer_BlockDeDuplicator/input.sol b/test/cmdlineTests/optimizer_BlockDeDuplicator/input.sol new file mode 100644 index 000000000000..3f75fa240a8e --- /dev/null +++ b/test/cmdlineTests/optimizer_BlockDeDuplicator/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; + +contract C { + function fun_x() public {} + function fun_() public {} + function f() public { true ? 1 : 3;} + function() r = true ? fun_x : f; +} diff --git a/test/cmdlineTests/optimizer_BlockDeDuplicator/output b/test/cmdlineTests/optimizer_BlockDeDuplicator/output new file mode 100644 index 000000000000..6f11f97a4dad --- /dev/null +++ b/test/cmdlineTests/optimizer_BlockDeDuplicator/output @@ -0,0 +1,107 @@ + +======= optimizer_BlockDeDuplicator/input.sol:C ======= +EVM assembly: + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ + mstore(0x40, 0x80) + /* "optimizer_BlockDeDuplicator/input.sol":179:210 function() r = true ? fun_x : f */ + 0x00 + dup1 + sload + not(sub(shl(0x40, 0x01), 0x01)) + and + /* "optimizer_BlockDeDuplicator/input.sol":201:206 fun_x */ + or(tag_0_7, shl(0x20, tag_4)) + sub(shl(0x40, 0x01), 0x01) + /* "optimizer_BlockDeDuplicator/input.sol":179:210 function() r = true ? fun_x : f */ + and + or + swap1 + sstore + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ + callvalue + /* "--CODEGEN--":2:4 */ + dup1 + iszero + tag_5 + jumpi + /* "--CODEGEN--":27:28 */ + 0x00 + /* "--CODEGEN--":24:25 */ + dup1 + /* "--CODEGEN--":17:29 */ + revert + /* "--CODEGEN--":2:4 */ +tag_5: + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ + pop + jump(tag_6) + /* "optimizer_BlockDeDuplicator/input.sol":77:103 function fun_x() public {} */ +tag_4: + jump // out + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ +tag_6: + dataSize(sub_0) + dup1 + dataOffset(sub_0) + 0x00 + codecopy + 0x00 + return +stop + +sub_0: assembly { + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ + mstore(0x40, 0x80) + callvalue + /* "--CODEGEN--":5:14 */ + dup1 + /* "--CODEGEN--":2:4 */ + iszero + tag_1 + jumpi + /* "--CODEGEN--":27:28 */ + 0x00 + /* "--CODEGEN--":24:25 */ + dup1 + /* "--CODEGEN--":17:29 */ + revert + /* "--CODEGEN--":2:4 */ + tag_1: + /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ + pop + jumpi(tag_2, lt(calldatasize, 0x04)) + shr(0xe0, calldataload(0x00)) + dup1 + 0x26121ff0 + eq + tag_3 + jumpi + dup1 + 0x2e1fb2bc + eq + tag_3 + jumpi + dup1 + 0x4753a67d + eq + tag_3 + jumpi + tag_2: + /* "--CODEGEN--":12:13 */ + 0x00 + /* "--CODEGEN--":9:10 */ + dup1 + /* "--CODEGEN--":2:14 */ + revert + /* "optimizer_BlockDeDuplicator/input.sol":138:174 function f() public { true ? 1 : 3;} */ + tag_3: + tag_6 + tag_7 + jump // in + tag_6: + stop + tag_7: + jump // out + + auxdata: AUXDATA REMOVED +} From 7af4c13486ed0b4a8b31a39aad50c26dbe2ad252 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Thu, 19 Mar 2020 18:15:42 -0500 Subject: [PATCH 054/479] [circleci] add t_ubu_asan_constantinople_clang --- .circleci/config.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 81acd1383278..15f122e4838d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -173,6 +173,18 @@ defaults: - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results + - test_asan_clang: &test_asan_clang + <<: *test_ubuntu2004_clang + steps: + - checkout + - attach_workspace: + at: build + - run: + <<: *run_soltest + no_output_timeout: 30m + - store_test_results: *store_test_results + - store_artifacts: *artifacts_test_results + # -------------------------------------------------------------------------- # Workflow Templates @@ -216,6 +228,11 @@ defaults: requires: - b_ubu_asan + - workflow_ubuntu2004_asan_clang: &workflow_ubuntu2004_asan_clang + <<: *workflow_trigger_on_tags + requires: + - b_ubu_asan_clang + - workflow_emscripten: &workflow_emscripten <<: *workflow_trigger_on_tags requires: @@ -380,6 +397,20 @@ jobs: - store_artifacts: *artifacts_solc - persist_to_workspace: *artifacts_executables + + b_ubu_asan_clang: &build_ubuntu2004_clang + docker: + - image: ethereum/solidity-buildpack-deps:ubuntu2004-clang-<< pipeline.parameters.ubuntu-2004-clang-docker-image-rev >> + environment: + CC: clang + CXX: clang++ + CMAKE_OPTIONS: -DSANITIZE=address + steps: + - checkout + - run: *run_build + - store_artifacts: *artifacts_solc + - persist_to_workspace: *artifacts_executables + b_ubu: &build_ubuntu2004 docker: - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> @@ -672,6 +703,14 @@ jobs: SOLTEST_FLAGS: --no-smt ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 + t_ubu_asan_constantinople_clang: + <<: *test_asan_clang + environment: + EVM: constantinople + OPTIMIZE: 0 + SOLTEST_FLAGS: --no-smt + ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 + t_ems_solcjs: docker: - image: buildpack-deps:latest @@ -836,7 +875,9 @@ workflows: # ASan build and tests - b_ubu_asan: *workflow_trigger_on_tags + - b_ubu_asan_clang: *workflow_trigger_on_tags - t_ubu_asan_constantinople: *workflow_ubuntu2004_asan + - t_ubu_asan_constantinople_clang: *workflow_ubuntu2004_asan_clang - t_ubu_asan_cli: *workflow_ubuntu2004_asan # Emscripten build and selected tests From f92a4f1965429de364ce4fd3f7671f41ff239e3c Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 12 May 2020 16:33:05 +0200 Subject: [PATCH 055/479] Provide runtime object in Yul mode. --- libevmasm/Assembly.h | 1 + libsolidity/interface/StandardCompiler.cpp | 32 ++++++++--- libyul/AssemblyStack.cpp | 57 +++++++++++++------ libyul/AssemblyStack.h | 6 ++ .../standard_yul_object_name/output.json | 2 +- 5 files changed, 72 insertions(+), 26 deletions(-) diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index e9e3630a8af0..27d825268bf2 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -52,6 +52,7 @@ class Assembly AssemblyItem newSub(AssemblyPointer const& _sub) { m_subs.push_back(_sub); return AssemblyItem(PushSub, m_subs.size() - 1); } Assembly const& sub(size_t _sub) const { return *m_subs.at(_sub); } Assembly& sub(size_t _sub) { return *m_subs.at(_sub); } + size_t numSubs() const { return m_subs.size(); } AssemblyItem newPushSubSize(u256 const& _subId) { return AssemblyItem(PushSubSize, _subId); } AssemblyItem newPushLibraryAddress(std::string const& _identifier); AssemblyItem newPushImmutable(std::string const& _identifier); diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 0abc867e8602..6cf13c309849 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -1127,16 +1128,29 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings) stack.optimize(); - MachineAssemblyObject object = stack.assemble(AssemblyStack::Machine::EVM); + MachineAssemblyObject object; + MachineAssemblyObject runtimeObject; + tie(object, runtimeObject) = stack.assembleAndGuessRuntime(); - if (isArtifactRequested( - _inputsAndSettings.outputSelection, - sourceName, - contractName, - { "evm.bytecode", "evm.bytecode.object", "evm.bytecode.opcodes", "evm.bytecode.sourceMap", "evm.bytecode.linkReferences" }, - wildcardMatchesExperimental - )) - output["contracts"][sourceName][contractName]["evm"]["bytecode"] = collectEVMObject(*object.bytecode, object.sourceMappings.get(), false); + for (string const& objectKind: vector{"bytecode", "deployedBytecode"}) + { + auto artifacts = util::applyMap( + vector{"", ".object", ".opcodes", ".sourceMap", ".linkReferences"}, + [&](auto const& _s) { return "evm." + objectKind + _s; } + ); + if (isArtifactRequested( + _inputsAndSettings.outputSelection, + sourceName, + contractName, + artifacts, + wildcardMatchesExperimental + )) + { + MachineAssemblyObject const& o = objectKind == "bytecode" ? object : runtimeObject; + if (o.bytecode) + output["contracts"][sourceName][contractName]["evm"][objectKind] = collectEVMObject(*o.bytecode, o.sourceMappings.get(), false); + } + } if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "irOptimized", wildcardMatchesExperimental)) output["contracts"][sourceName][contractName]["irOptimized"] = stack.print(); diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index 3988bc3fd1dd..e0ff93939c5e 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -198,22 +198,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const switch (_machine) { case Machine::EVM: - { - MachineAssemblyObject object; - evmasm::Assembly assembly; - EthAssemblyAdapter adapter(assembly); - compileEVM(adapter, false, m_optimiserSettings.optimizeStackAllocation); - object.bytecode = make_shared(assembly.assemble()); - yulAssert(object.bytecode->immutableReferences.empty(), "Leftover immutables."); - object.assembly = assembly.assemblyString(); - object.sourceMappings = make_unique( - evmasm::AssemblyItem::computeSourceMapping( - assembly.items(), - {{scanner().charStream() ? scanner().charStream()->name() : "", 0}} - ) - ); - return object; - } + return assembleAndGuessRuntime().first; case Machine::EVM15: { MachineAssemblyObject object; @@ -240,6 +225,46 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const return MachineAssemblyObject(); } +pair AssemblyStack::assembleAndGuessRuntime() const +{ + yulAssert(m_analysisSuccessful, ""); + yulAssert(m_parserResult, ""); + yulAssert(m_parserResult->code, ""); + yulAssert(m_parserResult->analysisInfo, ""); + + evmasm::Assembly assembly; + EthAssemblyAdapter adapter(assembly); + compileEVM(adapter, false, m_optimiserSettings.optimizeStackAllocation); + + MachineAssemblyObject creationObject; + creationObject.bytecode = make_shared(assembly.assemble()); + yulAssert(creationObject.bytecode->immutableReferences.empty(), "Leftover immutables."); + creationObject.assembly = assembly.assemblyString(); + creationObject.sourceMappings = make_unique( + evmasm::AssemblyItem::computeSourceMapping( + assembly.items(), + {{scanner().charStream() ? scanner().charStream()->name() : "", 0}} + ) + ); + + MachineAssemblyObject runtimeObject; + // Heuristic: If there is a single sub-assembly, this is likely the runtime object. + if (assembly.numSubs() == 1) + { + evmasm::Assembly& runtimeAssembly = assembly.sub(0); + runtimeObject.bytecode = make_shared(runtimeAssembly.assemble()); + runtimeObject.assembly = runtimeAssembly.assemblyString(); + runtimeObject.sourceMappings = make_unique( + evmasm::AssemblyItem::computeSourceMapping( + runtimeAssembly.items(), + {{scanner().charStream() ? scanner().charStream()->name() : "", 0}} + ) + ); + } + return {std::move(creationObject), std::move(runtimeObject)}; + +} + string AssemblyStack::print() const { yulAssert(m_parserResult, ""); diff --git a/libyul/AssemblyStack.h b/libyul/AssemblyStack.h index 60efd96749fc..f9d23550563e 100644 --- a/libyul/AssemblyStack.h +++ b/libyul/AssemblyStack.h @@ -88,6 +88,12 @@ class AssemblyStack /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; + /// Run the assembly step (should only be called after parseAndAnalyze). + /// In addition to the value returned by @a assemble, returns + /// a second object that is guessed to be the runtime code. + /// Only available for EVM. + std::pair assembleAndGuessRuntime() const; + /// @returns the errors generated during parsing, analysis (and potentially assembly). langutil::ErrorList const& errors() const { return m_errors; } diff --git a/test/cmdlineTests/standard_yul_object_name/output.json b/test/cmdlineTests/standard_yul_object_name/output.json index 2fdd9bc11d12..58d78b3a90ca 100644 --- a/test/cmdlineTests/standard_yul_object_name/output.json +++ b/test/cmdlineTests/standard_yul_object_name/output.json @@ -22,7 +22,7 @@ sub_0: assembly { /* \"A\":137:149 */ revert } -","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" { +","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"deployedBytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" { code { let x := dataoffset(\"DataName\") sstore(add(x, 0), 0) From 9f8d5753ce589ad3c1e1324c4255f3687874d03f Mon Sep 17 00:00:00 2001 From: a3d4 Date: Fri, 15 May 2020 03:20:54 +0200 Subject: [PATCH 056/479] Introduce ErrorWatcher and remove a dedicated error flag from AsmAnalyzer --- liblangutil/ErrorReporter.h | 22 +++++++++++++ libyul/AsmAnalysis.cpp | 63 +++++++++++-------------------------- libyul/AsmAnalysis.h | 2 -- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/liblangutil/ErrorReporter.h b/liblangutil/ErrorReporter.h index a52e978afc7c..fed3430f2574 100644 --- a/liblangutil/ErrorReporter.h +++ b/liblangutil/ErrorReporter.h @@ -143,6 +143,28 @@ class ErrorReporter // @returns true if the maximum error count has been reached. bool hasExcessiveErrors() const; + class ErrorWatcher + { + public: + ErrorWatcher(ErrorReporter const& _errorReporter): + m_errorReporter(_errorReporter), + m_initialErrorCount(_errorReporter.errorCount()) + {} + bool ok() const + { + solAssert(m_initialErrorCount <= m_errorReporter.errorCount(), "Unexpected error count."); + return m_initialErrorCount == m_errorReporter.errorCount(); + } + private: + ErrorReporter const& m_errorReporter; + unsigned const m_initialErrorCount; + }; + + ErrorWatcher errorWatcher() const + { + return ErrorWatcher(*this); + } + private: void error( ErrorId _error, diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 2edd4dc38fec..80c90650d501 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -45,22 +45,20 @@ using namespace solidity::langutil; bool AsmAnalyzer::analyze(Block const& _block) { - m_success = true; + auto watcher = m_errorReporter.errorWatcher(); try { if (!(ScopeFiller(m_info, m_errorReporter))(_block)) return false; (*this)(_block); - if (!m_success) - yulAssert(m_errorReporter.hasErrors(), "No success but no error."); } catch (FatalError const&) { // This FatalError con occur if the errorReporter has too many errors. - yulAssert(!m_errorReporter.errors().empty(), "Fatal error detected, but no error is reported."); + yulAssert(!watcher.ok(), "Fatal error detected, but no error is reported."); } - return m_success && !m_errorReporter.hasErrors(); + return watcher.ok(); } AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(Dialect const& _dialect, Object const& _object) @@ -105,7 +103,7 @@ vector AsmAnalyzer::operator()(Literal const& _literal) vector AsmAnalyzer::operator()(Identifier const& _identifier) { yulAssert(!_identifier.name.empty(), ""); - size_t numErrorsBefore = m_errorReporter.errors().size(); + auto watcher = m_errorReporter.errorWatcher(); YulString type = m_dialect.defaultType; if (m_currentScope->lookup(_identifier.name, GenericVisitor{ @@ -141,13 +139,9 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) yulAssert(stackSize == 1, "Invalid stack size of external reference."); } } - if (!found) - { + if (!found && watcher.ok()) // Only add an error message if the callback did not do it. - if (numErrorsBefore == m_errorReporter.errors().size()) - declarationError(_identifier.location, "Identifier not found."); - m_success = false; - } + declarationError(_identifier.location, "Identifier not found."); } return {type}; @@ -155,8 +149,9 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) void AsmAnalyzer::operator()(ExpressionStatement const& _statement) { + auto watcher = m_errorReporter.errorWatcher(); vector types = std::visit(*this, _statement.expression); - if (m_success && !types.empty()) + if (watcher.ok() && !types.empty()) typeError(_statement.location, "Top-level expressions are not supposed to return values (this expression returns " + to_string(types.size()) + @@ -253,6 +248,7 @@ void AsmAnalyzer::operator()(FunctionDefinition const& _funDef) vector AsmAnalyzer::operator()(FunctionCall const& _funCall) { yulAssert(!_funCall.functionName.name.empty(), ""); + auto watcher = m_errorReporter.errorWatcher(); vector const* parameterTypes = nullptr; vector const* returnTypes = nullptr; vector const* needsLiteralArguments = nullptr; @@ -281,7 +277,7 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) { if (!warnOnInstructions(_funCall.functionName.name.str(), _funCall.functionName.location)) declarationError(_funCall.functionName.location, "Function not found."); - m_success = false; + yulAssert(!watcher.ok(), "Expected a reported error."); } if (parameterTypes && _funCall.arguments.size() != parameterTypes->size()) typeError( @@ -323,7 +319,7 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) for (size_t i = 0; i < parameterTypes->size(); ++i) expectType((*parameterTypes)[i], argTypes[i], locationOf(_funCall.arguments[i])); - if (m_success) + if (watcher.ok()) { yulAssert(parameterTypes && parameterTypes->size() == argTypes.size(), ""); yulAssert(returnTypes, ""); @@ -353,6 +349,8 @@ void AsmAnalyzer::operator()(Switch const& _switch) { if (_case.value) { + auto watcher = m_errorReporter.errorWatcher(); + expectType(valueType, _case.value->type, _case.value->location); // We cannot use "expectExpression" here because *_case.value is not an @@ -360,7 +358,7 @@ void AsmAnalyzer::operator()(Switch const& _switch) (*this)(*_case.value); /// Note: the parser ensures there is only one default case - if (m_success && !cases.insert(valueOfLiteral(*_case.value)).second) + if (watcher.ok() && !cases.insert(valueOfLiteral(*_case.value)).second) declarationError(_case.location, "Duplicate case defined."); } @@ -432,7 +430,7 @@ void AsmAnalyzer::expectBoolExpression(Expression const& _expr) void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueType) { yulAssert(!_variable.name.empty(), ""); - size_t numErrorsBefore = m_errorReporter.errors().size(); + auto watcher = m_errorReporter.errorWatcher(); YulString const* variableType = nullptr; bool found = false; if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name)) @@ -461,13 +459,9 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT } } - if (!found) - { - m_success = false; + if (!found && watcher.ok()) // Only add message if the callback did not. - if (numErrorsBefore == m_errorReporter.errors().size()) - declarationError(_variable.location, "Variable not found or variable not lvalue."); - } + declarationError(_variable.location, "Variable not found or variable not lvalue."); if (variableType && *variableType != _valueType) typeError(_variable.location, "Assigning a value of type \"" + @@ -477,8 +471,7 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT "\"." ); - if (m_success) - yulAssert(variableType, ""); + yulAssert(!watcher.ok() || variableType, ""); } Scope& AsmAnalyzer::scope(Block const* _block) @@ -545,43 +538,28 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation _instr == evmasm::Instruction::RETURNDATACOPY || _instr == evmasm::Instruction::RETURNDATASIZE ) && !m_evmVersion.supportsReturndata()) - { errorForVM("only available for Byzantium-compatible"); - } else if (_instr == evmasm::Instruction::STATICCALL && !m_evmVersion.hasStaticCall()) - { errorForVM("only available for Byzantium-compatible"); - } else if (( _instr == evmasm::Instruction::SHL || _instr == evmasm::Instruction::SHR || _instr == evmasm::Instruction::SAR ) && !m_evmVersion.hasBitwiseShifting()) - { errorForVM("only available for Constantinople-compatible"); - } else if (_instr == evmasm::Instruction::CREATE2 && !m_evmVersion.hasCreate2()) - { errorForVM("only available for Constantinople-compatible"); - } else if (_instr == evmasm::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash()) - { errorForVM("only available for Constantinople-compatible"); - } else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID()) - { errorForVM("only available for Istanbul-compatible"); - } else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) - { errorForVM("only available for Istanbul-compatible"); - } else if ( _instr == evmasm::Instruction::JUMP || _instr == evmasm::Instruction::JUMPI || _instr == evmasm::Instruction::JUMPDEST ) - { m_errorReporter.error( 4316_error, Error::Type::SyntaxError, @@ -590,8 +568,6 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation "incorrect stack access. Because of that they are disallowed in strict assembly. " "Use functions, \"switch\", \"if\" or \"for\" statements instead." ); - m_success = false; - } else return false; @@ -601,12 +577,9 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation void AsmAnalyzer::typeError(SourceLocation const& _location, string const& _description) { m_errorReporter.typeError(7569_error, _location, _description); - m_success = false; } void AsmAnalyzer::declarationError(SourceLocation const& _location, string const& _description) { m_errorReporter.declarationError(9595_error, _location, _description); - m_success = false; } - diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 09ca73ee2bb1..bbc37bedb6af 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -115,8 +115,6 @@ class AsmAnalyzer void typeError(langutil::SourceLocation const& _location, std::string const& _description); void declarationError(langutil::SourceLocation const& _location, std::string const& _description); - /// Success-flag, can be set to false at any time. - bool m_success = true; yul::ExternalIdentifierAccess::Resolver m_resolver; Scope* m_currentScope = nullptr; /// Variables that are active at the current point in assembly (as opposed to From 20c8851f43730957677d026552636e4efaba7789 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Mon, 11 May 2020 23:26:09 -0400 Subject: [PATCH 057/479] Use optional for CompilerStack::Contract source mappings --- libsolidity/interface/CompilerStack.cpp | 8 ++++---- libsolidity/interface/CompilerStack.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 558c262d0c23..a8a415d99623 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -582,9 +582,9 @@ string const* CompilerStack::sourceMapping(string const& _contractName) const if (!c.sourceMapping) { if (auto items = assemblyItems(_contractName)) - c.sourceMapping = make_unique(evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices())); + c.sourceMapping.emplace(evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices())); } - return c.sourceMapping.get(); + return c.sourceMapping ? &*c.sourceMapping : nullptr; } string const* CompilerStack::runtimeSourceMapping(string const& _contractName) const @@ -596,11 +596,11 @@ string const* CompilerStack::runtimeSourceMapping(string const& _contractName) c if (!c.runtimeSourceMapping) { if (auto items = runtimeAssemblyItems(_contractName)) - c.runtimeSourceMapping = make_unique( + c.runtimeSourceMapping.emplace( evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices()) ); } - return c.runtimeSourceMapping.get(); + return c.runtimeSourceMapping ? &*c.runtimeSourceMapping : nullptr; } std::string const CompilerStack::filesystemFriendlyName(string const& _contractName) const diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 96dbc4f043ed..d3fe1a45a318 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -348,8 +348,8 @@ class CompilerStack: boost::noncopyable util::LazyInit storageLayout; util::LazyInit userDocumentation; util::LazyInit devDocumentation; - mutable std::unique_ptr sourceMapping; - mutable std::unique_ptr runtimeSourceMapping; + mutable std::optional sourceMapping; + mutable std::optional runtimeSourceMapping; }; /// Loads the missing sources from @a _ast (named @a _path) using the callback From 899e6d7e2b9ccb40292bb7de6aaac5d418286011 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Tue, 12 May 2020 11:17:23 -0400 Subject: [PATCH 058/479] Use optional for FunctionImport::returnType --- libyul/backends/wasm/WasmAST.h | 3 ++- libyul/backends/wasm/WasmCodeTransform.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h index 02862aea290c..635b7c4ea06e 100644 --- a/libyul/backends/wasm/WasmAST.h +++ b/libyul/backends/wasm/WasmAST.h @@ -25,6 +25,7 @@ #include #include #include +#include namespace solidity::yul::wasm { @@ -76,7 +77,7 @@ struct FunctionImport { std::string externalName; std::string internalName; std::vector paramTypes; - std::unique_ptr returnType; + std::optional returnType; }; struct FunctionDefinition diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 9c553b380a8c..ea88efbf77f8 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -29,6 +29,8 @@ #include +#include + using namespace std; using namespace solidity; using namespace solidity::yul; @@ -125,7 +127,7 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) builtin->name.str().substr(4), builtin->name.str(), {}, - builtin->returns.empty() ? nullptr : make_unique(builtin->returns.front().str()) + builtin->returns.empty() ? nullopt : make_optional(builtin->returns.front().str()) }; for (auto const& param: builtin->parameters) imp.paramTypes.emplace_back(param.str()); From 63ad1092cdc70c3a199f3ed3acf919ac771b6ac0 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Tue, 12 May 2020 10:39:00 -0400 Subject: [PATCH 059/479] Add comment to filenames in boostTest.cpp --- test/boostTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/boostTest.cpp b/test/boostTest.cpp index eb55ead8995b..5b45cc758214 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -89,7 +89,10 @@ int registerTests( } else { - static vector> filenames; + // This must be a vector of unique_ptrs because Boost.Test keeps the equivalent of a string_view to the filename + // that is passed in. If the strings were stored directly in the vector, pointers/references to them would be + // invalidated on reallocation. + static vector> filenames; filenames.emplace_back(make_unique(_path.string())); _suite.add(make_test_case( From 82db35e5639cba0ec0693c6d4e383287598b1c1c Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 12 May 2020 00:39:00 +0200 Subject: [PATCH 060/479] [SMTChecker] Support array push/pop --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 81 +++++++++++++++++++++++++++---- libsolidity/formal/SMTEncoder.h | 4 ++ 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index cfd28189336e..0409261c2ff8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Language Features: Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. * SMTChecker: Support array ``length``. + * SMTChecker: Support array ``push`` and ``pop``. Bugfixes: diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 09c1884351bd..c90dbde6d90e 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -646,6 +646,12 @@ void SMTEncoder::endVisit(FunctionCall const& _funCall) m_context.state().transfer(m_context.state().thisAddress(), expr(address), expr(*value)); break; } + case FunctionType::Kind::ArrayPush: + arrayPush(_funCall); + break; + case FunctionType::Kind::ArrayPop: + arrayPop(_funCall); + break; default: m_errorReporter.warning( 4588_error, @@ -905,16 +911,6 @@ bool SMTEncoder::visit(MemberAccess const& _memberAccess) m_context ); } - else - { - auto const& name = _memberAccess.memberName(); - solAssert(name == "push" || name == "pop", ""); - m_errorReporter.warning( - 9098_error, - _memberAccess.location(), - "Assertion checker does not yet support array member \"" + name + "\"." - ); - } return false; } else @@ -1082,6 +1078,71 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c } } +void SMTEncoder::arrayPush(FunctionCall const& _funCall) +{ + auto memberAccess = dynamic_cast(&_funCall.expression()); + solAssert(memberAccess, ""); + auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); + solAssert(symbArray, ""); + auto oldLength = symbArray->length(); + auto const& arguments = _funCall.arguments(); + smt::Expression element = arguments.empty() ? + smt::zeroValue(_funCall.annotation().type) : + expr(*arguments.front()); + smt::Expression store = smt::Expression::store( + symbArray->elements(), + oldLength, + element + ); + symbArray->increaseIndex(); + m_context.addAssertion(symbArray->elements() == store); + auto newLength = smt::Expression::ite( + oldLength == smt::maxValue(*TypeProvider::uint256()), + 0, + oldLength + 1 + ); + m_context.addAssertion(symbArray->length() == newLength); + + if (arguments.empty()) + defineExpr(_funCall, element); + + arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); +} + +void SMTEncoder::arrayPop(FunctionCall const& _funCall) +{ + auto memberAccess = dynamic_cast(&_funCall.expression()); + solAssert(memberAccess, ""); + auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); + solAssert(symbArray, ""); + auto oldElements = symbArray->elements(); + auto oldLength = symbArray->length(); + symbArray->increaseIndex(); + m_context.addAssertion(symbArray->elements() == oldElements); + auto newLength = smt::Expression::ite( + oldLength == 0, + smt::maxValue(*TypeProvider::uint256()), + oldLength - 1 + ); + m_context.addAssertion(symbArray->length() == newLength); + + arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); +} + +void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smt::Expression const& _array) +{ + if (auto const* id = dynamic_cast(&_expr)) + { + auto varDecl = identifierToVariable(*id); + solAssert(varDecl, ""); + m_context.addAssertion(m_context.newValue(*varDecl) == _array); + } + else if (auto const* indexAccess = dynamic_cast(&_expr)) + arrayIndexAssignment(*indexAccess, _array); + else + solAssert(false, ""); +} + void SMTEncoder::defineGlobalVariable(string const& _name, Expression const& _expr, bool _increaseIndex) { if (!m_context.knownGlobalSymbol(_name)) diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 21bf094c06b4..871a3d8b5bc9 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -137,6 +137,10 @@ class SMTEncoder: public ASTConstVisitor /// Handles assignment to SMT array index. void arrayIndexAssignment(Expression const& _expr, smt::Expression const& _rightHandSide); + void arrayPush(FunctionCall const& _funCall); + void arrayPop(FunctionCall const& _funCall); + void arrayPushPopAssign(Expression const& _expr, smt::Expression const& _array); + /// Division expression in the given type. Requires special treatment because /// of rounding for signed division. smt::Expression division(smt::Expression _left, smt::Expression _right, IntegerType const& _type); From d4d26c02e4fec88cde45fbda70e3997494a48729 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Sun, 17 May 2020 20:20:17 +0200 Subject: [PATCH 061/479] Assume that push will not overflow --- docs/security-considerations.rst | 11 +++++++++++ libsolidity/formal/SMTEncoder.cpp | 12 ++++++------ .../smtCheckerTests/array_members/push.sol | 10 ++++++++++ .../smtCheckerTests/array_members/push_2d.sol | 13 +++++++++++++ .../array_members/push_overflow_1_safe.sol | 10 ++++++++++ ...ush_overflow_1_safe_no_overflow_assumption.sol | 11 +++++++++++ .../array_members/push_overflow_2_safe.sol | 12 ++++++++++++ ...ush_overflow_2_safe_no_overflow_assumption.sol | 15 +++++++++++++++ 8 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_2d.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index f899736aa9d0..4ea39671d5f1 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -657,3 +657,14 @@ Notice that we do not clear knowledge about ``array`` and ``d`` because they are located in storage, even though they also have type ``uint[]``. However, if ``d`` was assigned, we would need to clear knowledge about ``array`` and vice-versa. + +Real World Assumptions +====================== + +Some scenarios are expressive in Solidity and the EVM, but are expected to +never occur in practice. +One of such cases is the length of a dynamic storage array overflowing after a +push: If the ``push`` operation is applied to such array 2^256 times, its +length silently overflows. +However, this is unlikely to happen in practice, since the Earth, the sun and +the universe might not be around anymore at the end of the 2^256 operations. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index c90dbde6d90e..e109b625eb57 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1085,6 +1085,11 @@ void SMTEncoder::arrayPush(FunctionCall const& _funCall) auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); solAssert(symbArray, ""); auto oldLength = symbArray->length(); + m_context.addAssertion(oldLength >= 0); + // Real world assumption: the array length is assumed to not overflow. + // This assertion guarantees that both the current and updated lengths have the above property. + m_context.addAssertion(oldLength + 1 < (smt::maxValue(*TypeProvider::uint256()) - 1)); + auto const& arguments = _funCall.arguments(); smt::Expression element = arguments.empty() ? smt::zeroValue(_funCall.annotation().type) : @@ -1096,12 +1101,7 @@ void SMTEncoder::arrayPush(FunctionCall const& _funCall) ); symbArray->increaseIndex(); m_context.addAssertion(symbArray->elements() == store); - auto newLength = smt::Expression::ite( - oldLength == smt::maxValue(*TypeProvider::uint256()), - 0, - oldLength + 1 - ); - m_context.addAssertion(symbArray->length() == newLength); + m_context.addAssertion(symbArray->length() == oldLength + 1); if (arguments.empty()) defineExpr(_funCall, element); diff --git a/test/libsolidity/smtCheckerTests/array_members/push.sol b/test/libsolidity/smtCheckerTests/array_members/push.sol new file mode 100644 index 000000000000..f6623d361026 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f(uint x) public { + require(a.length < 100000); + a.push(x); + assert(a[a.length - 1] == x); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d.sol new file mode 100644 index 000000000000..d09e847b7f8b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d.sol @@ -0,0 +1,13 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f(uint[] memory x, uint y) public { + require(a.length < 100000); + a.push(x); + assert(a[a.length - 1][0] == x[0]); + require(a[0].length < 100000); + a[0].push(y); + assert(a[0][a[0].length - 1] == y); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol new file mode 100644 index 000000000000..f563504f4b2d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint256[] x; + constructor() public { x.push(42); } + function f() public { + x.push(23); + assert(x[0] == 42 || x[0] == 23); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol new file mode 100644 index 000000000000..2a2b6b91a06b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; + +contract C { + uint256[] x; + constructor() public { x.push(42); } + function f() public { + x.push(23); + assert(x[0] == 42); + } +} +// ---- diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol new file mode 100644 index 000000000000..340f670d06c4 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol @@ -0,0 +1,12 @@ +contract C { + uint256[] x; + function f(uint256 l) public { + require(x.length == 0); + x.push(42); + x.push(84); + for(uint256 i = 0; i < l; ++i) + x.push(23); + assert(x[0] == 42 || x[0] == 23); + } +} + diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol new file mode 100644 index 000000000000..70fcb8709350 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol @@ -0,0 +1,15 @@ +pragma experimental SMTChecker; + +contract C { + uint256[] x; + function f(uint256 l) public { + require(x.length == 0); + x.push(42); + x.push(84); + for(uint256 i = 0; i < l; ++i) + x.push(23); + assert(x[0] == 42); + } +} + +// ---- From 2435ab938c9e1b34ba7ded71f3df2173955d04e8 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Sun, 17 May 2020 23:21:08 +0200 Subject: [PATCH 062/479] Add verification target for empty pop --- libsolidity/formal/CHC.cpp | 98 +++++++++++++++++-- libsolidity/formal/CHC.h | 7 +- libsolidity/formal/SMTEncoder.cpp | 7 +- libsolidity/formal/SMTEncoder.h | 5 +- .../array_members/pop_1_safe.sol | 9 ++ .../array_members/pop_1_unsafe.sol | 10 ++ .../array_members/pop_2d_safe.sol | 10 ++ .../array_members/pop_2d_unsafe.sol | 10 ++ .../array_members/pop_constructor_safe.sol | 9 ++ .../array_members/pop_constructor_unsafe.sol | 8 ++ .../array_members/pop_loop_safe.sol | 11 +++ .../array_members/pop_loop_unsafe.sol | 12 +++ .../{push_2d.sol => push_2d_arg_1_safe.sol} | 3 - .../array_members/push_2d_arg_1_unsafe.sol | 11 +++ .../{push.sol => push_arg_1.sol} | 1 - ...overflow_1_safe_no_overflow_assumption.sol | 1 - ...overflow_2_safe_no_overflow_assumption.sol | 2 - .../array_members/push_zero_2d_safe.sol | 10 ++ .../array_members/push_zero_2d_unsafe.sol | 10 ++ .../array_members/push_zero_safe.sol | 9 ++ .../array_members/push_zero_unsafe.sol | 9 ++ 21 files changed, 232 insertions(+), 20 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_1_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_2d_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_loop_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol rename test/libsolidity/smtCheckerTests/array_members/{push_2d.sol => push_2d_arg_1_safe.sol} (63%) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol rename test/libsolidity/smtCheckerTests/array_members/{push.sol => push_arg_1.sol} (81%) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_zero_2d_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_zero_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 1453df34f3e3..f309599721c2 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -98,17 +98,45 @@ void CHC::analyze(SourceUnit const& _source) for (auto const& [scope, target]: m_verificationTargets) { - auto assertions = transactionAssertions(scope); - for (auto const* assertion: assertions) + if (target.type == VerificationTarget::Type::Assert) { + auto assertions = transactionAssertions(scope); + for (auto const* assertion: assertions) + { + createErrorBlock(); + connectBlocks(target.value, error(), target.constraints && (target.errorId == assertion->id())); + auto [result, model] = query(error(), assertion->location()); + // This should be fine but it's a bug in the old compiler + (void)model; + if (result == smt::CheckResult::UNSATISFIABLE) + m_safeAssertions.insert(assertion); + } + } + else if (target.type == VerificationTarget::Type::PopEmptyArray) + { + solAssert(dynamic_cast(scope), ""); createErrorBlock(); - connectBlocks(target.value, error(), target.constraints && (target.errorId == assertion->id())); - auto [result, model] = query(error(), assertion->location()); + connectBlocks(target.value, error(), target.constraints && (target.errorId == scope->id())); + auto [result, model] = query(error(), scope->location()); // This should be fine but it's a bug in the old compiler (void)model; - if (result == smt::CheckResult::UNSATISFIABLE) - m_safeAssertions.insert(assertion); + if (result != smt::CheckResult::UNSATISFIABLE) + { + string msg = "Empty array \"pop\" "; + if (result == smt::CheckResult::SATISFIABLE) + msg += "detected here."; + else + msg += "might happen here."; + m_unsafeTargets.insert(scope); + m_outerErrorReporter.warning( + 2529_error, + scope->location(), + msg + ); + } } + else + solAssert(false, ""); } } @@ -161,7 +189,7 @@ void CHC::endVisit(ContractDefinition const& _contract) auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); setCurrentBlock(*m_constructorSummaryPredicate, &stateExprs); - addVerificationTarget(m_currentContract, m_currentBlock, smt::Expression(true), m_error.currentValue()); + addAssertVerificationTarget(m_currentContract, m_currentBlock, smt::Expression(true), m_error.currentValue()); connectBlocks(m_currentBlock, interface(), m_error.currentValue() == 0); SMTEncoder::endVisit(_contract); @@ -256,7 +284,7 @@ void CHC::endVisit(FunctionDefinition const& _function) if (_function.isPublic()) { - addVerificationTarget(&_function, m_currentBlock, sum, assertionError); + addAssertVerificationTarget(&_function, m_currentBlock, sum, assertionError); connectBlocks(m_currentBlock, iface, sum && (assertionError == 0)); } } @@ -556,10 +584,34 @@ void CHC::unknownFunctionCall(FunctionCall const&) m_unknownFunctionCallSeen = true; } +void CHC::makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) +{ + FunctionType const& funType = dynamic_cast(*_arrayPop.expression().annotation().type); + solAssert(funType.kind() == FunctionType::Kind::ArrayPop, ""); + + auto memberAccess = dynamic_cast(&_arrayPop.expression()); + solAssert(memberAccess, ""); + auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); + solAssert(symbArray, ""); + + auto previousError = m_error.currentValue(); + m_error.increaseIndex(); + + addArrayPopVerificationTarget(&_arrayPop, m_error.currentValue()); + connectBlocks( + m_currentBlock, + m_currentFunction->isConstructor() ? summary(*m_currentContract) : summary(*m_currentFunction), + currentPathConditions() && symbArray->length() <= 0 && m_error.currentValue() == _arrayPop.id() + ); + + m_context.addAssertion(m_error.currentValue() == previousError); +} + void CHC::resetSourceAnalysis() { m_verificationTargets.clear(); m_safeAssertions.clear(); + m_unsafeTargets.clear(); m_functionAssertions.clear(); m_callGraph.clear(); m_summaries.clear(); @@ -974,9 +1026,35 @@ pair> CHC::query(smt::Expression const& _query, return {result, values}; } -void CHC::addVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId) +void CHC::addVerificationTarget( + ASTNode const* _scope, + VerificationTarget::Type _type, + smt::Expression _from, + smt::Expression _constraints, + smt::Expression _errorId +) { - m_verificationTargets.emplace(_scope, CHCVerificationTarget{{VerificationTarget::Type::Assert, _from, _constraints}, _errorId}); + m_verificationTargets.emplace(_scope, CHCVerificationTarget{{_type, _from, _constraints}, _errorId}); +} + +void CHC::addAssertVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId) +{ + addVerificationTarget(_scope, VerificationTarget::Type::Assert, _from, _constraints, _errorId); +} + +void CHC::addArrayPopVerificationTarget(ASTNode const* _scope, smt::Expression _errorId) +{ + solAssert(m_currentContract, ""); + solAssert(m_currentFunction, ""); + + if (m_currentFunction->isConstructor()) + addVerificationTarget(_scope, VerificationTarget::Type::PopEmptyArray, summary(*m_currentContract), smt::Expression(true), _errorId); + else + { + auto iface = (*m_interfaces.at(m_currentContract))(initialStateVariables()); + auto sum = summary(*m_currentFunction); + addVerificationTarget(_scope, VerificationTarget::Type::PopEmptyArray, iface, sum, _errorId); + } } string CHC::uniquePrefix() diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 7fc752451c9d..87f902732fe8 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -78,6 +78,7 @@ class CHC: public SMTEncoder void visitAssert(FunctionCall const& _funCall); void internalFunctionCall(FunctionCall const& _funCall); void unknownFunctionCall(FunctionCall const& _funCall); + void makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) override; //@} struct IdCompare @@ -182,7 +183,9 @@ class CHC: public SMTEncoder /// @returns otherwise. std::pair> query(smt::Expression const& _query, langutil::SourceLocation const& _location); - void addVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId); + void addVerificationTarget(ASTNode const* _scope, VerificationTarget::Type _type, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId); + void addAssertVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId); + void addArrayPopVerificationTarget(ASTNode const* _scope, smt::Expression _errorId); //@} /// Misc. @@ -245,6 +248,8 @@ class CHC: public SMTEncoder /// Assertions proven safe. std::set m_safeAssertions; + /// Targets proven unsafe. + std::set m_unsafeTargets; //@} /// Control-flow. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index e109b625eb57..44bec4d85acf 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1115,8 +1115,13 @@ void SMTEncoder::arrayPop(FunctionCall const& _funCall) solAssert(memberAccess, ""); auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); solAssert(symbArray, ""); + + makeArrayPopVerificationTarget(_funCall); + auto oldElements = symbArray->elements(); auto oldLength = symbArray->length(); + m_context.addAssertion(oldLength > 0); + symbArray->increaseIndex(); m_context.addAssertion(symbArray->elements() == oldElements); auto newLength = smt::Expression::ite( @@ -1124,7 +1129,7 @@ void SMTEncoder::arrayPop(FunctionCall const& _funCall) smt::maxValue(*TypeProvider::uint256()), oldLength - 1 ); - m_context.addAssertion(symbArray->length() == newLength); + m_context.addAssertion(symbArray->length() == oldLength - 1); arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); } diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 871a3d8b5bc9..f62f18558c9b 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -140,6 +140,9 @@ class SMTEncoder: public ASTConstVisitor void arrayPush(FunctionCall const& _funCall); void arrayPop(FunctionCall const& _funCall); void arrayPushPopAssign(Expression const& _expr, smt::Expression const& _array); + /// Allows BMC and CHC to create verification targets for popping + /// an empty array. + virtual void makeArrayPopVerificationTarget(FunctionCall const&) {} /// Division expression in the given type. Requires special treatment because /// of rounding for signed division. @@ -244,7 +247,7 @@ class SMTEncoder: public ASTConstVisitor struct VerificationTarget { - enum class Type { ConstantCondition, Underflow, Overflow, UnderOverflow, DivByZero, Balance, Assert } type; + enum class Type { ConstantCondition, Underflow, Overflow, UnderOverflow, DivByZero, Balance, Assert, PopEmptyArray } type; smt::Expression value; smt::Expression constraints; }; diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_1_safe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_1_safe.sol new file mode 100644 index 000000000000..34663d931f7e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_1_safe.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f() public { + a.push(); + a.pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol new file mode 100644 index 000000000000..e6f2273f8aad --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f() public { + a.pop(); + } +} +// ---- +// Warning: (82-89): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_2d_safe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_2d_safe.sol new file mode 100644 index 000000000000..c67e91959658 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_2d_safe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + a[0].push(); + a[0].pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol new file mode 100644 index 000000000000..1b7713089536 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + a[0].push(); + a[1].pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol new file mode 100644 index 000000000000..4842ee56f74d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + constructor() public { + a.push(); + a.pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol new file mode 100644 index 000000000000..f94bdcd68d12 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol @@ -0,0 +1,8 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + constructor() public { + a.pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_loop_safe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_loop_safe.sol new file mode 100644 index 000000000000..25986da7b017 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_loop_safe.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f(uint l) public { + for (uint i = 0; i < l; ++i) { + a.push(); + a.pop(); + } + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol new file mode 100644 index 000000000000..2218c6665b5e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f(uint l) public { + for (uint i = 0; i < l; ++i) { + a.push(); + a.pop(); + } + a.pop(); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_safe.sol similarity index 63% rename from test/libsolidity/smtCheckerTests/array_members/push_2d.sol rename to test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_safe.sol index d09e847b7f8b..34a1ae680723 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_2d.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_safe.sol @@ -3,10 +3,7 @@ pragma experimental SMTChecker; contract C { uint[][] a; function f(uint[] memory x, uint y) public { - require(a.length < 100000); a.push(x); - assert(a[a.length - 1][0] == x[0]); - require(a[0].length < 100000); a[0].push(y); assert(a[0][a[0].length - 1] == y); } diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol new file mode 100644 index 000000000000..23b8f6f00be0 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f(uint[] memory x, uint y) public { + a.push(x); + a[0].push(y); + a[0].pop(); + assert(a[0][a[0].length - 1] == y); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push.sol b/test/libsolidity/smtCheckerTests/array_members/push_arg_1.sol similarity index 81% rename from test/libsolidity/smtCheckerTests/array_members/push.sol rename to test/libsolidity/smtCheckerTests/array_members/push_arg_1.sol index f6623d361026..e36895554360 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_arg_1.sol @@ -3,7 +3,6 @@ pragma experimental SMTChecker; contract C { uint[] a; function f(uint x) public { - require(a.length < 100000); a.push(x); assert(a[a.length - 1] == x); } diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol index 2a2b6b91a06b..7ed99a69edaf 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol @@ -8,4 +8,3 @@ contract C { assert(x[0] == 42); } } -// ---- diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol index 70fcb8709350..1f468f5923ff 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol @@ -11,5 +11,3 @@ contract C { assert(x[0] == 42); } } - -// ---- diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_safe.sol new file mode 100644 index 000000000000..45a56e677857 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_safe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + a[0].push(); + assert(a[a.length - 1][0] == 0); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol new file mode 100644 index 000000000000..91fcd90b1b3d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + a[0].push(); + assert(a[a.length - 1][0] == 100); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_safe.sol new file mode 100644 index 000000000000..e8054e361d1b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_safe.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f() public { + a.push(); + assert(a[a.length - 1] == 0); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol new file mode 100644 index 000000000000..b99f42fa48f9 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + function f() public { + a.push(); + assert(a[a.length - 1] == 100); + } +} From 1ab6ad79d8302557f83764ffca2e4d22990eb036 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 18 May 2020 16:33:27 +0200 Subject: [PATCH 063/479] Update test expectation --- .../array_members/pop_2d_unsafe.sol | 2 ++ .../array_members/pop_constructor_unsafe.sol | 2 ++ .../array_members/pop_loop_unsafe.sol | 2 ++ .../array_members/push_2d_arg_1_unsafe.sol | 3 +++ .../push_storage_ref_safe_aliasing.sol | 16 ++++++++++++++++ .../push_storage_ref_unsafe_aliasing.sol | 15 +++++++++++++++ .../array_members/push_zero_2d_unsafe.sol | 2 ++ .../array_members/push_zero_unsafe.sol | 2 ++ 8 files changed, 44 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol index 1b7713089536..1161ab92e5f6 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol @@ -8,3 +8,5 @@ contract C { a[1].pop(); } } +// ---- +// Warning: (111-121): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol index f94bdcd68d12..a86d1a3f350c 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol @@ -6,3 +6,5 @@ contract C { a.pop(); } } +// ---- +// Warning: (83-90): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol index 2218c6665b5e..5d4241984c96 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol @@ -10,3 +10,5 @@ contract C { a.pop(); } } +// ---- +// Warning: (150-157): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol index 23b8f6f00be0..d5bd19bb13f9 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol @@ -9,3 +9,6 @@ contract C { assert(a[0][a[0].length - 1] == y); } } +// ---- +// Warning: (162-177): Underflow (resulting value less than 0) happens here +// Warning: (150-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol new file mode 100644 index 000000000000..8ad5cdcad037 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol @@ -0,0 +1,16 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + uint[] storage b = a[0]; + b.push(8); + assert(b[b.length - 1] == 8); + // Safe but fails due to aliasing. + assert(a[0][a[0].length - 1] == 8); + } +} +// ---- +// Warning: (217-232): Underflow (resulting value less than 0) happens here +// Warning: (205-239): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol new file mode 100644 index 000000000000..f54fc8d83f34 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol @@ -0,0 +1,15 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + function f() public { + a.push(); + a[0].push(); + a[0][0] = 16; + uint[] storage b = a[0]; + b[0] = 32; + assert(a[0][0] == 16); + } +} +// ---- +// Warning: (167-188): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol index 91fcd90b1b3d..9b9516ccd199 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol @@ -8,3 +8,5 @@ contract C { assert(a[a.length - 1][0] == 100); } } +// ---- +// Warning: (111-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol index b99f42fa48f9..966b4e1bd154 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol @@ -7,3 +7,5 @@ contract C { assert(a[a.length - 1] == 100); } } +// ---- +// Warning: (94-124): Assertion violation happens here From 5d6dd6876601003017dcba497d0202b2486d1eda Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 18 May 2020 17:09:46 +0200 Subject: [PATCH 064/479] Update docs --- docs/security-considerations.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 4ea39671d5f1..772fa7c1d443 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -661,10 +661,10 @@ vice-versa. Real World Assumptions ====================== -Some scenarios are expressive in Solidity and the EVM, but are expected to +Some scenarios can be expressed in Solidity and the EVM, but are expected to never occur in practice. -One of such cases is the length of a dynamic storage array overflowing after a -push: If the ``push`` operation is applied to such array 2^256 times, its +One of such cases is the length of a dynamic storage array overflowing during a +push: If the ``push`` operation is applied to an array of length 2^256 - 1, its length silently overflows. -However, this is unlikely to happen in practice, since the Earth, the sun and -the universe might not be around anymore at the end of the 2^256 operations. +However, this is unlikely to happen in practice, since the operations required +to grow the array to that point would take billions of years to execute. From 5a7217b90ea4c4310e8ddf883335837a63aaf710 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 19 May 2020 14:26:08 +0200 Subject: [PATCH 065/479] Test: Output JSON AST as array when it involves multiple sources --- test/libsolidity/ASTJSON/documentation.json | 2 ++ test/libsolidity/ASTJSONTest.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json index 782409abfd96..b4305969e659 100644 --- a/test/libsolidity/ASTJSON/documentation.json +++ b/test/libsolidity/ASTJSON/documentation.json @@ -1,3 +1,4 @@ +[ { "absolutePath": "a", "exportedSymbols": @@ -218,3 +219,4 @@ ], "src": "0:160:3" } +] diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp index fd65d98f8974..3cc8b3ab31a7 100644 --- a/test/libsolidity/ASTJSONTest.cpp +++ b/test/libsolidity/ASTJSONTest.cpp @@ -140,6 +140,9 @@ TestCase::TestResult ASTJSONTest::run(ostream& _stream, string const& _linePrefi return TestResult::FatalError; } + if (m_sources.size() > 1) + m_result += "[\n"; + for (size_t i = 0; i < m_sources.size(); i++) { ostringstream result; @@ -150,6 +153,9 @@ TestCase::TestResult ASTJSONTest::run(ostream& _stream, string const& _linePrefi m_result += "\n"; } + if (m_sources.size() > 1) + m_result += "]\n"; + bool resultsMatch = true; replaceTagWithVersion(m_expectation); From d235d0c1660a89e302d66b96f7e5dc8073dedae0 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 5 May 2020 19:53:17 +0200 Subject: [PATCH 066/479] [Sol->Yul] Implementing Byte array push() and pop() --- libsolidity/codegen/YulUtilFunctions.cpp | 168 +++++++++++++++--- libsolidity/codegen/YulUtilFunctions.h | 8 + .../codegen/ir/IRGeneratorForStatements.cpp | 2 + .../semanticTests/array/byte_array_pop.sol | 3 +- .../array/byte_array_pop_empty_exception.sol | 2 + .../semanticTests/array/byte_array_push.sol | 3 +- .../array/byte_array_push_transition.sol | 3 +- .../array/byte_array_storage_layout.sol | 45 +++++ .../array/byte_array_transitional_2.sol | 21 +++ 9 files changed, 227 insertions(+), 28 deletions(-) create mode 100644 test/libsolidity/semanticTests/array/byte_array_storage_layout.sol create mode 100644 test/libsolidity/semanticTests/array/byte_array_transitional_2.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 34b2e127930c..64639efb1ece 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -602,6 +602,25 @@ string YulUtilFunctions::overflowCheckedIntSubFunction(IntegerType const& _type) }); } +string YulUtilFunctions::extractByteArrayLengthFunction() +{ + string functionName = "extract_byte_array_length"; + return m_functionCollector.createFunction(functionName, [&]() { + Whiskers w(R"( + function (data) -> length { + // Retrieve length both for in-place strings and off-place strings: + // Computes (x & (0x100 * (ISZERO (x & 1)) - 1)) / 2 + // i.e. for short strings (x & 1 == 0) it does (x & 0xff) / 2 and for long strings it + // computes (x & (-1)) / 2, which is equivalent to just x / 2. + let mask := sub(mul(0x100, iszero(and(data, 1))), 1) + length := div(and(data, mask), 2) + } + )"); + w("functionName", functionName); + return w.render(); + }); +} + string YulUtilFunctions::arrayLengthFunction(ArrayType const& _type) { string functionName = "array_length_" + _type.identifier(); @@ -615,12 +634,7 @@ string YulUtilFunctions::arrayLengthFunction(ArrayType const& _type) length := sload(value) - // Retrieve length both for in-place strings and off-place strings: - // Computes (x & (0x100 * (ISZERO (x & 1)) - 1)) / 2 - // i.e. for short strings (x & 1 == 0) it does (x & 0xff) / 2 and for long strings it - // computes (x & (-1)) / 2, which is equivalent to just x / 2. - let mask := sub(mul(0x100, iszero(and(length, 1))), 1) - length := div(and(length, mask), 2) + length := (length) @@ -634,7 +648,12 @@ string YulUtilFunctions::arrayLengthFunction(ArrayType const& _type) w("length", toCompactHexWithPrefix(_type.length())); w("memory", _type.location() == DataLocation::Memory); w("storage", _type.location() == DataLocation::Storage); - w("byteArray", _type.isByteArray()); + if (_type.location() == DataLocation::Storage) + { + w("byteArray", _type.isByteArray()); + if (_type.isByteArray()) + w("extractByteArrayLength", extractByteArrayLengthFunction()); + } if (_type.isDynamicallySized()) solAssert( _type.location() != DataLocation::CallData, @@ -689,8 +708,9 @@ string YulUtilFunctions::storageArrayPopFunction(ArrayType const& _type) { solAssert(_type.location() == DataLocation::Storage, ""); solAssert(_type.isDynamicallySized(), ""); - solUnimplementedAssert(!_type.isByteArray(), "Byte Arrays not yet implemented!"); solUnimplementedAssert(_type.baseType()->storageBytes() <= 32, "Base type is not yet implemented."); + if (_type.isByteArray()) + return storageByteArrayPopFunction(_type); string functionName = "array_pop_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { @@ -699,10 +719,8 @@ string YulUtilFunctions::storageArrayPopFunction(ArrayType const& _type) let oldLen := (array) if iszero(oldLen) { invalid() } let newLen := sub(oldLen, 1) - let slot, offset := (array, newLen) (slot, offset) - sstore(array, newLen) })") ("functionName", functionName) @@ -713,29 +731,115 @@ string YulUtilFunctions::storageArrayPopFunction(ArrayType const& _type) }); } +string YulUtilFunctions::storageByteArrayPopFunction(ArrayType const& _type) +{ + solAssert(_type.location() == DataLocation::Storage, ""); + solAssert(_type.isDynamicallySized(), ""); + solAssert(_type.isByteArray(), ""); + + string functionName = "byte_array_pop_" + _type.identifier(); + return m_functionCollector.createFunction(functionName, [&]() { + return Whiskers(R"( + function (array) { + let data := sload(array) + let oldLen := (data) + if iszero(oldLen) { invalid() } + + switch eq(oldLen, 32) + case 1 { + // Here we have a special case where array transitions to shorter than 32 + // So we need to copy data + let copyFromSlot := (array) + data := sload(copyFromSlot) + sstore(copyFromSlot, 0) + // New length is 31, encoded to 31 * 2 = 62 + data := or(and(data, not(0xff)), 62) + } + default { + data := sub(data, 2) + let newLen := sub(oldLen, 1) + switch lt(oldLen, 32) + case 1 { + // set last element to zero + let mask := not((mul(8, sub(31, newLen)), 0xff)) + data := and(data, mask) + } + default { + let slot, offset := (array, newLen) + (slot, offset) + } + } + sstore(array, data) + })") + ("functionName", functionName) + ("extractByteArrayLength", extractByteArrayLengthFunction()) + ("dataAreaFunction", arrayDataAreaFunction(_type)) + ("indexAccess", storageArrayIndexAccessFunction(_type)) + ("setToZero", storageSetToZeroFunction(*_type.baseType())) + ("shl", shiftLeftFunctionDynamic()) + .render(); + }); +} + string YulUtilFunctions::storageArrayPushFunction(ArrayType const& _type) { solAssert(_type.location() == DataLocation::Storage, ""); solAssert(_type.isDynamicallySized(), ""); - solUnimplementedAssert(!_type.isByteArray(), "Byte Arrays not yet implemented!"); solUnimplementedAssert(_type.baseType()->storageBytes() <= 32, "Base type is not yet implemented."); string functionName = "array_push_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( function (array, value) { - let oldLen := (array) - if iszero(lt(oldLen, )) { invalid() } - sstore(array, add(oldLen, 1)) + + let data := sload(array) + let oldLen := (data) + if iszero(lt(oldLen, )) { invalid() } - let slot, offset := (array, oldLen) - (slot, offset, value) + switch gt(oldLen, 31) + case 0 { + value := byte(0, value) + switch oldLen + case 31 { + // Here we have special case when array switches from short array to long array + // We need to copy data + let dataArea := (array) + data := and(data, not(0xff)) + sstore(dataArea, or(and(0xff, value), data)) + // New length is 32, encoded as (32 * 2 + 1) + sstore(array, 65) + } + default { + data := add(data, 2) + let shiftBits := mul(8, sub(31, oldLen)) + let valueShifted := (shiftBits, and(0xff, value)) + let mask := (shiftBits, 0xff) + data := or(and(data, not(mask)), valueShifted) + sstore(array, data) + } + } + default { + sstore(array, add(data, 2)) + let slot, offset := (array, oldLen) + (slot, offset, value) + } + + let oldLen := sload(array) + if iszero(lt(oldLen, )) { invalid() } + sstore(array, add(oldLen, 1)) + let slot, offset := (array, oldLen) + (slot, offset, value) + })") ("functionName", functionName) - ("fetchLength", arrayLengthFunction(_type)) + ("extractByteArrayLength", _type.isByteArray() ? extractByteArrayLengthFunction() : "") + ("dataAreaFunction", arrayDataAreaFunction(_type)) + ("isByteArray", _type.isByteArray()) ("indexAccess", storageArrayIndexAccessFunction(_type)) ("storeValue", updateStorageValueFunction(*_type.baseType())) ("maxArrayLength", (u256(1) << 64).str()) + ("shl", shiftLeftFunctionDynamic()) + ("shr", shiftRightFunction(248)) .render(); }); } @@ -947,21 +1051,33 @@ string YulUtilFunctions::arrayDataAreaFunction(ArrayType const& _type) string YulUtilFunctions::storageArrayIndexAccessFunction(ArrayType const& _type) { - solUnimplementedAssert(_type.baseType()->storageBytes() > 16, ""); - string functionName = "storage_array_index_access_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( function (array, index) -> slot, offset { - if iszero(lt(index, (array))) { - invalid() - } + let arrayLength := (array) + if iszero(lt(index, arrayLength)) { invalid() } - let data := (array) - + + offset := sub(31, mod(index, 0x20)) + switch lt(arrayLength, 0x20) + case 0 { + let dataArea := (array) + slot := add(dataArea, div(index, 0x20)) + } + default { + slot := array + } + + let itemsPerSlot := div(0x20, ) + let dataArea := (array) + slot := add(dataArea, div(index, itemsPerSlot)) + offset := mod(index, itemsPerSlot) + - slot := add(data, mul(index, )) + let dataArea := (array) + slot := add(dataArea, mul(index, )) offset := 0 } @@ -970,7 +1086,9 @@ string YulUtilFunctions::storageArrayIndexAccessFunction(ArrayType const& _type) ("arrayLen", arrayLengthFunction(_type)) ("dataAreaFunc", arrayDataAreaFunction(_type)) ("multipleItemsPerSlot", _type.baseType()->storageBytes() <= 16) + ("isBytesArray", _type.isByteArray()) ("storageSize", _type.baseType()->storageSize().str()) + ("storageBytes", toString(_type.baseType()->storageBytes())) .render(); }); } diff --git a/libsolidity/codegen/YulUtilFunctions.h b/libsolidity/codegen/YulUtilFunctions.h index e72d6d29384d..c23a7d735e76 100644 --- a/libsolidity/codegen/YulUtilFunctions.h +++ b/libsolidity/codegen/YulUtilFunctions.h @@ -364,6 +364,14 @@ class YulUtilFunctions /// use exactly one variable to hold the value. std::string conversionFunctionSpecial(Type const& _from, Type const& _to); + /// @returns function name that extracts and returns byte array length + /// signature: (data) -> length + std::string extractByteArrayLengthFunction(); + + /// @returns the name of a function that reduces the size of a storage byte array by one element + /// signature: (byteArray) + std::string storageByteArrayPopFunction(ArrayType const& _type); + std::string readFromMemoryOrCalldata(Type const& _type, bool _fromCalldata); langutil::EVMVersion m_evmVersion; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index c9f5d403ede2..58cd606baf7e 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -963,10 +963,12 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) ")\n"; break; } + case FunctionType::Kind::ByteArrayPush: case FunctionType::Kind::ArrayPush: { auto const& memberAccessExpression = dynamic_cast(_functionCall.expression()).expression(); ArrayType const& arrayType = dynamic_cast(*memberAccessExpression.annotation().type); + if (arguments.empty()) { auto slotName = m_context.newYulVariable(); diff --git a/test/libsolidity/semanticTests/array/byte_array_pop.sol b/test/libsolidity/semanticTests/array/byte_array_pop.sol index 5ed849702290..3f0e05b349f1 100644 --- a/test/libsolidity/semanticTests/array/byte_array_pop.sol +++ b/test/libsolidity/semanticTests/array/byte_array_pop.sol @@ -12,6 +12,7 @@ contract c { l = data.length; } } - +// ==== +// compileViaYul: also // ---- // test() -> 2, 1, 1 diff --git a/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol b/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol index 08aea4254e5e..abe8c737b1a6 100644 --- a/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol +++ b/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol @@ -9,5 +9,7 @@ contract c { return true; } } +// ==== +// compileViaYul: also // ---- // test() -> FAILURE diff --git a/test/libsolidity/semanticTests/array/byte_array_push.sol b/test/libsolidity/semanticTests/array/byte_array_push.sol index 67ed87b691e1..1a9aa3cdaae7 100644 --- a/test/libsolidity/semanticTests/array/byte_array_push.sol +++ b/test/libsolidity/semanticTests/array/byte_array_push.sol @@ -13,6 +13,7 @@ contract c { if (l != 0x03) return true; } } - +// ==== +// compileViaYul: also // ---- // test() -> false diff --git a/test/libsolidity/semanticTests/array/byte_array_push_transition.sol b/test/libsolidity/semanticTests/array/byte_array_push_transition.sol index ceecf6726c27..f0733a7f5718 100644 --- a/test/libsolidity/semanticTests/array/byte_array_push_transition.sol +++ b/test/libsolidity/semanticTests/array/byte_array_push_transition.sol @@ -13,6 +13,7 @@ contract c { return 0; } } - +// ==== +// compileViaYul: also // ---- // test() -> 0 diff --git a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol new file mode 100644 index 000000000000..b04ad9e46a6e --- /dev/null +++ b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol @@ -0,0 +1,45 @@ +contract c { + bytes data; + function test_short() public returns (uint256 r) { + assembly { + sstore(data_slot, 0) + } + for (uint8 i = 0; i < 15; i++) { + data.push(bytes1(i)); + } + assembly { + r := sload(data_slot) + } + } + + function test_long() public returns (uint256 r) { + assembly { + sstore(data_slot, 0) + } + for (uint8 i = 0; i < 33; i++) { + data.push(bytes1(i)); + } + assembly { + r := sload(data_slot) + } + } + + function test_pop() public returns (uint256 r) { + assembly { + sstore(data_slot, 0) + } + for (uint8 i = 0; i < 32; i++) { + data.push(bytes1(i)); + } + data.pop(); + assembly { + r := sload(data_slot) + } + } +} +// ==== +// compileViaYul: also +// ---- +// test_short() -> 1780731860627700044960722568376587075150542249149356309979516913770823710 +// test_long() -> 67 +// test_pop() -> 1780731860627700044960722568376592200742329637303199754547598369979440702 diff --git a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol new file mode 100644 index 000000000000..46ed1f72865a --- /dev/null +++ b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol @@ -0,0 +1,21 @@ +// Tests transition between short and long encoding both ways +contract c { + bytes data; + + function test() public returns (uint256) { + for (uint8 i = 0; i < 33; i++) { + data.push(bytes1(i)); + } + for (uint8 i = 0; i < data.length; i++) + if (data[i] != bytes1(i)) return i; + data.pop(); + data.pop(); + for (uint8 i = 0; i < data.length; i++) + if (data[i] != bytes1(i)) return i; + return 0; + } +} +// ==== +// compileViaYul: also +// ---- +// test() -> 0 From 774edd4670f72ba8afb2a8a247cec68989193d56 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 19 May 2020 13:35:15 +0530 Subject: [PATCH 067/479] Error when Mapping type in (non-local) storage is assigned to --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 10 ++++++- .../types/mapping/assignment_local_err.sol | 10 +++++++ .../types/mapping/assignment_map.sol | 27 +++++++++++++++++++ .../mapping/assignment_type_mismatch.sol | 8 ++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/assignment_map.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol diff --git a/Changelog.md b/Changelog.md index cfd28189336e..887a21373f43 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Compiler Features: Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. + * Type Checker: Disallow assignments to storage variables of type ``mapping``. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ebb7bf6e6874..ce090101a817 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -453,7 +453,15 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (contractType->contractDefinition().isLibrary()) m_errorReporter.typeError(1273_error, _variable.location(), "The type of a variable cannot be a library."); if (_variable.value()) - expectType(*_variable.value(), *varType); + { + if (_variable.isStateVariable() && dynamic_cast(varType)) + { + m_errorReporter.typeError(6280_error, _variable.location(), "Mappings cannot be assigned to."); + _variable.value()->accept(*this); + } + else + expectType(*_variable.value(), *varType); + } if (_variable.isConstant()) { if (!_variable.type()->isValueType()) diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol new file mode 100644 index 000000000000..1d8f8c301947 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol @@ -0,0 +1,10 @@ +contract D { + mapping (uint => uint) a; + mapping (uint => uint) b; + function foo() public view { + mapping (uint => uint) storage c = b; + b = c; + } +} +// ---- +// TypeError: (160-161): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol new file mode 100644 index 000000000000..1ec86d4cfd44 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol @@ -0,0 +1,27 @@ +contract C { + mapping (uint => address payable [ ]) public a = a ; +} + +contract D { + mapping (uint => uint) a; + mapping (uint => uint) b = a; +} + +contract F { + mapping (uint => uint) a; + mapping (uint => uint) b; + + function foo() public { + a = b; + } +} + +contract G { + uint x = 1; + mapping (uint => uint) b = x; +} +// ---- +// TypeError: (17-67): Mappings cannot be assigned to. +// TypeError: (120-148): Mappings cannot be assigned to. +// TypeError: (263-264): Mappings cannot be assigned to. +// TypeError: (312-340): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol new file mode 100644 index 000000000000..aa85a8858233 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol @@ -0,0 +1,8 @@ +contract D { + mapping (uint => uint) a; + function foo() public view { + mapping (uint => int) storage c = a; + } +} +// ---- +// TypeError: (84-119): Type mapping(uint256 => uint256) is not implicitly convertible to expected type mapping(uint256 => int256). From bd64b971b9f6d74b94e477bec7926cf7055909b6 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 19 May 2020 15:12:56 +0200 Subject: [PATCH 068/479] Fixing tests on breaking branch. --- docs/types/value-types.rst | 7 +------ docs/units-and-global-variables.rst | 1 + libsolidity/analysis/TypeChecker.cpp | 10 +++++----- .../calling_nonexisting_contract_throws.sol | 2 ++ .../semanticTests/functionCall/gas_and_value_basic.sol | 2 ++ .../intheritance/value_for_constructor.sol | 2 ++ .../semanticTests/various/value_complex.sol | 2 ++ .../libsolidity/semanticTests/various/value_insane.sol | 2 ++ .../syntaxTests/missing_functions_duplicate_bug.sol | 4 +--- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index b4fc5d8630b3..bc70a3331c6c 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -656,13 +656,8 @@ External (or public) functions have the following members: Example that shows how to use the members:: -<<<<<<< HEAD - pragma solidity >=0.6.4 <0.8.0; -======= // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.7.0; - // This will report a warning ->>>>>>> origin/develop + pragma solidity >=0.6.4 <0.8.0; contract Example { function f() public payable returns (bytes4) { diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 0c61d3d70839..75e9b509185a 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -330,6 +330,7 @@ for an interface type ``I``: A ``bytes4`` value containing the `EIP-165 `_ interface identifier of the given interface ``I``. This identifier is defined as the ``XOR`` of all function selectors defined within the interface itself - excluding all inherited functions. + The following properties are available for an integer type ``T``: ``type(T).min`` diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 082d9bd47772..d78b744863cd 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -3027,11 +3027,11 @@ bool TypeChecker::visit(Identifier const& _identifier) if (magicVar->type()->category() == Type::Category::Integer) { solAssert(_identifier.name() == "now", ""); - m_errorReporter - .typeError( - _identifier.location(), - "\"now\" has been deprecated. Use \"block.timestamp\" instead." - ); + m_errorReporter.typeError( + 7359_error, + _identifier.location(), + "\"now\" has been deprecated. Use \"block.timestamp\" instead." + ); } return false; diff --git a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol index 5215c9ccb5f4..1717794448d8 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol @@ -22,6 +22,8 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> FAILURE // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol index d7c48d42b395..b9a56935f487 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol @@ -37,6 +37,8 @@ contract test { } } +// ==== +// compileViaYul: also // ---- // constructor(), 20 wei -> // sendAmount(uint256): 5 -> 5 diff --git a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol index 141dbae2f296..51cee33b0767 100644 --- a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol +++ b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol @@ -38,6 +38,8 @@ contract Main { } } +// ==== +// compileViaYul: also // ---- // constructor(), 22 wei -> // getFlag() -> true diff --git a/test/libsolidity/semanticTests/various/value_complex.sol b/test/libsolidity/semanticTests/various/value_complex.sol index b5be00ff5692..64460d397263 100644 --- a/test/libsolidity/semanticTests/various/value_complex.sol +++ b/test/libsolidity/semanticTests/various/value_complex.sol @@ -18,6 +18,8 @@ contract test { } } +// ==== +// compileViaYul: also // ---- // constructor(), 20 wei -> // sendAmount(uint256): 5 -> 8 diff --git a/test/libsolidity/semanticTests/various/value_insane.sol b/test/libsolidity/semanticTests/various/value_insane.sol index 2e6622325266..a588fad54496 100644 --- a/test/libsolidity/semanticTests/various/value_insane.sol +++ b/test/libsolidity/semanticTests/various/value_insane.sol @@ -17,6 +17,8 @@ contract test { } } +// ==== +// compileViaYul: also // ---- // constructor(), 20 wei -> // sendAmount(uint256): 5 -> 8 diff --git a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol index c233cd69c66f..afc2b82d4326 100644 --- a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol +++ b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol @@ -1,5 +1,3 @@ -pragma solidity ^0.6.0; - pragma experimental ABIEncoderV2; contract Ownable { @@ -25,4 +23,4 @@ contract Voting is Ownable { } } // ---- -// Warning: (324-340): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (299-315): Unused function parameter. Remove or comment out the variable name to silence this warning. From b0ae85b6b0e72f2af37acb8465ec657d299a62c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 18:00:50 +0200 Subject: [PATCH 069/479] IRGenerationContext::internalDispatch(): Don't use asCallableFunction() to get internal function type --- libsolidity/codegen/ir/IRGenerationContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index ee477792f068..8472bb82ad93 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -153,7 +153,7 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out) for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts) for (FunctionDefinition const* function: contract->definedFunctions()) if ( - FunctionType const* functionType = TypeProvider::function(*function)->asCallableFunction(false); + FunctionType const* functionType = TypeProvider::function(*function, FunctionType::Kind::Internal); !function->isConstructor() && TupleType(functionType->parameterTypes()).sizeOnStack() == _in && TupleType(functionType->returnParameterTypes()).sizeOnStack() == _out From 3e8b9bdb1c326f5cc7b9a2ce8d5fa4a0ad748709 Mon Sep 17 00:00:00 2001 From: William Entriken Date: Mon, 2 Dec 2019 10:40:04 -0500 Subject: [PATCH 070/479] Add NatSpec for public state variables --- docs/natspec-format.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index fa1d0c665cce..18305961e21f 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -28,6 +28,9 @@ Documentation Example Documentation is inserted above each ``class``, ``interface`` and ``function`` using the doxygen notation format. +Note: a ``public`` state variable is equivalent to a ``function`` +for the purposes of NatSpec. + - For Solidity you may choose ``///`` for single or multi-line comments, or ``/**`` and ending with ``*/``. From 7d37ed45316ebb3b201b376d98e89e96558a1684 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 5 Mar 2020 21:59:26 +0100 Subject: [PATCH 071/479] Adds structured docs for variable declarations. - adds natspec generation for state variables. - exports structured docs for state variables to JSON. --- libsolidity/analysis/DocStringAnalyser.cpp | 17 ++++++++ libsolidity/analysis/DocStringAnalyser.h | 7 ++++ libsolidity/ast/AST.h | 8 ++-- libsolidity/ast/ASTAnnotations.h | 2 +- libsolidity/ast/ASTJsonConverter.cpp | 3 ++ libsolidity/ast/ASTJsonImporter.cpp | 1 + libsolidity/interface/Natspec.cpp | 26 +++++++++++++ libsolidity/parsing/Parser.cpp | 8 +++- test/libsolidity/SolidityNatspecJSON.cpp | 39 +++++++++++++++++++ .../natspec/docstring_state_variable.sol | 9 +++++ .../natspec/docstring_variable.sol | 13 +++++++ 11 files changed, 128 insertions(+), 5 deletions(-) create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_variable.sol diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 53edc8cdf055..9385838a949e 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -57,6 +57,13 @@ bool DocStringAnalyser::visit(FunctionDefinition const& _function) return true; } +bool DocStringAnalyser::visit(VariableDeclaration const& _variable) +{ + if (_variable.isStateVariable() && _variable.isPartOfExternalInterface()) + handleDeclaration(_variable, _variable, _variable.annotation()); + return true; +} + bool DocStringAnalyser::visit(ModifierDefinition const& _modifier) { handleCallable(_modifier, _modifier, _modifier.annotation()); @@ -117,6 +124,16 @@ void DocStringAnalyser::handleCallable( checkParameters(_callable, _node, _annotation); } +void DocStringAnalyser::handleDeclaration( + Declaration const&, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation +) +{ + static set const validTags = set{"author", "dev", "notice", "return", "param"}; + parseDocStrings(_node, _annotation, validTags, "state variables"); +} + void DocStringAnalyser::parseDocStrings( StructurallyDocumented const& _node, StructurallyDocumentedAnnotation& _annotation, diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index b9f816854eb3..09fa07b40ee8 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -46,6 +46,7 @@ class DocStringAnalyser: private ASTConstVisitor private: bool visit(ContractDefinition const& _contract) override; bool visit(FunctionDefinition const& _function) override; + bool visit(VariableDeclaration const& _variable) override; bool visit(ModifierDefinition const& _modifier) override; bool visit(EventDefinition const& _event) override; @@ -67,6 +68,12 @@ class DocStringAnalyser: private ASTConstVisitor StructurallyDocumentedAnnotation& _annotation ); + void handleDeclaration( + Declaration const& _declaration, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation + ); + void parseDocStrings( StructurallyDocumented const& _node, StructurallyDocumentedAnnotation& _annotation, diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 055c0298b156..aacd88507d74 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -859,7 +859,7 @@ class FunctionDefinition: public CallableDeclaration, public StructurallyDocumen * Declaration of a variable. This can be used in various places, e.g. in function parameter * lists, struct definitions and even function bodies. */ -class VariableDeclaration: public Declaration +class VariableDeclaration: public Declaration, public StructurallyDocumented { public: enum Location { Unspecified, Storage, Memory, CallData }; @@ -882,6 +882,7 @@ class VariableDeclaration: public Declaration ASTPointer const& _name, ASTPointer _value, Visibility _visibility, + ASTPointer const& _documentation, bool _isStateVar = false, bool _isIndexed = false, Mutability _mutability = Mutability::Mutable, @@ -889,8 +890,9 @@ class VariableDeclaration: public Declaration Location _referenceLocation = Location::Unspecified ): Declaration(_id, _location, _name, _visibility), - m_typeName(std::move(_type)), - m_value(std::move(_value)), + StructurallyDocumented(_documentation), + m_typeName(_type), + m_value(_value), m_isStateVariable(_isStateVar), m_isIndexed(_isIndexed), m_mutability(_mutability), diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 0ed54897a9e0..eb8f7a263bdc 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -171,7 +171,7 @@ struct ModifierDefinitionAnnotation: CallableDeclarationAnnotation, Structurally { }; -struct VariableDeclarationAnnotation: DeclarationAnnotation +struct VariableDeclarationAnnotation: DeclarationAnnotation, StructurallyDocumentedAnnotation { /// Type of variable (type of identifier referencing this variable). TypePointer type = nullptr; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 603781b26644..bfdb92e11a2f 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -390,7 +390,10 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node) make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }; if (_node.isStateVariable() && _node.isPublic()) + { attributes.emplace_back("functionSelector", _node.externalIdentifierHex()); + attributes.emplace_back("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue); + } if (m_inEvent) attributes.emplace_back("indexed", _node.isIndexed()); if (!_node.annotation().baseFunctions.empty()) diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index c0bee4c60ceb..f96e247ccb60 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -441,6 +441,7 @@ ASTPointer ASTJsonImporter::createVariableDeclaration(Json: make_shared(member(_node, "name").asString()), nullOrCast(member(_node, "value")), visibility(_node), + _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), memberAsBool(_node, "stateVariable"), _node.isMember("indexed") ? memberAsBool(_node, "indexed") : false, mutability, diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 5e51696ec8ba..ef842c8ef0bd 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -52,6 +52,7 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) for (auto const& it: _contractDef.interfaceFunctions()) if (it.second->hasDeclaration()) + { if (auto const* f = dynamic_cast(&it.second->declaration())) { string value = extractDoc(f->annotation().docTags, "notice"); @@ -63,6 +64,18 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) methods[it.second->externalSignature()] = user; } } + if (auto var = dynamic_cast(&it.second->declaration())) + { + string value = extractDoc(var->annotation().docTags, "notice"); + if (!value.empty()) + { + Json::Value user; + // since @notice is the only user tag if missing function should not appear + user["notice"] = Json::Value(value); + methods[it.second->externalSignature()] = user; + } + } + } doc["methods"] = methods; return doc; @@ -108,6 +121,19 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef) if (!method.empty()) methods[it.second->externalSignature()] = method; } + if (auto var = dynamic_cast(&it.second->declaration())) + { + Json::Value method(devDocumentation(var->annotation().docTags)); + if (!method.empty()) + { +// Json::Value jsonReturn = extractReturnParameterDocs(var->annotation().docTags, *var); + +// if (!jsonReturn.empty()) +// method["returns"] = jsonReturn; + + methods[it.second->externalSignature()] = method; + } + } } doc["methods"] = methods; diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 7ae22dc70343..884a0765ae19 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -686,6 +686,7 @@ ASTPointer Parser::parseVariableDeclaration( ASTNodeFactory nodeFactory = _lookAheadArrayType ? ASTNodeFactory(*this, _lookAheadArrayType) : ASTNodeFactory(*this); ASTPointer type; + ASTPointer documentation = parseStructuredDocumentation(); if (_lookAheadArrayType) type = _lookAheadArrayType; else @@ -695,6 +696,9 @@ ASTPointer Parser::parseVariableDeclaration( nodeFactory.setEndPositionFromNode(type); } +// if (!_options.isStateVariable && documentation != nullptr) +// fatalParserError("Only state variables can retrieve a docstring."); + if (dynamic_cast(type.get()) && _options.isStateVariable && m_scanner->currentToken() == Token::LBrace) fatalParserError( 2915_error, @@ -809,6 +813,7 @@ ASTPointer Parser::parseVariableDeclaration( identifier, value, visibility, + documentation, _options.isStateVariable, isIndexed, mutability, @@ -1574,7 +1579,8 @@ ASTPointer Parser::parseVariableDeclarationStateme ASTPointer(), name, ASTPointer(), - Visibility::Default + Visibility::Default, + nullptr ); } variables.push_back(var); diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 69ae832ad631..c3f96d8746a3 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -204,6 +204,45 @@ BOOST_AUTO_TEST_CASE(dev_and_user_no_doc) checkNatspec(sourceCode, "test", userNatspec, true); } +BOOST_AUTO_TEST_CASE(dev_state_variable) +{ + char const* sourceCode = R"( + contract test { + /// @dev Public accessor for the internal state + /// @notice Keeps track of the internal state + uint public state; + } + )"; + + char const* natspec = "{" + "\"methods\":{" + " \"state()\":{ \n" + " \"details\": \"Public accessor for the internal state\",\n" + " }\n" + "}}"; + + checkNatspec(sourceCode, "test", natspec, false); +} + +BOOST_AUTO_TEST_CASE(user_state_variable) +{ + char const* sourceCode = R"( + contract test { + /// @notice Keeps track of the internal state + uint public state; + } + )"; + + char const* natspec = "{" + "\"methods\":{" + " \"state()\":{ \n" + " \"notice\": \"Keeps track of the internal state\",n" + " }\n" + "}}"; + + checkNatspec(sourceCode, "test", natspec, true); +} + BOOST_AUTO_TEST_CASE(dev_desc_after_nl) { char const* sourceCode = R"( diff --git a/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol new file mode 100644 index 000000000000..1ee27b62bebb --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol @@ -0,0 +1,9 @@ +contract C { + /// @title example of title + /// @author example of author + /// @notice example of notice + /// @dev example of dev + /// @param example of param + /// @return example of return + uint public state; +} \ No newline at end of file diff --git a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol new file mode 100644 index 000000000000..ccbd4c8a5822 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol @@ -0,0 +1,13 @@ +contract C { + function f() public pure returns (uint) { + /// @title example of title + /// @author example of author + /// @notice example of notice + /// @dev example of dev + /// @param example of param + /// @return example of return + uint state = 42; + return state; + } +} +// ---- From af8bb5fb60c1909469aa75ecd3ab59ecc7d027ec Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 24 Mar 2020 17:44:39 -0500 Subject: [PATCH 072/479] Allow natspec comments on state variables. --- Changelog.md | 2 +- docs/control-structures.rst | 6 +- docs/natspec-format.rst | 6 +- docs/security-considerations.rst | 6 +- docs/types/reference-types.rst | 2 +- libsolidity/analysis/DocStringAnalyser.cpp | 49 +++++--- libsolidity/ast/AST.h | 8 +- libsolidity/ast/ASTJsonConverter.cpp | 5 +- libsolidity/ast/ASTJsonImporter.cpp | 2 +- libsolidity/interface/Natspec.cpp | 27 ++--- libsolidity/parsing/Parser.cpp | 11 +- test/libsolidity/ASTJSON/documentation.json | 107 +++++++++++------ test/libsolidity/ASTJSON/documentation.sol | 1 + .../ASTJSON/documentation_legacy.json | 109 ++++++++++++------ test/libsolidity/SolidityNatspecJSON.cpp | 72 ++++++++---- .../docstring_author_title_state_variable.sol | 7 ++ ..._non_public_state_variable_with_return.sol | 6 + .../docstring_private_state_variable.sol | 7 ++ .../natspec/docstring_state_variable.sol | 6 +- ...ng_state_variable_too_many_return_tags.sol | 9 ++ .../natspec/docstring_variable.sol | 1 + 21 files changed, 304 insertions(+), 145 deletions(-) create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol diff --git a/Changelog.md b/Changelog.md index 54b60bcf6932..649b2e1479ec 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,7 +7,7 @@ Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. * SMTChecker: Support array ``length``. * SMTChecker: Support array ``push`` and ``pop``. - + * Add support for natspec comments on state variables. Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 9ecaa838bda6..811e612c0d79 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -255,9 +255,9 @@ which only need to be created if there is a dispute. contract C { function createDSalted(bytes32 salt, uint arg) public { - /// This complicated expression just tells you how the address - /// can be pre-computed. It is just there for illustration. - /// You actually only need ``new D{salt: salt}(arg)``. + // This complicated expression just tells you how the address + // can be pre-computed. It is just there for illustration. + // You actually only need ``new D{salt: salt}(arg)``. address predictedAddress = address(uint(keccak256(abi.encodePacked( byte(0xff), address(this), diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index 18305961e21f..a0596869a834 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -85,10 +85,10 @@ Tag =========== =============================================================================== ============================= ``@title`` A title that should describe the contract/interface contract, interface ``@author`` The name of the author contract, interface, function -``@notice`` Explain to an end user what this does contract, interface, function -``@dev`` Explain to a developer any extra details contract, interface, function +``@notice`` Explain to an end user what this does contract, interface, function, public state variable +``@dev`` Explain to a developer any extra details contract, interface, function, state variable ``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function -``@return`` Documents the return variables of a contract's function function +``@return`` Documents the return variables of a contract's function function, public state variable =========== =============================================================================== ============================= If your function returns multiple values, like ``(int quotient, int remainder)`` diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 772fa7c1d443..f73cb0dbfc9c 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -63,7 +63,7 @@ complete contract): // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Fund { - /// Mapping of ether shares of the contract. + /// @dev Mapping of ether shares of the contract. mapping(address => uint) shares; /// Withdraw your share. function withdraw() public { @@ -87,7 +87,7 @@ as it uses ``call`` which forwards all remaining gas by default: // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Fund { - /// Mapping of ether shares of the contract. + /// @dev Mapping of ether shares of the contract. mapping(address => uint) shares; /// Withdraw your share. function withdraw() public { @@ -106,7 +106,7 @@ outlined further below: pragma solidity >=0.4.11 <0.7.0; contract Fund { - /// Mapping of ether shares of the contract. + /// @dev Mapping of ether shares of the contract. mapping(address => uint) shares; /// Withdraw your share. function withdraw() public { diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 5a59997c43d4..2db37495931e 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -415,7 +415,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete pragma solidity >=0.6.0 <0.7.0; contract Proxy { - /// Address of the client contract managed by proxy i.e., this contract + /// @dev Address of the client contract managed by proxy i.e., this contract address client; constructor(address _client) public { diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 9385838a949e..51f60f790a63 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -59,9 +59,27 @@ bool DocStringAnalyser::visit(FunctionDefinition const& _function) bool DocStringAnalyser::visit(VariableDeclaration const& _variable) { - if (_variable.isStateVariable() && _variable.isPartOfExternalInterface()) - handleDeclaration(_variable, _variable, _variable.annotation()); - return true; + if (_variable.isStateVariable()) + { + static set const validPublicTags = set{"dev", "notice", "return", "title", "author"}; + if (_variable.isPublic()) + parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); + else + { + parseDocStrings(_variable, _variable.annotation(), validPublicTags, "non-public state variables"); + if (_variable.annotation().docTags.count("notice") > 0) + m_errorReporter.warning( + 9098_error, _variable.documentation()->location(), + "Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly." + ); + } + if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) + m_errorReporter.warning( + 4822_error, _variable.documentation()->location(), + "Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0." + ); + } + return false; } bool DocStringAnalyser::visit(ModifierDefinition const& _modifier) @@ -124,16 +142,6 @@ void DocStringAnalyser::handleCallable( checkParameters(_callable, _node, _annotation); } -void DocStringAnalyser::handleDeclaration( - Declaration const&, - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation -) -{ - static set const validTags = set{"author", "dev", "notice", "return", "param"}; - parseDocStrings(_node, _annotation, validTags, "state variables"); -} - void DocStringAnalyser::parseDocStrings( StructurallyDocumented const& _node, StructurallyDocumentedAnnotation& _annotation, @@ -161,7 +169,20 @@ void DocStringAnalyser::parseDocStrings( if (docTag.first == "return") { returnTagsVisited++; - if (auto* function = dynamic_cast(&_node)) + if (auto* varDecl = dynamic_cast(&_node)) + { + if (!varDecl->isPublic()) + appendError( + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + "\" is only allowed on public state-variables." + ); + if (returnTagsVisited > 1) + appendError( + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + "\" is only allowed once on state-variables." + ); + } + else if (auto* function = dynamic_cast(&_node)) { string content = docTag.second.content; string firstWord = content.substr(0, content.find_first_of(" \t")); diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index aacd88507d74..721e76791f88 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -882,7 +882,7 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented ASTPointer const& _name, ASTPointer _value, Visibility _visibility, - ASTPointer const& _documentation, + ASTPointer const _documentation = nullptr, bool _isStateVar = false, bool _isIndexed = false, Mutability _mutability = Mutability::Mutable, @@ -890,9 +890,9 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented Location _referenceLocation = Location::Unspecified ): Declaration(_id, _location, _name, _visibility), - StructurallyDocumented(_documentation), - m_typeName(_type), - m_value(_value), + StructurallyDocumented(std::move(_documentation)), + m_typeName(std::move(_type)), + m_value(std::move(_value)), m_isStateVariable(_isStateVar), m_isIndexed(_isIndexed), m_mutability(_mutability), diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index bfdb92e11a2f..8da1dddd719d 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -390,10 +390,9 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node) make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }; if (_node.isStateVariable() && _node.isPublic()) - { attributes.emplace_back("functionSelector", _node.externalIdentifierHex()); - attributes.emplace_back("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue); - } + if (_node.isStateVariable() && _node.documentation()) + attributes.emplace_back("documentation", toJson(*_node.documentation())); if (m_inEvent) attributes.emplace_back("indexed", _node.isIndexed()); if (!_node.annotation().baseFunctions.empty()) diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index f96e247ccb60..97e3ba964455 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -441,7 +441,7 @@ ASTPointer ASTJsonImporter::createVariableDeclaration(Json: make_shared(member(_node, "name").asString()), nullOrCast(member(_node, "value")), visibility(_node), - _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), + _node["documentation"].isNull() ? nullptr : createDocumentation(member(_node, "documentation")), memberAsBool(_node, "stateVariable"), _node.isMember("indexed") ? memberAsBool(_node, "indexed") : false, mutability, diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index ef842c8ef0bd..25dcd794e0e2 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -40,7 +40,7 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) auto constructorDefinition(_contractDef.constructor()); if (constructorDefinition) { - string value = extractDoc(constructorDefinition->annotation().docTags, "notice"); + string const value = extractDoc(constructorDefinition->annotation().docTags, "notice"); if (!value.empty()) // add the constructor, only if we have any documentation to add methods["constructor"] = Json::Value(value); @@ -64,8 +64,9 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) methods[it.second->externalSignature()] = user; } } - if (auto var = dynamic_cast(&it.second->declaration())) + else if (auto var = dynamic_cast(&it.second->declaration())) { + solAssert(var->isStateVariable() && var->isPublic(), ""); string value = extractDoc(var->annotation().docTags, "notice"); if (!value.empty()) { @@ -121,22 +122,22 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef) if (!method.empty()) methods[it.second->externalSignature()] = method; } - if (auto var = dynamic_cast(&it.second->declaration())) - { - Json::Value method(devDocumentation(var->annotation().docTags)); - if (!method.empty()) - { -// Json::Value jsonReturn = extractReturnParameterDocs(var->annotation().docTags, *var); + } -// if (!jsonReturn.empty()) -// method["returns"] = jsonReturn; + Json::Value stateVariables(Json::objectValue); + for (VariableDeclaration const* varDecl: _contractDef.stateVariables()) + { + if (auto devDoc = devDocumentation(varDecl->annotation().docTags); !devDoc.empty()) + stateVariables[varDecl->name()] = devDoc; - methods[it.second->externalSignature()] = method; - } - } + solAssert(varDecl->annotation().docTags.count("return") <= 1, ""); + if (varDecl->annotation().docTags.count("return") == 1) + stateVariables[varDecl->name()]["return"] = extractDoc(varDecl->annotation().docTags, "return"); } doc["methods"] = methods; + if (!stateVariables.empty()) + doc["stateVariables"] = stateVariables; return doc; } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 884a0765ae19..c429ba78634f 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -686,7 +686,7 @@ ASTPointer Parser::parseVariableDeclaration( ASTNodeFactory nodeFactory = _lookAheadArrayType ? ASTNodeFactory(*this, _lookAheadArrayType) : ASTNodeFactory(*this); ASTPointer type; - ASTPointer documentation = parseStructuredDocumentation(); + ASTPointer const documentation = parseStructuredDocumentation(); if (_lookAheadArrayType) type = _lookAheadArrayType; else @@ -696,8 +696,8 @@ ASTPointer Parser::parseVariableDeclaration( nodeFactory.setEndPositionFromNode(type); } -// if (!_options.isStateVariable && documentation != nullptr) -// fatalParserError("Only state variables can retrieve a docstring."); + if (!_options.isStateVariable && documentation != nullptr) + parserWarning(2837_error, "Only state variables can have a docstring. This will be disallowed in 0.7.0."); if (dynamic_cast(type.get()) && _options.isStateVariable && m_scanner->currentToken() == Token::LBrace) fatalParserError( @@ -813,7 +813,7 @@ ASTPointer Parser::parseVariableDeclaration( identifier, value, visibility, - documentation, + documentation, _options.isStateVariable, isIndexed, mutability, @@ -1579,8 +1579,7 @@ ASTPointer Parser::parseVariableDeclarationStateme ASTPointer(), name, ASTPointer(), - Visibility::Default, - nullptr + Visibility::Default ); } variables.push_back(var); diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json index b4305969e659..29e0b17b94b5 100644 --- a/test/libsolidity/ASTJSON/documentation.json +++ b/test/libsolidity/ASTJSON/documentation.json @@ -87,10 +87,10 @@ { "C": [ - 20 + 23 ] }, - "id": 21, + "id": 24, "license": null, "nodeType": "SourceUnit", "nodes": @@ -102,90 +102,129 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 20, + "id": 23, "linearizedBaseContracts": [ - 20 + 23 ], "name": "C", "nodeType": "ContractDefinition", "nodes": [ { - "anonymous": false, + "constant": false, "documentation": { "id": 7, "nodeType": "StructuredDocumentation", - "src": "15:26:3", - "text": "Some comment on Evt." + "src": "15:32:3", + "text": "Some comment on state var." }, + "functionSelector": "c19d93fb", "id": 9, + "mutability": "mutable", + "name": "state", + "nodeType": "VariableDeclaration", + "overrides": null, + "scope": 23, + "src": "48:17:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 8, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "48:4:3", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "anonymous": false, + "documentation": + { + "id": 10, + "nodeType": "StructuredDocumentation", + "src": "69:26:3", + "text": "Some comment on Evt." + }, + "id": 12, "name": "Evt", "nodeType": "EventDefinition", "parameters": { - "id": 8, + "id": 11, "nodeType": "ParameterList", "parameters": [], - "src": "51:2:3" + "src": "105:2:3" }, - "src": "42:12:3" + "src": "96:12:3" }, { "body": { - "id": 13, + "id": 16, "nodeType": "Block", - "src": "99:6:3", + "src": "153:6:3", "statements": [ { - "id": 12, + "id": 15, "nodeType": "PlaceholderStatement", - "src": "101:1:3" + "src": "155:1:3" } ] }, "documentation": { - "id": 10, + "id": 13, "nodeType": "StructuredDocumentation", - "src": "57:26:3", + "src": "111:26:3", "text": "Some comment on mod." }, - "id": 14, + "id": 17, "name": "mod", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { - "id": 11, + "id": 14, "nodeType": "ParameterList", "parameters": [], - "src": "96:2:3" + "src": "150:2:3" }, - "src": "84:21:3", + "src": "138:21:3", "virtual": false, "visibility": "internal" }, { "body": { - "id": 18, + "id": 21, "nodeType": "Block", - "src": "155:2:3", + "src": "209:2:3", "statements": [] }, "documentation": { - "id": 15, + "id": 18, "nodeType": "StructuredDocumentation", - "src": "108:25:3", + "src": "162:25:3", "text": "Some comment on fn." }, "functionSelector": "a4a2c40b", - "id": 19, + "id": 22, "implemented": true, "kind": "function", "modifiers": [], @@ -194,29 +233,29 @@ "overrides": null, "parameters": { - "id": 16, + "id": 19, "nodeType": "ParameterList", "parameters": [], - "src": "145:2:3" + "src": "199:2:3" }, "returnParameters": { - "id": 17, + "id": 20, "nodeType": "ParameterList", "parameters": [], - "src": "155:0:3" + "src": "209:0:3" }, - "scope": 20, - "src": "134:23:3", + "scope": 23, + "src": "188:23:3", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 21, - "src": "0:159:3" + "scope": 24, + "src": "0:213:3" } ], - "src": "0:160:3" + "src": "0:214:3" } ] diff --git a/test/libsolidity/ASTJSON/documentation.sol b/test/libsolidity/ASTJSON/documentation.sol index 5c5fe7d2b650..089f81e0b581 100644 --- a/test/libsolidity/ASTJSON/documentation.sol +++ b/test/libsolidity/ASTJSON/documentation.sol @@ -11,6 +11,7 @@ contract C {} // ---- SOURCE: c contract C { + /** Some comment on state var.*/ uint public state; /** Some comment on Evt.*/ event Evt(); /** Some comment on mod.*/ modifier mod() { _; } /** Some comment on fn.*/ function fn() public {} diff --git a/test/libsolidity/ASTJSON/documentation_legacy.json b/test/libsolidity/ASTJSON/documentation_legacy.json index 70a4d8cf42c1..bf085443c1ae 100644 --- a/test/libsolidity/ASTJSON/documentation_legacy.json +++ b/test/libsolidity/ASTJSON/documentation_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 20 + 23 ] }, "license": null @@ -30,13 +30,54 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 20 + 23 ], "name": "C", - "scope": 21 + "scope": 24 }, "children": [ + { + "attributes": + { + "constant": false, + "functionSelector": "c19d93fb", + "mutability": "mutable", + "name": "state", + "overrides": null, + "scope": 23, + "stateVariable": true, + "storageLocation": "default", + "type": "uint256", + "value": null, + "visibility": "public" + }, + "children": + [ + { + "attributes": + { + "name": "uint", + "type": "uint256" + }, + "id": 8, + "name": "ElementaryTypeName", + "src": "48:4:3" + }, + { + "attributes": + { + "text": "Some comment on state var." + }, + "id": 7, + "name": "StructuredDocumentation", + "src": "15:32:3" + } + ], + "id": 9, + "name": "VariableDeclaration", + "src": "48:17:3" + }, { "attributes": { @@ -50,9 +91,9 @@ { "text": "Some comment on Evt." }, - "id": 7, + "id": 10, "name": "StructuredDocumentation", - "src": "15:26:3" + "src": "69:26:3" }, { "attributes": @@ -63,14 +104,14 @@ ] }, "children": [], - "id": 8, + "id": 11, "name": "ParameterList", - "src": "51:2:3" + "src": "105:2:3" } ], - "id": 9, + "id": 12, "name": "EventDefinition", - "src": "42:12:3" + "src": "96:12:3" }, { "attributes": @@ -87,9 +128,9 @@ { "text": "Some comment on mod." }, - "id": 10, + "id": 13, "name": "StructuredDocumentation", - "src": "57:26:3" + "src": "111:26:3" }, { "attributes": @@ -100,27 +141,27 @@ ] }, "children": [], - "id": 11, + "id": 14, "name": "ParameterList", - "src": "96:2:3" + "src": "150:2:3" }, { "children": [ { - "id": 12, + "id": 15, "name": "PlaceholderStatement", - "src": "101:1:3" + "src": "155:1:3" } ], - "id": 13, + "id": 16, "name": "Block", - "src": "99:6:3" + "src": "153:6:3" } ], - "id": 14, + "id": 17, "name": "ModifierDefinition", - "src": "84:21:3" + "src": "138:21:3" }, { "attributes": @@ -135,7 +176,7 @@ ], "name": "fn", "overrides": null, - "scope": 20, + "scope": 23, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -147,9 +188,9 @@ { "text": "Some comment on fn." }, - "id": 15, + "id": 18, "name": "StructuredDocumentation", - "src": "108:25:3" + "src": "162:25:3" }, { "attributes": @@ -160,9 +201,9 @@ ] }, "children": [], - "id": 16, + "id": 19, "name": "ParameterList", - "src": "145:2:3" + "src": "199:2:3" }, { "attributes": @@ -173,9 +214,9 @@ ] }, "children": [], - "id": 17, + "id": 20, "name": "ParameterList", - "src": "155:0:3" + "src": "209:0:3" }, { "attributes": @@ -186,22 +227,22 @@ ] }, "children": [], - "id": 18, + "id": 21, "name": "Block", - "src": "155:2:3" + "src": "209:2:3" } ], - "id": 19, + "id": 22, "name": "FunctionDefinition", - "src": "134:23:3" + "src": "188:23:3" } ], - "id": 20, + "id": 23, "name": "ContractDefinition", - "src": "0:159:3" + "src": "0:213:3" } ], - "id": 21, + "id": 24, "name": "SourceUnit", - "src": "0:160:3" + "src": "0:214:3" } diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index c3f96d8746a3..7ae794a83739 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -204,43 +204,75 @@ BOOST_AUTO_TEST_CASE(dev_and_user_no_doc) checkNatspec(sourceCode, "test", userNatspec, true); } -BOOST_AUTO_TEST_CASE(dev_state_variable) +BOOST_AUTO_TEST_CASE(public_state_variable) { char const* sourceCode = R"( contract test { - /// @dev Public accessor for the internal state - /// @notice Keeps track of the internal state + /// @notice example of notice + /// @dev example of dev + /// @return returns state uint public state; } )"; - char const* natspec = "{" - "\"methods\":{" - " \"state()\":{ \n" - " \"details\": \"Public accessor for the internal state\",\n" - " }\n" - "}}"; + char const* devDoc = R"R( + { + "methods" : {}, + "stateVariables" : + { + "state" : + { + "details" : "example of dev", + "return" : "returns state" + } + } + } + )R"; + checkNatspec(sourceCode, "test", devDoc, false); - checkNatspec(sourceCode, "test", natspec, false); + char const* userDoc = R"R( + { + "methods" : + { + "state()" : + { + "notice": "example of notice" + } + } + } + )R"; + checkNatspec(sourceCode, "test", userDoc, true); } -BOOST_AUTO_TEST_CASE(user_state_variable) +BOOST_AUTO_TEST_CASE(private_state_variable) { char const* sourceCode = R"( contract test { - /// @notice Keeps track of the internal state - uint public state; + /// @dev example of dev + uint private state; } )"; - char const* natspec = "{" - "\"methods\":{" - " \"state()\":{ \n" - " \"notice\": \"Keeps track of the internal state\",n" - " }\n" - "}}"; + char const* devDoc = R"( + { + "methods" : {}, + "stateVariables" : + { + "state" : + { + "details" : "example of dev" + } + } + } + )"; + checkNatspec(sourceCode, "test", devDoc, false); - checkNatspec(sourceCode, "test", natspec, true); + char const* userDoc = R"( + { + "methods":{} + } + )"; + checkNatspec(sourceCode, "test", userDoc, true); } BOOST_AUTO_TEST_CASE(dev_desc_after_nl) diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol new file mode 100644 index 000000000000..78aaf920c5f9 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol @@ -0,0 +1,7 @@ +contract C { + /// @title title + /// @author author + uint private state; +} +// ---- +// Warning: (17-56): Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol new file mode 100644 index 000000000000..2b079ee7f811 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol @@ -0,0 +1,6 @@ +contract test { + /// @return returns something + uint private state; +} +// ---- +// DocstringParsingError: (18-47): Documentation tag "@return" is only allowed on public state-variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol new file mode 100644 index 000000000000..780501230966 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol @@ -0,0 +1,7 @@ +contract C { + /// @notice example of notice + /// @dev example of dev + uint private state; +} +// ---- +// Warning: (17-74): Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol index 1ee27b62bebb..fd63f73df398 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_state_variable.sol @@ -1,9 +1,5 @@ contract C { - /// @title example of title - /// @author example of author /// @notice example of notice /// @dev example of dev - /// @param example of param - /// @return example of return uint public state; -} \ No newline at end of file +} diff --git a/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol b/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol new file mode 100644 index 000000000000..e57d6f7e454a --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol @@ -0,0 +1,9 @@ +contract test { + /// @notice example of notice + /// @dev example of dev + /// @return returns something + /// @return returns something + uint public state; +} +// ---- +// DocstringParsingError: (18-137): Documentation tag "@return" is only allowed once on state-variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol index ccbd4c8a5822..726eba852618 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol @@ -11,3 +11,4 @@ contract C { } } // ---- +// Warning: (290-295): Only state variables can have a docstring. This will be disallowed in 0.7.0. From 16e80b7bcd07181daacf3111cf251141e83a3530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 18:02:14 +0200 Subject: [PATCH 073/479] Test case for internal dispatch with functions that have arguments that take up multiple slots --- ...n_with_multislot_arguments_via_pointer.sol | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/libsolidity/semanticTests/functionCall/call_internal_function_with_multislot_arguments_via_pointer.sol diff --git a/test/libsolidity/semanticTests/functionCall/call_internal_function_with_multislot_arguments_via_pointer.sol b/test/libsolidity/semanticTests/functionCall/call_internal_function_with_multislot_arguments_via_pointer.sol new file mode 100644 index 000000000000..344d1dc635fa --- /dev/null +++ b/test/libsolidity/semanticTests/functionCall/call_internal_function_with_multislot_arguments_via_pointer.sol @@ -0,0 +1,31 @@ +contract C { + function m( + function() external returns (uint) a, + function() external returns (uint) b + ) internal returns (function() external returns (uint)) { + return a; + } + + function s(uint a, uint b) internal returns (uint) { + return a + b; + } + + function foo() external returns (uint) { + return 6; + } + + function test() public returns (uint) { + function(uint, uint) internal returns (uint) single_slot_function = s; + + function( + function() external returns (uint), + function() external returns (uint) + ) internal returns (function() external returns (uint)) multi_slot_function = m; + + return multi_slot_function(this.foo, this.foo)() + single_slot_function(5, 1); + } +} +// ==== +// compileViaYul: also +// ---- +// test() -> 12 From 4e9f6c350836935cc606c56587bacbaa59799a74 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 19 May 2020 22:11:22 +0200 Subject: [PATCH 074/479] Fix webassembly loops by adding explicit break at the end. --- libyul/backends/wasm/WasmCodeTransform.cpp | 2 ++ test/cmdlineTests/evm_to_wasm_break/output | 25 +++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 9c553b380a8c..2971331075d0 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -252,6 +252,7 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) m_breakContinueLabelNames.push({breakLabel, continueLabel}); wasm::Loop loop; + loop.labelName = newLabel(); loop.statements = visit(_for.pre.statements); loop.statements.emplace_back(wasm::BreakIf{wasm::Label{breakLabel}, make_unique( wasm::BuiltinCall{"i64.eqz", make_vector( @@ -260,6 +261,7 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) )}); loop.statements.emplace_back(wasm::Block{continueLabel, visit(_for.body.statements)}); loop.statements += visit(_for.post.statements); + loop.statements.emplace_back(wasm::Break{wasm::Label{loop.labelName}}); return { wasm::Block{breakLabel, make_vector(move(loop))} }; } diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 3ed2a2dd0e76..fc033a9d93e0 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -154,7 +154,7 @@ object "object" { Binary representation: -0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020a80090dee02011f7e4200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080b0b20002000200020002005200620072008100e0b2c01037e200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21042004240020030b6f010b7e200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b2011210820092400200a2401200b240220080b2301047e200020018420022003848450ada7ad210720052400200624012007240220040b4601047e2000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b20092400200a2401200b240220080b2a01027e02402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b20020b930101087e4200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b20092400200a2401200b240220080b8c0101087e4200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b210720052400200624012007240220040b1c01017e20004208864280fe0383200042088842ff018384210120010b1b01027e2000100a421086210220022000421088100a84210120010b1b01027e2000100b422086210220022000422088100b84210120010b3e01007e2000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b2401007e42002000200120022003100d42202004200520062007100d4200a74220a710000b +0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020a82090df002011f7e4200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b2c01037e200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21042004240020030b6f010b7e200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b2011210820092400200a2401200b240220080b2301047e200020018420022003848450ada7ad210720052400200624012007240220040b4601047e2000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b20092400200a2401200b240220080b2a01027e02402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b20020b930101087e4200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b20092400200a2401200b240220080b8c0101087e4200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b210720052400200624012007240220040b1c01017e20004208864280fe0383200042088842ff018384210120010b1b01027e2000100a421086210220022000421088100a84210120010b1b01027e2000100b422086210220022000422088100b84210120010b3e01007e2000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b2401007e42002000200120022003100d42202004200520062007100d4200a74220a710000b Text representation: (module @@ -213,7 +213,7 @@ Text representation: (local.set $_2 (i64.const 1)) (local.set $_3 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))))))) (block $label_ - (loop + (loop $label__4 (br_if $label_ (i64.eqz (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (local.get $_3)))))) (block $label__3 (block @@ -266,6 +266,7 @@ Text representation: (local.set $x_5 (local.get $x_9)) (local.set $x_6 (local.get $x_10)) (local.set $x_7 (local.get $x_11)) + (br $label__4) ) ) @@ -413,22 +414,22 @@ Text representation: (local $z3 i64) (local $z4 i64) (local $z i64) - (local $condition_4 i64) (local $condition_5 i64) (local $condition_6 i64) + (local $condition_7 i64) (local.set $z (i64.const 0)) (block - (local.set $condition_4 (call $cmp (local.get $x1) (local.get $y1))) - (if (i64.eq (local.get $condition_4) (i64.const 0)) (then + (local.set $condition_5 (call $cmp (local.get $x1) (local.get $y1))) + (if (i64.eq (local.get $condition_5) (i64.const 0)) (then (block - (local.set $condition_5 (call $cmp (local.get $x2) (local.get $y2))) - (if (i64.eq (local.get $condition_5) (i64.const 0)) (then + (local.set $condition_6 (call $cmp (local.get $x2) (local.get $y2))) + (if (i64.eq (local.get $condition_6) (i64.const 0)) (then (block - (local.set $condition_6 (call $cmp (local.get $x3) (local.get $y3))) - (if (i64.eq (local.get $condition_6) (i64.const 0)) (then + (local.set $condition_7 (call $cmp (local.get $x3) (local.get $y3))) + (if (i64.eq (local.get $condition_7) (i64.const 0)) (then (local.set $z (i64.extend_i32_u (i64.lt_u (local.get $x4) (local.get $y4)))) )(else - (if (i64.eq (local.get $condition_6) (i64.const 1)) (then + (if (i64.eq (local.get $condition_7) (i64.const 1)) (then (local.set $z (i64.const 0)) )(else (local.set $z (i64.const 1)) @@ -437,7 +438,7 @@ Text representation: ) )(else - (if (i64.eq (local.get $condition_5) (i64.const 1)) (then + (if (i64.eq (local.get $condition_6) (i64.const 1)) (then (local.set $z (i64.const 0)) )(else (local.set $z (i64.const 1)) @@ -446,7 +447,7 @@ Text representation: ) )(else - (if (i64.eq (local.get $condition_4) (i64.const 1)) (then + (if (i64.eq (local.get $condition_5) (i64.const 1)) (then (local.set $z (i64.const 0)) )(else (local.set $z (i64.const 1)) From 16e58449ab08e0eee22c5d061c3770142b55eb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 28 Apr 2020 13:14:45 +0200 Subject: [PATCH 075/479] ir/Common: Add YulArity struct --- libsolidity/codegen/ir/Common.cpp | 8 ++++++++ libsolidity/codegen/ir/Common.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index 8b895596ad55..dba6aee0743a 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -16,6 +16,7 @@ */ #include +#include #include @@ -23,6 +24,13 @@ using namespace std; using namespace solidity::util; using namespace solidity::frontend; +YulArity YulArity::fromType(FunctionType const& _functionType) +{ + return YulArity{ + TupleType(_functionType.parameterTypes()).sizeOnStack(), + TupleType(_functionType.returnParameterTypes()).sizeOnStack() + }; +} string IRNames::function(FunctionDefinition const& _function) { // @TODO previously, we had to distinguish creation context and runtime context, diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 771dd0ab4d02..96e2a86eaaa1 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -22,11 +22,28 @@ #include +#include #include namespace solidity::frontend { +/** + * Structure that describes arity and co-arity of a Yul function, i.e. the number of its inputs and outputs. + */ +struct YulArity +{ + explicit YulArity(size_t _in, size_t _out): in(_in), out(_out) {} + + static YulArity fromType(FunctionType const& _functionType); + + bool operator==(YulArity const& _other) const { return in == _other.in && out == _other.out; } + bool operator!=(YulArity const& _other) const { return !(*this == _other); } + + size_t in; /// Number of input parameters + size_t out; /// Number of output parameters +}; + struct IRNames { static std::string function(FunctionDefinition const& _function); @@ -45,3 +62,15 @@ struct IRNames }; } + +// Overloading std::less() makes it possible to use YulArity as a map key. We could define operator< +// instead but such an operator would be a bit ambiguous (e.g. YulArity{2, 2} would be be greater than +// YulArity{1, 10} in lexicographical order but the latter has greater total number of inputs and outputs). +template<> +struct std::less +{ + bool operator() (solidity::frontend::YulArity const& _lhs, solidity::frontend::YulArity const& _rhs) const + { + return _lhs.in < _rhs.in || (_lhs.in == _rhs.in && _lhs.out < _rhs.out); + } +}; From 1a521cc7ac612a2cf2b17753848cc1cdddfdfa45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 28 Apr 2020 13:15:26 +0200 Subject: [PATCH 076/479] Use YulArity in IR generator --- libsolidity/codegen/ir/IRGenerationContext.cpp | 18 ++++++++---------- libsolidity/codegen/ir/IRGenerationContext.h | 2 +- .../codegen/ir/IRGeneratorForStatements.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 8472bb82ad93..d5a926a0d5a4 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -121,9 +121,9 @@ string IRGenerationContext::newYulVariable() return "_" + to_string(++m_varCounter); } -string IRGenerationContext::internalDispatch(size_t _in, size_t _out) +string IRGenerationContext::internalDispatch(YulArity const& _arity) { - string funName = "dispatch_internal_in_" + to_string(_in) + "_out_" + to_string(_out); + string funName = "dispatch_internal_in_" + to_string(_arity.in) + "_out_" + to_string(_arity.out); return m_functions.createFunction(funName, [&]() { Whiskers templ(R"( function (fun ) { @@ -138,12 +138,12 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out) } )"); templ("functionName", funName); - templ("comma", _in > 0 ? "," : ""); + templ("comma", _arity.in > 0 ? "," : ""); YulUtilFunctions utils(m_evmVersion, m_revertStrings, m_functions); - templ("in", suffixedVariableNameList("in_", 0, _in)); - templ("arrow", _out > 0 ? "->" : ""); - templ("assignment_op", _out > 0 ? ":=" : ""); - templ("out", suffixedVariableNameList("out_", 0, _out)); + templ("in", suffixedVariableNameList("in_", 0, _arity.in)); + templ("arrow", _arity.out > 0 ? "->" : ""); + templ("assignment_op", _arity.out > 0 ? ":=" : ""); + templ("out", suffixedVariableNameList("out_", 0, _arity.out)); // UNIMPLEMENTED: Internal library calls via pointers are not implemented yet. // We're not generating code for internal library functions here even though it's possible @@ -153,10 +153,8 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out) for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts) for (FunctionDefinition const* function: contract->definedFunctions()) if ( - FunctionType const* functionType = TypeProvider::function(*function, FunctionType::Kind::Internal); !function->isConstructor() && - TupleType(functionType->parameterTypes()).sizeOnStack() == _in && - TupleType(functionType->returnParameterTypes()).sizeOnStack() == _out + YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity ) { // 0 is reserved for uninitialized function pointers diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index ef6df190b03e..2ae63ab2dcdb 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -102,7 +102,7 @@ class IRGenerationContext std::string newYulVariable(); - std::string internalDispatch(size_t _in, size_t _out); + std::string internalDispatch(YulArity const& _arity); /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 58cd606baf7e..788498c0678e 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -692,16 +692,16 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) joinHumanReadable(args) << ")\n"; else + { + YulArity arity = YulArity::fromType(*functionType); define(_functionCall) << // NOTE: internalDispatch() takes care of adding the function to function generation queue - m_context.internalDispatch( - TupleType(functionType->parameterTypes()).sizeOnStack(), - TupleType(functionType->returnParameterTypes()).sizeOnStack() - ) << + m_context.internalDispatch(arity) << "(" << IRVariable(_functionCall.expression()).part("functionIdentifier").name() << joinHumanReadablePrefixed(args) << ")\n"; + } break; } case FunctionType::Kind::External: From 410986e00f4e8cd948b873d28c9de3ce5d624dc9 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Mon, 18 May 2020 23:50:19 -0500 Subject: [PATCH 077/479] [isoltest] Improve parameter formatting. --- .../semanticTests/isoltestFormatting.sol | 13 ++++++++ test/libsolidity/util/BytesUtils.cpp | 30 ++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/semanticTests/isoltestFormatting.sol diff --git a/test/libsolidity/semanticTests/isoltestFormatting.sol b/test/libsolidity/semanticTests/isoltestFormatting.sol new file mode 100644 index 000000000000..9380dc01588e --- /dev/null +++ b/test/libsolidity/semanticTests/isoltestFormatting.sol @@ -0,0 +1,13 @@ +contract C { + function f() public returns (uint[5] memory) { + uint[5] memory a = [4, 11, 0x111, uint(3355443), 2222222222222222222]; + return a; + } + function g() public returns (uint[5] memory) { + uint[5] memory a = [16, 256, 257, uint(0x333333), 0x1ed6eb565788e38e]; + return a; + } +} +// ---- +// f() -> 4, 11, 0x0111, 0x333333, 2222222222222222222 +// g() -> 0x10, 0x0100, 0x0101, 0x333333, 2222222222222222222 diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index 6377fbe2e724..fd5cb7f49f37 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -252,7 +252,35 @@ string BytesUtils::formatBytes( if (*_bytes.begin() & 0x80) os << formatSigned(_bytes); else - os << formatUnsigned(_bytes); + { + std::string decimal(formatUnsigned(_bytes)); + std::string hexadecimal(formatHex(_bytes)); + unsigned int value = u256(_bytes).convert_to(); + if (value < 0x10) + os << decimal; + else if (value >= 0x10 && value <= 0xff) { + os << hexadecimal; + } + else + { + auto entropy = [](std::string const& str) -> double { + double result = 0; + map frequencies; + for (char c: str) + frequencies[c]++; + for (auto p: frequencies) + { + double freq = static_cast(p.second) / str.length(); + result -= freq * (log(freq) / log(2)); + } + return result; + }; + if (entropy(decimal) < entropy(hexadecimal.substr(2, hexadecimal.length()))) + os << decimal; + else + os << hexadecimal; + } + } break; case ABIType::SignedDec: os << formatSigned(_bytes); From 6dbf23d52afefb3188707bde0ad6f8629691a2ca Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 12 May 2020 23:23:01 +0200 Subject: [PATCH 078/479] Remove a dedicated error flag from ReferencesResolver --- libsolidity/analysis/ReferencesResolver.cpp | 6 ++---- libsolidity/analysis/ReferencesResolver.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 3415dee229c9..ac3553f6b605 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -44,8 +44,9 @@ namespace solidity::frontend bool ReferencesResolver::resolve(ASTNode const& _root) { + auto errorWatcher = m_errorReporter.errorWatcher(); _root.accept(*this); - return !m_errorOccurred; + return errorWatcher.ok(); } bool ReferencesResolver::visit(Block const& _block) @@ -267,19 +268,16 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) void ReferencesResolver::declarationError(SourceLocation const& _location, string const& _description) { - m_errorOccurred = true; m_errorReporter.declarationError(8532_error, _location, _description); } void ReferencesResolver::declarationError(SourceLocation const& _location, SecondarySourceLocation const& _ssl, string const& _description) { - m_errorOccurred = true; m_errorReporter.declarationError(3881_error, _location, _ssl, _description); } void ReferencesResolver::fatalDeclarationError(SourceLocation const& _location, string const& _description) { - m_errorOccurred = true; m_errorReporter.fatalDeclarationError(6546_error, _location, _description); } diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 2a4daf3db15f..7b8c1fff5fa6 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -103,7 +103,6 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker /// Stack of return parameters. std::vector m_returnParameters; bool const m_resolveInsideCode; - bool m_errorOccurred = false; InlineAssemblyAnnotation* m_yulAnnotation = nullptr; bool m_yulInsideFunction = false; From 6bb177ce7736b857977dab0a5b4d96e9da654538 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 12 May 2020 21:49:04 +0200 Subject: [PATCH 079/479] Remove dedicated error flags from DocStringParser and DocStringAnalyser --- libsolidity/analysis/DocStringAnalyser.cpp | 9 +++------ libsolidity/analysis/DocStringAnalyser.h | 1 - libsolidity/parsing/DocStringParser.cpp | 5 +---- libsolidity/parsing/DocStringParser.h | 4 +--- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 51f60f790a63..a04c9314efe1 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -34,10 +34,9 @@ using namespace solidity::frontend; bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit) { - m_errorOccured = false; + auto errorWatcher = m_errorReporter.errorWatcher(); _sourceUnit.accept(*this); - - return !m_errorOccured; + return errorWatcher.ok(); } bool DocStringAnalyser::visit(ContractDefinition const& _contract) @@ -152,8 +151,7 @@ void DocStringAnalyser::parseDocStrings( DocStringParser parser; if (_node.documentation() && !_node.documentation()->text()->empty()) { - if (!parser.parse(*_node.documentation()->text(), m_errorReporter)) - m_errorOccured = true; + parser.parse(*_node.documentation()->text(), m_errorReporter); _annotation.docTags = parser.tags(); } @@ -210,6 +208,5 @@ void DocStringAnalyser::parseDocStrings( void DocStringAnalyser::appendError(SourceLocation const& _location, string const& _description) { - m_errorOccured = true; m_errorReporter.docstringParsingError(7816_error, _location, _description); } diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index 09fa07b40ee8..cddfc2f1dd82 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -83,7 +83,6 @@ class DocStringAnalyser: private ASTConstVisitor void appendError(langutil::SourceLocation const& _location, std::string const& _description); - bool m_errorOccured = false; langutil::ErrorReporter& m_errorReporter; }; diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index b8238554f8a7..3ce67a43009f 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -77,10 +77,9 @@ string::const_iterator skipWhitespace( } -bool DocStringParser::parse(string const& _docString, ErrorReporter& _errorReporter) +void DocStringParser::parse(string const& _docString, ErrorReporter& _errorReporter) { m_errorReporter = &_errorReporter; - m_errorsOccurred = false; m_lastTag = nullptr; auto currPos = _docString.begin(); @@ -119,7 +118,6 @@ bool DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor currPos = nlPos + 1; } } - return !m_errorsOccurred; } DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, bool _appending) @@ -194,6 +192,5 @@ void DocStringParser::newTag(string const& _tagName) void DocStringParser::appendError(string const& _description) { - m_errorsOccurred = true; m_errorReporter->docstringParsingError(9440_error, _description); } diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index dc9c5194c568..b4c9186a7e19 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -37,8 +37,7 @@ class DocStringParser { public: /// Parse the given @a _docString and stores the parsed components internally. - /// @returns false on error and appends the error to @a _errors. - bool parse(std::string const& _docString, langutil::ErrorReporter& _errorReporter); + void parse(std::string const& _docString, langutil::ErrorReporter& _errorReporter); std::multimap const& tags() const { return m_docTags; } @@ -65,7 +64,6 @@ class DocStringParser std::multimap m_docTags; DocTag* m_lastTag = nullptr; langutil::ErrorReporter* m_errorReporter = nullptr; - bool m_errorsOccurred = false; }; } From 7d2292fbafa7f8c9ae2640612c976c9a45dac02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 14 May 2020 15:57:46 +0200 Subject: [PATCH 080/479] Rename IRGenerationContext::internalDispatch() to generateInternalDispatchFunction() --- libsolidity/codegen/ir/IRGenerationContext.cpp | 2 +- libsolidity/codegen/ir/IRGenerationContext.h | 2 +- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index d5a926a0d5a4..6612fc1ac9df 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -121,7 +121,7 @@ string IRGenerationContext::newYulVariable() return "_" + to_string(++m_varCounter); } -string IRGenerationContext::internalDispatch(YulArity const& _arity) +string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _arity) { string funName = "dispatch_internal_in_" + to_string(_arity.in) + "_out_" + to_string(_arity.out); return m_functions.createFunction(funName, [&]() { diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 2ae63ab2dcdb..42cdddcb0bc9 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -102,7 +102,7 @@ class IRGenerationContext std::string newYulVariable(); - std::string internalDispatch(YulArity const& _arity); + std::string generateInternalDispatchFunction(YulArity const& _arity); /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 788498c0678e..b91ed9f2bfd7 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -695,8 +695,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) { YulArity arity = YulArity::fromType(*functionType); define(_functionCall) << - // NOTE: internalDispatch() takes care of adding the function to function generation queue - m_context.internalDispatch(arity) << + // NOTE: generateInternalDispatchFunction() takes care of adding the function to function generation queue + m_context.generateInternalDispatchFunction(arity) << "(" << IRVariable(_functionCall.expression()).part("functionIdentifier").name() << joinHumanReadablePrefixed(args) << From 22c0568d348aedff78a741202c15965dfa3b617d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 14 May 2020 11:39:19 +0200 Subject: [PATCH 081/479] IRGenerationContext::internalDispatch(): Remove unused local YulUtilFunctions instance --- libsolidity/codegen/ir/IRGenerationContext.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 6612fc1ac9df..a6a8c2b05f87 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -139,7 +139,6 @@ string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _ar )"); templ("functionName", funName); templ("comma", _arity.in > 0 ? "," : ""); - YulUtilFunctions utils(m_evmVersion, m_revertStrings, m_functions); templ("in", suffixedVariableNameList("in_", 0, _arity.in)); templ("arrow", _arity.out > 0 ? "->" : ""); templ("assignment_op", _arity.out > 0 ? ":=" : ""); From bd75543900073b5e75a936ec585572b324e3487d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 28 Apr 2020 13:20:39 +0200 Subject: [PATCH 082/479] Add IRNames::internalDispatch() and use it in IRGenerationContext --- libsolidity/codegen/ir/Common.cpp | 7 +++++++ libsolidity/codegen/ir/Common.h | 1 + libsolidity/codegen/ir/IRGenerationContext.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index dba6aee0743a..1f1cc1cfe20e 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -53,6 +53,13 @@ string IRNames::runtimeObject(ContractDefinition const& _contract) return _contract.name() + "_" + toString(_contract.id()) + "_deployed"; } +string IRNames::internalDispatch(YulArity const& _arity) +{ + return "dispatch_internal" + "_in_" + to_string(_arity.in) + + "_out_" + to_string(_arity.out); +} + string IRNames::implicitConstructor(ContractDefinition const& _contract) { return "constructor_" + _contract.name() + "_" + to_string(_contract.id()); diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 96e2a86eaaa1..f1235553bfd5 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -50,6 +50,7 @@ struct IRNames static std::string function(VariableDeclaration const& _varDecl); static std::string creationObject(ContractDefinition const& _contract); static std::string runtimeObject(ContractDefinition const& _contract); + static std::string internalDispatch(YulArity const& _arity); static std::string implicitConstructor(ContractDefinition const& _contract); static std::string constantValueFunction(VariableDeclaration const& _constant); static std::string localVariable(VariableDeclaration const& _declaration); diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index a6a8c2b05f87..313aff40d969 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -123,7 +123,7 @@ string IRGenerationContext::newYulVariable() string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _arity) { - string funName = "dispatch_internal_in_" + to_string(_arity.in) + "_out_" + to_string(_arity.out); + string funName = IRNames::internalDispatch(_arity); return m_functions.createFunction(funName, [&]() { Whiskers templ(R"( function (fun ) { From 087605ea021d1180791f3b34d162aa9d954f250b Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 18 May 2020 17:42:24 +0200 Subject: [PATCH 083/479] Create libsmtutil --- CMakeLists.txt | 18 ++++++++ .../CHCSmtLib2Interface.cpp | 2 +- .../CHCSmtLib2Interface.h | 4 +- .../CHCSolverInterface.h | 2 +- libsmtutil/CMakeLists.txt | 34 ++++++++++++++ .../formal => libsmtutil}/CVC4Interface.cpp | 2 +- .../formal => libsmtutil}/CVC4Interface.h | 2 +- .../SMTLib2Interface.cpp | 2 +- .../formal => libsmtutil}/SMTLib2Interface.h | 2 +- .../formal => libsmtutil}/SMTPortfolio.cpp | 8 ++-- .../formal => libsmtutil}/SMTPortfolio.h | 2 +- .../formal => libsmtutil}/SolverInterface.h | 2 +- {libsolidity/formal => libsmtutil}/Sorts.cpp | 2 +- {libsolidity/formal => libsmtutil}/Sorts.h | 0 .../formal => libsmtutil}/Z3CHCInterface.cpp | 2 +- .../formal => libsmtutil}/Z3CHCInterface.h | 4 +- .../formal => libsmtutil}/Z3Interface.cpp | 2 +- .../formal => libsmtutil}/Z3Interface.h | 2 +- libsolidity/CMakeLists.txt | 44 +------------------ libsolidity/formal/BMC.cpp | 3 +- libsolidity/formal/BMC.h | 3 +- libsolidity/formal/CHC.cpp | 5 +-- libsolidity/formal/CHC.h | 4 +- libsolidity/formal/EncodingContext.h | 3 +- libsolidity/formal/ModelChecker.h | 3 +- libsolidity/formal/SMTEncoder.cpp | 3 +- libsolidity/formal/SymbolicState.h | 5 ++- libsolidity/formal/SymbolicVariables.h | 3 +- libsolidity/interface/CompilerStack.h | 3 +- test/CMakeLists.txt | 2 +- test/libsolidity/SMTCheckerTest.h | 2 +- 31 files changed, 97 insertions(+), 78 deletions(-) rename {libsolidity/formal => libsmtutil}/CHCSmtLib2Interface.cpp (98%) rename {libsolidity/formal => libsmtutil}/CHCSmtLib2Interface.h (95%) rename {libsolidity/formal => libsmtutil}/CHCSolverInterface.h (96%) create mode 100644 libsmtutil/CMakeLists.txt rename {libsolidity/formal => libsmtutil}/CVC4Interface.cpp (99%) rename {libsolidity/formal => libsmtutil}/CVC4Interface.h (97%) rename {libsolidity/formal => libsmtutil}/SMTLib2Interface.cpp (99%) rename {libsolidity/formal => libsmtutil}/SMTLib2Interface.h (98%) rename {libsolidity/formal => libsmtutil}/SMTPortfolio.cpp (96%) rename {libsolidity/formal => libsmtutil}/SMTPortfolio.h (97%) rename {libsolidity/formal => libsmtutil}/SolverInterface.h (99%) rename {libsolidity/formal => libsmtutil}/Sorts.cpp (95%) rename {libsolidity/formal => libsmtutil}/Sorts.h (100%) rename {libsolidity/formal => libsmtutil}/Z3CHCInterface.cpp (98%) rename {libsolidity/formal => libsmtutil}/Z3CHCInterface.h (93%) rename {libsolidity/formal => libsmtutil}/Z3Interface.cpp (99%) rename {libsolidity/formal => libsmtutil}/Z3Interface.h (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5689009e03c..7aa6647b2233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,26 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/license.h.in" include/licens include(EthOptions) configure_project(TESTS) +find_package(Z3 4.6.0) +if (${Z3_FOUND}) + add_definitions(-DHAVE_Z3) + message("Z3 SMT solver found. This enables optional SMT checking with Z3.") +endif() + +find_package(CVC4 QUIET) +if (${CVC4_FOUND}) + add_definitions(-DHAVE_CVC4) + message("CVC4 SMT solver found. This enables optional SMT checking with CVC4.") +endif() + +if (NOT (${Z3_FOUND} OR ${CVC4_FOUND})) + message("No SMT solver found (or it has been forcefully disabled). Optional SMT checking will not be available.\ + \nPlease install Z3 or CVC4 or remove the option disabling them (USE_Z3, USE_CVC4).") +endif() + add_subdirectory(libsolutil) add_subdirectory(liblangutil) +add_subdirectory(libsmtutil) add_subdirectory(libevmasm) add_subdirectory(libyul) add_subdirectory(libsolidity) diff --git a/libsolidity/formal/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp similarity index 98% rename from libsolidity/formal/CHCSmtLib2Interface.cpp rename to libsmtutil/CHCSmtLib2Interface.cpp index 4b52b7d5adca..d5895fc694b9 100644 --- a/libsolidity/formal/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see . */ -#include +#include #include diff --git a/libsolidity/formal/CHCSmtLib2Interface.h b/libsmtutil/CHCSmtLib2Interface.h similarity index 95% rename from libsolidity/formal/CHCSmtLib2Interface.h rename to libsmtutil/CHCSmtLib2Interface.h index d184cd9a49a6..9fd1489a4278 100644 --- a/libsolidity/formal/CHCSmtLib2Interface.h +++ b/libsmtutil/CHCSmtLib2Interface.h @@ -21,9 +21,9 @@ #pragma once -#include +#include -#include +#include namespace solidity::frontend::smt { diff --git a/libsolidity/formal/CHCSolverInterface.h b/libsmtutil/CHCSolverInterface.h similarity index 96% rename from libsolidity/formal/CHCSolverInterface.h rename to libsmtutil/CHCSolverInterface.h index 91198e1a838a..588e42ce1ecf 100644 --- a/libsolidity/formal/CHCSolverInterface.h +++ b/libsmtutil/CHCSolverInterface.h @@ -21,7 +21,7 @@ #pragma once -#include +#include namespace solidity::frontend::smt { diff --git a/libsmtutil/CMakeLists.txt b/libsmtutil/CMakeLists.txt new file mode 100644 index 000000000000..d5df3633f547 --- /dev/null +++ b/libsmtutil/CMakeLists.txt @@ -0,0 +1,34 @@ +set(sources + CHCSmtLib2Interface.cpp + CHCSmtLib2Interface.h + SMTLib2Interface.cpp + SMTLib2Interface.h + SMTPortfolio.cpp + SMTPortfolio.h + SolverInterface.h + Sorts.cpp + Sorts.h +) + +if (${Z3_FOUND}) + set(z3_SRCS Z3Interface.cpp Z3Interface.h Z3CHCInterface.cpp Z3CHCInterface.h) +else() + set(z3_SRCS) +endif() + +if (${CVC4_FOUND}) + set(cvc4_SRCS CVC4Interface.cpp CVC4Interface.h) +else() + set(cvc4_SRCS) +endif() + +add_library(smtutil ${sources} ${z3_SRCS} ${cvc4_SRCS}) +target_link_libraries(smtutil PUBLIC langutil solutil Boost::boost) + +if (${Z3_FOUND}) + target_link_libraries(smtutil PUBLIC z3::libz3) +endif() + +if (${CVC4_FOUND}) + target_link_libraries(smtutil PUBLIC CVC4::CVC4) +endif() diff --git a/libsolidity/formal/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp similarity index 99% rename from libsolidity/formal/CVC4Interface.cpp rename to libsmtutil/CVC4Interface.cpp index 86688e0b1476..71ab81f515e0 100644 --- a/libsolidity/formal/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see . */ -#include +#include #include #include diff --git a/libsolidity/formal/CVC4Interface.h b/libsmtutil/CVC4Interface.h similarity index 97% rename from libsolidity/formal/CVC4Interface.h rename to libsmtutil/CVC4Interface.h index b5c2a3fd6efb..2399dc453ce5 100644 --- a/libsolidity/formal/CVC4Interface.h +++ b/libsmtutil/CVC4Interface.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #if defined(__GLIBC__) diff --git a/libsolidity/formal/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp similarity index 99% rename from libsolidity/formal/SMTLib2Interface.cpp rename to libsmtutil/SMTLib2Interface.cpp index 97ccc2c913ea..081d87f61a8b 100644 --- a/libsolidity/formal/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see . */ -#include +#include #include diff --git a/libsolidity/formal/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h similarity index 98% rename from libsolidity/formal/SMTLib2Interface.h rename to libsmtutil/SMTLib2Interface.h index 5310f7e9576d..1acbcde2ce73 100644 --- a/libsolidity/formal/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include diff --git a/libsolidity/formal/SMTPortfolio.cpp b/libsmtutil/SMTPortfolio.cpp similarity index 96% rename from libsolidity/formal/SMTPortfolio.cpp rename to libsmtutil/SMTPortfolio.cpp index 2ce698bdfc63..67cb3803cb00 100644 --- a/libsolidity/formal/SMTPortfolio.cpp +++ b/libsmtutil/SMTPortfolio.cpp @@ -15,15 +15,15 @@ along with solidity. If not, see . */ -#include +#include #ifdef HAVE_Z3 -#include +#include #endif #ifdef HAVE_CVC4 -#include +#include #endif -#include +#include using namespace std; using namespace solidity; diff --git a/libsolidity/formal/SMTPortfolio.h b/libsmtutil/SMTPortfolio.h similarity index 97% rename from libsolidity/formal/SMTPortfolio.h rename to libsmtutil/SMTPortfolio.h index 7799f2268424..1ffce37ee013 100644 --- a/libsolidity/formal/SMTPortfolio.h +++ b/libsmtutil/SMTPortfolio.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include diff --git a/libsolidity/formal/SolverInterface.h b/libsmtutil/SolverInterface.h similarity index 99% rename from libsolidity/formal/SolverInterface.h rename to libsmtutil/SolverInterface.h index 4532c1b3ed3e..078eaef73da7 100644 --- a/libsolidity/formal/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include diff --git a/libsolidity/formal/Sorts.cpp b/libsmtutil/Sorts.cpp similarity index 95% rename from libsolidity/formal/Sorts.cpp rename to libsmtutil/Sorts.cpp index 195048e56ee8..dba0dc4b77e0 100644 --- a/libsolidity/formal/Sorts.cpp +++ b/libsmtutil/Sorts.cpp @@ -16,7 +16,7 @@ */ -#include +#include using namespace std; diff --git a/libsolidity/formal/Sorts.h b/libsmtutil/Sorts.h similarity index 100% rename from libsolidity/formal/Sorts.h rename to libsmtutil/Sorts.h diff --git a/libsolidity/formal/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp similarity index 98% rename from libsolidity/formal/Z3CHCInterface.cpp rename to libsmtutil/Z3CHCInterface.cpp index c64da2edcc81..3be40d3964a0 100644 --- a/libsolidity/formal/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see . */ -#include +#include #include #include diff --git a/libsolidity/formal/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h similarity index 93% rename from libsolidity/formal/Z3CHCInterface.h rename to libsmtutil/Z3CHCInterface.h index a7b7d6aeb540..bc0e6cf925ce 100644 --- a/libsolidity/formal/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include namespace solidity::frontend::smt { diff --git a/libsolidity/formal/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp similarity index 99% rename from libsolidity/formal/Z3Interface.cpp rename to libsmtutil/Z3Interface.cpp index d49314b6c88b..4303c76ac070 100644 --- a/libsolidity/formal/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see . */ -#include +#include #include #include diff --git a/libsolidity/formal/Z3Interface.h b/libsmtutil/Z3Interface.h similarity index 97% rename from libsolidity/formal/Z3Interface.h rename to libsmtutil/Z3Interface.h index 3791af4c55ab..282b87a096f2 100644 --- a/libsolidity/formal/Z3Interface.h +++ b/libsmtutil/Z3Interface.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 7b66e533e9f1..8e930b6ab9b5 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -94,22 +94,12 @@ set(sources formal/BMC.h formal/CHC.cpp formal/CHC.h - formal/CHCSmtLib2Interface.cpp - formal/CHCSmtLib2Interface.h - formal/CHCSolverInterface.h formal/EncodingContext.cpp formal/EncodingContext.h formal/ModelChecker.cpp formal/ModelChecker.h formal/SMTEncoder.cpp formal/SMTEncoder.h - formal/SMTLib2Interface.cpp - formal/SMTLib2Interface.h - formal/SMTPortfolio.cpp - formal/SMTPortfolio.h - formal/SolverInterface.h - formal/Sorts.cpp - formal/Sorts.h formal/SSAVariable.cpp formal/SSAVariable.h formal/SymbolicState.cpp @@ -144,36 +134,6 @@ set(sources parsing/Token.h ) -find_package(Z3 4.6.0) -if (${Z3_FOUND}) - add_definitions(-DHAVE_Z3) - message("Z3 SMT solver found. This enables optional SMT checking with Z3.") - set(z3_SRCS formal/Z3Interface.cpp formal/Z3Interface.h formal/Z3CHCInterface.cpp formal/Z3CHCInterface.h) -else() - set(z3_SRCS) -endif() +add_library(solidity ${sources}) +target_link_libraries(solidity PUBLIC yul evmasm langutil smtutil solutil Boost::boost) -find_package(CVC4 QUIET) -if (${CVC4_FOUND}) - add_definitions(-DHAVE_CVC4) - message("CVC4 SMT solver found. This enables optional SMT checking with CVC4.") - set(cvc4_SRCS formal/CVC4Interface.cpp formal/CVC4Interface.h) -else() - set(cvc4_SRCS) -endif() - -if (NOT (${Z3_FOUND} OR ${CVC4_FOUND})) - message("No SMT solver found (or it has been forcefully disabled). Optional SMT checking will not be available.\ - \nPlease install Z3 or CVC4 or remove the option disabling them (USE_Z3, USE_CVC4).") -endif() - -add_library(solidity ${sources} ${z3_SRCS} ${cvc4_SRCS}) -target_link_libraries(solidity PUBLIC yul evmasm langutil solutil Boost::boost) - -if (${Z3_FOUND}) - target_link_libraries(solidity PUBLIC z3::libz3) -endif() - -if (${CVC4_FOUND}) - target_link_libraries(solidity PUBLIC CVC4::CVC4) -endif() diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index 952eb1c50253..7c2bc481876e 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -17,10 +17,11 @@ #include -#include #include #include +#include + using namespace std; using namespace solidity; using namespace solidity::util; diff --git a/libsolidity/formal/BMC.h b/libsolidity/formal/BMC.h index 8b30f073d273..16ef665c0a23 100644 --- a/libsolidity/formal/BMC.h +++ b/libsolidity/formal/BMC.h @@ -30,9 +30,10 @@ #include #include -#include #include + +#include #include #include diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index f309599721c2..9cc01e26eb5d 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -17,16 +17,15 @@ #include -#include - #ifdef HAVE_Z3 -#include +#include #endif #include #include +#include #include using namespace std; diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 87f902732fe8..9315da70fdec 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -32,10 +32,10 @@ #include -#include - #include +#include + #include namespace solidity::frontend diff --git a/libsolidity/formal/EncodingContext.h b/libsolidity/formal/EncodingContext.h index d62de055dff4..e8cf48ed013c 100644 --- a/libsolidity/formal/EncodingContext.h +++ b/libsolidity/formal/EncodingContext.h @@ -17,10 +17,11 @@ #pragma once -#include #include #include +#include + #include #include diff --git a/libsolidity/formal/ModelChecker.h b/libsolidity/formal/ModelChecker.h index 546f2df86e97..663bae86916a 100644 --- a/libsolidity/formal/ModelChecker.h +++ b/libsolidity/formal/ModelChecker.h @@ -25,9 +25,10 @@ #include #include #include -#include #include + +#include #include namespace solidity::langutil diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 44bec4d85acf..7a62199b258c 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -18,10 +18,11 @@ #include #include -#include #include #include +#include + #include #include diff --git a/libsolidity/formal/SymbolicState.h b/libsolidity/formal/SymbolicState.h index 380bfda5159d..087ea9985c08 100644 --- a/libsolidity/formal/SymbolicState.h +++ b/libsolidity/formal/SymbolicState.h @@ -17,10 +17,11 @@ #pragma once -#include -#include #include +#include +#include + namespace solidity::frontend::smt { diff --git a/libsolidity/formal/SymbolicVariables.h b/libsolidity/formal/SymbolicVariables.h index 3f5379d9b09e..46d3520cf791 100644 --- a/libsolidity/formal/SymbolicVariables.h +++ b/libsolidity/formal/SymbolicVariables.h @@ -17,10 +17,11 @@ #pragma once -#include #include #include #include + +#include #include namespace solidity::frontend::smt diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 96dbc4f043ed..fbd32b382ce0 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -27,7 +27,8 @@ #include #include #include -#include + +#include #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1834d3b30d74..6c6d12c1e198 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -188,7 +188,7 @@ add_executable(soltest ${sources} ${libsolidity_util_sources} ${yul_phaser_sources} ) -target_link_libraries(soltest PRIVATE libsolc yul solidity yulInterpreter evmasm solutil Boost::boost Boost::filesystem Boost::program_options Boost::unit_test_framework evmc) +target_link_libraries(soltest PRIVATE libsolc yul solidity yulInterpreter evmasm smtutil solutil Boost::boost Boost::filesystem Boost::program_options Boost::unit_test_framework evmc) # Special compilation flag for Visual Studio (version 2019 at least affected) diff --git a/test/libsolidity/SMTCheckerTest.h b/test/libsolidity/SMTCheckerTest.h index ad38af25cff0..674564f5734c 100644 --- a/test/libsolidity/SMTCheckerTest.h +++ b/test/libsolidity/SMTCheckerTest.h @@ -19,7 +19,7 @@ #include -#include +#include #include From 802d66244d3ce4f2be9ee7cbcadbd611f4da1c38 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 19 May 2020 12:23:01 +0200 Subject: [PATCH 084/479] Do not link unnecessarily --- libsmtutil/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libsmtutil/CMakeLists.txt b/libsmtutil/CMakeLists.txt index d5df3633f547..e46b80df6d35 100644 --- a/libsmtutil/CMakeLists.txt +++ b/libsmtutil/CMakeLists.txt @@ -23,7 +23,7 @@ else() endif() add_library(smtutil ${sources} ${z3_SRCS} ${cvc4_SRCS}) -target_link_libraries(smtutil PUBLIC langutil solutil Boost::boost) +target_link_libraries(smtutil PUBLIC solutil Boost::boost) if (${Z3_FOUND}) target_link_libraries(smtutil PUBLIC z3::libz3) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6c6d12c1e198..06a082e66e60 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -188,7 +188,7 @@ add_executable(soltest ${sources} ${libsolidity_util_sources} ${yul_phaser_sources} ) -target_link_libraries(soltest PRIVATE libsolc yul solidity yulInterpreter evmasm smtutil solutil Boost::boost Boost::filesystem Boost::program_options Boost::unit_test_framework evmc) +target_link_libraries(soltest PRIVATE libsolc yul solidity smtutil solutil Boost::boost yulInterpreter evmasm Boost::filesystem Boost::program_options Boost::unit_test_framework evmc) # Special compilation flag for Visual Studio (version 2019 at least affected) From 45eba274242b386a37e4809636d678fca73bac52 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 19 May 2020 14:14:46 +0200 Subject: [PATCH 085/479] Rename namespace --- libsmtutil/CHCSmtLib2Interface.cpp | 12 +- libsmtutil/CHCSmtLib2Interface.h | 6 +- libsmtutil/CHCSolverInterface.h | 2 +- libsmtutil/CVC4Interface.cpp | 2 +- libsmtutil/CVC4Interface.h | 6 +- libsmtutil/SMTLib2Interface.cpp | 12 +- libsmtutil/SMTLib2Interface.h | 14 +- libsmtutil/SMTPortfolio.cpp | 16 +-- libsmtutil/SMTPortfolio.h | 12 +- libsmtutil/SolverInterface.h | 5 +- libsmtutil/Sorts.cpp | 2 +- libsmtutil/Sorts.h | 2 +- libsmtutil/Z3CHCInterface.cpp | 2 +- libsmtutil/Z3CHCInterface.h | 2 +- libsmtutil/Z3Interface.cpp | 4 +- libsmtutil/Z3Interface.h | 6 +- libsolidity/formal/BMC.cpp | 90 ++++++------ libsolidity/formal/BMC.h | 40 +++--- libsolidity/formal/CHC.cpp | 175 ++++++++++++----------- libsolidity/formal/CHC.h | 76 +++++----- libsolidity/formal/EncodingContext.cpp | 8 +- libsolidity/formal/EncodingContext.h | 16 +-- libsolidity/formal/ModelChecker.cpp | 6 +- libsolidity/formal/ModelChecker.h | 4 +- libsolidity/formal/SMTEncoder.cpp | 112 +++++++-------- libsolidity/formal/SMTEncoder.h | 48 +++---- libsolidity/formal/SymbolicState.cpp | 17 +-- libsolidity/formal/SymbolicState.h | 12 +- libsolidity/formal/SymbolicTypes.cpp | 29 ++-- libsolidity/formal/SymbolicTypes.h | 22 +-- libsolidity/formal/SymbolicVariables.cpp | 43 +++--- libsolidity/formal/SymbolicVariables.h | 62 ++++---- libsolidity/interface/CompilerStack.cpp | 6 +- libsolidity/interface/CompilerStack.h | 4 +- test/libsolidity/SMTCheckerTest.cpp | 8 +- test/libsolidity/SMTCheckerTest.h | 2 +- 36 files changed, 444 insertions(+), 441 deletions(-) diff --git a/libsmtutil/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp index d5895fc694b9..960e75eadca0 100644 --- a/libsmtutil/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -32,7 +32,7 @@ using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; CHCSmtLib2Interface::CHCSmtLib2Interface( map const& _queryResponses, @@ -51,10 +51,10 @@ void CHCSmtLib2Interface::reset() m_variables.clear(); } -void CHCSmtLib2Interface::registerRelation(smt::Expression const& _expr) +void CHCSmtLib2Interface::registerRelation(Expression const& _expr) { solAssert(_expr.sort, ""); - solAssert(_expr.sort->kind == smt::Kind::Function, ""); + solAssert(_expr.sort->kind == Kind::Function, ""); if (!m_variables.count(_expr.name)) { auto fSort = dynamic_pointer_cast(_expr.sort); @@ -71,7 +71,7 @@ void CHCSmtLib2Interface::registerRelation(smt::Expression const& _expr) } } -void CHCSmtLib2Interface::addRule(smt::Expression const& _expr, std::string const& _name) +void CHCSmtLib2Interface::addRule(Expression const& _expr, std::string const& _name) { write( "(rule (! " + @@ -82,7 +82,7 @@ void CHCSmtLib2Interface::addRule(smt::Expression const& _expr, std::string cons ); } -pair> CHCSmtLib2Interface::query(smt::Expression const& _block) +pair> CHCSmtLib2Interface::query(Expression const& _block) { string accumulated{}; swap(m_accumulatedOutput, accumulated); @@ -125,7 +125,7 @@ void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const void CHCSmtLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) { solAssert(_sort, ""); - solAssert(_sort->kind == smt::Kind::Function, ""); + solAssert(_sort->kind == Kind::Function, ""); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { diff --git a/libsmtutil/CHCSmtLib2Interface.h b/libsmtutil/CHCSmtLib2Interface.h index 9fd1489a4278..8ec3f8dd263f 100644 --- a/libsmtutil/CHCSmtLib2Interface.h +++ b/libsmtutil/CHCSmtLib2Interface.h @@ -25,7 +25,7 @@ #include -namespace solidity::frontend::smt +namespace solidity::smtutil { class CHCSmtLib2Interface: public CHCSolverInterface @@ -33,7 +33,7 @@ class CHCSmtLib2Interface: public CHCSolverInterface public: explicit CHCSmtLib2Interface( std::map const& _queryResponses, - ReadCallback::Callback const& _smtCallback + frontend::ReadCallback::Callback const& _smtCallback ); void reset(); @@ -67,7 +67,7 @@ class CHCSmtLib2Interface: public CHCSolverInterface std::map const& m_queryResponses; std::vector m_unhandledQueries; - ReadCallback::Callback m_smtCallback; + frontend::ReadCallback::Callback m_smtCallback; }; } diff --git a/libsmtutil/CHCSolverInterface.h b/libsmtutil/CHCSolverInterface.h index 588e42ce1ecf..f2d14cbcfa41 100644 --- a/libsmtutil/CHCSolverInterface.h +++ b/libsmtutil/CHCSolverInterface.h @@ -23,7 +23,7 @@ #include -namespace solidity::frontend::smt +namespace solidity::smtutil { class CHCSolverInterface diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 71ab81f515e0..3a678429add6 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -23,7 +23,7 @@ using namespace std; using namespace solidity; using namespace solidity::util; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; CVC4Interface::CVC4Interface(): m_solver(&m_context) diff --git a/libsmtutil/CVC4Interface.h b/libsmtutil/CVC4Interface.h index 2399dc453ce5..99059035182e 100644 --- a/libsmtutil/CVC4Interface.h +++ b/libsmtutil/CVC4Interface.h @@ -33,7 +33,7 @@ #undef _GLIBCXX_PERMIT_BACKWARD_HASH #endif -namespace solidity::frontend::smt +namespace solidity::smtutil { class CVC4Interface: public SolverInterface, public boost::noncopyable @@ -53,8 +53,8 @@ class CVC4Interface: public SolverInterface, public boost::noncopyable private: CVC4::Expr toCVC4Expr(Expression const& _expr); - CVC4::Type cvc4Sort(smt::Sort const& _sort); - std::vector cvc4Sort(std::vector const& _sorts); + CVC4::Type cvc4Sort(Sort const& _sort); + std::vector cvc4Sort(std::vector const& _sorts); CVC4::ExprManager m_context; CVC4::SmtEngine m_solver; diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index 081d87f61a8b..a9083a29156e 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -34,7 +34,7 @@ using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; SMTLib2Interface::SMTLib2Interface( map const& _queryResponses, @@ -82,7 +82,7 @@ void SMTLib2Interface::declareVariable(string const& _name, SortPointer const& _ void SMTLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) { solAssert(_sort, ""); - solAssert(_sort->kind == smt::Kind::Function, ""); + solAssert(_sort->kind == Kind::Function, ""); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { @@ -102,12 +102,12 @@ void SMTLib2Interface::declareFunction(string const& _name, SortPointer const& _ } } -void SMTLib2Interface::addAssertion(smt::Expression const& _expr) +void SMTLib2Interface::addAssertion(Expression const& _expr) { write("(assert " + toSExpr(_expr) + ")"); } -pair> SMTLib2Interface::check(vector const& _expressionsToEvaluate) +pair> SMTLib2Interface::check(vector const& _expressionsToEvaluate) { string response = querySolver( boost::algorithm::join(m_accumulatedOutput, "\n") + @@ -131,7 +131,7 @@ pair> SMTLib2Interface::check(vector const& _expressionsToEvaluate) +string SMTLib2Interface::checkSatAndGetValuesCommand(vector const& _expressionsToEvaluate) { string command; if (_expressionsToEvaluate.empty()) diff --git a/libsmtutil/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h index 1acbcde2ce73..6d97adac22b3 100644 --- a/libsmtutil/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -31,7 +31,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { class SMTLib2Interface: public SolverInterface, public boost::noncopyable @@ -39,7 +39,7 @@ class SMTLib2Interface: public SolverInterface, public boost::noncopyable public: explicit SMTLib2Interface( std::map const& _queryResponses, - ReadCallback::Callback _smtCallback + frontend::ReadCallback::Callback _smtCallback ); void reset() override; @@ -49,13 +49,13 @@ class SMTLib2Interface: public SolverInterface, public boost::noncopyable void declareVariable(std::string const&, SortPointer const&) override; - void addAssertion(smt::Expression const& _expr) override; - std::pair> check(std::vector const& _expressionsToEvaluate) override; + void addAssertion(Expression const& _expr) override; + std::pair> check(std::vector const& _expressionsToEvaluate) override; std::vector unhandledQueries() override { return m_unhandledQueries; } // Used by CHCSmtLib2Interface - std::string toSExpr(smt::Expression const& _expr); + std::string toSExpr(Expression const& _expr); std::string toSmtLibSort(Sort const& _sort); std::string toSmtLibSort(std::vector const& _sort); @@ -66,7 +66,7 @@ class SMTLib2Interface: public SolverInterface, public boost::noncopyable void write(std::string _data); - std::string checkSatAndGetValuesCommand(std::vector const& _expressionsToEvaluate); + std::string checkSatAndGetValuesCommand(std::vector const& _expressionsToEvaluate); std::vector parseValues(std::string::const_iterator _start, std::string::const_iterator _end); /// Communicates with the solver via the callback. Throws SMTSolverError on error. @@ -79,7 +79,7 @@ class SMTLib2Interface: public SolverInterface, public boost::noncopyable std::map const& m_queryResponses; std::vector m_unhandledQueries; - ReadCallback::Callback m_smtCallback; + frontend::ReadCallback::Callback m_smtCallback; }; } diff --git a/libsmtutil/SMTPortfolio.cpp b/libsmtutil/SMTPortfolio.cpp index 67cb3803cb00..dc7e69fa103c 100644 --- a/libsmtutil/SMTPortfolio.cpp +++ b/libsmtutil/SMTPortfolio.cpp @@ -29,22 +29,22 @@ using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; SMTPortfolio::SMTPortfolio( map const& _smtlib2Responses, - ReadCallback::Callback const& _smtCallback, + frontend::ReadCallback::Callback const& _smtCallback, [[maybe_unused]] SMTSolverChoice _enabledSolvers ) { - m_solvers.emplace_back(make_unique(_smtlib2Responses, _smtCallback)); + m_solvers.emplace_back(make_unique(_smtlib2Responses, _smtCallback)); #ifdef HAVE_Z3 if (_enabledSolvers.z3) - m_solvers.emplace_back(make_unique()); + m_solvers.emplace_back(make_unique()); #endif #ifdef HAVE_CVC4 if (_enabledSolvers.cvc4) - m_solvers.emplace_back(make_unique()); + m_solvers.emplace_back(make_unique()); #endif } @@ -73,7 +73,7 @@ void SMTPortfolio::declareVariable(string const& _name, SortPointer const& _sort s->declareVariable(_name, _sort); } -void SMTPortfolio::addAssertion(smt::Expression const& _expr) +void SMTPortfolio::addAssertion(Expression const& _expr) { for (auto const& s: m_solvers) s->addAssertion(_expr); @@ -109,7 +109,7 @@ void SMTPortfolio::addAssertion(smt::Expression const& _expr) * * If all solvers return ERROR, the result is ERROR. */ -pair> SMTPortfolio::check(vector const& _expressionsToEvaluate) +pair> SMTPortfolio::check(vector const& _expressionsToEvaluate) { CheckResult lastResult = CheckResult::ERROR; vector finalValues; @@ -142,7 +142,7 @@ vector SMTPortfolio::unhandledQueries() // This code assumes that the constructor guarantees that // SmtLib2Interface is in position 0. solAssert(!m_solvers.empty(), ""); - solAssert(dynamic_cast(m_solvers.front().get()), ""); + solAssert(dynamic_cast(m_solvers.front().get()), ""); return m_solvers.front()->unhandledQueries(); } diff --git a/libsmtutil/SMTPortfolio.h b/libsmtutil/SMTPortfolio.h index 1ffce37ee013..0399ac033f3e 100644 --- a/libsmtutil/SMTPortfolio.h +++ b/libsmtutil/SMTPortfolio.h @@ -26,7 +26,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { /** @@ -40,7 +40,7 @@ class SMTPortfolio: public SolverInterface, public boost::noncopyable public: SMTPortfolio( std::map const& _smtlib2Responses, - ReadCallback::Callback const& _smtCallback, + frontend::ReadCallback::Callback const& _smtCallback, SMTSolverChoice _enabledSolvers ); @@ -51,18 +51,18 @@ class SMTPortfolio: public SolverInterface, public boost::noncopyable void declareVariable(std::string const&, SortPointer const&) override; - void addAssertion(smt::Expression const& _expr) override; + void addAssertion(Expression const& _expr) override; - std::pair> check(std::vector const& _expressionsToEvaluate) override; + std::pair> check(std::vector const& _expressionsToEvaluate) override; std::vector unhandledQueries() override; unsigned solvers() override { return m_solvers.size(); } private: static bool solverAnswered(CheckResult result); - std::vector> m_solvers; + std::vector> m_solvers; - std::vector m_assertions; + std::vector m_assertions; }; } diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index 078eaef73da7..260dcc7a7787 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -32,7 +31,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { struct SMTSolverChoice @@ -56,7 +55,7 @@ enum class CheckResult }; // Forward declaration. -SortPointer smtSort(Type const& _type); +SortPointer smtSort(frontend::Type const& _type); /// C++ representation of an SMTLIB2 expression. class Expression diff --git a/libsmtutil/Sorts.cpp b/libsmtutil/Sorts.cpp index dba0dc4b77e0..7a45a174623d 100644 --- a/libsmtutil/Sorts.cpp +++ b/libsmtutil/Sorts.cpp @@ -20,7 +20,7 @@ using namespace std; -namespace solidity::frontend::smt +namespace solidity::smtutil { shared_ptr const SortProvider::boolSort{make_shared(Kind::Bool)}; diff --git a/libsmtutil/Sorts.h b/libsmtutil/Sorts.h index 2acd4697523b..903db1907ce7 100644 --- a/libsmtutil/Sorts.h +++ b/libsmtutil/Sorts.h @@ -24,7 +24,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { enum class Kind diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index 3be40d3964a0..8346ea647d0a 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -22,7 +22,7 @@ using namespace std; using namespace solidity; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; Z3CHCInterface::Z3CHCInterface(): m_z3Interface(make_unique()), diff --git a/libsmtutil/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h index bc0e6cf925ce..f36ee2caae46 100644 --- a/libsmtutil/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -24,7 +24,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { class Z3CHCInterface: public CHCSolverInterface diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index 4303c76ac070..3c4ea16ed1f8 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -21,7 +21,7 @@ #include using namespace std; -using namespace solidity::frontend::smt; +using namespace solidity::smtutil; Z3Interface::Z3Interface(): m_solver(m_context) @@ -61,7 +61,7 @@ void Z3Interface::declareVariable(string const& _name, SortPointer const& _sort) void Z3Interface::declareFunction(string const& _name, Sort const& _sort) { - solAssert(_sort.kind == smt::Kind::Function, ""); + solAssert(_sort.kind == Kind::Function, ""); FunctionSort fSort = dynamic_cast(_sort); if (m_functions.count(_name)) m_functions.at(_name) = m_context.function(_name.c_str(), z3Sort(fSort.domain), z3Sort(*fSort.codomain)); diff --git a/libsmtutil/Z3Interface.h b/libsmtutil/Z3Interface.h index 282b87a096f2..1662323bc5c9 100644 --- a/libsmtutil/Z3Interface.h +++ b/libsmtutil/Z3Interface.h @@ -21,7 +21,7 @@ #include #include -namespace solidity::frontend::smt +namespace solidity::smtutil { class Z3Interface: public SolverInterface, public boost::noncopyable @@ -55,8 +55,8 @@ class Z3Interface: public SolverInterface, public boost::noncopyable private: void declareFunction(std::string const& _name, Sort const& _sort); - z3::sort z3Sort(smt::Sort const& _sort); - z3::sort_vector z3Sort(std::vector const& _sorts); + z3::sort z3Sort(Sort const& _sort); + z3::sort_vector z3Sort(std::vector const& _sorts); z3::context m_context; z3::solver m_solver; diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index 7c2bc481876e..8ec6b3564b6e 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -33,10 +33,10 @@ BMC::BMC( ErrorReporter& _errorReporter, map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback, - smt::SMTSolverChoice _enabledSolvers + smtutil::SMTSolverChoice _enabledSolvers ): SMTEncoder(_context), - m_interface(make_unique(_smtlib2Responses, _smtCallback, _enabledSolvers)), + m_interface(make_unique(_smtlib2Responses, _smtCallback, _enabledSolvers)), m_outerErrorReporter(_errorReporter) { #if defined (HAVE_Z3) || defined (HAVE_CVC4) @@ -133,7 +133,7 @@ void BMC::endVisit(ContractDefinition const& _contract) { inlineConstructorHierarchy(_contract); /// Check targets created by state variable initialization. - smt::Expression constraints = m_context.assertions(); + smtutil::Expression constraints = m_context.assertions(); checkVerificationTargets(constraints); m_verificationTargets.clear(); } @@ -167,7 +167,7 @@ void BMC::endVisit(FunctionDefinition const& _function) { if (isRootFunction()) { - smt::Expression constraints = m_context.assertions(); + smtutil::Expression constraints = m_context.assertions(); checkVerificationTargets(constraints); m_verificationTargets.clear(); } @@ -294,7 +294,7 @@ bool BMC::visit(ForStatement const& _node) if (_node.condition()) _node.condition()->accept(*this); - auto forCondition = _node.condition() ? expr(*_node.condition()) : smt::Expression(true); + auto forCondition = _node.condition() ? expr(*_node.condition()) : smtutil::Expression(true); mergeVariables(touchedVars, forCondition, indicesAfterLoop, copyVariableIndices()); m_loopExecutionHappened = true; @@ -381,7 +381,7 @@ void BMC::endVisit(FunctionCall const& _funCall) SMTEncoder::endVisit(_funCall); auto value = _funCall.arguments().front(); solAssert(value, ""); - smt::Expression thisBalance = m_context.state().balance(); + smtutil::Expression thisBalance = m_context.state().balance(); addVerificationTarget( VerificationTarget::Type::Balance, @@ -453,7 +453,7 @@ void BMC::inlineFunctionCall(FunctionCall const& _funCall) void BMC::abstractFunctionCall(FunctionCall const& _funCall) { - vector smtArguments; + vector smtArguments; for (auto const& arg: _funCall.arguments()) smtArguments.push_back(expr(*arg)); defineExpr(_funCall, (*m_context.expression(_funCall.expression()))(smtArguments)); @@ -480,10 +480,10 @@ void BMC::internalOrExternalFunctionCall(FunctionCall const& _funCall) } } -pair BMC::arithmeticOperation( +pair BMC::arithmeticOperation( Token _op, - smt::Expression const& _left, - smt::Expression const& _right, + smtutil::Expression const& _left, + smtutil::Expression const& _right, TypePointer const& _commonType, Expression const& _expression ) @@ -516,9 +516,9 @@ void BMC::reset() m_loopExecutionHappened = false; } -pair, vector> BMC::modelExpressions() +pair, vector> BMC::modelExpressions() { - vector expressionsToEvaluate; + vector expressionsToEvaluate; vector expressionNames; for (auto const& var: m_context.variables()) if (var.first->type()->isValueType()) @@ -531,7 +531,7 @@ pair, vector> BMC::modelExpressions() auto const& type = var.second->type(); if ( type->isValueType() && - smt::smtKind(type->category()) != smt::Kind::Function + smt::smtKind(type->category()) != smtutil::Kind::Function ) { expressionsToEvaluate.emplace_back(var.second->currentValue()); @@ -550,13 +550,13 @@ pair, vector> BMC::modelExpressions() /// Verification targets. -void BMC::checkVerificationTargets(smt::Expression const& _constraints) +void BMC::checkVerificationTargets(smtutil::Expression const& _constraints) { for (auto& target: m_verificationTargets) checkVerificationTarget(target, _constraints); } -void BMC::checkVerificationTarget(BMCVerificationTarget& _target, smt::Expression const& _constraints) +void BMC::checkVerificationTarget(BMCVerificationTarget& _target, smtutil::Expression const& _constraints) { switch (_target.type) { @@ -597,7 +597,7 @@ void BMC::checkConstantCondition(BMCVerificationTarget& _target) ); } -void BMC::checkUnderflow(BMCVerificationTarget& _target, smt::Expression const& _constraints) +void BMC::checkUnderflow(BMCVerificationTarget& _target, smtutil::Expression const& _constraints) { solAssert( _target.type == VerificationTarget::Type::Underflow || @@ -619,7 +619,7 @@ void BMC::checkUnderflow(BMCVerificationTarget& _target, smt::Expression const& ); } -void BMC::checkOverflow(BMCVerificationTarget& _target, smt::Expression const& _constraints) +void BMC::checkOverflow(BMCVerificationTarget& _target, smtutil::Expression const& _constraints) { solAssert( _target.type == VerificationTarget::Type::Overflow || @@ -689,7 +689,7 @@ void BMC::checkAssert(BMCVerificationTarget& _target) void BMC::addVerificationTarget( VerificationTarget::Type _type, - smt::Expression const& _value, + smtutil::Expression const& _value, Expression const* _expression ) { @@ -712,21 +712,21 @@ void BMC::addVerificationTarget( /// Solving. void BMC::checkCondition( - smt::Expression _condition, + smtutil::Expression _condition, vector const& _callStack, - pair, vector> const& _modelExpressions, + pair, vector> const& _modelExpressions, SourceLocation const& _location, ErrorId _errorHappens, ErrorId _errorMightHappen, string const& _description, string const& _additionalValueName, - smt::Expression const* _additionalValue + smtutil::Expression const* _additionalValue ) { m_interface->push(); m_interface->addAssertion(_condition); - vector expressionsToEvaluate; + vector expressionsToEvaluate; vector expressionNames; tie(expressionsToEvaluate, expressionNames) = _modelExpressions; if (_callStack.size()) @@ -735,7 +735,7 @@ void BMC::checkCondition( expressionsToEvaluate.emplace_back(*_additionalValue); expressionNames.push_back(_additionalValueName); } - smt::CheckResult result; + smtutil::CheckResult result; vector values; tie(result, values) = checkSatisfiableAndGenerateModel(expressionsToEvaluate); @@ -756,7 +756,7 @@ void BMC::checkCondition( switch (result) { - case smt::CheckResult::SATISFIABLE: + case smtutil::CheckResult::SATISFIABLE: { std::ostringstream message; message << _description << " happens here"; @@ -788,15 +788,15 @@ void BMC::checkCondition( } break; } - case smt::CheckResult::UNSATISFIABLE: + case smtutil::CheckResult::UNSATISFIABLE: break; - case smt::CheckResult::UNKNOWN: + case smtutil::CheckResult::UNKNOWN: m_errorReporter.warning(_errorMightHappen, _location, _description + " might happen here.", secondaryLocation); break; - case smt::CheckResult::CONFLICTING: + case smtutil::CheckResult::CONFLICTING: m_errorReporter.warning(1584_error, _location, "At least two SMT solvers provided conflicting answers. Results might not be sound."); break; - case smt::CheckResult::ERROR: + case smtutil::CheckResult::ERROR: m_errorReporter.warning(1823_error, _location, "Error trying to invoke SMT solver."); break; } @@ -806,8 +806,8 @@ void BMC::checkCondition( void BMC::checkBooleanNotConstant( Expression const& _condition, - smt::Expression const& _constraints, - smt::Expression const& _value, + smtutil::Expression const& _constraints, + smtutil::Expression const& _value, vector const& _callStack ) { @@ -825,32 +825,32 @@ void BMC::checkBooleanNotConstant( auto negatedResult = checkSatisfiable(); m_interface->pop(); - if (positiveResult == smt::CheckResult::ERROR || negatedResult == smt::CheckResult::ERROR) + if (positiveResult == smtutil::CheckResult::ERROR || negatedResult == smtutil::CheckResult::ERROR) m_errorReporter.warning(8592_error, _condition.location(), "Error trying to invoke SMT solver."); - else if (positiveResult == smt::CheckResult::CONFLICTING || negatedResult == smt::CheckResult::CONFLICTING) + else if (positiveResult == smtutil::CheckResult::CONFLICTING || negatedResult == smtutil::CheckResult::CONFLICTING) m_errorReporter.warning(3356_error, _condition.location(), "At least two SMT solvers provided conflicting answers. Results might not be sound."); - else if (positiveResult == smt::CheckResult::SATISFIABLE && negatedResult == smt::CheckResult::SATISFIABLE) + else if (positiveResult == smtutil::CheckResult::SATISFIABLE && negatedResult == smtutil::CheckResult::SATISFIABLE) { // everything fine. } - else if (positiveResult == smt::CheckResult::UNKNOWN || negatedResult == smt::CheckResult::UNKNOWN) + else if (positiveResult == smtutil::CheckResult::UNKNOWN || negatedResult == smtutil::CheckResult::UNKNOWN) { // can't do anything. } - else if (positiveResult == smt::CheckResult::UNSATISFIABLE && negatedResult == smt::CheckResult::UNSATISFIABLE) + else if (positiveResult == smtutil::CheckResult::UNSATISFIABLE && negatedResult == smtutil::CheckResult::UNSATISFIABLE) m_errorReporter.warning(2512_error, _condition.location(), "Condition unreachable.", SMTEncoder::callStackMessage(_callStack)); else { string description; - if (positiveResult == smt::CheckResult::SATISFIABLE) + if (positiveResult == smtutil::CheckResult::SATISFIABLE) { - solAssert(negatedResult == smt::CheckResult::UNSATISFIABLE, ""); + solAssert(negatedResult == smtutil::CheckResult::UNSATISFIABLE, ""); description = "Condition is always true."; } else { - solAssert(positiveResult == smt::CheckResult::UNSATISFIABLE, ""); - solAssert(negatedResult == smt::CheckResult::SATISFIABLE, ""); + solAssert(positiveResult == smtutil::CheckResult::UNSATISFIABLE, ""); + solAssert(negatedResult == smtutil::CheckResult::SATISFIABLE, ""); description = "Condition is always false."; } m_errorReporter.warning( @@ -862,22 +862,22 @@ void BMC::checkBooleanNotConstant( } } -pair> -BMC::checkSatisfiableAndGenerateModel(vector const& _expressionsToEvaluate) +pair> +BMC::checkSatisfiableAndGenerateModel(vector const& _expressionsToEvaluate) { - smt::CheckResult result; + smtutil::CheckResult result; vector values; try { tie(result, values) = m_interface->check(_expressionsToEvaluate); } - catch (smt::SolverError const& _e) + catch (smtutil::SolverError const& _e) { string description("Error querying SMT solver"); if (_e.comment()) description += ": " + *_e.comment(); m_errorReporter.warning(8140_error, description); - result = smt::CheckResult::ERROR; + result = smtutil::CheckResult::ERROR; } for (string& value: values) @@ -893,7 +893,7 @@ BMC::checkSatisfiableAndGenerateModel(vector const& _expression return make_pair(result, values); } -smt::CheckResult BMC::checkSatisfiable() +smtutil::CheckResult BMC::checkSatisfiable() { return checkSatisfiableAndGenerateModel({}).first; } diff --git a/libsolidity/formal/BMC.h b/libsolidity/formal/BMC.h index 16ef665c0a23..4f0a980236d4 100644 --- a/libsolidity/formal/BMC.h +++ b/libsolidity/formal/BMC.h @@ -60,7 +60,7 @@ class BMC: public SMTEncoder langutil::ErrorReporter& _errorReporter, std::map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback, - smt::SMTSolverChoice _enabledSolvers + smtutil::SMTSolverChoice _enabledSolvers ); void analyze(SourceUnit const& _sources, std::set _safeAssertions); @@ -103,10 +103,10 @@ class BMC: public SMTEncoder void internalOrExternalFunctionCall(FunctionCall const& _funCall); /// Creates underflow/overflow verification targets. - std::pair arithmeticOperation( + std::pair arithmeticOperation( Token _op, - smt::Expression const& _left, - smt::Expression const& _right, + smtutil::Expression const& _left, + smtutil::Expression const& _right, TypePointer const& _commonType, Expression const& _expression ) override; @@ -114,7 +114,7 @@ class BMC: public SMTEncoder void resetStorageReferences(); void reset(); - std::pair, std::vector> modelExpressions(); + std::pair, std::vector> modelExpressions(); //@} /// Verification targets. @@ -123,20 +123,20 @@ class BMC: public SMTEncoder { Expression const* expression; std::vector callStack; - std::pair, std::vector> modelExpressions; + std::pair, std::vector> modelExpressions; }; - void checkVerificationTargets(smt::Expression const& _constraints); - void checkVerificationTarget(BMCVerificationTarget& _target, smt::Expression const& _constraints = smt::Expression(true)); + void checkVerificationTargets(smtutil::Expression const& _constraints); + void checkVerificationTarget(BMCVerificationTarget& _target, smtutil::Expression const& _constraints = smtutil::Expression(true)); void checkConstantCondition(BMCVerificationTarget& _target); - void checkUnderflow(BMCVerificationTarget& _target, smt::Expression const& _constraints); - void checkOverflow(BMCVerificationTarget& _target, smt::Expression const& _constraints); + void checkUnderflow(BMCVerificationTarget& _target, smtutil::Expression const& _constraints); + void checkOverflow(BMCVerificationTarget& _target, smtutil::Expression const& _constraints); void checkDivByZero(BMCVerificationTarget& _target); void checkBalance(BMCVerificationTarget& _target); void checkAssert(BMCVerificationTarget& _target); void addVerificationTarget( VerificationTarget::Type _type, - smt::Expression const& _value, + smtutil::Expression const& _value, Expression const* _expression ); //@} @@ -145,31 +145,31 @@ class BMC: public SMTEncoder //@{ /// Check that a condition can be satisfied. void checkCondition( - smt::Expression _condition, + smtutil::Expression _condition, std::vector const& _callStack, - std::pair, std::vector> const& _modelExpressions, + std::pair, std::vector> const& _modelExpressions, langutil::SourceLocation const& _location, langutil::ErrorId _errorHappens, langutil::ErrorId _errorMightHappen, std::string const& _description, std::string const& _additionalValueName = "", - smt::Expression const* _additionalValue = nullptr + smtutil::Expression const* _additionalValue = nullptr ); /// Checks that a boolean condition is not constant. Do not warn if the expression /// is a literal constant. void checkBooleanNotConstant( Expression const& _condition, - smt::Expression const& _constraints, - smt::Expression const& _value, + smtutil::Expression const& _constraints, + smtutil::Expression const& _value, std::vector const& _callStack ); - std::pair> - checkSatisfiableAndGenerateModel(std::vector const& _expressionsToEvaluate); + std::pair> + checkSatisfiableAndGenerateModel(std::vector const& _expressionsToEvaluate); - smt::CheckResult checkSatisfiable(); + smtutil::CheckResult checkSatisfiable(); //@} - std::unique_ptr m_interface; + std::unique_ptr m_interface; /// Flags used for better warning messages. bool m_loopExecutionHappened = false; diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 9cc01e26eb5d..fe63c198d605 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -32,6 +32,7 @@ using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::langutil; +using namespace solidity::smtutil; using namespace solidity::frontend; CHC::CHC( @@ -39,7 +40,7 @@ CHC::CHC( ErrorReporter& _errorReporter, map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback, - [[maybe_unused]] smt::SMTSolverChoice _enabledSolvers + [[maybe_unused]] smtutil::SMTSolverChoice _enabledSolvers ): SMTEncoder(_context), m_outerErrorReporter(_errorReporter), @@ -47,10 +48,10 @@ CHC::CHC( { #ifdef HAVE_Z3 if (_enabledSolvers.z3) - m_interface = make_unique(); + m_interface = make_unique(); #endif if (!m_interface) - m_interface = make_unique(_smtlib2Responses, _smtCallback); + m_interface = make_unique(_smtlib2Responses, _smtCallback); } void CHC::analyze(SourceUnit const& _source) @@ -62,14 +63,14 @@ void CHC::analyze(SourceUnit const& _source) usesZ3 = m_enabledSolvers.z3; if (usesZ3) { - auto z3Interface = dynamic_cast(m_interface.get()); + auto z3Interface = dynamic_cast(m_interface.get()); solAssert(z3Interface, ""); m_context.setSolver(z3Interface->z3Interface()); } #endif if (!usesZ3) { - auto smtlib2Interface = dynamic_cast(m_interface.get()); + auto smtlib2Interface = dynamic_cast(m_interface.get()); solAssert(smtlib2Interface, ""); m_context.setSolver(smtlib2Interface->smtlib2Interface()); } @@ -79,9 +80,9 @@ void CHC::analyze(SourceUnit const& _source) resetSourceAnalysis(); - auto genesisSort = make_shared( - vector(), - smt::SortProvider::boolSort + auto genesisSort = make_shared( + vector(), + smtutil::SortProvider::boolSort ); m_genesisPredicate = createSymbolicBlock(genesisSort, "genesis"); addRule(genesis(), "genesis"); @@ -107,7 +108,7 @@ void CHC::analyze(SourceUnit const& _source) auto [result, model] = query(error(), assertion->location()); // This should be fine but it's a bug in the old compiler (void)model; - if (result == smt::CheckResult::UNSATISFIABLE) + if (result == smtutil::CheckResult::UNSATISFIABLE) m_safeAssertions.insert(assertion); } } @@ -119,10 +120,10 @@ void CHC::analyze(SourceUnit const& _source) auto [result, model] = query(error(), scope->location()); // This should be fine but it's a bug in the old compiler (void)model; - if (result != smt::CheckResult::UNSATISFIABLE) + if (result != smtutil::CheckResult::UNSATISFIABLE) { string msg = "Empty array \"pop\" "; - if (result == smt::CheckResult::SATISFIABLE) + if (result == smtutil::CheckResult::SATISFIABLE) msg += "detected here."; else msg += "might happen here."; @@ -141,7 +142,7 @@ void CHC::analyze(SourceUnit const& _source) vector CHC::unhandledQueries() const { - if (auto smtlib2 = dynamic_cast(m_interface.get())) + if (auto smtlib2 = dynamic_cast(m_interface.get())) return smtlib2->unhandledQueries(); return {}; @@ -181,14 +182,14 @@ void CHC::endVisit(ContractDefinition const& _contract) else inlineConstructorHierarchy(_contract); - auto summary = predicate(*m_constructorSummaryPredicate, vector{m_error.currentValue()} + currentStateVariables()); + auto summary = predicate(*m_constructorSummaryPredicate, vector{m_error.currentValue()} + currentStateVariables()); connectBlocks(m_currentBlock, summary); clearIndices(m_currentContract, nullptr); - auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); + auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); setCurrentBlock(*m_constructorSummaryPredicate, &stateExprs); - addAssertVerificationTarget(m_currentContract, m_currentBlock, smt::Expression(true), m_error.currentValue()); + addAssertVerificationTarget(m_currentContract, m_currentBlock, smtutil::Expression(true), m_error.currentValue()); connectBlocks(m_currentBlock, interface(), m_error.currentValue() == 0); SMTEncoder::endVisit(_contract); @@ -264,10 +265,10 @@ void CHC::endVisit(FunctionDefinition const& _function) { string suffix = m_currentContract->name() + "_" + to_string(m_currentContract->id()); auto constructorExit = createSymbolicBlock(constructorSort(), "constructor_exit_" + suffix); - connectBlocks(m_currentBlock, predicate(*constructorExit, vector{m_error.currentValue()} + currentStateVariables())); + connectBlocks(m_currentBlock, predicate(*constructorExit, vector{m_error.currentValue()} + currentStateVariables())); clearIndices(m_currentContract, m_currentFunction); - auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); + auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); setCurrentBlock(*constructorExit, &stateExprs); } else @@ -416,7 +417,7 @@ bool CHC::visit(ForStatement const& _for) connectBlocks(m_currentBlock, predicate(*loopHeaderBlock)); setCurrentBlock(*loopHeaderBlock); - auto condition = smt::Expression(true); + auto condition = smtutil::Expression(true); if (auto forCondition = _for.condition()) { forCondition->accept(*this); @@ -655,7 +656,7 @@ bool CHC::shouldVisit(FunctionDefinition const& _function) const void CHC::setCurrentBlock( smt::SymbolicFunctionVariable const& _block, - vector const* _arguments + vector const* _arguments ) { if (m_context.solverStackHeigh() > 0) @@ -669,7 +670,7 @@ void CHC::setCurrentBlock( m_currentBlock = predicate(_block); } -set CHC::transactionAssertions(ASTNode const* _txRoot) +set CHC::transactionAssertions(ASTNode const* _txRoot) { set assertions; solidity::util::BreadthFirstSearch{{_txRoot}}.run([&](auto const* function, auto&& _addChild) { @@ -689,7 +690,7 @@ vector CHC::stateVariablesIncludingInheritedAndPriva ); } -vector CHC::stateSorts(ContractDefinition const& _contract) +vector CHC::stateSorts(ContractDefinition const& _contract) { return applyMap( stateVariablesIncludingInheritedAndPrivate(_contract), @@ -697,35 +698,35 @@ vector CHC::stateSorts(ContractDefinition const& _contract) ); } -smt::SortPointer CHC::constructorSort() +smtutil::SortPointer CHC::constructorSort() { - return make_shared( - vector{smt::SortProvider::intSort} + m_stateSorts, - smt::SortProvider::boolSort + return make_shared( + vector{smtutil::SortProvider::intSort} + m_stateSorts, + smtutil::SortProvider::boolSort ); } -smt::SortPointer CHC::interfaceSort() +smtutil::SortPointer CHC::interfaceSort() { - return make_shared( + return make_shared( m_stateSorts, - smt::SortProvider::boolSort + smtutil::SortProvider::boolSort ); } -smt::SortPointer CHC::interfaceSort(ContractDefinition const& _contract) +smtutil::SortPointer CHC::interfaceSort(ContractDefinition const& _contract) { - return make_shared( + return make_shared( stateSorts(_contract), - smt::SortProvider::boolSort + smtutil::SortProvider::boolSort ); } -smt::SortPointer CHC::arity0FunctionSort() +smtutil::SortPointer CHC::arity0FunctionSort() { - return make_shared( - vector(), - smt::SortProvider::boolSort + return make_shared( + vector(), + smtutil::SortProvider::boolSort ); } @@ -740,33 +741,33 @@ smt::SortPointer CHC::arity0FunctionSort() /// - Current input variables /// At the beginning of the function these must equal set 1 /// - 1 set of output variables -smt::SortPointer CHC::sort(FunctionDefinition const& _function) +smtutil::SortPointer CHC::sort(FunctionDefinition const& _function) { auto smtSort = [](auto _var) { return smt::smtSortAbstractFunction(*_var->type()); }; auto inputSorts = applyMap(_function.parameters(), smtSort); auto outputSorts = applyMap(_function.returnParameters(), smtSort); - return make_shared( - vector{smt::SortProvider::intSort} + m_stateSorts + inputSorts + m_stateSorts + inputSorts + outputSorts, - smt::SortProvider::boolSort + return make_shared( + vector{smtutil::SortProvider::intSort} + m_stateSorts + inputSorts + m_stateSorts + inputSorts + outputSorts, + smtutil::SortProvider::boolSort ); } -smt::SortPointer CHC::sort(ASTNode const* _node) +smtutil::SortPointer CHC::sort(ASTNode const* _node) { if (auto funDef = dynamic_cast(_node)) return sort(*funDef); - auto fSort = dynamic_pointer_cast(sort(*m_currentFunction)); + auto fSort = dynamic_pointer_cast(sort(*m_currentFunction)); solAssert(fSort, ""); auto smtSort = [](auto _var) { return smt::smtSortAbstractFunction(*_var->type()); }; - return make_shared( + return make_shared( fSort->domain + applyMap(m_currentFunction->localVariables(), smtSort), - smt::SortProvider::boolSort + smtutil::SortProvider::boolSort ); } -smt::SortPointer CHC::summarySort(FunctionDefinition const& _function, ContractDefinition const& _contract) +smtutil::SortPointer CHC::summarySort(FunctionDefinition const& _function, ContractDefinition const& _contract) { auto stateVariables = stateVariablesIncludingInheritedAndPrivate(_contract); auto sorts = stateSorts(_contract); @@ -774,13 +775,13 @@ smt::SortPointer CHC::summarySort(FunctionDefinition const& _function, ContractD auto smtSort = [](auto _var) { return smt::smtSortAbstractFunction(*_var->type()); }; auto inputSorts = applyMap(_function.parameters(), smtSort); auto outputSorts = applyMap(_function.returnParameters(), smtSort); - return make_shared( - vector{smt::SortProvider::intSort} + sorts + inputSorts + sorts + outputSorts, - smt::SortProvider::boolSort + return make_shared( + vector{smtutil::SortProvider::intSort} + sorts + inputSorts + sorts + outputSorts, + smtutil::SortProvider::boolSort ); } -unique_ptr CHC::createSymbolicBlock(smt::SortPointer _sort, string const& _name) +unique_ptr CHC::createSymbolicBlock(smtutil::SortPointer _sort, string const& _name) { auto block = make_unique( _sort, @@ -807,7 +808,7 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source) } } -smt::Expression CHC::interface() +smtutil::Expression CHC::interface() { auto paramExprs = applyMap( m_stateVariables, @@ -816,32 +817,32 @@ smt::Expression CHC::interface() return (*m_interfaces.at(m_currentContract))(paramExprs); } -smt::Expression CHC::interface(ContractDefinition const& _contract) +smtutil::Expression CHC::interface(ContractDefinition const& _contract) { return (*m_interfaces.at(&_contract))(stateVariablesAtIndex(0, _contract)); } -smt::Expression CHC::error() +smtutil::Expression CHC::error() { return (*m_errorPredicate)({}); } -smt::Expression CHC::error(unsigned _idx) +smtutil::Expression CHC::error(unsigned _idx) { return m_errorPredicate->functionValueAtIndex(_idx)({}); } -smt::Expression CHC::summary(ContractDefinition const&) +smtutil::Expression CHC::summary(ContractDefinition const&) { return (*m_constructorSummaryPredicate)( - vector{m_error.currentValue()} + + vector{m_error.currentValue()} + currentStateVariables() ); } -smt::Expression CHC::summary(FunctionDefinition const& _function) +smtutil::Expression CHC::summary(FunctionDefinition const& _function) { - vector args{m_error.currentValue()}; + vector args{m_error.currentValue()}; auto contract = _function.annotation().contract; args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : initialStateVariables(); args += applyMap(_function.parameters(), [this](auto _var) { return valueAtIndex(*_var, 0); }); @@ -876,27 +877,27 @@ void CHC::createErrorBlock() m_interface->registerRelation(m_errorPredicate->currentFunctionValue()); } -void CHC::connectBlocks(smt::Expression const& _from, smt::Expression const& _to, smt::Expression const& _constraints) +void CHC::connectBlocks(smtutil::Expression const& _from, smtutil::Expression const& _to, smtutil::Expression const& _constraints) { - smt::Expression edge = smt::Expression::implies( + smtutil::Expression edge = smtutil::Expression::implies( _from && m_context.assertions() && _constraints, _to ); addRule(edge, _from.name + "_to_" + _to.name); } -vector CHC::initialStateVariables() +vector CHC::initialStateVariables() { return stateVariablesAtIndex(0); } -vector CHC::stateVariablesAtIndex(int _index) +vector CHC::stateVariablesAtIndex(int _index) { solAssert(m_currentContract, ""); return applyMap(m_stateVariables, [&](auto _var) { return valueAtIndex(*_var, _index); }); } -vector CHC::stateVariablesAtIndex(int _index, ContractDefinition const& _contract) +vector CHC::stateVariablesAtIndex(int _index, ContractDefinition const& _contract) { return applyMap( stateVariablesIncludingInheritedAndPrivate(_contract), @@ -904,23 +905,23 @@ vector CHC::stateVariablesAtIndex(int _index, ContractDefinitio ); } -vector CHC::currentStateVariables() +vector CHC::currentStateVariables() { solAssert(m_currentContract, ""); return applyMap(m_stateVariables, [this](auto _var) { return currentValue(*_var); }); } -vector CHC::currentFunctionVariables() +vector CHC::currentFunctionVariables() { - vector initInputExprs; - vector mutableInputExprs; + vector initInputExprs; + vector mutableInputExprs; for (auto const& var: m_currentFunction->parameters()) { initInputExprs.push_back(m_context.variable(*var)->valueAtIndex(0)); mutableInputExprs.push_back(m_context.variable(*var)->currentValue()); } auto returnExprs = applyMap(m_currentFunction->returnParameters(), [this](auto _var) { return currentValue(*_var); }); - return vector{m_error.currentValue()} + + return vector{m_error.currentValue()} + initialStateVariables() + initInputExprs + currentStateVariables() + @@ -928,7 +929,7 @@ vector CHC::currentFunctionVariables() returnExprs; } -vector CHC::currentBlockVariables() +vector CHC::currentBlockVariables() { if (m_currentFunction) return currentFunctionVariables() + applyMap(m_currentFunction->localVariables(), [this](auto _var) { return currentValue(*_var); }); @@ -953,27 +954,27 @@ string CHC::predicateName(ASTNode const* _node, ContractDefinition const* _contr return prefix + "_" + to_string(_node->id()) + "_" + to_string(contract->id()); } -smt::Expression CHC::predicate(smt::SymbolicFunctionVariable const& _block) +smtutil::Expression CHC::predicate(smt::SymbolicFunctionVariable const& _block) { return _block(currentBlockVariables()); } -smt::Expression CHC::predicate( +smtutil::Expression CHC::predicate( smt::SymbolicFunctionVariable const& _block, - vector const& _arguments + vector const& _arguments ) { return _block(_arguments); } -smt::Expression CHC::predicate(FunctionCall const& _funCall) +smtutil::Expression CHC::predicate(FunctionCall const& _funCall) { auto const* function = functionCallToDefinition(_funCall); if (!function) - return smt::Expression(true); + return smtutil::Expression(true); m_error.increaseIndex(); - vector args{m_error.currentValue()}; + vector args{m_error.currentValue()}; auto const* contract = function->annotation().contract; args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : currentStateVariables(); @@ -997,28 +998,28 @@ smt::Expression CHC::predicate(FunctionCall const& _funCall) return (*m_summaries.at(m_currentContract).at(function))(args); } -void CHC::addRule(smt::Expression const& _rule, string const& _ruleName) +void CHC::addRule(smtutil::Expression const& _rule, string const& _ruleName) { m_interface->addRule(_rule, _ruleName); } -pair> CHC::query(smt::Expression const& _query, langutil::SourceLocation const& _location) +pair> CHC::query(smtutil::Expression const& _query, langutil::SourceLocation const& _location) { - smt::CheckResult result; + smtutil::CheckResult result; vector values; tie(result, values) = m_interface->query(_query); switch (result) { - case smt::CheckResult::SATISFIABLE: + case smtutil::CheckResult::SATISFIABLE: break; - case smt::CheckResult::UNSATISFIABLE: + case smtutil::CheckResult::UNSATISFIABLE: break; - case smt::CheckResult::UNKNOWN: + case smtutil::CheckResult::UNKNOWN: break; - case smt::CheckResult::CONFLICTING: + case smtutil::CheckResult::CONFLICTING: m_outerErrorReporter.warning(1988_error, _location, "At least two SMT solvers provided conflicting answers. Results might not be sound."); break; - case smt::CheckResult::ERROR: + case smtutil::CheckResult::ERROR: m_outerErrorReporter.warning(1218_error, _location, "Error trying to invoke SMT solver."); break; } @@ -1028,26 +1029,26 @@ pair> CHC::query(smt::Expression const& _query, void CHC::addVerificationTarget( ASTNode const* _scope, VerificationTarget::Type _type, - smt::Expression _from, - smt::Expression _constraints, - smt::Expression _errorId + smtutil::Expression _from, + smtutil::Expression _constraints, + smtutil::Expression _errorId ) { m_verificationTargets.emplace(_scope, CHCVerificationTarget{{_type, _from, _constraints}, _errorId}); } -void CHC::addAssertVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId) +void CHC::addAssertVerificationTarget(ASTNode const* _scope, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId) { addVerificationTarget(_scope, VerificationTarget::Type::Assert, _from, _constraints, _errorId); } -void CHC::addArrayPopVerificationTarget(ASTNode const* _scope, smt::Expression _errorId) +void CHC::addArrayPopVerificationTarget(ASTNode const* _scope, smtutil::Expression _errorId) { solAssert(m_currentContract, ""); solAssert(m_currentFunction, ""); if (m_currentFunction->isConstructor()) - addVerificationTarget(_scope, VerificationTarget::Type::PopEmptyArray, summary(*m_currentContract), smt::Expression(true), _errorId); + addVerificationTarget(_scope, VerificationTarget::Type::PopEmptyArray, summary(*m_currentContract), smtutil::Expression(true), _errorId); else { auto iface = (*m_interfaces.at(m_currentContract))(initialStateVariables()); diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 9315da70fdec..b1235a188cfe 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -49,7 +49,7 @@ class CHC: public SMTEncoder langutil::ErrorReporter& _errorReporter, std::map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback, - smt::SMTSolverChoice _enabledSolvers + smtutil::SMTSolverChoice _enabledSolvers ); void analyze(SourceUnit const& _sources); @@ -96,43 +96,43 @@ class CHC: public SMTEncoder void eraseKnowledge(); void clearIndices(ContractDefinition const* _contract, FunctionDefinition const* _function = nullptr) override; bool shouldVisit(FunctionDefinition const& _function) const; - void setCurrentBlock(smt::SymbolicFunctionVariable const& _block, std::vector const* _arguments = nullptr); + void setCurrentBlock(smt::SymbolicFunctionVariable const& _block, std::vector const* _arguments = nullptr); std::set transactionAssertions(ASTNode const* _txRoot); static std::vector stateVariablesIncludingInheritedAndPrivate(ContractDefinition const& _contract); //@} /// Sort helpers. //@{ - static std::vector stateSorts(ContractDefinition const& _contract); - smt::SortPointer constructorSort(); - smt::SortPointer interfaceSort(); - static smt::SortPointer interfaceSort(ContractDefinition const& _const); - smt::SortPointer arity0FunctionSort(); - smt::SortPointer sort(FunctionDefinition const& _function); - smt::SortPointer sort(ASTNode const* _block); + static std::vector stateSorts(ContractDefinition const& _contract); + smtutil::SortPointer constructorSort(); + smtutil::SortPointer interfaceSort(); + static smtutil::SortPointer interfaceSort(ContractDefinition const& _const); + smtutil::SortPointer arity0FunctionSort(); + smtutil::SortPointer sort(FunctionDefinition const& _function); + smtutil::SortPointer sort(ASTNode const* _block); /// @returns the sort of a predicate that represents the summary of _function in the scope of _contract. /// The _contract is also needed because the same function might be in many contracts due to inheritance, /// where the sort changes because the set of state variables might change. - static smt::SortPointer summarySort(FunctionDefinition const& _function, ContractDefinition const& _contract); + static smtutil::SortPointer summarySort(FunctionDefinition const& _function, ContractDefinition const& _contract); //@} /// Predicate helpers. //@{ /// @returns a new block of given _sort and _name. - std::unique_ptr createSymbolicBlock(smt::SortPointer _sort, std::string const& _name); + std::unique_ptr createSymbolicBlock(smtutil::SortPointer _sort, std::string const& _name); /// Creates summary predicates for all functions of all contracts /// in a given _source. void defineInterfacesAndSummaries(SourceUnit const& _source); /// Genesis predicate. - smt::Expression genesis() { return (*m_genesisPredicate)({}); } + smtutil::Expression genesis() { return (*m_genesisPredicate)({}); } /// Interface predicate over current variables. - smt::Expression interface(); - smt::Expression interface(ContractDefinition const& _contract); + smtutil::Expression interface(); + smtutil::Expression interface(ContractDefinition const& _contract); /// Error predicate over current variables. - smt::Expression error(); - smt::Expression error(unsigned _idx); + smtutil::Expression error(); + smtutil::Expression error(unsigned _idx); /// Creates a block for the given _node. std::unique_ptr createBlock(ASTNode const* _node, std::string const& _prefix = ""); @@ -144,48 +144,48 @@ class CHC: public SMTEncoder /// Also registers the predicate. void createErrorBlock(); - void connectBlocks(smt::Expression const& _from, smt::Expression const& _to, smt::Expression const& _constraints = smt::Expression(true)); + void connectBlocks(smtutil::Expression const& _from, smtutil::Expression const& _to, smtutil::Expression const& _constraints = smtutil::Expression(true)); /// @returns the symbolic values of the state variables at the beginning /// of the current transaction. - std::vector initialStateVariables(); - std::vector stateVariablesAtIndex(int _index); - std::vector stateVariablesAtIndex(int _index, ContractDefinition const& _contract); + std::vector initialStateVariables(); + std::vector stateVariablesAtIndex(int _index); + std::vector stateVariablesAtIndex(int _index, ContractDefinition const& _contract); /// @returns the current symbolic values of the current state variables. - std::vector currentStateVariables(); + std::vector currentStateVariables(); /// @returns the current symbolic values of the current function's /// input and output parameters. - std::vector currentFunctionVariables(); + std::vector currentFunctionVariables(); /// @returns the same as currentFunctionVariables plus /// local variables. - std::vector currentBlockVariables(); + std::vector currentBlockVariables(); /// @returns the predicate name for a given node. std::string predicateName(ASTNode const* _node, ContractDefinition const* _contract = nullptr); /// @returns a predicate application over the current scoped variables. - smt::Expression predicate(smt::SymbolicFunctionVariable const& _block); + smtutil::Expression predicate(smt::SymbolicFunctionVariable const& _block); /// @returns a predicate application over @param _arguments. - smt::Expression predicate(smt::SymbolicFunctionVariable const& _block, std::vector const& _arguments); + smtutil::Expression predicate(smt::SymbolicFunctionVariable const& _block, std::vector const& _arguments); /// @returns the summary predicate for the called function. - smt::Expression predicate(FunctionCall const& _funCall); + smtutil::Expression predicate(FunctionCall const& _funCall); /// @returns a predicate that defines a constructor summary. - smt::Expression summary(ContractDefinition const& _contract); + smtutil::Expression summary(ContractDefinition const& _contract); /// @returns a predicate that defines a function summary. - smt::Expression summary(FunctionDefinition const& _function); + smtutil::Expression summary(FunctionDefinition const& _function); //@} /// Solver related. //@{ /// Adds Horn rule to the solver. - void addRule(smt::Expression const& _rule, std::string const& _ruleName); + void addRule(smtutil::Expression const& _rule, std::string const& _ruleName); /// @returns if query is unsatisfiable (safe). /// @returns otherwise. - std::pair> query(smt::Expression const& _query, langutil::SourceLocation const& _location); + std::pair> query(smtutil::Expression const& _query, langutil::SourceLocation const& _location); - void addVerificationTarget(ASTNode const* _scope, VerificationTarget::Type _type, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId); - void addAssertVerificationTarget(ASTNode const* _scope, smt::Expression _from, smt::Expression _constraints, smt::Expression _errorId); - void addArrayPopVerificationTarget(ASTNode const* _scope, smt::Expression _errorId); + void addVerificationTarget(ASTNode const* _scope, VerificationTarget::Type _type, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); + void addAssertVerificationTarget(ASTNode const* _scope, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); + void addArrayPopVerificationTarget(ASTNode const* _scope, smtutil::Expression _errorId); //@} /// Misc. @@ -231,7 +231,7 @@ class CHC: public SMTEncoder //@{ /// State variables sorts. /// Used by all predicates. - std::vector m_stateSorts; + std::vector m_stateSorts; /// State variables. /// Used to create all predicates. std::vector m_stateVariables; @@ -241,7 +241,7 @@ class CHC: public SMTEncoder //@{ struct CHCVerificationTarget: VerificationTarget { - smt::Expression errorId; + smtutil::Expression errorId; }; std::map m_verificationTargets; @@ -261,7 +261,7 @@ class CHC: public SMTEncoder std::map, IdCompare> m_functionAssertions; /// The current block. - smt::Expression m_currentBlock = smt::Expression(true); + smtutil::Expression m_currentBlock = smtutil::Expression(true); /// Counter to generate unique block names. unsigned m_blockCounter = 0; @@ -276,13 +276,13 @@ class CHC: public SMTEncoder //@} /// CHC solver. - std::unique_ptr m_interface; + std::unique_ptr m_interface; /// ErrorReporter that comes from CompilerStack. langutil::ErrorReporter& m_outerErrorReporter; /// SMT solvers that are chosen at runtime. - smt::SMTSolverChoice m_enabledSolvers; + smtutil::SMTSolverChoice m_enabledSolvers; }; } diff --git a/libsolidity/formal/EncodingContext.cpp b/libsolidity/formal/EncodingContext.cpp index 3e0e4fa7ed51..51dd37a3d26f 100644 --- a/libsolidity/formal/EncodingContext.cpp +++ b/libsolidity/formal/EncodingContext.cpp @@ -92,7 +92,7 @@ void EncodingContext::resetAllVariables() resetVariables([&](frontend::VariableDeclaration const&) { return true; }); } -Expression EncodingContext::newValue(frontend::VariableDeclaration const& _decl) +smtutil::Expression EncodingContext::newValue(frontend::VariableDeclaration const& _decl) { solAssert(knownVariable(_decl), ""); return m_variables.at(&_decl)->increaseIndex(); @@ -179,10 +179,10 @@ bool EncodingContext::knownGlobalSymbol(string const& _var) const /// Solver. -Expression EncodingContext::assertions() +smtutil::Expression EncodingContext::assertions() { if (m_assertions.empty()) - return Expression(true); + return smtutil::Expression(true); return m_assertions.back(); } @@ -201,7 +201,7 @@ void EncodingContext::popSolver() m_assertions.pop_back(); } -void EncodingContext::addAssertion(Expression const& _expr) +void EncodingContext::addAssertion(smtutil::Expression const& _expr) { if (m_assertions.empty()) m_assertions.push_back(_expr); diff --git a/libsolidity/formal/EncodingContext.h b/libsolidity/formal/EncodingContext.h index e8cf48ed013c..79f9567a5284 100644 --- a/libsolidity/formal/EncodingContext.h +++ b/libsolidity/formal/EncodingContext.h @@ -46,7 +46,7 @@ class EncodingContext /// Sets the current solver used by the current engine for /// SMT variable declaration. - void setSolver(SolverInterface* _solver) + void setSolver(smtutil::SolverInterface* _solver) { solAssert(_solver, ""); m_solver = _solver; @@ -56,7 +56,7 @@ class EncodingContext void setAssertionAccumulation(bool _acc) { m_accumulateAssertions = _acc; } /// Forwards variable creation to the solver. - Expression newVariable(std::string _name, SortPointer _sort) + smtutil::Expression newVariable(std::string _name, smtutil::SortPointer _sort) { solAssert(m_solver, ""); return m_solver->newVariable(move(_name), move(_sort)); @@ -86,7 +86,7 @@ class EncodingContext /// Allocates a new index for the declaration, updates the current /// index to this value and returns the expression. - Expression newValue(frontend::VariableDeclaration const& _decl); + smtutil::Expression newValue(frontend::VariableDeclaration const& _decl); /// Sets the value of the declaration to zero. void setZeroValue(frontend::VariableDeclaration const& _decl); void setZeroValue(SymbolicVariable& _variable); @@ -126,12 +126,12 @@ class EncodingContext /// Solver. //@{ /// @returns conjunction of all added assertions. - Expression assertions(); + smtutil::Expression assertions(); void pushSolver(); void popSolver(); - void addAssertion(Expression const& _e); + void addAssertion(smtutil::Expression const& _e); unsigned solverStackHeigh() { return m_assertions.size(); } const - SolverInterface* solver() + smtutil::SolverInterface* solver() { solAssert(m_solver, ""); return m_solver; @@ -160,10 +160,10 @@ class EncodingContext /// Solver related. //@{ /// Solver can be SMT solver or Horn solver in the future. - SolverInterface* m_solver = nullptr; + smtutil::SolverInterface* m_solver = nullptr; /// Assertion stack. - std::vector m_assertions; + std::vector m_assertions; /// Whether to conjoin assertions in the assertion stack. bool m_accumulateAssertions = true; diff --git a/libsolidity/formal/ModelChecker.cpp b/libsolidity/formal/ModelChecker.cpp index ebc1a875131c..f74e1327da9e 100644 --- a/libsolidity/formal/ModelChecker.cpp +++ b/libsolidity/formal/ModelChecker.cpp @@ -27,7 +27,7 @@ ModelChecker::ModelChecker( ErrorReporter& _errorReporter, map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback, - smt::SMTSolverChoice _enabledSolvers + smtutil::SMTSolverChoice _enabledSolvers ): m_context(), m_bmc(m_context, _errorReporter, _smtlib2Responses, _smtCallback, _enabledSolvers), @@ -49,9 +49,9 @@ vector ModelChecker::unhandledQueries() return m_bmc.unhandledQueries() + m_chc.unhandledQueries(); } -smt::SMTSolverChoice ModelChecker::availableSolvers() +solidity::smtutil::SMTSolverChoice ModelChecker::availableSolvers() { - smt::SMTSolverChoice available = smt::SMTSolverChoice::None(); + smtutil::SMTSolverChoice available = smtutil::SMTSolverChoice::None(); #ifdef HAVE_Z3 available.z3 = true; #endif diff --git a/libsolidity/formal/ModelChecker.h b/libsolidity/formal/ModelChecker.h index 663bae86916a..b4378e629073 100644 --- a/libsolidity/formal/ModelChecker.h +++ b/libsolidity/formal/ModelChecker.h @@ -49,7 +49,7 @@ class ModelChecker langutil::ErrorReporter& _errorReporter, std::map const& _smtlib2Responses, ReadCallback::Callback const& _smtCallback = ReadCallback::Callback(), - smt::SMTSolverChoice _enabledSolvers = smt::SMTSolverChoice::All() + smtutil::SMTSolverChoice _enabledSolvers = smtutil::SMTSolverChoice::All() ); void analyze(SourceUnit const& _sources); @@ -60,7 +60,7 @@ class ModelChecker std::vector unhandledQueries(); /// @returns SMT solvers that are available via the C++ API. - static smt::SMTSolverChoice availableSolvers(); + static smtutil::SMTSolverChoice availableSolvers(); private: /// Stores the context of the encoding. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 7a62199b258c..afaf8ea7e528 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -181,7 +181,7 @@ void SMTEncoder::inlineModifierInvocation(ModifierInvocation const* _invocation, solAssert(_invocation, ""); _invocation->accept(*this); - vector args; + vector args; if (auto const* arguments = _invocation->arguments()) { auto const& modifierParams = _definition->parameters(); @@ -367,7 +367,7 @@ void SMTEncoder::endVisit(Assignment const& _assignment) else { auto const& type = _assignment.annotation().type; - vector rightArguments; + vector rightArguments; if (auto const* tupleTypeRight = dynamic_cast(_assignment.rightHandSide().annotation().type)) { auto symbTupleLeft = dynamic_pointer_cast(m_context.expression(_assignment.leftHandSide())); @@ -641,7 +641,7 @@ void SMTEncoder::endVisit(FunctionCall const& _funCall) auto const& value = args.front(); solAssert(value, ""); - smt::Expression thisBalance = m_context.state().balance(); + smtutil::Expression thisBalance = m_context.state().balance(); setSymbolicUnknownValue(thisBalance, TypeProvider::uint256(), m_context); m_context.state().transfer(m_context.state().thisAddress(), expr(address), expr(*value)); @@ -779,7 +779,7 @@ void SMTEncoder::visitTypeConversion(FunctionCall const& _funCall) else { auto const& intType = dynamic_cast(*m_context.expression(_funCall)->type()); - defineExpr(_funCall, smt::Expression::ite( + defineExpr(_funCall, smtutil::Expression::ite( expr(*argument) >= smt::minValue(intType) && expr(*argument) <= smt::maxValue(intType), expr(*argument), expr(_funCall) @@ -810,9 +810,9 @@ void SMTEncoder::endVisit(Literal const& _literal) solAssert(_literal.annotation().type, "Expected type for AST node"); Type const& type = *_literal.annotation().type; if (smt::isNumber(type.category())) - defineExpr(_literal, smt::Expression(type.literalValue(&_literal))); + defineExpr(_literal, smtutil::Expression(type.literalValue(&_literal))); else if (smt::isBool(type.category())) - defineExpr(_literal, smt::Expression(_literal.token() == Token::TrueLiteral ? true : false)); + defineExpr(_literal, smtutil::Expression(_literal.token() == Token::TrueLiteral ? true : false)); else if (smt::isStringLiteral(type.category())) createExpr(_literal); else @@ -965,7 +965,7 @@ void SMTEncoder::endVisit(IndexAccess const& _indexAccess) auto arrayVar = dynamic_pointer_cast(array); solAssert(arrayVar, ""); - defineExpr(_indexAccess, smt::Expression::select( + defineExpr(_indexAccess, smtutil::Expression::select( arrayVar->elements(), expr(*_indexAccess.indexExpression()) )); @@ -992,7 +992,7 @@ void SMTEncoder::arrayAssignment() m_arrayAssignmentHappened = true; } -void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression const& _rightHandSide) +void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smtutil::Expression const& _rightHandSide) { auto toStore = _rightHandSide; auto indexAccess = dynamic_cast(&_expr); @@ -1039,7 +1039,7 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c }); auto symbArray = dynamic_pointer_cast(m_context.variable(*varDecl)); - smt::Expression store = smt::Expression::store( + smtutil::Expression store = smtutil::Expression::store( symbArray->elements(), expr(*indexAccess->indexExpression()), toStore @@ -1050,7 +1050,7 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c m_context.addAssertion(symbArray->length() == oldLength); // Update the SMT select value after the assignment, // necessary for sound models. - defineExpr(*indexAccess, smt::Expression::select( + defineExpr(*indexAccess, smtutil::Expression::select( symbArray->elements(), expr(*indexAccess->indexExpression()) )); @@ -1061,9 +1061,9 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smt::Expression c { auto symbArray = dynamic_pointer_cast(m_context.expression(*base)); solAssert(symbArray, ""); - toStore = smt::Expression::tuple_constructor( - smt::Expression(base->annotation().type), - {smt::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()} + toStore = smtutil::Expression::tuple_constructor( + smtutil::Expression(base->annotation().type), + {smtutil::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()} ); indexAccess = base; } @@ -1092,10 +1092,10 @@ void SMTEncoder::arrayPush(FunctionCall const& _funCall) m_context.addAssertion(oldLength + 1 < (smt::maxValue(*TypeProvider::uint256()) - 1)); auto const& arguments = _funCall.arguments(); - smt::Expression element = arguments.empty() ? + smtutil::Expression element = arguments.empty() ? smt::zeroValue(_funCall.annotation().type) : expr(*arguments.front()); - smt::Expression store = smt::Expression::store( + smtutil::Expression store = smtutil::Expression::store( symbArray->elements(), oldLength, element @@ -1125,7 +1125,7 @@ void SMTEncoder::arrayPop(FunctionCall const& _funCall) symbArray->increaseIndex(); m_context.addAssertion(symbArray->elements() == oldElements); - auto newLength = smt::Expression::ite( + auto newLength = smtutil::Expression::ite( oldLength == 0, smt::maxValue(*TypeProvider::uint256()), oldLength - 1 @@ -1135,7 +1135,7 @@ void SMTEncoder::arrayPop(FunctionCall const& _funCall) arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); } -void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smt::Expression const& _array) +void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression const& _array) { if (auto const* id = dynamic_cast(&_expr)) { @@ -1176,9 +1176,9 @@ bool SMTEncoder::shortcutRationalNumber(Expression const& _expr) auto rationalType = dynamic_cast(_expr.annotation().type); solAssert(rationalType, ""); if (rationalType->isNegative()) - defineExpr(_expr, smt::Expression(u2s(rationalType->literalValue(nullptr)))); + defineExpr(_expr, smtutil::Expression(u2s(rationalType->literalValue(nullptr)))); else - defineExpr(_expr, smt::Expression(rationalType->literalValue(nullptr))); + defineExpr(_expr, smtutil::Expression(rationalType->literalValue(nullptr))); return true; } return false; @@ -1224,10 +1224,10 @@ void SMTEncoder::arithmeticOperation(BinaryOperation const& _op) ); } -pair SMTEncoder::arithmeticOperation( +pair SMTEncoder::arithmeticOperation( Token _op, - smt::Expression const& _left, - smt::Expression const& _right, + smtutil::Expression const& _left, + smtutil::Expression const& _right, TypePointer const& _commonType, Expression const& ) @@ -1244,7 +1244,7 @@ pair SMTEncoder::arithmeticOperation( solAssert(_commonType->category() == Type::Category::Integer, ""); auto const& intType = dynamic_cast(*_commonType); - smt::Expression valueNoMod( + smtutil::Expression valueNoMod( _op == Token::Add ? _left + _right : _op == Token::Sub ? _left - _right : _op == Token::Div ? division(_left, _right, intType) : @@ -1255,11 +1255,11 @@ pair SMTEncoder::arithmeticOperation( if (_op == Token::Div || _op == Token::Mod) m_context.addAssertion(_right != 0); - smt::Expression intValueRange = (0 - smt::minValue(intType)) + smt::maxValue(intType) + 1; - auto value = smt::Expression::ite( + smtutil::Expression intValueRange = (0 - smt::minValue(intType)) + smt::maxValue(intType) + 1; + auto value = smtutil::Expression::ite( valueNoMod > smt::maxValue(intType), valueNoMod % intValueRange, - smt::Expression::ite( + smtutil::Expression::ite( valueNoMod < smt::minValue(intType), valueNoMod % intValueRange, valueNoMod @@ -1267,7 +1267,7 @@ pair SMTEncoder::arithmeticOperation( ); if (intType.isSigned()) - value = smt::Expression::ite( + value = smtutil::Expression::ite( value > smt::maxValue(intType), value - intValueRange, value @@ -1282,13 +1282,13 @@ void SMTEncoder::compareOperation(BinaryOperation const& _op) solAssert(commonType, ""); if (smt::isSupportedType(commonType->category())) { - smt::Expression left(expr(_op.leftExpression(), commonType)); - smt::Expression right(expr(_op.rightExpression(), commonType)); + smtutil::Expression left(expr(_op.leftExpression(), commonType)); + smtutil::Expression right(expr(_op.rightExpression(), commonType)); Token op = _op.getOperator(); - shared_ptr value; + shared_ptr value; if (smt::isNumber(commonType->category())) { - value = make_shared( + value = make_shared( op == Token::Equal ? (left == right) : op == Token::NotEqual ? (left != right) : op == Token::LessThan ? (left < right) : @@ -1300,7 +1300,7 @@ void SMTEncoder::compareOperation(BinaryOperation const& _op) else // Bool { solUnimplementedAssert(smt::isBool(commonType->category()), "Operation not yet supported"); - value = make_shared( + value = make_shared( op == Token::Equal ? (left == right) : /*op == Token::NotEqual*/ (left != right) ); @@ -1345,14 +1345,14 @@ void SMTEncoder::booleanOperation(BinaryOperation const& _op) ); } -smt::Expression SMTEncoder::division(smt::Expression _left, smt::Expression _right, IntegerType const& _type) +smtutil::Expression SMTEncoder::division(smtutil::Expression _left, smtutil::Expression _right, IntegerType const& _type) { // Signed division in SMTLIB2 rounds differently for negative division. if (_type.isSigned()) - return (smt::Expression::ite( + return (smtutil::Expression::ite( _left >= 0, - smt::Expression::ite(_right >= 0, _left / _right, 0 - (_left / (0 - _right))), - smt::Expression::ite(_right >= 0, 0 - ((0 - _left) / _right), (0 - _left) / (0 - _right)) + smtutil::Expression::ite(_right >= 0, _left / _right, 0 - (_left / (0 - _right))), + smtutil::Expression::ite(_right >= 0, 0 - ((0 - _left) / _right), (0 - _left) / (0 - _right)) )); else return _left / _right; @@ -1360,7 +1360,7 @@ smt::Expression SMTEncoder::division(smt::Expression _left, smt::Expression _rig void SMTEncoder::assignment( Expression const& _left, - vector const& _right, + vector const& _right, TypePointer const& _type, langutil::SourceLocation const& _location ) @@ -1406,7 +1406,7 @@ void SMTEncoder::assignment( ); } -smt::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment) +smtutil::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment) { static map const compoundToArithmetic{ {Token::AssignAdd, Token::Add}, @@ -1440,7 +1440,7 @@ void SMTEncoder::assignment(VariableDeclaration const& _variable, Expression con // TODO else { store each string literal byte into the array } } -void SMTEncoder::assignment(VariableDeclaration const& _variable, smt::Expression const& _value) +void SMTEncoder::assignment(VariableDeclaration const& _variable, smtutil::Expression const& _value) { TypePointer type = _variable.type(); if (type->category() == Type::Category::Mapping) @@ -1448,12 +1448,12 @@ void SMTEncoder::assignment(VariableDeclaration const& _variable, smt::Expressio m_context.addAssertion(m_context.newValue(_variable) == _value); } -SMTEncoder::VariableIndices SMTEncoder::visitBranch(ASTNode const* _statement, smt::Expression _condition) +SMTEncoder::VariableIndices SMTEncoder::visitBranch(ASTNode const* _statement, smtutil::Expression _condition) { return visitBranch(_statement, &_condition); } -SMTEncoder::VariableIndices SMTEncoder::visitBranch(ASTNode const* _statement, smt::Expression const* _condition) +SMTEncoder::VariableIndices SMTEncoder::visitBranch(ASTNode const* _statement, smtutil::Expression const* _condition) { auto indicesBeforeBranch = copyVariableIndices(); if (_condition) @@ -1466,7 +1466,7 @@ SMTEncoder::VariableIndices SMTEncoder::visitBranch(ASTNode const* _statement, s return indicesAfterBranch; } -void SMTEncoder::initializeFunctionCallParameters(CallableDeclaration const& _function, vector const& _callArgs) +void SMTEncoder::initializeFunctionCallParameters(CallableDeclaration const& _function, vector const& _callArgs) { auto const& funParams = _function.parameters(); solAssert(funParams.size() == _callArgs.size(), ""); @@ -1563,7 +1563,7 @@ TypePointer SMTEncoder::typeWithoutPointer(TypePointer const& _type) return _type; } -void SMTEncoder::mergeVariables(set const& _variables, smt::Expression const& _condition, VariableIndices const& _indicesEndTrue, VariableIndices const& _indicesEndFalse) +void SMTEncoder::mergeVariables(set const& _variables, smtutil::Expression const& _condition, VariableIndices const& _indicesEndTrue, VariableIndices const& _indicesEndFalse) { auto cmp = [] (VariableDeclaration const* var1, VariableDeclaration const* var2) { return var1->id() < var2->id(); @@ -1590,7 +1590,7 @@ void SMTEncoder::mergeVariables(set const& _variable int trueIndex = _indicesEndTrue.at(decl); int falseIndex = _indicesEndFalse.at(decl); solAssert(trueIndex != falseIndex, ""); - m_context.addAssertion(m_context.newValue(*decl) == smt::Expression::ite( + m_context.addAssertion(m_context.newValue(*decl) == smtutil::Expression::ite( _condition, valueAtIndex(*decl, trueIndex), valueAtIndex(*decl, falseIndex)) @@ -1598,13 +1598,13 @@ void SMTEncoder::mergeVariables(set const& _variable } } -smt::Expression SMTEncoder::currentValue(VariableDeclaration const& _decl) +smtutil::Expression SMTEncoder::currentValue(VariableDeclaration const& _decl) { solAssert(m_context.knownVariable(_decl), ""); return m_context.variable(_decl)->currentValue(); } -smt::Expression SMTEncoder::valueAtIndex(VariableDeclaration const& _decl, int _index) +smtutil::Expression SMTEncoder::valueAtIndex(VariableDeclaration const& _decl, int _index) { solAssert(m_context.knownVariable(_decl), ""); return m_context.variable(_decl)->valueAtIndex(_index); @@ -1627,7 +1627,7 @@ bool SMTEncoder::createVariable(VariableDeclaration const& _varDecl) return true; } -smt::Expression SMTEncoder::expr(Expression const& _e, TypePointer _targetType) +smtutil::Expression SMTEncoder::expr(Expression const& _e, TypePointer _targetType) { if (!m_context.knownExpression(_e)) { @@ -1649,10 +1649,10 @@ void SMTEncoder::createExpr(Expression const& _e) ); } -void SMTEncoder::defineExpr(Expression const& _e, smt::Expression _value) +void SMTEncoder::defineExpr(Expression const& _e, smtutil::Expression _value) { createExpr(_e); - solAssert(_value.sort->kind != smt::Kind::Function, "Equality operator applied to type that is not fully supported"); + solAssert(_value.sort->kind != smtutil::Kind::Function, "Equality operator applied to type that is not fully supported"); m_context.addAssertion(expr(_e) == _value); } @@ -1662,15 +1662,15 @@ void SMTEncoder::popPathCondition() m_pathConditions.pop_back(); } -void SMTEncoder::pushPathCondition(smt::Expression const& _e) +void SMTEncoder::pushPathCondition(smtutil::Expression const& _e) { m_pathConditions.push_back(currentPathConditions() && _e); } -smt::Expression SMTEncoder::currentPathConditions() +smtutil::Expression SMTEncoder::currentPathConditions() { if (m_pathConditions.empty()) - return smt::Expression(true); + return smtutil::Expression(true); return m_pathConditions.back(); } @@ -1698,9 +1698,9 @@ void SMTEncoder::pushCallStack(CallStackEntry _entry) m_callStack.push_back(_entry); } -void SMTEncoder::addPathImpliedExpression(smt::Expression const& _e) +void SMTEncoder::addPathImpliedExpression(smtutil::Expression const& _e) { - m_context.addAssertion(smt::Expression::implies(currentPathConditions(), _e)); + m_context.addAssertion(smtutil::Expression::implies(currentPathConditions(), _e)); } bool SMTEncoder::isRootFunction() @@ -1836,12 +1836,12 @@ void SMTEncoder::createReturnedExpressions(FunctionCall const& _funCall) defineExpr(_funCall, currentValue(*returnParams.front())); } -vector SMTEncoder::symbolicArguments(FunctionCall const& _funCall) +vector SMTEncoder::symbolicArguments(FunctionCall const& _funCall) { auto const* function = functionCallToDefinition(_funCall); solAssert(function, ""); - vector args; + vector args; Expression const* calledExpr = &_funCall.expression(); auto const& funType = dynamic_cast(calledExpr->annotation().type); solAssert(funType, ""); diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index f62f18558c9b..63bbd45df0d5 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -99,10 +99,10 @@ class SMTEncoder: public ASTConstVisitor /// @returns _op(_left, _right) with and without modular arithmetic. /// Used by the function above, compound assignments and /// unary increment/decrement. - virtual std::pair arithmeticOperation( + virtual std::pair arithmeticOperation( Token _op, - smt::Expression const& _left, - smt::Expression const& _right, + smtutil::Expression const& _left, + smtutil::Expression const& _right, TypePointer const& _commonType, Expression const& _expression ); @@ -135,32 +135,32 @@ class SMTEncoder: public ASTConstVisitor /// while aliasing is not supported. void arrayAssignment(); /// Handles assignment to SMT array index. - void arrayIndexAssignment(Expression const& _expr, smt::Expression const& _rightHandSide); + void arrayIndexAssignment(Expression const& _expr, smtutil::Expression const& _rightHandSide); void arrayPush(FunctionCall const& _funCall); void arrayPop(FunctionCall const& _funCall); - void arrayPushPopAssign(Expression const& _expr, smt::Expression const& _array); + void arrayPushPopAssign(Expression const& _expr, smtutil::Expression const& _array); /// Allows BMC and CHC to create verification targets for popping /// an empty array. virtual void makeArrayPopVerificationTarget(FunctionCall const&) {} /// Division expression in the given type. Requires special treatment because /// of rounding for signed division. - smt::Expression division(smt::Expression _left, smt::Expression _right, IntegerType const& _type); + smtutil::Expression division(smtutil::Expression _left, smtutil::Expression _right, IntegerType const& _type); void assignment(VariableDeclaration const& _variable, Expression const& _value); /// Handles assignments to variables of different types. - void assignment(VariableDeclaration const& _variable, smt::Expression const& _value); + void assignment(VariableDeclaration const& _variable, smtutil::Expression const& _value); /// Handles assignments between generic expressions. /// Will also be used for assignments of tuple components. void assignment( Expression const& _left, - std::vector const& _right, + std::vector const& _right, TypePointer const& _type, langutil::SourceLocation const& _location ); /// Computes the right hand side of a compound assignment. - smt::Expression compoundAssignment(Assignment const& _assignment); + smtutil::Expression compoundAssignment(Assignment const& _assignment); /// Maps a variable to an SSA index. using VariableIndices = std::unordered_map; @@ -168,8 +168,8 @@ class SMTEncoder: public ASTConstVisitor /// Visits the branch given by the statement, pushes and pops the current path conditions. /// @param _condition if present, asserts that this condition is true within the branch. /// @returns the variable indices after visiting the branch. - VariableIndices visitBranch(ASTNode const* _statement, smt::Expression const* _condition = nullptr); - VariableIndices visitBranch(ASTNode const* _statement, smt::Expression _condition); + VariableIndices visitBranch(ASTNode const* _statement, smtutil::Expression const* _condition = nullptr); + VariableIndices visitBranch(ASTNode const* _statement, smtutil::Expression _condition); using CallStackEntry = std::pair; @@ -177,7 +177,7 @@ class SMTEncoder: public ASTConstVisitor void initializeStateVariables(ContractDefinition const& _contract); void createLocalVariables(FunctionDefinition const& _function); void initializeLocalVariables(FunctionDefinition const& _function); - void initializeFunctionCallParameters(CallableDeclaration const& _function, std::vector const& _callArgs); + void initializeFunctionCallParameters(CallableDeclaration const& _function, std::vector const& _callArgs); void resetStateVariables(); /// @returns the type without storage pointer information if it has it. TypePointer typeWithoutPointer(TypePointer const& _type); @@ -185,31 +185,31 @@ class SMTEncoder: public ASTConstVisitor /// Given two different branches and the touched variables, /// merge the touched variables into after-branch ite variables /// using the branch condition as guard. - void mergeVariables(std::set const& _variables, smt::Expression const& _condition, VariableIndices const& _indicesEndTrue, VariableIndices const& _indicesEndFalse); + void mergeVariables(std::set const& _variables, smtutil::Expression const& _condition, VariableIndices const& _indicesEndTrue, VariableIndices const& _indicesEndFalse); /// Tries to create an uninitialized variable and returns true on success. bool createVariable(VariableDeclaration const& _varDecl); /// @returns an expression denoting the value of the variable declared in @a _decl /// at the current point. - smt::Expression currentValue(VariableDeclaration const& _decl); + smtutil::Expression currentValue(VariableDeclaration const& _decl); /// @returns an expression denoting the value of the variable declared in @a _decl /// at the given index. Does not ensure that this index exists. - smt::Expression valueAtIndex(VariableDeclaration const& _decl, int _index); + smtutil::Expression valueAtIndex(VariableDeclaration const& _decl, int _index); /// Returns the expression corresponding to the AST node. /// If _targetType is not null apply conversion. /// Throws if the expression does not exist. - smt::Expression expr(Expression const& _e, TypePointer _targetType = nullptr); + smtutil::Expression expr(Expression const& _e, TypePointer _targetType = nullptr); /// Creates the expression (value can be arbitrary) void createExpr(Expression const& _e); /// Creates the expression and sets its value. - void defineExpr(Expression const& _e, smt::Expression _value); + void defineExpr(Expression const& _e, smtutil::Expression _value); /// Adds a new path condition - void pushPathCondition(smt::Expression const& _e); + void pushPathCondition(smtutil::Expression const& _e); /// Remove the last path condition void popPathCondition(); /// Returns the conjunction of all path conditions or True if empty - smt::Expression currentPathConditions(); + smtutil::Expression currentPathConditions(); /// @returns a human-readable call stack. Used for models. langutil::SecondarySourceLocation callStackMessage(std::vector const& _callStack); /// Copies and pops the last called node. @@ -217,7 +217,7 @@ class SMTEncoder: public ASTConstVisitor /// Adds (_definition, _node) to the callstack. void pushCallStack(CallStackEntry _entry); /// Add to the solver: the given expression implied by the current path conditions - void addPathImpliedExpression(smt::Expression const& _e); + void addPathImpliedExpression(smtutil::Expression const& _e); /// Copy the SSA indices of m_variables. VariableIndices copyVariableIndices(); @@ -240,7 +240,7 @@ class SMTEncoder: public ASTConstVisitor /// @returns the symbolic arguments for a function call, /// taking into account bound functions and /// type conversion. - std::vector symbolicArguments(FunctionCall const& _funCall); + std::vector symbolicArguments(FunctionCall const& _funCall); /// @returns a note to be added to warnings. std::string extraComment(); @@ -248,8 +248,8 @@ class SMTEncoder: public ASTConstVisitor struct VerificationTarget { enum class Type { ConstantCondition, Underflow, Overflow, UnderOverflow, DivByZero, Balance, Assert, PopEmptyArray } type; - smt::Expression value; - smt::Expression constraints; + smtutil::Expression value; + smtutil::Expression constraints; }; smt::VariableUsage m_variableUsage; @@ -261,7 +261,7 @@ class SMTEncoder: public ASTConstVisitor /// These may be direct application of UFs or Array index access. /// Used to retrieve models. std::set m_uninterpretedTerms; - std::vector m_pathConditions; + std::vector m_pathConditions; /// Local SMTEncoder ErrorReporter. /// This is necessary to show the "No SMT solver available" /// warning before the others in case it's needed. diff --git a/libsolidity/formal/SymbolicState.cpp b/libsolidity/formal/SymbolicState.cpp index 5ae8922fb157..1ab6e18608f0 100644 --- a/libsolidity/formal/SymbolicState.cpp +++ b/libsolidity/formal/SymbolicState.cpp @@ -20,6 +20,7 @@ #include using namespace std; +using namespace solidity; using namespace solidity::frontend::smt; SymbolicState::SymbolicState(EncodingContext& _context): @@ -35,22 +36,22 @@ void SymbolicState::reset() // Blockchain -Expression SymbolicState::thisAddress() +smtutil::Expression SymbolicState::thisAddress() { return m_thisAddress.currentValue(); } -Expression SymbolicState::balance() +smtutil::Expression SymbolicState::balance() { return balance(m_thisAddress.currentValue()); } -Expression SymbolicState::balance(Expression _address) +smtutil::Expression SymbolicState::balance(smtutil::Expression _address) { - return Expression::select(m_balances.elements(), move(_address)); + return smtutil::Expression::select(m_balances.elements(), move(_address)); } -void SymbolicState::transfer(Expression _from, Expression _to, Expression _value) +void SymbolicState::transfer(smtutil::Expression _from, smtutil::Expression _to, smtutil::Expression _value) { unsigned indexBefore = m_balances.index(); addBalance(_from, 0 - _value); @@ -59,7 +60,7 @@ void SymbolicState::transfer(Expression _from, Expression _to, Expression _value solAssert(indexAfter > indexBefore, ""); m_balances.increaseIndex(); /// Do not apply the transfer operation if _from == _to. - auto newBalances = Expression::ite( + auto newBalances = smtutil::Expression::ite( move(_from) == move(_to), m_balances.valueAtIndex(indexBefore), m_balances.valueAtIndex(indexAfter) @@ -69,9 +70,9 @@ void SymbolicState::transfer(Expression _from, Expression _to, Expression _value /// Private helpers. -void SymbolicState::addBalance(Expression _address, Expression _value) +void SymbolicState::addBalance(smtutil::Expression _address, smtutil::Expression _value) { - auto newBalances = Expression::store( + auto newBalances = smtutil::Expression::store( m_balances.elements(), _address, balance(_address) + move(_value) diff --git a/libsolidity/formal/SymbolicState.h b/libsolidity/formal/SymbolicState.h index 087ea9985c08..f33faf9f287c 100644 --- a/libsolidity/formal/SymbolicState.h +++ b/libsolidity/formal/SymbolicState.h @@ -40,18 +40,18 @@ class SymbolicState /// Blockchain. //@{ /// Value of `this` address. - Expression thisAddress(); + smtutil::Expression thisAddress(); /// @returns the symbolic balance of address `this`. - Expression balance(); + smtutil::Expression balance(); /// @returns the symbolic balance of an address. - Expression balance(Expression _address); + smtutil::Expression balance(smtutil::Expression _address); /// Transfer _value from _from to _to. - void transfer(Expression _from, Expression _to, Expression _value); + void transfer(smtutil::Expression _from, smtutil::Expression _to, smtutil::Expression _value); //@} private: /// Adds _value to _account's balance. - void addBalance(Expression _account, Expression _value); + void addBalance(smtutil::Expression _account, smtutil::Expression _value); EncodingContext& m_context; @@ -63,7 +63,7 @@ class SymbolicState /// Symbolic balances. SymbolicArrayVariable m_balances{ - std::make_shared(SortProvider::intSort, SortProvider::intSort), + std::make_shared(smtutil::SortProvider::intSort, smtutil::SortProvider::intSort), "balances", m_context }; diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index be6cc1b37e4d..bf4f38daa9f3 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -24,6 +24,7 @@ #include using namespace std; +using namespace solidity::smtutil; namespace solidity::frontend::smt { @@ -334,14 +335,14 @@ bool isStringLiteral(frontend::Type::Category _category) return _category == frontend::Type::Category::StringLiteral; } -Expression minValue(frontend::IntegerType const& _type) +smtutil::Expression minValue(frontend::IntegerType const& _type) { - return Expression(_type.minValue()); + return smtutil::Expression(_type.minValue()); } -Expression maxValue(frontend::IntegerType const& _type) +smtutil::Expression maxValue(frontend::IntegerType const& _type) { - return Expression(_type.maxValue()); + return smtutil::Expression(_type.maxValue()); } void setSymbolicZeroValue(SymbolicVariable const& _variable, EncodingContext& _context) @@ -349,13 +350,13 @@ void setSymbolicZeroValue(SymbolicVariable const& _variable, EncodingContext& _c setSymbolicZeroValue(_variable.currentValue(), _variable.type(), _context); } -void setSymbolicZeroValue(Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context) +void setSymbolicZeroValue(smtutil::Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context) { solAssert(_type, ""); _context.addAssertion(_expr == zeroValue(_type)); } -Expression zeroValue(frontend::TypePointer const& _type) +smtutil::Expression zeroValue(frontend::TypePointer const& _type) { solAssert(_type, ""); if (isSupportedType(_type->category())) @@ -363,28 +364,28 @@ Expression zeroValue(frontend::TypePointer const& _type) if (isNumber(_type->category())) return 0; if (isBool(_type->category())) - return Expression(false); + return smtutil::Expression(false); if (isArray(_type->category()) || isMapping(_type->category())) { auto tupleSort = dynamic_pointer_cast(smtSort(*_type)); solAssert(tupleSort, ""); auto sortSort = make_shared(tupleSort->components.front()); - std::optional zeroArray; + std::optional zeroArray; auto length = bigint(0); if (auto arrayType = dynamic_cast(_type)) { - zeroArray = Expression::const_array(Expression(sortSort), zeroValue(arrayType->baseType())); + zeroArray = smtutil::Expression::const_array(smtutil::Expression(sortSort), zeroValue(arrayType->baseType())); if (!arrayType->isDynamicallySized()) length = bigint(arrayType->length()); } else if (auto mappingType = dynamic_cast(_type)) - zeroArray = Expression::const_array(Expression(sortSort), zeroValue(mappingType->valueType())); + zeroArray = smtutil::Expression::const_array(smtutil::Expression(sortSort), zeroValue(mappingType->valueType())); else solAssert(false, ""); solAssert(zeroArray, ""); - return Expression::tuple_constructor(Expression(_type), vector{*zeroArray, length}); + return smtutil::Expression::tuple_constructor(smtutil::Expression(_type), vector{*zeroArray, length}); } solAssert(false, ""); @@ -398,7 +399,7 @@ void setSymbolicUnknownValue(SymbolicVariable const& _variable, EncodingContext& setSymbolicUnknownValue(_variable.currentValue(), _variable.type(), _context); } -void setSymbolicUnknownValue(Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context) +void setSymbolicUnknownValue(smtutil::Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context) { solAssert(_type, ""); if (isEnum(_type->category())) @@ -417,7 +418,7 @@ void setSymbolicUnknownValue(Expression _expr, frontend::TypePointer const& _typ } } -optional symbolicTypeConversion(TypePointer _from, TypePointer _to) +optional symbolicTypeConversion(TypePointer _from, TypePointer _to) { if (_to && _from) // StringLiterals are encoded as SMT arrays in the generic case, @@ -425,7 +426,7 @@ optional symbolicTypeConversion(TypePointer _from, TypePointer _to) // case they'd need to be encoded as numbers. if (auto strType = dynamic_cast(_from)) if (_to->category() == frontend::Type::Category::FixedBytes) - return smt::Expression(u256(toHex(util::asBytes(strType->value()), util::HexPrefix::Add))); + return smtutil::Expression(u256(toHex(util::asBytes(strType->value()), util::HexPrefix::Add))); return std::nullopt; } diff --git a/libsolidity/formal/SymbolicTypes.h b/libsolidity/formal/SymbolicTypes.h index a05d606fe53a..2e06f4c86e61 100644 --- a/libsolidity/formal/SymbolicTypes.h +++ b/libsolidity/formal/SymbolicTypes.h @@ -26,14 +26,14 @@ namespace solidity::frontend::smt { /// Returns the SMT sort that models the Solidity type _type. -SortPointer smtSort(frontend::Type const& _type); -std::vector smtSort(std::vector const& _types); +smtutil::SortPointer smtSort(frontend::Type const& _type); +std::vector smtSort(std::vector const& _types); /// If _type has type Function, abstract it to Integer. /// Otherwise return smtSort(_type). -SortPointer smtSortAbstractFunction(frontend::Type const& _type); -std::vector smtSortAbstractFunction(std::vector const& _types); +smtutil::SortPointer smtSortAbstractFunction(frontend::Type const& _type); +std::vector smtSortAbstractFunction(std::vector const& _types); /// Returns the SMT kind that models the Solidity type type category _category. -Kind smtKind(frontend::Type::Category _category); +smtutil::Kind smtKind(frontend::Type::Category _category); /// Returns true if type is fully supported (declaration and operations). bool isSupportedType(frontend::Type::Category _category); @@ -61,14 +61,14 @@ bool isStringLiteral(frontend::Type::Category _category); /// which is true for unsupported types. std::pair> newSymbolicVariable(frontend::Type const& _type, std::string const& _uniqueName, EncodingContext& _context); -Expression minValue(frontend::IntegerType const& _type); -Expression maxValue(frontend::IntegerType const& _type); -Expression zeroValue(frontend::TypePointer const& _type); +smtutil::Expression minValue(frontend::IntegerType const& _type); +smtutil::Expression maxValue(frontend::IntegerType const& _type); +smtutil::Expression zeroValue(frontend::TypePointer const& _type); void setSymbolicZeroValue(SymbolicVariable const& _variable, EncodingContext& _context); -void setSymbolicZeroValue(Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context); +void setSymbolicZeroValue(smtutil::Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context); void setSymbolicUnknownValue(SymbolicVariable const& _variable, EncodingContext& _context); -void setSymbolicUnknownValue(Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context); +void setSymbolicUnknownValue(smtutil::Expression _expr, frontend::TypePointer const& _type, EncodingContext& _context); -std::optional symbolicTypeConversion(TypePointer _from, TypePointer _to); +std::optional symbolicTypeConversion(TypePointer _from, TypePointer _to); } diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index 519588abd3b9..558e7ccd1cf2 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -22,6 +22,7 @@ using namespace std; using namespace solidity; +using namespace solidity::smtutil; using namespace solidity::frontend; using namespace solidity::frontend::smt; @@ -55,7 +56,7 @@ SymbolicVariable::SymbolicVariable( solAssert(m_sort, ""); } -smt::Expression SymbolicVariable::currentValue(frontend::TypePointer const&) const +smtutil::Expression SymbolicVariable::currentValue(frontend::TypePointer const&) const { return valueAtIndex(m_ssa->index()); } @@ -65,7 +66,7 @@ string SymbolicVariable::currentName() const return uniqueSymbol(m_ssa->index()); } -smt::Expression SymbolicVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicVariable::valueAtIndex(int _index) const { return m_context.newVariable(uniqueSymbol(_index), m_sort); } @@ -80,19 +81,19 @@ string SymbolicVariable::uniqueSymbol(unsigned _index) const return m_uniqueName + "_" + to_string(_index); } -smt::Expression SymbolicVariable::resetIndex() +smtutil::Expression SymbolicVariable::resetIndex() { m_ssa->resetIndex(); return currentValue(); } -smt::Expression SymbolicVariable::setIndex(unsigned _index) +smtutil::Expression SymbolicVariable::setIndex(unsigned _index) { m_ssa->setIndex(_index); return currentValue(); } -smt::Expression SymbolicVariable::increaseIndex() +smtutil::Expression SymbolicVariable::increaseIndex() { ++(*m_ssa); return currentValue(); @@ -159,39 +160,39 @@ SymbolicFunctionVariable::SymbolicFunctionVariable( solAssert(m_sort->kind == Kind::Function, ""); } -smt::Expression SymbolicFunctionVariable::currentValue(frontend::TypePointer const& _targetType) const +smtutil::Expression SymbolicFunctionVariable::currentValue(frontend::TypePointer const& _targetType) const { return m_abstract.currentValue(_targetType); } -smt::Expression SymbolicFunctionVariable::currentFunctionValue() const +smtutil::Expression SymbolicFunctionVariable::currentFunctionValue() const { return m_declaration; } -smt::Expression SymbolicFunctionVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicFunctionVariable::valueAtIndex(int _index) const { return m_abstract.valueAtIndex(_index); } -smt::Expression SymbolicFunctionVariable::functionValueAtIndex(int _index) const +smtutil::Expression SymbolicFunctionVariable::functionValueAtIndex(int _index) const { return SymbolicVariable::valueAtIndex(_index); } -smt::Expression SymbolicFunctionVariable::resetIndex() +smtutil::Expression SymbolicFunctionVariable::resetIndex() { SymbolicVariable::resetIndex(); return m_abstract.resetIndex(); } -smt::Expression SymbolicFunctionVariable::setIndex(unsigned _index) +smtutil::Expression SymbolicFunctionVariable::setIndex(unsigned _index) { SymbolicVariable::setIndex(_index); return m_abstract.setIndex(_index); } -smt::Expression SymbolicFunctionVariable::increaseIndex() +smtutil::Expression SymbolicFunctionVariable::increaseIndex() { ++(*m_ssa); resetDeclaration(); @@ -199,7 +200,7 @@ smt::Expression SymbolicFunctionVariable::increaseIndex() return m_abstract.currentValue(); } -smt::Expression SymbolicFunctionVariable::operator()(vector _arguments) const +smtutil::Expression SymbolicFunctionVariable::operator()(vector _arguments) const { return m_declaration(_arguments); } @@ -246,17 +247,17 @@ vector const& SymbolicTupleVariable::components() return tupleSort->components; } -smt::Expression SymbolicTupleVariable::component( +smtutil::Expression SymbolicTupleVariable::component( size_t _index, TypePointer _fromType, TypePointer _toType ) { - optional conversion = symbolicTypeConversion(_fromType, _toType); + optional conversion = symbolicTypeConversion(_fromType, _toType); if (conversion) return *conversion; - return smt::Expression::tuple_get(currentValue(), _index); + return smtutil::Expression::tuple_get(currentValue(), _index); } SymbolicArrayVariable::SymbolicArrayVariable( @@ -294,26 +295,26 @@ SymbolicArrayVariable::SymbolicArrayVariable( solAssert(m_sort->kind == Kind::Array, ""); } -smt::Expression SymbolicArrayVariable::currentValue(frontend::TypePointer const& _targetType) const +smtutil::Expression SymbolicArrayVariable::currentValue(frontend::TypePointer const& _targetType) const { - optional conversion = symbolicTypeConversion(m_originalType, _targetType); + optional conversion = symbolicTypeConversion(m_originalType, _targetType); if (conversion) return *conversion; return m_pair.currentValue(); } -smt::Expression SymbolicArrayVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicArrayVariable::valueAtIndex(int _index) const { return m_pair.valueAtIndex(_index); } -smt::Expression SymbolicArrayVariable::elements() +smtutil::Expression SymbolicArrayVariable::elements() { return m_pair.component(0); } -smt::Expression SymbolicArrayVariable::length() +smtutil::Expression SymbolicArrayVariable::length() { return m_pair.component(1); } diff --git a/libsolidity/formal/SymbolicVariables.h b/libsolidity/formal/SymbolicVariables.h index 46d3520cf791..a7c0bd1702fc 100644 --- a/libsolidity/formal/SymbolicVariables.h +++ b/libsolidity/formal/SymbolicVariables.h @@ -43,7 +43,7 @@ class SymbolicVariable EncodingContext& _context ); SymbolicVariable( - SortPointer _sort, + smtutil::SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); @@ -52,14 +52,14 @@ class SymbolicVariable virtual ~SymbolicVariable() = default; - virtual Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const; + virtual smtutil::Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const; std::string currentName() const; - virtual Expression valueAtIndex(int _index) const; + virtual smtutil::Expression valueAtIndex(int _index) const; virtual std::string nameAtIndex(int _index) const; - virtual Expression resetIndex(); - virtual Expression setIndex(unsigned _index); - virtual Expression increaseIndex(); - virtual Expression operator()(std::vector /*_arguments*/) const + virtual smtutil::Expression resetIndex(); + virtual smtutil::Expression setIndex(unsigned _index); + virtual smtutil::Expression increaseIndex(); + virtual smtutil::Expression operator()(std::vector /*_arguments*/) const { solAssert(false, "Function application to non-function."); } @@ -67,7 +67,7 @@ class SymbolicVariable unsigned index() const { return m_ssa->index(); } unsigned& index() { return m_ssa->index(); } - SortPointer const& sort() const { return m_sort; } + smtutil::SortPointer const& sort() const { return m_sort; } frontend::TypePointer const& type() const { return m_type; } frontend::TypePointer const& originalType() const { return m_originalType; } @@ -75,7 +75,7 @@ class SymbolicVariable std::string uniqueSymbol(unsigned _index) const; /// SMT sort. - SortPointer m_sort; + smtutil::SortPointer m_sort; /// Solidity type, used for size and range in number types. frontend::TypePointer m_type; /// Solidity original type, used for type conversion if necessary. @@ -155,33 +155,33 @@ class SymbolicFunctionVariable: public SymbolicVariable EncodingContext& _context ); SymbolicFunctionVariable( - SortPointer _sort, + smtutil::SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); - Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; + smtutil::Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; // Explicit request the function declaration. - Expression currentFunctionValue() const; + smtutil::Expression currentFunctionValue() const; - Expression valueAtIndex(int _index) const override; + smtutil::Expression valueAtIndex(int _index) const override; // Explicit request the function declaration. - Expression functionValueAtIndex(int _index) const; + smtutil::Expression functionValueAtIndex(int _index) const; - Expression resetIndex() override; - Expression setIndex(unsigned _index) override; - Expression increaseIndex() override; + smtutil::Expression resetIndex() override; + smtutil::Expression setIndex(unsigned _index) override; + smtutil::Expression increaseIndex() override; - Expression operator()(std::vector _arguments) const override; + smtutil::Expression operator()(std::vector _arguments) const override; private: /// Creates a new function declaration. void resetDeclaration(); /// Stores the current function declaration. - Expression m_declaration; + smtutil::Expression m_declaration; /// Abstract representation. SymbolicIntVariable m_abstract{ @@ -217,13 +217,13 @@ class SymbolicTupleVariable: public SymbolicVariable EncodingContext& _context ); SymbolicTupleVariable( - SortPointer _sort, + smtutil::SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); - std::vector const& components(); - Expression component( + std::vector const& components(); + smtutil::Expression component( size_t _index, TypePointer _fromType = nullptr, TypePointer _toType = nullptr @@ -243,22 +243,22 @@ class SymbolicArrayVariable: public SymbolicVariable EncodingContext& _context ); SymbolicArrayVariable( - SortPointer _sort, + smtutil::SortPointer _sort, std::string _uniqueName, EncodingContext& _context ); SymbolicArrayVariable(SymbolicArrayVariable&&) = default; - Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; - Expression valueAtIndex(int _index) const override; - Expression resetIndex() override { SymbolicVariable::resetIndex(); return m_pair.resetIndex(); } - Expression setIndex(unsigned _index) override { SymbolicVariable::setIndex(_index); return m_pair.setIndex(_index); } - Expression increaseIndex() override { SymbolicVariable::increaseIndex(); return m_pair.increaseIndex(); } - Expression elements(); - Expression length(); + smtutil::Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; + smtutil::Expression valueAtIndex(int _index) const override; + smtutil::Expression resetIndex() override { SymbolicVariable::resetIndex(); return m_pair.resetIndex(); } + smtutil::Expression setIndex(unsigned _index) override { SymbolicVariable::setIndex(_index); return m_pair.setIndex(_index); } + smtutil::Expression increaseIndex() override { SymbolicVariable::increaseIndex(); return m_pair.increaseIndex(); } + smtutil::Expression elements(); + smtutil::Expression length(); - SortPointer tupleSort() { return m_pair.sort(); } + smtutil::SortPointer tupleSort() { return m_pair.sort(); } private: SymbolicTupleVariable m_pair; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 558c262d0c23..cf67d2d7e981 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -82,7 +82,7 @@ static int g_compilerStackCounts = 0; CompilerStack::CompilerStack(ReadCallback::Callback _readFile): m_readFile{std::move(_readFile)}, - m_enabledSMTSolvers{smt::SMTSolverChoice::All()}, + m_enabledSMTSolvers{smtutil::SMTSolverChoice::All()}, m_generateIR{false}, m_generateEwasm{false}, m_errorList{}, @@ -136,7 +136,7 @@ void CompilerStack::setEVMVersion(langutil::EVMVersion _version) m_evmVersion = _version; } -void CompilerStack::setSMTSolverChoice(smt::SMTSolverChoice _enabledSMTSolvers) +void CompilerStack::setSMTSolverChoice(smtutil::SMTSolverChoice _enabledSMTSolvers) { if (m_stackState >= ParsingPerformed) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Must set enabled SMT solvers before parsing.")); @@ -205,7 +205,7 @@ void CompilerStack::reset(bool _keepSettings) m_remappings.clear(); m_libraries.clear(); m_evmVersion = langutil::EVMVersion(); - m_enabledSMTSolvers = smt::SMTSolverChoice::All(); + m_enabledSMTSolvers = smtutil::SMTSolverChoice::All(); m_generateIR = false; m_generateEwasm = false; m_revertStrings = RevertStrings::Default; diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index fbd32b382ce0..bbf68f22556a 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -164,7 +164,7 @@ class CompilerStack: boost::noncopyable void setEVMVersion(langutil::EVMVersion _version = langutil::EVMVersion{}); /// Set which SMT solvers should be enabled. - void setSMTSolverChoice(smt::SMTSolverChoice _enabledSolvers); + void setSMTSolverChoice(smtutil::SMTSolverChoice _enabledSolvers); /// Sets the requested contract names by source. /// If empty, no filtering is performed and every contract @@ -434,7 +434,7 @@ class CompilerStack: boost::noncopyable OptimiserSettings m_optimiserSettings; RevertStrings m_revertStrings = RevertStrings::Default; langutil::EVMVersion m_evmVersion; - smt::SMTSolverChoice m_enabledSMTSolvers; + smtutil::SMTSolverChoice m_enabledSMTSolvers; std::map> m_requestedContractNames; bool m_generateIR; bool m_generateEwasm; diff --git a/test/libsolidity/SMTCheckerTest.cpp b/test/libsolidity/SMTCheckerTest.cpp index 28c98ffab3a6..7daa6f182298 100644 --- a/test/libsolidity/SMTCheckerTest.cpp +++ b/test/libsolidity/SMTCheckerTest.cpp @@ -30,13 +30,13 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion _ev { auto const& choice = m_reader.stringSetting("SMTSolvers", "any"); if (choice == "any") - m_enabledSolvers = smt::SMTSolverChoice::All(); + m_enabledSolvers = smtutil::SMTSolverChoice::All(); else if (choice == "z3") - m_enabledSolvers = smt::SMTSolverChoice::Z3(); + m_enabledSolvers = smtutil::SMTSolverChoice::Z3(); else if (choice == "cvc4") - m_enabledSolvers = smt::SMTSolverChoice::CVC4(); + m_enabledSolvers = smtutil::SMTSolverChoice::CVC4(); else if (choice == "none") - m_enabledSolvers = smt::SMTSolverChoice::None(); + m_enabledSolvers = smtutil::SMTSolverChoice::None(); else BOOST_THROW_EXCEPTION(runtime_error("Invalid SMT solver choice.")); diff --git a/test/libsolidity/SMTCheckerTest.h b/test/libsolidity/SMTCheckerTest.h index 674564f5734c..34f526cd9b83 100644 --- a/test/libsolidity/SMTCheckerTest.h +++ b/test/libsolidity/SMTCheckerTest.h @@ -41,7 +41,7 @@ class SMTCheckerTest: public SyntaxTest /// This is set via option SMTSolvers in the test. /// The possible options are `all`, `z3`, `cvc4`, `none`, /// where if none is given the default used option is `all`. - smt::SMTSolverChoice m_enabledSolvers; + smtutil::SMTSolverChoice m_enabledSolvers; }; } From 7a91c9b971ad8d2bb67aaa00374abeb4acda39f4 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 19 May 2020 14:23:41 +0200 Subject: [PATCH 086/479] Remove Type from SolverInterface --- libsmtutil/SolverInterface.h | 7 +------ libsolidity/formal/SMTEncoder.cpp | 3 ++- libsolidity/formal/SymbolicTypes.cpp | 5 ++++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index 260dcc7a7787..0dd8e5bcd1a4 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -19,7 +19,6 @@ #include -#include #include #include #include @@ -54,17 +53,13 @@ enum class CheckResult SATISFIABLE, UNSATISFIABLE, UNKNOWN, CONFLICTING, ERROR }; -// Forward declaration. -SortPointer smtSort(frontend::Type const& _type); - /// C++ representation of an SMTLIB2 expression. class Expression { friend class SolverInterface; public: explicit Expression(bool _v): Expression(_v ? "true" : "false", Kind::Bool) {} - explicit Expression(frontend::TypePointer _type): Expression(_type->toString(true), {}, std::make_shared(smtSort(*_type))) {} - explicit Expression(std::shared_ptr _sort): Expression("", {}, _sort) {} + explicit Expression(std::shared_ptr _sort, std::string _name = ""): Expression(std::move(_name), {}, _sort) {} Expression(size_t _number): Expression(std::to_string(_number), Kind::Int) {} Expression(u256 const& _number): Expression(_number.str(), Kind::Int) {} Expression(s256 const& _number): Expression(_number.str(), Kind::Int) {} diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index afaf8ea7e528..a8e0e32b74d2 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1061,8 +1061,9 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smtutil::Expressi { auto symbArray = dynamic_pointer_cast(m_context.expression(*base)); solAssert(symbArray, ""); + auto baseType = base->annotation().type; toStore = smtutil::Expression::tuple_constructor( - smtutil::Expression(base->annotation().type), + smtutil::Expression(make_shared(smt::smtSort(*baseType)), baseType->toString(true)), {smtutil::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()} ); indexAccess = base; diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index bf4f38daa9f3..38f72cb66131 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -385,7 +385,10 @@ smtutil::Expression zeroValue(frontend::TypePointer const& _type) solAssert(false, ""); solAssert(zeroArray, ""); - return smtutil::Expression::tuple_constructor(smtutil::Expression(_type), vector{*zeroArray, length}); + return smtutil::Expression::tuple_constructor( + smtutil::Expression(std::make_shared(smtSort(*_type)), _type->toString(true)), + vector{*zeroArray, length} + ); } solAssert(false, ""); From 25de3975ce6747c249bcabdbc4aeae37184f1579 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 19 May 2020 14:52:31 +0200 Subject: [PATCH 087/479] Add SMTLogicException --- libsmtutil/CHCSmtLib2Interface.cpp | 12 +++---- libsmtutil/CMakeLists.txt | 1 + libsmtutil/CVC4Interface.cpp | 35 ++++++++++---------- libsmtutil/Exceptions.h | 31 ++++++++++++++++++ libsmtutil/SMTLib2Interface.cpp | 30 +++++++++--------- libsmtutil/SMTLib2Interface.h | 2 +- libsmtutil/SMTPortfolio.cpp | 6 ++-- libsmtutil/SolverInterface.h | 51 +++++++++++++++--------------- libsmtutil/Sorts.h | 28 ++++++++-------- libsmtutil/Z3CHCInterface.cpp | 3 +- libsmtutil/Z3Interface.cpp | 27 ++++++++-------- 11 files changed, 127 insertions(+), 99 deletions(-) create mode 100644 libsmtutil/Exceptions.h diff --git a/libsmtutil/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp index 960e75eadca0..8116ea2a26ce 100644 --- a/libsmtutil/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -53,8 +53,8 @@ void CHCSmtLib2Interface::reset() void CHCSmtLib2Interface::registerRelation(Expression const& _expr) { - solAssert(_expr.sort, ""); - solAssert(_expr.sort->kind == Kind::Function, ""); + smtAssert(_expr.sort, ""); + smtAssert(_expr.sort->kind == Kind::Function, ""); if (!m_variables.count(_expr.name)) { auto fSort = dynamic_pointer_cast(_expr.sort); @@ -112,7 +112,7 @@ pair> CHCSmtLib2Interface::query(Expression const& _ void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); if (_sort->kind == Kind::Function) declareFunction(_name, _sort); else if (!m_variables.count(_name)) @@ -124,13 +124,13 @@ void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const void CHCSmtLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); - solAssert(_sort->kind == Kind::Function, ""); + smtAssert(_sort, ""); + smtAssert(_sort->kind == Kind::Function, ""); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { auto fSort = dynamic_pointer_cast(_sort); - solAssert(fSort->codomain, ""); + smtAssert(fSort->codomain, ""); string domain = m_smtlib2->toSmtLibSort(fSort->domain); string codomain = m_smtlib2->toSmtLibSort(*fSort->codomain); m_variables.insert(_name); diff --git a/libsmtutil/CMakeLists.txt b/libsmtutil/CMakeLists.txt index e46b80df6d35..62b52f5c6f09 100644 --- a/libsmtutil/CMakeLists.txt +++ b/libsmtutil/CMakeLists.txt @@ -1,6 +1,7 @@ set(sources CHCSmtLib2Interface.cpp CHCSmtLib2Interface.h + Exceptions.h SMTLib2Interface.cpp SMTLib2Interface.h SMTPortfolio.cpp diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 3a678429add6..4c1ef378a7f6 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -17,7 +17,6 @@ #include -#include #include using namespace std; @@ -51,7 +50,7 @@ void CVC4Interface::pop() void CVC4Interface::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); m_variables[_name] = m_context.mkVar(_name.c_str(), cvc4Sort(*_sort)); } @@ -63,19 +62,19 @@ void CVC4Interface::addAssertion(Expression const& _expr) } catch (CVC4::TypeCheckingException const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } catch (CVC4::LogicException const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } catch (CVC4::UnsafeInterruptException const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } catch (CVC4::Exception const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } } @@ -97,7 +96,7 @@ pair> CVC4Interface::check(vector const& result = CheckResult::UNKNOWN; break; default: - solAssert(false, ""); + smtAssert(false, ""); } if (result == CheckResult::SATISFIABLE && !_expressionsToEvaluate.empty()) @@ -147,15 +146,15 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) } catch (CVC4::TypeCheckingException const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } catch (CVC4::Exception const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } } - solAssert(_expr.hasCorrectArity(), ""); + smtAssert(_expr.hasCorrectArity(), ""); if (n == "ite") return arguments[0].iteExpr(arguments[1], arguments[2]); else if (n == "not") @@ -193,13 +192,13 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) else if (n == "const_array") { shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); - solAssert(sortSort, ""); + smtAssert(sortSort, ""); return m_context.mkConst(CVC4::ArrayStoreAll(cvc4Sort(*sortSort->inner), arguments[1])); } else if (n == "tuple_get") { shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); - solAssert(tupleSort, ""); + smtAssert(tupleSort, ""); CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); CVC4::Datatype const& dt = tt.getDatatype(); size_t index = std::stoi(_expr.arguments[1].name); @@ -209,25 +208,25 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) else if (n == "tuple_constructor") { shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.sort); - solAssert(tupleSort, ""); + smtAssert(tupleSort, ""); CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); CVC4::Datatype const& dt = tt.getDatatype(); CVC4::Expr c = dt[0].getConstructor(); return m_context.mkExpr(CVC4::kind::APPLY_CONSTRUCTOR, c, arguments); } - solAssert(false, ""); + smtAssert(false, ""); } catch (CVC4::TypeCheckingException const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } catch (CVC4::Exception const& _e) { - solAssert(false, _e.what()); + smtAssert(false, _e.what()); } - solAssert(false, ""); + smtAssert(false, ""); } CVC4::Type CVC4Interface::cvc4Sort(Sort const& _sort) @@ -256,7 +255,7 @@ CVC4::Type CVC4Interface::cvc4Sort(Sort const& _sort) default: break; } - solAssert(false, ""); + smtAssert(false, ""); // Cannot be reached. return m_context.integerType(); } diff --git a/libsmtutil/Exceptions.h b/libsmtutil/Exceptions.h new file mode 100644 index 000000000000..6321c4f6a647 --- /dev/null +++ b/libsmtutil/Exceptions.h @@ -0,0 +1,31 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ + +#pragma once + +#include +#include + +namespace solidity::smtutil +{ + +struct SMTLogicError: virtual util::Exception {}; + +#define smtAssert(CONDITION, DESCRIPTION) \ + assertThrow(CONDITION, SMTLogicError, DESCRIPTION) + +} diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index a9083a29156e..4e81444fef00 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -63,13 +63,13 @@ void SMTLib2Interface::push() void SMTLib2Interface::pop() { - solAssert(!m_accumulatedOutput.empty(), ""); + smtAssert(!m_accumulatedOutput.empty(), ""); m_accumulatedOutput.pop_back(); } void SMTLib2Interface::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); if (_sort->kind == Kind::Function) declareFunction(_name, _sort); else if (!m_variables.count(_name)) @@ -81,8 +81,8 @@ void SMTLib2Interface::declareVariable(string const& _name, SortPointer const& _ void SMTLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); - solAssert(_sort->kind == Kind::Function, ""); + smtAssert(_sort, ""); + smtAssert(_sort->kind == Kind::Function, ""); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { @@ -139,26 +139,26 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) std::string sexpr = "("; if (_expr.name == "const_array") { - solAssert(_expr.arguments.size() == 2, ""); + smtAssert(_expr.arguments.size() == 2, ""); auto sortSort = std::dynamic_pointer_cast(_expr.arguments.at(0).sort); - solAssert(sortSort, ""); + smtAssert(sortSort, ""); auto arraySort = dynamic_pointer_cast(sortSort->inner); - solAssert(arraySort, ""); + smtAssert(arraySort, ""); sexpr += "(as const " + toSmtLibSort(*arraySort) + ") "; sexpr += toSExpr(_expr.arguments.at(1)); } else if (_expr.name == "tuple_get") { - solAssert(_expr.arguments.size() == 2, ""); + smtAssert(_expr.arguments.size() == 2, ""); auto tupleSort = dynamic_pointer_cast(_expr.arguments.at(0).sort); unsigned index = std::stoi(_expr.arguments.at(1).name); - solAssert(index < tupleSort->members.size(), ""); + smtAssert(index < tupleSort->members.size(), ""); sexpr += "|" + tupleSort->members.at(index) + "| " + toSExpr(_expr.arguments.at(0)); } else if (_expr.name == "tuple_constructor") { auto tupleSort = dynamic_pointer_cast(_expr.sort); - solAssert(tupleSort, ""); + smtAssert(tupleSort, ""); sexpr += "|" + tupleSort->name + "|"; for (auto const& arg: _expr.arguments) sexpr += " " + toSExpr(arg); @@ -184,7 +184,7 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) case Kind::Array: { auto const& arraySort = dynamic_cast(_sort); - solAssert(arraySort.domain && arraySort.range, ""); + smtAssert(arraySort.domain && arraySort.range, ""); return "(Array " + toSmtLibSort(*arraySort.domain) + ' ' + toSmtLibSort(*arraySort.range) + ')'; } case Kind::Tuple: @@ -195,7 +195,7 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) { m_userSorts.insert(tupleName); string decl("(declare-datatypes ((" + tupleName + " 0)) (((" + tupleName); - solAssert(tupleSort.members.size() == tupleSort.components.size(), ""); + smtAssert(tupleSort.members.size() == tupleSort.components.size(), ""); for (unsigned i = 0; i < tupleSort.members.size(); ++i) decl += " (|" + tupleSort.members.at(i) + "| " + toSmtLibSort(*tupleSort.components.at(i)) + ")"; decl += "))))"; @@ -205,7 +205,7 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) return tupleName; } default: - solAssert(false, "Invalid SMT sort"); + smtAssert(false, "Invalid SMT sort"); } } @@ -220,7 +220,7 @@ string SMTLib2Interface::toSmtLibSort(vector const& _sorts) void SMTLib2Interface::write(string _data) { - solAssert(!m_accumulatedOutput.empty(), ""); + smtAssert(!m_accumulatedOutput.empty(), ""); m_accumulatedOutput.back() += move(_data) + "\n"; } @@ -235,7 +235,7 @@ string SMTLib2Interface::checkSatAndGetValuesCommand(vector const& _ for (size_t i = 0; i < _expressionsToEvaluate.size(); i++) { auto const& e = _expressionsToEvaluate.at(i); - solAssert(e.sort->kind == Kind::Int || e.sort->kind == Kind::Bool, "Invalid sort for expression to evaluate."); + smtAssert(e.sort->kind == Kind::Int || e.sort->kind == Kind::Bool, "Invalid sort for expression to evaluate."); command += "(declare-const |EVALEXPR_" + to_string(i) + "| " + (e.sort->kind == Kind::Int ? "Int" : "Bool") + ")\n"; command += "(assert (= |EVALEXPR_" + to_string(i) + "| " + toSExpr(e) + "))\n"; } diff --git a/libsmtutil/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h index 6d97adac22b3..dfb32a959bc4 100644 --- a/libsmtutil/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -20,7 +20,7 @@ #include #include -#include + #include #include diff --git a/libsmtutil/SMTPortfolio.cpp b/libsmtutil/SMTPortfolio.cpp index dc7e69fa103c..80c1a47506bb 100644 --- a/libsmtutil/SMTPortfolio.cpp +++ b/libsmtutil/SMTPortfolio.cpp @@ -68,7 +68,7 @@ void SMTPortfolio::pop() void SMTPortfolio::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); for (auto const& s: m_solvers) s->declareVariable(_name, _sort); } @@ -141,8 +141,8 @@ vector SMTPortfolio::unhandledQueries() { // This code assumes that the constructor guarantees that // SmtLib2Interface is in position 0. - solAssert(!m_solvers.empty(), ""); - solAssert(dynamic_cast(m_solvers.front().get()), ""); + smtAssert(!m_solvers.empty(), ""); + smtAssert(dynamic_cast(m_solvers.front().get()), ""); return m_solvers.front()->unhandledQueries(); } diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index 0dd8e5bcd1a4..13fcae4f2d39 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -17,11 +17,10 @@ #pragma once +#include #include -#include #include -#include #include #include @@ -75,7 +74,7 @@ class Expression if (name == "tuple_constructor") { auto tupleSort = std::dynamic_pointer_cast(sort); - solAssert(tupleSort, ""); + smtAssert(tupleSort, ""); return arguments.size() == tupleSort->components.size(); } @@ -105,7 +104,7 @@ class Expression static Expression ite(Expression _condition, Expression _trueValue, Expression _falseValue) { - solAssert(*_trueValue.sort == *_falseValue.sort, ""); + smtAssert(*_trueValue.sort == *_falseValue.sort, ""); SortPointer sort = _trueValue.sort; return Expression("ite", std::vector{ std::move(_condition), std::move(_trueValue), std::move(_falseValue) @@ -125,11 +124,11 @@ class Expression /// select is the SMT representation of an array index access. static Expression select(Expression _array, Expression _index) { - solAssert(_array.sort->kind == Kind::Array, ""); + smtAssert(_array.sort->kind == Kind::Array, ""); std::shared_ptr arraySort = std::dynamic_pointer_cast(_array.sort); - solAssert(arraySort, ""); - solAssert(_index.sort, ""); - solAssert(*arraySort->domain == *_index.sort, ""); + smtAssert(arraySort, ""); + smtAssert(_index.sort, ""); + smtAssert(*arraySort->domain == *_index.sort, ""); return Expression( "select", std::vector{std::move(_array), std::move(_index)}, @@ -142,11 +141,11 @@ class Expression static Expression store(Expression _array, Expression _index, Expression _element) { auto arraySort = std::dynamic_pointer_cast(_array.sort); - solAssert(arraySort, ""); - solAssert(_index.sort, ""); - solAssert(_element.sort, ""); - solAssert(*arraySort->domain == *_index.sort, ""); - solAssert(*arraySort->range == *_element.sort, ""); + smtAssert(arraySort, ""); + smtAssert(_index.sort, ""); + smtAssert(_element.sort, ""); + smtAssert(*arraySort->domain == *_index.sort, ""); + smtAssert(*arraySort->range == *_element.sort, ""); return Expression( "store", std::vector{std::move(_array), std::move(_index), std::move(_element)}, @@ -156,12 +155,12 @@ class Expression static Expression const_array(Expression _sort, Expression _value) { - solAssert(_sort.sort->kind == Kind::Sort, ""); + smtAssert(_sort.sort->kind == Kind::Sort, ""); auto sortSort = std::dynamic_pointer_cast(_sort.sort); auto arraySort = std::dynamic_pointer_cast(sortSort->inner); - solAssert(sortSort && arraySort, ""); - solAssert(_value.sort, ""); - solAssert(*arraySort->range == *_value.sort, ""); + smtAssert(sortSort && arraySort, ""); + smtAssert(_value.sort, ""); + smtAssert(*arraySort->range == *_value.sort, ""); return Expression( "const_array", std::vector{std::move(_sort), std::move(_value)}, @@ -171,10 +170,10 @@ class Expression static Expression tuple_get(Expression _tuple, size_t _index) { - solAssert(_tuple.sort->kind == Kind::Tuple, ""); + smtAssert(_tuple.sort->kind == Kind::Tuple, ""); std::shared_ptr tupleSort = std::dynamic_pointer_cast(_tuple.sort); - solAssert(tupleSort, ""); - solAssert(_index < tupleSort->components.size(), ""); + smtAssert(tupleSort, ""); + smtAssert(_index < tupleSort->components.size(), ""); return Expression( "tuple_get", std::vector{std::move(_tuple), Expression(_index)}, @@ -184,11 +183,11 @@ class Expression static Expression tuple_constructor(Expression _tuple, std::vector _arguments) { - solAssert(_tuple.sort->kind == Kind::Sort, ""); + smtAssert(_tuple.sort->kind == Kind::Sort, ""); auto sortSort = std::dynamic_pointer_cast(_tuple.sort); auto tupleSort = std::dynamic_pointer_cast(sortSort->inner); - solAssert(tupleSort, ""); - solAssert(_arguments.size() == tupleSort->components.size(), ""); + smtAssert(tupleSort, ""); + smtAssert(_arguments.size() == tupleSort->components.size(), ""); return Expression( "tuple_constructor", std::move(_arguments), @@ -254,12 +253,12 @@ class Expression } Expression operator()(std::vector _arguments) const { - solAssert( + smtAssert( sort->kind == Kind::Function, "Attempted function application to non-function." ); auto fSort = dynamic_cast(sort.get()); - solAssert(fSort, ""); + smtAssert(fSort, ""); return Expression(name, std::move(_arguments), fSort->codomain); } @@ -297,7 +296,7 @@ class SolverInterface Expression newVariable(std::string _name, SortPointer const& _sort) { // Subclasses should do something here - solAssert(_sort, ""); + smtAssert(_sort, ""); declareVariable(_name, _sort); return Expression(std::move(_name), {}, _sort); } diff --git a/libsmtutil/Sorts.h b/libsmtutil/Sorts.h index 903db1907ce7..228dd057baa3 100644 --- a/libsmtutil/Sorts.h +++ b/libsmtutil/Sorts.h @@ -17,9 +17,9 @@ #pragma once -#include +#include + #include -#include #include #include @@ -57,7 +57,7 @@ struct FunctionSort: public Sort if (!Sort::operator==(_other)) return false; auto _otherFunction = dynamic_cast(&_other); - solAssert(_otherFunction, ""); + smtAssert(_otherFunction, ""); if (domain.size() != _otherFunction->domain.size()) return false; if (!std::equal( @@ -67,8 +67,8 @@ struct FunctionSort: public Sort [&](SortPointer _a, SortPointer _b) { return *_a == *_b; } )) return false; - solAssert(codomain, ""); - solAssert(_otherFunction->codomain, ""); + smtAssert(codomain, ""); + smtAssert(_otherFunction->codomain, ""); return *codomain == *_otherFunction->codomain; } @@ -87,11 +87,11 @@ struct ArraySort: public Sort if (!Sort::operator==(_other)) return false; auto _otherArray = dynamic_cast(&_other); - solAssert(_otherArray, ""); - solAssert(_otherArray->domain, ""); - solAssert(_otherArray->range, ""); - solAssert(domain, ""); - solAssert(range, ""); + smtAssert(_otherArray, ""); + smtAssert(_otherArray->domain, ""); + smtAssert(_otherArray->range, ""); + smtAssert(domain, ""); + smtAssert(range, ""); return *domain == *_otherArray->domain && *range == *_otherArray->range; } @@ -107,9 +107,9 @@ struct SortSort: public Sort if (!Sort::operator==(_other)) return false; auto _otherSort = dynamic_cast(&_other); - solAssert(_otherSort, ""); - solAssert(_otherSort->inner, ""); - solAssert(inner, ""); + smtAssert(_otherSort, ""); + smtAssert(_otherSort->inner, ""); + smtAssert(inner, ""); return *inner == *_otherSort->inner; } @@ -134,7 +134,7 @@ struct TupleSort: public Sort if (!Sort::operator==(_other)) return false; auto _otherTuple = dynamic_cast(&_other); - solAssert(_otherTuple, ""); + smtAssert(_otherTuple, ""); if (name != _otherTuple->name) return false; if (members != _otherTuple->members) diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index 8346ea647d0a..d2bce2f1c6dd 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -17,7 +17,6 @@ #include -#include #include using namespace std; @@ -48,7 +47,7 @@ Z3CHCInterface::Z3CHCInterface(): void Z3CHCInterface::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); m_z3Interface->declareVariable(_name, _sort); } diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index 3c4ea16ed1f8..b42bc4765819 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -17,7 +17,6 @@ #include -#include #include using namespace std; @@ -50,7 +49,7 @@ void Z3Interface::pop() void Z3Interface::declareVariable(string const& _name, SortPointer const& _sort) { - solAssert(_sort, ""); + smtAssert(_sort, ""); if (_sort->kind == Kind::Function) declareFunction(_name, *_sort); else if (m_constants.count(_name)) @@ -61,7 +60,7 @@ void Z3Interface::declareVariable(string const& _name, SortPointer const& _sort) void Z3Interface::declareFunction(string const& _name, Sort const& _sort) { - solAssert(_sort.kind == Kind::Function, ""); + smtAssert(_sort.kind == Kind::Function, ""); FunctionSort fSort = dynamic_cast(_sort); if (m_functions.count(_name)) m_functions.at(_name) = m_context.function(_name.c_str(), z3Sort(fSort.domain), z3Sort(*fSort.codomain)); @@ -124,7 +123,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) return m_functions.at(n)(arguments); else if (m_constants.count(n)) { - solAssert(arguments.empty(), ""); + smtAssert(arguments.empty(), ""); return m_constants.at(n); } else if (arguments.empty()) @@ -136,7 +135,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) else if (_expr.sort->kind == Kind::Sort) { auto sortSort = dynamic_pointer_cast(_expr.sort); - solAssert(sortSort, ""); + smtAssert(sortSort, ""); return m_context.constant(n.c_str(), z3Sort(*sortSort->inner)); } else @@ -146,11 +145,11 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) } catch (z3::exception const& _e) { - solAssert(false, _e.msg()); + smtAssert(false, _e.msg()); } } - solAssert(_expr.hasCorrectArity(), ""); + smtAssert(_expr.hasCorrectArity(), ""); if (n == "ite") return z3::ite(arguments[0], arguments[1], arguments[2]); else if (n == "not") @@ -188,9 +187,9 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) else if (n == "const_array") { shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); - solAssert(sortSort, ""); + smtAssert(sortSort, ""); auto arraySort = dynamic_pointer_cast(sortSort->inner); - solAssert(arraySort && arraySort->domain, ""); + smtAssert(arraySort && arraySort->domain, ""); return z3::const_array(z3Sort(*arraySort->domain), arguments[1]); } else if (n == "tuple_get") @@ -201,21 +200,21 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) else if (n == "tuple_constructor") { auto constructor = z3::func_decl(m_context, Z3_get_tuple_sort_mk_decl(m_context, z3Sort(*_expr.sort))); - solAssert(constructor.arity() == arguments.size(), ""); + smtAssert(constructor.arity() == arguments.size(), ""); z3::expr_vector args(m_context); for (auto const& arg: arguments) args.push_back(arg); return constructor(args); } - solAssert(false, ""); + smtAssert(false, ""); } catch (z3::exception const& _e) { - solAssert(false, _e.msg()); + smtAssert(false, _e.msg()); } - solAssert(false, ""); + smtAssert(false, ""); } z3::sort Z3Interface::z3Sort(Sort const& _sort) @@ -256,7 +255,7 @@ z3::sort Z3Interface::z3Sort(Sort const& _sort) default: break; } - solAssert(false, ""); + smtAssert(false, ""); // Cannot be reached. return m_context.int_sort(); } From 6c6a8a74e8700478b6348423da063ccf99538eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 14 May 2020 20:34:59 +0200 Subject: [PATCH 088/479] IRGenerationContext: Extract code for enumerating dispatchable functions from generateInternalDispatch() into a separate function --- .../codegen/ir/IRGenerationContext.cpp | 61 ++++++++++++------- libsolidity/codegen/ir/IRGenerationContext.h | 2 + 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 313aff40d969..3fa40327249a 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -144,29 +144,27 @@ string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _ar templ("assignment_op", _arity.out > 0 ? ":=" : ""); templ("out", suffixedVariableNameList("out_", 0, _arity.out)); - // UNIMPLEMENTED: Internal library calls via pointers are not implemented yet. - // We're not generating code for internal library functions here even though it's possible - // to call them via pointers. Right now such calls end up triggering the `default` case in - // the switch above. - vector> functions; - for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts) - for (FunctionDefinition const* function: contract->definedFunctions()) - if ( - !function->isConstructor() && - YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity - ) - { - // 0 is reserved for uninitialized function pointers - solAssert(function->id() != 0, "Unexpected function ID: 0"); - - functions.emplace_back(map { - { "funID", to_string(function->id()) }, - { "name", IRNames::function(*function)} - }); - - enqueueFunctionForCodeGeneration(*function); - } - templ("cases", move(functions)); + vector> cases; + for (FunctionDefinition const* function: collectFunctionsOfArity(_arity)) + { + solAssert(function, ""); + solAssert( + YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity, + "A single dispatch function can only handle functions of one arity" + ); + solAssert(!function->isConstructor(), ""); + // 0 is reserved for uninitialized function pointers + solAssert(function->id() != 0, "Unexpected function ID: 0"); + + cases.emplace_back(map{ + {"funID", to_string(function->id())}, + {"name", IRNames::function(*function)} + }); + + enqueueFunctionForCodeGeneration(*function); + } + + templ("cases", move(cases)); return templ.render(); }); } @@ -186,3 +184,20 @@ std::string IRGenerationContext::revertReasonIfDebug(std::string const& _message return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message); } +set IRGenerationContext::collectFunctionsOfArity(YulArity const& _arity) +{ + // UNIMPLEMENTED: Internal library calls via pointers are not implemented yet. + // We're not returning any internal library functions here even though it's possible + // to call them via pointers. Right now such calls end will up triggering the `default` case in + // the switch in the generated dispatch function. + set functions; + for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts) + for (FunctionDefinition const* function: contract->definedFunctions()) + if ( + !function->isConstructor() && + YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity + ) + functions.insert(function); + + return functions; +} diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 42cdddcb0bc9..30aa5e2205a9 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -120,6 +120,8 @@ class IRGenerationContext std::set& subObjectsCreated() { return m_subObjects; } private: + std::set collectFunctionsOfArity(YulArity const& _arity); + langutil::EVMVersion m_evmVersion; RevertStrings m_revertStrings; OptimiserSettings m_optimiserSettings; From 0eb067ae4fec6af4faa2a73bdbf2f36b93bd54e0 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 20 May 2020 12:55:12 +0200 Subject: [PATCH 089/479] Add SMTLogicError exception catches --- libsolidity/interface/StandardCompiler.cpp | 11 +++++++++++ solc/CommandLineInterface.cpp | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 6cf13c309849..feda8fc53f99 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -921,6 +922,16 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting "Yul exception" )); } + catch (smtutil::SMTLogicError const& _exception) + { + errors.append(formatErrorWithException( + _exception, + false, + "SMTLogicException", + "general", + "SMT logic exception" + )); + } catch (util::Exception const& _exception) { errors.append(formatError( diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 1342ef1f6daa..cd792d9c085b 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -47,6 +47,8 @@ #include #include +#include + #include #include #include @@ -1295,6 +1297,14 @@ bool CommandLineInterface::processInput() boost::diagnostic_information(_exception); return false; } + catch (smtutil::SMTLogicError const& _exception) + { + serr() << + "SMT logic error during analysis:" << + endl << + boost::diagnostic_information(_exception); + return false; + } catch (Error const& _error) { if (_error.type() == Error::Type::DocstringParsingError) From 4a001d568eb5614e6fefbcce42ffcbf82f0b8960 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Mon, 27 Apr 2020 13:58:54 +0530 Subject: [PATCH 090/479] Removed null members from JSON output --- Changelog.md | 1 + libsolidity/ast/ASTJsonConverter.cpp | 2 +- libsolidity/ast/ASTJsonImporter.cpp | 3 +- libsolidity/ast/AsmJsonImporter.cpp | 3 +- libsolutil/JSON.cpp | 23 +++++++++++ libsolutil/JSON.h | 3 ++ solc/CommandLineInterface.cpp | 17 ++++---- .../recovery_ast_constructor/output | 9 ---- .../ASTJSON/abstract_contract.json | 4 -- .../ASTJSON/abstract_contract_legacy.json | 6 +-- test/libsolidity/ASTJSON/address_payable.json | 41 +------------------ .../ASTJSON/address_payable_legacy.json | 37 ++--------------- test/libsolidity/ASTJSON/array_type_name.json | 5 --- .../ASTJSON/array_type_name_legacy.json | 7 +--- test/libsolidity/ASTJSON/assembly/call.json | 4 -- .../ASTJSON/assembly/call_legacy.json | 6 +-- .../ASTJSON/assembly/empty_block.json | 4 -- .../ASTJSON/assembly/empty_block_legacy.json | 6 +-- .../ASTJSON/assembly/function.json | 4 -- .../ASTJSON/assembly/function_legacy.json | 6 +-- test/libsolidity/ASTJSON/assembly/leave.json | 4 -- .../ASTJSON/assembly/leave_legacy.json | 6 +-- test/libsolidity/ASTJSON/assembly/loop.json | 4 -- .../ASTJSON/assembly/loop_legacy.json | 6 +-- .../ASTJSON/assembly/nested_functions.json | 18 +------- .../assembly/nested_functions_legacy.json | 12 +----- .../ASTJSON/assembly/slot_offset.json | 9 ---- .../ASTJSON/assembly/slot_offset_legacy.json | 11 +---- .../ASTJSON/assembly/stringlit.json | 4 -- .../ASTJSON/assembly/stringlit_legacy.json | 6 +-- test/libsolidity/ASTJSON/assembly/switch.json | 4 -- .../ASTJSON/assembly/switch_default.json | 4 -- .../assembly/switch_default_legacy.json | 6 +-- .../ASTJSON/assembly/switch_legacy.json | 6 +-- .../ASTJSON/assembly/var_access.json | 7 ---- .../ASTJSON/assembly/var_access_legacy.json | 11 +---- test/libsolidity/ASTJSON/constructor.json | 4 -- .../ASTJSON/constructor_legacy.json | 6 +-- .../ASTJSON/contract_dep_order.json | 14 ------- .../ASTJSON/contract_dep_order_legacy.json | 32 +++------------ test/libsolidity/ASTJSON/documentation.json | 6 --- .../ASTJSON/documentation_legacy.json | 6 +-- test/libsolidity/ASTJSON/enum_value.json | 2 - .../ASTJSON/enum_value_legacy.json | 4 +- .../libsolidity/ASTJSON/event_definition.json | 3 -- .../ASTJSON/event_definition_legacy.json | 5 +-- test/libsolidity/ASTJSON/fallback.json | 4 -- .../ASTJSON/fallback_and_reveice_ether.json | 6 --- .../fallback_and_reveice_ether_legacy.json | 8 +--- test/libsolidity/ASTJSON/fallback_legacy.json | 6 +-- .../libsolidity/ASTJSON/fallback_payable.json | 4 -- .../ASTJSON/fallback_payable_legacy.json | 6 +-- test/libsolidity/ASTJSON/function_type.json | 12 ------ .../ASTJSON/function_type_legacy.json | 14 +------ test/libsolidity/ASTJSON/global_enum.json | 1 - .../ASTJSON/global_enum_legacy.json | 3 +- test/libsolidity/ASTJSON/global_struct.json | 3 -- .../ASTJSON/global_struct_legacy.json | 5 +-- .../ASTJSON/inheritance_specifier.json | 5 --- .../ASTJSON/inheritance_specifier_legacy.json | 11 +---- test/libsolidity/ASTJSON/license.json | 1 - test/libsolidity/ASTJSON/license_legacy.json | 1 - .../long_type_name_binary_operation.json | 11 ----- ...ong_type_name_binary_operation_legacy.json | 13 +----- .../ASTJSON/long_type_name_identifier.json | 11 ----- .../long_type_name_identifier_legacy.json | 13 +----- test/libsolidity/ASTJSON/mappings.json | 10 ----- test/libsolidity/ASTJSON/mappings_legacy.json | 12 +----- .../ASTJSON/modifier_definition.json | 11 ----- .../ASTJSON/modifier_definition_legacy.json | 13 +----- .../ASTJSON/modifier_invocation.json | 11 ----- .../ASTJSON/modifier_invocation_legacy.json | 13 +----- test/libsolidity/ASTJSON/mutability.json | 11 ----- .../ASTJSON/mutability_legacy.json | 13 +----- test/libsolidity/ASTJSON/non_utf8.json | 12 +----- test/libsolidity/ASTJSON/non_utf8_legacy.json | 14 +------ test/libsolidity/ASTJSON/override.json | 18 -------- test/libsolidity/ASTJSON/override_legacy.json | 28 ++----------- .../ASTJSON/placeholder_statement.json | 4 -- .../ASTJSON/placeholder_statement_legacy.json | 6 +-- test/libsolidity/ASTJSON/receive_ether.json | 4 -- .../ASTJSON/receive_ether_legacy.json | 6 +-- test/libsolidity/ASTJSON/short_type_name.json | 8 ---- .../ASTJSON/short_type_name_legacy.json | 12 +----- .../ASTJSON/short_type_name_ref.json | 9 ---- .../ASTJSON/short_type_name_ref_legacy.json | 13 +----- test/libsolidity/ASTJSON/smoke.json | 2 - test/libsolidity/ASTJSON/smoke_legacy.json | 4 +- test/libsolidity/ASTJSON/source_location.json | 11 ----- .../ASTJSON/source_location_legacy.json | 13 +----- .../ASTJSON/two_base_functions.json | 15 ------- .../ASTJSON/two_base_functions_legacy.json | 25 ++--------- .../ASTJSON/using_for_directive.json | 4 -- .../ASTJSON/using_for_directive_legacy.json | 6 +-- tools/yulPhaser/Program.cpp | 2 +- 95 files changed, 106 insertions(+), 733 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7e2eb67abd7b..a982fef830b3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Breaking changes: * Type Checker: Disallow virtual for library functions. * Deprecated dot syntax for `value` and `gas`. * Deprecated the identifier `now`. + * JSON AST: Removes members with ``null`` value from JSON output. Language Features: diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 603781b26644..22a8ee0206b8 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -201,7 +201,7 @@ Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair ASTJsonImporter::createDocumentation(Json::V Json::Value ASTJsonImporter::member(Json::Value const& _node, string const& _name) { - astAssert(_node.isMember(_name), "Node '" + _node["nodeType"].asString() + "' (id " + _node["id"].asString() + ") is missing field '" + _name + "'."); + if (!_node.isMember(_name)) + return Json::nullValue; return _node[_name]; } diff --git a/libsolidity/ast/AsmJsonImporter.cpp b/libsolidity/ast/AsmJsonImporter.cpp index 3023888414ac..6dd57ac21dfe 100644 --- a/libsolidity/ast/AsmJsonImporter.cpp +++ b/libsolidity/ast/AsmJsonImporter.cpp @@ -63,7 +63,8 @@ T AsmJsonImporter::createAsmNode(Json::Value const& _node) Json::Value AsmJsonImporter::member(Json::Value const& _node, string const& _name) { - astAssert(_node.isMember(_name), "Node is missing field '" + _name + "'."); + if (!_node.isMember(_name)) + return Json::nullValue; return _node[_name]; } diff --git a/libsolutil/JSON.cpp b/libsolutil/JSON.cpp index c66aab9b2537..097e15ab67b8 100644 --- a/libsolutil/JSON.cpp +++ b/libsolutil/JSON.cpp @@ -87,8 +87,31 @@ bool parse(Json::CharReaderBuilder& _builder, string const& _input, Json::Value& return reader->parse(_input.c_str(), _input.c_str() + _input.length(), &_json, _errs); } +/// Takes a JSON value (@ _json) and removes all its members with value 'null' recursively. +void removeNullMembersHelper(Json::Value& _json) +{ + if (_json.type() == Json::ValueType::arrayValue) + for (auto& child: _json) + removeNullMembersHelper(child); + else if (_json.type() == Json::ValueType::objectValue) + for (auto const& key: _json.getMemberNames()) + { + Json::Value& value = _json[key]; + if (value.isNull()) + _json.removeMember(key); + else + removeNullMembersHelper(value); + } +} + } // end anonymous namespace +Json::Value removeNullMembers(Json::Value _json) +{ + removeNullMembersHelper(_json); + return _json; +} + string jsonPrettyPrint(Json::Value const& _input) { static map settings{{"indentation", " "}, {"enableYAMLCompatibility", true}}; diff --git a/libsolutil/JSON.h b/libsolutil/JSON.h index 17633ea0775e..b777cf85278b 100644 --- a/libsolutil/JSON.h +++ b/libsolutil/JSON.h @@ -28,6 +28,9 @@ namespace solidity::util { +/// Removes members with null value recursively from (@a _json). +Json::Value removeNullMembers(Json::Value _json); + /// Serialise the JSON object (@a _input) with indentation std::string jsonPrettyPrint(Json::Value const& _input); diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 1342ef1f6daa..2b996108a097 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -433,7 +433,7 @@ void CommandLineInterface::handleABI(string const& _contract) if (!m_args.count(g_argAbi)) return; - string data = jsonCompactPrint(m_compiler->contractABI(_contract)); + string data = jsonCompactPrint(removeNullMembers(m_compiler->contractABI(_contract))); if (m_args.count(g_argOutputDir)) createFile(m_compiler->filesystemFriendlyName(_contract) + ".abi", data); else @@ -445,7 +445,7 @@ void CommandLineInterface::handleStorageLayout(string const& _contract) if (!m_args.count(g_argStorageLayout)) return; - string data = jsonCompactPrint(m_compiler->storageLayout(_contract)); + string data = jsonCompactPrint(removeNullMembers(m_compiler->storageLayout(_contract))); if (m_args.count(g_argOutputDir)) createFile(m_compiler->filesystemFriendlyName(_contract) + "_storage.json", data); else @@ -474,9 +474,11 @@ void CommandLineInterface::handleNatspec(bool _natspecDev, string const& _contra if (m_args.count(argName)) { std::string output = jsonPrettyPrint( - _natspecDev ? - m_compiler->natspecDev(_contract) : - m_compiler->natspecUser(_contract) + removeNullMembers( + _natspecDev ? + m_compiler->natspecDev(_contract) : + m_compiler->natspecUser(_contract) + ) ); if (m_args.count(g_argOutputDir)) @@ -1399,7 +1401,8 @@ void CommandLineInterface::handleCombinedJSON() } } - string json = m_args.count(g_argPrettyJson) ? jsonPrettyPrint(output) : jsonCompactPrint(output); + string json = m_args.count(g_argPrettyJson) ? jsonPrettyPrint(removeNullMembers(std::move(output))) : + jsonCompactPrint(removeNullMembers(std::move(output))); if (m_args.count(g_argOutputDir)) createJson("combined", json); @@ -1715,7 +1718,7 @@ void CommandLineInterface::outputCompilationResults() { string ret; if (m_args.count(g_argAsmJson)) - ret = jsonPrettyPrint(m_compiler->assemblyJSON(contract)); + ret = jsonPrettyPrint(removeNullMembers(m_compiler->assemblyJSON(contract))); else ret = m_compiler->assemblyString(contract, m_sourceCodes); diff --git a/test/cmdlineTests/recovery_ast_constructor/output b/test/cmdlineTests/recovery_ast_constructor/output index 06d7bb95ced8..27a7b5ce56e3 100644 --- a/test/cmdlineTests/recovery_ast_constructor/output +++ b/test/cmdlineTests/recovery_ast_constructor/output @@ -45,7 +45,6 @@ JSON AST: null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -59,7 +58,6 @@ JSON AST: { "attributes": { - "documentation": null, "implemented": true, "isConstructor": true, "kind": "constructor", @@ -68,7 +66,6 @@ JSON AST: null ], "name": "", - "overrides": null, "scope": 18, "stateMutability": "nonpayable", "virtual": false, @@ -123,7 +120,6 @@ JSON AST: { "attributes": { - "documentation": null, "functionSelector": "af11c34c", "implemented": true, "isConstructor": false, @@ -133,7 +129,6 @@ JSON AST: null ], "name": "five", - "overrides": null, "scope": 18, "stateMutability": "view", "virtual": false, @@ -163,12 +158,10 @@ JSON AST: "constant": false, "mutability": "mutable", "name": "", - "overrides": null, "scope": 17, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -206,13 +199,11 @@ JSON AST: { "attributes": { - "argumentTypes": null, "hexvalue": "35", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 5", "value": "5" diff --git a/test/libsolidity/ASTJSON/abstract_contract.json b/test/libsolidity/ASTJSON/abstract_contract.json index 32b414e8a577..27b74a32d157 100644 --- a/test/libsolidity/ASTJSON/abstract_contract.json +++ b/test/libsolidity/ASTJSON/abstract_contract.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "44:4:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/abstract_contract_legacy.json b/test/libsolidity/ASTJSON/abstract_contract_legacy.json index 13f046eecb55..c345ab6bae6a 100644 --- a/test/libsolidity/ASTJSON/abstract_contract_legacy.json +++ b/test/libsolidity/ASTJSON/abstract_contract_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": true, "kind": "constructor", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 5, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/address_payable.json b/test/libsolidity/ASTJSON/address_payable.json index a82fa0b82a55..3365ec436de6 100644 --- a/test/libsolidity/ASTJSON/address_payable.json +++ b/test/libsolidity/ASTJSON/address_payable.json @@ -8,7 +8,6 @@ ] }, "id": 40, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 39, "linearizedBaseContracts": @@ -35,7 +33,6 @@ "mutability": "mutable", "name": "m", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 39, "src": "17:44:1", "stateVariable": true, @@ -81,7 +78,6 @@ } } }, - "value": null, "visibility": "public" }, { @@ -105,7 +101,6 @@ "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 37, "src": "144:17:1", "stateVariable": false, @@ -128,17 +123,14 @@ "typeString": "address payable" } }, - "value": null, "visibility": "internal" } ], "id": 16, "initialValue": { - "argumentTypes": null, "baseExpression": { - "argumentTypes": null, "id": 13, "name": "m", "nodeType": "Identifier", @@ -154,7 +146,6 @@ "id": 15, "indexExpression": { - "argumentTypes": null, "id": 14, "name": "arg", "nodeType": "Identifier", @@ -185,7 +176,6 @@ { "expression": { - "argumentTypes": null, "id": 19, "isConstant": false, "isLValue": false, @@ -193,7 +183,6 @@ "lValueRequested": false, "leftHandSide": { - "argumentTypes": null, "id": 17, "name": "r", "nodeType": "Identifier", @@ -210,7 +199,6 @@ "operator": "=", "rightHandSide": { - "argumentTypes": null, "id": 18, "name": "arg", "nodeType": "Identifier", @@ -247,7 +235,6 @@ "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 37, "src": "197:9:1", "stateVariable": false, @@ -270,18 +257,15 @@ "typeString": "address" } }, - "value": null, "visibility": "internal" } ], "id": 27, "initialValue": { - "argumentTypes": null, "arguments": [ { - "argumentTypes": null, "id": 25, "name": "this", "nodeType": "Identifier", @@ -322,11 +306,7 @@ "name": "address", "nodeType": "ElementaryTypeName", "src": "209:7:1", - "typeDescriptions": - { - "typeIdentifier": null, - "typeString": null - } + "typeDescriptions": {} } }, "id": 26, @@ -351,7 +331,6 @@ { "expression": { - "argumentTypes": null, "id": 35, "isConstant": false, "isLValue": false, @@ -359,10 +338,8 @@ "lValueRequested": false, "leftHandSide": { - "argumentTypes": null, "baseExpression": { - "argumentTypes": null, "id": 28, "name": "m", "nodeType": "Identifier", @@ -378,7 +355,6 @@ "id": 30, "indexExpression": { - "argumentTypes": null, "id": 29, "name": "c", "nodeType": "Identifier", @@ -407,11 +383,9 @@ "operator": "=", "rightHandSide": { - "argumentTypes": null, "arguments": [ { - "argumentTypes": null, "hexValue": "30", "id": 33, "isConstant": false, @@ -421,7 +395,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "247:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", @@ -457,11 +430,7 @@ "name": "address", "nodeType": "ElementaryTypeName", "src": "239:7:1", - "typeDescriptions": - { - "typeIdentifier": null, - "typeString": null - } + "typeDescriptions": {} } }, "id": 34, @@ -493,7 +462,6 @@ } ] }, - "documentation": null, "functionSelector": "fc68521a", "id": 38, "implemented": true, @@ -501,7 +469,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 7, @@ -514,7 +481,6 @@ "mutability": "mutable", "name": "arg", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 38, "src": "78:19:1", "stateVariable": false, @@ -537,7 +503,6 @@ "typeString": "address payable" } }, - "value": null, "visibility": "internal" } ], @@ -555,7 +520,6 @@ "mutability": "mutable", "name": "r", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 38, "src": "115:17:1", "stateVariable": false, @@ -578,7 +542,6 @@ "typeString": "address payable" } }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/address_payable_legacy.json b/test/libsolidity/ASTJSON/address_payable_legacy.json index 7fe404f3e71a..bda50fc5758d 100644 --- a/test/libsolidity/ASTJSON/address_payable_legacy.json +++ b/test/libsolidity/ASTJSON/address_payable_legacy.json @@ -8,8 +8,7 @@ [ 39 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -44,12 +42,10 @@ "functionSelector": "97682884", "mutability": "mutable", "name": "m", - "overrides": null, "scope": 39, "stateVariable": true, "storageLocation": "default", "type": "mapping(address => address payable)", - "value": null, "visibility": "public" }, "children": @@ -95,7 +91,6 @@ { "attributes": { - "documentation": null, "functionSelector": "fc68521a", "implemented": true, "isConstructor": false, @@ -105,7 +100,6 @@ null ], "name": "f", - "overrides": null, "scope": 39, "stateMutability": "nonpayable", "virtual": false, @@ -122,12 +116,10 @@ "constant": false, "mutability": "mutable", "name": "arg", - "overrides": null, "scope": 38, "stateVariable": false, "storageLocation": "default", "type": "address payable", - "value": null, "visibility": "internal" }, "children": @@ -162,12 +154,10 @@ "constant": false, "mutability": "mutable", "name": "r", - "overrides": null, "scope": 38, "stateVariable": false, "storageLocation": "default", "type": "address payable", - "value": null, "visibility": "internal" }, "children": @@ -212,12 +202,10 @@ "constant": false, "mutability": "mutable", "name": "a", - "overrides": null, "scope": 37, "stateVariable": false, "storageLocation": "default", "type": "address payable", - "value": null, "visibility": "internal" }, "children": @@ -241,7 +229,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, @@ -253,7 +240,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -269,7 +255,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -298,7 +283,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, @@ -311,7 +295,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -327,7 +310,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -366,12 +348,10 @@ "constant": false, "mutability": "mutable", "name": "c", - "overrides": null, "scope": 37, "stateVariable": false, "storageLocation": "default", "type": "address", - "value": null, "visibility": "internal" }, "children": @@ -395,7 +375,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, @@ -432,8 +411,7 @@ { "attributes": { - "name": "address", - "type": null + "name": "address" }, "id": 23, "name": "ElementaryTypeName", @@ -447,7 +425,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -476,7 +453,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, @@ -489,7 +465,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, @@ -501,7 +476,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -517,7 +491,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -538,7 +511,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": true, @@ -575,8 +547,7 @@ { "attributes": { - "name": "address", - "type": null + "name": "address" }, "id": 31, "name": "ElementaryTypeName", @@ -590,13 +561,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "30", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 0", "value": "0" diff --git a/test/libsolidity/ASTJSON/array_type_name.json b/test/libsolidity/ASTJSON/array_type_name.json index a09bc306ad12..90649b5019f3 100644 --- a/test/libsolidity/ASTJSON/array_type_name.json +++ b/test/libsolidity/ASTJSON/array_type_name.json @@ -8,7 +8,6 @@ ] }, "id": 5, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 4, "linearizedBaseContracts": @@ -34,7 +32,6 @@ "mutability": "mutable", "name": "i", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 4, "src": "13:8:1", "stateVariable": true, @@ -59,7 +56,6 @@ } }, "id": 2, - "length": null, "nodeType": "ArrayTypeName", "src": "13:6:1", "typeDescriptions": @@ -68,7 +64,6 @@ "typeString": "uint256[]" } }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/array_type_name_legacy.json b/test/libsolidity/ASTJSON/array_type_name_legacy.json index cc1c7a77aa17..304d59da86f1 100644 --- a/test/libsolidity/ASTJSON/array_type_name_legacy.json +++ b/test/libsolidity/ASTJSON/array_type_name_legacy.json @@ -8,8 +8,7 @@ [ 4 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -43,12 +41,10 @@ "constant": false, "mutability": "mutable", "name": "i", - "overrides": null, "scope": 4, "stateVariable": true, "storageLocation": "default", "type": "uint256[]", - "value": null, "visibility": "internal" }, "children": @@ -56,7 +52,6 @@ { "attributes": { - "length": null, "type": "uint256[]" }, "children": diff --git a/test/libsolidity/ASTJSON/assembly/call.json b/test/libsolidity/ASTJSON/assembly/call.json index ad81c1094784..9538fe5cc3d2 100644 --- a/test/libsolidity/ASTJSON/assembly/call.json +++ b/test/libsolidity/ASTJSON/assembly/call.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -133,7 +131,6 @@ } ] }, - "documentation": null, "functionSelector": "b582ec5f", "id": 5, "implemented": true, @@ -141,7 +138,6 @@ "modifiers": [], "name": "j", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/call_legacy.json b/test/libsolidity/ASTJSON/assembly/call_legacy.json index 93ad1b956576..2902873faba4 100644 --- a/test/libsolidity/ASTJSON/assembly/call_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/call_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "b582ec5f", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "j", - "overrides": null, "scope": 6, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/empty_block.json b/test/libsolidity/ASTJSON/assembly/empty_block.json index 847fd408583b..2d22cc035878 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -58,7 +56,6 @@ } ] }, - "documentation": null, "functionSelector": "e2179b8e", "id": 5, "implemented": true, @@ -66,7 +63,6 @@ "modifiers": [], "name": "g", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/empty_block_legacy.json b/test/libsolidity/ASTJSON/assembly/empty_block_legacy.json index 74d24d5e1e8e..54811bf1a618 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "e2179b8e", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "g", - "overrides": null, "scope": 6, "stateMutability": "view", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/function.json b/test/libsolidity/ASTJSON/assembly/function.json index 6bd37162d89d..ccbf3d853028 100644 --- a/test/libsolidity/ASTJSON/assembly/function.json +++ b/test/libsolidity/ASTJSON/assembly/function.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -120,7 +118,6 @@ } ] }, - "documentation": null, "functionSelector": "b8c9d365", "id": 5, "implemented": true, @@ -128,7 +125,6 @@ "modifiers": [], "name": "h", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/function_legacy.json b/test/libsolidity/ASTJSON/assembly/function_legacy.json index ee6918d251b1..940a4b6ac94d 100644 --- a/test/libsolidity/ASTJSON/assembly/function_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/function_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "b8c9d365", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "h", - "overrides": null, "scope": 6, "stateMutability": "view", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/leave.json b/test/libsolidity/ASTJSON/assembly/leave.json index 5868c1acb9a6..ba765146fada 100644 --- a/test/libsolidity/ASTJSON/assembly/leave.json +++ b/test/libsolidity/ASTJSON/assembly/leave.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -70,7 +68,6 @@ } ] }, - "documentation": null, "functionSelector": "ece866b9", "id": 5, "implemented": true, @@ -78,7 +75,6 @@ "modifiers": [], "name": "l", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/leave_legacy.json b/test/libsolidity/ASTJSON/assembly/leave_legacy.json index 2c39fba3782e..fa71bcba0482 100644 --- a/test/libsolidity/ASTJSON/assembly/leave_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/leave_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "ece866b9", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "l", - "overrides": null, "scope": 6, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/loop.json b/test/libsolidity/ASTJSON/assembly/loop.json index 263db400d276..9c99cf4918d9 100644 --- a/test/libsolidity/ASTJSON/assembly/loop.json +++ b/test/libsolidity/ASTJSON/assembly/loop.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -133,7 +131,6 @@ } ] }, - "documentation": null, "functionSelector": "e2179b8e", "id": 5, "implemented": true, @@ -141,7 +138,6 @@ "modifiers": [], "name": "g", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/loop_legacy.json b/test/libsolidity/ASTJSON/assembly/loop_legacy.json index 5085e4c5044a..84890475f851 100644 --- a/test/libsolidity/ASTJSON/assembly/loop_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/loop_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "e2179b8e", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "g", - "overrides": null, "scope": 6, "stateMutability": "view", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions.json b/test/libsolidity/ASTJSON/assembly/nested_functions.json index 5abb7fce4cf9..f945494bad5a 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions.json @@ -8,7 +8,6 @@ ] }, "id": 9, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 8, "linearizedBaseContracts": @@ -97,7 +95,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 7, "implemented": true, @@ -105,7 +102,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, @@ -125,29 +121,19 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 7, "src": "49:6:1", "stateVariable": false, "storageLocation": "default", - "typeDescriptions": - { - "typeIdentifier": null, - "typeString": null - }, + "typeDescriptions": {}, "typeName": { "id": 2, "name": "uint", "nodeType": "ElementaryTypeName", "src": "49:4:1", - "typeDescriptions": - { - "typeIdentifier": null, - "typeString": null - } + "typeDescriptions": {} }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions_legacy.json b/test/libsolidity/ASTJSON/assembly/nested_functions_legacy.json index 0ccfcf85a4e5..393646221434 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions_legacy.json @@ -8,8 +8,7 @@ [ 8 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 8, "stateMutability": "pure", "virtual": false, @@ -80,12 +76,9 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 7, "stateVariable": false, "storageLocation": "default", - "type": null, - "value": null, "visibility": "internal" }, "children": @@ -93,8 +86,7 @@ { "attributes": { - "name": "uint", - "type": null + "name": "uint" }, "id": 2, "name": "ElementaryTypeName", diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.json b/test/libsolidity/ASTJSON/assembly/slot_offset.json index 7231747c4d2a..2bdcccadc5d6 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.json @@ -8,7 +8,6 @@ ] }, "id": 12, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 11, "linearizedBaseContracts": @@ -39,7 +37,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 3, "src": "28:6:1", "stateVariable": false, @@ -61,7 +58,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], @@ -77,7 +73,6 @@ "mutability": "mutable", "name": "s", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 11, "src": "42:3:1", "stateVariable": true, @@ -89,7 +84,6 @@ }, "typeName": { - "contractScope": null, "id": 4, "name": "S", "nodeType": "UserDefinedTypeName", @@ -101,7 +95,6 @@ "typeString": "struct C.S" } }, - "value": null, "visibility": "internal" }, { @@ -203,7 +196,6 @@ } ] }, - "documentation": null, "functionSelector": "ffae15ba", "id": 10, "implemented": true, @@ -211,7 +203,6 @@ "modifiers": [], "name": "e", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 6, diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json index 574c7ad75ad3..aa137111eb0f 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json @@ -8,8 +8,7 @@ [ 11 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -53,12 +51,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 3, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -89,12 +85,10 @@ "constant": false, "mutability": "mutable", "name": "s", - "overrides": null, "scope": 11, "stateVariable": true, "storageLocation": "default", "type": "struct C.S", - "value": null, "visibility": "internal" }, "children": @@ -102,7 +96,6 @@ { "attributes": { - "contractScope": null, "name": "S", "referencedDeclaration": 3, "type": "struct C.S" @@ -119,7 +112,6 @@ { "attributes": { - "documentation": null, "functionSelector": "ffae15ba", "implemented": true, "isConstructor": false, @@ -129,7 +121,6 @@ null ], "name": "e", - "overrides": null, "scope": 11, "stateMutability": "pure", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/stringlit.json b/test/libsolidity/ASTJSON/assembly/stringlit.json index 7fd0b9b84a24..08e0ea4f6e70 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -74,7 +72,6 @@ } ] }, - "documentation": null, "functionSelector": "5a2ee019", "id": 5, "implemented": true, @@ -82,7 +79,6 @@ "modifiers": [], "name": "m", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/stringlit_legacy.json b/test/libsolidity/ASTJSON/assembly/stringlit_legacy.json index 76c503925b34..325d25274a9a 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "5a2ee019", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "m", - "overrides": null, "scope": 6, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/switch.json b/test/libsolidity/ASTJSON/assembly/switch.json index 61b462f1ea48..9ae71f15c4d0 100644 --- a/test/libsolidity/ASTJSON/assembly/switch.json +++ b/test/libsolidity/ASTJSON/assembly/switch.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -182,7 +180,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 5, "implemented": true, @@ -190,7 +187,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.json b/test/libsolidity/ASTJSON/assembly/switch_default.json index 2f15a82c5536..4cb7b93870b8 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default.json @@ -8,7 +8,6 @@ ] }, "id": 7, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 6, "linearizedBaseContracts": @@ -79,7 +77,6 @@ } ] }, - "documentation": null, "functionSelector": "e2179b8e", "id": 5, "implemented": true, @@ -87,7 +84,6 @@ "modifiers": [], "name": "g", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json b/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json index 18e7c860c17d..8c5ab802b308 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "e2179b8e", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "g", - "overrides": null, "scope": 6, "stateMutability": "view", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/switch_legacy.json b/test/libsolidity/ASTJSON/assembly/switch_legacy.json index dab33b305c49..92e2e2c61cd9 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/switch_legacy.json @@ -8,8 +8,7 @@ [ 6 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 6, "stateMutability": "pure", "virtual": false, diff --git a/test/libsolidity/ASTJSON/assembly/var_access.json b/test/libsolidity/ASTJSON/assembly/var_access.json index c44940a28474..f10c45cc4320 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access.json +++ b/test/libsolidity/ASTJSON/assembly/var_access.json @@ -8,7 +8,6 @@ ] }, "id": 10, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 9, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 7, "src": "52:6:1", "stateVariable": false, @@ -71,12 +68,10 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], "id": 5, - "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "52:6:1" }, @@ -126,7 +121,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 8, "implemented": true, @@ -134,7 +128,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/assembly/var_access_legacy.json b/test/libsolidity/ASTJSON/assembly/var_access_legacy.json index a80a24613d8a..fcd798ad9b1f 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/var_access_legacy.json @@ -8,8 +8,7 @@ [ 9 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 9, "stateMutability": "pure", "virtual": false, @@ -93,8 +89,7 @@ "assignments": [ 4 - ], - "initialValue": null + ] }, "children": [ @@ -104,12 +99,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 7, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": diff --git a/test/libsolidity/ASTJSON/constructor.json b/test/libsolidity/ASTJSON/constructor.json index 321d93471538..24a91d1feeb9 100644 --- a/test/libsolidity/ASTJSON/constructor.json +++ b/test/libsolidity/ASTJSON/constructor.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "35:4:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/constructor_legacy.json b/test/libsolidity/ASTJSON/constructor_legacy.json index 9417561a7bbe..108fbcdf0ee2 100644 --- a/test/libsolidity/ASTJSON/constructor_legacy.json +++ b/test/libsolidity/ASTJSON/constructor_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": true, "kind": "constructor", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 5, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/contract_dep_order.json b/test/libsolidity/ASTJSON/contract_dep_order.json index b4a93ff75af0..ff1247548972 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order.json +++ b/test/libsolidity/ASTJSON/contract_dep_order.json @@ -24,7 +24,6 @@ ] }, "id": 14, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -33,7 +32,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 1, "linearizedBaseContracts": @@ -51,10 +49,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 2, "name": "A", "nodeType": "UserDefinedTypeName", @@ -76,7 +72,6 @@ 1 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 4, "linearizedBaseContracts": @@ -95,10 +90,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 5, "name": "B", "nodeType": "UserDefinedTypeName", @@ -121,7 +114,6 @@ 4 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 7, "linearizedBaseContracts": @@ -141,10 +133,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 8, "name": "C", "nodeType": "UserDefinedTypeName", @@ -168,7 +158,6 @@ 7 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 10, "linearizedBaseContracts": @@ -189,10 +178,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 11, "name": "D", "nodeType": "UserDefinedTypeName", @@ -217,7 +204,6 @@ 10 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 13, "linearizedBaseContracts": diff --git a/test/libsolidity/ASTJSON/contract_dep_order_legacy.json b/test/libsolidity/ASTJSON/contract_dep_order_legacy.json index 75ac151e85f4..20f40cb906c9 100644 --- a/test/libsolidity/ASTJSON/contract_dep_order_legacy.json +++ b/test/libsolidity/ASTJSON/contract_dep_order_legacy.json @@ -24,8 +24,7 @@ [ 13 ] - }, - "license": null + } }, "children": [ @@ -42,7 +41,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -68,7 +66,6 @@ 1 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -85,16 +82,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "A", "referencedDeclaration": 1, "type": "contract A" @@ -123,7 +116,6 @@ 4 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -141,16 +133,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "B", "referencedDeclaration": 4, "type": "contract B" @@ -180,7 +168,6 @@ 7 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -199,16 +186,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "C", "referencedDeclaration": 7, "type": "contract C" @@ -239,7 +222,6 @@ 10 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -259,16 +241,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "D", "referencedDeclaration": 10, "type": "contract D" diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json index b4305969e659..5e8cf1a6b899 100644 --- a/test/libsolidity/ASTJSON/documentation.json +++ b/test/libsolidity/ASTJSON/documentation.json @@ -9,7 +9,6 @@ ] }, "id": 3, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -50,7 +49,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -91,7 +89,6 @@ ] }, "id": 21, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -100,7 +97,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 20, "linearizedBaseContracts": @@ -157,7 +153,6 @@ "id": 14, "name": "mod", "nodeType": "ModifierDefinition", - "overrides": null, "parameters": { "id": 11, @@ -191,7 +186,6 @@ "modifiers": [], "name": "fn", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 16, diff --git a/test/libsolidity/ASTJSON/documentation_legacy.json b/test/libsolidity/ASTJSON/documentation_legacy.json index 70a4d8cf42c1..6719ee98972b 100644 --- a/test/libsolidity/ASTJSON/documentation_legacy.json +++ b/test/libsolidity/ASTJSON/documentation_legacy.json @@ -8,8 +8,7 @@ [ 20 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -76,7 +74,6 @@ "attributes": { "name": "mod", - "overrides": null, "virtual": false, "visibility": "internal" }, @@ -134,7 +131,6 @@ null ], "name": "fn", - "overrides": null, "scope": 20, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/enum_value.json b/test/libsolidity/ASTJSON/enum_value.json index bb8e1289b909..533e7b9e62f6 100644 --- a/test/libsolidity/ASTJSON/enum_value.json +++ b/test/libsolidity/ASTJSON/enum_value.json @@ -8,7 +8,6 @@ ] }, "id": 5, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 4, "linearizedBaseContracts": diff --git a/test/libsolidity/ASTJSON/enum_value_legacy.json b/test/libsolidity/ASTJSON/enum_value_legacy.json index eeff347d722f..9ae5e1dad7e0 100644 --- a/test/libsolidity/ASTJSON/enum_value_legacy.json +++ b/test/libsolidity/ASTJSON/enum_value_legacy.json @@ -8,8 +8,7 @@ [ 4 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ diff --git a/test/libsolidity/ASTJSON/event_definition.json b/test/libsolidity/ASTJSON/event_definition.json index e5c5749738be..61a1f46d4037 100644 --- a/test/libsolidity/ASTJSON/event_definition.json +++ b/test/libsolidity/ASTJSON/event_definition.json @@ -8,7 +8,6 @@ ] }, "id": 4, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 3, "linearizedBaseContracts": @@ -30,7 +28,6 @@ [ { "anonymous": false, - "documentation": null, "id": 2, "name": "E", "nodeType": "EventDefinition", diff --git a/test/libsolidity/ASTJSON/event_definition_legacy.json b/test/libsolidity/ASTJSON/event_definition_legacy.json index 330f586ae229..7adf0d038940 100644 --- a/test/libsolidity/ASTJSON/event_definition_legacy.json +++ b/test/libsolidity/ASTJSON/event_definition_legacy.json @@ -8,8 +8,7 @@ [ 3 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -41,7 +39,6 @@ "attributes": { "anonymous": false, - "documentation": null, "name": "E" }, "children": diff --git a/test/libsolidity/ASTJSON/fallback.json b/test/libsolidity/ASTJSON/fallback.json index 7c83f871f4d3..7037b960a694 100644 --- a/test/libsolidity/ASTJSON/fallback.json +++ b/test/libsolidity/ASTJSON/fallback.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "43:5:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json b/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json index 801a4e148be0..009363e9830f 100644 --- a/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json +++ b/test/libsolidity/ASTJSON/fallback_and_reveice_ether.json @@ -8,7 +8,6 @@ ] }, "id": 10, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 9, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "42:5:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "receive", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, @@ -72,14 +68,12 @@ "src": "78:5:1", "statements": [] }, - "documentation": null, "id": 8, "implemented": true, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 5, diff --git a/test/libsolidity/ASTJSON/fallback_and_reveice_ether_legacy.json b/test/libsolidity/ASTJSON/fallback_and_reveice_ether_legacy.json index 44e02c42dd3e..8ac17607e6c7 100644 --- a/test/libsolidity/ASTJSON/fallback_and_reveice_ether_legacy.json +++ b/test/libsolidity/ASTJSON/fallback_and_reveice_ether_legacy.json @@ -8,8 +8,7 @@ [ 9 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": false, "kind": "receive", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 9, "stateMutability": "payable", "virtual": false, @@ -104,7 +100,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": false, "kind": "fallback", @@ -113,7 +108,6 @@ null ], "name": "", - "overrides": null, "scope": 9, "stateMutability": "payable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/fallback_legacy.json b/test/libsolidity/ASTJSON/fallback_legacy.json index 8c81e87d86a3..1ee8bf6b30ee 100644 --- a/test/libsolidity/ASTJSON/fallback_legacy.json +++ b/test/libsolidity/ASTJSON/fallback_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": false, "kind": "fallback", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 5, "stateMutability": "payable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/fallback_payable.json b/test/libsolidity/ASTJSON/fallback_payable.json index fb55b60774df..2391f57bbf1f 100644 --- a/test/libsolidity/ASTJSON/fallback_payable.json +++ b/test/libsolidity/ASTJSON/fallback_payable.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "34:2:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/fallback_payable_legacy.json b/test/libsolidity/ASTJSON/fallback_payable_legacy.json index 2bc5a9659d4c..69e25ab6e18a 100644 --- a/test/libsolidity/ASTJSON/fallback_payable_legacy.json +++ b/test/libsolidity/ASTJSON/fallback_payable_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": false, "kind": "fallback", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 5, "stateMutability": "nonpayable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/function_type.json b/test/libsolidity/ASTJSON/function_type.json index 57f061b3901e..c0d2efc6889f 100644 --- a/test/libsolidity/ASTJSON/function_type.json +++ b/test/libsolidity/ASTJSON/function_type.json @@ -8,7 +8,6 @@ ] }, "id": 18, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 17, "linearizedBaseContracts": @@ -36,7 +34,6 @@ "src": "120:2:1", "statements": [] }, - "documentation": null, "functionSelector": "d6cd4974", "id": 16, "implemented": true, @@ -44,7 +41,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 7, @@ -57,7 +53,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 16, "src": "24:44:1", "stateVariable": false, @@ -90,7 +85,6 @@ "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 5, "src": "61:4:1", "stateVariable": false, @@ -112,7 +106,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], @@ -127,7 +120,6 @@ }, "visibility": "external" }, - "value": null, "visibility": "internal" } ], @@ -145,7 +137,6 @@ "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 16, "src": "79:40:1", "stateVariable": false, @@ -178,7 +169,6 @@ "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 12, "src": "113:4:1", "stateVariable": false, @@ -200,7 +190,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], @@ -215,7 +204,6 @@ }, "visibility": "external" }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/function_type_legacy.json b/test/libsolidity/ASTJSON/function_type_legacy.json index 799e94bf9ae5..627ce45f0878 100644 --- a/test/libsolidity/ASTJSON/function_type_legacy.json +++ b/test/libsolidity/ASTJSON/function_type_legacy.json @@ -8,8 +8,7 @@ [ 17 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "d6cd4974", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 17, "stateMutability": "nonpayable", "virtual": false, @@ -67,12 +63,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 16, "stateVariable": false, "storageLocation": "default", "type": "function () payable external returns (uint256)", - "value": null, "visibility": "internal" }, "children": @@ -108,12 +102,10 @@ "constant": false, "mutability": "mutable", "name": "", - "overrides": null, "scope": 5, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -162,12 +154,10 @@ "constant": false, "mutability": "mutable", "name": "", - "overrides": null, "scope": 16, "stateVariable": false, "storageLocation": "default", "type": "function () view external returns (uint256)", - "value": null, "visibility": "internal" }, "children": @@ -203,12 +193,10 @@ "constant": false, "mutability": "mutable", "name": "", - "overrides": null, "scope": 12, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": diff --git a/test/libsolidity/ASTJSON/global_enum.json b/test/libsolidity/ASTJSON/global_enum.json index 876b55ddf347..1b0ffe3778d9 100644 --- a/test/libsolidity/ASTJSON/global_enum.json +++ b/test/libsolidity/ASTJSON/global_enum.json @@ -8,7 +8,6 @@ ] }, "id": 3, - "license": null, "nodeType": "SourceUnit", "nodes": [ diff --git a/test/libsolidity/ASTJSON/global_enum_legacy.json b/test/libsolidity/ASTJSON/global_enum_legacy.json index aea0583457f0..f29649018688 100644 --- a/test/libsolidity/ASTJSON/global_enum_legacy.json +++ b/test/libsolidity/ASTJSON/global_enum_legacy.json @@ -8,8 +8,7 @@ [ 2 ] - }, - "license": null + } }, "children": [ diff --git a/test/libsolidity/ASTJSON/global_struct.json b/test/libsolidity/ASTJSON/global_struct.json index e1802e03b828..2d1d42bdcae2 100644 --- a/test/libsolidity/ASTJSON/global_struct.json +++ b/test/libsolidity/ASTJSON/global_struct.json @@ -8,7 +8,6 @@ ] }, "id": 4, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -23,7 +22,6 @@ "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 3, "src": "11:9:1", "stateVariable": false, @@ -45,7 +43,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/global_struct_legacy.json b/test/libsolidity/ASTJSON/global_struct_legacy.json index 2670ea5ea5df..09f5d2de61c0 100644 --- a/test/libsolidity/ASTJSON/global_struct_legacy.json +++ b/test/libsolidity/ASTJSON/global_struct_legacy.json @@ -8,8 +8,7 @@ [ 3 ] - }, - "license": null + } }, "children": [ @@ -29,12 +28,10 @@ "constant": false, "mutability": "mutable", "name": "a", - "overrides": null, "scope": 3, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": diff --git a/test/libsolidity/ASTJSON/inheritance_specifier.json b/test/libsolidity/ASTJSON/inheritance_specifier.json index 20da9e31c2b7..40acc5d2a81e 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier.json @@ -12,7 +12,6 @@ ] }, "id": 5, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -21,7 +20,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 1, "linearizedBaseContracts": @@ -39,10 +37,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 2, "name": "C1", "nodeType": "UserDefinedTypeName", @@ -64,7 +60,6 @@ 1 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 4, "linearizedBaseContracts": diff --git a/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json b/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json index b8de3a97bae1..4d6f0ffec3f2 100644 --- a/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json +++ b/test/libsolidity/ASTJSON/inheritance_specifier_legacy.json @@ -12,8 +12,7 @@ [ 4 ] - }, - "license": null + } }, "children": [ @@ -30,7 +29,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -56,7 +54,6 @@ 1 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -73,16 +70,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "C1", "referencedDeclaration": 1, "type": "contract C1" diff --git a/test/libsolidity/ASTJSON/license.json b/test/libsolidity/ASTJSON/license.json index e8c6616a3cd5..c365c072a53e 100644 --- a/test/libsolidity/ASTJSON/license.json +++ b/test/libsolidity/ASTJSON/license.json @@ -17,7 +17,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 1, "linearizedBaseContracts": diff --git a/test/libsolidity/ASTJSON/license_legacy.json b/test/libsolidity/ASTJSON/license_legacy.json index 2f1405b62cef..03e6b60560a3 100644 --- a/test/libsolidity/ASTJSON/license_legacy.json +++ b/test/libsolidity/ASTJSON/license_legacy.json @@ -26,7 +26,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json index 5e13c2bfb58e..7b598093b012 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json @@ -8,7 +8,6 @@ ] }, "id": 12, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 11, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 9, "src": "35:6:1", "stateVariable": false, @@ -71,14 +68,12 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], "id": 8, "initialValue": { - "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_5_by_1", @@ -91,7 +86,6 @@ "lValueRequested": false, "leftExpression": { - "argumentTypes": null, "hexValue": "32", "id": 5, "isConstant": false, @@ -101,7 +95,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "44:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", @@ -113,7 +106,6 @@ "operator": "+", "rightExpression": { - "argumentTypes": null, "hexValue": "33", "id": 6, "isConstant": false, @@ -123,7 +115,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "48:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_3_by_1", @@ -143,7 +134,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 10, "implemented": true, @@ -151,7 +141,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json index c6f7662eac44..46e5b0417add 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json @@ -8,8 +8,7 @@ [ 11 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 11, "stateMutability": "nonpayable", "virtual": false, @@ -103,12 +99,10 @@ "constant": false, "mutability": "mutable", "name": "a", - "overrides": null, "scope": 9, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -131,7 +125,6 @@ { "attributes": { - "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_5_by_1", @@ -149,13 +142,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "32", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 2", "value": "2" @@ -167,13 +158,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "33", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 3", "value": "3" diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier.json b/test/libsolidity/ASTJSON/long_type_name_identifier.json index 417972b45d90..4293f6df44bd 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier.json @@ -8,7 +8,6 @@ ] }, "id": 16, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 15, "linearizedBaseContracts": @@ -34,7 +32,6 @@ "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 15, "src": "13:8:1", "stateVariable": true, @@ -59,7 +56,6 @@ } }, "id": 2, - "length": null, "nodeType": "ArrayTypeName", "src": "13:6:1", "typeDescriptions": @@ -68,7 +64,6 @@ "typeString": "uint256[]" } }, - "value": null, "visibility": "internal" }, { @@ -92,7 +87,6 @@ "mutability": "mutable", "name": "b", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 13, "src": "45:16:1", "stateVariable": false, @@ -117,7 +111,6 @@ } }, "id": 9, - "length": null, "nodeType": "ArrayTypeName", "src": "45:6:1", "typeDescriptions": @@ -126,14 +119,12 @@ "typeString": "uint256[]" } }, - "value": null, "visibility": "internal" } ], "id": 12, "initialValue": { - "argumentTypes": null, "id": 11, "name": "a", "nodeType": "Identifier", @@ -151,7 +142,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 14, "implemented": true, @@ -159,7 +149,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 4, diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json index 537746abd719..ced331a6dda5 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json @@ -8,8 +8,7 @@ [ 15 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -43,12 +41,10 @@ "constant": false, "mutability": "mutable", "name": "a", - "overrides": null, "scope": 15, "stateVariable": true, "storageLocation": "default", "type": "uint256[]", - "value": null, "visibility": "internal" }, "children": @@ -56,7 +52,6 @@ { "attributes": { - "length": null, "type": "uint256[]" }, "children": @@ -84,7 +79,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -94,7 +88,6 @@ null ], "name": "f", - "overrides": null, "scope": 15, "stateMutability": "nonpayable", "virtual": false, @@ -147,12 +140,10 @@ "constant": false, "mutability": "mutable", "name": "b", - "overrides": null, "scope": 13, "stateVariable": false, "storageLocation": "storage", "type": "uint256[]", - "value": null, "visibility": "internal" }, "children": @@ -160,7 +151,6 @@ { "attributes": { - "length": null, "type": "uint256[]" }, "children": @@ -188,7 +178,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null diff --git a/test/libsolidity/ASTJSON/mappings.json b/test/libsolidity/ASTJSON/mappings.json index 8df004d4ba35..b1f150f10334 100644 --- a/test/libsolidity/ASTJSON/mappings.json +++ b/test/libsolidity/ASTJSON/mappings.json @@ -8,7 +8,6 @@ ] }, "id": 18, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 17, "linearizedBaseContracts": @@ -62,7 +60,6 @@ "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 17, "src": "40:20:1", "stateVariable": true, @@ -77,7 +74,6 @@ "id": 7, "keyType": { - "contractScope": null, "id": 5, "name": "C", "nodeType": "UserDefinedTypeName", @@ -109,7 +105,6 @@ } } }, - "value": null, "visibility": "internal" }, { @@ -118,7 +113,6 @@ "mutability": "mutable", "name": "b", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 17, "src": "66:26:1", "stateVariable": true, @@ -163,7 +157,6 @@ } } }, - "value": null, "visibility": "internal" }, { @@ -172,7 +165,6 @@ "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 17, "src": "98:20:1", "stateVariable": true, @@ -187,7 +179,6 @@ "id": 15, "keyType": { - "contractScope": null, "id": 13, "name": "E", "nodeType": "UserDefinedTypeName", @@ -219,7 +210,6 @@ } } }, - "value": null, "visibility": "internal" } ], diff --git a/test/libsolidity/ASTJSON/mappings_legacy.json b/test/libsolidity/ASTJSON/mappings_legacy.json index 49737edeebff..a44eea0ebd45 100644 --- a/test/libsolidity/ASTJSON/mappings_legacy.json +++ b/test/libsolidity/ASTJSON/mappings_legacy.json @@ -8,8 +8,7 @@ [ 17 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -83,12 +81,10 @@ "constant": false, "mutability": "mutable", "name": "a", - "overrides": null, "scope": 17, "stateVariable": true, "storageLocation": "default", "type": "mapping(contract C => bool)", - "value": null, "visibility": "internal" }, "children": @@ -103,7 +99,6 @@ { "attributes": { - "contractScope": null, "name": "C", "referencedDeclaration": 17, "type": "contract C" @@ -138,12 +133,10 @@ "constant": false, "mutability": "mutable", "name": "b", - "overrides": null, "scope": 17, "stateVariable": true, "storageLocation": "default", "type": "mapping(address => bool)", - "value": null, "visibility": "internal" }, "children": @@ -191,12 +184,10 @@ "constant": false, "mutability": "mutable", "name": "c", - "overrides": null, "scope": 17, "stateVariable": true, "storageLocation": "default", "type": "mapping(enum C.E => bool)", - "value": null, "visibility": "internal" }, "children": @@ -211,7 +202,6 @@ { "attributes": { - "contractScope": null, "name": "E", "referencedDeclaration": 4, "type": "enum C.E" diff --git a/test/libsolidity/ASTJSON/modifier_definition.json b/test/libsolidity/ASTJSON/modifier_definition.json index c5070f1da8ba..198afe45415d 100644 --- a/test/libsolidity/ASTJSON/modifier_definition.json +++ b/test/libsolidity/ASTJSON/modifier_definition.json @@ -8,7 +8,6 @@ ] }, "id": 15, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 14, "linearizedBaseContracts": @@ -43,11 +41,9 @@ } ] }, - "documentation": null, "id": 6, "name": "M", "nodeType": "ModifierDefinition", - "overrides": null, "parameters": { "id": 3, @@ -60,7 +56,6 @@ "mutability": "mutable", "name": "i", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 6, "src": "24:6:1", "stateVariable": false, @@ -82,7 +77,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], @@ -100,7 +94,6 @@ "src": "64:2:1", "statements": [] }, - "documentation": null, "functionSelector": "28811f59", "id": 13, "implemented": true, @@ -111,7 +104,6 @@ "arguments": [ { - "argumentTypes": null, "hexValue": "31", "id": 9, "isConstant": false, @@ -121,7 +113,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "54:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", @@ -133,7 +124,6 @@ "id": 10, "modifierName": { - "argumentTypes": null, "id": 8, "name": "M", "nodeType": "Identifier", @@ -152,7 +142,6 @@ ], "name": "F", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 7, diff --git a/test/libsolidity/ASTJSON/modifier_definition_legacy.json b/test/libsolidity/ASTJSON/modifier_definition_legacy.json index 05876ae3e3c2..cc3089395ef0 100644 --- a/test/libsolidity/ASTJSON/modifier_definition_legacy.json +++ b/test/libsolidity/ASTJSON/modifier_definition_legacy.json @@ -8,8 +8,7 @@ [ 14 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,9 +38,7 @@ { "attributes": { - "documentation": null, "name": "M", - "overrides": null, "virtual": false, "visibility": "internal" }, @@ -57,12 +53,10 @@ "constant": false, "mutability": "mutable", "name": "i", - "overrides": null, "scope": 6, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -108,13 +102,11 @@ { "attributes": { - "documentation": null, "functionSelector": "28811f59", "implemented": true, "isConstructor": false, "kind": "function", "name": "F", - "overrides": null, "scope": 14, "stateMutability": "nonpayable", "virtual": false, @@ -154,7 +146,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -170,13 +161,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "31", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 1", "value": "1" diff --git a/test/libsolidity/ASTJSON/modifier_invocation.json b/test/libsolidity/ASTJSON/modifier_invocation.json index c5070f1da8ba..198afe45415d 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation.json +++ b/test/libsolidity/ASTJSON/modifier_invocation.json @@ -8,7 +8,6 @@ ] }, "id": 15, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 14, "linearizedBaseContracts": @@ -43,11 +41,9 @@ } ] }, - "documentation": null, "id": 6, "name": "M", "nodeType": "ModifierDefinition", - "overrides": null, "parameters": { "id": 3, @@ -60,7 +56,6 @@ "mutability": "mutable", "name": "i", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 6, "src": "24:6:1", "stateVariable": false, @@ -82,7 +77,6 @@ "typeString": "uint256" } }, - "value": null, "visibility": "internal" } ], @@ -100,7 +94,6 @@ "src": "64:2:1", "statements": [] }, - "documentation": null, "functionSelector": "28811f59", "id": 13, "implemented": true, @@ -111,7 +104,6 @@ "arguments": [ { - "argumentTypes": null, "hexValue": "31", "id": 9, "isConstant": false, @@ -121,7 +113,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "54:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", @@ -133,7 +124,6 @@ "id": 10, "modifierName": { - "argumentTypes": null, "id": 8, "name": "M", "nodeType": "Identifier", @@ -152,7 +142,6 @@ ], "name": "F", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 7, diff --git a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json index 05876ae3e3c2..cc3089395ef0 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json +++ b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json @@ -8,8 +8,7 @@ [ 14 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,9 +38,7 @@ { "attributes": { - "documentation": null, "name": "M", - "overrides": null, "virtual": false, "visibility": "internal" }, @@ -57,12 +53,10 @@ "constant": false, "mutability": "mutable", "name": "i", - "overrides": null, "scope": 6, "stateVariable": false, "storageLocation": "default", "type": "uint256", - "value": null, "visibility": "internal" }, "children": @@ -108,13 +102,11 @@ { "attributes": { - "documentation": null, "functionSelector": "28811f59", "implemented": true, "isConstructor": false, "kind": "function", "name": "F", - "overrides": null, "scope": 14, "stateMutability": "nonpayable", "virtual": false, @@ -154,7 +146,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null @@ -170,13 +161,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "31", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 1", "value": "1" diff --git a/test/libsolidity/ASTJSON/mutability.json b/test/libsolidity/ASTJSON/mutability.json index 3f5d610ed2a3..f93bbb87fbc3 100644 --- a/test/libsolidity/ASTJSON/mutability.json +++ b/test/libsolidity/ASTJSON/mutability.json @@ -8,7 +8,6 @@ ] }, "id": 11, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 10, "linearizedBaseContracts": @@ -35,7 +33,6 @@ "mutability": "immutable", "name": "a", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 10, "src": "17:27:1", "stateVariable": true, @@ -59,7 +56,6 @@ }, "value": { - "argumentTypes": null, "hexValue": "34", "id": 2, "isConstant": false, @@ -69,7 +65,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "43:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_4_by_1", @@ -86,7 +81,6 @@ "mutability": "constant", "name": "b", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 10, "src": "50:26:1", "stateVariable": true, @@ -110,7 +104,6 @@ }, "value": { - "argumentTypes": null, "hexValue": "32", "id": 5, "isConstant": false, @@ -120,7 +113,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "75:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", @@ -137,7 +129,6 @@ "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 10, "src": "82:17:1", "stateVariable": true, @@ -161,7 +152,6 @@ }, "value": { - "argumentTypes": null, "hexValue": "33", "id": 8, "isConstant": false, @@ -171,7 +161,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "98:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_3_by_1", diff --git a/test/libsolidity/ASTJSON/mutability_legacy.json b/test/libsolidity/ASTJSON/mutability_legacy.json index 387ebc267772..f4eb7e0c5dcd 100644 --- a/test/libsolidity/ASTJSON/mutability_legacy.json +++ b/test/libsolidity/ASTJSON/mutability_legacy.json @@ -8,8 +8,7 @@ [ 10 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -44,7 +42,6 @@ "functionSelector": "0dbe671f", "mutability": "immutable", "name": "a", - "overrides": null, "scope": 10, "stateVariable": true, "storageLocation": "default", @@ -66,13 +63,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "34", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 4", "value": "4" @@ -93,7 +88,6 @@ "functionSelector": "4df7e3d0", "mutability": "constant", "name": "b", - "overrides": null, "scope": 10, "stateVariable": true, "storageLocation": "default", @@ -115,13 +109,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "32", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 2", "value": "2" @@ -142,7 +134,6 @@ "functionSelector": "c3da42b8", "mutability": "mutable", "name": "c", - "overrides": null, "scope": 10, "stateVariable": true, "storageLocation": "default", @@ -164,13 +155,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "33", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 3", "value": "3" diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json index d716d91c2d77..49118d4b8238 100644 --- a/test/libsolidity/ASTJSON/non_utf8.json +++ b/test/libsolidity/ASTJSON/non_utf8.json @@ -8,7 +8,6 @@ ] }, "id": 9, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 8, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 6, "src": "35:5:1", "stateVariable": false, @@ -59,15 +56,12 @@ "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, - "typeName": null, - "value": null, "visibility": "internal" } ], "id": 5, "initialValue": { - "argumentTypes": null, "hexValue": "ff", "id": 4, "isConstant": false, @@ -77,20 +71,17 @@ "lValueRequested": false, "nodeType": "Literal", "src": "43:7:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9", "typeString": "literal_string (contains invalid UTF-8 sequence at position 0)" - }, - "value": null + } }, "nodeType": "VariableDeclarationStatement", "src": "35:15:1" } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 7, "implemented": true, @@ -98,7 +89,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/non_utf8_legacy.json b/test/libsolidity/ASTJSON/non_utf8_legacy.json index d49d2013d812..e2e0bcacf003 100644 --- a/test/libsolidity/ASTJSON/non_utf8_legacy.json +++ b/test/libsolidity/ASTJSON/non_utf8_legacy.json @@ -8,8 +8,7 @@ [ 8 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 8, "stateMutability": "nonpayable", "virtual": false, @@ -103,13 +99,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 6, "stateVariable": false, "storageLocation": "default", "type": "string", - "typeName": null, - "value": null, "visibility": "internal" }, "children": [], @@ -120,16 +113,13 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "ff", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "string", - "type": "literal_string (contains invalid UTF-8 sequence at position 0)", - "value": null + "type": "literal_string (contains invalid UTF-8 sequence at position 0)" }, "id": 4, "name": "Literal", diff --git a/test/libsolidity/ASTJSON/override.json b/test/libsolidity/ASTJSON/override.json index 3e5a8c9da52b..49f85144e8fa 100644 --- a/test/libsolidity/ASTJSON/override.json +++ b/test/libsolidity/ASTJSON/override.json @@ -16,7 +16,6 @@ ] }, "id": 32, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -25,7 +24,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -44,7 +42,6 @@ "src": "36:2:1", "statements": [] }, - "documentation": null, "functionSelector": "a399b6a2", "id": 4, "implemented": true, @@ -52,7 +49,6 @@ "modifiers": [], "name": "faa", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, @@ -82,10 +78,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 6, "name": "A", "nodeType": "UserDefinedTypeName", @@ -107,7 +101,6 @@ 5 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": false, "id": 16, "linearizedBaseContracts": @@ -120,8 +113,6 @@ "nodes": [ { - "body": null, - "documentation": null, "functionSelector": "c2985578", "id": 10, "implemented": false, @@ -129,7 +120,6 @@ "modifiers": [], "name": "foo", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 8, @@ -162,7 +152,6 @@ "src": "115:2:1", "statements": [] }, - "documentation": null, "functionSelector": "a399b6a2", "id": 15, "implemented": true, @@ -206,10 +195,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 17, "name": "B", "nodeType": "UserDefinedTypeName", @@ -232,7 +219,6 @@ 16 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 31, "linearizedBaseContracts": @@ -257,7 +243,6 @@ "src": "170:3:1", "statements": [] }, - "documentation": null, "functionSelector": "c2985578", "id": 23, "implemented": true, @@ -304,7 +289,6 @@ "src": "212:2:1", "statements": [] }, - "documentation": null, "functionSelector": "a399b6a2", "id": 30, "implemented": true, @@ -319,7 +303,6 @@ "overrides": [ { - "contractScope": null, "id": 25, "name": "A", "nodeType": "UserDefinedTypeName", @@ -332,7 +315,6 @@ } }, { - "contractScope": null, "id": 26, "name": "B", "nodeType": "UserDefinedTypeName", diff --git a/test/libsolidity/ASTJSON/override_legacy.json b/test/libsolidity/ASTJSON/override_legacy.json index 23cf18b2bfda..5cdc2f3649ff 100644 --- a/test/libsolidity/ASTJSON/override_legacy.json +++ b/test/libsolidity/ASTJSON/override_legacy.json @@ -16,8 +16,7 @@ [ 31 ] - }, - "license": null + } }, "children": [ @@ -34,7 +33,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -48,7 +46,6 @@ { "attributes": { - "documentation": null, "functionSelector": "a399b6a2", "implemented": true, "isConstructor": false, @@ -58,7 +55,6 @@ null ], "name": "faa", - "overrides": null, "scope": 5, "stateMutability": "nonpayable", "virtual": false, @@ -124,7 +120,6 @@ 5 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": false, "linearizedBaseContracts": [ @@ -137,16 +132,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "A", "referencedDeclaration": 5, "type": "contract A" @@ -163,8 +154,6 @@ { "attributes": { - "body": null, - "documentation": null, "functionSelector": "c2985578", "implemented": false, "isConstructor": false, @@ -174,7 +163,6 @@ null ], "name": "foo", - "overrides": null, "scope": 16, "stateMutability": "nonpayable", "virtual": false, @@ -220,7 +208,6 @@ [ 4 ], - "documentation": null, "functionSelector": "a399b6a2", "implemented": true, "isConstructor": false, @@ -308,7 +295,6 @@ 16 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -322,16 +308,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "B", "referencedDeclaration": 16, "type": "contract B" @@ -352,7 +334,6 @@ [ 10 ], - "documentation": null, "functionSelector": "c2985578", "implemented": true, "isConstructor": false, @@ -432,7 +413,6 @@ [ 15 ], - "documentation": null, "functionSelector": "a399b6a2", "implemented": true, "isConstructor": false, @@ -455,7 +435,6 @@ { "attributes": { - "contractScope": null, "name": "A", "referencedDeclaration": 5, "type": "contract A" @@ -467,7 +446,6 @@ { "attributes": { - "contractScope": null, "name": "B", "referencedDeclaration": 16, "type": "contract B" diff --git a/test/libsolidity/ASTJSON/placeholder_statement.json b/test/libsolidity/ASTJSON/placeholder_statement.json index 3be70c463e1b..4f9bbbdce8ad 100644 --- a/test/libsolidity/ASTJSON/placeholder_statement.json +++ b/test/libsolidity/ASTJSON/placeholder_statement.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -43,11 +41,9 @@ } ] }, - "documentation": null, "id": 4, "name": "M", "nodeType": "ModifierDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/placeholder_statement_legacy.json b/test/libsolidity/ASTJSON/placeholder_statement_legacy.json index 7ab1f48799de..661feb13e26b 100644 --- a/test/libsolidity/ASTJSON/placeholder_statement_legacy.json +++ b/test/libsolidity/ASTJSON/placeholder_statement_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,9 +38,7 @@ { "attributes": { - "documentation": null, "name": "M", - "overrides": null, "virtual": false, "visibility": "internal" }, diff --git a/test/libsolidity/ASTJSON/receive_ether.json b/test/libsolidity/ASTJSON/receive_ether.json index a837dae157d1..8a1f0ac9a8ff 100644 --- a/test/libsolidity/ASTJSON/receive_ether.json +++ b/test/libsolidity/ASTJSON/receive_ether.json @@ -8,7 +8,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -36,14 +34,12 @@ "src": "42:5:1", "statements": [] }, - "documentation": null, "id": 4, "implemented": true, "kind": "receive", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/receive_ether_legacy.json b/test/libsolidity/ASTJSON/receive_ether_legacy.json index 964bd991b840..d9544f138a48 100644 --- a/test/libsolidity/ASTJSON/receive_ether_legacy.json +++ b/test/libsolidity/ASTJSON/receive_ether_legacy.json @@ -8,8 +8,7 @@ [ 5 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "implemented": true, "isConstructor": false, "kind": "receive", @@ -49,7 +46,6 @@ null ], "name": "", - "overrides": null, "scope": 5, "stateMutability": "payable", "virtual": false, diff --git a/test/libsolidity/ASTJSON/short_type_name.json b/test/libsolidity/ASTJSON/short_type_name.json index 54c9b99eac65..882fcfe24da5 100644 --- a/test/libsolidity/ASTJSON/short_type_name.json +++ b/test/libsolidity/ASTJSON/short_type_name.json @@ -8,7 +8,6 @@ ] }, "id": 12, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 11, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 9, "src": "35:15:1", "stateVariable": false, @@ -74,7 +71,6 @@ } }, "id": 6, - "length": null, "nodeType": "ArrayTypeName", "src": "35:6:1", "typeDescriptions": @@ -83,18 +79,15 @@ "typeString": "uint256[]" } }, - "value": null, "visibility": "internal" } ], "id": 8, - "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "35:15:1" } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 10, "implemented": true, @@ -102,7 +95,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/short_type_name_legacy.json b/test/libsolidity/ASTJSON/short_type_name_legacy.json index c813bcdf42a3..8e255954d9a9 100644 --- a/test/libsolidity/ASTJSON/short_type_name_legacy.json +++ b/test/libsolidity/ASTJSON/short_type_name_legacy.json @@ -8,8 +8,7 @@ [ 11 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 11, "stateMutability": "nonpayable", "virtual": false, @@ -93,8 +89,7 @@ "assignments": [ 7 - ], - "initialValue": null + ] }, "children": [ @@ -104,12 +99,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 9, "stateVariable": false, "storageLocation": "memory", "type": "uint256[]", - "value": null, "visibility": "internal" }, "children": @@ -117,7 +110,6 @@ { "attributes": { - "length": null, "type": "uint256[]" }, "children": diff --git a/test/libsolidity/ASTJSON/short_type_name_ref.json b/test/libsolidity/ASTJSON/short_type_name_ref.json index 1a22f1f2435d..2d07a9c609dd 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref.json @@ -8,7 +8,6 @@ ] }, "id": 13, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 12, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "rows", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 10, "src": "35:20:1", "stateVariable": false, @@ -76,7 +73,6 @@ } }, "id": 6, - "length": null, "nodeType": "ArrayTypeName", "src": "35:6:1", "typeDescriptions": @@ -86,7 +82,6 @@ } }, "id": 7, - "length": null, "nodeType": "ArrayTypeName", "src": "35:8:1", "typeDescriptions": @@ -95,18 +90,15 @@ "typeString": "uint256[][]" } }, - "value": null, "visibility": "internal" } ], "id": 9, - "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "35:20:1" } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 11, "implemented": true, @@ -114,7 +106,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json index 086a215848d7..5316c56ac572 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json @@ -8,8 +8,7 @@ [ 12 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 12, "stateMutability": "nonpayable", "virtual": false, @@ -93,8 +89,7 @@ "assignments": [ 8 - ], - "initialValue": null + ] }, "children": [ @@ -104,12 +99,10 @@ "constant": false, "mutability": "mutable", "name": "rows", - "overrides": null, "scope": 10, "stateVariable": false, "storageLocation": "memory", "type": "uint256[][]", - "value": null, "visibility": "internal" }, "children": @@ -117,7 +110,6 @@ { "attributes": { - "length": null, "type": "uint256[][]" }, "children": @@ -125,7 +117,6 @@ { "attributes": { - "length": null, "type": "uint256[]" }, "children": diff --git a/test/libsolidity/ASTJSON/smoke.json b/test/libsolidity/ASTJSON/smoke.json index d72018e090d3..dede1661c80f 100644 --- a/test/libsolidity/ASTJSON/smoke.json +++ b/test/libsolidity/ASTJSON/smoke.json @@ -8,7 +8,6 @@ ] }, "id": 2, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 1, "linearizedBaseContracts": diff --git a/test/libsolidity/ASTJSON/smoke_legacy.json b/test/libsolidity/ASTJSON/smoke_legacy.json index da56b0e772af..6097976e922c 100644 --- a/test/libsolidity/ASTJSON/smoke_legacy.json +++ b/test/libsolidity/ASTJSON/smoke_legacy.json @@ -8,8 +8,7 @@ [ 1 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ diff --git a/test/libsolidity/ASTJSON/source_location.json b/test/libsolidity/ASTJSON/source_location.json index b0b81d8f8a12..a13b2546994c 100644 --- a/test/libsolidity/ASTJSON/source_location.json +++ b/test/libsolidity/ASTJSON/source_location.json @@ -8,7 +8,6 @@ ] }, "id": 12, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -17,7 +16,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 11, "linearizedBaseContracts": @@ -49,7 +47,6 @@ "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "overrides": null, "scope": 9, "src": "28:5:1", "stateVariable": false, @@ -59,15 +56,12 @@ "typeIdentifier": "t_uint8", "typeString": "uint8" }, - "typeName": null, - "value": null, "visibility": "internal" } ], "id": 5, "initialValue": { - "argumentTypes": null, "hexValue": "32", "id": 4, "isConstant": false, @@ -77,7 +71,6 @@ "lValueRequested": false, "nodeType": "Literal", "src": "36:1:1", - "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", @@ -91,7 +84,6 @@ { "expression": { - "argumentTypes": null, "id": 7, "isConstant": false, "isLValue": false, @@ -103,7 +95,6 @@ "src": "39:3:1", "subExpression": { - "argumentTypes": null, "id": 6, "name": "x", "nodeType": "Identifier", @@ -128,7 +119,6 @@ } ] }, - "documentation": null, "functionSelector": "26121ff0", "id": 10, "implemented": true, @@ -136,7 +126,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, diff --git a/test/libsolidity/ASTJSON/source_location_legacy.json b/test/libsolidity/ASTJSON/source_location_legacy.json index 42f81ad1614e..5d55cfe57fd0 100644 --- a/test/libsolidity/ASTJSON/source_location_legacy.json +++ b/test/libsolidity/ASTJSON/source_location_legacy.json @@ -8,8 +8,7 @@ [ 11 ] - }, - "license": null + } }, "children": [ @@ -26,7 +25,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -40,7 +38,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -50,7 +47,6 @@ null ], "name": "f", - "overrides": null, "scope": 11, "stateMutability": "nonpayable", "virtual": false, @@ -103,13 +99,10 @@ "constant": false, "mutability": "mutable", "name": "x", - "overrides": null, "scope": 9, "stateVariable": false, "storageLocation": "default", "type": "uint8", - "typeName": null, - "value": null, "visibility": "internal" }, "children": [], @@ -120,13 +113,11 @@ { "attributes": { - "argumentTypes": null, "hexvalue": "32", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, - "subdenomination": null, "token": "number", "type": "int_const 2", "value": "2" @@ -146,7 +137,6 @@ { "attributes": { - "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, @@ -160,7 +150,6 @@ { "attributes": { - "argumentTypes": null, "overloadedDeclarations": [ null diff --git a/test/libsolidity/ASTJSON/two_base_functions.json b/test/libsolidity/ASTJSON/two_base_functions.json index 18412bbc7849..769e5c3f88d1 100644 --- a/test/libsolidity/ASTJSON/two_base_functions.json +++ b/test/libsolidity/ASTJSON/two_base_functions.json @@ -16,7 +16,6 @@ ] }, "id": 23, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -25,7 +24,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -44,7 +42,6 @@ "src": "45:2:1", "statements": [] }, - "documentation": null, "functionSelector": "26121ff0", "id": 4, "implemented": true, @@ -52,7 +49,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 1, @@ -82,7 +78,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 10, "linearizedBaseContracts": @@ -101,7 +96,6 @@ "src": "95:2:1", "statements": [] }, - "documentation": null, "functionSelector": "26121ff0", "id": 9, "implemented": true, @@ -109,7 +103,6 @@ "modifiers": [], "name": "f", "nodeType": "FunctionDefinition", - "overrides": null, "parameters": { "id": 6, @@ -139,10 +132,8 @@ "baseContracts": [ { - "arguments": null, "baseName": { - "contractScope": null, "id": 11, "name": "A", "nodeType": "UserDefinedTypeName", @@ -159,10 +150,8 @@ "src": "114:1:1" }, { - "arguments": null, "baseName": { - "contractScope": null, "id": 13, "name": "B", "nodeType": "UserDefinedTypeName", @@ -185,7 +174,6 @@ 10 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 22, "linearizedBaseContracts": @@ -211,7 +199,6 @@ "src": "160:2:1", "statements": [] }, - "documentation": null, "functionSelector": "26121ff0", "id": 21, "implemented": true, @@ -226,7 +213,6 @@ "overrides": [ { - "contractScope": null, "id": 16, "name": "A", "nodeType": "UserDefinedTypeName", @@ -239,7 +225,6 @@ } }, { - "contractScope": null, "id": 17, "name": "B", "nodeType": "UserDefinedTypeName", diff --git a/test/libsolidity/ASTJSON/two_base_functions_legacy.json b/test/libsolidity/ASTJSON/two_base_functions_legacy.json index b58008b75909..a5bd2d725d80 100644 --- a/test/libsolidity/ASTJSON/two_base_functions_legacy.json +++ b/test/libsolidity/ASTJSON/two_base_functions_legacy.json @@ -16,8 +16,7 @@ [ 22 ] - }, - "license": null + } }, "children": [ @@ -34,7 +33,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -48,7 +46,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -58,7 +55,6 @@ null ], "name": "f", - "overrides": null, "scope": 5, "stateMutability": "nonpayable", "virtual": true, @@ -128,7 +124,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -142,7 +137,6 @@ { "attributes": { - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -152,7 +146,6 @@ null ], "name": "f", - "overrides": null, "scope": 10, "stateMutability": "nonpayable", "virtual": true, @@ -219,7 +212,6 @@ 10 ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -233,16 +225,12 @@ "children": [ { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "A", "referencedDeclaration": 5, "type": "contract A" @@ -257,16 +245,12 @@ "src": "114:1:1" }, { - "attributes": - { - "arguments": null - }, + "attributes": {}, "children": [ { "attributes": { - "contractScope": null, "name": "B", "referencedDeclaration": 10, "type": "contract B" @@ -288,7 +272,6 @@ 4, 9 ], - "documentation": null, "functionSelector": "26121ff0", "implemented": true, "isConstructor": false, @@ -311,7 +294,6 @@ { "attributes": { - "contractScope": null, "name": "A", "referencedDeclaration": 5, "type": "contract A" @@ -323,7 +305,6 @@ { "attributes": { - "contractScope": null, "name": "B", "referencedDeclaration": 10, "type": "contract B" diff --git a/test/libsolidity/ASTJSON/using_for_directive.json b/test/libsolidity/ASTJSON/using_for_directive.json index 66674f5899b9..d26922262241 100644 --- a/test/libsolidity/ASTJSON/using_for_directive.json +++ b/test/libsolidity/ASTJSON/using_for_directive.json @@ -12,7 +12,6 @@ ] }, "id": 6, - "license": null, "nodeType": "SourceUnit", "nodes": [ @@ -21,7 +20,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "library", - "documentation": null, "fullyImplemented": true, "id": 1, "linearizedBaseContracts": @@ -39,7 +37,6 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "id": 5, "linearizedBaseContracts": @@ -54,7 +51,6 @@ "id": 4, "libraryName": { - "contractScope": null, "id": 2, "name": "L", "nodeType": "UserDefinedTypeName", diff --git a/test/libsolidity/ASTJSON/using_for_directive_legacy.json b/test/libsolidity/ASTJSON/using_for_directive_legacy.json index 280e9be4aebd..bdd92fcbaa31 100644 --- a/test/libsolidity/ASTJSON/using_for_directive_legacy.json +++ b/test/libsolidity/ASTJSON/using_for_directive_legacy.json @@ -12,8 +12,7 @@ [ 1 ] - }, - "license": null + } }, "children": [ @@ -30,7 +29,6 @@ null ], "contractKind": "library", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -60,7 +58,6 @@ null ], "contractKind": "contract", - "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ @@ -77,7 +74,6 @@ { "attributes": { - "contractScope": null, "name": "L", "referencedDeclaration": 1, "type": "library L" diff --git a/tools/yulPhaser/Program.cpp b/tools/yulPhaser/Program.cpp index a457750d2227..5fcca0af5924 100644 --- a/tools/yulPhaser/Program.cpp +++ b/tools/yulPhaser/Program.cpp @@ -119,7 +119,7 @@ ostream& phaser::operator<<(ostream& _stream, Program const& _program) string Program::toJson() const { Json::Value serializedAst = AsmJsonConverter(0)(*m_ast); - return jsonPrettyPrint(serializedAst); + return jsonPrettyPrint(removeNullMembers(std::move(serializedAst))); } variant, ErrorList> Program::parseObject(Dialect const& _dialect, CharStream _source) From d199fc537ba1796c584817073ca30ab93e47b2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 29 Feb 2020 19:53:58 +0100 Subject: [PATCH 091/479] Add configurable weights to CodeSize metric --- libyul/optimiser/Metrics.cpp | 79 ++++++++----- libyul/optimiser/Metrics.h | 57 ++++++++-- test/libyul/Metrics.cpp | 209 ++++++++++++++++++++++++++++++++++- 3 files changed, 304 insertions(+), 41 deletions(-) diff --git a/libyul/optimiser/Metrics.cpp b/libyul/optimiser/Metrics.cpp index bcd723464e60..5a7162294a02 100644 --- a/libyul/optimiser/Metrics.cpp +++ b/libyul/optimiser/Metrics.cpp @@ -36,30 +36,71 @@ using namespace solidity; using namespace solidity::yul; using namespace solidity::util; -size_t CodeSize::codeSize(Statement const& _statement) +size_t CodeWeights::costOf(Statement const& _statement) const { - CodeSize cs; + if (holds_alternative(_statement)) + return expressionStatementCost; + else if (holds_alternative(_statement)) + return assignmentCost; + else if (holds_alternative(_statement)) + return variableDeclarationCost; + else if (holds_alternative(_statement)) + return functionDefinitionCost; + else if (holds_alternative(_statement)) + return ifCost; + else if (holds_alternative(_statement)) + return switchCost + caseCost * std::get(_statement).cases.size(); + else if (holds_alternative(_statement)) + return forLoopCost; + else if (holds_alternative(_statement)) + return breakCost; + else if (holds_alternative(_statement)) + return continueCost; + else if (holds_alternative(_statement)) + return leaveCost; + else if (holds_alternative(_statement)) + return blockCost; + else + yulAssert(false, "If you add a new statement type, you must update CodeWeights."); +} + +size_t CodeWeights::costOf(Expression const& _expression) const +{ + if (holds_alternative(_expression)) + return functionCallCost; + else if (holds_alternative(_expression)) + return identifierCost; + else if (holds_alternative(_expression)) + return literalCost; + else + yulAssert(false, "If you add a new expression type, you must update CodeWeights."); +} + + +size_t CodeSize::codeSize(Statement const& _statement, CodeWeights const& _weights) +{ + CodeSize cs(true, _weights); cs.visit(_statement); return cs.m_size; } -size_t CodeSize::codeSize(Expression const& _expression) +size_t CodeSize::codeSize(Expression const& _expression, CodeWeights const& _weights) { - CodeSize cs; + CodeSize cs(true, _weights); cs.visit(_expression); return cs.m_size; } -size_t CodeSize::codeSize(Block const& _block) +size_t CodeSize::codeSize(Block const& _block, CodeWeights const& _weights) { - CodeSize cs; + CodeSize cs(true, _weights); cs(_block); return cs.m_size; } -size_t CodeSize::codeSizeIncludingFunctions(Block const& _block) +size_t CodeSize::codeSizeIncludingFunctions(Block const& _block, CodeWeights const& _weights) { - CodeSize cs(false); + CodeSize cs(false, _weights); cs(_block); return cs.m_size; } @@ -68,32 +109,14 @@ void CodeSize::visit(Statement const& _statement) { if (holds_alternative(_statement) && m_ignoreFunctions) return; - else if ( - holds_alternative(_statement) || - holds_alternative(_statement) || - holds_alternative(_statement) || - holds_alternative(_statement) - ) - m_size += 2; - else if (holds_alternative(_statement)) - m_size += 3; - else if (holds_alternative(_statement)) - m_size += 1 + 2 * std::get(_statement).cases.size(); - else if (!( - holds_alternative(_statement) || - holds_alternative(_statement) || - holds_alternative(_statement) || - holds_alternative(_statement) - )) - ++m_size; + m_size += m_weights.costOf(_statement); ASTWalker::visit(_statement); } void CodeSize::visit(Expression const& _expression) { - if (!holds_alternative(_expression)) - ++m_size; + m_size += m_weights.costOf(_expression); ASTWalker::visit(_expression); } diff --git a/libyul/optimiser/Metrics.h b/libyul/optimiser/Metrics.h index 0b1087de2fcd..19ca5616f0fb 100644 --- a/libyul/optimiser/Metrics.h +++ b/libyul/optimiser/Metrics.h @@ -30,33 +30,67 @@ struct Dialect; struct EVMDialect; /** - * Metric for the size of code. - * More specifically, the number of AST nodes. - * Ignores function definitions while traversing the AST by default. - * If you want to know the size of a function, you have to invoke this on its body. + * Weights to be assigned to specific yul statements and expressions by a metric. + * + * The default values are meant to reflect specifically the number of AST nodes. * - * As an exception, the following AST elements have a cost of zero: + * The following AST elements have a default cost of zero (because the cleanup phase would + * remove them anyway or they are just wrappers around something else will be counted instead): * - expression statement (only the expression inside has a cost) * - block (only the statements inside have a cost) * - variable references * - variable declarations (only the right hand side has a cost) * - assignments (only the value has a cost) * - * As another exception, each statement incurs and additional cost of one + * Each statement incurs and additional cost of one * per jump/branch. This means if, break and continue statements have a cost of 2, * switch statements have a cost of 1 plus the number of cases times two, * and for loops cost 3. +*/ +struct CodeWeights +{ + // Statements + size_t expressionStatementCost = 0; + size_t assignmentCost = 0; + size_t variableDeclarationCost = 0; + size_t functionDefinitionCost = 1; + size_t ifCost = 2; + size_t switchCost = 1; + size_t caseCost = 2; + size_t forLoopCost = 3; + size_t breakCost = 2; + size_t continueCost = 2; + size_t leaveCost = 2; + size_t blockCost = 0; + + // Expressions + size_t functionCallCost = 1; + size_t identifierCost = 0; + size_t literalCost = 1; + + size_t costOf(Statement const& _statement) const; + size_t costOf(Expression const& _expression) const; +}; + +/** + * Metric for the size of code. + * Ignores function definitions while traversing the AST by default. + * If you want to know the size of a function, you have to invoke this on its body. + * + * The cost of each statement and expression type is configurable via CodeWeights. */ class CodeSize: public ASTWalker { public: - static size_t codeSize(Statement const& _statement); - static size_t codeSize(Expression const& _expression); - static size_t codeSize(Block const& _block); - static size_t codeSizeIncludingFunctions(Block const& _block); + static size_t codeSize(Statement const& _statement, CodeWeights const& _weights = {}); + static size_t codeSize(Expression const& _expression, CodeWeights const& _weights = {}); + static size_t codeSize(Block const& _block, CodeWeights const& _weights = {}); + static size_t codeSizeIncludingFunctions(Block const& _block, CodeWeights const& _weights = {}); private: - CodeSize(bool _ignoreFunctions = true): m_ignoreFunctions(_ignoreFunctions) {} + CodeSize(bool _ignoreFunctions = true, CodeWeights const& _weights = {}): + m_ignoreFunctions(_ignoreFunctions), + m_weights(_weights) {} void visit(Statement const& _statement) override; void visit(Expression const& _expression) override; @@ -64,6 +98,7 @@ class CodeSize: public ASTWalker private: bool m_ignoreFunctions; size_t m_size = 0; + CodeWeights m_weights; }; /** diff --git a/test/libyul/Metrics.cpp b/test/libyul/Metrics.cpp index 1841abc676f1..2d1cc1c4ec75 100644 --- a/test/libyul/Metrics.cpp +++ b/test/libyul/Metrics.cpp @@ -36,15 +36,38 @@ namespace solidity::yul::test namespace { -size_t codeSize(string const& _source) +size_t codeSize(string const& _source, CodeWeights const _weights = {}) { shared_ptr ast = parse(_source, false).first; BOOST_REQUIRE(ast); - return CodeSize::codeSize(*ast); + return CodeSize::codeSize(*ast, _weights); } } +class CustomWeightFixture +{ +protected: + CodeWeights m_weights{ + /* expressionStatementCost = */ 1, + /* assignmentCost = */ 2, + /* variableDeclarationCost = */ 3, + /* functionDefinitionCost = */ 4, + /* ifCost = */ 5, + /* switchCost = */ 6, + /* caseCost = */ 7, + /* forLoopCost = */ 8, + /* breakCost = */ 9, + /* continueCost = */ 10, + /* leaveCost = */ 11, + /* blockCost = */ 12, + + /* functionCallCost = */ 13, + /* identifierCost = */ 14, + /* literalCost = */ 15, + }; +}; + BOOST_AUTO_TEST_SUITE(YulCodeSize) BOOST_AUTO_TEST_CASE(empty_code) @@ -52,41 +75,103 @@ BOOST_AUTO_TEST_CASE(empty_code) BOOST_CHECK_EQUAL(codeSize("{}"), 0); } +BOOST_FIXTURE_TEST_CASE(empty_code_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL(codeSize("{}", m_weights), 0); +} + BOOST_AUTO_TEST_CASE(nested_blocks) { BOOST_CHECK_EQUAL(codeSize("{ {} {} {{ }} }"), 0); } +BOOST_FIXTURE_TEST_CASE(nested_blocks_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL(codeSize("{ {} {} {{ }} }", m_weights), 4 * m_weights.blockCost); +} + BOOST_AUTO_TEST_CASE(instruction) { BOOST_CHECK_EQUAL(codeSize("{ pop(calldatasize()) }"), 2); } +BOOST_FIXTURE_TEST_CASE(instruction_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ pop(calldatasize()) }", m_weights), + 2 * m_weights.functionCallCost + + 1 * m_weights.expressionStatementCost + ); +} + BOOST_AUTO_TEST_CASE(variables_are_free) { BOOST_CHECK_EQUAL(codeSize("{ let x let y let a, b, c }"), 0); } +BOOST_FIXTURE_TEST_CASE(variables_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ let x let y let a, b, c }", m_weights), + 3 * m_weights.variableDeclarationCost + ); +} + BOOST_AUTO_TEST_CASE(constants_cost_one) { BOOST_CHECK_EQUAL(codeSize("{ let x := 3 }"), 1); } +BOOST_FIXTURE_TEST_CASE(constants_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ let x := 3 }", m_weights), + 1 * m_weights.variableDeclarationCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(functions_are_skipped) { BOOST_CHECK_EQUAL(codeSize("{ function f(x) -> r { r := mload(x) } }"), 0); } +BOOST_FIXTURE_TEST_CASE(functions_are_skipped_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL(codeSize("{ function f(x) -> r { r := mload(x) } }", m_weights), 0); +} + BOOST_AUTO_TEST_CASE(function_with_arguments) { BOOST_CHECK_EQUAL(codeSize("{ function f(x) { sstore(x, 2) } f(2) }"), 2); } +BOOST_FIXTURE_TEST_CASE(function_with_arguments_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ function f(x) { sstore(x, 2) } f(2) }", m_weights), + 1 * m_weights.expressionStatementCost + + 1 * m_weights.functionCallCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(function_with_variables_as_arguments) { BOOST_CHECK_EQUAL(codeSize("{ function f(x) { sstore(x, 2) } let y f(y) }"), 1); } +BOOST_FIXTURE_TEST_CASE(function_with_variables_as_arguments_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ function f(x) { sstore(x, 2) } let y f(y) }", m_weights), + 1 * m_weights.variableDeclarationCost + + 1 * m_weights.expressionStatementCost + + 1 * m_weights.functionCallCost + + 1 * m_weights.identifierCost + ); +} + BOOST_AUTO_TEST_CASE(function_with_variables_and_constants_as_arguments) { BOOST_CHECK_EQUAL(codeSize( @@ -94,21 +179,69 @@ BOOST_AUTO_TEST_CASE(function_with_variables_and_constants_as_arguments) ), 2); } +BOOST_FIXTURE_TEST_CASE( + function_with_variables_and_constants_as_arguments_custom_weights, + CustomWeightFixture +) +{ + BOOST_CHECK_EQUAL( + codeSize( + "{ function f(x, r) -> z { sstore(x, r) z := r } let y let t := f(y, 2) }", + m_weights + ), + 2 * m_weights.variableDeclarationCost + + 1 * m_weights.functionCallCost + + 1 * m_weights.identifierCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(assignment) { BOOST_CHECK_EQUAL(codeSize("{ let a a := 3 }"), 1); } +BOOST_FIXTURE_TEST_CASE(assignment_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ let a a := 3 }", m_weights), + 1 * m_weights.variableDeclarationCost + + 1 * m_weights.assignmentCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(assignments_between_vars_are_free) { BOOST_CHECK_EQUAL(codeSize("{ let a let b := a a := b }"), 0); } +BOOST_FIXTURE_TEST_CASE(assignments_between_vars_are_free_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ let a let b := a a := b }", m_weights), + 2 * m_weights.variableDeclarationCost + + 1 * m_weights.assignmentCost + + 2 * m_weights.identifierCost + ); +} + BOOST_AUTO_TEST_CASE(assignment_complex) { BOOST_CHECK_EQUAL(codeSize("{ let a let x := mload(a) a := sload(x) }"), 2); } +BOOST_FIXTURE_TEST_CASE(assignment_complex_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ let a let x := mload(a) a := sload(x) }", m_weights), + 2 * m_weights.variableDeclarationCost + + 1 * m_weights.assignmentCost + + 2 * m_weights.identifierCost + + 2 * m_weights.functionCallCost + ); +} + BOOST_AUTO_TEST_CASE(empty_for_loop) { BOOST_CHECK_EQUAL(codeSize( @@ -116,6 +249,15 @@ BOOST_AUTO_TEST_CASE(empty_for_loop) ), 4); } +BOOST_FIXTURE_TEST_CASE(empty_for_loop_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ for {} 1 {} {} }", m_weights), + 1 * m_weights.forLoopCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(break_statement) { BOOST_CHECK_EQUAL(codeSize( @@ -123,6 +265,16 @@ BOOST_AUTO_TEST_CASE(break_statement) ), 6); } +BOOST_FIXTURE_TEST_CASE(break_statement_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ for {} 1 {} { break } }", m_weights), + 1 * m_weights.forLoopCost + + 1 * m_weights.literalCost + + 1 * m_weights.breakCost + ); +} + BOOST_AUTO_TEST_CASE(continue_statement) { BOOST_CHECK_EQUAL(codeSize( @@ -130,6 +282,16 @@ BOOST_AUTO_TEST_CASE(continue_statement) ), 6); } +BOOST_FIXTURE_TEST_CASE(continue_statement_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ for {} 1 {} { continue } }", m_weights), + 1 * m_weights.forLoopCost + + 1 * m_weights.literalCost + + 1 * m_weights.continueCost + ); +} + BOOST_AUTO_TEST_CASE(regular_for_loop) { BOOST_CHECK_EQUAL(codeSize( @@ -137,6 +299,20 @@ BOOST_AUTO_TEST_CASE(regular_for_loop) ), 10); } +BOOST_FIXTURE_TEST_CASE(regular_for_loop_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ for { let x := 0 } lt(x, 10) { x := add(x, 1) } { mstore(x, 1) } }", m_weights), + 1 * m_weights.forLoopCost + + 1 * m_weights.variableDeclarationCost + + 1 * m_weights.assignmentCost + + 3 * m_weights.functionCallCost + + 4 * m_weights.literalCost + + 3 * m_weights.identifierCost + + 1 * m_weights.expressionStatementCost + ); +} + BOOST_AUTO_TEST_CASE(if_statement) { BOOST_CHECK_EQUAL(codeSize( @@ -144,6 +320,15 @@ BOOST_AUTO_TEST_CASE(if_statement) ), 3); } +BOOST_FIXTURE_TEST_CASE(if_statement_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ if 1 {} }", m_weights), + 1 * m_weights.ifCost + + 1 * m_weights.literalCost + ); +} + BOOST_AUTO_TEST_CASE(switch_statement_tiny) { BOOST_CHECK_EQUAL(codeSize( @@ -158,6 +343,16 @@ BOOST_AUTO_TEST_CASE(switch_statement_small) ), 6); } +BOOST_FIXTURE_TEST_CASE(switch_statement_small_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ switch calldatasize() case 0 {} default {} }", m_weights), + 1 * m_weights.functionCallCost + + 1 * m_weights.switchCost + + 2 * m_weights.caseCost + ); +} + BOOST_AUTO_TEST_CASE(switch_statement_medium) { BOOST_CHECK_EQUAL(codeSize( @@ -172,6 +367,16 @@ BOOST_AUTO_TEST_CASE(switch_statement_large) ), 10); } +BOOST_FIXTURE_TEST_CASE(switch_statement_large_custom_weights, CustomWeightFixture) +{ + BOOST_CHECK_EQUAL( + codeSize("{ switch calldatasize() case 0 {} case 1 {} case 2 {} default {} }", m_weights), + 1 * m_weights.functionCallCost + + 1 * m_weights.switchCost + + 4 * m_weights.caseCost + ); +} + BOOST_AUTO_TEST_SUITE_END() } From 40dfac76838a96eb564acd19ad962e84cf3c60f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 29 Feb 2020 21:55:32 +0100 Subject: [PATCH 092/479] [yul-phaser] Require specifying weights for Program::codeSize() --- test/yulPhaser/AlgorithmRunner.cpp | 5 +- test/yulPhaser/FitnessMetrics.cpp | 77 ++++++++++++++++-------------- test/yulPhaser/Program.cpp | 2 +- test/yulPhaser/ProgramCache.cpp | 12 +++-- tools/yulPhaser/FitnessMetrics.cpp | 7 +-- tools/yulPhaser/FitnessMetrics.h | 9 +++- tools/yulPhaser/Phaser.cpp | 3 ++ tools/yulPhaser/Program.cpp | 4 +- tools/yulPhaser/Program.h | 5 +- tools/yulPhaser/ProgramCache.cpp | 4 +- 10 files changed, 76 insertions(+), 52 deletions(-) diff --git a/test/yulPhaser/AlgorithmRunner.cpp b/test/yulPhaser/AlgorithmRunner.cpp index 8dd6e7564382..042cd4c2bf39 100644 --- a/test/yulPhaser/AlgorithmRunner.cpp +++ b/test/yulPhaser/AlgorithmRunner.cpp @@ -37,6 +37,7 @@ using namespace boost::unit_test::framework; using namespace boost::test_tools; using namespace solidity::langutil; using namespace solidity::util; +using namespace solidity::yul; namespace fs = boost::filesystem; @@ -299,8 +300,8 @@ BOOST_FIXTURE_TEST_CASE(run_should_print_cache_stats_if_requested, AlgorithmRunn make_shared(programs[1]), }; shared_ptr fitnessMetric = make_shared(vector>{ - make_shared(nullopt, caches[0]), - make_shared(nullopt, caches[1]), + make_shared(nullopt, caches[0], CodeWeights{}), + make_shared(nullopt, caches[1], CodeWeights{}), }); Population population = Population::makeRandom(fitnessMetric, 2, 0, 5); diff --git a/test/yulPhaser/FitnessMetrics.cpp b/test/yulPhaser/FitnessMetrics.cpp index 524ef6357e1f..e668b54e9d17 100644 --- a/test/yulPhaser/FitnessMetrics.cpp +++ b/test/yulPhaser/FitnessMetrics.cpp @@ -62,12 +62,12 @@ class ProgramBasedMetricFixture Program optimisedProgram(Program _program) const { - [[maybe_unused]] size_t originalSize = _program.codeSize(); + [[maybe_unused]] size_t originalSize = _program.codeSize(m_weights); Program result = move(_program); result.optimise(m_chromosome.optimisationSteps()); // Make sure that the program and the chromosome we have chosen are suitable for the test - assert(result.codeSize() != originalSize); + assert(result.codeSize(m_weights) != originalSize); return result; } @@ -77,15 +77,16 @@ class ProgramBasedMetricFixture Program m_program = get(Program::load(m_sourceStream)); Program m_optimisedProgram = optimisedProgram(m_program); shared_ptr m_programCache = make_shared(m_program); + static constexpr CodeWeights m_weights{}; }; class FitnessMetricCombinationFixture: public ProgramBasedMetricFixture { protected: vector> m_simpleMetrics = { - make_shared(m_program, nullptr, 1), - make_shared(m_program, nullptr, 2), - make_shared(m_program, nullptr, 3), + make_shared(m_program, nullptr, m_weights, 1), + make_shared(m_program, nullptr, m_weights, 2), + make_shared(m_program, nullptr, m_weights, 3), }; vector m_fitness = { m_simpleMetrics[0]->evaluate(m_chromosome), @@ -100,7 +101,7 @@ BOOST_AUTO_TEST_SUITE(ProgramBasedMetricTest) BOOST_FIXTURE_TEST_CASE(optimisedProgram_should_return_optimised_program_even_if_cache_not_available, ProgramBasedMetricFixture) { - string code = toString(DummyProgramBasedMetric(m_program, nullptr).optimisedProgram(m_chromosome)); + string code = toString(DummyProgramBasedMetric(m_program, nullptr, m_weights).optimisedProgram(m_chromosome)); BOOST_TEST(code != toString(m_program)); BOOST_TEST(code == toString(m_optimisedProgram)); @@ -108,7 +109,7 @@ BOOST_FIXTURE_TEST_CASE(optimisedProgram_should_return_optimised_program_even_if BOOST_FIXTURE_TEST_CASE(optimisedProgram_should_use_cache_if_available, ProgramBasedMetricFixture) { - string code = toString(DummyProgramBasedMetric(nullopt, m_programCache).optimisedProgram(m_chromosome)); + string code = toString(DummyProgramBasedMetric(nullopt, m_programCache, m_weights).optimisedProgram(m_chromosome)); BOOST_TEST(code != toString(m_program)); BOOST_TEST(code == toString(m_optimisedProgram)); @@ -117,7 +118,7 @@ BOOST_FIXTURE_TEST_CASE(optimisedProgram_should_use_cache_if_available, ProgramB BOOST_FIXTURE_TEST_CASE(optimisedProgramNoCache_should_return_optimised_program_even_if_cache_not_available, ProgramBasedMetricFixture) { - string code = toString(DummyProgramBasedMetric(m_program, nullptr).optimisedProgramNoCache(m_chromosome)); + string code = toString(DummyProgramBasedMetric(m_program, nullptr, m_weights).optimisedProgramNoCache(m_chromosome)); BOOST_TEST(code != toString(m_program)); BOOST_TEST(code == toString(m_optimisedProgram)); @@ -125,7 +126,7 @@ BOOST_FIXTURE_TEST_CASE(optimisedProgramNoCache_should_return_optimised_program_ BOOST_FIXTURE_TEST_CASE(optimisedProgramNoCache_should_not_use_cache_even_if_available, ProgramBasedMetricFixture) { - string code = toString(DummyProgramBasedMetric(nullopt, m_programCache).optimisedProgramNoCache(m_chromosome)); + string code = toString(DummyProgramBasedMetric(nullopt, m_programCache, m_weights).optimisedProgramNoCache(m_chromosome)); BOOST_TEST(code != toString(m_program)); BOOST_TEST(code == toString(m_optimisedProgram)); @@ -137,18 +138,18 @@ BOOST_AUTO_TEST_SUITE(ProgramSizeTest) BOOST_FIXTURE_TEST_CASE(evaluate_should_compute_size_of_the_optimised_program, ProgramBasedMetricFixture) { - size_t fitness = ProgramSize(m_program, nullptr).evaluate(m_chromosome); + size_t fitness = ProgramSize(m_program, nullptr, m_weights).evaluate(m_chromosome); - BOOST_TEST(fitness != m_program.codeSize()); - BOOST_TEST(fitness == m_optimisedProgram.codeSize()); + BOOST_TEST(fitness != m_program.codeSize(m_weights)); + BOOST_TEST(fitness == m_optimisedProgram.codeSize(m_weights)); } BOOST_FIXTURE_TEST_CASE(evaluate_should_be_able_to_use_program_cache_if_available, ProgramBasedMetricFixture) { - size_t fitness = ProgramSize(nullopt, m_programCache).evaluate(m_chromosome); + size_t fitness = ProgramSize(nullopt, m_programCache, m_weights).evaluate(m_chromosome); - BOOST_TEST(fitness != m_program.codeSize()); - BOOST_TEST(fitness == m_optimisedProgram.codeSize()); + BOOST_TEST(fitness != m_program.codeSize(m_weights)); + BOOST_TEST(fitness == m_optimisedProgram.codeSize(m_weights)); BOOST_TEST(m_programCache->size() == m_chromosome.length()); } @@ -157,21 +158,21 @@ BOOST_FIXTURE_TEST_CASE(evaluate_should_repeat_the_optimisation_specified_number Program const& programOptimisedOnce = m_optimisedProgram; Program programOptimisedTwice = optimisedProgram(programOptimisedOnce); - ProgramSize metric(m_program, nullptr, 2); + ProgramSize metric(m_program, nullptr, m_weights, 2); size_t fitness = metric.evaluate(m_chromosome); - BOOST_TEST(fitness != m_program.codeSize()); - BOOST_TEST(fitness != programOptimisedOnce.codeSize()); - BOOST_TEST(fitness == programOptimisedTwice.codeSize()); + BOOST_TEST(fitness != m_program.codeSize(m_weights)); + BOOST_TEST(fitness != programOptimisedOnce.codeSize(m_weights)); + BOOST_TEST(fitness == programOptimisedTwice.codeSize(m_weights)); } BOOST_FIXTURE_TEST_CASE(evaluate_should_not_optimise_if_number_of_repetitions_is_zero, ProgramBasedMetricFixture) { - ProgramSize metric(m_program, nullptr, 0); + ProgramSize metric(m_program, nullptr, m_weights, 0); size_t fitness = metric.evaluate(m_chromosome); - BOOST_TEST(fitness == m_program.codeSize()); - BOOST_TEST(fitness != m_optimisedProgram.codeSize()); + BOOST_TEST(fitness == m_program.codeSize(m_weights)); + BOOST_TEST(fitness != m_optimisedProgram.codeSize(m_weights)); } BOOST_AUTO_TEST_SUITE_END() @@ -179,12 +180,18 @@ BOOST_AUTO_TEST_SUITE(RelativeProgramSizeTest) BOOST_FIXTURE_TEST_CASE(evaluate_should_compute_the_size_ratio_between_optimised_program_and_original_program, ProgramBasedMetricFixture) { - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 3).evaluate(m_chromosome) == round(1000.0 * m_optimisedProgram.codeSize() / m_program.codeSize())); + BOOST_TEST( + RelativeProgramSize(m_program, nullptr, 3, m_weights).evaluate(m_chromosome) == + round(1000.0 * m_optimisedProgram.codeSize(m_weights) / m_program.codeSize(m_weights)) + ); } BOOST_FIXTURE_TEST_CASE(evaluate_should_be_able_to_use_program_cache_if_available, ProgramBasedMetricFixture) { - BOOST_TEST(RelativeProgramSize(nullopt, m_programCache, 3).evaluate(m_chromosome) == round(1000.0 * m_optimisedProgram.codeSize() / m_program.codeSize())); + BOOST_TEST( + RelativeProgramSize(nullopt, m_programCache, 3, m_weights).evaluate(m_chromosome) == + round(1000.0 * m_optimisedProgram.codeSize(m_weights) / m_program.codeSize(m_weights)) + ); BOOST_TEST(m_programCache->size() == m_chromosome.length()); } @@ -193,17 +200,17 @@ BOOST_FIXTURE_TEST_CASE(evaluate_should_repeat_the_optimisation_specified_number Program const& programOptimisedOnce = m_optimisedProgram; Program programOptimisedTwice = optimisedProgram(programOptimisedOnce); - RelativeProgramSize metric(m_program, nullptr, 3, 2); + RelativeProgramSize metric(m_program, nullptr, 3, m_weights, 2); size_t fitness = metric.evaluate(m_chromosome); BOOST_TEST(fitness != 1000); - BOOST_TEST(fitness != RelativeProgramSize(programOptimisedTwice, nullptr, 3, 1).evaluate(m_chromosome)); - BOOST_TEST(fitness == round(1000.0 * programOptimisedTwice.codeSize() / m_program.codeSize())); + BOOST_TEST(fitness != RelativeProgramSize(programOptimisedTwice, nullptr, 3, m_weights, 1).evaluate(m_chromosome)); + BOOST_TEST(fitness == round(1000.0 * programOptimisedTwice.codeSize(m_weights) / m_program.codeSize(m_weights))); } BOOST_FIXTURE_TEST_CASE(evaluate_should_return_one_if_number_of_repetitions_is_zero, ProgramBasedMetricFixture) { - RelativeProgramSize metric(m_program, nullptr, 3, 0); + RelativeProgramSize metric(m_program, nullptr, 3, m_weights, 0); BOOST_TEST(metric.evaluate(m_chromosome) == 1000); } @@ -213,7 +220,7 @@ BOOST_FIXTURE_TEST_CASE(evaluate_should_return_one_if_the_original_program_size_ CharStream sourceStream = CharStream("{}", ""); Program program = get(Program::load(sourceStream)); - RelativeProgramSize metric(program, nullptr, 3); + RelativeProgramSize metric(program, nullptr, 3, m_weights); BOOST_TEST(metric.evaluate(m_chromosome) == 1000); BOOST_TEST(metric.evaluate(Chromosome("")) == 1000); @@ -222,12 +229,12 @@ BOOST_FIXTURE_TEST_CASE(evaluate_should_return_one_if_the_original_program_size_ BOOST_FIXTURE_TEST_CASE(evaluate_should_multiply_the_result_by_scaling_factor, ProgramBasedMetricFixture) { - double sizeRatio = static_cast(m_optimisedProgram.codeSize()) / m_program.codeSize(); - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 0).evaluate(m_chromosome) == round(1.0 * sizeRatio)); - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 1).evaluate(m_chromosome) == round(10.0 * sizeRatio)); - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 2).evaluate(m_chromosome) == round(100.0 * sizeRatio)); - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 3).evaluate(m_chromosome) == round(1000.0 * sizeRatio)); - BOOST_TEST(RelativeProgramSize(m_program, nullptr, 4).evaluate(m_chromosome) == round(10000.0 * sizeRatio)); + double sizeRatio = static_cast(m_optimisedProgram.codeSize(m_weights)) / m_program.codeSize(m_weights); + BOOST_TEST(RelativeProgramSize(m_program, nullptr, 0, m_weights).evaluate(m_chromosome) == round(1.0 * sizeRatio)); + BOOST_TEST(RelativeProgramSize(m_program, nullptr, 1, m_weights).evaluate(m_chromosome) == round(10.0 * sizeRatio)); + BOOST_TEST(RelativeProgramSize(m_program, nullptr, 2, m_weights).evaluate(m_chromosome) == round(100.0 * sizeRatio)); + BOOST_TEST(RelativeProgramSize(m_program, nullptr, 3, m_weights).evaluate(m_chromosome) == round(1000.0 * sizeRatio)); + BOOST_TEST(RelativeProgramSize(m_program, nullptr, 4, m_weights).evaluate(m_chromosome) == round(10000.0 * sizeRatio)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/yulPhaser/Program.cpp b/test/yulPhaser/Program.cpp index e69f0fc5c654..0a7520dd7b7c 100644 --- a/test/yulPhaser/Program.cpp +++ b/test/yulPhaser/Program.cpp @@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE(codeSize) CharStream sourceStream(sourceCode, current_test_case().p_name); Program program = get(Program::load(sourceStream)); - BOOST_TEST(program.codeSize() == CodeSize::codeSizeIncludingFunctions(program.ast())); + BOOST_TEST(program.codeSize(CodeWeights{}) == CodeSize::codeSizeIncludingFunctions(program.ast())); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/yulPhaser/ProgramCache.cpp b/test/yulPhaser/ProgramCache.cpp index 1ed6024bcafa..5e2a67c2af43 100644 --- a/test/yulPhaser/ProgramCache.cpp +++ b/test/yulPhaser/ProgramCache.cpp @@ -18,6 +18,8 @@ #include #include +#include + #include #include @@ -212,11 +214,11 @@ BOOST_FIXTURE_TEST_CASE(startRound_should_remove_entries_older_than_two_rounds, BOOST_FIXTURE_TEST_CASE(gatherStats_should_return_cache_statistics, ProgramCacheFixture) { - size_t sizeI = optimisedProgram(m_program, "I").codeSize(); - size_t sizeIu = optimisedProgram(m_program, "Iu").codeSize(); - size_t sizeIuO = optimisedProgram(m_program, "IuO").codeSize(); - size_t sizeL = optimisedProgram(m_program, "L").codeSize(); - size_t sizeLT = optimisedProgram(m_program, "LT").codeSize(); + size_t sizeI = optimisedProgram(m_program, "I").codeSize(CodeWeights{}); + size_t sizeIu = optimisedProgram(m_program, "Iu").codeSize(CodeWeights{}); + size_t sizeIuO = optimisedProgram(m_program, "IuO").codeSize(CodeWeights{}); + size_t sizeL = optimisedProgram(m_program, "L").codeSize(CodeWeights{}); + size_t sizeLT = optimisedProgram(m_program, "LT").codeSize(CodeWeights{}); m_programCache.optimiseProgram("L"); m_programCache.optimiseProgram("Iu"); diff --git a/tools/yulPhaser/FitnessMetrics.cpp b/tools/yulPhaser/FitnessMetrics.cpp index 5279cea723f9..134c13dfcef7 100644 --- a/tools/yulPhaser/FitnessMetrics.cpp +++ b/tools/yulPhaser/FitnessMetrics.cpp @@ -23,6 +23,7 @@ using namespace std; using namespace solidity::util; +using namespace solidity::yul; using namespace solidity::phaser; Program const& ProgramBasedMetric::program() const @@ -55,18 +56,18 @@ Program ProgramBasedMetric::optimisedProgramNoCache(Chromosome const& _chromosom size_t ProgramSize::evaluate(Chromosome const& _chromosome) { - return optimisedProgram(_chromosome).codeSize(); + return optimisedProgram(_chromosome).codeSize(codeWeights()); } size_t RelativeProgramSize::evaluate(Chromosome const& _chromosome) { size_t const scalingFactor = pow(10, m_fixedPointPrecision); - size_t unoptimisedSize = optimisedProgram(Chromosome("")).codeSize(); + size_t unoptimisedSize = optimisedProgram(Chromosome("")).codeSize(codeWeights()); if (unoptimisedSize == 0) return scalingFactor; - size_t optimisedSize = optimisedProgram(_chromosome).codeSize(); + size_t optimisedSize = optimisedProgram(_chromosome).codeSize(codeWeights()); return static_cast(round( static_cast(optimisedSize) / unoptimisedSize * scalingFactor diff --git a/tools/yulPhaser/FitnessMetrics.h b/tools/yulPhaser/FitnessMetrics.h index 72e8111522c5..50f4c896feb8 100644 --- a/tools/yulPhaser/FitnessMetrics.h +++ b/tools/yulPhaser/FitnessMetrics.h @@ -24,6 +24,8 @@ #include #include +#include + #include #include @@ -64,10 +66,12 @@ class ProgramBasedMetric: public FitnessMetric explicit ProgramBasedMetric( std::optional _program, std::shared_ptr _programCache, + yul::CodeWeights const& _codeWeights, size_t _repetitionCount = 1 ): m_program(std::move(_program)), m_programCache(std::move(_programCache)), + m_codeWeights(_codeWeights), m_repetitionCount(_repetitionCount) { assert(m_program.has_value() == (m_programCache == nullptr)); @@ -75,6 +79,7 @@ class ProgramBasedMetric: public FitnessMetric Program const& program() const; ProgramCache const* programCache() const { return m_programCache.get(); } + yul::CodeWeights const& codeWeights() const { return m_codeWeights; } size_t repetitionCount() const { return m_repetitionCount; } Program optimisedProgram(Chromosome const& _chromosome); @@ -83,6 +88,7 @@ class ProgramBasedMetric: public FitnessMetric private: std::optional m_program; std::shared_ptr m_programCache; + yul::CodeWeights m_codeWeights; size_t m_repetitionCount; }; @@ -111,9 +117,10 @@ class RelativeProgramSize: public ProgramBasedMetric std::optional _program, std::shared_ptr _programCache, size_t _fixedPointPrecision, + yul::CodeWeights const& _weights, size_t _repetitionCount = 1 ): - ProgramBasedMetric(std::move(_program), std::move(_programCache), _repetitionCount), + ProgramBasedMetric(std::move(_program), std::move(_programCache), _weights, _repetitionCount), m_fixedPointPrecision(_fixedPointPrecision) {} size_t fixedPointPrecision() const { return m_fixedPointPrecision; } diff --git a/tools/yulPhaser/Phaser.cpp b/tools/yulPhaser/Phaser.cpp index d5b3bdda7599..68b9b05a99c7 100644 --- a/tools/yulPhaser/Phaser.cpp +++ b/tools/yulPhaser/Phaser.cpp @@ -39,6 +39,7 @@ using namespace std; using namespace solidity; using namespace solidity::langutil; using namespace solidity::util; +using namespace solidity::yul; using namespace solidity::phaser; namespace po = boost::program_options; @@ -216,6 +217,7 @@ unique_ptr FitnessMetricFactory::build( metrics.push_back(make_unique( _programCaches[i] != nullptr ? optional{} : move(_programs[i]), move(_programCaches[i]), + CodeWeights{}, _options.chromosomeRepetitions )); @@ -228,6 +230,7 @@ unique_ptr FitnessMetricFactory::build( _programCaches[i] != nullptr ? optional{} : move(_programs[i]), move(_programCaches[i]), _options.relativeMetricScale, + CodeWeights{}, _options.chromosomeRepetitions )); break; diff --git a/tools/yulPhaser/Program.cpp b/tools/yulPhaser/Program.cpp index a457750d2227..2fd29f51a516 100644 --- a/tools/yulPhaser/Program.cpp +++ b/tools/yulPhaser/Program.cpp @@ -207,7 +207,7 @@ unique_ptr Program::applyOptimisationSteps( return _ast; } -size_t Program::computeCodeSize(Block const& _ast) +size_t Program::computeCodeSize(Block const& _ast, CodeWeights const& _weights) { - return CodeSize::codeSizeIncludingFunctions(_ast); + return CodeSize::codeSizeIncludingFunctions(_ast, _weights); } diff --git a/tools/yulPhaser/Program.h b/tools/yulPhaser/Program.h index 10fed6de2f58..b96843ee4c27 100644 --- a/tools/yulPhaser/Program.h +++ b/tools/yulPhaser/Program.h @@ -41,6 +41,7 @@ namespace solidity::yul struct AsmAnalysisInfo; struct Dialect; +struct CodeWeights; } @@ -78,7 +79,7 @@ class Program static std::variant load(langutil::CharStream& _sourceCode); void optimise(std::vector const& _optimisationSteps); - size_t codeSize() const { return computeCodeSize(*m_ast); } + size_t codeSize(yul::CodeWeights const& _weights) const { return computeCodeSize(*m_ast, _weights); } yul::Block const& ast() const { return *m_ast; } friend std::ostream& operator<<(std::ostream& _stream, Program const& _program); @@ -113,7 +114,7 @@ class Program std::unique_ptr _ast, std::vector const& _optimisationSteps ); - static size_t computeCodeSize(yul::Block const& _ast); + static size_t computeCodeSize(yul::Block const& _ast, yul::CodeWeights const& _weights); std::unique_ptr m_ast; yul::Dialect const& m_dialect; diff --git a/tools/yulPhaser/ProgramCache.cpp b/tools/yulPhaser/ProgramCache.cpp index 7acec16bdfea..2556ea7c3be6 100644 --- a/tools/yulPhaser/ProgramCache.cpp +++ b/tools/yulPhaser/ProgramCache.cpp @@ -17,6 +17,8 @@ #include +#include + #include using namespace std; @@ -133,7 +135,7 @@ size_t ProgramCache::calculateTotalCachedCodeSize() const { size_t size = 0; for (auto const& pair: m_entries) - size += pair.second.program.codeSize(); + size += pair.second.program.codeSize(CodeWeights{}); return size; } From b776021870718e1becd2c3e4bd02ba3c1f6e6f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 29 Feb 2020 21:57:14 +0100 Subject: [PATCH 093/479] [yul-phaser] Command-line options for altering weights used by CodeSize metric --- test/yulPhaser/Phaser.cpp | 13 +++++---- tools/yulPhaser/Phaser.cpp | 57 ++++++++++++++++++++++++++++++++++---- tools/yulPhaser/Phaser.h | 21 +++++++++++++- 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/test/yulPhaser/Phaser.cpp b/test/yulPhaser/Phaser.cpp index c381ba623cbe..5cef037786a8 100644 --- a/test/yulPhaser/Phaser.cpp +++ b/test/yulPhaser/Phaser.cpp @@ -32,6 +32,7 @@ using namespace std; using namespace solidity::util; using namespace solidity::langutil; +using namespace solidity::yul; namespace fs = boost::filesystem; @@ -86,6 +87,7 @@ class FitnessMetricFactoryFixture: public FixtureWithPrograms /* relativeMetricScale = */ 5, /* chromosomeRepetitions = */ 1, }; + CodeWeights const m_weights{}; }; class PoulationFactoryFixture @@ -183,7 +185,7 @@ BOOST_FIXTURE_TEST_CASE(build_should_create_metric_of_the_right_type, FitnessMet { m_options.metric = MetricChoice::RelativeCodeSize; m_options.metricAggregator = MetricAggregatorChoice::Sum; - unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}); + unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}, m_weights); BOOST_REQUIRE(metric != nullptr); auto sumMetric = dynamic_cast(metric.get()); @@ -201,7 +203,7 @@ BOOST_FIXTURE_TEST_CASE(build_should_respect_chromosome_repetitions_option, Fitn m_options.metric = MetricChoice::CodeSize; m_options.metricAggregator = MetricAggregatorChoice::Average; m_options.chromosomeRepetitions = 5; - unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}); + unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}, m_weights); BOOST_REQUIRE(metric != nullptr); auto averageMetric = dynamic_cast(metric.get()); @@ -219,7 +221,7 @@ BOOST_FIXTURE_TEST_CASE(build_should_set_relative_metric_scale, FitnessMetricFac m_options.metric = MetricChoice::RelativeCodeSize; m_options.metricAggregator = MetricAggregatorChoice::Average; m_options.relativeMetricScale = 10; - unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}); + unique_ptr metric = FitnessMetricFactory::build(m_options, {m_programs[0]}, {nullptr}, m_weights); BOOST_REQUIRE(metric != nullptr); auto averageMetric = dynamic_cast(metric.get()); @@ -237,7 +239,8 @@ BOOST_FIXTURE_TEST_CASE(build_should_create_metric_for_each_input_program, Fitne unique_ptr metric = FitnessMetricFactory::build( m_options, m_programs, - vector>(m_programs.size(), nullptr) + vector>(m_programs.size(), nullptr), + m_weights ); BOOST_REQUIRE(metric != nullptr); @@ -256,7 +259,7 @@ BOOST_FIXTURE_TEST_CASE(build_should_pass_program_caches_to_metrics, FitnessMetr }; m_options.metric = MetricChoice::RelativeCodeSize; - unique_ptr metric = FitnessMetricFactory::build(m_options, m_programs, caches); + unique_ptr metric = FitnessMetricFactory::build(m_options, m_programs, caches, m_weights); BOOST_REQUIRE(metric != nullptr); auto combinedMetric = dynamic_cast(metric.get()); diff --git a/tools/yulPhaser/Phaser.cpp b/tools/yulPhaser/Phaser.cpp index 68b9b05a99c7..ef1725949c0a 100644 --- a/tools/yulPhaser/Phaser.cpp +++ b/tools/yulPhaser/Phaser.cpp @@ -189,6 +189,27 @@ unique_ptr GeneticAlgorithmFactory::build( } } +CodeWeights CodeWeightFactory::buildFromCommandLine(po::variables_map const& _arguments) +{ + return { + _arguments["expression-statement-cost"].as(), + _arguments["assignment-cost"].as(), + _arguments["variable-declaration-cost"].as(), + _arguments["function-definition-cost"].as(), + _arguments["if-cost"].as(), + _arguments["switch-cost"].as(), + _arguments["case-cost"].as(), + _arguments["for-loop-cost"].as(), + _arguments["break-cost"].as(), + _arguments["continue-cost"].as(), + _arguments["leave-cost"].as(), + _arguments["block-cost"].as(), + _arguments["function-call-cost"].as(), + _arguments["identifier-cost"].as(), + _arguments["literal-cost"].as(), + }; +} + FitnessMetricFactory::Options FitnessMetricFactory::Options::fromCommandLine(po::variables_map const& _arguments) { return { @@ -202,7 +223,8 @@ FitnessMetricFactory::Options FitnessMetricFactory::Options::fromCommandLine(po: unique_ptr FitnessMetricFactory::build( Options const& _options, vector _programs, - vector> _programCaches + vector> _programCaches, + CodeWeights const& _weights ) { assert(_programCaches.size() == _programs.size()); @@ -217,7 +239,7 @@ unique_ptr FitnessMetricFactory::build( metrics.push_back(make_unique( _programCaches[i] != nullptr ? optional{} : move(_programs[i]), move(_programCaches[i]), - CodeWeights{}, + _weights, _options.chromosomeRepetitions )); @@ -230,7 +252,7 @@ unique_ptr FitnessMetricFactory::build( _programCaches[i] != nullptr ? optional{} : move(_programs[i]), move(_programCaches[i]), _options.relativeMetricScale, - CodeWeights{}, + _weights, _options.chromosomeRepetitions )); break; @@ -656,6 +678,26 @@ Phaser::CommandLineDescription Phaser::buildCommandLineDescription() ; keywordDescription.add(metricsDescription); + po::options_description metricWeightDescription("METRIC WEIGHTS", lineLength, minDescriptionLength); + metricWeightDescription.add_options() + ("expression-statement-cost", po::value()->value_name("")->default_value(0)) + ("assignment-cost", po::value()->value_name("")->default_value(0)) + ("variable-declaration-cost", po::value()->value_name("")->default_value(0)) + ("function-definition-cost", po::value()->value_name("")->default_value(1)) + ("if-cost", po::value()->value_name("")->default_value(2)) + ("switch-cost", po::value()->value_name("")->default_value(1)) + ("case-cost", po::value()->value_name("")->default_value(2)) + ("for-loop-cost", po::value()->value_name("")->default_value(3)) + ("break-cost", po::value()->value_name("")->default_value(2)) + ("continue-cost", po::value()->value_name("")->default_value(2)) + ("leave-cost", po::value()->value_name("")->default_value(2)) + ("block-cost", po::value()->value_name("")->default_value(0)) + ("function-call-cost", po::value()->value_name("")->default_value(1)) + ("identifier-cost", po::value()->value_name("")->default_value(0)) + ("literal-cost", po::value()->value_name("")->default_value(1)) + ; + keywordDescription.add(metricWeightDescription); + po::options_description cacheDescription("CACHE", lineLength, minDescriptionLength); cacheDescription.add_options() ( @@ -765,8 +807,13 @@ void Phaser::runPhaser(po::variables_map const& _arguments) vector programs = ProgramFactory::build(programOptions); vector> programCaches = ProgramCacheFactory::build(cacheOptions, programs); - - unique_ptr fitnessMetric = FitnessMetricFactory::build(metricOptions, programs, programCaches); + CodeWeights codeWeights = CodeWeightFactory::buildFromCommandLine(_arguments); + unique_ptr fitnessMetric = FitnessMetricFactory::build( + metricOptions, + programs, + programCaches, + codeWeights + ); Population population = PopulationFactory::build(populationOptions, move(fitnessMetric)); if (_arguments["mode"].as() == PhaserMode::RunAlgorithm) diff --git a/tools/yulPhaser/Phaser.h b/tools/yulPhaser/Phaser.h index 9c1c5ef751f5..8ba5fc938367 100644 --- a/tools/yulPhaser/Phaser.h +++ b/tools/yulPhaser/Phaser.h @@ -39,6 +39,13 @@ class CharStream; } +namespace solidity::yul +{ + +struct CodeWeights; + +} + namespace solidity::phaser { @@ -125,6 +132,17 @@ class GeneticAlgorithmFactory ); }; +/** + * Builds and validates instances of @a CodeWeights. + */ +class CodeWeightFactory +{ +public: + static yul::CodeWeights buildFromCommandLine( + boost::program_options::variables_map const& _arguments + ); +}; + /** * Builds and validates instances of @a FitnessMetric and its derived classes. */ @@ -144,7 +162,8 @@ class FitnessMetricFactory static std::unique_ptr build( Options const& _options, std::vector _programs, - std::vector> _programCaches + std::vector> _programCaches, + yul::CodeWeights const& _weights ); }; From bff012c76d48c5af48b06bfcb1fe06eab588a838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 29 Feb 2020 22:12:38 +0100 Subject: [PATCH 094/479] [yul-phaser] Change default metric weights so that everything has a cost - The CodeSize::DefaultWeights gives zeros to instructions that it assumes will be optimised out. Obviously, we cannot make this assumption here since phaser is meant to find the best way for the optimiser to work. --- tools/yulPhaser/Phaser.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/yulPhaser/Phaser.cpp b/tools/yulPhaser/Phaser.cpp index ef1725949c0a..731560fe6162 100644 --- a/tools/yulPhaser/Phaser.cpp +++ b/tools/yulPhaser/Phaser.cpp @@ -680,9 +680,11 @@ Phaser::CommandLineDescription Phaser::buildCommandLineDescription() po::options_description metricWeightDescription("METRIC WEIGHTS", lineLength, minDescriptionLength); metricWeightDescription.add_options() - ("expression-statement-cost", po::value()->value_name("")->default_value(0)) - ("assignment-cost", po::value()->value_name("")->default_value(0)) - ("variable-declaration-cost", po::value()->value_name("")->default_value(0)) + // TODO: We need to figure out the best set of weights for the phaser. + // This one is just a stopgap to make sure no statement or expression has zero cost. + ("expression-statement-cost", po::value()->value_name("")->default_value(1)) + ("assignment-cost", po::value()->value_name("")->default_value(1)) + ("variable-declaration-cost", po::value()->value_name("")->default_value(1)) ("function-definition-cost", po::value()->value_name("")->default_value(1)) ("if-cost", po::value()->value_name("")->default_value(2)) ("switch-cost", po::value()->value_name("")->default_value(1)) @@ -691,9 +693,9 @@ Phaser::CommandLineDescription Phaser::buildCommandLineDescription() ("break-cost", po::value()->value_name("")->default_value(2)) ("continue-cost", po::value()->value_name("")->default_value(2)) ("leave-cost", po::value()->value_name("")->default_value(2)) - ("block-cost", po::value()->value_name("")->default_value(0)) + ("block-cost", po::value()->value_name("")->default_value(1)) ("function-call-cost", po::value()->value_name("")->default_value(1)) - ("identifier-cost", po::value()->value_name("")->default_value(0)) + ("identifier-cost", po::value()->value_name("")->default_value(1)) ("literal-cost", po::value()->value_name("")->default_value(1)) ; keywordDescription.add(metricWeightDescription); From 1fa689e9511de35cef7e2ac6baaacd32d24acc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 29 Feb 2020 22:13:49 +0100 Subject: [PATCH 095/479] [yul-phaser] ProgramCache::calculateTotalCachedCodeSize(): Replace default weights with ones that better correlate with memory usage --- test/yulPhaser/ProgramCache.cpp | 10 +++++----- tools/yulPhaser/ProgramCache.cpp | 2 +- tools/yulPhaser/ProgramCache.h | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/test/yulPhaser/ProgramCache.cpp b/test/yulPhaser/ProgramCache.cpp index 5e2a67c2af43..3b652e3fbffa 100644 --- a/test/yulPhaser/ProgramCache.cpp +++ b/test/yulPhaser/ProgramCache.cpp @@ -214,11 +214,11 @@ BOOST_FIXTURE_TEST_CASE(startRound_should_remove_entries_older_than_two_rounds, BOOST_FIXTURE_TEST_CASE(gatherStats_should_return_cache_statistics, ProgramCacheFixture) { - size_t sizeI = optimisedProgram(m_program, "I").codeSize(CodeWeights{}); - size_t sizeIu = optimisedProgram(m_program, "Iu").codeSize(CodeWeights{}); - size_t sizeIuO = optimisedProgram(m_program, "IuO").codeSize(CodeWeights{}); - size_t sizeL = optimisedProgram(m_program, "L").codeSize(CodeWeights{}); - size_t sizeLT = optimisedProgram(m_program, "LT").codeSize(CodeWeights{}); + size_t sizeI = optimisedProgram(m_program, "I").codeSize(CacheStats::StorageWeights); + size_t sizeIu = optimisedProgram(m_program, "Iu").codeSize(CacheStats::StorageWeights); + size_t sizeIuO = optimisedProgram(m_program, "IuO").codeSize(CacheStats::StorageWeights); + size_t sizeL = optimisedProgram(m_program, "L").codeSize(CacheStats::StorageWeights); + size_t sizeLT = optimisedProgram(m_program, "LT").codeSize(CacheStats::StorageWeights); m_programCache.optimiseProgram("L"); m_programCache.optimiseProgram("Iu"); diff --git a/tools/yulPhaser/ProgramCache.cpp b/tools/yulPhaser/ProgramCache.cpp index 2556ea7c3be6..b174ad07f397 100644 --- a/tools/yulPhaser/ProgramCache.cpp +++ b/tools/yulPhaser/ProgramCache.cpp @@ -135,7 +135,7 @@ size_t ProgramCache::calculateTotalCachedCodeSize() const { size_t size = 0; for (auto const& pair: m_entries) - size += pair.second.program.codeSize(CodeWeights{}); + size += pair.second.program.codeSize(CacheStats::StorageWeights); return size; } diff --git a/tools/yulPhaser/ProgramCache.h b/tools/yulPhaser/ProgramCache.h index 8cc83009866e..25c796a3d241 100644 --- a/tools/yulPhaser/ProgramCache.h +++ b/tools/yulPhaser/ProgramCache.h @@ -19,6 +19,8 @@ #include +#include + #include #include @@ -44,6 +46,29 @@ struct CacheEntry */ struct CacheStats { + /// Weights used to compute totalCodeSize. + /// The goal here is to get a result proportional to the amount of memory taken by the AST. + /// Each statement/expression gets 1 just for existing. We add more if it contains any extra + /// data that won't be visited separately by ASTWalker. + static yul::CodeWeights constexpr StorageWeights = { + /* expressionStatementCost = */ 1, + /* assignmentCost = */ 1, + /* variableDeclarationCost = */ 1, + /* functionDefinitionCost = */ 1, + /* ifCost = */ 1, + /* switchCost = */ 1, + /* caseCost = */ 1, + /* forLoopCost = */ 1, + /* breakCost = */ 1, + /* continueCost = */ 1, + /* leaveCost = */ 1, + /* blockCost = */ 1, + + /* functionCallCost = */ 1, + /* identifierCost = */ 1, + /* literalCost = */ 1, + }; + size_t hits; size_t misses; size_t totalCodeSize; From 37257548d080f36c5eb6bd557593fd54783540a3 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Tue, 28 Apr 2020 14:04:07 +0530 Subject: [PATCH 096/479] Fixed bug when two empty NatSpec comments led to scanning past EOL --- Changelog.md | 2 + liblangutil/Scanner.cpp | 17 +++-- liblangutil/Scanner.h | 2 +- test/libsolidity/SolidityNatspecJSON.cpp | 75 +++++++++++++++++++ test/libsolidity/SolidityScanner.cpp | 4 +- .../natspec/docstring_double_empty.sol | 7 ++ 6 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_double_empty.sol diff --git a/Changelog.md b/Changelog.md index 649b2e1479ec..4e0e677d74b9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,8 @@ Compiler Features: Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. * Type Checker: Disallow assignments to storage variables of type ``mapping``. + * NatSpec: DocString block is terminated when encountering an empty line. + * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. ### 0.6.8 (2020-05-14) diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index 9d748c570fa3..6cf319067878 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -267,10 +267,13 @@ bool Scanner::skipWhitespace() return sourcePos() != startPosition; } -void Scanner::skipWhitespaceExceptUnicodeLinebreak() +bool Scanner::skipWhitespaceExceptUnicodeLinebreak() { + int const startPosition = sourcePos(); while (isWhiteSpace(m_char) && !isUnicodeLinebreak()) advance(); + // Return whether or not we skipped any characters. + return sourcePos() != startPosition; } Token Scanner::skipSingleLineComment() @@ -321,7 +324,7 @@ int Scanner::scanSingleLineDocComment() { // Check if next line is also a single-line comment. // If any whitespaces were skipped, use source position before. - if (!skipWhitespace()) + if (!skipWhitespaceExceptUnicodeLinebreak()) endPosition = m_source->position(); if (!m_source->isPastEndOfInput(3) && @@ -329,8 +332,10 @@ int Scanner::scanSingleLineDocComment() m_source->get(1) == '/' && m_source->get(2) == '/') { - addCommentLiteralChar('\n'); m_char = m_source->advanceAndGet(3); + if (atEndOfLine()) + continue; + addCommentLiteralChar('\n'); } else break; // next line is not a documentation comment, we are done @@ -389,9 +394,11 @@ Token Scanner::scanMultiLineDocComment() } else if (!m_source->isPastEndOfInput(1) && m_source->get(0) == '*' && m_source->get(1) != '/') { // skip first '*' in subsequent lines + m_char = m_source->advanceAndGet(1); + if (atEndOfLine()) // ignores empty lines + continue; if (charsAdded) - addCommentLiteralChar('\n'); - m_char = m_source->advanceAndGet(2); + addCommentLiteralChar('\n'); // corresponds to the end of previous line } else if (!m_source->isPastEndOfInput(1) && m_source->get(0) == '*' && m_source->get(1) == '/') { // if after newline the comment ends, don't insert the newline diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h index 5b365f134918..d54bb7532bcd 100644 --- a/liblangutil/Scanner.h +++ b/liblangutil/Scanner.h @@ -214,7 +214,7 @@ class Scanner /// Skips all whitespace and @returns true if something was skipped. bool skipWhitespace(); /// Skips all whitespace that are neither '\r' nor '\n'. - void skipWhitespaceExceptUnicodeLinebreak(); + bool skipWhitespaceExceptUnicodeLinebreak(); Token skipSingleLineComment(); Token skipMultiLineComment(); diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 7ae794a83739..fa1d2614d2e0 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -78,6 +78,81 @@ class DocumentationChecker BOOST_FIXTURE_TEST_SUITE(SolidityNatspecJSON, DocumentationChecker) +BOOST_AUTO_TEST_CASE(user_empty_natspec_test) +{ + char const* sourceCode = R"( + contract test { + /// + /// + function f() public { + } + } + )"; + + char const* natspec = R"( + { + "methods": {} + } + )"; + + checkNatspec(sourceCode, "test", natspec, true); +} + +BOOST_AUTO_TEST_CASE(user_newline_break) +{ + char const* sourceCode = R"( + contract test { + /// + /// @notice hello + + /// @notice world + function f() public { + } + } + )"; + + char const* natspec = R"ABCDEF( + { + "methods": { + "f()": + { + "notice": "world" + } + } + } + )ABCDEF"; + + checkNatspec(sourceCode, "test", natspec, true); +} + +BOOST_AUTO_TEST_CASE(user_multiline_empty_lines) +{ + char const* sourceCode = R"( + contract test { + /** + * + * + * @notice hello world + */ + function f() public { + } + } + )"; + + char const* natspec = R"ABCDEF( + { + "methods": { + "f()": { + "notice": "hello world" + } + } + } + )ABCDEF"; + + checkNatspec(sourceCode, "test", natspec, true); +} + + BOOST_AUTO_TEST_CASE(user_basic_test) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index a80ef8b5c939..dc628674ac40 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_comments_parsed) BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), " Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(multiline_documentation_no_stars) @@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_whitespace_hell) BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), " Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(comment_before_eos) diff --git a/test/libsolidity/syntaxTests/natspec/docstring_double_empty.sol b/test/libsolidity/syntaxTests/natspec/docstring_double_empty.sol new file mode 100644 index 000000000000..a84d5d928338 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_double_empty.sol @@ -0,0 +1,7 @@ +contract C { + /// + /// + function vote(uint id) public { + } +} +// ---- From bd28fedd9b513b0887b50ba263eba19688bc0fe8 Mon Sep 17 00:00:00 2001 From: Juan Franco Date: Wed, 20 May 2020 13:05:40 -0300 Subject: [PATCH 097/479] Change build OSX CircleCI to Release --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 15f122e4838d..a34649d740ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -531,7 +531,7 @@ jobs: xcode: "11.0.0" environment: TERM: xterm - CMAKE_BUILD_TYPE: Debug + CMAKE_BUILD_TYPE: Release steps: - checkout - restore_cache: From 09433332764c053057d50a3e8168a960d726d9ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 13 May 2020 18:50:57 +0200 Subject: [PATCH 098/479] Simplify endVisit() for internal calls - Define IRHelpers::referencedFunctionDeclaration() to avoid repeating the same dynamic_casts over and over again. --- libsolidity/codegen/ir/Common.cpp | 10 ++++ libsolidity/codegen/ir/Common.h | 5 ++ .../codegen/ir/IRGeneratorForStatements.cpp | 51 +++++++------------ 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index 1f1cc1cfe20e..2bf4a36cfabf 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -99,3 +99,13 @@ string IRNames::zeroValue(Type const& _type, string const& _variableName) { return "zero_value_for_type_" + _type.identifier() + _variableName; } + +FunctionDefinition const* IRHelpers::referencedFunctionDeclaration(Expression const& _expression) +{ + if (auto memberAccess = dynamic_cast(&_expression)) + return dynamic_cast(memberAccess->annotation().referencedDeclaration); + else if (auto identifier = dynamic_cast(&_expression)) + return dynamic_cast(identifier->annotation().referencedDeclaration); + else + return nullptr; +} diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index f1235553bfd5..3f4ea64f4f67 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -62,6 +62,11 @@ struct IRNames static std::string zeroValue(Type const& _type, std::string const& _variableName); }; +struct IRHelpers +{ + static FunctionDefinition const* referencedFunctionDeclaration(Expression const& _expression); +}; + } // Overloading std::less() makes it possible to use YulArity as a map key. We could define operator< diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index b91ed9f2bfd7..b06da63c19af 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -625,7 +625,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) arguments.push_back(callArguments[std::distance(callArgumentNames.begin(), it)]); } - if (auto memberAccess = dynamic_cast(&_functionCall.expression())) + auto memberAccess = dynamic_cast(&_functionCall.expression()); + if (memberAccess) if (auto expressionType = dynamic_cast(memberAccess->expression().annotation().type)) if (auto contractType = dynamic_cast(expressionType->actualType())) solUnimplementedAssert( @@ -641,42 +642,26 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) break; case FunctionType::Kind::Internal: { - optional functionDef; - if (auto memberAccess = dynamic_cast(&_functionCall.expression())) - { - solUnimplementedAssert(!functionType->bound(), "Internal calls to bound functions are not yet implemented for libraries and not allowed for contracts"); + auto identifier = dynamic_cast(&_functionCall.expression()); + FunctionDefinition const* functionDef = IRHelpers::referencedFunctionDeclaration(_functionCall.expression()); - functionDef = dynamic_cast(memberAccess->annotation().referencedDeclaration); - if (functionDef.value() != nullptr) - solAssert(functionType->declaration() == *memberAccess->annotation().referencedDeclaration, ""); - else - { - solAssert(dynamic_cast(memberAccess->annotation().referencedDeclaration), ""); - solAssert(!functionType->hasDeclaration(), ""); - } - } - else if (auto identifier = dynamic_cast(&_functionCall.expression())) + if (functionDef) { - solAssert(!functionType->bound(), ""); + solAssert(memberAccess || identifier, ""); + solAssert(functionType->declaration() == *functionDef, ""); - if (auto unresolvedFunctionDef = dynamic_cast(identifier->annotation().referencedDeclaration)) - { - functionDef = &unresolvedFunctionDef->resolveVirtual(m_context.mostDerivedContract()); - solAssert(functionType->declaration() == *identifier->annotation().referencedDeclaration, ""); - } - else - { - functionDef = nullptr; - solAssert(dynamic_cast(identifier->annotation().referencedDeclaration), ""); - solAssert(!functionType->hasDeclaration(), ""); - } + if (identifier) + functionDef = &functionDef->resolveVirtual(m_context.mostDerivedContract()); + + solAssert(functionDef->isImplemented(), ""); } else - // Not a simple expression like x or A.x - functionDef = nullptr; + solAssert(!functionType->hasDeclaration(), ""); - solAssert(functionDef.has_value(), ""); - solAssert(functionDef.value() == nullptr || functionDef.value()->isImplemented(), ""); + if (memberAccess) + solUnimplementedAssert(!functionType->bound(), ""); + else + solAssert(!functionType->bound(), ""); vector args; for (size_t i = 0; i < arguments.size(); ++i) @@ -685,9 +670,9 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) else args += convert(*arguments[i], *parameterTypes[i]).stackSlots(); - if (functionDef.value() != nullptr) + if (functionDef) define(_functionCall) << - m_context.enqueueFunctionForCodeGeneration(*functionDef.value()) << + m_context.enqueueFunctionForCodeGeneration(*functionDef) << "(" << joinHumanReadable(args) << ")\n"; From 87c598863fdaa655ed8a5fd1a1ffe304ce1b08b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 22:54:15 +0200 Subject: [PATCH 099/479] IRGeneratorForStatements: Remove unnecessary code for handling internal functions with arbitrary parameters - Internal functions cannot have arbitrary parameters --- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index b06da63c19af..4d0d6436a118 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -663,12 +663,11 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) else solAssert(!functionType->bound(), ""); + solAssert(!functionType->takesArbitraryParameters(), ""); + vector args; for (size_t i = 0; i < arguments.size(); ++i) - if (functionType->takesArbitraryParameters()) - args += IRVariable(*arguments[i]).stackSlots(); - else - args += convert(*arguments[i], *parameterTypes[i]).stackSlots(); + args += convert(*arguments[i], *parameterTypes[i]).stackSlots(); if (functionDef) define(_functionCall) << From a68b4ab7ede1bf909b3922164d2cdb0bc33e83ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 13:02:51 +0200 Subject: [PATCH 100/479] IRGeneratorForStatements: Slightly reorganize local variables in endVisit(MemberAccess) - Add memberFunctionType accessible in the whole function to avoid declaring it multiple times - Add objectCategory --- .../codegen/ir/IRGeneratorForStatements.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 4d0d6436a118..50a9eadc2274 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1221,13 +1221,13 @@ void IRGeneratorForStatements::endVisit(FunctionCallOptions const& _options) void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) { ASTString const& member = _memberAccess.memberName(); - if (auto funType = dynamic_cast(_memberAccess.annotation().type)) - if (funType->bound()) - { - solUnimplementedAssert(false, ""); - } + auto memberFunctionType = dynamic_cast(_memberAccess.annotation().type); + Type::Category objectCategory = _memberAccess.expression().annotation().type->category(); + + if (memberFunctionType && memberFunctionType->bound()) + solUnimplementedAssert(false, ""); - switch (_memberAccess.expression().annotation().type->category()) + switch (objectCategory) { case Type::Category::Contract: { @@ -1460,9 +1460,9 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) { if (auto const* variable = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) handleVariableReference(*variable, _memberAccess); - else if (auto const* funType = dynamic_cast(_memberAccess.annotation().type)) + else if (memberFunctionType) { - switch (funType->kind()) + switch (memberFunctionType->kind()) { case FunctionType::Kind::Declaration: break; @@ -1481,7 +1481,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) break; case FunctionType::Kind::DelegateCall: define(IRVariable(_memberAccess).part("address"), _memberAccess.expression()); - define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(funType->externalIdentifier()) << "\n"; + define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(memberFunctionType->externalIdentifier()) << "\n"; break; case FunctionType::Kind::External: case FunctionType::Kind::Creation: From 4a2ce57bedc5c3a21652c880b69ba7413197e277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 22:21:47 +0200 Subject: [PATCH 101/479] Add support for bound function calls in IR generator --- .../codegen/ir/IRGeneratorForStatements.cpp | 38 +++++++++++++++---- ...rnal_library_function_bound_to_address.sol | 18 +++++++++ ...n_bound_to_address_named_send_transfer.sol | 21 ++++++++++ ...function_bound_to_array_named_pop_push.sol | 19 ++++++++++ ...nternal_library_function_bound_to_bool.sol | 20 ++++++++++ ...nal_library_function_bound_to_contract.sol | 21 ++++++++++ ...ibrary_function_bound_to_dynamic_array.sol | 21 ++++++++++ ...nternal_library_function_bound_to_enum.sol | 21 ++++++++++ ...ry_function_bound_to_external_function.sol | 23 +++++++++++ ..._library_function_bound_to_fixed_array.sol | 21 ++++++++++ ..._library_function_bound_to_fixed_bytes.sol | 17 +++++++++ ...ction_bound_to_function_named_selector.sol | 22 +++++++++++ ...rnal_library_function_bound_to_integer.sol | 17 +++++++++ ...al_library_function_bound_to_interface.sol | 22 +++++++++++ ...ry_function_bound_to_internal_function.sol | 22 +++++++++++ ...rnal_library_function_bound_to_mapping.sol | 22 +++++++++++ ...ernal_library_function_bound_to_string.sol | 18 +++++++++ 17 files changed, 356 insertions(+), 7 deletions(-) create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address_named_send_transfer.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_array_named_pop_push.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_bool.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_contract.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_dynamic_array.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_enum.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_external_function.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_array.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_bytes.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_function_named_selector.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_integer.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_interface.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_internal_function.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_mapping.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_string.sol diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 50a9eadc2274..5472ec7ed20c 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -627,14 +627,20 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) auto memberAccess = dynamic_cast(&_functionCall.expression()); if (memberAccess) + { if (auto expressionType = dynamic_cast(memberAccess->expression().annotation().type)) + { + solAssert(!functionType->bound(), ""); if (auto contractType = dynamic_cast(expressionType->actualType())) solUnimplementedAssert( !contractType->contractDefinition().isLibrary() || functionType->kind() == FunctionType::Kind::Internal, "Only internal function calls implemented for libraries" ); + } + } + else + solAssert(!functionType->bound(), ""); - solUnimplementedAssert(!functionType->bound(), ""); switch (functionType->kind()) { case FunctionType::Kind::Declaration: @@ -658,14 +664,18 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) else solAssert(!functionType->hasDeclaration(), ""); - if (memberAccess) - solUnimplementedAssert(!functionType->bound(), ""); - else - solAssert(!functionType->bound(), ""); - solAssert(!functionType->takesArbitraryParameters(), ""); vector args; + if (functionType->bound()) + { + solAssert(memberAccess && functionDef, ""); + solAssert(functionDef->parameters().size() == arguments.size() + 1, ""); + args += convert(memberAccess->expression(), *functionDef->parameters()[0]->type()).stackSlots(); + } + else + solAssert(!functionDef || functionDef->parameters().size() == arguments.size(), ""); + for (size_t i = 0; i < arguments.size(); ++i) args += convert(*arguments[i], *parameterTypes[i]).stackSlots(); @@ -1225,7 +1235,21 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) Type::Category objectCategory = _memberAccess.expression().annotation().type->category(); if (memberFunctionType && memberFunctionType->bound()) - solUnimplementedAssert(false, ""); + { + solAssert((set{ + Type::Category::Contract, + Type::Category::Bool, + Type::Category::Integer, + Type::Category::Address, + Type::Category::Function, + Type::Category::Struct, + Type::Category::Enum, + Type::Category::Mapping, + Type::Category::Array, + Type::Category::FixedBytes, + }).count(objectCategory) > 0, ""); + return; + } switch (objectCategory) { diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address.sol new file mode 100644 index 000000000000..08cc04346595 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address.sol @@ -0,0 +1,18 @@ +library L { + function equals(address a, address b) internal pure returns (bool) { + return a == b; + } +} + +contract C { + using L for address; + + function foo(address a, address b) public returns (bool) { + return a.equals(b); + } +} +// ==== +// compileViaYul: also +// ---- +// foo(address, address): 0x111122223333444455556666777788889999aAaa, 0x111122223333444455556666777788889999aAaa -> true +// foo(address, address): 0x111122223333444455556666777788889999aAaa, 0x0000000000000000000000000000000000000000 -> false diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address_named_send_transfer.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address_named_send_transfer.sol new file mode 100644 index 000000000000..bfc5a3d629af --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_address_named_send_transfer.sol @@ -0,0 +1,21 @@ +library L { + function transfer(address a) internal {} + function send(address a) internal {} +} + +contract C { + using L for address; + + function useTransfer(address a) public { + a.transfer(); + } + + function useSend(address a) public { + a.send(); + } +} +// ==== +// compileViaYul: also +// ---- +// useTransfer(address): 0x111122223333444455556666777788889999aAaa -> +// useSend(address): 0x111122223333444455556666777788889999aAaa -> diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_array_named_pop_push.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_array_named_pop_push.sol new file mode 100644 index 000000000000..c684cc77f399 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_array_named_pop_push.sol @@ -0,0 +1,19 @@ +library L { + function pop(uint[2] memory a) internal {} + function push(uint[2] memory a) internal {} +} + +contract C { + using L for uint[2]; + + function test() public { + uint[2] memory input; + + input.push(); + input.pop(); + } +} +// ==== +// compileViaYul: also +// ---- +// test() -> diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_bool.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_bool.sol new file mode 100644 index 000000000000..836f976bb7d6 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_bool.sol @@ -0,0 +1,20 @@ +library L { + function xor(bool a, bool b) internal pure returns (bool) { + return a != b; + } +} + +contract C { + using L for bool; + + function foo(bool a, bool b) public returns (bool) { + return a.xor(b); + } +} +// ==== +// compileViaYul: also +// ---- +// foo(bool, bool): true, true -> false +// foo(bool, bool): true, false -> true +// foo(bool, bool): false, true -> true +// foo(bool, bool): false, false -> false diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_contract.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_contract.sol new file mode 100644 index 000000000000..a9566ca59ff2 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_contract.sol @@ -0,0 +1,21 @@ +contract E {} + +library L { + function foo(E e) internal pure returns (uint) { + return 42; + } +} + +contract C { + using L for E; + + function test() public returns (uint) { + E e = new E(); + return e.foo(); + } +} + +// ==== +// compileViaYul: also +// ---- +// test() -> 42 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_dynamic_array.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_dynamic_array.sol new file mode 100644 index 000000000000..0ea7e4144dd8 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_dynamic_array.sol @@ -0,0 +1,21 @@ +library L { + function at(uint[] memory a, uint i) internal pure returns (uint) { + return a[i]; + } +} + +contract C { + using L for uint[]; + + function secondItem() public returns (uint) { + uint[] memory input = new uint[](2); + input[0] = 0x11; + input[1] = 0x22; + + return input.at(1); + } +} +// ==== +// compileViaYul: also +// ---- +// secondItem() -> 0x22 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_enum.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_enum.sol new file mode 100644 index 000000000000..93c5fd4a00b0 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_enum.sol @@ -0,0 +1,21 @@ +library L { + enum E { A, B } + + function equals(E a, E b) internal pure returns (bool) { + return a == b; + } +} + +contract C { + using L for L.E; + + function equalsA(uint choice) public returns (bool) { + L.E x = L.E.A; + return x.equals(L.E(choice)); + } +} +// ==== +// compileViaYul: also +// ---- +// equalsA(uint256): 0 -> true +// equalsA(uint256): 1 -> false diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_external_function.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_external_function.sol new file mode 100644 index 000000000000..f68cb4e21854 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_external_function.sol @@ -0,0 +1,23 @@ +library L { + // NOTE: External function takes up two stack slots + function double(function(uint) external pure returns (uint) f, uint x) internal pure returns (uint) { + return f(x) * 2; + } +} + +contract C { + using L for function(uint) external pure returns (uint); + + function identity(uint x) external pure returns (uint) { + return x; + } + + function test(uint value) public returns (uint) { + return this.identity.double(value); + } +} + +// ==== +// compileViaYul: also +// ---- +// test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_array.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_array.sol new file mode 100644 index 000000000000..842911079503 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_array.sol @@ -0,0 +1,21 @@ +library L { + function at(uint[2] memory a, uint i) internal pure returns (uint) { + return a[i]; + } +} + +contract C { + using L for uint[2]; + + function secondItem() public returns (uint) { + uint[2] memory input; + input[0] = 0x11; + input[1] = 0x22; + + return input.at(1); + } +} +// ==== +// compileViaYul: also +// ---- +// secondItem() -> 0x22 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_bytes.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_bytes.sol new file mode 100644 index 000000000000..62bd48beb2c9 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_fixed_bytes.sol @@ -0,0 +1,17 @@ +library L { + function add(bytes2 a, bytes2 b) internal pure returns (bytes2) { + return bytes2(uint16(a) + uint16(b)); + } +} + +contract C { + using L for bytes2; + + function sum(bytes2 a, bytes2 b) public returns (bytes2) { + return a.add(b); + } +} +// ==== +// compileViaYul: also +// ---- +// sum(bytes2, bytes2): left(0x1100), left(0x0022) -> left(0x1122) diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_function_named_selector.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_function_named_selector.sol new file mode 100644 index 000000000000..75c4e4cb86cd --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_function_named_selector.sol @@ -0,0 +1,22 @@ +library L { + function selector(function(uint) internal pure returns (uint) f, uint x) internal pure returns (uint) { + return f(x) * 2; + } +} + +contract C { + using L for function(uint) internal pure returns (uint); + + function identity(uint x) internal pure returns (uint) { + return x; + } + + function test(uint value) public returns (uint) { + return identity.selector(value); + } +} + +// ==== +// compileViaYul: also +// ---- +// test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_integer.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_integer.sol new file mode 100644 index 000000000000..b6793c3d7744 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_integer.sol @@ -0,0 +1,17 @@ +library L { + function add(uint256 a, uint256 b) internal pure returns (uint256) { + return a + b; + } +} + +contract C { + using L for uint256; + + function foo(uint256 a, uint256 b) public returns (uint256) { + return a.add(b); + } +} +// ==== +// compileViaYul: also +// ---- +// foo(uint256, uint256): 8, 42 -> 50 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_interface.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_interface.sol new file mode 100644 index 000000000000..47e58bb32420 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_interface.sol @@ -0,0 +1,22 @@ +interface I {} +contract E is I {} + +library L { + function foo(I i) internal pure returns (uint) { + return 42; + } +} + +contract C { + using L for I; + + function test() public returns (uint) { + E e = new E(); + return I(e).foo(); + } +} + +// ==== +// compileViaYul: also +// ---- +// test() -> 42 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_internal_function.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_internal_function.sol new file mode 100644 index 000000000000..519eafdddabd --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_internal_function.sol @@ -0,0 +1,22 @@ +library L { + function double(function(uint) internal pure returns (uint) f, uint x) internal pure returns (uint) { + return f(x) * 2; + } +} + +contract C { + using L for function(uint) internal pure returns (uint); + + function identity(uint x) internal pure returns (uint) { + return x; + } + + function test(uint value) public returns (uint) { + return identity.double(value); + } +} + +// ==== +// compileViaYul: also +// ---- +// test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_mapping.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_mapping.sol new file mode 100644 index 000000000000..ec1250a629fd --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_mapping.sol @@ -0,0 +1,22 @@ +library L { + function at(mapping(uint => uint) storage a, uint i) internal view returns (uint) { + return a[i]; + } +} + +contract C { + using L for mapping(uint => uint); + + mapping(uint => uint) map; + + function mapValue(uint a) public returns (uint) { + map[42] = 0x24; + map[66] = 0x66; + + return map.at(a); + } +} +// ==== +// compileViaYul: also +// ---- +// mapValue(uint256): 42 -> 0x24 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_string.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_string.sol new file mode 100644 index 000000000000..d8d4205128fd --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_string.sol @@ -0,0 +1,18 @@ +library L { + function at(string memory a, uint i) internal pure returns (uint8) { + return uint8(bytes(a)[i]); + } +} + +contract C { + using L for string; + + function secondChar() public returns (uint8) { + string memory input = "abc"; + return input.at(1); + } +} +// ==== +// compileViaYul: also +// ---- +// secondChar() -> 98 From 3a75b1da4db39d20bc42f322b3b8b175923dca75 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Wed, 20 May 2020 23:56:25 +0200 Subject: [PATCH 102/479] Remove DeclarationTypeChecker class-specific error reporting functions --- .../analysis/DeclarationTypeChecker.cpp | 44 +++++++------------ libsolidity/analysis/DeclarationTypeChecker.h | 9 ---- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index a06679b973c0..ee5f8a020c5f 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -50,7 +50,8 @@ bool DeclarationTypeChecker::visit(ElementaryTypeName const& _typeName) _typeName.annotation().type = TypeProvider::address(); break; default: - typeError( + m_errorReporter.typeError( + 2311_error, _typeName.location(), "Address types can only be payable or non-payable." ); @@ -102,7 +103,7 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct) auto visitor = [&](StructDefinition const& _struct, auto& _cycleDetector, size_t _depth) { if (_depth >= 256) - fatalDeclarationError(_struct.location(), "Struct definition exhausts cyclic dependency validator."); + m_errorReporter.fatalDeclarationError(5651_error, _struct.location(), "Struct definition exhausts cyclic dependency validator."); for (ASTPointer const& member: _struct.members()) { @@ -119,7 +120,7 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct) } }; if (util::CycleDetector(visitor).run(_struct) != nullptr) - fatalTypeError(_struct.location(), "Recursive struct definition."); + m_errorReporter.fatalTypeError(2046_error, _struct.location(), "Recursive struct definition."); return false; } @@ -145,7 +146,7 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName) else { _typeName.annotation().type = TypeProvider::emptyTuple(); - fatalTypeError(_typeName.location(), "Name has to refer to a struct, enum or contract."); + m_errorReporter.fatalTypeError(9755_error, _typeName.location(), "Name has to refer to a struct, enum or contract."); } } bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) @@ -165,13 +166,13 @@ bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) case Visibility::External: break; default: - fatalTypeError(_typeName.location(), "Invalid visibility, can only be \"external\" or \"internal\"."); + m_errorReporter.fatalTypeError(7653_error, _typeName.location(), "Invalid visibility, can only be \"external\" or \"internal\"."); return false; } if (_typeName.isPayable() && _typeName.visibility() != Visibility::External) { - fatalTypeError(_typeName.location(), "Only external function types can be payable."); + m_errorReporter.fatalTypeError(6138_error, _typeName.location(), "Only external function types can be payable."); return false; } _typeName.annotation().type = TypeProvider::function(_typeName); @@ -226,7 +227,7 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) return; } if (baseType->storageBytes() == 0) - fatalTypeError(_typeName.baseType().location(), "Illegal base type of storage size zero for array."); + m_errorReporter.fatalTypeError(9390_error, _typeName.baseType().location(), "Illegal base type of storage size zero for array."); if (Expression const* length = _typeName.length()) { TypePointer& lengthTypeGeneric = length->annotation().type; @@ -235,13 +236,13 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) RationalNumberType const* lengthType = dynamic_cast(lengthTypeGeneric); u256 lengthValue = 0; if (!lengthType || !lengthType->mobileType()) - typeError(length->location(), "Invalid array length, expected integer literal or constant expression."); + m_errorReporter.typeError(8922_error, length->location(), "Invalid array length, expected integer literal or constant expression."); else if (lengthType->isZero()) - typeError(length->location(), "Array with zero length specified."); + m_errorReporter.typeError(1220_error, length->location(), "Array with zero length specified."); else if (lengthType->isFractional()) - typeError(length->location(), "Array with fractional length specified."); + m_errorReporter.typeError(4323_error, length->location(), "Array with fractional length specified."); else if (lengthType->isNegative()) - typeError(length->location(), "Array with negative length specified."); + m_errorReporter.typeError(9308_error, length->location(), "Array with negative length specified."); else lengthValue = lengthType->literalValue(nullptr); _typeName.annotation().type = TypeProvider::array(DataLocation::Storage, baseType, lengthValue); @@ -309,7 +310,7 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) errorString += " for variable"; } errorString += ", but " + locationToString(varLoc) + " was given."; - typeError(_variable.location(), errorString); + m_errorReporter.typeError(6160_error, _variable.location(), errorString); solAssert(!allowedDataLocations.empty(), ""); varLoc = *allowedDataLocations.begin(); @@ -359,24 +360,9 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) } -void DeclarationTypeChecker::typeError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.typeError(2311_error, _location, _description); -} - -void DeclarationTypeChecker::fatalTypeError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.fatalTypeError(5651_error, _location, _description); -} - -void DeclarationTypeChecker::fatalDeclarationError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.fatalDeclarationError(2046_error, _location, _description); -} - bool DeclarationTypeChecker::check(ASTNode const& _node) { - unsigned errorCount = m_errorReporter.errorCount(); + auto watcher = m_errorReporter.errorWatcher(); _node.accept(*this); - return m_errorReporter.errorCount() == errorCount; + return watcher.ok(); } diff --git a/libsolidity/analysis/DeclarationTypeChecker.h b/libsolidity/analysis/DeclarationTypeChecker.h index e5407599828a..764a66e1d786 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.h +++ b/libsolidity/analysis/DeclarationTypeChecker.h @@ -59,15 +59,6 @@ class DeclarationTypeChecker: private ASTConstVisitor void endVisit(VariableDeclaration const& _variable) override; bool visit(StructDefinition const& _struct) override; - /// Adds a new error to the list of errors. - void typeError(langutil::SourceLocation const& _location, std::string const& _description); - - /// Adds a new error to the list of errors and throws to abort reference resolving. - void fatalTypeError(langutil::SourceLocation const& _location, std::string const& _description); - - /// Adds a new error to the list of errors and throws to abort reference resolving. - void fatalDeclarationError(langutil::SourceLocation const& _location, std::string const& _description); - langutil::ErrorReporter& m_errorReporter; langutil::EVMVersion m_evmVersion; bool m_insideFunctionType = false; From 66a8c7d1ab5b744736d1355ba46c9e1d5f090ac8 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 21 May 2020 00:04:26 +0200 Subject: [PATCH 103/479] Remove ReferencesResolver class-specific error reporting functions --- libsolidity/analysis/ReferencesResolver.cpp | 30 ++++++--------------- libsolidity/analysis/ReferencesResolver.h | 9 ------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index ac3553f6b605..073c0795a3b7 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -119,7 +119,7 @@ bool ReferencesResolver::visit(Identifier const& _identifier) else errorMessage += " Did you mean " + std::move(suggestions) + "?"; } - declarationError(_identifier.location(), errorMessage); + m_errorReporter.declarationError(8051_error, _identifier.location(), errorMessage); } else if (declarations.size() == 1) _identifier.annotation().referencedDeclaration = declarations.front(); @@ -157,7 +157,7 @@ void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName) Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath()); if (!declaration) { - fatalDeclarationError(_typeName.location(), "Identifier not found or not unique."); + m_errorReporter.fatalDeclarationError(7556_error, _typeName.location(), "Identifier not found or not unique."); return; } @@ -209,14 +209,14 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) )); if (realName.empty()) { - declarationError(_identifier.location, "In variable names _slot and _offset can only be used as a suffix."); + m_errorReporter.declarationError(9553_error, _identifier.location, "In variable names _slot and _offset can only be used as a suffix."); return; } declarations = m_resolver.nameFromCurrentScope(realName); } if (declarations.size() > 1) { - declarationError(_identifier.location, "Multiple matching identifiers. Resolving overloaded identifiers is not supported."); + m_errorReporter.declarationError(8827_error, _identifier.location, "Multiple matching identifiers. Resolving overloaded identifiers is not supported."); return; } else if (declarations.size() == 0) @@ -224,7 +224,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) if (auto var = dynamic_cast(declarations.front())) if (var->isLocalVariable() && m_yulInsideFunction) { - declarationError(_identifier.location, "Cannot access local Solidity variables from inside an inline assembly function."); + m_errorReporter.declarationError(8477_error, _identifier.location, "Cannot access local Solidity variables from inside an inline assembly function."); return; } @@ -242,7 +242,7 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) string namePrefix = identifier.name.str().substr(0, identifier.name.str().find('.')); if (isSlot || isOffset) - declarationError(identifier.location, "In variable declarations _slot and _offset can not be used as a suffix."); + m_errorReporter.declarationError(8820_error, identifier.location, "In variable declarations _slot and _offset can not be used as a suffix."); else if ( auto declarations = m_resolver.nameFromCurrentScope(namePrefix); !declarations.empty() @@ -252,7 +252,8 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) for (auto const* decl: declarations) ssl.append("The shadowed declaration is here:", decl->location()); if (!ssl.infos.empty()) - declarationError( + m_errorReporter.declarationError( + 6005_error, identifier.location, ssl, namePrefix.size() < identifier.name.str().size() ? @@ -266,19 +267,4 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) visit(*_varDecl.value); } -void ReferencesResolver::declarationError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.declarationError(8532_error, _location, _description); -} - -void ReferencesResolver::declarationError(SourceLocation const& _location, SecondarySourceLocation const& _ssl, string const& _description) -{ - m_errorReporter.declarationError(3881_error, _location, _ssl, _description); -} - -void ReferencesResolver::fatalDeclarationError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.fatalDeclarationError(6546_error, _location, _description); -} - } diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 7b8c1fff5fa6..7da745cc5e4c 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -88,15 +88,6 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker void operator()(yul::Identifier const& _identifier) override; void operator()(yul::VariableDeclaration const& _varDecl) override; - /// Adds a new error to the list of errors. - void declarationError(langutil::SourceLocation const& _location, std::string const& _description); - - /// Adds a new error to the list of errors. - void declarationError(langutil::SourceLocation const& _location, langutil::SecondarySourceLocation const& _ssl, std::string const& _description); - - /// Adds a new error to the list of errors and throws to abort reference resolving. - void fatalDeclarationError(langutil::SourceLocation const& _location, std::string const& _description); - langutil::ErrorReporter& m_errorReporter; NameAndTypeResolver& m_resolver; langutil::EVMVersion m_evmVersion; From 38e65a909ac86d0e2cea7d4c48dfe1a98f4f020a Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 21 May 2020 00:26:14 +0200 Subject: [PATCH 104/479] Remove DocStringAnalyzer and DocStringParser class-specific error reporting functions --- libsolidity/analysis/DocStringAnalyser.cpp | 27 +++++++++++----------- libsolidity/analysis/DocStringAnalyser.h | 2 -- libsolidity/parsing/DocStringParser.cpp | 11 +++------ libsolidity/parsing/DocStringParser.h | 2 -- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index a04c9314efe1..1d2d8f54a353 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -68,13 +68,13 @@ bool DocStringAnalyser::visit(VariableDeclaration const& _variable) parseDocStrings(_variable, _variable.annotation(), validPublicTags, "non-public state variables"); if (_variable.annotation().docTags.count("notice") > 0) m_errorReporter.warning( - 9098_error, _variable.documentation()->location(), + 7816_error, _variable.documentation()->location(), "Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly." ); } if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) m_errorReporter.warning( - 4822_error, _variable.documentation()->location(), + 8532_error, _variable.documentation()->location(), "Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0." ); } @@ -110,7 +110,8 @@ void DocStringAnalyser::checkParameters( auto paramRange = _annotation.docTags.equal_range("param"); for (auto i = paramRange.first; i != paramRange.second; ++i) if (!validParams.count(i->second.paramName)) - appendError( + m_errorReporter.docstringParsingError( + 3881_error, _node.documentation()->location(), "Documented parameter \"" + i->second.paramName + @@ -159,7 +160,8 @@ void DocStringAnalyser::parseDocStrings( for (auto const& docTag: _annotation.docTags) { if (!_validTags.count(docTag.first)) - appendError( + m_errorReporter.docstringParsingError( + 6546_error, _node.documentation()->location(), "Documentation tag @" + docTag.first + " not valid for " + _nodeName + "." ); @@ -170,12 +172,14 @@ void DocStringAnalyser::parseDocStrings( if (auto* varDecl = dynamic_cast(&_node)) { if (!varDecl->isPublic()) - appendError( + m_errorReporter.docstringParsingError( + 9440_error, _node.documentation()->location(), "Documentation tag \"@" + docTag.first + "\" is only allowed on public state-variables." ); if (returnTagsVisited > 1) - appendError( + m_errorReporter.docstringParsingError( + 5256_error, _node.documentation()->location(), "Documentation tag \"@" + docTag.first + "\" is only allowed once on state-variables." ); @@ -186,7 +190,8 @@ void DocStringAnalyser::parseDocStrings( string firstWord = content.substr(0, content.find_first_of(" \t")); if (returnTagsVisited > function->returnParameters().size()) - appendError( + m_errorReporter.docstringParsingError( + 2604_error, _node.documentation()->location(), "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + " exceeds the number of return parameters." @@ -195,7 +200,8 @@ void DocStringAnalyser::parseDocStrings( { auto parameter = function->returnParameters().at(returnTagsVisited - 1); if (!parameter->name().empty() && parameter->name() != firstWord) - appendError( + m_errorReporter.docstringParsingError( + 5856_error, _node.documentation()->location(), "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + " does not contain the name of its return parameter." @@ -205,8 +211,3 @@ void DocStringAnalyser::parseDocStrings( } } } - -void DocStringAnalyser::appendError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.docstringParsingError(7816_error, _location, _description); -} diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index cddfc2f1dd82..9bc8ec5782a4 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -81,8 +81,6 @@ class DocStringAnalyser: private ASTConstVisitor std::string const& _nodeName ); - void appendError(langutil::SourceLocation const& _location, std::string const& _description); - langutil::ErrorReporter& m_errorReporter; }; diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index 3ce67a43009f..755eb0b50721 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -96,7 +96,7 @@ void DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor auto tagNameEndPos = firstWhitespaceOrNewline(tagPos, end); if (tagNameEndPos == end) { - appendError("End of tag " + string(tagPos, tagNameEndPos) + " not found"); + m_errorReporter->docstringParsingError(9222_error, "End of tag " + string(tagPos, tagNameEndPos) + " not found"); break; } @@ -138,7 +138,7 @@ DocStringParser::iter DocStringParser::parseDocTagParam(iter _pos, iter _end) auto nameStartPos = skipWhitespace(_pos, _end); if (nameStartPos == _end) { - appendError("No param name given"); + m_errorReporter->docstringParsingError(3335_error, "No param name given"); return _end; } auto nameEndPos = firstNonIdentifier(nameStartPos, _end); @@ -149,7 +149,7 @@ DocStringParser::iter DocStringParser::parseDocTagParam(iter _pos, iter _end) if (descStartPos == nlPos) { - appendError("No description given for param " + paramName); + m_errorReporter->docstringParsingError(9942_error, "No description given for param " + paramName); return _end; } @@ -189,8 +189,3 @@ void DocStringParser::newTag(string const& _tagName) { m_lastTag = &m_docTags.insert(make_pair(_tagName, DocTag()))->second; } - -void DocStringParser::appendError(string const& _description) -{ - m_errorReporter->docstringParsingError(9440_error, _description); -} diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index b4c9186a7e19..eaf18503b900 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -58,8 +58,6 @@ class DocStringParser /// Creates and inserts a new tag and adjusts m_lastTag. void newTag(std::string const& _tagName); - void appendError(std::string const& _description); - /// Mapping tag name -> content. std::multimap m_docTags; DocTag* m_lastTag = nullptr; From cfdfa360658da1133463d5de9d0f7ce11f9afe75 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 20 May 2020 23:59:03 +0100 Subject: [PATCH 105/479] Rename wasm::Break(If) to wasm::Branch(If) for clarity --- libyul/backends/wasm/BinaryTransform.cpp | 10 +++++----- libyul/backends/wasm/BinaryTransform.h | 4 ++-- libyul/backends/wasm/TextTransform.cpp | 8 ++++---- libyul/backends/wasm/TextTransform.h | 4 ++-- libyul/backends/wasm/WasmAST.h | 10 +++++----- libyul/backends/wasm/WasmCodeTransform.cpp | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 249d87a333fa..43eced734ec2 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -382,15 +382,15 @@ bytes BinaryTransform::operator()(Loop const& _loop) return result; } -bytes BinaryTransform::operator()(Break const& _break) +bytes BinaryTransform::operator()(Branch const& _branch) { - return toBytes(Opcode::Br) + encodeLabelIdx(_break.label.name); + return toBytes(Opcode::Br) + encodeLabelIdx(_branch.label.name); } -bytes BinaryTransform::operator()(BreakIf const& _breakIf) +bytes BinaryTransform::operator()(BranchIf const& _branchIf) { - bytes result = std::visit(*this, *_breakIf.condition); - result += toBytes(Opcode::BrIf) + encodeLabelIdx(_breakIf.label.name); + bytes result = std::visit(*this, *_branchIf.condition); + result += toBytes(Opcode::BrIf) + encodeLabelIdx(_branchIf.label.name); return result; } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index e11c92bf63bd..c1c924dccb64 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -48,8 +48,8 @@ class BinaryTransform bytes operator()(wasm::GlobalAssignment const& _assignment); bytes operator()(wasm::If const& _if); bytes operator()(wasm::Loop const& _loop); - bytes operator()(wasm::Break const& _break); - bytes operator()(wasm::BreakIf const& _break); + bytes operator()(wasm::Branch const& _branch); + bytes operator()(wasm::BranchIf const& _branchIf); bytes operator()(wasm::Return const& _return); bytes operator()(wasm::Block const& _block); bytes operator()(wasm::FunctionDefinition const& _function); diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index 2a2499b61697..fd8eaf746772 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -121,14 +121,14 @@ string TextTransform::operator()(wasm::Loop const& _loop) return "(loop" + move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n"; } -string TextTransform::operator()(wasm::Break const& _break) +string TextTransform::operator()(wasm::Branch const& _branch) { - return "(br $" + _break.label.name + ")\n"; + return "(br $" + _branch.label.name + ")\n"; } -string TextTransform::operator()(wasm::BreakIf const& _break) +string TextTransform::operator()(wasm::BranchIf const& _branchIf) { - return "(br_if $" + _break.label.name + " " + visit(*_break.condition) + ")\n"; + return "(br_if $" + _branchIf.label.name + " " + visit(*_branchIf.condition) + ")\n"; } string TextTransform::operator()(wasm::Return const&) diff --git a/libyul/backends/wasm/TextTransform.h b/libyul/backends/wasm/TextTransform.h index 10f9f3fbb2ed..ebbca4e9e7e6 100644 --- a/libyul/backends/wasm/TextTransform.h +++ b/libyul/backends/wasm/TextTransform.h @@ -48,9 +48,9 @@ class TextTransform std::string operator()(wasm::GlobalAssignment const& _assignment); std::string operator()(wasm::If const& _if); std::string operator()(wasm::Loop const& _loop); - std::string operator()(wasm::Break const& _break); + std::string operator()(wasm::Branch const& _branch); + std::string operator()(wasm::BranchIf const& _branchIf); std::string operator()(wasm::Return const& _return); - std::string operator()(wasm::BreakIf const& _break); std::string operator()(wasm::Block const& _block); private: diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h index 635b7c4ea06e..7ba7066cbca2 100644 --- a/libyul/backends/wasm/WasmAST.h +++ b/libyul/backends/wasm/WasmAST.h @@ -41,13 +41,13 @@ struct GlobalAssignment; struct Block; struct If; struct Loop; -struct Break; -struct BreakIf; +struct Branch; +struct BranchIf; struct Return; using Expression = std::variant< Literal, StringLiteral, LocalVariable, GlobalVariable, FunctionCall, BuiltinCall, LocalAssignment, GlobalAssignment, - Block, If, Loop, Break, BreakIf, Return + Block, If, Loop, Branch, BranchIf, Return >; struct Literal { uint64_t value; }; @@ -66,9 +66,9 @@ struct If { std::unique_ptr> elseStatements; }; struct Loop { std::string labelName; std::vector statements; }; -struct Break { Label label; }; +struct Branch { Label label; }; struct Return {}; -struct BreakIf { Label label; std::unique_ptr condition; }; +struct BranchIf { Label label; std::unique_ptr condition; }; struct VariableDeclaration { std::string variableName; }; struct GlobalVariableDeclaration { std::string variableName; }; diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index f2e6245523af..308171c44c45 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -256,26 +256,26 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) wasm::Loop loop; loop.labelName = newLabel(); loop.statements = visit(_for.pre.statements); - loop.statements.emplace_back(wasm::BreakIf{wasm::Label{breakLabel}, make_unique( + loop.statements.emplace_back(wasm::BranchIf{wasm::Label{breakLabel}, make_unique( wasm::BuiltinCall{"i64.eqz", make_vector( visitReturnByValue(*_for.condition) )} )}); loop.statements.emplace_back(wasm::Block{continueLabel, visit(_for.body.statements)}); loop.statements += visit(_for.post.statements); - loop.statements.emplace_back(wasm::Break{wasm::Label{loop.labelName}}); + loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}}); return { wasm::Block{breakLabel, make_vector(move(loop))} }; } wasm::Expression WasmCodeTransform::operator()(Break const&) { - return wasm::Break{wasm::Label{m_breakContinueLabelNames.top().first}}; + return wasm::Branch{wasm::Label{m_breakContinueLabelNames.top().first}}; } wasm::Expression WasmCodeTransform::operator()(Continue const&) { - return wasm::Break{wasm::Label{m_breakContinueLabelNames.top().second}}; + return wasm::Branch{wasm::Label{m_breakContinueLabelNames.top().second}}; } wasm::Expression WasmCodeTransform::operator()(Leave const&) From 5870253b0079edb672a3c8a494905f7fdb5daec5 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 21 May 2020 17:38:47 +0200 Subject: [PATCH 106/479] Shorten a couple of lines --- .../analysis/DeclarationTypeChecker.cpp | 51 ++++++++++++++++--- libsolidity/analysis/DocStringAnalyser.cpp | 6 ++- libsolidity/analysis/ReferencesResolver.cpp | 24 +++++++-- libsolidity/parsing/DocStringParser.cpp | 5 +- 4 files changed, 71 insertions(+), 15 deletions(-) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index ee5f8a020c5f..ca565b53a8eb 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -103,7 +103,11 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct) auto visitor = [&](StructDefinition const& _struct, auto& _cycleDetector, size_t _depth) { if (_depth >= 256) - m_errorReporter.fatalDeclarationError(5651_error, _struct.location(), "Struct definition exhausts cyclic dependency validator."); + m_errorReporter.fatalDeclarationError( + 5651_error, + _struct.location(), + "Struct definition exhausts cyclic dependency validator." + ); for (ASTPointer const& member: _struct.members()) { @@ -146,9 +150,14 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName) else { _typeName.annotation().type = TypeProvider::emptyTuple(); - m_errorReporter.fatalTypeError(9755_error, _typeName.location(), "Name has to refer to a struct, enum or contract."); + m_errorReporter.fatalTypeError( + 9755_error, + _typeName.location(), + "Name has to refer to a struct, enum or contract." + ); } } + bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) { if (_typeName.annotation().type) @@ -166,18 +175,27 @@ bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) case Visibility::External: break; default: - m_errorReporter.fatalTypeError(7653_error, _typeName.location(), "Invalid visibility, can only be \"external\" or \"internal\"."); + m_errorReporter.fatalTypeError( + 7653_error, + _typeName.location(), + "Invalid visibility, can only be \"external\" or \"internal\"." + ); return false; } if (_typeName.isPayable() && _typeName.visibility() != Visibility::External) { - m_errorReporter.fatalTypeError(6138_error, _typeName.location(), "Only external function types can be payable."); + m_errorReporter.fatalTypeError( + 6138_error, + _typeName.location(), + "Only external function types can be payable." + ); return false; } _typeName.annotation().type = TypeProvider::function(_typeName); return false; } + void DeclarationTypeChecker::endVisit(Mapping const& _mapping) { if (_mapping.annotation().type) @@ -227,7 +245,11 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) return; } if (baseType->storageBytes() == 0) - m_errorReporter.fatalTypeError(9390_error, _typeName.baseType().location(), "Illegal base type of storage size zero for array."); + m_errorReporter.fatalTypeError( + 9390_error, + _typeName.baseType().location(), + "Illegal base type of storage size zero for array." + ); if (Expression const* length = _typeName.length()) { TypePointer& lengthTypeGeneric = length->annotation().type; @@ -236,7 +258,11 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) RationalNumberType const* lengthType = dynamic_cast(lengthTypeGeneric); u256 lengthValue = 0; if (!lengthType || !lengthType->mobileType()) - m_errorReporter.typeError(8922_error, length->location(), "Invalid array length, expected integer literal or constant expression."); + m_errorReporter.typeError( + 8922_error, + length->location(), + "Invalid array length, expected integer literal or constant expression." + ); else if (lengthType->isZero()) m_errorReporter.typeError(1220_error, length->location(), "Array with zero length specified."); else if (lengthType->isFractional()) @@ -250,15 +276,24 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) else _typeName.annotation().type = TypeProvider::array(DataLocation::Storage, baseType); } + void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) { if (_variable.annotation().type) return; if (_variable.isConstant() && !_variable.isStateVariable()) - m_errorReporter.declarationError(1788_error, _variable.location(), "The \"constant\" keyword can only be used for state variables."); + m_errorReporter.declarationError( + 1788_error, + _variable.location(), + "The \"constant\" keyword can only be used for state variables." + ); if (_variable.immutable() && !_variable.isStateVariable()) - m_errorReporter.declarationError(8297_error, _variable.location(), "The \"immutable\" keyword can only be used for state variables."); + m_errorReporter.declarationError( + 8297_error, + _variable.location(), + "The \"immutable\" keyword can only be used for state variables." + ); if (!_variable.typeName()) { diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 1d2d8f54a353..7d8a8a43f864 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -69,13 +69,15 @@ bool DocStringAnalyser::visit(VariableDeclaration const& _variable) if (_variable.annotation().docTags.count("notice") > 0) m_errorReporter.warning( 7816_error, _variable.documentation()->location(), - "Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly." + "Documentation tag on non-public state variables will be disallowed in 0.7.0. " + "You will need to use the @dev tag explicitly." ); } if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) m_errorReporter.warning( 8532_error, _variable.documentation()->location(), - "Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0." + "Documentation tag @title and @author is only allowed on contract definitions. " + "It will be disallowed in 0.7.0." ); } return false; diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 073c0795a3b7..f92f8dc30dc9 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -209,14 +209,22 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) )); if (realName.empty()) { - m_errorReporter.declarationError(9553_error, _identifier.location, "In variable names _slot and _offset can only be used as a suffix."); + m_errorReporter.declarationError( + 9553_error, + _identifier.location, + "In variable names _slot and _offset can only be used as a suffix." + ); return; } declarations = m_resolver.nameFromCurrentScope(realName); } if (declarations.size() > 1) { - m_errorReporter.declarationError(8827_error, _identifier.location, "Multiple matching identifiers. Resolving overloaded identifiers is not supported."); + m_errorReporter.declarationError( + 8827_error, + _identifier.location, + "Multiple matching identifiers. Resolving overloaded identifiers is not supported." + ); return; } else if (declarations.size() == 0) @@ -224,7 +232,11 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) if (auto var = dynamic_cast(declarations.front())) if (var->isLocalVariable() && m_yulInsideFunction) { - m_errorReporter.declarationError(8477_error, _identifier.location, "Cannot access local Solidity variables from inside an inline assembly function."); + m_errorReporter.declarationError( + 8477_error, + _identifier.location, + "Cannot access local Solidity variables from inside an inline assembly function." + ); return; } @@ -242,7 +254,11 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) string namePrefix = identifier.name.str().substr(0, identifier.name.str().find('.')); if (isSlot || isOffset) - m_errorReporter.declarationError(8820_error, identifier.location, "In variable declarations _slot and _offset can not be used as a suffix."); + m_errorReporter.declarationError( + 8820_error, + identifier.location, + "In variable declarations _slot and _offset can not be used as a suffix." + ); else if ( auto declarations = m_resolver.nameFromCurrentScope(namePrefix); !declarations.empty() diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index 755eb0b50721..33cdbd937bbd 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -96,7 +96,10 @@ void DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor auto tagNameEndPos = firstWhitespaceOrNewline(tagPos, end); if (tagNameEndPos == end) { - m_errorReporter->docstringParsingError(9222_error, "End of tag " + string(tagPos, tagNameEndPos) + " not found"); + m_errorReporter->docstringParsingError( + 9222_error, + "End of tag " + string(tagPos, tagNameEndPos) + " not found" + ); break; } From a499ef16faf9a24bb5e73c90d8c7012c7e406bf9 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sun, 24 May 2020 19:41:15 +0200 Subject: [PATCH 107/479] Fix spelling errors --- docs/060-breaking-changes.rst | 2 +- libevmasm/Assembly.cpp | 6 +++--- libsolidity/ast/ASTAnnotations.h | 2 +- libsolidity/codegen/CompilerUtils.h | 2 +- libsolidity/codegen/ExpressionCompiler.cpp | 2 +- libsolidity/interface/StandardCompiler.cpp | 4 ++-- scripts/codespell_whitelist.txt | 1 + scripts/release_ppa.sh | 2 +- test/compilationTests/corion/ico.sol | 6 +++--- test/libevmasm/Optimiser.cpp | 20 ++++++++++---------- 10 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index 99e969e07ac4..a1ee96d952df 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -166,7 +166,7 @@ This section gives detailed instructions on how to update prior code for every b documentation so long as the notices are in the order they appear in the tuple return type. * Choose unique identifiers for variable declarations in inline assembly that do not conflict - with declartions outside the inline assembly block. + with declarations outside the inline assembly block. * Add ``virtual`` to every non-interface function you intend to override. Add ``virtual`` to all functions without implementation outside interfaces. For single inheritance, add diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index fa6ea4f16ba3..296a330abe02 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -435,10 +435,10 @@ map Assembly::optimiseInternal( // This only modifies PushTags, we have to run again to actually remove code. if (_settings.runDeduplicate) { - BlockDeduplicator dedup{m_items}; - if (dedup.deduplicate()) + BlockDeduplicator deduplicator{m_items}; + if (deduplicator.deduplicate()) { - for (auto const& replacement: dedup.replacedTags()) + for (auto const& replacement: deduplicator.replacedTags()) { assertThrow( replacement.first <= size_t(-1) && replacement.second <= size_t(-1), diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index eb8f7a263bdc..507559ca6ceb 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -250,7 +250,7 @@ struct ExpressionAnnotation: ASTAnnotation bool lValueOfOrdinaryAssignment = false; /// Types and - if given - names of arguments if the expr. is a function - /// that is called, used for overload resoultion + /// that is called, used for overload resolution std::optional arguments; }; diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index 3d5d858251ae..a3c266bdee35 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -286,7 +286,7 @@ class CompilerUtils /// Appends code that computes the Keccak-256 hash of the topmost stack element of 32 byte type. void computeHashStatic(); - /// Apppends code that copies the code of the given contract to memory. + /// Appends code that copies the code of the given contract to memory. /// Stack pre: Memory position /// Stack post: Updated memory position /// @param creation if true, copies creation code, if false copies runtime code. diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index f05ffda8f170..6397c7492de6 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1912,7 +1912,7 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier) // If the identifier is called right away, this code is executed in visit(FunctionCall...), because // we want to avoid having a reference to the runtime function entry point in the // constructor context, since this would force the compiler to include unreferenced - // internal functions in the runtime contex. + // internal functions in the runtime context. utils().pushCombinedFunctionEntryLabel(functionDef->resolveVirtual(m_context.mostDerivedContract())); else if (auto variable = dynamic_cast(declaration)) appendVariable(*variable, static_cast(_identifier)); diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index feda8fc53f99..e04b0b2f17a6 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -178,7 +178,7 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _art } /// -/// @a _outputSelection is a JSON object containining a two-level hashmap, where the first level is the filename, +/// @a _outputSelection is a JSON object containing a two-level hashmap, where the first level is the filename, /// the second level is the contract name and the value is an array of artifact names to be requested for that contract. /// @a _file is the current file /// @a _contract is the current contract @@ -229,7 +229,7 @@ bool isBinaryRequested(Json::Value const& _outputSelection) if (!_outputSelection.isObject()) return false; - // This does not inculde "evm.methodIdentifiers" on purpose! + // This does not include "evm.methodIdentifiers" on purpose! static vector const outputsThatRequireBinaries{ "*", "ir", "irOptimized", diff --git a/scripts/codespell_whitelist.txt b/scripts/codespell_whitelist.txt index 0409dc1a2169..f1111719f138 100644 --- a/scripts/codespell_whitelist.txt +++ b/scripts/codespell_whitelist.txt @@ -11,3 +11,4 @@ compilability errorstring hist otion +keypair diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index 6d50e00667b9..267346e417cb 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -6,7 +6,7 @@ ## You can pass a branch name as argument to this script (which, if no argument is given, ## will default to "develop"). ## -## If the gien branch is "release", the resulting package will be uplaoded to +## If the given branch is "release", the resulting package will be uploaded to ## ethereum/ethereum PPA, or ethereum/ethereum-dev PPA otherwise. ## ## The gnupg key for "builds@ethereum.org" has to be present in order to sign diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index 26858e9d688b..a8804fd4cb40 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -193,7 +193,7 @@ contract ico is safeMath { function setICOEthPrice(uint256 value) external { /* - Setting of the ICO ETC USD rates which can only be calle by a pre-defined address. + Setting of the ICO ETC USD rates which can only be called by a pre-defined address. After this function is completed till the call of the next function (which is at least an exchangeRateDelay array) this rate counts. With this process avoiding the sudden rate changes. @@ -221,8 +221,8 @@ contract ico is safeMath { /* Closing the ICO. It is only possible when the ICO period passed and only by the owner. - The 96% of the whole amount of the token is generated to the address of the fundation. - Ethers which are situated in this contract will be sent to the address of the fundation. + The 96% of the whole amount of the token is generated to the address of the foundation. + Ethers which are situated in this contract will be sent to the address of the foundation. */ require( msg.sender == owner ); require( block.number > icoDelay ); diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 782b687fc0d3..536eaa9512f8 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -826,8 +826,8 @@ BOOST_AUTO_TEST_CASE(block_deduplicator) Instruction::JUMP, AssemblyItem(Tag, 3) }; - BlockDeduplicator dedup(input); - dedup.deduplicate(); + BlockDeduplicator deduplicator(input); + deduplicator.deduplicate(); set pushTags; for (AssemblyItem const& item: input) @@ -857,8 +857,8 @@ BOOST_AUTO_TEST_CASE(block_deduplicator_assign_immutable_same) AssemblyItem(PushTag, 1), AssemblyItem(PushTag, 1), } + blocks; - BlockDeduplicator dedup(input); - dedup.deduplicate(); + BlockDeduplicator deduplicator(input); + deduplicator.deduplicate(); BOOST_CHECK_EQUAL_COLLECTIONS(input.begin(), input.end(), output.begin(), output.end()); } @@ -876,8 +876,8 @@ BOOST_AUTO_TEST_CASE(block_deduplicator_assign_immutable_different_value) AssemblyItem{AssignImmutable, 0x1234}, Instruction::JUMP }; - BlockDeduplicator dedup(input); - BOOST_CHECK(!dedup.deduplicate()); + BlockDeduplicator deduplicator(input); + BOOST_CHECK(!deduplicator.deduplicate()); } BOOST_AUTO_TEST_CASE(block_deduplicator_assign_immutable_different_hash) @@ -894,8 +894,8 @@ BOOST_AUTO_TEST_CASE(block_deduplicator_assign_immutable_different_hash) AssemblyItem{AssignImmutable, 0xABCD}, Instruction::JUMP }; - BlockDeduplicator dedup(input); - BOOST_CHECK(!dedup.deduplicate()); + BlockDeduplicator deduplicator(input); + BOOST_CHECK(!deduplicator.deduplicate()); } BOOST_AUTO_TEST_CASE(block_deduplicator_loops) @@ -920,8 +920,8 @@ BOOST_AUTO_TEST_CASE(block_deduplicator_loops) AssemblyItem(PushTag, 2), Instruction::JUMP, }; - BlockDeduplicator dedup(input); - dedup.deduplicate(); + BlockDeduplicator deduplicator(input); + deduplicator.deduplicate(); set pushTags; for (AssemblyItem const& item: input) From 0fda5fe077b6a2a42b64c75ae6a5a9217da795c7 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Sat, 23 May 2020 21:51:59 +0200 Subject: [PATCH 108/479] [SMTChecker] Add test that has an unused mapping --- .../smtCheckerTests/types/unused_mapping.sol | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/types/unused_mapping.sol diff --git a/test/libsolidity/smtCheckerTests/types/unused_mapping.sol b/test/libsolidity/smtCheckerTests/types/unused_mapping.sol new file mode 100644 index 000000000000..f12cd41de5fc --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/unused_mapping.sol @@ -0,0 +1,17 @@ +pragma experimental SMTChecker; + +contract C { + uint x; + uint y; + mapping (address => bool) public never_used; + + function inc() public { + require(x < 10); + require(y < 10); + + if(x == 0) x = 0; // noop state var read + x++; + y++; + assert(y == x); + } +} From d45bb2aa07677a53a0219b93cde0414e3a1ab937 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 19 May 2020 13:12:07 +0200 Subject: [PATCH 109/479] Add proper unipmlemented errors for array copying --- Changelog.md | 2 +- libsolidity/codegen/ArrayUtils.cpp | 7 +++++++ libsolidity/codegen/CompilerUtils.cpp | 8 ++++++++ .../syntaxTests/array/nested_calldata_memory.sol | 13 +++++++++++++ .../syntaxTests/array/nested_calldata_memory2.sol | 13 +++++++++++++ .../syntaxTests/array/nested_calldata_memory3.sol | 13 +++++++++++++ .../syntaxTests/array/nested_calldata_storage.sol | 9 +++++++++ .../syntaxTests/array/nested_calldata_storage2.sol | 9 +++++++++ 8 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/array/nested_calldata_memory.sol create mode 100644 test/libsolidity/syntaxTests/array/nested_calldata_memory2.sol create mode 100644 test/libsolidity/syntaxTests/array/nested_calldata_memory3.sol create mode 100644 test/libsolidity/syntaxTests/array/nested_calldata_storage.sol create mode 100644 test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol diff --git a/Changelog.md b/Changelog.md index 4e0e677d74b9..518c789635f9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,7 +14,7 @@ Bugfixes: * Type Checker: Disallow assignments to storage variables of type ``mapping``. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. - + * Code Generator: Trigger proper unimplemented errors on certain array copy operations. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index 089d0f5cf57e..732deca6f648 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -185,6 +185,13 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons { solAssert(byteOffsetSize == 0, "Byte offset for array as base type."); auto const& sourceBaseArrayType = dynamic_cast(*sourceBaseType); + + solUnimplementedAssert( + _sourceType.location() != DataLocation::CallData || + !_sourceType.isDynamicallyEncoded() || + !sourceBaseArrayType.isDynamicallySized(), + "Copying nested calldata dynamic arrays to storage is not implemented in the old code generator." + ); _context << Instruction::DUP3; if (sourceBaseArrayType.location() == DataLocation::Memory) _context << Instruction::MLOAD; diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 8bf0a21e2101..25c91f0a32f6 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -974,6 +974,14 @@ void CompilerUtils::convertType( } else { + if (auto baseType = dynamic_cast(typeOnStack.baseType())) + solUnimplementedAssert( + typeOnStack.location() != DataLocation::CallData || + !typeOnStack.isDynamicallyEncoded() || + !baseType->isDynamicallySized(), + "Copying nested dynamic calldata arrays to memory is not implemented in the old code generator." + ); + m_context << u256(0) << Instruction::SWAP1; // stack: (variably sized) auto repeat = m_context.newTag(); diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_memory.sol b/test/libsolidity/syntaxTests/array/nested_calldata_memory.sol new file mode 100644 index 000000000000..b8361e115613 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/nested_calldata_memory.sol @@ -0,0 +1,13 @@ +pragma experimental ABIEncoderV2; + +contract Test { + struct shouldBug { + bytes[2] deadly; + } + function killer(bytes[2] calldata weapon) pure external { + shouldBug(weapon); + } +} + +// ---- +// UnimplementedFeatureError: Copying nested dynamic calldata arrays to memory is not implemented in the old code generator. diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_memory2.sol b/test/libsolidity/syntaxTests/array/nested_calldata_memory2.sol new file mode 100644 index 000000000000..c886c8eee913 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/nested_calldata_memory2.sol @@ -0,0 +1,13 @@ +pragma experimental ABIEncoderV2; + +contract Test { + struct shouldBug { + uint256[][2] deadly; + } + function killer(uint256[][2] calldata weapon) pure external { + shouldBug(weapon); + } +} + +// ---- +// UnimplementedFeatureError: Copying nested dynamic calldata arrays to memory is not implemented in the old code generator. diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_memory3.sol b/test/libsolidity/syntaxTests/array/nested_calldata_memory3.sol new file mode 100644 index 000000000000..d8716d18ebd3 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/nested_calldata_memory3.sol @@ -0,0 +1,13 @@ +pragma experimental ABIEncoderV2; + +contract Test { + struct shouldBug { + uint256[][] deadly; + } + function killer(uint256[][] calldata weapon) pure external { + shouldBug(weapon); + } +} + +// ---- +// UnimplementedFeatureError: Copying nested dynamic calldata arrays to memory is not implemented in the old code generator. diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol b/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol new file mode 100644 index 000000000000..bae1033216d8 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol @@ -0,0 +1,9 @@ +pragma experimental ABIEncoderV2; + +contract C { + uint[][2] tmp_i; + function i(uint[][2] calldata s) external { tmp_i = s; } +} + +// ---- +// UnimplementedFeatureError: Copying nested calldata dynamic arrays to storage is not implemented in the old code generator. diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol b/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol new file mode 100644 index 000000000000..d922d717ffce --- /dev/null +++ b/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol @@ -0,0 +1,9 @@ +pragma experimental ABIEncoderV2; + +contract C { + uint[][] tmp_i; + function i(uint[][] calldata s) external { tmp_i = s; } +} + +// ---- +// UnimplementedFeatureError: Copying nested calldata dynamic arrays to storage is not implemented in the old code generator. From 936ea6f950ffd9b4d4bfaa9cd5ae949be0df58fd Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 21 May 2020 03:49:31 +0200 Subject: [PATCH 110/479] Refactor TypeChecker to assign different IDs to different errors --- libsolidity/analysis/TypeChecker.cpp | 281 +++++++++++++++------------ 1 file changed, 157 insertions(+), 124 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ce090101a817..6066893687bf 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1994,19 +1994,16 @@ void TypeChecker::typeCheckFunctionGeneralChecks( bool const isStructConstructorCall = _functionCall.annotation().kind == FunctionCallKind::StructConstructorCall; - string msg; - - if (isVariadic) - msg += + auto [errorId, description] = [&]() -> tuple { + string msg = isVariadic ? "Need at least " + toString(parameterTypes.size()) + " arguments for " + string(isStructConstructorCall ? "struct constructor" : "function call") + ", but provided only " + toString(arguments.size()) + - "."; - else - msg += + "." + : "Wrong argument count for " + string(isStructConstructorCall ? "struct constructor" : "function call") + ": " + @@ -2016,49 +2013,64 @@ void TypeChecker::typeCheckFunctionGeneralChecks( toString(parameterTypes.size()) + "."; - // Extend error message in case we try to construct a struct with mapping member. - if (isStructConstructorCall) - { - /// For error message: Struct members that were removed during conversion to memory. - TypePointer const expressionType = type(_functionCall.expression()); - TypeType const& t = dynamic_cast(*expressionType); - auto const& structType = dynamic_cast(*t.actualType()); - set membersRemovedForStructConstructor = structType.membersMissingInMemory(); + // Extend error message in case we try to construct a struct with mapping member. + if (isStructConstructorCall) + { + /// For error message: Struct members that were removed during conversion to memory. + TypePointer const expressionType = type(_functionCall.expression()); + auto const& t = dynamic_cast(*expressionType); + auto const& structType = dynamic_cast(*t.actualType()); + set membersRemovedForStructConstructor = structType.membersMissingInMemory(); - if (!membersRemovedForStructConstructor.empty()) + if (!membersRemovedForStructConstructor.empty()) + { + msg += " Members that have to be skipped in memory:"; + for (auto const& member: membersRemovedForStructConstructor) + msg += " " + member; + } + + return { isVariadic ? 1123_error : 9755_error, msg }; + } + else if ( + _functionType->kind() == FunctionType::Kind::BareCall || + _functionType->kind() == FunctionType::Kind::BareCallCode || + _functionType->kind() == FunctionType::Kind::BareDelegateCall || + _functionType->kind() == FunctionType::Kind::BareStaticCall + ) { - msg += " Members that have to be skipped in memory:"; - for (auto const& member: membersRemovedForStructConstructor) - msg += " " + member; + if (arguments.empty()) + return { + isVariadic ? 7653_error : 6138_error, + msg + + " This function requires a single bytes argument." + " Use \"\" as argument to provide empty calldata." + }; + else + return { + isVariadic ? 9390_error : 8922_error, + msg + + " This function requires a single bytes argument." + " If all your arguments are value types, you can use" + " abi.encode(...) to properly generate it." + }; } - } - else if ( - _functionType->kind() == FunctionType::Kind::BareCall || - _functionType->kind() == FunctionType::Kind::BareCallCode || - _functionType->kind() == FunctionType::Kind::BareDelegateCall || - _functionType->kind() == FunctionType::Kind::BareStaticCall - ) - { - if (arguments.empty()) - msg += + else if ( + _functionType->kind() == FunctionType::Kind::KECCAK256 || + _functionType->kind() == FunctionType::Kind::SHA256 || + _functionType->kind() == FunctionType::Kind::RIPEMD160 + ) + return { + isVariadic ? 1220_error : 4323_error, + msg + " This function requires a single bytes argument." - " Use \"\" as argument to provide empty calldata."; + " Use abi.encodePacked(...) to obtain the pre-0.5.0" + " behaviour or abi.encode(...) to use ABI encoding." + }; else - msg += - " This function requires a single bytes argument." - " If all your arguments are value types, you can use" - " abi.encode(...) to properly generate it."; - } - else if ( - _functionType->kind() == FunctionType::Kind::KECCAK256 || - _functionType->kind() == FunctionType::Kind::SHA256 || - _functionType->kind() == FunctionType::Kind::RIPEMD160 - ) - msg += - " This function requires a single bytes argument." - " Use abi.encodePacked(...) to obtain the pre-0.5.0" - " behaviour or abi.encode(...) to use ABI encoding."; - m_errorReporter.typeError(1093_error, _functionCall.location(), msg); + return { isVariadic ? 9308_error : 6160_error, msg }; + }(); + + m_errorReporter.typeError(errorId, _functionCall.location(), description); return; } @@ -2134,33 +2146,43 @@ void TypeChecker::typeCheckFunctionGeneralChecks( solAssert(!!paramArgMap[i], "unmapped parameter"); if (!type(*paramArgMap[i])->isImplicitlyConvertibleTo(*parameterTypes[i])) { - string msg = - "Invalid type for argument in function call. " - "Invalid implicit conversion from " + - type(*paramArgMap[i])->toString() + - " to " + - parameterTypes[i]->toString() + - " requested."; - if ( - _functionType->kind() == FunctionType::Kind::BareCall || - _functionType->kind() == FunctionType::Kind::BareCallCode || - _functionType->kind() == FunctionType::Kind::BareDelegateCall || - _functionType->kind() == FunctionType::Kind::BareStaticCall - ) - msg += - " This function requires a single bytes argument." - " If all your arguments are value types, you can" - " use abi.encode(...) to properly generate it."; - else if ( - _functionType->kind() == FunctionType::Kind::KECCAK256 || - _functionType->kind() == FunctionType::Kind::SHA256 || - _functionType->kind() == FunctionType::Kind::RIPEMD160 - ) - msg += - " This function requires a single bytes argument." - " Use abi.encodePacked(...) to obtain the pre-0.5.0" - " behaviour or abi.encode(...) to use ABI encoding."; - m_errorReporter.typeError(6706_error, paramArgMap[i]->location(), msg); + auto [errorId, description] = [&]() -> tuple { + string msg = + "Invalid type for argument in function call. " + "Invalid implicit conversion from " + + type(*paramArgMap[i])->toString() + + " to " + + parameterTypes[i]->toString() + + " requested."; + if ( + _functionType->kind() == FunctionType::Kind::BareCall || + _functionType->kind() == FunctionType::Kind::BareCallCode || + _functionType->kind() == FunctionType::Kind::BareDelegateCall || + _functionType->kind() == FunctionType::Kind::BareStaticCall + ) + return { + 8051_error, + msg + + " This function requires a single bytes argument." + " If all your arguments are value types, you can" + " use abi.encode(...) to properly generate it." + }; + else if ( + _functionType->kind() == FunctionType::Kind::KECCAK256 || + _functionType->kind() == FunctionType::Kind::SHA256 || + _functionType->kind() == FunctionType::Kind::RIPEMD160 + ) + return { + 7556_error, + msg + + " This function requires a single bytes argument." + " Use abi.encodePacked(...) to obtain the pre-0.5.0" + " behaviour or abi.encode(...) to use ABI encoding." + }; + else + return { 9553_error, msg }; + }(); + m_errorReporter.typeError(errorId, paramArgMap[i]->location(), description); } } } @@ -2549,61 +2571,70 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) " outside of storage." ); } - string errorMsg = "Member \"" + memberName + "\" not found or not visible " - "after argument-dependent lookup in " + exprType->toString() + "."; - if (auto const& funType = dynamic_cast(exprType)) - { - auto const& t = funType->returnParameterTypes(); + auto [errorId, description] = [&]() -> tuple { + string errorMsg = "Member \"" + memberName + "\" not found or not visible " + "after argument-dependent lookup in " + exprType->toString() + "."; - if (memberName == "value") + if (auto const* funType = dynamic_cast(exprType)) { - if (funType->kind() == FunctionType::Kind::Creation) - errorMsg = "Constructor for " + t.front()->toString() + " must be payable for member \"value\" to be available."; + TypePointers const& t = funType->returnParameterTypes(); + + if (memberName == "value") + { + if (funType->kind() == FunctionType::Kind::Creation) + return { + 8827_error, + "Constructor for " + t.front()->toString() + " must be payable for member \"value\" to be available." + }; + else if ( + funType->kind() == FunctionType::Kind::DelegateCall || + funType->kind() == FunctionType::Kind::BareDelegateCall + ) + return { 8477_error, "Member \"value\" is not allowed in delegated calls due to \"msg.value\" persisting." }; + else + return { 8820_error, "Member \"value\" is only available for payable functions." }; + } else if ( - funType->kind() == FunctionType::Kind::DelegateCall || - funType->kind() == FunctionType::Kind::BareDelegateCall + t.size() == 1 && ( + t.front()->category() == Type::Category::Struct || + t.front()->category() == Type::Category::Contract + ) ) - errorMsg = "Member \"value\" is not allowed in delegated calls due to \"msg.value\" persisting."; - else - errorMsg = "Member \"value\" is only available for payable functions."; + return { 6005_error, errorMsg + " Did you intend to call the function?" }; } - else if ( - t.size() == 1 && - (t.front()->category() == Type::Category::Struct || - t.front()->category() == Type::Category::Contract) - ) - errorMsg += " Did you intend to call the function?"; - } - else if (exprType->category() == Type::Category::Contract) - { - for (auto const& addressMember: TypeProvider::payableAddress()->nativeMembers(nullptr)) - if (addressMember.name == memberName) - { - Identifier const* var = dynamic_cast(&_memberAccess.expression()); - string varName = var ? var->name() : "..."; - errorMsg += " Use \"address(" + varName + ")." + memberName + "\" to access this address member."; - break; - } - } - else if (auto addressType = dynamic_cast(exprType)) - { - // Trigger error when using send or transfer with a non-payable fallback function. - if (memberName == "send" || memberName == "transfer") + else if (exprType->category() == Type::Category::Contract) { - solAssert( - addressType->stateMutability() != StateMutability::Payable, - "Expected address not-payable as members were not found" - ); + for (MemberList::Member const& addressMember: TypeProvider::payableAddress()->nativeMembers(nullptr)) + if (addressMember.name == memberName) + { + auto const* var = dynamic_cast(&_memberAccess.expression()); + string varName = var ? var->name() : "..."; + errorMsg += " Use \"address(" + varName + ")." + memberName + "\" to access this address member."; + return { 5256_error, errorMsg }; + } + } + else if (auto const* addressType = dynamic_cast(exprType)) + { + // Trigger error when using send or transfer with a non-payable fallback function. + if (memberName == "send" || memberName == "transfer") + { + solAssert( + addressType->stateMutability() != StateMutability::Payable, + "Expected address not-payable as members were not found" + ); - errorMsg = "\"send\" and \"transfer\" are only available for objects of type \"address payable\", not \"" + exprType->toString() + "\"."; + return { 2604_error, "\"send\" and \"transfer\" are only available for objects of type \"address payable\", not \"" + exprType->toString() + "\"." }; + } } - } + + return { 5856_error, errorMsg }; + }(); m_errorReporter.fatalTypeError( - 4035_error, + errorId, _memberAccess.location(), - errorMsg + description ); } else if (possibleMembers.size() > 1) @@ -3165,17 +3196,17 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss if (_expression.annotation().isLValue) return; - return m_errorReporter.typeError(1123_error, _expression.location(), [&]() { + auto [errorId, description] = [&]() -> tuple { if (_expression.annotation().isConstant) - return "Cannot assign to a constant variable."; + return { 6520_error, "Cannot assign to a constant variable." }; if (auto indexAccess = dynamic_cast(&_expression)) { if (type(indexAccess->baseExpression())->category() == Type::Category::FixedBytes) - return "Single bytes in fixed bytes arrays cannot be modified."; + return { 9222_error, "Single bytes in fixed bytes arrays cannot be modified." }; else if (auto arrayType = dynamic_cast(type(indexAccess->baseExpression()))) if (arrayType->dataStoredIn(DataLocation::CallData)) - return "Calldata arrays are read-only."; + return { 3335_error, "Calldata arrays are read-only." }; } if (auto memberAccess = dynamic_cast(&_expression)) @@ -3183,18 +3214,20 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss if (auto structType = dynamic_cast(type(memberAccess->expression()))) { if (structType->dataStoredIn(DataLocation::CallData)) - return "Calldata structs are read-only."; + return { 9942_error, "Calldata structs are read-only." }; } else if (dynamic_cast(type(memberAccess->expression()))) if (memberAccess->memberName() == "length") - return "Member \"length\" is read-only and cannot be used to resize arrays."; + return { 7567_error, "Member \"length\" is read-only and cannot be used to resize arrays." }; } if (auto identifier = dynamic_cast(&_expression)) if (auto varDecl = dynamic_cast(identifier->annotation().referencedDeclaration)) if (varDecl->isExternalCallableParameter() && dynamic_cast(identifier->annotation().type)) - return "External function arguments of reference type are read-only."; + return { 7128_error, "External function arguments of reference type are read-only." }; + + return { 4247_error, "Expression has to be an lvalue." }; + }(); - return "Expression has to be an lvalue."; - }()); + m_errorReporter.typeError(errorId, _expression.location(), description); } From 7f3d437ffeb9710a3e3aadd5c9eefa477bb57d52 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 25 May 2020 12:22:11 +0200 Subject: [PATCH 111/479] Fix caret position for errors with utf source --- liblangutil/SourceReferenceFormatterHuman.cpp | 6 ++++-- libsolutil/UTF8.cpp | 9 +++++++++ libsolutil/UTF8.h | 2 ++ scripts/isolate_tests.py | 2 +- scripts/wasm-rebuild/docker-scripts/isolate_tests.py | 2 +- test/cmdlineTests/message_format_utf16/err | 11 +++++++++++ test/cmdlineTests/message_format_utf16/input.sol | 3 +++ 7 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 test/cmdlineTests/message_format_utf16/err create mode 100644 test/cmdlineTests/message_format_utf16/input.sol diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index ca947314e60e..cbf24cf3518a 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include using namespace std; @@ -103,12 +104,13 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ m_stream << leftpad << ' '; frameColored() << '|'; m_stream << ' '; + for_each( _ref.text.cbegin(), - _ref.text.cbegin() + _ref.startColumn, + _ref.text.cbegin() + numCodepoints(_ref.text.substr(0, _ref.startColumn)), [this](char ch) { m_stream << (ch == '\t' ? '\t' : ' '); } ); - diagColored() << string(locationLength, '^'); + diagColored() << string(numCodepoints(_ref.text.substr(_ref.startColumn, locationLength)), '^'); m_stream << '\n'; } else diff --git a/libsolutil/UTF8.cpp b/libsolutil/UTF8.cpp index a7d55af6c382..82c87bb4445f 100644 --- a/libsolutil/UTF8.cpp +++ b/libsolutil/UTF8.cpp @@ -138,4 +138,13 @@ bool validateUTF8(std::string const& _input, size_t& _invalidPosition) return validateUTF8(reinterpret_cast(_input.c_str()), _input.length(), _invalidPosition); } +size_t numCodepoints(std::string const& _utf8EncodedInput) +{ + size_t codepoint = 0; + for (char c: _utf8EncodedInput) + codepoint += (c & 0xc0) != 0x80; + + return codepoint; +} + } diff --git a/libsolutil/UTF8.h b/libsolutil/UTF8.h index cd84c3982590..fb5ee376ceab 100644 --- a/libsolutil/UTF8.h +++ b/libsolutil/UTF8.h @@ -38,4 +38,6 @@ inline bool validateUTF8(std::string const& _input) return validateUTF8(_input, invalidPos); } +size_t numCodepoints(std::string const& _utf8EncodedInput); + } diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py index 768f94801fda..0f2bc1d79c44 100755 --- a/scripts/isolate_tests.py +++ b/scripts/isolate_tests.py @@ -13,7 +13,7 @@ from os.path import join, isfile def extract_test_cases(path): - lines = open(path, mode='r', encoding='utf8').read().splitlines() + lines = open(path, encoding="utf8", errors='ignore', mode='r').read().splitlines() inside = False delimiter = '' diff --git a/scripts/wasm-rebuild/docker-scripts/isolate_tests.py b/scripts/wasm-rebuild/docker-scripts/isolate_tests.py index eab461bffe82..0a7571891270 100755 --- a/scripts/wasm-rebuild/docker-scripts/isolate_tests.py +++ b/scripts/wasm-rebuild/docker-scripts/isolate_tests.py @@ -8,7 +8,7 @@ def extract_test_cases(path): - lines = open(path, 'rb').read().splitlines() + lines = open(path, encoding="utf8", errors='ignore', mode='rb').read().splitlines() inside = False delimiter = '' diff --git a/test/cmdlineTests/message_format_utf16/err b/test/cmdlineTests/message_format_utf16/err new file mode 100644 index 000000000000..abe92d2e5c98 --- /dev/null +++ b/test/cmdlineTests/message_format_utf16/err @@ -0,0 +1,11 @@ +Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. +--> message_format_utf16/input.sol + +Warning: Source file does not specify required compiler version! +--> message_format_utf16/input.sol + +Warning: Statement has no effect. + --> message_format_utf16/input.sol:2:58: + | +2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } + | ^^^^^^^^^^^^ diff --git a/test/cmdlineTests/message_format_utf16/input.sol b/test/cmdlineTests/message_format_utf16/input.sol new file mode 100644 index 000000000000..2c1f9007a2a7 --- /dev/null +++ b/test/cmdlineTests/message_format_utf16/input.sol @@ -0,0 +1,3 @@ +contract Foo { +/* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } +} From 4c3e78d0462c27f5d7481352f0396e31349008de Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 12 May 2020 00:06:25 +0200 Subject: [PATCH 112/479] Disallowing shifts by signed types --- Changelog.md | 1 + docs/070-breaking-changes.rst | 2 ++ docs/types/value-types.rst | 6 ++--- libsolidity/ast/Types.cpp | 2 +- test/compilationTests/gnosis/Utils/Math.sol | 8 +++--- .../shifts/shift_negative_rvalue.sol | 15 ----------- .../shift_negative_rvalue_assignment.sol | 17 ------------ .../semanticTests/shifts/shift_overflow.sol | 6 ++--- .../shifts/shift_right_assignment_signed.sol | 14 ---------- .../shifts/shift_right_negative_lvalue.sol | 26 +++++++++---------- ...shift_right_negative_lvalue_assignment.sol | 26 +++++++++---------- .../shift_right_negative_lvalue_int16.sol | 26 +++++++++---------- .../shift_right_negative_lvalue_int32.sol | 26 +++++++++---------- .../shift_right_negative_lvalue_int8.sol | 26 +++++++++---------- ...right_negative_lvalue_signextend_int16.sol | 12 ++++----- ...ht_negative_lvalue_signextend_int16_v2.sol | 12 ++++----- ...right_negative_lvalue_signextend_int32.sol | 12 ++++----- ...ht_negative_lvalue_signextend_int32_v2.sol | 12 ++++----- ..._right_negative_lvalue_signextend_int8.sol | 12 ++++----- ...ght_negative_lvalue_signextend_int8_v2.sol | 12 ++++----- .../shifts/shift_signed_cleanup_amount.sol | 16 ------------ .../shift_underflow_negative_rvalue.sol | 15 +++++++++++ .../shifts/shift_singed_rvalue.sol | 11 ++++++++ 23 files changed, 141 insertions(+), 174 deletions(-) delete mode 100644 test/libsolidity/semanticTests/shifts/shift_negative_rvalue.sol delete mode 100644 test/libsolidity/semanticTests/shifts/shift_negative_rvalue_assignment.sol delete mode 100644 test/libsolidity/semanticTests/shifts/shift_right_assignment_signed.sol delete mode 100644 test/libsolidity/semanticTests/shifts/shift_signed_cleanup_amount.sol create mode 100644 test/libsolidity/semanticTests/shifts/shift_underflow_negative_rvalue.sol create mode 100644 test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol diff --git a/Changelog.md b/Changelog.md index 7e9e3c3befb0..0d638e0f6996 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Breaking changes: * Deprecated dot syntax for `value` and `gas`. * Deprecated the identifier `now`. * JSON AST: Removes members with ``null`` value from JSON output. + * Type Checker: Disallow shifts by signed types. Language Features: diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index f273dcd0b9eb..2971a25ea2f6 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -16,3 +16,5 @@ This section gives detailed instructions on how to update prior code for every b * Change ``f.value(...)()`` to ``f{value: ...}()``. Similarly ``(new C).value(...)()`` to ``(new C){value: ...}()`` and ``f.gas(...)()`` to ``f{gas: ...}()``. * Change ``now`` to ``block.timestamp``. +* Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to + ``x >> uint(256 - y)``. diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index bc70a3331c6c..5d7adc7cab2a 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -64,11 +64,11 @@ Shifts ^^^^^^ The result of a shift operation has the type of the left operand, truncating the result to match the type. +Right operand must be unsigned type. Trying to shift by signed type will produce a compilation error. - For positive and negative ``x`` values, ``x << y`` is equivalent to ``x * 2**y``. - For positive ``x`` values, ``x >> y`` is equivalent to ``x / 2**y``. - For negative ``x`` values, ``x >> y`` is equivalent to ``(x + 1) / 2**y - 1`` (which is the same as dividing ``x`` by ``2**y`` while rounding down towards negative infinity). -- In all cases, shifting by a negative ``y`` throws a runtime exception. .. warning:: Before version ``0.5.0`` a right shift ``x >> y`` for negative ``x`` was equivalent to ``x / 2**y``, @@ -370,9 +370,9 @@ Operators: * Shift operators: ``<<`` (left shift), ``>>`` (right shift) * Index access: If ``x`` is of type ``bytesI``, then ``x[k]`` for ``0 <= k < I`` returns the ``k`` th byte (read-only). -The shifting operator works with any integer type as right operand (but +The shifting operator works with unsigned integer type as right operand (but returns the type of the left operand), which denotes the number of bits to shift by. -Shifting by a negative amount causes a runtime exception. +Shifting by a signed type will produce a compilation error. Members: diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index c2522637902d..ed41f32562b4 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -480,7 +480,7 @@ bool isValidShiftAndAmountType(Token _operator, Type const& _shiftAmountType) if (_operator == Token::SHR) return false; else if (IntegerType const* otherInt = dynamic_cast(&_shiftAmountType)) - return true; + return !otherInt->isSigned(); else if (RationalNumberType const* otherRat = dynamic_cast(&_shiftAmountType)) return !otherRat->isFractional() && otherRat->integerType() && !otherRat->integerType()->isSigned(); else diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 090c935ec5d3..bcae29b6a87a 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -94,12 +94,12 @@ library Math { zpow = zpow * z / ONE; result += 0x9c7 * zpow / ONE; if (shift >= 0) { - if (result >> (256-shift) > 0) - return (2**256-1); - return result << shift; + if (result >> uint(256 - shift) > 0) + return (2 ** 256 - 1); + return result << uint(shift); } else - return result >> (-shift); + return result >> uint(-shift); } /// @dev Returns natural logarithm value of given x diff --git a/test/libsolidity/semanticTests/shifts/shift_negative_rvalue.sol b/test/libsolidity/semanticTests/shifts/shift_negative_rvalue.sol deleted file mode 100644 index 61145824612f..000000000000 --- a/test/libsolidity/semanticTests/shifts/shift_negative_rvalue.sol +++ /dev/null @@ -1,15 +0,0 @@ -contract C { - function f(int256 a, int256 b) public returns (int256) { - return a << b; - } - - function g(int256 a, int256 b) public returns (int256) { - return a >> b; - } -} - -// ==== -// compileViaYul: also -// ---- -// f(int256,int256): 1, -1 -> FAILURE -// g(int256,int256): 1, -1 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_negative_rvalue_assignment.sol b/test/libsolidity/semanticTests/shifts/shift_negative_rvalue_assignment.sol deleted file mode 100644 index 623a715ecf30..000000000000 --- a/test/libsolidity/semanticTests/shifts/shift_negative_rvalue_assignment.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract C { - function f(int256 a, int256 b) public returns (int256) { - a <<= b; - return a; - } - - function g(int256 a, int256 b) public returns (int256) { - a >>= b; - return a; - } -} - -// ==== -// compileViaYul: also -// ---- -// f(int256,int256): 1, -1 -> FAILURE -// g(int256,int256): 1, -1 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_overflow.sol b/test/libsolidity/semanticTests/shifts/shift_overflow.sol index 54f5fcc2b67e..c303d449e1ff 100644 --- a/test/libsolidity/semanticTests/shifts/shift_overflow.sol +++ b/test/libsolidity/semanticTests/shifts/shift_overflow.sol @@ -3,7 +3,7 @@ contract C { return x << y; } - function leftS(int8 x, int8 y) public returns (int8) { + function leftS(int8 x, uint8 y) public returns (int8) { return x << y; } } @@ -14,5 +14,5 @@ contract C { // leftU(uint8,uint8): 255, 8 -> 0 // leftU(uint8,uint8): 255, 1 -> 254 // leftU(uint8,uint8): 255, 0 -> 255 -// leftS(int8,int8): 1, 7 -> -128 # Result is -128 and output is sign-extended, not zero-padded. # -// leftS(int8,int8): 1, 6 -> 64 +// leftS(int8,uint8): 1, 7 -> -128 # Result is -128 and output is sign-extended, not zero-padded. # +// leftS(int8,uint8): 1, 6 -> 64 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_assignment_signed.sol b/test/libsolidity/semanticTests/shifts/shift_right_assignment_signed.sol deleted file mode 100644 index 5b84941674f9..000000000000 --- a/test/libsolidity/semanticTests/shifts/shift_right_assignment_signed.sol +++ /dev/null @@ -1,14 +0,0 @@ -contract C { - function f(int256 a, int256 b) public returns (int256) { - a >>= b; - return a; - } -} - -// ==== -// compileViaYul: also -// ---- -// f(int256,int256): 0x4266, 0x0 -> 0x4266 -// f(int256,int256): 0x4266, 0x8 -> 0x42 -// f(int256,int256): 0x4266, 0x10 -> 0 -// f(int256,int256): 0x4266, 0x11 -> 0 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue.sol index 2bac06e6eb0d..013379d97daf 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue.sol @@ -1,5 +1,5 @@ contract C { - function f(int256 a, int256 b) public returns (int256) { + function f(int256 a, uint256 b) public returns (int256) { return a >> b; } } @@ -7,15 +7,15 @@ contract C { // ==== // compileViaYul: also // ---- -// f(int256,int256): -4266, 0 -> -4266 -// f(int256,int256): -4266, 1 -> -2133 -// f(int256,int256): -4266, 4 -> -267 -// f(int256,int256): -4266, 8 -> -17 -// f(int256,int256): -4266, 16 -> -1 -// f(int256,int256): -4266, 17 -> -1 -// f(int256,int256): -4267, 0 -> -4267 -// f(int256,int256): -4267, 1 -> -2134 -// f(int256,int256): -4267, 4 -> -267 -// f(int256,int256): -4267, 8 -> -17 -// f(int256,int256): -4267, 16 -> -1 -// f(int256,int256): -4267, 17 -> -1 +// f(int256,uint256): -4266, 0 -> -4266 +// f(int256,uint256): -4266, 1 -> -2133 +// f(int256,uint256): -4266, 4 -> -267 +// f(int256,uint256): -4266, 8 -> -17 +// f(int256,uint256): -4266, 16 -> -1 +// f(int256,uint256): -4266, 17 -> -1 +// f(int256,uint256): -4267, 0 -> -4267 +// f(int256,uint256): -4267, 1 -> -2134 +// f(int256,uint256): -4267, 4 -> -267 +// f(int256,uint256): -4267, 8 -> -17 +// f(int256,uint256): -4267, 16 -> -1 +// f(int256,uint256): -4267, 17 -> -1 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_assignment.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_assignment.sol index 4fecffda4195..2109f47d3628 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_assignment.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_assignment.sol @@ -1,5 +1,5 @@ contract C { - function f(int256 a, int256 b) public returns (int256) { + function f(int256 a, uint256 b) public returns (int256) { a >>= b; return a; } @@ -8,15 +8,15 @@ contract C { // ==== // compileViaYul: also // ---- -// f(int256,int256): -4266, 0 -> -4266 -// f(int256,int256): -4266, 1 -> -2133 -// f(int256,int256): -4266, 4 -> -267 -// f(int256,int256): -4266, 8 -> -17 -// f(int256,int256): -4266, 16 -> -1 -// f(int256,int256): -4266, 17 -> -1 -// f(int256,int256): -4267, 0 -> -4267 -// f(int256,int256): -4267, 1 -> -2134 -// f(int256,int256): -4267, 4 -> -267 -// f(int256,int256): -4267, 8 -> -17 -// f(int256,int256): -4267, 16 -> -1 -// f(int256,int256): -4267, 17 -> -1 +// f(int256,uint256): -4266, 0 -> -4266 +// f(int256,uint256): -4266, 1 -> -2133 +// f(int256,uint256): -4266, 4 -> -267 +// f(int256,uint256): -4266, 8 -> -17 +// f(int256,uint256): -4266, 16 -> -1 +// f(int256,uint256): -4266, 17 -> -1 +// f(int256,uint256): -4267, 0 -> -4267 +// f(int256,uint256): -4267, 1 -> -2134 +// f(int256,uint256): -4267, 4 -> -267 +// f(int256,uint256): -4267, 8 -> -17 +// f(int256,uint256): -4267, 16 -> -1 +// f(int256,uint256): -4267, 17 -> -1 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int16.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int16.sol index 883f004d0efe..2132f13b1f03 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int16.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int16.sol @@ -1,5 +1,5 @@ contract C { - function f(int16 a, int16 b) public returns (int256) { + function f(int16 a, uint16 b) public returns (int256) { return a >> b; } } @@ -7,15 +7,15 @@ contract C { // ==== // compileViaYul: also // ---- -// f(int16,int16): -4266, 0 -> -4266 -// f(int16,int16): -4266, 1 -> -2133 -// f(int16,int16): -4266, 4 -> -267 -// f(int16,int16): -4266, 8 -> -17 -// f(int16,int16): -4266, 16 -> -1 -// f(int16,int16): -4266, 17 -> -1 -// f(int16,int16): -4267, 0 -> -4267 -// f(int16,int16): -4267, 1 -> -2134 -// f(int16,int16): -4267, 4 -> -267 -// f(int16,int16): -4267, 8 -> -17 -// f(int16,int16): -4267, 16 -> -1 -// f(int16,int16): -4267, 17 -> -1 +// f(int16,uint16): -4266, 0 -> -4266 +// f(int16,uint16): -4266, 1 -> -2133 +// f(int16,uint16): -4266, 4 -> -267 +// f(int16,uint16): -4266, 8 -> -17 +// f(int16,uint16): -4266, 16 -> -1 +// f(int16,uint16): -4266, 17 -> -1 +// f(int16,uint16): -4267, 0 -> -4267 +// f(int16,uint16): -4267, 1 -> -2134 +// f(int16,uint16): -4267, 4 -> -267 +// f(int16,uint16): -4267, 8 -> -17 +// f(int16,uint16): -4267, 16 -> -1 +// f(int16,uint16): -4267, 17 -> -1 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int32.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int32.sol index 4f689c01533c..8c944e26e794 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int32.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int32.sol @@ -1,5 +1,5 @@ contract C { - function f(int32 a, int32 b) public returns (int256) { + function f(int32 a, uint32 b) public returns (int256) { return a >> b; } } @@ -7,15 +7,15 @@ contract C { // ==== // compileViaYul: also // ---- -// f(int32,int32): -4266, 0 -> -4266 -// f(int32,int32): -4266, 1 -> -2133 -// f(int32,int32): -4266, 4 -> -267 -// f(int32,int32): -4266, 8 -> -17 -// f(int32,int32): -4266, 16 -> -1 -// f(int32,int32): -4266, 17 -> -1 -// f(int32,int32): -4267, 0 -> -4267 -// f(int32,int32): -4267, 1 -> -2134 -// f(int32,int32): -4267, 4 -> -267 -// f(int32,int32): -4267, 8 -> -17 -// f(int32,int32): -4267, 16 -> -1 -// f(int32,int32): -4267, 17 -> -1 +// f(int32,uint32): -4266, 0 -> -4266 +// f(int32,uint32): -4266, 1 -> -2133 +// f(int32,uint32): -4266, 4 -> -267 +// f(int32,uint32): -4266, 8 -> -17 +// f(int32,uint32): -4266, 16 -> -1 +// f(int32,uint32): -4266, 17 -> -1 +// f(int32,uint32): -4267, 0 -> -4267 +// f(int32,uint32): -4267, 1 -> -2134 +// f(int32,uint32): -4267, 4 -> -267 +// f(int32,uint32): -4267, 8 -> -17 +// f(int32,uint32): -4267, 16 -> -1 +// f(int32,uint32): -4267, 17 -> -1 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int8.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int8.sol index 02f293e3ca7a..d224a2379252 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int8.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_int8.sol @@ -1,5 +1,5 @@ contract C { - function f(int8 a, int8 b) public returns (int256) { + function f(int8 a, uint8 b) public returns (int256) { return a >> b; } } @@ -7,15 +7,15 @@ contract C { // ==== // compileViaYul: also // ---- -// f(int8,int8): -66, 0 -> -66 -// f(int8,int8): -66, 1 -> -33 -// f(int8,int8): -66, 4 -> -5 -// f(int8,int8): -66, 8 -> -1 -// f(int8,int8): -66, 16 -> -1 -// f(int8,int8): -66, 17 -> -1 -// f(int8,int8): -67, 0 -> -67 -// f(int8,int8): -67, 1 -> -34 -// f(int8,int8): -67, 4 -> -5 -// f(int8,int8): -67, 8 -> -1 -// f(int8,int8): -67, 16 -> -1 -// f(int8,int8): -67, 17 -> -1 +// f(int8,uint8): -66, 0 -> -66 +// f(int8,uint8): -66, 1 -> -33 +// f(int8,uint8): -66, 4 -> -5 +// f(int8,uint8): -66, 8 -> -1 +// f(int8,uint8): -66, 16 -> -1 +// f(int8,uint8): -66, 17 -> -1 +// f(int8,uint8): -67, 0 -> -67 +// f(int8,uint8): -67, 1 -> -34 +// f(int8,uint8): -67, 4 -> -5 +// f(int8,uint8): -67, 8 -> -1 +// f(int8,uint8): -67, 16 -> -1 +// f(int8,uint8): -67, 17 -> -1 diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16.sol index c59107f52f3d..daa1ffb5fa84 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16.sol @@ -1,13 +1,13 @@ contract C { - function f(int16 a, int16 b) public returns (int16) { + function f(int16 a, uint16 b) public returns (int16) { return a >> b; } } // ==== // ABIEncoderV1Only: true // ---- -// f(int16,int16): 0xff99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 -// f(int16,int16): 0xff99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc -// f(int16,int16): 0xff99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 -// f(int16,int16): 0xff99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 -// f(int16,int16): 0xff99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +// f(int16,uint16): 0xff99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 +// f(int16,uint16): 0xff99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc +// f(int16,uint16): 0xff99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 +// f(int16,uint16): 0xff99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 +// f(int16,uint16): 0xff99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol index 850a89be3c6f..5ffb50c23e6e 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol @@ -2,15 +2,15 @@ pragma experimental ABIEncoderV2; contract C { - function f(int16 a, int16 b) public returns (int16) { + function f(int16 a, uint16 b) public returns (int16) { return a >> b; } } // ==== // compileViaYul: also // ---- -// f(int16,int16): 0xff99, 0x00 -> FAILURE -// f(int16,int16): 0xff99, 0x01 -> FAILURE -// f(int16,int16): 0xff99, 0x02 -> FAILURE -// f(int16,int16): 0xff99, 0x04 -> FAILURE -// f(int16,int16): 0xff99, 0x08 -> FAILURE +// f(int16,uint16): 0xff99, 0x00 -> FAILURE +// f(int16,uint16): 0xff99, 0x01 -> FAILURE +// f(int16,uint16): 0xff99, 0x02 -> FAILURE +// f(int16,uint16): 0xff99, 0x04 -> FAILURE +// f(int16,uint16): 0xff99, 0x08 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32.sol index 74e9d53b0ddf..4070fe7e18a3 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32.sol @@ -1,13 +1,13 @@ contract C { - function f(int32 a, int32 b) public returns (int32) { + function f(int32 a, uint32 b) public returns (int32) { return a >> b; } } // ==== // ABIEncoderV1Only: true // ---- -// f(int32,int32): 0xffffff99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 -// f(int32,int32): 0xffffff99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc -// f(int32,int32): 0xffffff99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 -// f(int32,int32): 0xffffff99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 -// f(int32,int32): 0xffffff99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +// f(int32,uint32): 0xffffff99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 +// f(int32,uint32): 0xffffff99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc +// f(int32,uint32): 0xffffff99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 +// f(int32,uint32): 0xffffff99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 +// f(int32,uint32): 0xffffff99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol index d797531ec425..a4cb461a1ea2 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol @@ -2,15 +2,15 @@ pragma experimental ABIEncoderV2; contract C { - function f(int32 a, int32 b) public returns (int32) { + function f(int32 a, uint32 b) public returns (int32) { return a >> b; } } // ==== // compileViaYul: also // ---- -// f(int32,int32): 0xffffff99, 0x00 -> FAILURE -// f(int32,int32): 0xffffff99, 0x01 -> FAILURE -// f(int32,int32): 0xffffff99, 0x02 -> FAILURE -// f(int32,int32): 0xffffff99, 0x04 -> FAILURE -// f(int32,int32): 0xffffff99, 0x08 -> FAILURE +// f(int32,uint32): 0xffffff99, 0x00 -> FAILURE +// f(int32,uint32): 0xffffff99, 0x01 -> FAILURE +// f(int32,uint32): 0xffffff99, 0x02 -> FAILURE +// f(int32,uint32): 0xffffff99, 0x04 -> FAILURE +// f(int32,uint32): 0xffffff99, 0x08 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8.sol index 06dcf8eb5be0..95d983dcd1c8 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8.sol @@ -1,13 +1,13 @@ contract C { - function f(int8 a, int8 b) public returns (int8) { + function f(int8 a, uint8 b) public returns (int8) { return a >> b; } } // ==== // ABIEncoderV1Only: true // ---- -// f(int8,int8): 0x99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 -// f(int8,int8): 0x99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc -// f(int8,int8): 0x99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 -// f(int8,int8): 0x99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 -// f(int8,int8): 0x99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +// f(int8,uint8): 0x99, 0x00 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff99 +// f(int8,uint8): 0x99, 0x01 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc +// f(int8,uint8): 0x99, 0x02 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe6 +// f(int8,uint8): 0x99, 0x04 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9 +// f(int8,uint8): 0x99, 0x08 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol index ee485335d33e..f42f0677348e 100644 --- a/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol +++ b/test/libsolidity/semanticTests/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol @@ -2,15 +2,15 @@ pragma experimental ABIEncoderV2; contract C { - function f(int8 a, int8 b) public returns (int8) { + function f(int8 a, uint8 b) public returns (int8) { return a >> b; } } // ==== // compileViaYul: also // ---- -// f(int8,int8): 0x99, 0x00 -> FAILURE -// f(int8,int8): 0x99, 0x01 -> FAILURE -// f(int8,int8): 0x99, 0x02 -> FAILURE -// f(int8,int8): 0x99, 0x04 -> FAILURE -// f(int8,int8): 0x99, 0x08 -> FAILURE +// f(int8,uint8): 0x99, 0x00 -> FAILURE +// f(int8,uint8): 0x99, 0x01 -> FAILURE +// f(int8,uint8): 0x99, 0x02 -> FAILURE +// f(int8,uint8): 0x99, 0x04 -> FAILURE +// f(int8,uint8): 0x99, 0x08 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_signed_cleanup_amount.sol b/test/libsolidity/semanticTests/shifts/shift_signed_cleanup_amount.sol deleted file mode 100644 index 72b8f69c83c6..000000000000 --- a/test/libsolidity/semanticTests/shifts/shift_signed_cleanup_amount.sol +++ /dev/null @@ -1,16 +0,0 @@ -contract C { - function f(uint256 a, int8 b) public returns (uint256) { - assembly { b := 0xff } - return a << b; - } - function g(uint256 a, int8 b) public returns (uint256) { - assembly { b := 0xff } - return a >> b; - } -} - -// ==== -// compileViaYul: also -// ---- -// f(uint256,int8): 0x1234, 0x0 -> FAILURE -// g(uint256,int8): 0x1234, 0x0 -> FAILURE diff --git a/test/libsolidity/semanticTests/shifts/shift_underflow_negative_rvalue.sol b/test/libsolidity/semanticTests/shifts/shift_underflow_negative_rvalue.sol new file mode 100644 index 000000000000..ad14558beb4a --- /dev/null +++ b/test/libsolidity/semanticTests/shifts/shift_underflow_negative_rvalue.sol @@ -0,0 +1,15 @@ +contract C { + function f(int256 a, uint256 b) public returns (int256) { + return a << b; + } + + function g(int256 a, uint256 b) public returns (int256) { + return a >> b; + } +} + +// ==== +// compileViaYul: also +// ---- +// f(int256,uint256): 1, -1 -> 0 +// g(int256,uint256): 1, -1 -> 0 diff --git a/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol b/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol new file mode 100644 index 000000000000..73b49f3df354 --- /dev/null +++ b/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol @@ -0,0 +1,11 @@ +contract C { + function f(int256 a, int256 b) public returns (int256) { + return a >> b; + } + function g(int256 a, int256 b) public returns (int256) { + return a >> (256 - b); + } +} +// ---- +// TypeError: (89-95): Operator >> not compatible with types int256 and int256 +// TypeError: (179-193): Operator >> not compatible with types int256 and int256 From bd64e537cb1662f7946da7c6abeccd32bce2bed1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 May 2020 23:33:59 +0200 Subject: [PATCH 113/479] Fix implementation of leave. --- libyul/backends/wasm/BinaryTransform.cpp | 1 + libyul/backends/wasm/WasmCodeTransform.cpp | 11 +- libyul/backends/wasm/WasmCodeTransform.h | 1 + test/cmdlineTests/evm_to_wasm/output | 41 ++- test/cmdlineTests/evm_to_wasm_break/output | 340 ++++++++++-------- .../standard_eWasm_requested/output.json | 95 +++-- 6 files changed, 285 insertions(+), 204 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 43eced734ec2..f5dfd8410810 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -396,6 +396,7 @@ bytes BinaryTransform::operator()(BranchIf const& _branchIf) bytes BinaryTransform::operator()(Return const&) { + // Note that this does not work if the function returns a value. return toBytes(Opcode::Return); } diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 308171c44c45..f23f51eee92f 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -280,7 +280,8 @@ wasm::Expression WasmCodeTransform::operator()(Continue const&) wasm::Expression WasmCodeTransform::operator()(Leave const&) { - return wasm::Return{}; + yulAssert(!m_functionBodyLabel.empty(), ""); + return wasm::Branch{wasm::Label{m_functionBodyLabel}}; } wasm::Expression WasmCodeTransform::operator()(Block const& _block) @@ -330,10 +331,16 @@ wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefin fun.returns = !_fun.returnVariables.empty(); yulAssert(m_localVariables.empty(), ""); - fun.body = visit(_fun.body.statements); + yulAssert(m_functionBodyLabel.empty(), ""); + m_functionBodyLabel = newLabel(); + fun.body.emplace_back(wasm::Expression(wasm::Block{ + m_functionBodyLabel, + visit(_fun.body.statements) + })); fun.locals += m_localVariables; m_localVariables.clear(); + m_functionBodyLabel = {}; if (!_fun.returnVariables.empty()) { diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 2f3ba88c9117..26000e3852ab 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -95,6 +95,7 @@ class WasmCodeTransform std::vector m_localVariables; std::vector m_globalVariables; std::map m_functionsToImport; + std::string m_functionBodyLabel; std::stack> m_breakContinueLabelNames; }; diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output index 4e83eea9d162..31b982d0dba6 100644 --- a/test/cmdlineTests/evm_to_wasm/output +++ b/test/cmdlineTests/evm_to_wasm/output @@ -45,7 +45,7 @@ object "object" { Binary representation: -0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010abe01052801017e420021004200200020002000200010054220200020002000420110054200a74220a710000b1c01017e20004208864280fe0383200042088842ff018384210120010b1b01027e20001002421086210220022000421088100284210120010b1b01027e20001003422086210220022000422088100384210120010b3e01007e2000a7200110043703002000a74208a76aada7200210043703002000a74210a76aada7200310043703002000a74218a76aada7200410043703000b +0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acd01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b4101007e02402000a7200110043703002000a74208a76aada7200210043703002000a74210a76aada7200310043703002000a74218a76aada7200410043703000b0b Text representation: (module @@ -55,17 +55,22 @@ Text representation: (func $main (local $_1 i64) - (local.set $_1 (i64.const 0)) - (call $mstore_internal (i64.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) - (call $mstore_internal (i64.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1)) - (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + (block $label_ + (local.set $_1 (i64.const 0)) + (call $mstore_internal (i64.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) + (call $mstore_internal (i64.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1)) + (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + ) ) (func $endian_swap_16 (param $x i64) (result i64) (local $y i64) - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (block $label__1 + (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + + ) (local.get $y) ) @@ -74,8 +79,11 @@ Text representation: (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + (block $label__2 + (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + + ) (local.get $y) ) @@ -84,8 +92,11 @@ Text representation: (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + (block $label__3 + (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + + ) (local.get $y) ) @@ -95,10 +106,12 @@ Text representation: (param $y2 i64) (param $y3 i64) (param $y4 i64) - (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + (block $label__4 + (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + ) ) ) diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index fc033a9d93e0..2325fa737083 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -154,7 +154,7 @@ object "object" { Binary representation: -0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020a82090df002011f7e4200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b2c01037e200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21042004240020030b6f010b7e200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b2011210820092400200a2401200b240220080b2301047e200020018420022003848450ada7ad210720052400200624012007240220040b4601047e2000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b20092400200a2401200b240220080b2a01027e02402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b20020b930101087e4200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b20092400200a2401200b240220080b8c0101087e4200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b210720052400200624012007240220040b1c01017e20004208864280fe0383200042088842ff018384210120010b1b01027e2000100a421086210220022000421088100a84210120010b1b01027e2000100b422086210220022000422088100b84210120010b3e01007e2000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b2401007e42002000200120022003100d42202004200520062007100d4200a74220a710000b +0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa9090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b4101007e02402000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b0b2701007e024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b Text representation: (module @@ -198,79 +198,81 @@ Text representation: (local $x_9 i64) (local $x_10 i64) (local $x_11 i64) - (local.set $_1 (i64.const 0)) - (block - (local.set $x (call $calldataload (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) - (local.set $x_1 (global.get $global_)) - (local.set $x_2 (global.get $global__1)) - (local.set $x_3 (global.get $global__2)) - - ) - (local.set $x_4 (local.get $x)) - (local.set $x_5 (local.get $x_1)) - (local.set $x_6 (local.get $x_2)) - (local.set $x_7 (local.get $x_3)) - (local.set $_2 (i64.const 1)) - (local.set $_3 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))))))) (block $label_ - (loop $label__4 - (br_if $label_ (i64.eqz (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (local.get $_3)))))) - (block $label__3 - (block - (local.set $_4 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))) - (local.set $_5 (global.get $global_)) - (local.set $_6 (global.get $global__1)) - (local.set $_7 (global.get $global__2)) + (local.set $_1 (i64.const 0)) + (block + (local.set $x (call $calldataload (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) + (local.set $x_1 (global.get $global_)) + (local.set $x_2 (global.get $global__1)) + (local.set $x_3 (global.get $global__2)) - ) - (block - (local.set $_8 (call $iszero (local.get $_4) (local.get $_5) (local.get $_6) (local.get $_7))) - (local.set $_9 (global.get $global_)) - (local.set $_10 (global.get $global__1)) - (local.set $_11 (global.get $global__2)) + ) + (local.set $x_4 (local.get $x)) + (local.set $x_5 (local.get $x_1)) + (local.set $x_6 (local.get $x_2)) + (local.set $x_7 (local.get $x_3)) + (local.set $_2 (i64.const 1)) + (local.set $_3 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))))))) + (block $label__3 + (loop $label__5 + (br_if $label__3 (i64.eqz (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (local.get $_3)))))) + (block $label__4 + (block + (local.set $_4 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))) + (local.set $_5 (global.get $global_)) + (local.set $_6 (global.get $global__1)) + (local.set $_7 (global.get $global__2)) - ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11)))))))) (i64.const 0)) (then - (br $label_) - )) - (block - (local.set $_12 (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2))) - (local.set $_13 (global.get $global_)) - (local.set $_14 (global.get $global__1)) - (local.set $_15 (global.get $global__2)) + ) + (block + (local.set $_8 (call $iszero (local.get $_4) (local.get $_5) (local.get $_6) (local.get $_7))) + (local.set $_9 (global.get $global_)) + (local.set $_10 (global.get $global__1)) + (local.set $_11 (global.get $global__2)) + + ) + (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11)))))))) (i64.const 0)) (then + (br $label__3) + )) + (block + (local.set $_12 (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2))) + (local.set $_13 (global.get $global_)) + (local.set $_14 (global.get $global__1)) + (local.set $_15 (global.get $global__2)) + + ) + (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15)))))))) (i64.const 0)) (then + (br $label__3) + )) + (block + (local.set $_16 (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4))) + (local.set $_17 (global.get $global_)) + (local.set $_18 (global.get $global__1)) + (local.set $_19 (global.get $global__2)) + + ) + (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_16) (local.get $_17)) (i64.or (local.get $_18) (local.get $_19)))))))) (i64.const 0)) (then + (br $label__4) + )) ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15)))))))) (i64.const 0)) (then - (br $label_) - )) (block - (local.set $_16 (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4))) - (local.set $_17 (global.get $global_)) - (local.set $_18 (global.get $global__1)) - (local.set $_19 (global.get $global__2)) + (local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))) + (local.set $x_9 (global.get $global_)) + (local.set $x_10 (global.get $global__1)) + (local.set $x_11 (global.get $global__2)) ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_16) (local.get $_17)) (i64.or (local.get $_18) (local.get $_19)))))))) (i64.const 0)) (then - (br $label__3) - )) - + (local.set $x_4 (local.get $x_8)) + (local.set $x_5 (local.get $x_9)) + (local.set $x_6 (local.get $x_10)) + (local.set $x_7 (local.get $x_11)) + (br $label__5) ) - (block - (local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))) - (local.set $x_9 (global.get $global_)) - (local.set $x_10 (global.get $global__1)) - (local.set $x_11 (global.get $global__2)) - ) - (local.set $x_4 (local.get $x_8)) - (local.set $x_5 (local.get $x_9)) - (local.set $x_6 (local.get $x_10)) - (local.set $x_7 (local.get $x_11)) - (br $label__4) ) - + (call $sstore (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)) ) - (call $sstore (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)) ) (func $add_carry @@ -281,9 +283,12 @@ Text representation: (local $r i64) (local $r_c i64) (local $t i64) - (local.set $t (i64.add (local.get $x) (local.get $y))) - (local.set $r (i64.add (local.get $t) (local.get $c))) - (local.set $r_c (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r) (local.get $t))))))))) + (block $label__6 + (local.set $t (i64.add (local.get $x) (local.get $y))) + (local.set $r (i64.add (local.get $t) (local.get $c))) + (local.set $r_c (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r) (local.get $t))))))))) + + ) (global.set $global_ (local.get $r_c)) (local.get $r) ) @@ -309,26 +314,29 @@ Text representation: (local $carry_1 i64) (local $r1_1 i64) (local $carry_2 i64) - (local.set $t (i64.add (local.get $x4) (local.get $y4))) - (local.set $r4 (i64.add (local.get $t) (i64.const 0))) - (block - (local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x4)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r4) (local.get $t)))))))))) - (local.set $carry (global.get $global_)) + (block $label__7 + (local.set $t (i64.add (local.get $x4) (local.get $y4))) + (local.set $r4 (i64.add (local.get $t) (i64.const 0))) + (block + (local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x4)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r4) (local.get $t)))))))))) + (local.set $carry (global.get $global_)) - ) - (local.set $r3 (local.get $r3_1)) - (block - (local.set $r2_1 (call $add_carry (local.get $x2) (local.get $y2) (local.get $carry))) - (local.set $carry_1 (global.get $global_)) + ) + (local.set $r3 (local.get $r3_1)) + (block + (local.set $r2_1 (call $add_carry (local.get $x2) (local.get $y2) (local.get $carry))) + (local.set $carry_1 (global.get $global_)) - ) - (local.set $r2 (local.get $r2_1)) - (block - (local.set $r1_1 (call $add_carry (local.get $x1) (local.get $y1) (local.get $carry_1))) - (local.set $carry_2 (global.get $global_)) + ) + (local.set $r2 (local.get $r2_1)) + (block + (local.set $r1_1 (call $add_carry (local.get $x1) (local.get $y1) (local.get $carry_1))) + (local.set $carry_2 (global.get $global_)) + + ) + (local.set $r1 (local.get $r1_1)) ) - (local.set $r1 (local.get $r1_1)) (global.set $global_ (local.get $r2)) (global.set $global__1 (local.get $r3)) (global.set $global__2 (local.get $r4)) @@ -345,7 +353,10 @@ Text representation: (local $r2 i64) (local $r3 i64) (local $r4 i64) - (local.set $r4 (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4)))))))) + (block $label__8 + (local.set $r4 (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4)))))))) + + ) (global.set $global_ (local.get $r2)) (global.set $global__1 (local.get $r3)) (global.set $global__2 (local.get $r4)) @@ -366,15 +377,18 @@ Text representation: (local $r2 i64) (local $r3 i64) (local $r4 i64) - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x1) (local.get $y1))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x2) (local.get $y2))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x3) (local.get $y3))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x4) (local.get $y4))) (i64.const 0)) (then - (local.set $r4 (i64.const 1)) + (block $label__9 + (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x1) (local.get $y1))) (i64.const 0)) (then + (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x2) (local.get $y2))) (i64.const 0)) (then + (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x3) (local.get $y3))) (i64.const 0)) (then + (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x4) (local.get $y4))) (i64.const 0)) (then + (local.set $r4 (i64.const 1)) + )) )) )) )) - )) + + ) (global.set $global_ (local.get $r2)) (global.set $global__1 (local.get $r3)) (global.set $global__2 (local.get $r4)) @@ -387,13 +401,16 @@ Text representation: (result i64) (local $r i64) (local $condition i64) - (block - (local.set $condition (i64.extend_i32_u (i64.lt_u (local.get $a) (local.get $b)))) - (if (i64.eq (local.get $condition) (i64.const 1)) (then - (local.set $r (i64.const 4294967295)) - )(else - (local.set $r (i64.extend_i32_u (i64.ne (local.get $a) (local.get $b)))) - )) + (block $label__10 + (block + (local.set $condition (i64.extend_i32_u (i64.lt_u (local.get $a) (local.get $b)))) + (if (i64.eq (local.get $condition) (i64.const 1)) (then + (local.set $r (i64.const 4294967295)) + )(else + (local.set $r (i64.extend_i32_u (i64.ne (local.get $a) (local.get $b)))) + )) + + ) ) (local.get $r) @@ -414,48 +431,51 @@ Text representation: (local $z3 i64) (local $z4 i64) (local $z i64) - (local $condition_5 i64) - (local $condition_6 i64) - (local $condition_7 i64) - (local.set $z (i64.const 0)) - (block - (local.set $condition_5 (call $cmp (local.get $x1) (local.get $y1))) - (if (i64.eq (local.get $condition_5) (i64.const 0)) (then - (block - (local.set $condition_6 (call $cmp (local.get $x2) (local.get $y2))) - (if (i64.eq (local.get $condition_6) (i64.const 0)) (then - (block - (local.set $condition_7 (call $cmp (local.get $x3) (local.get $y3))) - (if (i64.eq (local.get $condition_7) (i64.const 0)) (then - (local.set $z (i64.extend_i32_u (i64.lt_u (local.get $x4) (local.get $y4)))) - )(else - (if (i64.eq (local.get $condition_7) (i64.const 1)) (then - (local.set $z (i64.const 0)) + (local $condition_12 i64) + (local $condition_13 i64) + (local $condition_14 i64) + (block $label__11 + (local.set $z (i64.const 0)) + (block + (local.set $condition_12 (call $cmp (local.get $x1) (local.get $y1))) + (if (i64.eq (local.get $condition_12) (i64.const 0)) (then + (block + (local.set $condition_13 (call $cmp (local.get $x2) (local.get $y2))) + (if (i64.eq (local.get $condition_13) (i64.const 0)) (then + (block + (local.set $condition_14 (call $cmp (local.get $x3) (local.get $y3))) + (if (i64.eq (local.get $condition_14) (i64.const 0)) (then + (local.set $z (i64.extend_i32_u (i64.lt_u (local.get $x4) (local.get $y4)))) )(else - (local.set $z (i64.const 1)) + (if (i64.eq (local.get $condition_14) (i64.const 1)) (then + (local.set $z (i64.const 0)) + )(else + (local.set $z (i64.const 1)) + )) )) - )) - ) - )(else - (if (i64.eq (local.get $condition_6) (i64.const 1)) (then - (local.set $z (i64.const 0)) + ) )(else - (local.set $z (i64.const 1)) + (if (i64.eq (local.get $condition_13) (i64.const 1)) (then + (local.set $z (i64.const 0)) + )(else + (local.set $z (i64.const 1)) + )) )) - )) - ) - )(else - (if (i64.eq (local.get $condition_5) (i64.const 1)) (then - (local.set $z (i64.const 0)) + ) )(else - (local.set $z (i64.const 1)) + (if (i64.eq (local.get $condition_12) (i64.const 1)) (then + (local.set $z (i64.const 0)) + )(else + (local.set $z (i64.const 1)) + )) )) - )) + + ) + (local.set $z4 (i64.extend_i32_u (i32.wrap_i64 (local.get $z)))) ) - (local.set $z4 (i64.extend_i32_u (i32.wrap_i64 (local.get $z)))) (global.set $global_ (local.get $z2)) (global.set $global__1 (local.get $z3)) (global.set $global__2 (local.get $z4)) @@ -476,19 +496,22 @@ Text representation: (local $z2_1 i64) (local $z3_1 i64) (local $z4_1 i64) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then - (unreachable))) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then - (unreachable))) - (call $eth.callDataCopy (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) (i32.wrap_i64 (i64.const 32))) - (local.set $z1_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) - (local.set $z2_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) - (local.set $z3_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) - (local.set $z4_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))) - (local.set $z1 (local.get $z1_1)) - (local.set $z2 (local.get $z2_1)) - (local.set $z3 (local.get $z3_1)) - (local.set $z4 (local.get $z4_1)) + (block $label__15 + (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then + (unreachable))) + (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then + (unreachable))) + (call $eth.callDataCopy (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) (i32.wrap_i64 (i64.const 32))) + (local.set $z1_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) + (local.set $z2_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) + (local.set $z3_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) + (local.set $z4_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))) + (local.set $z1 (local.get $z1_1)) + (local.set $z2 (local.get $z2_1)) + (local.set $z3 (local.get $z3_1)) + (local.set $z4 (local.get $z4_1)) + + ) (global.set $global_ (local.get $z2)) (global.set $global__1 (local.get $z3)) (global.set $global__2 (local.get $z4)) @@ -499,7 +522,10 @@ Text representation: (param $x i64) (result i64) (local $y i64) - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (block $label__16 + (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + + ) (local.get $y) ) @@ -508,8 +534,11 @@ Text representation: (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + (block $label__17 + (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + + ) (local.get $y) ) @@ -518,8 +547,11 @@ Text representation: (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + (block $label__18 + (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + + ) (local.get $y) ) @@ -529,10 +561,12 @@ Text representation: (param $y2 i64) (param $y3 i64) (param $y4 i64) - (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + (block $label__19 + (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + ) ) (func $sstore @@ -544,9 +578,11 @@ Text representation: (param $y2 i64) (param $y3 i64) (param $y4 i64) - (call $mstore_internal (i64.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) - (call $mstore_internal (i64.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) - (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + (block $label__20 + (call $mstore_internal (i64.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) + (call $mstore_internal (i64.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) + (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + ) ) ) diff --git a/test/cmdlineTests/standard_eWasm_requested/output.json b/test/cmdlineTests/standard_eWasm_requested/output.json index a67539f62f49..b604b384d4ed 100644 --- a/test/cmdlineTests/standard_eWasm_requested/output.json +++ b/test/cmdlineTests/standard_eWasm_requested/output.json @@ -16,25 +16,27 @@ (local $z2 i64) (local $z3 i64) (local $_3 i64) - (local.set $_1 (i64.const 0)) - (local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64))) - (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) - (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then - (unreachable))) - (local.set $_2 (call $endian_swap (local.get $_1))) - (i64.store (i32.wrap_i64 (local.get $r)) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 8))))) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 16))))) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (i64.const 128))) - (call $eth.getCallValue (i32.wrap_i64 (i64.const 0))) - (local.set $z1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) - (local.set $z2 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) - (local.set $z3 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))))))))) (i64.const 0)) (then - (call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))) - (local.set $_3 (datasize \"C_2_deployed\")) - (call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) - (call $return (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) + (block $label_ + (local.set $_1 (i64.const 0)) + (local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64))) + (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) + (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then + (unreachable))) + (local.set $_2 (call $endian_swap (local.get $_1))) + (i64.store (i32.wrap_i64 (local.get $r)) (local.get $_2)) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 8))))) (local.get $_2)) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 16))))) (local.get $_2)) + (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (i64.const 128))) + (call $eth.getCallValue (i32.wrap_i64 (i64.const 0))) + (local.set $z1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) + (local.set $z2 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) + (local.set $z3 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) + (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))))))))) (i64.const 0)) (then + (call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))) + (local.set $_3 (datasize \"C_2_deployed\")) + (call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) + (call $return (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) + ) ) (func $u256_to_i32 @@ -44,11 +46,14 @@ (param $x4 i64) (result i64) (local $v i64) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then - (unreachable))) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then - (unreachable))) - (local.set $v (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) + (block $label__1 + (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then + (unreachable))) + (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then + (unreachable))) + (local.set $v (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) + + ) (local.get $v) ) @@ -60,10 +65,13 @@ (result i64) (local $r i64) (local $p i64) - (local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) - (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) - (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then - (unreachable))) + (block $label__2 + (local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) + (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) + (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then + (unreachable))) + + ) (local.get $r) ) @@ -80,14 +88,19 @@ (param $z2 i64) (param $z3 i64) (param $z4 i64) - (call $eth.codeCopy (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4)))) + (block $label__3 + (call $eth.codeCopy (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4)))) + ) ) (func $endian_swap_16 (param $x i64) (result i64) (local $y i64) - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (block $label__4 + (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + + ) (local.get $y) ) @@ -96,8 +109,11 @@ (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + (block $label__5 + (local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16))))) + + ) (local.get $y) ) @@ -106,8 +122,11 @@ (result i64) (local $y i64) (local $hi i64) - (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + (block $label__6 + (local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32))))) + + ) (local.get $y) ) @@ -120,7 +139,9 @@ (param $y2 i64) (param $y3 i64) (param $y4 i64) - (call $eth.finish (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + (block $label__7 + (call $eth.finish (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + ) ) (func $revert @@ -132,7 +153,9 @@ (param $y2 i64) (param $y3 i64) (param $y4 i64) - (call $eth.revert (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + (block $label__8 + (call $eth.revert (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + ) ) ) From 76d27bcfaa3588d3a33beb63dbfaa0522b82f04d Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 10:35:04 +0200 Subject: [PATCH 114/479] Fix assumption for member not in memory. --- libsolidity/codegen/YulUtilFunctions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 64639efb1ece..cdd773ae7f0c 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1667,8 +1667,10 @@ string YulUtilFunctions::allocateAndInitializeMemoryStructFunction(StructType co for (size_t i = 0; i < members.size(); ++i) { solAssert(members[i]->memoryHeadSize() == 32, ""); - solAssert(members[i]->dataStoredIn(DataLocation::Memory), ""); - memberParams[i]["zeroValue"] = zeroValueFunction(*members[i], false); + memberParams[i]["zeroValue"] = zeroValueFunction( + *TypeProvider::withLocationIfReference(DataLocation::Memory, members[i]), + false + ); } templ("member", memberParams); return templ.render(); From 499cb0526f37a3939de76dc1e62a12a2419b19f0 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 May 2020 19:30:17 +0200 Subject: [PATCH 115/479] Calldata variables. --- libsolidity/ast/AST.cpp | 23 ++++++++++++----------- libsolidity/codegen/CompilerUtils.cpp | 9 +++++++++ libsolidity/codegen/YulUtilFunctions.cpp | 22 +++++++++++++++++++++- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index e553e45bd9e6..3d98ff169857 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -338,8 +338,14 @@ TypePointer FunctionDefinition::type() const TypePointer FunctionDefinition::typeViaContractName() const { if (annotation().contract->isLibrary()) - return FunctionType(*this).asCallableFunction(true); - return TypeProvider::function(*this, FunctionType::Kind::Declaration); + { + if (isPublic()) + return FunctionType(*this).asCallableFunction(true); + else + return TypeProvider::function(*this, FunctionType::Kind::Internal); + } + else + return TypeProvider::function(*this, FunctionType::Kind::Declaration); } string FunctionDefinition::externalSignature() const @@ -616,18 +622,14 @@ set VariableDeclaration::allowedDataLocations() c if (!hasReferenceOrMappingType() || isStateVariable() || isEventParameter()) return set{ Location::Unspecified }; - else if (isExternalCallableParameter()) - { - set locations{ Location::CallData }; - if (isLibraryFunctionParameter()) - locations.insert(Location::Storage); - return locations; - } else if (isCallableOrCatchParameter()) { set locations{ Location::Memory }; if (isInternalCallableParameter() || isLibraryFunctionParameter() || isTryCatchParameter()) locations.insert(Location::Storage); + if (!isTryCatchParameter()) + locations.insert(Location::CallData); + return locations; } else if (isLocalVariable()) @@ -642,8 +644,7 @@ set VariableDeclaration::allowedDataLocations() c case Type::Category::Mapping: return set{ Location::Storage }; default: - // TODO: add Location::Calldata once implemented for local variables. - return set{ Location::Memory, Location::Storage }; + return set{ Location::Memory, Location::Storage, Location::CallData }; } }; return dataLocations(typeName()->annotation().type, dataLocations); diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 25c91f0a32f6..225a9fe8e360 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1218,6 +1218,15 @@ void CompilerUtils::pushZeroValue(Type const& _type) m_context << u256(0); return; } + if (referenceType->location() == DataLocation::CallData) + { + solAssert(referenceType->sizeOnStack() == 1 || referenceType->sizeOnStack() == 2, ""); + m_context << Instruction::CALLDATASIZE; + if (referenceType->sizeOnStack() == 2) + m_context << 0; + return; + } + solAssert(referenceType->location() == DataLocation::Memory, ""); if (auto arrayType = dynamic_cast(&_type)) if (arrayType->isDynamicallySized()) diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 64639efb1ece..05912962ab31 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -2238,6 +2238,27 @@ string YulUtilFunctions::zeroValueFunction(Type const& _type, bool _splitFunctio ("functionName", functionName) .render(); + if (_type.dataStoredIn(DataLocation::CallData)) + { + solAssert( + _type.category() == Type::Category::Struct || + _type.category() == Type::Category::Array, + ""); + Whiskers templ(R"( + function () -> offset, length { + offset := calldatasize() + length := 0 + } + )"); + templ("functionName", functionName); + templ("hasLength", + _type.category() == Type::Category::Array && + dynamic_cast(_type).isDynamicallySized() + ); + + return templ.render(); + } + Whiskers templ(R"( function () -> ret { ret := @@ -2622,4 +2643,3 @@ string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction( .render(); }); } - From 99194b1450861add0051a9ae64dbb5e559ba0503 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 May 2020 19:30:42 +0200 Subject: [PATCH 116/479] New tests. --- .../calldata/calldata_bytes_internal.sol | 12 ++++++++++ .../calldata_internal_function_pointer.sol | 17 ++++++++++++++ .../calldata/calldata_internal_library.sol | 22 ++++++++++++++++++ .../calldata_internal_multi_array.sol | 23 +++++++++++++++++++ .../calldata_internal_multi_fixed_array.sol | 19 +++++++++++++++ .../calldata/calldata_memory_mixed.sol | 21 +++++++++++++++++ .../calldata/calldata_struct_internal.sol | 17 ++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_internal_library.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_internal_multi_array.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_internal_multi_fixed_array.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol new file mode 100644 index 000000000000..3b39a51a42af --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_internal.sol @@ -0,0 +1,12 @@ +contract C { + function f(bytes calldata b, uint i) internal pure returns (byte) { + return b[i]; + } + function f(uint, bytes calldata b, uint) external pure returns (byte) { + return f(b, 2); + } +} +// ==== +// compileViaYul: also +// ---- +// f(uint256,bytes,uint256): 7, 0x60, 7, 4, "abcd" -> "c" diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol new file mode 100644 index 000000000000..539653219837 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol @@ -0,0 +1,17 @@ +contract C { + function(bytes calldata) returns (byte) x; + constructor() public { x = f; } + function f(bytes calldata b) internal pure returns (byte) { + return b[2]; + } + function h(bytes calldata b) external returns (byte) { + return x(b); + } + function g() external returns (byte) { + bytes memory a = new bytes(34); + a[2] = byte(uint8(7)); + return this.h(a); + } +} +// ---- +// g() -> 0x0700000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol new file mode 100644 index 000000000000..90528fc70272 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_library.sol @@ -0,0 +1,22 @@ +library L { + function f(uint, bytes calldata _x, uint) internal returns (byte) { + return _x[2]; + } +} +contract C { + function f(bytes calldata a) + external + returns (byte) + { + return L.f(3, a, 9); + } + function g() public returns (byte) { + bytes memory x = new bytes(4); + x[2] = 0x08; + return this.f(x); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 0x0800000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_multi_array.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_multi_array.sol new file mode 100644 index 000000000000..6dea02b29325 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_multi_array.sol @@ -0,0 +1,23 @@ +pragma experimental ABIEncoderV2; + +contract C { + function g(uint[][2] calldata s) internal pure returns (uint, uint[] calldata) { + return (s[0][1], s[1]); + } + function f(uint, uint[][2] calldata s, uint) external pure returns (uint, uint) { + (uint x, uint[] calldata y) = g(s); + return (x, y[0]); + } + function g() public returns (uint, uint) { + uint[][2] memory x; + x[0] = new uint[](2); + x[1] = new uint[](2); + x[0][1] = 7; + x[1][0] = 8; + return this.f(4, x, 5); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 7, 8 diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_multi_fixed_array.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_multi_fixed_array.sol new file mode 100644 index 000000000000..6fb892dde519 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_multi_fixed_array.sol @@ -0,0 +1,19 @@ +contract C { + function g(uint[3][2] calldata s) internal pure returns (uint, uint[3] calldata) { + return (s[0][1], s[1]); + } + function f(uint, uint[3][2] calldata s, uint) external pure returns (uint, uint) { + (uint x, uint[3] calldata y) = g(s); + return (x, y[0]); + } + function g() public returns (uint, uint) { + uint[3][2] memory x; + x[0][1] = 7; + x[1][0] = 8; + return this.f(4, x, 5); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 7, 8 diff --git a/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol b/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol new file mode 100644 index 000000000000..a87afac117b0 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_memory_mixed.sol @@ -0,0 +1,21 @@ +contract C { + function f(bytes memory _a, bytes calldata _b, bytes memory _c) + public + returns (uint, byte, byte, byte) + { + return (_a.length + _b.length + _c.length, _a[1], _b[1], _c[1]); + } + function g() public returns (uint, byte, byte, byte) { + bytes memory x = new bytes(3); + bytes memory y = new bytes(4); + bytes memory z = new bytes(7); + x[1] = 0x08; + y[1] = 0x09; + z[1] = 0x0a; + return this.f(x, y, z); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 0x0e, 0x0800000000000000000000000000000000000000000000000000000000000000, 0x0900000000000000000000000000000000000000000000000000000000000000, 0x0a00000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol b/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol new file mode 100644 index 000000000000..a463b5d33960 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol @@ -0,0 +1,17 @@ +pragma experimental ABIEncoderV2; + +struct S { + uint x; + uint y; +} + +contract C { + function f(S calldata s) internal pure returns (uint, uint) { + return (s.x, s.y); + } + function f(uint, S calldata s, uint) external pure returns (uint, uint) { + return f(s); + } +} +// ---- +// f(uint256,(uint256,uint256),uint256): 7, 1, 2, 4 -> 1, 2 From fb40a8abb8090c1be040bb4b74a3d340f18bcc44 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 14 May 2020 19:02:45 +0200 Subject: [PATCH 117/479] Test updates. --- ...gth_cannot_be_constant_function_parameter.sol | 2 +- .../data_location_in_function_type_fail.sol | 3 +-- ...nction_return_parameters_no_data_location.sol | 2 +- ...t_location_specifier_test_external_memory.sol | 3 ++- ..._location_specifier_test_external_storage.sol | 2 +- ...location_specifier_test_internal_calldata.sol | 3 ++- ...rnal_function_parameters_no_data_location.sol | 2 +- ...nction_return_parameters_no_data_location.sol | 2 +- ...external_function_params_no_data_location.sol | 8 ++++---- ...external_function_return_no_data_location.sol | 8 ++++---- ...ibrary_internal_function_no_data_location.sol | 16 ++++++++-------- ...library_private_function_no_data_location.sol | 16 ++++++++-------- .../library_public_function_no_data_location.sol | 16 ++++++++-------- ...t_location_specifier_test_external_memory.sol | 1 - ...location_specifier_test_internal_calldata.sol | 1 - ...vate_function_parameters_no_data_location.sol | 2 +- ...nction_return_parameters_no_data_location.sol | 2 +- ...t_location_specifier_test_public_calldata.sol | 3 ++- ...nt_location_specifier_test_public_storage.sol | 2 +- ...blic_function_parameters_no_data_location.sol | 2 +- ...nction_return_parameters_no_data_location.sol | 2 +- .../150_array_with_nonconstant_length.sol | 2 +- .../151_array_with_negative_length.sol | 2 +- .../204_overwrite_memory_location_external.sol | 1 - .../205_overwrite_storage_location_external.sol | 2 +- ...8_invalid_array_declaration_with_rational.sol | 2 +- ..._array_declaration_with_signed_fixed_type.sol | 2 +- ...rray_declaration_with_unsigned_fixed_type.sol | 2 +- .../471_unspecified_storage_fail.sol | 4 ++-- .../types/mapping/argument_external.sol | 2 +- .../types/mapping/argument_public.sol | 2 +- .../types/mapping/array_argument_external.sol | 2 +- .../types/mapping/array_argument_public.sol | 2 +- .../mapping/function_type_argument_external.sol | 2 +- .../mapping/function_type_return_external.sol | 2 +- .../mapping/mapping_array_return_external.sol | 2 +- .../mapping/mapping_array_return_public.sol | 2 +- .../types/mapping/mapping_return_external.sol | 2 +- .../types/mapping/mapping_return_public.sol | 2 +- 39 files changed, 67 insertions(+), 68 deletions(-) diff --git a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol index 270f1908f8f4..0d332bf1a3cd 100644 --- a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol +++ b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol @@ -6,4 +6,4 @@ contract C { // ---- // DeclarationError: (28-45): The "constant" keyword can only be used for state variables. // TypeError: (69-72): Invalid array length, expected integer literal or constant expression. -// TypeError: (64-75): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (64-75): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol index b80849cebc21..0ed969464138 100644 --- a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol +++ b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol @@ -5,5 +5,4 @@ library L { } // ---- -// TypeError: (66-81): Data location must be "memory" for parameter in function, but "calldata" was given. -// TypeError: (159-173): Data location must be "memory" for parameter in function, but "storage" was given. +// TypeError: (159-173): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol index cbcf2a6e2052..5d956b2f586e 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function i() external pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Data location must be "memory" for return parameter in function, but none was given. +// TypeError: (52-58): Data location must be "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol index d30bde3f29fc..c831f96a2af4 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol @@ -2,4 +2,5 @@ contract test { function f(bytes memory) external; } // ---- -// TypeError: (31-43): Data location must be "calldata" for parameter in external function, but "memory" was given. +// TypeError: (0-56): Contract "test" should be marked as abstract. +// TypeError: (20-54): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol index 7dc5ba6d5e62..9c4df92d82e7 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) external; } // ---- -// TypeError: (31-44): Data location must be "calldata" for parameter in external function, but "storage" was given. +// TypeError: (31-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol index da3abff4e6fe..edf6d04c5bcb 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -2,4 +2,5 @@ contract test { function f(bytes calldata) internal; } // ---- -// TypeError: (31-45): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. +// TypeError: (0-58): Contract "test" should be marked as abstract. +// TypeError: (20-56): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol index f1c4a5504f74..7ea8f2a57406 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g(uint[]) internal pure {} } // ---- -// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol index a32995e7572f..847b595feaa8 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g() internal pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (52-58): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol index c20088b7fe05..36619c5a3866 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol @@ -6,7 +6,7 @@ library L { function j(mapping(uint => uint)) external pure {} } // ---- -// TypeError: (52-59): Data location must be "storage" or "calldata" for parameter in external function, but none was given. -// TypeError: (93-99): Data location must be "storage" or "calldata" for parameter in external function, but none was given. -// TypeError: (133-134): Data location must be "storage" or "calldata" for parameter in external function, but none was given. -// TypeError: (168-189): Data location must be "storage" or "calldata" for parameter in external function, but none was given. +// TypeError: (52-59): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError: (93-99): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError: (133-134): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError: (168-189): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol index fa3a78213f6d..4bbd34704ef3 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol @@ -6,7 +6,7 @@ library L { function j() external pure returns (mapping(uint => uint)) {} } // ---- -// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol index 68c177a8b527..670201444998 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol @@ -10,11 +10,11 @@ library L { function jp(mapping(uint => uint)) internal pure {} } // ---- -// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (268-275): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (310-316): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (351-352): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (387-408): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (268-275): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (310-316): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (351-352): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (387-408): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol index 35256eae161e..d56607497426 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol @@ -10,11 +10,11 @@ library L { function jp(mapping(uint => uint)) private pure {} } // ---- -// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol index f8f8dcb26074..3910c79ed02f 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol @@ -9,11 +9,11 @@ library L { function ip(S) private pure {} function jp(mapping(uint => uint)) private pure {}} // ---- -// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given. -// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given. -// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol index 8dd89845279c..2a374eb77755 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol @@ -2,4 +2,3 @@ library test { function f(bytes memory) external {} } // ---- -// TypeError: (30-42): Data location must be "storage" or "calldata" for parameter in external function, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol index c4b81f98be53..b9291a52de6d 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -2,4 +2,3 @@ library test { function f(bytes calldata) internal pure {} } // ---- -// TypeError: (30-44): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol index fdd5cbaf6584..1a58b6020a3e 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f(uint[]) private pure {} } // ---- -// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol index 65ec1bcef16a..cf38ba424dd0 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f() private pure returns(uint[]) {} } // ---- -// TypeError: (51-57): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (51-57): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol index 3aba870f9fa7..c1904542e854 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol @@ -2,4 +2,5 @@ contract test { function f(bytes calldata) public; } // ---- -// TypeError: (31-45): Data location must be "memory" for parameter in function, but "calldata" was given. +// TypeError: (0-56): Contract "test" should be marked as abstract. +// TypeError: (20-54): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol index 1c033a6939e0..4a73c2a76cdd 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) public; } // ---- -// TypeError: (31-44): Data location must be "memory" for parameter in function, but "storage" was given. +// TypeError: (31-44): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol index f76bd63136e0..31a7318935db 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h(uint[]) public pure {} } // ---- -// TypeError: (28-34): Data location must be "memory" for parameter in function, but none was given. +// TypeError: (28-34): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol index 6b087c3465c1..e1b86b092685 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h() public pure returns(uint[]) {} } // ---- -// TypeError: (50-56): Data location must be "memory" for return parameter in function, but none was given. +// TypeError: (50-56): Data location must be "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol index 678e7e42b4ca..2d653805ba1b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol @@ -3,4 +3,4 @@ contract c { } // ---- // TypeError: (51-52): Invalid array length, expected integer literal or constant expression. -// TypeError: (45-55): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (45-55): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol index ab736e7daed4..3d21f42a7b74 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol @@ -3,4 +3,4 @@ contract c { } // ---- // TypeError: (51-53): Array with negative length specified. -// TypeError: (45-56): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (45-56): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol index 22d515eae9de..af9b8ba686d5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol @@ -2,4 +2,3 @@ contract C { function f(uint[] memory a) external {} } // ---- -// TypeError: (28-43): Data location must be "calldata" for parameter in external function, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol index 3825809ccd9e..c56a57c496e9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol @@ -2,4 +2,4 @@ contract C { function f(uint[] storage a) external {} } // ---- -// TypeError: (28-44): Data location must be "calldata" for parameter in external function, but "storage" was given. +// TypeError: (28-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol index 7e18c5fe7cd9..5b131e0f6f94 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol @@ -5,4 +5,4 @@ contract test { } // ---- // TypeError: (55-58): Array with fractional length specified. -// TypeError: (50-61): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (50-61): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol index 8aef0ac23796..b11db892d94e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol @@ -5,4 +5,4 @@ contract test { } // ---- // TypeError: (55-65): Invalid array length, expected integer literal or constant expression. -// TypeError: (50-68): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (50-68): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol index dfd145f8e272..a3b8ad1f6aa5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol @@ -5,4 +5,4 @@ contract test { } // ---- // TypeError: (55-66): Invalid array length, expected integer literal or constant expression. -// TypeError: (50-69): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (50-69): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol index de42ebd7cf0d..6a77c3785540 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (104-107): Data location must be "storage" or "memory" for variable, but none was given. -// TypeError: (123-131): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (104-107): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError: (123-131): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol index 2b5e6b054d0b..515b43741305 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-57): Data location must be "calldata" for parameter in external function, but "storage" was given. +// TypeError: (28-57): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol index 32f11fe9167d..bdd3ee602454 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-57): Data location must be "memory" for parameter in function, but "storage" was given. +// TypeError: (28-57): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol index 0863653cc3a8..993938a81419 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-59): Data location must be "calldata" for parameter in external function, but "storage" was given. +// TypeError: (28-59): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol index 99c83d8ac288..1ddf12e901d4 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-59): Data location must be "memory" for parameter in function, but "storage" was given. +// TypeError: (28-59): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol index 8638baf85080..529c63bcf64c 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (37-64): Data location must be "memory" for parameter in function, but "storage" was given. +// TypeError: (37-64): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol index b9bd5bc3f6a2..c18aff714c38 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (57-84): Data location must be "memory" for return parameter in function, but "storage" was given. +// TypeError: (57-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol index fe021bd0632f..2f7d7e2ed36b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (53-84): Data location must be "memory" for return parameter in function, but "storage" was given. +// TypeError: (53-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol index 1eb9d03b11b1..d48c8b2a8aef 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-82): Data location must be "memory" for return parameter in function, but "storage" was given. +// TypeError: (51-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol index 17e646cebacf..243bbf72f16e 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (53-82): Data location must be "memory" for return parameter in function, but "storage" was given. +// TypeError: (53-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol index cf5ec4ff9a33..e488a34e13b1 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-80): Data location must be "memory" for return parameter in function, but "storage" was given. +// TypeError: (51-80): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. From 33450619b14f1bdd3330572616805c6dc05afbe9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 May 2020 19:58:50 +0200 Subject: [PATCH 118/479] Checks for uninitialized access to calldata variables. --- libsolidity/analysis/ControlFlowAnalyzer.cpp | 10 ++++++++-- .../if_declaration_err.sol | 10 ++++++++++ .../if_declaration_fine.sol | 11 +++++++++++ .../localCalldataVariables/smoke_declaration.sol | 16 ++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol create mode 100644 test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_fine.sol create mode 100644 test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/smoke_declaration.sol diff --git a/libsolidity/analysis/ControlFlowAnalyzer.cpp b/libsolidity/analysis/ControlFlowAnalyzer.cpp index 84979082fc2b..4937ee1d4269 100644 --- a/libsolidity/analysis/ControlFlowAnalyzer.cpp +++ b/libsolidity/analysis/ControlFlowAnalyzer.cpp @@ -94,7 +94,10 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod case VariableOccurrence::Kind::Return: if (unassignedVariables.count(&variableOccurrence.declaration())) { - if (variableOccurrence.declaration().type()->dataStoredIn(DataLocation::Storage)) + if ( + variableOccurrence.declaration().type()->dataStoredIn(DataLocation::Storage) || + variableOccurrence.declaration().type()->dataStoredIn(DataLocation::CallData) + ) // Merely store the unassigned access. We do not generate an error right away, since this // path might still always revert. It is only an error if this is propagated to the exit // node of the function (i.e. there is a path with an uninitialized access). @@ -135,13 +138,16 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod if (variableOccurrence->occurrence()) ssl.append("The variable was declared here.", variableOccurrence->declaration().location()); + bool isStorage = variableOccurrence->declaration().type()->dataStoredIn(DataLocation::Storage); m_errorReporter.typeError( 3464_error, variableOccurrence->occurrence() ? *variableOccurrence->occurrence() : variableOccurrence->declaration().location(), ssl, - string("This variable is of storage pointer type and can be ") + + "This variable is of " + + string(isStorage ? "storage" : "calldata") + + " pointer type and can be " + (variableOccurrence->kind() == VariableOccurrence::Kind::Return ? "returned" : "accessed") + " without prior assignment, which would lead to undefined behaviour." ); diff --git a/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol new file mode 100644 index 000000000000..63b434090bbe --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol @@ -0,0 +1,10 @@ +contract C { + function f(uint[] calldata _c) public pure { + uint[] calldata c; + if (_c[2] > 10) + c = _c; + c[2]; + } +} +// ---- +// TypeError: (141-142): This variable is of calldata pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_fine.sol new file mode 100644 index 000000000000..8bd0aeac2698 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_fine.sol @@ -0,0 +1,11 @@ +contract C { + function f(uint[] calldata _c) public pure { + uint[] calldata c; + if (_c[2] > 10) + c = _c; + else + c = _c; + c[2]; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/smoke_declaration.sol b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/smoke_declaration.sol new file mode 100644 index 000000000000..ae43f6f73afc --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/smoke_declaration.sol @@ -0,0 +1,16 @@ +contract C { + function g() internal pure returns (bytes calldata) { + return msg.data; + } + function h(uint[] calldata _c) internal pure { + uint[] calldata c; + c = _c; + c[2]; + } + function i(uint[] calldata _c) internal pure { + uint[] calldata c; + (c) = _c; + c[2]; + } +} +// ---- From add55fd793a3aead9f3d38cf6ebaaf13142b5332 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 May 2020 23:42:15 +0200 Subject: [PATCH 119/479] Documentation. --- Changelog.md | 1 + docs/types/reference-types.rst | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 518c789635f9..cbfa2ad20371 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ ### 0.6.9 (unreleased) Language Features: + * Permit calldata location for all variables. Compiler Features: diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 2db37495931e..6283eaa0e46d 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -13,8 +13,7 @@ arrays and mappings. If you use a reference type, you always have to explicitly provide the data area where the type is stored: ``memory`` (whose lifetime is limited to an external function call), ``storage`` (the location where the state variables are stored, where the lifetime is limited to the lifetime of a contract) -or ``calldata`` (special data location that contains the function arguments, -only available for external function call parameters). +or ``calldata`` (special data location that contains the function arguments). An assignment or type conversion that changes the data location will always incur an automatic copy operation, while assignments inside the same data location only copy in some cases for storage types. @@ -26,9 +25,9 @@ Data location Every reference type has an additional annotation, the "data location", about where it is stored. There are three data locations: -``memory``, ``storage`` and ``calldata``. Calldata is only valid for parameters of external contract -functions and is required for this type of parameter. Calldata is a non-modifiable, +``memory``, ``storage`` and ``calldata``. Calldata is a non-modifiable, non-persistent area where function arguments are stored, and behaves mostly like memory. +It is required for parameters of external functions but can also be used for other variables. .. note:: @@ -36,6 +35,12 @@ non-persistent area where function arguments are stored, and behaves mostly like depending on the kind of variable, function type, etc., but all complex types must now give an explicit data location. +.. note:: + If you can, try to use ``calldata`` as data location because it will avoid copies and + also makes sure that the data cannot be modified. Arrays and structs with ``calldata`` + data location can also be returned from functions, but it is not possible to + allocate such types. + .. _data-location-assignment: Data location and assignment behaviour From 96041741517bf3faa963b5bc7e2012052c319db1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 10:48:17 +0200 Subject: [PATCH 120/479] Rename asCallableFunction. --- libsolidity/analysis/ContractLevelChecker.cpp | 8 ++++---- libsolidity/analysis/OverrideChecker.cpp | 4 ++-- libsolidity/ast/AST.cpp | 6 +++--- libsolidity/ast/Types.cpp | 6 +++--- libsolidity/ast/Types.h | 4 ++-- libsolidity/formal/SMTEncoder.cpp | 4 ++-- tools/solidityUpgrade/Upgrade060.cpp | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index cb8694537338..c0fdd9e3082d 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -41,8 +41,8 @@ bool hasEqualNameAndParameters(T const& _a, B const& _b) { return _a.name() == _b.name() && - FunctionType(_a).asCallableFunction(false)->hasEqualParameterTypes( - *FunctionType(_b).asCallableFunction(false) + FunctionType(_a).asExternallyCallableFunction(false)->hasEqualParameterTypes( + *FunctionType(_b).asExternallyCallableFunction(false) ); } @@ -345,7 +345,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c // under non error circumstances this should be true if (functionType->interfaceFunctionType()) externalDeclarations[functionType->externalSignature()].emplace_back( - f, functionType->asCallableFunction(false) + f, functionType->asExternallyCallableFunction(false) ); } for (VariableDeclaration const* v: contract->stateVariables()) @@ -355,7 +355,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c // under non error circumstances this should be true if (functionType->interfaceFunctionType()) externalDeclarations[functionType->externalSignature()].emplace_back( - v, functionType->asCallableFunction(false) + v, functionType->asExternallyCallableFunction(false) ); } } diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 4cf2ff8f41b0..06b98113907e 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -311,8 +311,8 @@ Token OverrideProxy::functionKind() const FunctionType const* OverrideProxy::functionType() const { return std::visit(GenericVisitor{ - [&](FunctionDefinition const* _item) { return FunctionType(*_item).asCallableFunction(false); }, - [&](VariableDeclaration const* _item) { return FunctionType(*_item).asCallableFunction(false); }, + [&](FunctionDefinition const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); }, + [&](VariableDeclaration const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); }, [&](ModifierDefinition const*) -> FunctionType const* { solAssert(false, "Requested function type of modifier."); return nullptr; } }, m_item); } diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3d98ff169857..3edb08476e4a 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -340,7 +340,7 @@ TypePointer FunctionDefinition::typeViaContractName() const if (annotation().contract->isLibrary()) { if (isPublic()) - return FunctionType(*this).asCallableFunction(true); + return FunctionType(*this).asExternallyCallableFunction(true); else return TypeProvider::function(*this, FunctionType::Kind::Internal); } @@ -375,7 +375,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual( solAssert(!dynamic_cast(*scope()).isLibrary(), ""); - FunctionType const* functionType = TypeProvider::function(*this)->asCallableFunction(false); + FunctionType const* functionType = TypeProvider::function(*this)->asExternallyCallableFunction(false); for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts) { @@ -386,7 +386,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual( if ( function->name() == name() && !function->isConstructor() && - FunctionType(*function).asCallableFunction(false)->hasEqualParameterTypes(*functionType) + FunctionType(*function).asExternallyCallableFunction(false)->hasEqualParameterTypes(*functionType) ) return *function; } diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index c2522637902d..de7b03153517 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -370,7 +370,7 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition seenFunctions.insert(function); if (function->parameters().empty()) continue; - FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asCallableFunction(true, true); + FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asExternallyCallableFunction(true, true); if (_type.isImplicitlyConvertibleTo(*fun->selfType())) members.emplace_back(function->name(), fun, function); } @@ -2058,7 +2058,7 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con for (auto const& it: m_contract.interfaceFunctions()) members.emplace_back( it.second->declaration().name(), - it.second->asCallableFunction(m_contract.isLibrary()), + it.second->asExternallyCallableFunction(m_contract.isLibrary()), &it.second->declaration() ); } @@ -3427,7 +3427,7 @@ TypePointer FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bo ); } -FunctionTypePointer FunctionType::asCallableFunction(bool _inLibrary, bool _bound) const +FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, bool _bound) const { if (_bound) solAssert(!m_parameterTypes.empty(), ""); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 120b1a42fbc2..4c6885b82037 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1290,11 +1290,11 @@ class FunctionType: public Type /// @returns a copy of this function type where the location of reference types is changed /// from CallData to Memory. This is the type that would be used when the function is - /// called, as opposed to the parameter types that are available inside the function body. + /// called externally, as opposed to the parameter types that are available inside the function body. /// Also supports variants to be used for library or bound calls. /// @param _inLibrary if true, uses DelegateCall as location. /// @param _bound if true, the function type is set to be bound. - FunctionTypePointer asCallableFunction(bool _inLibrary, bool _bound = false) const; + FunctionTypePointer asExternallyCallableFunction(bool _inLibrary, bool _bound = false) const; protected: std::vector> makeStackItems() const override; diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index a8e0e32b74d2..99aa6195f3fa 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -74,8 +74,8 @@ bool SMTEncoder::visit(ContractDefinition const& _contract) if ( function->name() == baseFunction->name() && function->kind() == baseFunction->kind() && - FunctionType(*function).asCallableFunction(false)-> - hasEqualParameterTypes(*FunctionType(*baseFunction).asCallableFunction(false)) + FunctionType(*function).asExternallyCallableFunction(false)-> + hasEqualParameterTypes(*FunctionType(*baseFunction).asExternallyCallableFunction(false)) ) { overridden = true; diff --git a/tools/solidityUpgrade/Upgrade060.cpp b/tools/solidityUpgrade/Upgrade060.cpp index f5fc4bdf54d7..30214ddfccfd 100644 --- a/tools/solidityUpgrade/Upgrade060.cpp +++ b/tools/solidityUpgrade/Upgrade060.cpp @@ -139,8 +139,8 @@ void OverridingFunction::endVisit(ContractDefinition const& _contract) for (auto [begin, end] = inheritedFunctions.equal_range(proxy); begin != end; begin++) { auto& super = (*begin); - auto functionType = FunctionType(*function).asCallableFunction(false); - auto superType = super.functionType()->asCallableFunction(false); + auto functionType = FunctionType(*function).asExternallyCallableFunction(false); + auto superType = super.functionType()->asExternallyCallableFunction(false); if (functionType && functionType->hasEqualParameterTypes(*superType)) { From 21e34d7ca9412691df47b89f5d598d6dfc8ca922 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 26 May 2020 18:07:31 +0530 Subject: [PATCH 121/479] Fixed seed for randomness, fixed conflicts in errorids --- .../analysis/DeclarationTypeChecker.cpp | 18 +++++++++--------- libsolidity/analysis/OverrideChecker.cpp | 2 +- libsolidity/analysis/ReferencesResolver.cpp | 14 +++++++------- libsolidity/analysis/TypeChecker.cpp | 14 +++++++------- scripts/correct_error_ids.py | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index ca565b53a8eb..b5b27222d302 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -151,7 +151,7 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName) { _typeName.annotation().type = TypeProvider::emptyTuple(); m_errorReporter.fatalTypeError( - 9755_error, + 5172_error, _typeName.location(), "Name has to refer to a struct, enum or contract." ); @@ -176,7 +176,7 @@ bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) break; default: m_errorReporter.fatalTypeError( - 7653_error, + 6012_error, _typeName.location(), "Invalid visibility, can only be \"external\" or \"internal\"." ); @@ -186,7 +186,7 @@ bool DeclarationTypeChecker::visit(FunctionTypeName const& _typeName) if (_typeName.isPayable() && _typeName.visibility() != Visibility::External) { m_errorReporter.fatalTypeError( - 6138_error, + 7415_error, _typeName.location(), "Only external function types can be payable." ); @@ -246,7 +246,7 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) } if (baseType->storageBytes() == 0) m_errorReporter.fatalTypeError( - 9390_error, + 6493_error, _typeName.baseType().location(), "Illegal base type of storage size zero for array." ); @@ -259,16 +259,16 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName) u256 lengthValue = 0; if (!lengthType || !lengthType->mobileType()) m_errorReporter.typeError( - 8922_error, + 5462_error, length->location(), "Invalid array length, expected integer literal or constant expression." ); else if (lengthType->isZero()) - m_errorReporter.typeError(1220_error, length->location(), "Array with zero length specified."); + m_errorReporter.typeError(1406_error, length->location(), "Array with zero length specified."); else if (lengthType->isFractional()) - m_errorReporter.typeError(4323_error, length->location(), "Array with fractional length specified."); + m_errorReporter.typeError(3208_error, length->location(), "Array with fractional length specified."); else if (lengthType->isNegative()) - m_errorReporter.typeError(9308_error, length->location(), "Array with negative length specified."); + m_errorReporter.typeError(3658_error, length->location(), "Array with negative length specified."); else lengthValue = lengthType->literalValue(nullptr); _typeName.annotation().type = TypeProvider::array(DataLocation::Storage, baseType, lengthValue); @@ -345,7 +345,7 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) errorString += " for variable"; } errorString += ", but " + locationToString(varLoc) + " was given."; - m_errorReporter.typeError(6160_error, _variable.location(), errorString); + m_errorReporter.typeError(6651_error, _variable.location(), errorString); solAssert(!allowedDataLocations.empty(), ""); varLoc = *allowedDataLocations.begin(); diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 06b98113907e..4b9a3b7f3ea7 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -559,7 +559,7 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr overrideError( _overriding, _super, - 2837_error, + 6959_error, "Overriding function changes state mutability from \"" + stateMutabilityToString(_super.stateMutability()) + "\" to \"" + diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index f92f8dc30dc9..408a7ff83782 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -119,7 +119,7 @@ bool ReferencesResolver::visit(Identifier const& _identifier) else errorMessage += " Did you mean " + std::move(suggestions) + "?"; } - m_errorReporter.declarationError(8051_error, _identifier.location(), errorMessage); + m_errorReporter.declarationError(7576_error, _identifier.location(), errorMessage); } else if (declarations.size() == 1) _identifier.annotation().referencedDeclaration = declarations.front(); @@ -157,7 +157,7 @@ void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName) Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath()); if (!declaration) { - m_errorReporter.fatalDeclarationError(7556_error, _typeName.location(), "Identifier not found or not unique."); + m_errorReporter.fatalDeclarationError(7920_error, _typeName.location(), "Identifier not found or not unique."); return; } @@ -210,7 +210,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) if (realName.empty()) { m_errorReporter.declarationError( - 9553_error, + 4794_error, _identifier.location, "In variable names _slot and _offset can only be used as a suffix." ); @@ -221,7 +221,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) if (declarations.size() > 1) { m_errorReporter.declarationError( - 8827_error, + 4718_error, _identifier.location, "Multiple matching identifiers. Resolving overloaded identifiers is not supported." ); @@ -233,7 +233,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) if (var->isLocalVariable() && m_yulInsideFunction) { m_errorReporter.declarationError( - 8477_error, + 6578_error, _identifier.location, "Cannot access local Solidity variables from inside an inline assembly function." ); @@ -255,7 +255,7 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) string namePrefix = identifier.name.str().substr(0, identifier.name.str().find('.')); if (isSlot || isOffset) m_errorReporter.declarationError( - 8820_error, + 9155_error, identifier.location, "In variable declarations _slot and _offset can not be used as a suffix." ); @@ -269,7 +269,7 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) ssl.append("The shadowed declaration is here:", decl->location()); if (!ssl.infos.empty()) m_errorReporter.declarationError( - 6005_error, + 3859_error, identifier.location, ssl, namePrefix.size() < identifier.name.str().size() ? diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6066893687bf..75a221c48832 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2611,7 +2611,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) auto const* var = dynamic_cast(&_memberAccess.expression()); string varName = var ? var->name() : "..."; errorMsg += " Use \"address(" + varName + ")." + memberName + "\" to access this address member."; - return { 5256_error, errorMsg }; + return { 3125_error, errorMsg }; } } else if (auto const* addressType = dynamic_cast(exprType)) @@ -2624,11 +2624,11 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) "Expected address not-payable as members were not found" ); - return { 2604_error, "\"send\" and \"transfer\" are only available for objects of type \"address payable\", not \"" + exprType->toString() + "\"." }; + return { 9862_error, "\"send\" and \"transfer\" are only available for objects of type \"address payable\", not \"" + exprType->toString() + "\"." }; } } - return { 5856_error, errorMsg }; + return { 9582_error, errorMsg }; }(); m_errorReporter.fatalTypeError( @@ -2904,7 +2904,7 @@ bool TypeChecker::visit(IndexRangeAccess const& _access) if (arrayType->location() != DataLocation::CallData || !arrayType->isDynamicallySized()) m_errorReporter.typeError(1227_error, _access.location(), "Index range access is only supported for dynamic calldata arrays."); else if (arrayType->baseType()->isDynamicallyEncoded()) - m_errorReporter.typeError(1878_error, _access.location(), "Index range access is not supported for arrays with dynamically encoded base types."); + m_errorReporter.typeError(2148_error, _access.location(), "Index range access is not supported for arrays with dynamically encoded base types."); _access.annotation().type = TypeProvider::arraySlice(*arrayType); _access.annotation().isLValue = isLValue; _access.annotation().isPure = isPure; @@ -3203,10 +3203,10 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss if (auto indexAccess = dynamic_cast(&_expression)) { if (type(indexAccess->baseExpression())->category() == Type::Category::FixedBytes) - return { 9222_error, "Single bytes in fixed bytes arrays cannot be modified." }; + return { 4360_error, "Single bytes in fixed bytes arrays cannot be modified." }; else if (auto arrayType = dynamic_cast(type(indexAccess->baseExpression()))) if (arrayType->dataStoredIn(DataLocation::CallData)) - return { 3335_error, "Calldata arrays are read-only." }; + return { 6182_error, "Calldata arrays are read-only." }; } if (auto memberAccess = dynamic_cast(&_expression)) @@ -3214,7 +3214,7 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss if (auto structType = dynamic_cast(type(memberAccess->expression()))) { if (structType->dataStoredIn(DataLocation::CallData)) - return { 9942_error, "Calldata structs are read-only." }; + return { 4156_error, "Calldata structs are read-only." }; } else if (dynamic_cast(type(memberAccess->expression()))) if (memberAccess->memberName() == "length") diff --git a/scripts/correct_error_ids.py b/scripts/correct_error_ids.py index c5885fac6458..cce8285deda7 100644 --- a/scripts/correct_error_ids.py +++ b/scripts/correct_error_ids.py @@ -55,7 +55,6 @@ def get_used_ids(file_names): def get_id(available_ids, used_ids): while len(available_ids) > 0: - random.seed(len(available_ids)) k = random.randrange(len(available_ids)) id = list(available_ids.keys())[k] del available_ids[id] @@ -117,6 +116,7 @@ def find_source_files(top_dir): def main(): + random.seed() cwd = os.getcwd() answer = input( f"This script checks and corrects *_error literals in .h and .cpp files\n" From 2716b5ff83bb08fd93b417e61463782bb8d1e97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 26 May 2020 12:28:46 +0200 Subject: [PATCH 122/479] Replace conditionally empty whiskers variables for punctuation with syntax in IRGenerator::generateInternalDispatchFunctions() --- libsolidity/codegen/ir/IRGenerationContext.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 3fa40327249a..493ed7b53de9 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -126,22 +126,19 @@ string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _ar string funName = IRNames::internalDispatch(_arity); return m_functions.createFunction(funName, [&]() { Whiskers templ(R"( - function (fun ) { + function (fun, ) -> { switch fun <#cases> case { - () + := () } default { invalid() } } )"); templ("functionName", funName); - templ("comma", _arity.in > 0 ? "," : ""); templ("in", suffixedVariableNameList("in_", 0, _arity.in)); - templ("arrow", _arity.out > 0 ? "->" : ""); - templ("assignment_op", _arity.out > 0 ? ":=" : ""); templ("out", suffixedVariableNameList("out_", 0, _arity.out)); vector> cases; From 1a2e441bc544e8011ac906a71aedc20819ecc289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 19 May 2020 21:50:22 +0200 Subject: [PATCH 123/479] Generate internal dispatch only for functions that might actually get called via pointers - This also adds support for internal library calls as a side-effect since they'll now be pulled into the internal dispatch automatically. --- .../codegen/ir/IRGenerationContext.cpp | 106 ++++++++---------- libsolidity/codegen/ir/IRGenerationContext.h | 32 +++++- libsolidity/codegen/ir/IRGenerator.cpp | 76 +++++++++++++ libsolidity/codegen/ir/IRGenerator.h | 5 + .../codegen/ir/IRGeneratorForStatements.cpp | 31 ++++- .../codegen/ir/IRGeneratorForStatements.h | 1 + ...called_by_constructor_through_dispatch.sol | 31 +++++ .../function_type_library_internal.sol | 2 + .../inherited_function_through_dispatch.sol | 21 ++++ .../internal_library_function_pointer.sol | 17 +++ ...irtual_function_calls_through_dispatch.sol | 26 +++++ 11 files changed, 284 insertions(+), 64 deletions(-) create mode 100644 test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol create mode 100644 test/libsolidity/semanticTests/intheritance/inherited_function_through_dispatch.sol create mode 100644 test/libsolidity/semanticTests/libraries/internal_library_function_pointer.sol create mode 100644 test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 493ed7b53de9..b85e2f7d3ed1 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -29,6 +29,8 @@ #include #include +#include + using namespace std; using namespace solidity; using namespace solidity::util; @@ -121,49 +123,55 @@ string IRGenerationContext::newYulVariable() return "_" + to_string(++m_varCounter); } -string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _arity) -{ - string funName = IRNames::internalDispatch(_arity); - return m_functions.createFunction(funName, [&]() { - Whiskers templ(R"( - function (fun, ) -> { - switch fun - <#cases> - case - { - := () - } - - default { invalid() } - } - )"); - templ("functionName", funName); - templ("in", suffixedVariableNameList("in_", 0, _arity.in)); - templ("out", suffixedVariableNameList("out_", 0, _arity.out)); - - vector> cases; - for (FunctionDefinition const* function: collectFunctionsOfArity(_arity)) - { - solAssert(function, ""); - solAssert( - YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity, - "A single dispatch function can only handle functions of one arity" - ); - solAssert(!function->isConstructor(), ""); - // 0 is reserved for uninitialized function pointers - solAssert(function->id() != 0, "Unexpected function ID: 0"); - - cases.emplace_back(map{ - {"funID", to_string(function->id())}, - {"name", IRNames::function(*function)} - }); +void IRGenerationContext::initializeInternalDispatch(InternalDispatchMap _internalDispatch) +{ + solAssert(internalDispatchClean(), ""); + for (set const& functions: _internalDispatch | boost::adaptors::map_values) + for (auto function: functions) enqueueFunctionForCodeGeneration(*function); - } - templ("cases", move(cases)); - return templ.render(); - }); + m_internalDispatchMap = move(_internalDispatch); +} + +InternalDispatchMap IRGenerationContext::consumeInternalDispatchMap() +{ + m_directInternalFunctionCalls.clear(); + + InternalDispatchMap internalDispatch = move(m_internalDispatchMap); + m_internalDispatchMap.clear(); + return internalDispatch; +} + +void IRGenerationContext::internalFunctionCalledDirectly(Expression const& _expression) +{ + solAssert(m_directInternalFunctionCalls.count(&_expression) == 0, ""); + + m_directInternalFunctionCalls.insert(&_expression); +} + +void IRGenerationContext::internalFunctionAccessed(Expression const& _expression, FunctionDefinition const& _function) +{ + solAssert( + IRHelpers::referencedFunctionDeclaration(_expression) && + _function.resolveVirtual(mostDerivedContract()) == + IRHelpers::referencedFunctionDeclaration(_expression)->resolveVirtual(mostDerivedContract()), + "Function definition does not match the expression" + ); + + if (m_directInternalFunctionCalls.count(&_expression) == 0) + { + FunctionType const* functionType = TypeProvider::function(_function, FunctionType::Kind::Internal); + solAssert(functionType, ""); + + m_internalDispatchMap[YulArity::fromType(*functionType)].insert(&_function); + enqueueFunctionForCodeGeneration(_function); + } +} + +void IRGenerationContext::internalFunctionCalledThroughDispatch(YulArity const& _arity) +{ + m_internalDispatchMap.try_emplace(_arity); } YulUtilFunctions IRGenerationContext::utils() @@ -180,21 +188,3 @@ std::string IRGenerationContext::revertReasonIfDebug(std::string const& _message { return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message); } - -set IRGenerationContext::collectFunctionsOfArity(YulArity const& _arity) -{ - // UNIMPLEMENTED: Internal library calls via pointers are not implemented yet. - // We're not returning any internal library functions here even though it's possible - // to call them via pointers. Right now such calls end will up triggering the `default` case in - // the switch in the generated dispatch function. - set functions; - for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts) - for (FunctionDefinition const* function: contract->definedFunctions()) - if ( - !function->isConstructor() && - YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == _arity - ) - functions.insert(function); - - return functions; -} diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 30aa5e2205a9..d6d8022dfbe7 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -43,6 +43,8 @@ namespace solidity::frontend class YulUtilFunctions; class ABIFunctions; +using InternalDispatchMap = std::map>; + /** * Class that contains contextual information during IR generation. */ @@ -102,7 +104,26 @@ class IRGenerationContext std::string newYulVariable(); - std::string generateInternalDispatchFunction(YulArity const& _arity); + void initializeInternalDispatch(InternalDispatchMap _internalDispatchMap); + InternalDispatchMap consumeInternalDispatchMap(); + bool internalDispatchClean() const { return m_internalDispatchMap.empty() && m_directInternalFunctionCalls.empty(); } + + /// Notifies the context that a function call that needs to go through internal dispatch was + /// encountered while visiting the AST. This ensures that the corresponding dispatch function + /// gets added to the dispatch map even if there are no entries in it (which may happen if + /// the code contains a call to an uninitialized function variable). + void internalFunctionCalledThroughDispatch(YulArity const& _arity); + + /// Notifies the context that a direct function call (i.e. not through internal dispatch) was + /// encountered while visiting the AST. This lets the context know that the function should + /// not be added to the dispatch (unless there are also indirect calls to it elsewhere else). + void internalFunctionCalledDirectly(Expression const& _expression); + + /// Notifies the context that a name representing an internal function has been found while + /// visiting the AST. If the name has not been reported as a direct call using + /// @a internalFunctionCalledDirectly(), it's assumed to represent function variable access + /// and the function gets added to internal dispatch. + void internalFunctionAccessed(Expression const& _expression, FunctionDefinition const& _function); /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); @@ -120,8 +141,6 @@ class IRGenerationContext std::set& subObjectsCreated() { return m_subObjects; } private: - std::set collectFunctionsOfArity(YulArity const& _arity); - langutil::EVMVersion m_evmVersion; RevertStrings m_revertStrings; OptimiserSettings m_optimiserSettings; @@ -147,6 +166,13 @@ class IRGenerationContext /// all platforms - which is a property guaranteed by MultiUseYulFunctionCollector. std::set m_functionGenerationQueue; + /// Collection of functions that need to be callable via internal dispatch. + /// Note that having a key with an empty set of functions is a valid situation. It means that + /// the code contains a call via a pointer even though a specific function is never assigned to it. + /// It will fail at runtime but the code must still compile. + InternalDispatchMap m_internalDispatchMap; + std::set m_directInternalFunctionCalls; + std::set m_subObjects; }; diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index 69aad0af62f6..1bb6c7089443 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -38,6 +38,8 @@ #include +#include + #include using namespace std; @@ -137,14 +139,22 @@ string IRGenerator::generate( t("deploy", deployCode(_contract)); generateImplicitConstructors(_contract); generateQueuedFunctions(); + InternalDispatchMap internalDispatchMap = generateInternalDispatchFunctions(); t("functions", m_context.functionCollector().requestedFunctions()); t("subObjects", subObjectSources(m_context.subObjectsCreated())); resetContext(_contract); + + // NOTE: Function pointers can be passed from creation code via storage variables. We need to + // get all the functions they could point to into the dispatch functions even if they're never + // referenced by name in the runtime code. + m_context.initializeInternalDispatch(move(internalDispatchMap)); + // Do not register immutables to avoid assignment. t("RuntimeObject", IRNames::runtimeObject(_contract)); t("dispatch", dispatchRoutine(_contract)); generateQueuedFunctions(); + generateInternalDispatchFunctions(); t("runtimeFunctions", m_context.functionCollector().requestedFunctions()); t("runtimeSubObjects", subObjectSources(m_context.subObjectsCreated())); return t.render(); @@ -164,6 +174,68 @@ void IRGenerator::generateQueuedFunctions() generateFunction(*m_context.dequeueFunctionForCodeGeneration()); } +InternalDispatchMap IRGenerator::generateInternalDispatchFunctions() +{ + solAssert( + m_context.functionGenerationQueueEmpty(), + "At this point all the enqueued functions should have been generated. " + "Otherwise the dispatch may be incomplete." + ); + + InternalDispatchMap internalDispatchMap = m_context.consumeInternalDispatchMap(); + for (YulArity const& arity: internalDispatchMap | boost::adaptors::map_keys) + { + string funName = IRNames::internalDispatch(arity); + m_context.functionCollector().createFunction(funName, [&]() { + Whiskers templ(R"( + function (fun, ) -> { + switch fun + <#cases> + case + { + := () + } + + default { invalid() } + } + )"); + templ("functionName", funName); + templ("in", suffixedVariableNameList("in_", 0, arity.in)); + templ("out", suffixedVariableNameList("out_", 0, arity.out)); + + vector> cases; + for (FunctionDefinition const* function: internalDispatchMap.at(arity)) + { + solAssert(function, ""); + solAssert( + YulArity::fromType(*TypeProvider::function(*function, FunctionType::Kind::Internal)) == arity, + "A single dispatch function can only handle functions of one arity" + ); + solAssert(!function->isConstructor(), ""); + // 0 is reserved for uninitialized function pointers + solAssert(function->id() != 0, "Unexpected function ID: 0"); + solAssert(m_context.functionCollector().contains(IRNames::function(*function)), ""); + + cases.emplace_back(map{ + {"funID", to_string(function->id())}, + {"name", IRNames::function(*function)} + }); + } + + templ("cases", move(cases)); + return templ.render(); + }); + } + + solAssert(m_context.internalDispatchClean(), ""); + solAssert( + m_context.functionGenerationQueueEmpty(), + "Internal dispatch generation must not add new functions to generation queue because they won't be proeessed." + ); + + return internalDispatchMap; +} + string IRGenerator::generateFunction(FunctionDefinition const& _function) { string functionName = IRNames::function(_function); @@ -556,6 +628,10 @@ void IRGenerator::resetContext(ContractDefinition const& _contract) m_context.functionCollector().requestedFunctions().empty(), "Reset context while it still had functions." ); + solAssert( + m_context.internalDispatchClean(), + "Reset internal dispatch map without consuming it." + ); m_context = IRGenerationContext(m_evmVersion, m_context.revertStrings(), m_optimiserSettings); m_context.setMostDerivedContract(_contract); diff --git a/libsolidity/codegen/ir/IRGenerator.h b/libsolidity/codegen/ir/IRGenerator.h index bff0c0739a81..6bf94e575b1d 100644 --- a/libsolidity/codegen/ir/IRGenerator.h +++ b/libsolidity/codegen/ir/IRGenerator.h @@ -65,6 +65,11 @@ class IRGenerator /// Generates code for all the functions from the function generation queue. /// The resulting code is stored in the function collector in IRGenerationContext. void generateQueuedFunctions(); + /// Generates all the internal dispatch functions necessary to handle any function that could + /// possibly be called via a pointer. + /// @return The content of the dispatch for reuse in runtime code. Reuse is necessary because + /// pointers to functions can be passed from the creation code in storage variables. + InternalDispatchMap generateInternalDispatchFunctions(); /// Generates code for and returns the name of the function. std::string generateFunction(FunctionDefinition const& _function); /// Generates a getter for the given declaration and returns its name diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 5472ec7ed20c..98c0b2169501 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -583,6 +583,20 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp) return false; } +bool IRGeneratorForStatements::visit(FunctionCall const& _functionCall) +{ + FunctionTypePointer functionType = dynamic_cast(&type(_functionCall.expression())); + if ( + functionType && + functionType->kind() == FunctionType::Kind::Internal && + !functionType->bound() && + IRHelpers::referencedFunctionDeclaration(_functionCall.expression()) + ) + m_context.internalFunctionCalledDirectly(_functionCall.expression()); + + return true; +} + void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) { solUnimplementedAssert( @@ -688,9 +702,10 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) else { YulArity arity = YulArity::fromType(*functionType); + m_context.internalFunctionCalledThroughDispatch(arity); + define(_functionCall) << - // NOTE: generateInternalDispatchFunction() takes care of adding the function to function generation queue - m_context.generateInternalDispatchFunction(arity) << + IRNames::internalDispatch(arity) << "(" << IRVariable(_functionCall.expression()).part("functionIdentifier").name() << joinHumanReadablePrefixed(args) << @@ -1492,7 +1507,10 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) break; case FunctionType::Kind::Internal: if (auto const* function = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) + { define(_memberAccess) << to_string(function->id()) << "\n"; + m_context.internalFunctionAccessed(_memberAccess, *function); + } else solAssert(false, "Function not found in member access"); break; @@ -1756,7 +1774,14 @@ void IRGeneratorForStatements::endVisit(Identifier const& _identifier) return; } else if (FunctionDefinition const* functionDef = dynamic_cast(declaration)) - define(_identifier) << to_string(functionDef->resolveVirtual(m_context.mostDerivedContract()).id()) << "\n"; + { + FunctionDefinition const& resolvedFunctionDef = functionDef->resolveVirtual(m_context.mostDerivedContract()); + define(_identifier) << to_string(resolvedFunctionDef.id()) << "\n"; + + solAssert(resolvedFunctionDef.functionType(true), ""); + solAssert(resolvedFunctionDef.functionType(true)->kind() == FunctionType::Kind::Internal, ""); + m_context.internalFunctionAccessed(_identifier, resolvedFunctionDef); + } else if (VariableDeclaration const* varDecl = dynamic_cast(declaration)) handleVariableReference(*varDecl, _identifier); else if (dynamic_cast(declaration)) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.h b/libsolidity/codegen/ir/IRGeneratorForStatements.h index 42d355ddd547..bdf21f783e0b 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.h +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.h @@ -70,6 +70,7 @@ class IRGeneratorForStatements: public ASTConstVisitor void endVisit(Return const& _return) override; void endVisit(UnaryOperation const& _unaryOperation) override; bool visit(BinaryOperation const& _binOp) override; + bool visit(FunctionCall const& _funCall) override; void endVisit(FunctionCall const& _funCall) override; void endVisit(FunctionCallOptions const& _funCallOptions) override; void endVisit(MemberAccess const& _memberAccess) override; diff --git a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol new file mode 100644 index 000000000000..56f92cd50c5d --- /dev/null +++ b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol @@ -0,0 +1,31 @@ +contract Test { + bytes6 name; + + constructor() public { + function (bytes6 _name) internal setter = setName; + setter("abcdef"); + + applyShift(leftByteShift, 3); + } + + function getName() public returns (bytes6 ret) { + return name; + } + + function setName(bytes6 _name) private { + name = _name; + } + + function leftByteShift(bytes6 _value, uint _shift) public returns (bytes6) { + return _value << _shift * 8; + } + + function applyShift(function (bytes6 _value, uint _shift) internal returns (bytes6) _shiftOperator, uint _bytes) internal { + name = _shiftOperator(name, _bytes); + } +} + +// ==== +// compileViaYul: also +// ---- +// getName() -> "def\x00\x00\x00" diff --git a/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol b/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol index f096a4979444..c4554740d341 100644 --- a/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol +++ b/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol @@ -22,5 +22,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(uint256[]): 0x20, 0x3, 0x1, 0x7, 0x3 -> 11 diff --git a/test/libsolidity/semanticTests/intheritance/inherited_function_through_dispatch.sol b/test/libsolidity/semanticTests/intheritance/inherited_function_through_dispatch.sol new file mode 100644 index 000000000000..a7aa1fcb8598 --- /dev/null +++ b/test/libsolidity/semanticTests/intheritance/inherited_function_through_dispatch.sol @@ -0,0 +1,21 @@ +contract A { + function f() internal virtual returns (uint256) { + return 1; + } +} + + +contract B is A { + function f() internal override returns (uint256) { + return 2; + } + + function g() public returns (uint256) { + function() internal returns (uint256) ptr = A.f; + return ptr(); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 1 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_pointer.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_pointer.sol new file mode 100644 index 000000000000..bc2f2da0a4f4 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_pointer.sol @@ -0,0 +1,17 @@ +library L { + function f() internal returns (uint) { + return 66; + } +} + +contract C { + function g() public returns (uint) { + function() internal returns(uint) ptr; + ptr = L.f; + return ptr(); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 66 diff --git a/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol new file mode 100644 index 000000000000..f3bc0845f99d --- /dev/null +++ b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol @@ -0,0 +1,26 @@ +contract Base { + function f() internal returns (uint256 i) { + function() internal returns (uint256) ptr = g; + return ptr(); + } + + function g() internal virtual returns (uint256 i) { + return 1; + } +} + + +contract Derived is Base { + function g() internal override returns (uint256 i) { + return 2; + } + + function h() public returns (uint256 i) { + return f(); + } +} + +// ==== +// compileViaYul: also +// ---- +// h() -> 2 From b3cafe45835abf1de16e89799cb5d86529a788dc Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 26 May 2020 17:23:49 +0200 Subject: [PATCH 124/479] Fix ICE by avoiding copyForLocation() on ArraySliceType --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 2 +- libsolidity/ast/Types.cpp | 9 ++++++--- .../syntaxTests/array/slice/member_access.sol | 8 ++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/syntaxTests/array/slice/member_access.sol diff --git a/Changelog.md b/Changelog.md index cbfa2ad20371..381d9eaae71d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ Compiler Features: Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. * Type Checker: Disallow assignments to storage variables of type ``mapping``. + * Type Checker: Fix internal compiler error when accessing members of array slices. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6066893687bf..ec3f491dcdcd 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2555,7 +2555,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) if (possibleMembers.empty()) { - if (initialMemberCount == 0) + if (initialMemberCount == 0 && !dynamic_cast(exprType)) { // Try to see if the member was removed because it is only available for storage types. auto storageType = TypeProvider::withLocationIfReference( diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index de7b03153517..d2f6c3898808 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -349,14 +349,17 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition const& _scope) { // Normalise data location of type. - TypePointer type = TypeProvider::withLocationIfReference(DataLocation::Storage, &_type); + DataLocation typeLocation = DataLocation::Storage; + if (auto refType = dynamic_cast(&_type)) + typeLocation = refType->location(); + set seenFunctions; MemberList::MemberMap members; for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts) for (UsingForDirective const* ufd: contract->usingForDirectives()) { - if (ufd->typeName() && *type != *TypeProvider::withLocationIfReference( - DataLocation::Storage, + if (ufd->typeName() && _type != *TypeProvider::withLocationIfReference( + typeLocation, ufd->typeName()->annotation().type )) continue; diff --git a/test/libsolidity/syntaxTests/array/slice/member_access.sol b/test/libsolidity/syntaxTests/array/slice/member_access.sol new file mode 100644 index 000000000000..e3f09cae8b5a --- /dev/null +++ b/test/libsolidity/syntaxTests/array/slice/member_access.sol @@ -0,0 +1,8 @@ +// Used to cause ICE +contract C { + function f(uint[] calldata x) external pure { + x[1:2].a; + } +} +// ---- +// TypeError: (92-100): Member "a" not found or not visible after argument-dependent lookup in uint256[] calldata slice. From e4b31e723003a2d98554c2d17b5f72885c8b96a5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 15:08:57 +0200 Subject: [PATCH 125/479] Introduce named concept for types. --- libsolidity/ast/Types.cpp | 11 +++++++++++ libsolidity/ast/Types.h | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index d2f6c3898808..fbb119e42829 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3029,6 +3029,17 @@ unsigned FunctionType::storageBytes() const solAssert(false, "Storage size of non-storable function type requested."); } +bool FunctionType::nameable() const +{ + return + (m_kind == Kind::Internal || m_kind == Kind::External) && + !m_bound && + !m_arbitraryParameters && + !m_gasSet && + !m_valueSet && + !m_saltSet; +} + vector> FunctionType::makeStackItems() const { vector> slots; diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 4c6885b82037..609f2e9edf83 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -263,6 +263,10 @@ class Type /// Returns true if the type can be stored as a value (as opposed to a reference) on the stack, /// i.e. it behaves differently in lvalue context and in value context. virtual bool isValueType() const { return false; } + /// @returns true if this type can be used for variables. It returns false for + /// types like magic types, literals and function types with a kind that is not + /// internal or external. + virtual bool nameable() const { return false; } /// @returns a list of named and typed stack items that determine the layout of this type on the stack. /// A stack item either has an empty name and type ``nullptr`` referring to a single stack slot, or /// has a non-empty name and a valid type referring to the stack layout of that type. @@ -402,6 +406,7 @@ class AddressType: public Type unsigned storageBytes() const override { return 160 / 8; } bool leftAligned() const override { return false; } bool isValueType() const override { return true; } + bool nameable() const override { return true; } MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; @@ -446,6 +451,7 @@ class IntegerType: public Type unsigned storageBytes() const override { return m_bits / 8; } bool leftAligned() const override { return false; } bool isValueType() const override { return true; } + bool nameable() const override { return true; } std::string toString(bool _short) const override; @@ -492,6 +498,7 @@ class FixedPointType: public Type unsigned storageBytes() const override { return m_totalBits / 8; } bool leftAligned() const override { return false; } bool isValueType() const override { return true; } + bool nameable() const override { return true; } std::string toString(bool _short) const override; @@ -639,6 +646,7 @@ class FixedBytesType: public Type unsigned storageBytes() const override { return m_bytes; } bool leftAligned() const override { return true; } bool isValueType() const override { return true; } + bool nameable() const override { return true; } std::string toString(bool) const override { return "bytes" + util::toString(m_bytes); } MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; @@ -666,6 +674,7 @@ class BoolType: public Type unsigned storageBytes() const override { return 1; } bool leftAligned() const override { return false; } bool isValueType() const override { return true; } + bool nameable() const override { return true; } std::string toString(bool) const override { return "bool"; } u256 literalValue(Literal const* _literal) const override; @@ -773,6 +782,7 @@ class ArrayType: public ReferenceType bool isDynamicallyEncoded() const override; u256 storageSize() const override; bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); } + bool nameable() const override { return true; } std::string toString(bool _short) const override; std::string canonicalName() const override; std::string signatureInExternalFunction(bool _structsByName) const override; @@ -875,6 +885,7 @@ class ContractType: public Type bool leftAligned() const override { solAssert(!isSuper(), ""); return false; } bool canLiveOutsideStorage() const override { return !isSuper(); } bool isValueType() const override { return !isSuper(); } + bool nameable() const override { return !isSuper(); } std::string toString(bool _short) const override; std::string canonicalName() const override; @@ -935,6 +946,7 @@ class StructType: public ReferenceType u256 memoryDataSize() const override; u256 storageSize() const override; bool canLiveOutsideStorage() const override { return true; } + bool nameable() const override { return true; } std::string toString(bool _short) const override; MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; @@ -997,6 +1009,7 @@ class EnumType: public Type std::string toString(bool _short) const override; std::string canonicalName() const override; bool isValueType() const override { return true; } + bool nameable() const override { return true; } BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override; TypePointer encodingType() const override; @@ -1202,6 +1215,7 @@ class FunctionType: public Type bool leftAligned() const override; unsigned storageBytes() const override; bool isValueType() const override { return true; } + bool nameable() const override; bool canLiveOutsideStorage() const override { return m_kind == Kind::Internal || m_kind == Kind::External; } bool hasSimpleZeroValueInMemory() const override { return false; } MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; @@ -1339,6 +1353,7 @@ class MappingType: public Type bool dataStoredIn(DataLocation _location) const override { return _location == DataLocation::Storage; } /// Cannot be stored in memory, but just in case. bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } + bool nameable() const override { return true; } Type const* keyType() const { return m_keyType; } Type const* valueType() const { return m_valueType; } From d0b6de580fb1c84d7dde616e71addf99ac07ec3d Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 15:20:54 +0200 Subject: [PATCH 126/479] Disallow non-namable types for inline arrays. --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 6 ++++++ .../inline_arrays/unnamed_types_in_inline_array_1.sol | 7 +++++++ .../inline_arrays/unnamed_types_in_inline_array_2.sol | 7 +++++++ 4 files changed, 21 insertions(+) create mode 100644 test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol create mode 100644 test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol diff --git a/Changelog.md b/Changelog.md index 381d9eaae71d..ad568e6ae9dd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ Compiler Features: Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. * Type Checker: Disallow assignments to storage variables of type ``mapping``. + * Type Checker: Disallow inline arrays of non-nameable types. * Type Checker: Fix internal compiler error when accessing members of array slices. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 86961bfda920..47178fb469dd 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1509,6 +1509,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple) { if (!inlineArrayType) m_errorReporter.fatalTypeError(6378_error, _tuple.location(), "Unable to deduce common type for array elements."); + else if (!inlineArrayType->nameable()) + m_errorReporter.fatalTypeError( + 9656_error, + _tuple.location(), + "Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element." + ); else if (!inlineArrayType->canLiveOutsideStorage()) m_errorReporter.fatalTypeError(1545_error, _tuple.location(), "Type " + inlineArrayType->toString() + " is only valid in storage."); diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol new file mode 100644 index 000000000000..a6280344507f --- /dev/null +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + [msg]; + } +} +// ---- +// TypeError: (47-52): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol new file mode 100644 index 000000000000..a93e092423d2 --- /dev/null +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + [type(C)]; + } +} +// ---- +// TypeError: (47-56): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. From 309f0fbc8a6c2e13d5e67e8c4d72404a4e8ca1e3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 15:35:29 +0200 Subject: [PATCH 127/479] Unimplemented assert for conversion from calldata slices to memory. --- libsolidity/codegen/CompilerUtils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 225a9fe8e360..2735c2fce9ed 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1022,6 +1022,10 @@ void CompilerUtils::convertType( case Type::Category::ArraySlice: { auto& typeOnStack = dynamic_cast(_typeOnStack); + solUnimplementedAssert( + _targetType.dataStoredIn(DataLocation::CallData), + "Conversion from calldata slices to memory not yet implemented." + ); solAssert(_targetType == typeOnStack.arrayType(), ""); solUnimplementedAssert( typeOnStack.arrayType().location() == DataLocation::CallData && From cb5bfc7436ca11bdfa2f0543a3611079e3f4cbee Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 20 May 2020 11:25:23 -0500 Subject: [PATCH 128/479] Update natspec comments on state variables. - changing some warnings to errors --- libsolidity/analysis/DocStringAnalyser.cpp | 19 +++---------------- libsolidity/parsing/Parser.cpp | 2 +- test/compilationTests/corion/premium.sol | 12 ++++++------ test/compilationTests/corion/token.sol | 13 +++++++------ test/libsolidity/SolidityParser.cpp | 8 ++++---- .../docstring_author_title_state_variable.sol | 3 ++- ..._non_public_state_variable_with_return.sol | 2 +- .../docstring_private_state_variable.sol | 2 +- .../natspec/docstring_variable.sol | 2 +- 9 files changed, 26 insertions(+), 37 deletions(-) diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 7d8a8a43f864..9031b75745c1 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -60,25 +60,12 @@ bool DocStringAnalyser::visit(VariableDeclaration const& _variable) { if (_variable.isStateVariable()) { - static set const validPublicTags = set{"dev", "notice", "return", "title", "author"}; + static set const validPublicTags = set{"dev", "notice", "return"}; + static set const validNonPublicTags = set{"dev"}; if (_variable.isPublic()) parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); else - { - parseDocStrings(_variable, _variable.annotation(), validPublicTags, "non-public state variables"); - if (_variable.annotation().docTags.count("notice") > 0) - m_errorReporter.warning( - 7816_error, _variable.documentation()->location(), - "Documentation tag on non-public state variables will be disallowed in 0.7.0. " - "You will need to use the @dev tag explicitly." - ); - } - if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) - m_errorReporter.warning( - 8532_error, _variable.documentation()->location(), - "Documentation tag @title and @author is only allowed on contract definitions. " - "It will be disallowed in 0.7.0." - ); + parseDocStrings(_variable, _variable.annotation(), validNonPublicTags, "non-public state variables"); } return false; } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index c429ba78634f..ab8180dc7eb4 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -697,7 +697,7 @@ ASTPointer Parser::parseVariableDeclaration( } if (!_options.isStateVariable && documentation != nullptr) - parserWarning(2837_error, "Only state variables can have a docstring. This will be disallowed in 0.7.0."); + parserError(2837_error, "Only state variables can have a docstring."); if (dynamic_cast(type.get()) && _options.isStateVariable && m_scanner->currentToken() == Token::LBrace) fatalParserError( diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol index d3b842608eea..a703bec025e2 100644 --- a/test/compilationTests/corion/premium.sol +++ b/test/compilationTests/corion/premium.sol @@ -11,6 +11,12 @@ contract thirdPartyPContractAbstract { contract ptokenDB is tokenDB {} +/** + * + * @title Corion Platform Premium Token + * @author iFA @ Corion Platform + * + */ contract premium is module, safeMath { function replaceModule(address payable addr) external override returns (bool success) { require( super.isModuleHandler(msg.sender) ); @@ -23,12 +29,6 @@ contract premium is module, safeMath { require( _success && _active ); _; } - /** - * - * @title Corion Platform Premium Token - * @author iFA @ Corion Platform - * - */ string public name = "Corion Premium"; string public symbol = "CORP"; diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index 0d67feaa9fb5..0888744dba41 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -11,6 +11,12 @@ contract thirdPartyContractAbstract { function approvedCorionToken(address, uint256, bytes calldata) external returns (bool) {} } +/** + * + * @title Corion Platform Token + * @author iFA @ Corion Platform + * + */ contract token is safeMath, module, announcementTypes { /* module callbacks @@ -26,12 +32,7 @@ contract token is safeMath, module, announcementTypes { require( _success && _active ); _; } - /** - * - * @title Corion Platform Token - * @author iFA @ Corion Platform - * - */ + string public name = "Corion"; string public symbol = "COR"; uint8 public decimals = 6; diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 12fbc3fcec35..ac1a56afdc6c 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body) /// fun1 description function fun1(uint256 a) { var b; - /// I should not interfere with actual natspec comments + // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; bytes7 name = "Solidity"; @@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature) function ///I am in the wrong place fun1(uint256 a) { var b; - /// I should not interfere with actual natspec comments + // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; bytes7 name = "Solidity"; @@ -310,9 +310,9 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature) contract test { uint256 stateVar; function fun1(uint256 a) { - /// I should have been above the function signature + // I should have been above the function signature (natspec comments on local variables not allowed anymore) var b; - /// I should not interfere with actual natspec comments + // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; bytes7 name = "Solidity"; diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol index 78aaf920c5f9..d7e52608c375 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol @@ -4,4 +4,5 @@ contract C { uint private state; } // ---- -// Warning: (17-56): Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0. +// DocstringParsingError: (17-56): Documentation tag @author not valid for non-public state variables. +// DocstringParsingError: (17-56): Documentation tag @title not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol index 2b079ee7f811..d8f70ebd87db 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol @@ -3,4 +3,4 @@ contract test { uint private state; } // ---- -// DocstringParsingError: (18-47): Documentation tag "@return" is only allowed on public state-variables. +// DocstringParsingError: (18-47): Documentation tag @return not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol index 780501230966..dbc5c9a0b77c 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol @@ -4,4 +4,4 @@ contract C { uint private state; } // ---- -// Warning: (17-74): Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly. +// DocstringParsingError: (17-74): Documentation tag @notice not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol index 726eba852618..f1becfb5eb6c 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (290-295): Only state variables can have a docstring. This will be disallowed in 0.7.0. +// ParserError: (290-295): Only state variables can have a docstring. From 884e7cbffc3e0acdfa6747aa6397f02dd8dade9a Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 26 May 2020 19:04:59 +0200 Subject: [PATCH 129/479] Fix ICE when trying to decode too large static arrays --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 12 ++++++++++++ .../array/length/abi_decode_length_too_large.sol | 8 ++++++++ 3 files changed, 21 insertions(+) create mode 100644 test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol diff --git a/Changelog.md b/Changelog.md index 381d9eaae71d..6159c62ae26e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. * Type Checker: Disallow assignments to storage variables of type ``mapping``. * Type Checker: Fix internal compiler error when accessing members of array slices. + * Type Checker: Fix internal compiler error when trying to decode too large static arrays. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 86961bfda920..d9c1dfd626c3 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -193,6 +193,18 @@ TypePointers TypeChecker::typeCheckABIDecodeAndRetrieveReturnType(FunctionCall c typeArgument->location(), "Decoding type " + actualType->toString(false) + " not supported." ); + + if (auto referenceType = dynamic_cast(actualType)) + { + auto result = referenceType->validForLocation(referenceType->location()); + if (!result) + m_errorReporter.typeError( + 6118_error, + typeArgument->location(), + result.message() + ); + } + components.push_back(actualType); } else 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 new file mode 100644 index 000000000000..f16ebadae355 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/abi_decode_length_too_large.sol @@ -0,0 +1,8 @@ +// Used to cause ICE +contract C { + function f() public { + abi.decode("", (byte[999999999])); + } +} +// ---- +// TypeError: (75-90): Type too large for memory. From 118cb13476f7794f3a2d6c84673464ce019f4517 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Mon, 25 May 2020 06:40:43 -0500 Subject: [PATCH 130/479] [Sol - Yul] Add support for ABIDecode. --- .../codegen/ir/IRGeneratorForStatements.cpp | 40 ++++++++++++++++++- .../abiEncoderV1/abi_decode_dynamic_array.sol | 2 + .../abiEncoderV1/abi_decode_static_array.sol | 2 + .../abi_decode_static_array_v2.sol | 2 + .../abiEncoderV1/abi_decode_trivial.sol | 2 + .../abiEncoderV1/abi_encode_decode_simple.sol | 2 + .../abiEncoderV1/decode_slice.sol | 3 ++ .../abiEncoderV1/dynamic_memory_copy.sol | 3 ++ .../abiencodedecode/abi_decode_calldata.sol | 3 ++ .../abiencodedecode/abi_decode_simple.sol | 3 ++ .../abi_decode_simple_storage.sol | 1 + 11 files changed, 62 insertions(+), 1 deletion(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 98c0b2169501..feaacce1df47 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -884,6 +884,45 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) m_code << templ.render(); break; } + case FunctionType::Kind::ABIDecode: + { + Whiskers templ(R"( + let := (, add(, )) + )"); + + TypePointer firstArgType = arguments.front()->annotation().type; + TypePointers targetTypes; + + if (TupleType const* targetTupleType = dynamic_cast(_functionCall.annotation().type)) + targetTypes = targetTupleType->components(); + else + targetTypes = TypePointers{_functionCall.annotation().type}; + + if ( + auto referenceType = dynamic_cast(firstArgType); + referenceType && referenceType->dataStoredIn(DataLocation::CallData) + ) + { + solAssert(referenceType->isImplicitlyConvertibleTo(*TypeProvider::bytesCalldata()), ""); + IRVariable var = convert(*arguments[0], *TypeProvider::bytesCalldata()); + templ("abiDecode", m_context.abiFunctions().tupleDecoder(targetTypes, false)); + templ("offset", var.part("offset").name()); + templ("length", var.part("length").name()); + } + else + { + IRVariable var = convert(*arguments[0], *TypeProvider::bytesMemory()); + templ("abiDecode", m_context.abiFunctions().tupleDecoder(targetTypes, true)); + templ("offset", "add(" + var.part("mpos").name() + ", 32)"); + templ("length", + m_utils.arrayLengthFunction(*TypeProvider::bytesMemory()) + "(" + var.part("mpos").name() + ")" + ); + } + templ("retVars", IRVariable(_functionCall).commaSeparatedList()); + + m_code << templ.render(); + break; + } case FunctionType::Kind::Revert: { solAssert(arguments.size() == parameterTypes.size(), ""); @@ -1369,7 +1408,6 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) else if (member == "data") { IRVariable var(_memberAccess); - declare(var); define(var.part("offset")) << "0\n"; define(var.part("length")) << "calldatasize()\n"; } diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol index 180d89ec185b..4a67993ee97f 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol @@ -4,5 +4,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0xc0, 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 -> 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol index 270a5abc0695..eeb8bfc706ec 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol @@ -8,5 +8,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol index 46450f704bda..27c022cfd329 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol @@ -11,5 +11,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol index 7b873951f676..f02d75d17cd3 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol @@ -4,5 +4,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0x20, 0x21 -> 33 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol index 1fbcfa53d80f..b0205606f710 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol @@ -5,5 +5,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol index 35cb15077abc..33e32e065eab 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol @@ -5,5 +5,8 @@ contract C { f = abi.decode(msg.data[4 + 32 : 4 + 32 + 32], (uint256)); } } + +// ==== +// compileViaYul: also // ---- // f(uint256,uint256): 42, 23 -> 42, 23, 42, 23 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol b/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol index ef2b07cb5213..450dfa4d5d15 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol @@ -18,6 +18,9 @@ contract C { } } } + +// ==== +// compileViaYul: also // ---- // test(bytes): 0x20, 0x80, 0x40, 0x60, 0, 0 -> false, false // test(bytes): 0x20, 0xC0, 0x40, 0x80, 1, 0x42, 1, 0x42 -> false, false diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol index 6b6e55e02241..0574c4dd2c04 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol @@ -7,5 +7,8 @@ contract C { return abi.decode(data, (uint256, bytes)); } } + +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol index 9ae6602f310f..b3eb6724da34 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol @@ -3,5 +3,8 @@ contract C { return abi.decode(data, (uint256, bytes)); } } + +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol index af37480a3798..d08e2ff822af 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol @@ -6,5 +6,6 @@ contract C { return abi.decode(data, (uint256, bytes)); } } + // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" From f574d8ec3ae1e4c499a7f15275789fee44b5c6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 26 May 2020 22:18:41 +0200 Subject: [PATCH 131/479] Don't assume that an expression cannot be associated with a function declaration --- .../codegen/ir/IRGeneratorForStatements.cpp | 2 -- .../call_internal_function_via_expression.sol | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 98c0b2169501..f5591f4ae1b1 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -675,8 +675,6 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) solAssert(functionDef->isImplemented(), ""); } - else - solAssert(!functionType->hasDeclaration(), ""); solAssert(!functionType->takesArbitraryParameters(), ""); diff --git a/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol b/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol new file mode 100644 index 000000000000..ebe52b3e578d --- /dev/null +++ b/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol @@ -0,0 +1,24 @@ +contract C { + function foo() internal returns (uint) { + return 42; + } + + function get_ptr(function() internal returns (uint) ptr) internal returns(function() internal returns (uint)) { + return ptr; + } + + function associated() public returns (uint) { + // This expression directly references function definition + return (foo)(); + } + + function unassociated() public returns (uint) { + // This expression is not associated with a specific function definition + return (get_ptr(foo))(); + } +} +// ==== +// compileViaYul: also +// ---- +// associated() -> 42 +// unassociated() -> 42 From 75df2342d6766ce6576f731fe85c49ae888c10a0 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 27 May 2020 09:39:45 +0200 Subject: [PATCH 132/479] Adding some debug messages to bytecode store. --- scripts/bytecodecompare/storebytecode.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index f2b3a38972db..185465bc9bb4 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -107,8 +107,10 @@ for (var optimize of [false, true]) } } EOF + echo "Running the compiler..." chmod +x solc ./solc *.sol > report.txt + echo "Finished running the compiler." else $REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/$BUILD_DIR/solc/solc fi @@ -138,6 +140,9 @@ EOF else echo "Adding report failed, it might already exist in the repository." fi + else + echo "Not storing bytecode because the keys are not available." fi ) rm -rf "$TMPDIR" +echo "Storebytecode finished." \ No newline at end of file From 421f9f387661c7ba78230c51a19fd145d2551148 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 27 May 2020 11:12:40 +0200 Subject: [PATCH 133/479] Disable smt checker for bytecodecompare. --- scripts/bytecodecompare/prepare_report.py | 5 ++++- scripts/bytecodecompare/storebytecode.sh | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/bytecodecompare/prepare_report.py b/scripts/bytecodecompare/prepare_report.py index 74178c758213..cd5ee7491932 100755 --- a/scripts/bytecodecompare/prepare_report.py +++ b/scripts/bytecodecompare/prepare_report.py @@ -8,10 +8,13 @@ SOLC_BIN = sys.argv[1] REPORT_FILE = open("report.txt", mode="w", encoding='utf8', newline='\n') +def removeSMT(source): + return source.replace('pragma experimental SMTChecker;', '') + for optimize in [False, True]: for f in sorted(glob.glob("*.sol")): sources = {} - sources[f] = {'content': open(f, mode='r', encoding='utf8').read()} + sources[f] = {'content': removeSMT(open(f, mode='r', encoding='utf8').read())} input_json = { 'language': 'Solidity', 'sources': sources, diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index 185465bc9bb4..02530db03749 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -64,6 +64,11 @@ var fs = require('fs') var compiler = require('./solc-js/wrapper.js')(require('./solc-js/soljson.js')) +function removeSMT(source) +{ + return source.replace('pragma experimental SMTChecker;', ''); +} + for (var optimize of [false, true]) { for (var filename of process.argv.slice(2)) @@ -71,7 +76,7 @@ for (var optimize of [false, true]) if (filename !== undefined) { var inputs = {} - inputs[filename] = { content: fs.readFileSync(filename).toString() } + inputs[filename] = { content: removeSMT(fs.readFileSync(filename).toString()) } var input = { language: 'Solidity', sources: inputs, From a7b89065ca16daa4558890c79b8cb5c959587803 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Fri, 15 May 2020 18:59:57 -0500 Subject: [PATCH 134/479] [yul] Add support for EVM version-dependent rules. --- libevmasm/RuleList.h | 33 +++++++++++++++++++ libevmasm/SimplificationRules.cpp | 2 +- libyul/optimiser/SimplificationRules.cpp | 21 ++++++++---- libyul/optimiser/SimplificationRules.h | 12 ++++--- .../selfbalance_not_supported.yul | 9 +++++ .../selfbalance_split.yul | 13 ++++++++ .../selfbalance_supported.yul | 9 +++++ 7 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_not_supported.yul create mode 100644 test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_split.yul create mode 100644 test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_supported.yul diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index cd6eda81d9df..e29141b494ad 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -29,6 +29,10 @@ #include +#include +#include +#include + #include #include @@ -657,12 +661,37 @@ std::vector> simplificationRuleListPart9( return rules; } +template +std::vector> evmRuleList( + langutil::EVMVersion _evmVersion, + Pattern, + Pattern, + Pattern, + Pattern, + Pattern, + Pattern, + Pattern +) +{ + using Builtins = typename Pattern::Builtins; + std::vector> rules; + + if (_evmVersion.hasSelfBalance()) + rules.push_back({ + Builtins::BALANCE(Instruction::ADDRESS), + []() -> Pattern { return Instruction::SELFBALANCE; }, false + }); + + return rules; +} + /// @returns a list of simplification rules given certain match placeholders. /// A, B and C should represent constants, W, X, Y, and Z arbitrary expressions. /// The simplifications should never change the order of evaluation of /// arbitrary operations. template std::vector> simplificationRuleList( + std::optional _evmVersion, Pattern A, Pattern B, Pattern C, @@ -691,6 +720,10 @@ std::vector> simplificationRuleList( rules += simplificationRuleListPart7(A, B, C, W, X); rules += simplificationRuleListPart8(A, B, C, W, X); rules += simplificationRuleListPart9(A, B, C, W, X, Y, Z); + + if (_evmVersion.has_value()) + rules += evmRuleList(*_evmVersion, A, B, C, W, X, Y, Z); + return rules; } diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index 8fb65d1d3620..c4cc598639b1 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -92,7 +92,7 @@ Rules::Rules() Y.setMatchGroup(6, m_matchGroups); Z.setMatchGroup(7, m_matchGroups); - addRules(simplificationRuleList(A, B, C, W, X, Y, Z)); + addRules(simplificationRuleList(nullopt, A, B, C, W, X, Y, Z)); assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized."); } diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp index 0d70fbf3851c..7a9b6576a633 100644 --- a/libyul/optimiser/SimplificationRules.cpp +++ b/libyul/optimiser/SimplificationRules.cpp @@ -36,7 +36,7 @@ using namespace solidity::evmasm; using namespace solidity::langutil; using namespace solidity::yul; -SimplificationRule const* SimplificationRules::findFirstMatch( +SimplificationRules::Rule const* SimplificationRules::findFirstMatch( Expression const& _expr, Dialect const& _dialect, map const& _ssaValues @@ -46,7 +46,16 @@ SimplificationRule const* SimplificationRules::findFirstMatch( if (!instruction) return nullptr; - static SimplificationRules rules; + static std::map, std::unique_ptr> evmRules; + + std::optional version; + if (yul::EVMDialect const* evmDialect = dynamic_cast(&_dialect)) + version = evmDialect->evmVersion(); + + if (!evmRules[version]) + evmRules[version] = std::make_unique(version); + + SimplificationRules& rules = *evmRules[version]; assertThrow(rules.isInitialized(), OptimizerException, "Rule list not properly initialized."); for (auto const& rule: rules.m_rules[uint8_t(instruction->first)]) @@ -76,18 +85,18 @@ std::optional const*>> return {}; } -void SimplificationRules::addRules(vector> const& _rules) +void SimplificationRules::addRules(std::vector const& _rules) { for (auto const& r: _rules) addRule(r); } -void SimplificationRules::addRule(SimplificationRule const& _rule) +void SimplificationRules::addRule(Rule const& _rule) { m_rules[uint8_t(_rule.pattern.instruction())].push_back(_rule); } -SimplificationRules::SimplificationRules() +SimplificationRules::SimplificationRules(std::optional _evmVersion) { // Multiple occurrences of one of these inside one rule must match the same equivalence class. // Constants. @@ -107,7 +116,7 @@ SimplificationRules::SimplificationRules() Y.setMatchGroup(6, m_matchGroups); Z.setMatchGroup(7, m_matchGroups); - addRules(simplificationRuleList(A, B, C, W, X, Y, Z)); + addRules(simplificationRuleList(_evmVersion, A, B, C, W, X, Y, Z)); assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized."); } diff --git a/libyul/optimiser/SimplificationRules.h b/libyul/optimiser/SimplificationRules.h index 1a438ce3680b..b897ed492b95 100644 --- a/libyul/optimiser/SimplificationRules.h +++ b/libyul/optimiser/SimplificationRules.h @@ -27,6 +27,8 @@ #include +#include + #include #include @@ -45,12 +47,14 @@ class Pattern; class SimplificationRules: public boost::noncopyable { public: - SimplificationRules(); + using Rule = evmasm::SimplificationRule; + + explicit SimplificationRules(std::optional _evmVersion = std::nullopt); /// @returns a pointer to the first matching pattern and sets the match /// groups accordingly. /// @param _ssaValues values of variables that are assigned exactly once. - static evmasm::SimplificationRule const* findFirstMatch( + static Rule const* findFirstMatch( Expression const& _expr, Dialect const& _dialect, std::map const& _ssaValues @@ -64,8 +68,8 @@ class SimplificationRules: public boost::noncopyable instructionAndArguments(Dialect const& _dialect, Expression const& _expr); private: - void addRules(std::vector> const& _rules); - void addRule(evmasm::SimplificationRule const& _rule); + void addRules(std::vector const& _rules); + void addRule(Rule const& _rule); void resetMatchGroups() { m_matchGroups.clear(); } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_not_supported.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_not_supported.yul new file mode 100644 index 000000000000..693c05c42829 --- /dev/null +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_not_supported.yul @@ -0,0 +1,9 @@ +{ + let ret := balance(address()) +} +// ==== +// EVMVersion: =istanbul +// ---- +// step: expressionSimplifier +// +// { +// let a := address() +// let ret := selfbalance() +// } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_supported.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_supported.yul new file mode 100644 index 000000000000..7b0a7524e45f --- /dev/null +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/selfbalance_supported.yul @@ -0,0 +1,9 @@ +{ + let ret := balance(address()) +} +// ==== +// EVMVersion: >=istanbul +// ---- +// step: expressionSimplifier +// +// { let ret := selfbalance() } From b7fa5d5040a5735f9f07a378997c527740778fbb Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Tue, 12 May 2020 17:09:25 +0200 Subject: [PATCH 135/479] Mark EVM instruction `pc()` as deprecated when used in inline assembly. --- Changelog.md | 1 + libsolidity/analysis/SyntaxChecker.cpp | 1 + libyul/AsmAnalysis.cpp | 15 +++++++- libyul/AsmAnalysis.h | 5 +++ libyul/optimiser/Semantics.cpp | 1 - .../syntaxTests/inlineAssembly/pc.sol | 9 +++++ test/libyul/ewasmTranslationTests/pc.yul | 8 ---- .../yulInterpreterTests/side_effect_free.yul | 1 - .../fullSuite/stack_compressor_msize.yul | 37 ++++++++++++++----- .../stackCompressor/unusedPrunerWithMSize.yul | 20 +++++----- test/libyul/yulSyntaxTests/pc.yul | 7 ++++ 11 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/pc.sol delete mode 100644 test/libyul/ewasmTranslationTests/pc.yul create mode 100644 test/libyul/yulSyntaxTests/pc.yul diff --git a/Changelog.md b/Changelog.md index ad568e6ae9dd..9e58b2c17efe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ Language Features: * Permit calldata location for all variables. + * Yul: EVM instruction `pc()` is marked deprecated and will be removed in the next breaking release. Compiler Features: diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 86204e88e8c4..267d5764fd66 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -273,6 +273,7 @@ bool SyntaxChecker::visit(InlineAssembly const& _inlineAssembly) "The msize instruction cannot be used when the Yul optimizer is activated because " "it can change its semantics. Either disable the Yul optimizer or do not use the instruction." ); + return false; } diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 80c90650d501..fd8e44dfab8b 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -73,7 +73,7 @@ AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(Dialect const& _dialect, {}, _object.dataNames() ).analyze(*_object.code); - yulAssert(success && errorList.empty(), "Invalid assembly/yul code."); + yulAssert(success && !errors.hasErrors(), "Invalid assembly/yul code."); return analysisInfo; } @@ -259,6 +259,8 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) returnTypes = &f->returns; if (f->literalArguments) needsLiteralArguments = &f->literalArguments.value(); + + warnOnInstructions(_funCall); } else if (!m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{ [&](Scope::Variable const&) @@ -275,10 +277,11 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) } })) { - if (!warnOnInstructions(_funCall.functionName.name.str(), _funCall.functionName.location)) + if (!warnOnInstructions(_funCall)) declarationError(_funCall.functionName.location, "Function not found."); yulAssert(!watcher.ok(), "Expected a reported error."); } + if (parameterTypes && _funCall.arguments.size() != parameterTypes->size()) typeError( _funCall.functionName.location, @@ -553,6 +556,14 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation errorForVM("only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID()) errorForVM("only available for Istanbul-compatible"); + else if (_instr == evmasm::Instruction::PC) + m_errorReporter.warning( + 2450_error, + _location, + "The \"" + + boost::to_lower_copy(instructionInfo(_instr).name) + + "\" instruction is deprecated and will be removed in the next breaking release." + ); else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) errorForVM("only available for Istanbul-compatible"); else if ( diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index bbc37bedb6af..438c31bbdd64 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -112,6 +112,11 @@ class AsmAnalyzer bool warnOnInstructions(evmasm::Instruction _instr, langutil::SourceLocation const& _location); bool warnOnInstructions(std::string const& _instrIdentifier, langutil::SourceLocation const& _location); + bool warnOnInstructions(FunctionCall const& _functionCall) + { + return warnOnInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); + } + void typeError(langutil::SourceLocation const& _location, std::string const& _description); void declarationError(langutil::SourceLocation const& _location, std::string const& _description); diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 1e2dcb1047aa..a6f41b8445e6 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -90,7 +90,6 @@ void MSizeFinder::operator()(FunctionCall const& _functionCall) m_msizeFound = true; } - map SideEffectsPropagator::sideEffects( Dialect const& _dialect, CallGraph const& _directCallGraph diff --git a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol new file mode 100644 index 000000000000..08b0238894e5 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol @@ -0,0 +1,9 @@ +contract C { + function f() pure public { + assembly { + pop(pc()) + } + } +} +// ---- +// Warning: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release. diff --git a/test/libyul/ewasmTranslationTests/pc.yul b/test/libyul/ewasmTranslationTests/pc.yul deleted file mode 100644 index 16d98dec8074..000000000000 --- a/test/libyul/ewasmTranslationTests/pc.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - sstore(0, pc()) -} -// ---- -// Trace: -// INVALID() -// Memory dump: -// Storage dump: diff --git a/test/libyul/yulInterpreterTests/side_effect_free.yul b/test/libyul/yulInterpreterTests/side_effect_free.yul index 8eac1f5a99f0..1b8107646ffc 100644 --- a/test/libyul/yulInterpreterTests/side_effect_free.yul +++ b/test/libyul/yulInterpreterTests/side_effect_free.yul @@ -6,7 +6,6 @@ pop(extcodehash(0)) pop(returndatasize()) pop(sload(0)) - pop(pc()) pop(msize()) pop(mload(0)) pop(sload(0)) diff --git a/test/libyul/yulOptimizerTests/fullSuite/stack_compressor_msize.yul b/test/libyul/yulOptimizerTests/fullSuite/stack_compressor_msize.yul index 961abd72c48d..56a2d6cfe0c5 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/stack_compressor_msize.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/stack_compressor_msize.yul @@ -1,10 +1,23 @@ { let a + function gcd(_a, _b) -> out + { + // GCD algorithm. in order to test underlying stack compressor this function must not be inlined. + switch _b + case 0 { out := _a } + default { out := gcd(_b, mod(_a, _b)) } + } + + function f() -> out + { + out := gcd(10, 15) + } + function foo_singlereturn_0() -> out { - mstore(lt(or(gt(1,or(or(gt(or(or(or(1,gt(or(gt(or(or(keccak256(pc(),or(gt(not(pc()),1),1)),1),not(1)),pc()),1),pc())),lt(or(1,sub(pc(),1)),1)),pc()),1),1),gt(not(pc()),1))),1),1),1) - sstore(not(pc()),1) + mstore(lt(or(gt(1,or(or(gt(or(or(or(1,gt(or(gt(or(or(keccak256(f(),or(gt(not(f()),1),1)),1),not(1)),f()),1),f())),lt(or(1,sub(f(),1)),1)),f()),1),1),gt(not(f()),1))),1),1),1) + sstore(not(f()),1) } function foo_singlereturn_1(in_1, in_2) -> out @@ -25,21 +38,27 @@ // // { // { -// let _1 := gt(not(pc()), 1) -// let _2 := pc() +// let _1 := gt(not(gcd(10, 15)), 1) +// let _2 := gcd(10, 15) // let _3 := not(0) -// let _4 := lt(or(1, add(pc(), _3)), 1) -// let _5 := pc() -// let _6 := pc() -// pop(keccak256(pc(), or(gt(not(pc()), 1), 1))) +// let _4 := lt(or(1, add(gcd(10, 15), _3)), 1) +// let _5 := gcd(10, 15) +// let _6 := gcd(10, 15) +// pop(keccak256(gcd(10, 15), or(gt(not(gcd(10, 15)), 1), 1))) // mstore(lt(or(gt(1, or(or(gt(or(or(or(gt(or(gt(_3, _6), 1), _5), _4), _2), 1), 1), _1), 1)), 1), 1), 1) -// sstore(not(pc()), 1) +// sstore(not(gcd(10, 15)), 1) // sstore(0, 0) // sstore(2, 1) // pop(foo_singlereturn_1(calldataload(0), calldataload(3))) // sstore(0, 0) // sstore(3, 1) // } +// function gcd(_a, _b) -> out +// { +// switch _b +// case 0 { out := _a } +// default { out := gcd(_b, mod(_a, _b)) } +// } // function foo_singlereturn_1(in, in_1) -> out // { extcodecopy(1, msize(), 1, 1) } // } diff --git a/test/libyul/yulOptimizerTests/stackCompressor/unusedPrunerWithMSize.yul b/test/libyul/yulOptimizerTests/stackCompressor/unusedPrunerWithMSize.yul index 279c0d90145b..7e3acd9b62e7 100644 --- a/test/libyul/yulOptimizerTests/stackCompressor/unusedPrunerWithMSize.yul +++ b/test/libyul/yulOptimizerTests/stackCompressor/unusedPrunerWithMSize.yul @@ -1,11 +1,11 @@ { { let _13_71 := 1 - let _17_72 := pc() - let _22_75 := pc() - let _25_76 := pc() - let _30_80 := pc() - let _32_81 := pc() + let _17_72 := msize() + let _22_75 := msize() + let _25_76 := msize() + let _30_80 := msize() + let _32_81 := msize() // This should not be removed pop(keccak256(1, 2)) let _104 := gt(not(_17_72), _13_71) @@ -22,11 +22,11 @@ // step: stackCompressor // // { -// let _17_72 := pc() -// let _22_75 := pc() -// let _25_76 := pc() -// let _30_80 := pc() -// let _32_81 := pc() +// let _17_72 := msize() +// let _22_75 := msize() +// let _25_76 := msize() +// let _30_80 := msize() +// let _32_81 := msize() // pop(keccak256(1, 2)) // let _105 := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff // mstore(lt(or(gt(1, or(or(gt(or(or(or(gt(or(gt(_105, _32_81), 1), _30_80), lt(or(1, add(_25_76, _105)), 1)), _22_75), 1), 1), gt(not(_17_72), 1)), 1)), 1), 1), 1) diff --git a/test/libyul/yulSyntaxTests/pc.yul b/test/libyul/yulSyntaxTests/pc.yul new file mode 100644 index 000000000000..04804f150f3c --- /dev/null +++ b/test/libyul/yulSyntaxTests/pc.yul @@ -0,0 +1,7 @@ +{ + pop(pc()) +} +// ==== +// dialect: evmTyped +// ---- +// Warning: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release. From 09485058d89b0187e7919cdcc7e39f586d03109d Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 13 May 2020 13:51:49 +0200 Subject: [PATCH 136/479] Adds ``--base-path` to solc when compiling in `--standard-json` mode for resolving relative paths. --- Changelog.md | 1 + docs/using-the-compiler.rst | 8 ++++++++ solc/CommandLineInterface.cpp | 23 ++++++++++++++++++++++- solc/CommandLineInterface.h | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index ad568e6ae9dd..cba4521a0a4b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Language Features: Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. + * Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree instead of the root of the filesystem. * SMTChecker: Support array ``length``. * SMTChecker: Support array ``push`` and ``pop``. * Add support for natspec comments on state variables. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 9009fac016f7..3f0252884d7b 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -44,8 +44,15 @@ An empty remapping prefix is not allowed. If there are multiple matches due to remappings, the one with the longest common prefix is selected. +When accessing the filesystem to search for imports, all paths are treated as if they were fully qualified paths. +This behaviour can be customized by adding the command line option ``--base-path`` with a path to be prepended +before each filesystem access for imports is performed. Furthermore, the part added via ``--base-path`` +will not appear in the contract metadata. + For security reasons the compiler has restrictions what directories it can access. Paths (and their subdirectories) of source files specified on the commandline and paths defined by remappings are allowed for import statements, but everything else is rejected. Additional paths (and their subdirectories) can be allowed via the ``--allow-paths /sample/path,/another/sample/path`` switch. +Everything inside the path specified via ``--base-path`` is always allowed. + If your contracts use :ref:`libraries `, you will notice that the bytecode contains substrings of the form ``__$53aea86b7d70b31448b230b20ae141a537$__``. These are placeholders for the actual library addresses. The placeholder is a 34 character prefix of the hex encoding of the keccak256 hash of the fully qualified library name. The bytecode file will also contain lines of the form ``// -> `` at the end to help @@ -58,6 +65,7 @@ Either add ``--libraries "file.sol:Math:0x12345678901234567890123456789012345678 If ``solc`` is called with the option ``--link``, all input files are interpreted to be unlinked binaries (hex-encoded) in the ``__$53aea86b7d70b31448b230b20ae141a537$__``-format given above and are linked in-place (if the input is read from stdin, it is written to stdout). All options except ``--libraries`` are ignored (including ``-o``) in this case. If ``solc`` is called with the option ``--standard-json``, it will expect a JSON input (as explained below) on the standard input, and return a JSON output on the standard output. This is the recommended interface for more complex and especially automated uses. The process will always terminate in a "success" state and report any errors via the JSON output. +The option ``--base-path`` is also processed in standard-json mode. .. note:: The library placeholder used to be the fully qualified name of the library itself diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index cd792d9c085b..a8e5cc5b7fba 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -107,6 +107,7 @@ std::ostream& serr(bool _used = true) static string const g_stdinFileNameStr = ""; static string const g_strAbi = "abi"; static string const g_strAllowPaths = "allow-paths"; +static string const g_strBasePath = "base-path"; static string const g_strAsm = "asm"; static string const g_strAsmJson = "asm-json"; static string const g_strAssemble = "assemble"; @@ -181,6 +182,7 @@ static string const g_strOldReporter = "old-reporter"; static string const g_argAbi = g_strAbi; static string const g_argPrettyJson = g_strPrettyJson; static string const g_argAllowPaths = g_strAllowPaths; +static string const g_argBasePath = g_strBasePath; static string const g_argAsm = g_strAsm; static string const g_argAsmJson = g_strAsmJson; static string const g_argAssemble = g_strAssemble; @@ -830,6 +832,11 @@ Allowed options)").c_str(), po::value()->value_name("path(s)"), "Allow a given path for imports. A list of paths can be supplied by separating them with a comma." ) + ( + g_argBasePath.c_str(), + po::value()->value_name("path"), + "Use the given path as the root of the source tree instead of the root of the filesystem." + ) (g_argColor.c_str(), "Force colored output.") (g_argNoColor.c_str(), "Explicitly disable colored output, disabling terminal auto-detection.") (g_argOldReporter.c_str(), "Enables old diagnostics reporter.") @@ -965,7 +972,8 @@ bool CommandLineInterface::processInput() string validPath = _path; if (validPath.find("file://") == 0) validPath.erase(0, 7); - auto path = boost::filesystem::path(validPath); + + auto const path = m_basePath / validPath; auto canonicalPath = boost::filesystem::weakly_canonical(path); bool isAllowed = false; for (auto const& allowedDir: m_allowedDirectories) @@ -1003,6 +1011,19 @@ bool CommandLineInterface::processInput() } }; + if (m_args.count(g_argBasePath)) + { + boost::filesystem::path const fspath{m_args[g_argBasePath].as()}; + if (!boost::filesystem::is_directory(fspath)) + { + serr() << "Base path must be a directory: \"" << fspath << "\"\n"; + return false; + } + m_basePath = fspath; + if (!contains(m_allowedDirectories, fspath)) + m_allowedDirectories.push_back(fspath); + } + if (m_args.count(g_argAllowPaths)) { vector paths; diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 446ea822489d..00b9181ec069 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -117,6 +117,8 @@ class CommandLineInterface std::vector m_remappings; /// list of allowed directories to read files from std::vector m_allowedDirectories; + /// Base path, used for resolving relative paths in imports. + boost::filesystem::path m_basePath; /// map of library names to addresses std::map m_libraries; /// Solidity compiler stack From 7548441b4fb394012d0f14c5058bc8da8413fe56 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 27 May 2020 12:13:37 +0200 Subject: [PATCH 137/479] Check for wrong error codes in the CI --- .circleci/config.yml | 10 ++++++++++ scripts/correct_error_ids.py | 38 ++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) mode change 100644 => 100755 scripts/correct_error_ids.py diff --git a/.circleci/config.yml b/.circleci/config.yml index a34649d740ab..7f2b46a0c74b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -316,6 +316,15 @@ jobs: name: checking shell scripts command: ./scripts/chk_shellscripts/chk_shellscripts.sh + chk_errorcodes: + docker: + - image: circleci/python:3.6 + steps: + - checkout + - run: + name: Check for error codes + command: ./scripts/correct_error_ids.py --noconfirm + chk_pylint: docker: - image: buildpack-deps:eoan @@ -845,6 +854,7 @@ workflows: - chk_buglist: *workflow_trigger_on_tags - chk_proofs: *workflow_trigger_on_tags - chk_pylint: *workflow_trigger_on_tags + - chk_errorcodes: *workflow_trigger_on_tags - chk_antlr_grammar: *workflow_trigger_on_tags - chk_docs_pragma_min_version: *workflow_trigger_on_tags diff --git a/scripts/correct_error_ids.py b/scripts/correct_error_ids.py old mode 100644 new mode 100755 index cce8285deda7..cbbad8264d1d --- a/scripts/correct_error_ids.py +++ b/scripts/correct_error_ids.py @@ -1,6 +1,9 @@ +#! /usr/bin/env python3 import random import re import os +import getopt +import sys from os import path ENCODING = "utf-8" @@ -115,19 +118,28 @@ def find_source_files(top_dir): return source_file_names -def main(): +def main(argv): + noconfirm = False + opts, args = getopt.getopt(argv, "", ["noconfirm"]) + + for opt, arg in opts: + if opt == '--noconfirm': + noconfirm = True + random.seed() cwd = os.getcwd() - answer = input( - f"This script checks and corrects *_error literals in .h and .cpp files\n" - f"in {cwd}, recursively.\n\n" - f"Please commit current changes first, and review the results when the script finishes.\n\n" - f"Do you want to start [Y/N]? " - ) - while len(answer) == 0 or answer not in "YNyn": - answer = input("[Y/N]? ") - if answer not in "yY": - return + + if not noconfirm: + answer = input( + f"This script checks and corrects *_error literals in .h and .cpp files\n" + f"in {cwd}, recursively.\n\n" + f"Please commit current changes first, and review the results when the script finishes.\n\n" + f"Do you want to start [Y/N]? " + ) + while len(answer) == 0 or answer not in "YNyn": + answer = input("[Y/N]? ") + if answer not in "yY": + exit(0) source_file_names = find_source_files(cwd) @@ -147,10 +159,12 @@ def main(): if ok: print("No incorrect IDs found") + exit(0) else: fix_ids(used_ids, source_file_names) print("Fixing completed") + exit(1) if __name__ == "__main__": - main() + main(sys.argv[1:]) From eb923af09cd0b1d77d63cd242641612969bffeab Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 17:24:52 +0200 Subject: [PATCH 138/479] Do not set source locations for small internal assembly routines. --- Changelog.md | 1 + libevmasm/Assembly.h | 1 + liblangutil/ParserBase.h | 2 +- libsolidity/codegen/CompilerContext.cpp | 7 +++- libyul/AsmParser.h | 17 ++++++++-- .../optimizer_BlockDeDuplicator/output | 16 --------- test/cmdlineTests/optimizer_user_yul/output | 3 -- .../standard_immutable_references/output.json | 2 +- test/libsolidity/Assembly.cpp | 28 +++------------ test/libsolidity/StandardCompiler.cpp | 34 +++++++++---------- 10 files changed, 46 insertions(+), 65 deletions(-) diff --git a/Changelog.md b/Changelog.md index d19d08be2656..ca31a970072a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Language Features: Compiler Features: + * Code Generator: Do not introduce new source references for small internal routines. * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. * SMTChecker: Support array ``length``. * SMTChecker: Support array ``push`` and ``pop``. diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index 27d825268bf2..e82fee7ddda4 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -97,6 +97,7 @@ class Assembly /// Changes the source location used for each appended item. void setSourceLocation(langutil::SourceLocation const& _location) { m_currentSourceLocation = _location; } + langutil::SourceLocation const& currentSourceLocation() const { return m_currentSourceLocation; } /// Assembles the assembly into bytecode. The assembly should not be modified after this call, since the assembled version is cached. LinkerObject const& assemble() const; diff --git a/liblangutil/ParserBase.h b/liblangutil/ParserBase.h index bb4123b9f58c..0f61460059f6 100644 --- a/liblangutil/ParserBase.h +++ b/liblangutil/ParserBase.h @@ -64,7 +64,7 @@ class ParserBase }; /// Location of the current token - SourceLocation currentLocation() const; + virtual SourceLocation currentLocation() const; ///@{ ///@name Helper functions diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 9431ecec6a61..9e2c0663bdd6 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -422,7 +422,12 @@ void CompilerContext::appendInlineAssembly( ErrorReporter errorReporter(errors); auto scanner = make_shared(langutil::CharStream(_assembly, "--CODEGEN--")); yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion); - shared_ptr parserResult = yul::Parser(errorReporter, dialect).parse(scanner, false); + optional locationOverride; + if (!_system) + locationOverride = m_asm->currentSourceLocation(); + shared_ptr parserResult = + yul::Parser(errorReporter, dialect, std::move(locationOverride)) + .parse(scanner, false); #ifdef SOL_OUTPUT_ASM cout << yul::AsmPrinter(&dialect)(*parserResult) << endl; #endif diff --git a/libyul/AsmParser.h b/libyul/AsmParser.h index 54c79a0e7e61..3c70abd7ef3c 100644 --- a/libyul/AsmParser.h +++ b/libyul/AsmParser.h @@ -46,8 +46,15 @@ class Parser: public langutil::ParserBase None, ForLoopPre, ForLoopPost, ForLoopBody }; - explicit Parser(langutil::ErrorReporter& _errorReporter, Dialect const& _dialect): - ParserBase(_errorReporter), m_dialect(_dialect) {} + explicit Parser( + langutil::ErrorReporter& _errorReporter, + Dialect const& _dialect, + std::optional _locationOverride = {} + ): + ParserBase(_errorReporter), + m_dialect(_dialect), + m_locationOverride(std::move(_locationOverride)) + {} /// Parses an inline assembly block starting with `{` and ending with `}`. /// @param _reuseScanner if true, do check for end of input after the `}`. @@ -60,6 +67,11 @@ class Parser: public langutil::ParserBase protected: using ElementaryOperation = std::variant; + langutil::SourceLocation currentLocation() const override + { + return m_locationOverride ? *m_locationOverride : ParserBase::currentLocation(); + } + /// Creates an inline assembly node with the current source location. template T createWithLocation() const { @@ -91,6 +103,7 @@ class Parser: public langutil::ParserBase private: Dialect const& m_dialect; + std::optional m_locationOverride; ForLoopComponent m_currentForLoopComponent = ForLoopComponent::None; bool m_insideFunction = false; }; diff --git a/test/cmdlineTests/optimizer_BlockDeDuplicator/output b/test/cmdlineTests/optimizer_BlockDeDuplicator/output index 6f11f97a4dad..e5c45e53e209 100644 --- a/test/cmdlineTests/optimizer_BlockDeDuplicator/output +++ b/test/cmdlineTests/optimizer_BlockDeDuplicator/output @@ -19,20 +19,14 @@ EVM assembly: sstore /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ callvalue - /* "--CODEGEN--":2:4 */ dup1 iszero tag_5 jumpi - /* "--CODEGEN--":27:28 */ 0x00 - /* "--CODEGEN--":24:25 */ dup1 - /* "--CODEGEN--":17:29 */ revert - /* "--CODEGEN--":2:4 */ tag_5: - /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ pop jump(tag_6) /* "optimizer_BlockDeDuplicator/input.sol":77:103 function fun_x() public {} */ @@ -53,21 +47,14 @@ sub_0: assembly { /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ mstore(0x40, 0x80) callvalue - /* "--CODEGEN--":5:14 */ dup1 - /* "--CODEGEN--":2:4 */ iszero tag_1 jumpi - /* "--CODEGEN--":27:28 */ 0x00 - /* "--CODEGEN--":24:25 */ dup1 - /* "--CODEGEN--":17:29 */ revert - /* "--CODEGEN--":2:4 */ tag_1: - /* "optimizer_BlockDeDuplicator/input.sol":60:213 contract C {... */ pop jumpi(tag_2, lt(calldatasize, 0x04)) shr(0xe0, calldataload(0x00)) @@ -87,11 +74,8 @@ sub_0: assembly { tag_3 jumpi tag_2: - /* "--CODEGEN--":12:13 */ 0x00 - /* "--CODEGEN--":9:10 */ dup1 - /* "--CODEGEN--":2:14 */ revert /* "optimizer_BlockDeDuplicator/input.sol":138:174 function f() public { true ? 1 : 3;} */ tag_3: diff --git a/test/cmdlineTests/optimizer_user_yul/output b/test/cmdlineTests/optimizer_user_yul/output index a160c37c4e45..340d709140af 100644 --- a/test/cmdlineTests/optimizer_user_yul/output +++ b/test/cmdlineTests/optimizer_user_yul/output @@ -76,11 +76,8 @@ stop sub_0: assembly { /* "optimizer_user_yul/input.sol":60:525 contract C... */ mstore(0x40, 0x80) - /* "--CODEGEN--":12:13 */ 0x00 - /* "--CODEGEN--":9:10 */ dup1 - /* "--CODEGEN--":2:14 */ revert auxdata: AUXDATA REMOVED diff --git a/test/cmdlineTests/standard_immutable_references/output.json b/test/cmdlineTests/standard_immutable_references/output.json index edb5d74d0255..f39a67c07a5d 100644 --- a/test/cmdlineTests/standard_immutable_references/output.json +++ b/test/cmdlineTests/standard_immutable_references/output.json @@ -1,2 +1,2 @@ -{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;36:96:0;;;;;;;;;;;;;;;;12:1:-1;9;2:12;74:56:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}} diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 898de1427c0b..0484bf95cc00 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -107,13 +107,13 @@ void printAssemblyLocations(AssemblyItems const& _items) cout << "\t\tvector(" << _repetitions << - ", SourceLocation(" << + ", SourceLocation{" << _loc.start << ", " << _loc.end << ", make_shared(\"" << _loc.source->name() << - "\"))) +" << endl; + "\")}) +" << endl; }; vector locations; @@ -175,33 +175,13 @@ BOOST_AUTO_TEST_CASE(location_test) vector locations; if (solidity::test::CommonOptions::get().optimize) locations = - vector(4, SourceLocation{2, 82, sourceCode}) + - vector(1, SourceLocation{5, 14, codegenCharStream}) + - vector(3, SourceLocation{2, 4, codegenCharStream}) + - vector(1, SourceLocation{27, 28, codegenCharStream}) + - vector(1, SourceLocation{24, 25, codegenCharStream}) + - vector(1, SourceLocation{17, 29, codegenCharStream}) + - vector(1, SourceLocation{2, 4, codegenCharStream}) + - vector(16, SourceLocation{2, 82, sourceCode}) + - vector(1, SourceLocation{12, 13, codegenCharStream}) + - vector(1, SourceLocation{9, 10, codegenCharStream}) + - vector(1, SourceLocation{2, 14, codegenCharStream}) + + vector(31, SourceLocation{2, 82, sourceCode}) + vector(21, SourceLocation{20, 79, sourceCode}) + vector(1, SourceLocation{72, 74, sourceCode}) + vector(2, SourceLocation{20, 79, sourceCode}); else locations = - vector(4, SourceLocation{2, 82, sourceCode}) + - vector(1, SourceLocation{5, 14, codegenCharStream}) + - vector(3, SourceLocation{2, 4, codegenCharStream}) + - vector(1, SourceLocation{27, 28, codegenCharStream}) + - vector(1, SourceLocation{24, 25, codegenCharStream}) + - vector(1, SourceLocation{17, 29, codegenCharStream}) + - vector(1, SourceLocation{2, 4, codegenCharStream}) + - vector(hasShifts ? 16 : 17, SourceLocation{2, 82, sourceCode}) + - vector(1, SourceLocation{12, 13, codegenCharStream}) + - vector(1, SourceLocation{9, 10, codegenCharStream}) + - vector(1, SourceLocation{2, 14, codegenCharStream}) + + vector(hasShifts ? 31 : 32, SourceLocation{2, 82, sourceCode}) + vector(24, SourceLocation{20, 79, sourceCode}) + vector(1, SourceLocation{49, 58, sourceCode}) + vector(1, SourceLocation{72, 74, sourceCode}) + diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 5f4a4e3d4cea..3b7b1d1284f8 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -370,15 +370,15 @@ BOOST_AUTO_TEST_CASE(basic_compilation) BOOST_CHECK(contract["evm"]["assembly"].isString()); BOOST_CHECK(contract["evm"]["assembly"].asString().find( " /* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n " - "callvalue\n /* \"--CODEGEN--\":5:14 */\n dup1\n " - "/* \"--CODEGEN--\":2:4 */\n iszero\n tag_1\n jumpi\n " - "/* \"--CODEGEN--\":27:28 */\n 0x00\n /* \"--CODEGEN--\":24:25 */\n " - "dup1\n /* \"--CODEGEN--\":17:29 */\n revert\n /* \"--CODEGEN--\":2:4 */\n" - "tag_1:\n /* \"fileA\":0:14 contract A { } */\n pop\n dataSize(sub_0)\n dup1\n " + "callvalue\n dup1\n " + "iszero\n tag_1\n jumpi\n " + "0x00\n " + "dup1\n revert\n" + "tag_1:\n pop\n dataSize(sub_0)\n dup1\n " "dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n " - "/* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n " - "/* \"--CODEGEN--\":12:13 */\n 0x00\n /* \"--CODEGEN--\":9:10 */\n " - "dup1\n /* \"--CODEGEN--\":2:14 */\n revert\n\n auxdata: 0xa26469706673582212" + "/* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n " + "0x00\n " + "dup1\n revert\n\n auxdata: 0xa26469706673582212" ) == 0); BOOST_CHECK(contract["evm"]["gasEstimates"].isObject()); BOOST_CHECK_EQUAL(contract["evm"]["gasEstimates"].size(), 1); @@ -402,15 +402,15 @@ BOOST_AUTO_TEST_CASE(basic_compilation) "{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"source\":0,\"value\":\"40\"}," "{\"begin\":0,\"end\":14,\"name\":\"MSTORE\",\"source\":0}," "{\"begin\":0,\"end\":14,\"name\":\"CALLVALUE\",\"source\":0}," - "{\"begin\":5,\"end\":14,\"name\":\"DUP1\",\"source\":-1}," - "{\"begin\":2,\"end\":4,\"name\":\"ISZERO\",\"source\":-1}," - "{\"begin\":2,\"end\":4,\"name\":\"PUSH [tag]\",\"source\":-1,\"value\":\"1\"}," - "{\"begin\":2,\"end\":4,\"name\":\"JUMPI\",\"source\":-1}," - "{\"begin\":27,\"end\":28,\"name\":\"PUSH\",\"source\":-1,\"value\":\"0\"}," - "{\"begin\":24,\"end\":25,\"name\":\"DUP1\",\"source\":-1}," - "{\"begin\":17,\"end\":29,\"name\":\"REVERT\",\"source\":-1}," - "{\"begin\":2,\"end\":4,\"name\":\"tag\",\"source\":-1,\"value\":\"1\"}," - "{\"begin\":2,\"end\":4,\"name\":\"JUMPDEST\",\"source\":-1}," + "{\"begin\":0,\"end\":14,\"name\":\"DUP1\",\"source\":0}," + "{\"begin\":0,\"end\":14,\"name\":\"ISZERO\",\"source\":0}," + "{\"begin\":0,\"end\":14,\"name\":\"PUSH [tag]\",\"source\":0,\"value\":\"1\"}," + "{\"begin\":0,\"end\":14,\"name\":\"JUMPI\",\"source\":0}," + "{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"source\":0,\"value\":\"0\"}," + "{\"begin\":0,\"end\":14,\"name\":\"DUP1\",\"source\":0}," + "{\"begin\":0,\"end\":14,\"name\":\"REVERT\",\"source\":0}," + "{\"begin\":0,\"end\":14,\"name\":\"tag\",\"source\":0,\"value\":\"1\"}," + "{\"begin\":0,\"end\":14,\"name\":\"JUMPDEST\",\"source\":0}," "{\"begin\":0,\"end\":14,\"name\":\"POP\",\"source\":0}," "{\"begin\":0,\"end\":14,\"name\":\"PUSH #[$]\",\"source\":0,\"value\":\"0000000000000000000000000000000000000000000000000000000000000000\"}," "{\"begin\":0,\"end\":14,\"name\":\"DUP1\",\"source\":0}," From a846c18e67cbd1e5e4bf2d153f01f66e894cbb4e Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 27 May 2020 18:22:04 +0200 Subject: [PATCH 139/479] Fix failure to find overload resolution when overrides are involved --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 10 +++++----- .../inheritance/override/no_matching_resolution.sol | 11 +++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/no_matching_resolution.sol diff --git a/Changelog.md b/Changelog.md index d19d08be2656..36ac87428e59 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,7 @@ Bugfixes: * Type Checker: Disallow inline arrays of non-nameable types. * Type Checker: Fix internal compiler error when accessing members of array slices. * Type Checker: Fix internal compiler error when trying to decode too large static arrays. + * Type Checker: Fix wrong compiler error when referencing an overridden function without calling it. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 7681efc18cb1..e6694043ce77 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2981,7 +2981,11 @@ bool TypeChecker::visit(Identifier const& _identifier) if (!annotation.referencedDeclaration) { annotation.overloadedDeclarations = cleanOverloadedDeclarations(_identifier, annotation.candidateDeclarations); - if (!annotation.arguments) + if (annotation.overloadedDeclarations.empty()) + m_errorReporter.fatalTypeError(7593_error, _identifier.location(), "No candidates for overload resolution found."); + else if (annotation.overloadedDeclarations.size() == 1) + annotation.referencedDeclaration = *annotation.overloadedDeclarations.begin(); + else if (!annotation.arguments) { // The identifier should be a public state variable shadowing other functions vector candidates; @@ -2998,10 +3002,6 @@ bool TypeChecker::visit(Identifier const& _identifier) else m_errorReporter.fatalTypeError(7589_error, _identifier.location(), "No unique declaration found after variable lookup."); } - else if (annotation.overloadedDeclarations.empty()) - m_errorReporter.fatalTypeError(7593_error, _identifier.location(), "No candidates for overload resolution found."); - else if (annotation.overloadedDeclarations.size() == 1) - annotation.referencedDeclaration = *annotation.overloadedDeclarations.begin(); else { vector candidates; diff --git a/test/libsolidity/syntaxTests/inheritance/override/no_matching_resolution.sol b/test/libsolidity/syntaxTests/inheritance/override/no_matching_resolution.sol new file mode 100644 index 000000000000..870f2b736b37 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/no_matching_resolution.sol @@ -0,0 +1,11 @@ +contract A { + function f() virtual internal {} +} +contract B is A { + function f() virtual override internal {} + function h() pure internal { f; } +} +contract C is B { + function f() override internal {} + function i() pure internal { f; } +} From 9e9f0c52e1f300358efe6df77f7179b7a0188de7 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 13 May 2020 13:08:48 +0200 Subject: [PATCH 140/479] [SMTChecker] Support to bitwise --- Changelog.md | 2 + libsmtutil/CVC4Interface.cpp | 45 +++++++++++++++++++ libsmtutil/SMTLib2Interface.cpp | 37 ++++++++++++++- libsmtutil/SolverInterface.h | 34 ++++++++++++++ libsmtutil/Sorts.cpp | 10 ++++- libsmtutil/Sorts.h | 35 ++++++++++++++- libsmtutil/Z3Interface.cpp | 13 ++++++ libsolidity/formal/CHC.cpp | 6 +-- libsolidity/formal/SMTEncoder.cpp | 39 ++++++++++++++++ libsolidity/formal/SMTEncoder.h | 1 + libsolidity/formal/SymbolicState.h | 2 +- libsolidity/formal/SymbolicTypes.cpp | 20 +++++---- libsolidity/formal/SymbolicVariables.cpp | 2 +- .../operators/bitwise_and_int.sol | 18 ++++++++ .../operators/bitwise_and_rational.sol | 12 +++++ .../operators/bitwise_and_uint.sol | 18 ++++++++ 16 files changed, 277 insertions(+), 17 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol diff --git a/Changelog.md b/Changelog.md index d19d08be2656..40b4765cdb94 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,8 +9,10 @@ Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. * SMTChecker: Support array ``length``. * SMTChecker: Support array ``push`` and ``pop``. + * SMTChecker: General support to BitVectors and the bitwise ``and`` operator. * Add support for natspec comments on state variables. + Bugfixes: * Optimizer: Fixed a bug in BlockDeDuplicator. * Type Checker: Disallow assignments to storage variables of type ``mapping``. diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 4c1ef378a7f6..87184714f24a 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -19,6 +19,8 @@ #include +#include + using namespace std; using namespace solidity; using namespace solidity::util; @@ -185,6 +187,49 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) return m_context.mkExpr(CVC4::kind::INTS_DIVISION_TOTAL, arguments[0], arguments[1]); else if (n == "mod") return m_context.mkExpr(CVC4::kind::INTS_MODULUS, arguments[0], arguments[1]); + else if (n == "bvand") + return m_context.mkExpr(CVC4::kind::BITVECTOR_AND, arguments[0], arguments[1]); + else if (n == "int2bv") + { + size_t size = std::stoi(_expr.arguments[1].name); + auto i2bvOp = m_context.mkConst(CVC4::IntToBitVector(size)); + // CVC4 treats all BVs as unsigned, so we need to manually apply 2's complement if needed. + return m_context.mkExpr( + CVC4::kind::ITE, + m_context.mkExpr(CVC4::kind::GEQ, arguments[0], m_context.mkConst(CVC4::Rational(0))), + m_context.mkExpr(CVC4::kind::INT_TO_BITVECTOR, i2bvOp, arguments[0]), + m_context.mkExpr( + CVC4::kind::BITVECTOR_NEG, + m_context.mkExpr(CVC4::kind::INT_TO_BITVECTOR, i2bvOp, m_context.mkExpr(CVC4::kind::UMINUS, arguments[0])) + ) + ); + } + else if (n == "bv2int") + { + auto intSort = dynamic_pointer_cast(_expr.sort); + smtAssert(intSort, ""); + auto nat = m_context.mkExpr(CVC4::kind::BITVECTOR_TO_NAT, arguments[0]); + if (!intSort->isSigned) + return nat; + + auto type = arguments[0].getType(); + smtAssert(type.isBitVector(), ""); + auto size = CVC4::BitVectorType(type).getSize(); + // CVC4 treats all BVs as unsigned, so we need to manually apply 2's complement if needed. + auto extractOp = m_context.mkConst(CVC4::BitVectorExtract(size - 1, size - 1)); + return m_context.mkExpr(CVC4::kind::ITE, + m_context.mkExpr( + CVC4::kind::EQUAL, + m_context.mkExpr(CVC4::kind::BITVECTOR_EXTRACT, extractOp, arguments[0]), + m_context.mkConst(CVC4::BitVector(1, size_t(0))) + ), + nat, + m_context.mkExpr( + CVC4::kind::UMINUS, + m_context.mkExpr(CVC4::kind::BITVECTOR_TO_NAT, m_context.mkExpr(CVC4::kind::BITVECTOR_NEG, arguments[0])) + ) + ); + } else if (n == "select") return m_context.mkExpr(CVC4::kind::SELECT, arguments[0], arguments[1]); else if (n == "store") diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index 4e81444fef00..bc37ffb6c162 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -126,7 +126,7 @@ pair> SMTLib2Interface::check(vector con result = CheckResult::ERROR; vector values; - if (result == CheckResult::SATISFIABLE && result != CheckResult::ERROR) + if (result == CheckResult::SATISFIABLE && !_expressionsToEvaluate.empty()) values = parseValues(find(response.cbegin(), response.cend(), '\n'), response.cend()); return make_pair(result, values); } @@ -137,7 +137,40 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) return _expr.name; std::string sexpr = "("; - if (_expr.name == "const_array") + if (_expr.name == "int2bv") + { + size_t size = std::stoi(_expr.arguments[1].name); + auto arg = toSExpr(_expr.arguments.front()); + auto int2bv = "(_ int2bv " + to_string(size) + ")"; + // Some solvers treat all BVs as unsigned, so we need to manually apply 2's complement if needed. + sexpr += string("ite ") + + "(>= " + arg + " 0) " + + "(" + int2bv + " " + arg + ") " + + "(bvneg (" + int2bv + " (- " + arg + ")))"; + } + else if (_expr.name == "bv2int") + { + auto intSort = dynamic_pointer_cast(_expr.sort); + smtAssert(intSort, ""); + + auto arg = toSExpr(_expr.arguments.front()); + auto nat = "(bv2nat " + arg + ")"; + + if (!intSort->isSigned) + return nat; + + auto bvSort = dynamic_pointer_cast(_expr.arguments.front().sort); + smtAssert(bvSort, ""); + auto size = to_string(bvSort->size); + auto pos = to_string(bvSort->size - 1); + + // Some solvers treat all BVs as unsigned, so we need to manually apply 2's complement if needed. + sexpr += string("ite ") + + "(= ((_ extract " + pos + " " + pos + ")" + arg + ") #b0) " + + nat + " " + + "(- (bvneg " + arg + "))"; + } + else if (_expr.name == "const_array") { smtAssert(_expr.arguments.size() == 2, ""); auto sortSort = std::dynamic_pointer_cast(_expr.arguments.at(0).sort); diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index 13fcae4f2d39..be12c3a80811 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -94,6 +94,9 @@ class Expression {"*", 2}, {"/", 2}, {"mod", 2}, + {"bvand", 2}, + {"int2bv", 2}, + {"bv2int", 1}, {"select", 2}, {"store", 3}, {"const_array", 2}, @@ -195,6 +198,32 @@ class Expression ); } + static Expression int2bv(Expression _n, size_t _size) + { + smtAssert(_n.sort->kind == Kind::Int, ""); + std::shared_ptr intSort = std::dynamic_pointer_cast(_n.sort); + smtAssert(intSort, ""); + smtAssert(_size <= 256, ""); + return Expression( + "int2bv", + std::vector{std::move(_n), Expression(_size)}, + std::make_shared(_size) + ); + } + + static Expression bv2int(Expression _bv, bool _signed = false) + { + smtAssert(_bv.sort->kind == Kind::BitVector, ""); + std::shared_ptr bvSort = std::dynamic_pointer_cast(_bv.sort); + smtAssert(bvSort, ""); + smtAssert(bvSort->size <= 256, ""); + return Expression( + "bv2int", + std::vector{std::move(_bv)}, + SortProvider::intSort(_signed) + ); + } + friend Expression operator!(Expression _a) { return Expression("not", std::move(_a), Kind::Bool); @@ -251,6 +280,11 @@ class Expression { return Expression("mod", std::move(_a), std::move(_b), Kind::Int); } + friend Expression operator&(Expression _a, Expression _b) + { + auto bvSort = _a.sort; + return Expression("bvand", {std::move(_a), std::move(_b)}, bvSort); + } Expression operator()(std::vector _arguments) const { smtAssert( diff --git a/libsmtutil/Sorts.cpp b/libsmtutil/Sorts.cpp index 7a45a174623d..7624cbb5b57a 100644 --- a/libsmtutil/Sorts.cpp +++ b/libsmtutil/Sorts.cpp @@ -24,6 +24,14 @@ namespace solidity::smtutil { shared_ptr const SortProvider::boolSort{make_shared(Kind::Bool)}; -shared_ptr const SortProvider::intSort{make_shared(Kind::Int)}; +shared_ptr const SortProvider::uintSort{make_shared(false)}; +shared_ptr const SortProvider::sintSort{make_shared(true)}; + +shared_ptr SortProvider::intSort(bool _signed) +{ + if (_signed) + return sintSort; + return uintSort; +} } diff --git a/libsmtutil/Sorts.h b/libsmtutil/Sorts.h index 228dd057baa3..20cbf2be5af8 100644 --- a/libsmtutil/Sorts.h +++ b/libsmtutil/Sorts.h @@ -31,6 +31,7 @@ enum class Kind { Int, Bool, + BitVector, Function, Array, Sort, @@ -48,6 +49,36 @@ struct Sort }; using SortPointer = std::shared_ptr; +struct IntSort: public Sort +{ + IntSort(bool _signed): + Sort(Kind::Int), + isSigned(_signed) + {} + + bool operator==(IntSort const& _other) const + { + return Sort::operator==(_other) && isSigned == _other.isSigned; + } + + bool isSigned; +}; + +struct BitVectorSort: public Sort +{ + BitVectorSort(unsigned _size): + Sort(Kind::BitVector), + size(_size) + {} + + bool operator==(BitVectorSort const& _other) const + { + return Sort::operator==(_other) && size == _other.size; + } + + unsigned size; +}; + struct FunctionSort: public Sort { FunctionSort(std::vector _domain, SortPointer _codomain): @@ -160,7 +191,9 @@ struct TupleSort: public Sort struct SortProvider { static std::shared_ptr const boolSort; - static std::shared_ptr const intSort; + static std::shared_ptr const uintSort; + static std::shared_ptr const sintSort; + static std::shared_ptr intSort(bool _signed = false); }; } diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index b42bc4765819..1337b7b20de7 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -180,6 +180,19 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) return arguments[0] / arguments[1]; else if (n == "mod") return z3::mod(arguments[0], arguments[1]); + else if (n == "bvand") + return arguments[0] & arguments[1]; + else if (n == "int2bv") + { + size_t size = std::stoi(_expr.arguments[1].name); + return z3::int2bv(size, arguments[0]); + } + else if (n == "bv2int") + { + auto intSort = dynamic_pointer_cast(_expr.sort); + smtAssert(intSort, ""); + return z3::bv2int(arguments[0], intSort->isSigned); + } else if (n == "select") return z3::select(arguments[0], arguments[1]); else if (n == "store") diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index fe63c198d605..f0ba6d0de096 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -701,7 +701,7 @@ vector CHC::stateSorts(ContractDefinition const& _contract smtutil::SortPointer CHC::constructorSort() { return make_shared( - vector{smtutil::SortProvider::intSort} + m_stateSorts, + vector{smtutil::SortProvider::uintSort} + m_stateSorts, smtutil::SortProvider::boolSort ); } @@ -747,7 +747,7 @@ smtutil::SortPointer CHC::sort(FunctionDefinition const& _function) auto inputSorts = applyMap(_function.parameters(), smtSort); auto outputSorts = applyMap(_function.returnParameters(), smtSort); return make_shared( - vector{smtutil::SortProvider::intSort} + m_stateSorts + inputSorts + m_stateSorts + inputSorts + outputSorts, + vector{smtutil::SortProvider::uintSort} + m_stateSorts + inputSorts + m_stateSorts + inputSorts + outputSorts, smtutil::SortProvider::boolSort ); } @@ -776,7 +776,7 @@ smtutil::SortPointer CHC::summarySort(FunctionDefinition const& _function, Contr auto inputSorts = applyMap(_function.parameters(), smtSort); auto outputSorts = applyMap(_function.returnParameters(), smtSort); return make_shared( - vector{smtutil::SortProvider::intSort} + sorts + inputSorts + sorts + outputSorts, + vector{smtutil::SortProvider::uintSort} + sorts + inputSorts + sorts + outputSorts, smtutil::SortProvider::boolSort ); } diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 99aa6195f3fa..258c74bcc58e 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -574,6 +574,8 @@ void SMTEncoder::endVisit(BinaryOperation const& _op) arithmeticOperation(_op); else if (TokenTraits::isCompareOp(_op.getOperator())) compareOperation(_op); + else if (TokenTraits::isBitOp(_op.getOperator())) + bitwiseOperation(_op); else m_errorReporter.warning( 3876_error, @@ -1346,6 +1348,43 @@ void SMTEncoder::booleanOperation(BinaryOperation const& _op) ); } +void SMTEncoder::bitwiseOperation(BinaryOperation const& _op) +{ + solAssert(TokenTraits::isBitOp(_op.getOperator()), ""); + auto commonType = _op.annotation().commonType; + solAssert(commonType, ""); + + unsigned bvSize = 256; + bool isSigned = false; + if (auto const* intType = dynamic_cast(commonType)) + { + bvSize = intType->numBits(); + isSigned = intType->isSigned(); + } + else if (auto const* fixedType = dynamic_cast(commonType)) + { + bvSize = fixedType->numBits(); + isSigned = fixedType->isSigned(); + } + + auto bvLeft = smtutil::Expression::int2bv(expr(_op.leftExpression()), bvSize); + auto bvRight = smtutil::Expression::int2bv(expr(_op.rightExpression()), bvSize); + + optional result; + if (_op.getOperator() == Token::BitAnd) + result = bvLeft & bvRight; + // TODO implement the other operators + else + m_errorReporter.warning( + 1093_error, + _op.location(), + "Assertion checker does not yet implement this bitwise operator." + ); + + if (result) + defineExpr(_op, smtutil::Expression::bv2int(*result, isSigned)); +} + smtutil::Expression SMTEncoder::division(smtutil::Expression _left, smtutil::Expression _right, IntegerType const& _type) { // Signed division in SMTLIB2 rounds differently for negative division. diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 63bbd45df0d5..8010ba820ef1 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -108,6 +108,7 @@ class SMTEncoder: public ASTConstVisitor ); void compareOperation(BinaryOperation const& _op); void booleanOperation(BinaryOperation const& _op); + void bitwiseOperation(BinaryOperation const& _op); void initContract(ContractDefinition const& _contract); void initFunction(FunctionDefinition const& _function); diff --git a/libsolidity/formal/SymbolicState.h b/libsolidity/formal/SymbolicState.h index f33faf9f287c..2b234466dde9 100644 --- a/libsolidity/formal/SymbolicState.h +++ b/libsolidity/formal/SymbolicState.h @@ -63,7 +63,7 @@ class SymbolicState /// Symbolic balances. SymbolicArrayVariable m_balances{ - std::make_shared(smtutil::SortProvider::intSort, smtutil::SortProvider::intSort), + std::make_shared(smtutil::SortProvider::uintSort, smtutil::SortProvider::uintSort), "balances", m_context }; diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index 38f72cb66131..0ed81ee315ad 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -34,7 +34,11 @@ SortPointer smtSort(frontend::Type const& _type) switch (smtKind(_type.category())) { case Kind::Int: - return SortProvider::intSort; + if (auto const* intType = dynamic_cast(&_type)) + return SortProvider::intSort(intType->isSigned()); + if (auto const* fixedType = dynamic_cast(&_type)) + return SortProvider::intSort(fixedType->isSigned()); + return SortProvider::uintSort; case Kind::Bool: return SortProvider::boolSort; case Kind::Function: @@ -50,7 +54,7 @@ SortPointer smtSort(frontend::Type const& _type) returnSort = SortProvider::boolSort; else if (returnTypes.size() > 1) // Abstract sort. - returnSort = SortProvider::intSort; + returnSort = SortProvider::uintSort; else returnSort = smtSort(*returnTypes.front()); return make_shared(parameterSorts, returnSort); @@ -68,7 +72,7 @@ SortPointer smtSort(frontend::Type const& _type) { auto stringLitType = dynamic_cast(&_type); solAssert(stringLitType, ""); - array = make_shared(SortProvider::intSort, SortProvider::intSort); + array = make_shared(SortProvider::uintSort, SortProvider::uintSort); } else { @@ -81,7 +85,7 @@ SortPointer smtSort(frontend::Type const& _type) solAssert(false, ""); solAssert(arrayType, ""); - array = make_shared(SortProvider::intSort, smtSortAbstractFunction(*arrayType->baseType())); + array = make_shared(SortProvider::uintSort, smtSortAbstractFunction(*arrayType->baseType())); } string tupleName; @@ -98,7 +102,7 @@ SortPointer smtSort(frontend::Type const& _type) return make_shared( tupleName, vector{tupleName + "_accessor_array", tupleName + "_accessor_length"}, - vector{array, SortProvider::intSort} + vector{array, SortProvider::uintSort} ); } case Kind::Tuple: @@ -118,7 +122,7 @@ SortPointer smtSort(frontend::Type const& _type) } default: // Abstract case. - return SortProvider::intSort; + return SortProvider::uintSort; } } @@ -133,7 +137,7 @@ vector smtSort(vector const& _types) SortPointer smtSortAbstractFunction(frontend::Type const& _type) { if (isFunction(_type.category())) - return SortProvider::intSort; + return SortProvider::uintSort; return smtSort(_type); } @@ -144,7 +148,7 @@ vector smtSortAbstractFunction(vector const& if (type) sorts.push_back(smtSortAbstractFunction(*type)); else - sorts.push_back(SortProvider::intSort); + sorts.push_back(SortProvider::uintSort); return sorts; } diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index 558e7ccd1cf2..002df600214f 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -286,7 +286,7 @@ SymbolicArrayVariable::SymbolicArrayVariable( std::make_shared( "array_length_pair", std::vector{"array", "length"}, - std::vector{m_sort, SortProvider::intSort} + std::vector{m_sort, SortProvider::uintSort} ), m_uniqueName + "_array_length_pair", m_context diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol new file mode 100644 index 000000000000..579702632a6a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol @@ -0,0 +1,18 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + int8 x = 1; + int8 y = 0; + assert(x & y != 0); + x = -1; y = 3; + assert(x & y == 3); + y = -1; + int8 z = x & y; + assert(z == -1); + y = 127; + assert(x & y == 127); + } +} +// ---- +// Warning: (104-122): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol new file mode 100644 index 000000000000..4efdafdeb75f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + assert(1 & 0 != 0); + assert(-1 & 3 == 3); + assert(-1 & -1 == -1); + assert(-1 & 127 == 127); + } +} +// ---- +// Warning: (76-94): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol new file mode 100644 index 000000000000..ce8400dbeb62 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol @@ -0,0 +1,18 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + uint8 x = 1; + uint16 y = 0; + assert(x & y != 0); + x = 0xff; + y = 0xffff; + assert(x & y == 0xff); + assert(x & y == 0xffff); + assert(x & y == 0x0000); + } +} +// ---- +// Warning: (107-125): Assertion violation happens here +// Warning: (180-203): Assertion violation happens here +// Warning: (207-230): Assertion violation happens here From 011f8a462d718f3034e72025b1d3d3916faa474d Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 28 May 2020 02:02:53 +0200 Subject: [PATCH 141/479] Remove AsmAnalyzer class-specific error reporting functions --- libyul/AsmAnalysis.cpp | 84 ++++++++++++++++++++++++------------------ libyul/AsmAnalysis.h | 3 -- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index fd8e44dfab8b..7a80377603af 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -81,17 +81,19 @@ vector AsmAnalyzer::operator()(Literal const& _literal) { expectValidType(_literal.type, _literal.location); if (_literal.kind == LiteralKind::String && _literal.value.str().size() > 32) - typeError( + m_errorReporter.typeError( + 3069_error, _literal.location, "String literal too long (" + to_string(_literal.value.str().size()) + " > 32)" ); else if (_literal.kind == LiteralKind::Number && bigint(_literal.value.str()) > u256(-1)) - typeError(_literal.location, "Number literal too large (> 256 bits)"); + m_errorReporter.typeError(6708_error, _literal.location, "Number literal too large (> 256 bits)"); else if (_literal.kind == LiteralKind::Boolean) yulAssert(_literal.value == "true"_yulstring || _literal.value == "false"_yulstring, ""); if (!m_dialect.validTypeForLiteral(_literal.kind, _literal.value, _literal.type)) - typeError( + m_errorReporter.typeError( + 5170_error, _literal.location, "Invalid type \"" + _literal.type.str() + "\" for literal \"" + _literal.value.str() + "\"." ); @@ -110,7 +112,8 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) [&](Scope::Variable const& _var) { if (!m_activeVariables.count(&_var)) - declarationError( + m_errorReporter.declarationError( + 4990_error, _identifier.location, "Variable " + _identifier.name.str() + " used before it was declared." ); @@ -118,7 +121,8 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) }, [&](Scope::Function const&) { - typeError( + m_errorReporter.typeError( + 6041_error, _identifier.location, "Function " + _identifier.name.str() + " used without being called." ); @@ -141,7 +145,7 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) } if (!found && watcher.ok()) // Only add an error message if the callback did not do it. - declarationError(_identifier.location, "Identifier not found."); + m_errorReporter.declarationError(8198_error, _identifier.location, "Identifier not found."); } return {type}; @@ -152,7 +156,9 @@ void AsmAnalyzer::operator()(ExpressionStatement const& _statement) auto watcher = m_errorReporter.errorWatcher(); vector types = std::visit(*this, _statement.expression); if (watcher.ok() && !types.empty()) - typeError(_statement.location, + m_errorReporter.typeError( + 3083_error, + _statement.location, "Top-level expressions are not supposed to return values (this expression returns " + to_string(types.size()) + " value" + @@ -170,7 +176,8 @@ void AsmAnalyzer::operator()(Assignment const& _assignment) vector types = std::visit(*this, *_assignment.value); if (types.size() != numVariables) - declarationError( + m_errorReporter.declarationError( + 8678_error, _assignment.location, "Variable count does not match number of values (" + to_string(numVariables) + @@ -202,7 +209,9 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) { vector types = std::visit(*this, *_varDecl.value); if (types.size() != numVariables) - declarationError(_varDecl.location, + m_errorReporter.declarationError( + 3812_error, + _varDecl.location, "Variable count mismatch: " + to_string(numVariables) + " variables and " + @@ -217,7 +226,8 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) givenType = types[i]; TypedName const& variable = _varDecl.variables[i]; if (variable.type != givenType) - typeError( + m_errorReporter.typeError( + 3947_error, variable.location, "Assigning value of type \"" + givenType.str() + "\" to variable of type \"" + variable.type.str() + "." ); @@ -265,7 +275,8 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) else if (!m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{ [&](Scope::Variable const&) { - typeError( + m_errorReporter.typeError( + 4202_error, _funCall.functionName.location, "Attempt to call variable instead of function." ); @@ -278,12 +289,13 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) })) { if (!warnOnInstructions(_funCall)) - declarationError(_funCall.functionName.location, "Function not found."); + m_errorReporter.declarationError(4619_error, _funCall.functionName.location, "Function not found."); yulAssert(!watcher.ok(), "Expected a reported error."); } if (parameterTypes && _funCall.arguments.size() != parameterTypes->size()) - typeError( + m_errorReporter.typeError( + 7000_error, _funCall.functionName.location, "Function expects " + to_string(parameterTypes->size()) + @@ -301,7 +313,8 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) if (needsLiteralArguments && (*needsLiteralArguments)[i - 1]) { if (!holds_alternative(arg)) - typeError( + m_errorReporter.typeError( + 9114_error, _funCall.functionName.location, "Function expects direct literals as arguments." ); @@ -310,7 +323,8 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) _funCall.functionName.name.str() == "dataoffset" ) if (!m_dataNames.count(std::get(arg).value)) - typeError( + m_errorReporter.typeError( + 3517_error, _funCall.functionName.location, "Unknown data object \"" + std::get(arg).value.str() + "\"." ); @@ -362,7 +376,7 @@ void AsmAnalyzer::operator()(Switch const& _switch) /// Note: the parser ensures there is only one default case if (watcher.ok() && !cases.insert(valueOfLiteral(*_case.value)).second) - declarationError(_case.location, "Duplicate case defined."); + m_errorReporter.declarationError(6792_error, _case.location, "Duplicate case defined."); } (*this)(_case.body); @@ -408,7 +422,8 @@ YulString AsmAnalyzer::expectExpression(Expression const& _expr) { vector types = std::visit(*this, _expr); if (types.size() != 1) - typeError( + m_errorReporter.typeError( + 3950_error, locationOf(_expr), "Expected expression to evaluate to one value, but got " + to_string(types.size()) + @@ -421,7 +436,9 @@ void AsmAnalyzer::expectBoolExpression(Expression const& _expr) { YulString type = expectExpression(_expr); if (type != m_dialect.boolType) - typeError(locationOf(_expr), + m_errorReporter.typeError( + 1733_error, + locationOf(_expr), "Expected a value of boolean type \"" + m_dialect.boolType.str() + "\" but got \"" + @@ -440,9 +457,10 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT { // Check that it is a variable if (!holds_alternative(*var)) - typeError(_variable.location, "Assignment requires variable."); + m_errorReporter.typeError(2657_error, _variable.location, "Assignment requires variable."); else if (!m_activeVariables.count(&std::get(*var))) - declarationError( + m_errorReporter.declarationError( + 1133_error, _variable.location, "Variable " + _variable.name.str() + " used before it was declared." ); @@ -464,9 +482,11 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT if (!found && watcher.ok()) // Only add message if the callback did not. - declarationError(_variable.location, "Variable not found or variable not lvalue."); + m_errorReporter.declarationError(4634_error, _variable.location, "Variable not found or variable not lvalue."); if (variableType && *variableType != _valueType) - typeError(_variable.location, + m_errorReporter.typeError( + 9547_error, + _variable.location, "Assigning a value of type \"" + _valueType.str() + "\" to a variable of type \"" + @@ -488,7 +508,8 @@ Scope& AsmAnalyzer::scope(Block const* _block) void AsmAnalyzer::expectValidType(YulString _type, SourceLocation const& _location) { if (!m_dialect.types.count(_type)) - typeError( + m_errorReporter.typeError( + 5473_error, _location, "\"" + _type.str() + "\" is not a valid type (user defined types are not yet supported)." ); @@ -497,7 +518,9 @@ void AsmAnalyzer::expectValidType(YulString _type, SourceLocation const& _locati void AsmAnalyzer::expectType(YulString _expectedType, YulString _givenType, SourceLocation const& _location) { if (_expectedType != _givenType) - typeError(_location, + m_errorReporter.typeError( + 3781_error, + _location, "Expected a value of type \"" + _expectedType.str() + "\" but got \"" + @@ -524,7 +547,8 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation yulAssert(m_evmVersion.hasBitwiseShifting() == m_evmVersion.hasCreate2(), ""); auto errorForVM = [&](string const& vmKindMessage) { - typeError( + m_errorReporter.typeError( + 7079_error, _location, "The \"" + boost::to_lower_copy(instructionInfo(_instr).name) @@ -584,13 +608,3 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation return true; } - -void AsmAnalyzer::typeError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.typeError(7569_error, _location, _description); -} - -void AsmAnalyzer::declarationError(SourceLocation const& _location, string const& _description) -{ - m_errorReporter.declarationError(9595_error, _location, _description); -} diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 438c31bbdd64..3804476ae2be 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -117,9 +117,6 @@ class AsmAnalyzer return warnOnInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); } - void typeError(langutil::SourceLocation const& _location, std::string const& _description); - void declarationError(langutil::SourceLocation const& _location, std::string const& _description); - yul::ExternalIdentifierAccess::Resolver m_resolver; Scope* m_currentScope = nullptr; /// Variables that are active at the current point in assembly (as opposed to From be83c54d79c2a6388a7254dada03917c634ad63b Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 28 May 2020 01:17:53 +0200 Subject: [PATCH 142/479] Throw TestParserError instead of Error in tests --- test/libsolidity/util/BytesUtils.cpp | 8 +-- test/libsolidity/util/SoltestErrors.h | 9 ++++ test/libsolidity/util/TestFileParser.cpp | 41 +++++++--------- test/libsolidity/util/TestFileParserTests.cpp | 49 ++++++++++--------- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index fd5cb7f49f37..72f7c7594975 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -81,7 +81,7 @@ bytes BytesUtils::convertBoolean(string const& _literal) else if (_literal == "false") return bytes{false}; else - throw Error(Error::Type::ParserError, "Boolean literal invalid."); + throw TestParserError("Boolean literal invalid."); } bytes BytesUtils::convertNumber(string const& _literal) @@ -92,7 +92,7 @@ bytes BytesUtils::convertNumber(string const& _literal) } catch (std::exception const&) { - throw Error(Error::Type::ParserError, "Number encoding invalid."); + throw TestParserError("Number encoding invalid."); } } @@ -104,7 +104,7 @@ bytes BytesUtils::convertHexNumber(string const& _literal) } catch (std::exception const&) { - throw Error(Error::Type::ParserError, "Hex number encoding invalid."); + throw TestParserError("Hex number encoding invalid."); } } @@ -116,7 +116,7 @@ bytes BytesUtils::convertString(string const& _literal) } catch (std::exception const&) { - throw Error(Error::Type::ParserError, "String encoding invalid."); + throw TestParserError("String encoding invalid."); } } diff --git a/test/libsolidity/util/SoltestErrors.h b/test/libsolidity/util/SoltestErrors.h index f895e706b787..3291692a893a 100644 --- a/test/libsolidity/util/SoltestErrors.h +++ b/test/libsolidity/util/SoltestErrors.h @@ -30,6 +30,15 @@ namespace solidity::frontend::test while (false) +class TestParserError: virtual public util::Exception +{ +public: + explicit TestParserError(std::string const& _description) + { + *this << util::errinfo_comment(_description); + } +}; + /** * Representation of a notice, warning or error that can occur while * formatting and therefore updating an interactive function call test. diff --git a/test/libsolidity/util/TestFileParser.cpp b/test/libsolidity/util/TestFileParser.cpp index 50ca68f632c6..52e4156aabfe 100644 --- a/test/libsolidity/util/TestFileParser.cpp +++ b/test/libsolidity/util/TestFileParser.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -128,9 +129,9 @@ vector TestFileParser::parseFunctionCall calls.emplace_back(std::move(call)); } - catch (Error const& _e) + catch (TestParserError const& _e) { - throw Error{_e.type(), "Line " + to_string(_lineOffset + m_lineNumber) + ": " + _e.what()}; + throw TestParserError("Line " + to_string(_lineOffset + m_lineNumber) + ": " + _e.what()); } } } @@ -150,8 +151,7 @@ bool TestFileParser::accept(soltest::Token _token, bool const _expect) bool TestFileParser::expect(soltest::Token _token, bool const _advance) { if (m_scanner.currentToken() != _token || m_scanner.currentToken() == Token::Invalid) - throw Error( - Error::Type::ParserError, + throw TestParserError( "Unexpected " + formatToken(m_scanner.currentToken()) + ": \"" + m_scanner.currentLiteral() + "\". " + "Expected \"" + formatToken(_token) + "\"." @@ -187,10 +187,10 @@ pair TestFileParser::parseFunctionSignature() parameters += parseIdentifierOrTuple(); } if (accept(Token::Arrow, true)) - throw Error(Error::Type::ParserError, "Invalid signature detected: " + signature); + throw TestParserError("Invalid signature detected: " + signature); if (!hasName && !parameters.empty()) - throw Error(Error::Type::ParserError, "Signatures without a name cannot have parameters: " + signature); + throw TestParserError("Signatures without a name cannot have parameters: " + signature); else signature += parameters; @@ -207,7 +207,7 @@ FunctionValue TestFileParser::parseFunctionCallValue() u256 value{ parseDecimalNumber() }; Token token = m_scanner.currentToken(); if (token != Token::Ether && token != Token::Wei) - throw Error(Error::Type::ParserError, "Invalid value unit provided. Coins can be wei or ether."); + throw TestParserError("Invalid value unit provided. Coins can be wei or ether."); m_scanner.scanNextToken(); @@ -216,7 +216,7 @@ FunctionValue TestFileParser::parseFunctionCallValue() } catch (std::exception const&) { - throw Error(Error::Type::ParserError, "Ether value encoding invalid."); + throw TestParserError("Ether value encoding invalid."); } } @@ -226,7 +226,7 @@ FunctionCallArgs TestFileParser::parseFunctionCallArguments() auto param = parseParameter(); if (param.abiType.type == ABIType::None) - throw Error(Error::Type::ParserError, "No argument provided."); + throw TestParserError("No argument provided."); arguments.parameters.emplace_back(param); while (accept(Token::Comma, true)) @@ -290,7 +290,7 @@ Parameter TestFileParser::parseParameter() if (accept(Token::Boolean)) { if (isSigned) - throw Error(Error::Type::ParserError, "Invalid boolean literal."); + throw TestParserError("Invalid boolean literal."); parameter.abiType = ABIType{ABIType::Boolean, ABIType::AlignRight, 32}; string parsed = parseBoolean(); @@ -304,7 +304,7 @@ Parameter TestFileParser::parseParameter() else if (accept(Token::HexNumber)) { if (isSigned) - throw Error(Error::Type::ParserError, "Invalid hex number literal."); + throw TestParserError("Invalid hex number literal."); parameter.abiType = ABIType{ABIType::Hex, ABIType::AlignRight, 32}; string parsed = parseHexNumber(); @@ -318,9 +318,9 @@ Parameter TestFileParser::parseParameter() else if (accept(Token::Hex, true)) { if (isSigned) - throw Error(Error::Type::ParserError, "Invalid hex string literal."); + throw TestParserError("Invalid hex string literal."); if (parameter.alignment != Parameter::Alignment::None) - throw Error(Error::Type::ParserError, "Hex string literals cannot be aligned or padded."); + throw TestParserError("Hex string literals cannot be aligned or padded."); string parsed = parseString(); parameter.rawString += "hex\"" + parsed + "\""; @@ -332,9 +332,9 @@ Parameter TestFileParser::parseParameter() else if (accept(Token::String)) { if (isSigned) - throw Error(Error::Type::ParserError, "Invalid string literal."); + throw TestParserError("Invalid string literal."); if (parameter.alignment != Parameter::Alignment::None) - throw Error(Error::Type::ParserError, "String literals cannot be aligned or padded."); + throw TestParserError("String literals cannot be aligned or padded."); string parsed = parseString(); parameter.abiType = ABIType{ABIType::String, ABIType::AlignLeft, parsed.size()}; @@ -364,7 +364,7 @@ Parameter TestFileParser::parseParameter() else if (accept(Token::Failure, true)) { if (isSigned) - throw Error(Error::Type::ParserError, "Invalid failure literal."); + throw TestParserError("Invalid failure literal."); parameter.abiType = ABIType{ABIType::Failure, ABIType::AlignRight, 0}; parameter.rawBytes = bytes{}; @@ -555,10 +555,7 @@ void TestFileParser::Scanner::scanNextToken() else if (isEndOfLine()) token = make_pair(Token::EOS, "EOS"); else - throw Error( - Error::Type::ParserError, - "Unexpected character: '" + string{current()} + "'" - ); + throw TestParserError("Unexpected character: '" + string{current()} + "'"); break; } } @@ -651,7 +648,7 @@ string TestFileParser::Scanner::scanString() str += scanHexPart(); break; default: - throw Error(Error::Type::ParserError, "Invalid or escape sequence found in string literal."); + throw TestParserError("Invalid or escape sequence found in string literal."); } } else @@ -673,7 +670,7 @@ char TestFileParser::Scanner::scanHexPart() else if (tolower(current()) >= 'a' && tolower(current()) <= 'f') value = tolower(current()) - 'a' + 10; else - throw Error(Error::Type::ParserError, "\\x used with no following hex digits."); + throw TestParserError("\\x used with no following hex digits."); advance(); if (current() == '"') diff --git a/test/libsolidity/util/TestFileParserTests.cpp b/test/libsolidity/util/TestFileParserTests.cpp index f074fc1bbb93..d24a80b95290 100644 --- a/test/libsolidity/util/TestFileParserTests.cpp +++ b/test/libsolidity/util/TestFileParserTests.cpp @@ -25,6 +25,7 @@ #include #include +#include #include using namespace std; @@ -365,7 +366,7 @@ BOOST_AUTO_TEST_CASE(scanner_hex_values_invalid1) char const* source = R"( // f(uint256): "\x" -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(scanner_hex_values_invalid2) @@ -383,7 +384,7 @@ BOOST_AUTO_TEST_CASE(scanner_hex_values_invalid3) char const* source = R"( // f(uint256): "\xZ" -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(scanner_hex_values_invalid4) @@ -391,7 +392,7 @@ BOOST_AUTO_TEST_CASE(scanner_hex_values_invalid4) char const* source = R"( // f(uint256): "\xZZ" -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_hex_string) @@ -741,7 +742,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_hex_string_left_align) char const* source = R"( // f(bytes): left(hex"4200ef") -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_hex_string_right_align) @@ -749,7 +750,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_hex_string_right_align) char const* source = R"( // f(bytes): right(hex"4200ef") -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_newline_invalid) @@ -757,7 +758,7 @@ BOOST_AUTO_TEST_CASE(call_newline_invalid) char const* source = R"( / )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_invalid) @@ -765,7 +766,7 @@ BOOST_AUTO_TEST_CASE(call_invalid) char const* source = R"( / f() -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_signature_invalid) @@ -773,7 +774,7 @@ BOOST_AUTO_TEST_CASE(call_signature_invalid) char const* source = R"( // f(uint8,) -> FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid) @@ -781,7 +782,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid) char const* source = R"( // f((uint8,) -> FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid_empty) @@ -789,7 +790,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid_empty) char const* source = R"( // f(uint8, ()) -> FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid_parantheses) @@ -797,14 +798,14 @@ BOOST_AUTO_TEST_CASE(call_arguments_tuple_invalid_parantheses) char const* source = R"( // f((uint8,() -> FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_ether_value_expectations_missing) { char const* source = R"( // f(), 0)"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_invalid) @@ -812,7 +813,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_invalid) char const* source = R"( // f(uint256): abc -> 1 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_invalid_decimal) @@ -820,7 +821,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_invalid_decimal) char const* source = R"( // sig(): 0.h3 -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_ether_value_invalid) @@ -828,7 +829,7 @@ BOOST_AUTO_TEST_CASE(call_ether_value_invalid) char const* source = R"( // f(uint256), abc : 1 -> 1 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_ether_value_invalid_decimal) @@ -836,7 +837,7 @@ BOOST_AUTO_TEST_CASE(call_ether_value_invalid_decimal) char const* source = R"( // sig(): 0.1hd ether -> )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_ether_type_invalid) @@ -844,7 +845,7 @@ BOOST_AUTO_TEST_CASE(call_ether_type_invalid) char const* source = R"( // f(uint256), 2 btc : 1 -> 1 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_signed_bool_invalid) @@ -852,7 +853,7 @@ BOOST_AUTO_TEST_CASE(call_signed_bool_invalid) char const* source = R"( // f() -> -true )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_signed_failure_invalid) @@ -860,7 +861,7 @@ BOOST_AUTO_TEST_CASE(call_signed_failure_invalid) char const* source = R"( // f() -> -FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_signed_hex_number_invalid) @@ -868,7 +869,7 @@ BOOST_AUTO_TEST_CASE(call_signed_hex_number_invalid) char const* source = R"( // f() -> -0x42 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_colon) @@ -877,7 +878,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_colon) // h256(): // -> 1 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arguments_newline_colon) @@ -887,7 +888,7 @@ BOOST_AUTO_TEST_CASE(call_arguments_newline_colon) // : // -> 1 )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_arrow_missing) @@ -895,7 +896,7 @@ BOOST_AUTO_TEST_CASE(call_arrow_missing) char const* source = R"( // h256() FAILURE )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(call_unexpected_character) @@ -903,7 +904,7 @@ BOOST_AUTO_TEST_CASE(call_unexpected_character) char const* source = R"( // f() -> ?? )"; - BOOST_REQUIRE_THROW(parse(source), langutil::Error); + BOOST_REQUIRE_THROW(parse(source), TestParserError); } BOOST_AUTO_TEST_CASE(constructor) From 61431d2c59f28a99c8fe6b6465f9c3ca1410be67 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 27 May 2020 16:59:43 +0200 Subject: [PATCH 143/479] ossfuzz: Remove PC from yul proto specification --- test/tools/ossfuzz/protoToYul.cpp | 3 --- test/tools/ossfuzz/yulProto.proto | 35 +++++++++++++++---------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 8d5ced0a85f2..aed519de2aa2 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -622,9 +622,6 @@ void ProtoConverter::visit(NullaryOp const& _x) { switch (_x.op()) { - case NullaryOp::PC: - m_output << "pc()"; - break; case NullaryOp::MSIZE: m_output << "msize()"; break; diff --git a/test/tools/ossfuzz/yulProto.proto b/test/tools/ossfuzz/yulProto.proto index 3180b421a0ce..2527c3c189a0 100644 --- a/test/tools/ossfuzz/yulProto.proto +++ b/test/tools/ossfuzz/yulProto.proto @@ -214,24 +214,23 @@ message ExtCodeCopy { message NullaryOp { enum NOp { - PC = 1; - MSIZE = 2; - GAS = 3; - CALLDATASIZE = 4; - CODESIZE = 5; - RETURNDATASIZE = 6; - ADDRESS = 7; - ORIGIN = 8; - CALLER = 9; - CALLVALUE = 10; - GASPRICE = 11; - COINBASE = 12; - TIMESTAMP = 13; - NUMBER = 14; - DIFFICULTY = 15; - GASLIMIT = 16; - SELFBALANCE = 17; - CHAINID = 18; + MSIZE = 1; + GAS = 2; + CALLDATASIZE = 3; + CODESIZE = 4; + RETURNDATASIZE = 5; + ADDRESS = 6; + ORIGIN = 7; + CALLER = 8; + CALLVALUE = 9; + GASPRICE = 10; + COINBASE = 11; + TIMESTAMP = 12; + NUMBER = 13; + DIFFICULTY = 14; + GASLIMIT = 15; + SELFBALANCE = 16; + CHAINID = 17; } required NOp op = 1; } From cb1cbbc1f1cf34cee5ff5be057babb5975c04162 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 10:55:35 +0200 Subject: [PATCH 144/479] [SMTChecker] Fix fixed point inc/dec --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 7 ++----- libsolidity/formal/SymbolicTypes.cpp | 8 ++++++++ libsolidity/formal/SymbolicTypes.h | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index a908ad23fd3a..69ad9a8797f9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -23,6 +23,7 @@ Bugfixes: * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. + * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 258c74bcc58e..fd1acb66ff4f 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -463,9 +463,6 @@ void SMTEncoder::endVisit(UnaryOperation const& _op) createExpr(_op); - if (_op.annotation().type->category() == Type::Category::FixedPoint) - return; - switch (_op.getOperator()) { case Token::Not: // ! @@ -477,8 +474,8 @@ void SMTEncoder::endVisit(UnaryOperation const& _op) case Token::Inc: // ++ (pre- or postfix) case Token::Dec: // -- (pre- or postfix) { - - solAssert(smt::isInteger(_op.annotation().type->category()), ""); + auto cat = _op.annotation().type->category(); + solAssert(smt::isInteger(cat) || smt::isFixedPoint(cat), ""); solAssert(_op.subExpression().annotation().willBeWrittenTo, ""); if (auto identifier = dynamic_cast(&_op.subExpression())) { diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index 0ed81ee315ad..a46b88e03140 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -224,6 +224,8 @@ pair> newSymbolicVariable( } else if (isInteger(_type.category())) var = make_shared(type, type, _uniqueName, _context); + else if (isFixedPoint(_type.category())) + var = make_shared(type, type, _uniqueName, _context); else if (isFixedBytes(_type.category())) { auto fixedBytesType = dynamic_cast(type); @@ -272,6 +274,11 @@ bool isInteger(frontend::Type::Category _category) return _category == frontend::Type::Category::Integer; } +bool isFixedPoint(frontend::Type::Category _category) +{ + return _category == frontend::Type::Category::FixedPoint; +} + bool isRational(frontend::Type::Category _category) { return _category == frontend::Type::Category::RationalNumber; @@ -300,6 +307,7 @@ bool isEnum(frontend::Type::Category _category) bool isNumber(frontend::Type::Category _category) { return isInteger(_category) || + isFixedPoint(_category) || isRational(_category) || isFixedBytes(_category) || isAddress(_category) || diff --git a/libsolidity/formal/SymbolicTypes.h b/libsolidity/formal/SymbolicTypes.h index 2e06f4c86e61..226bd5f94697 100644 --- a/libsolidity/formal/SymbolicTypes.h +++ b/libsolidity/formal/SymbolicTypes.h @@ -43,6 +43,7 @@ bool isSupportedTypeDeclaration(frontend::Type::Category _category); bool isSupportedTypeDeclaration(frontend::Type const& _type); bool isInteger(frontend::Type::Category _category); +bool isFixedPoint(frontend::Type::Category _category); bool isRational(frontend::Type::Category _category); bool isFixedBytes(frontend::Type::Category _category); bool isAddress(frontend::Type::Category _category); From 13f32268da48f0c3bf5a888fc5823b7cf7eb42c7 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 13:05:56 +0200 Subject: [PATCH 145/479] [SMTChecker] Add test that shows that deleting arrays takes the index into account --- .../operators/delete_multid_array.sol | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol diff --git a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol new file mode 100644 index 000000000000..0d19b2877716 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol @@ -0,0 +1,42 @@ +pragma experimental SMTChecker; + +contract C { + uint[] a; + uint[][] b; + function f(uint x, uint y, uint v) public { + a[x] = v; + delete a; + assert(a[y] == 0); + } + function g(uint x, uint y, uint v) public { + b[x][y] = v; + delete b; + assert(b[y][x] == 0); + } + function h(uint x, uint y, uint v) public { + b[x][y] = v; + delete b[x]; + // Not necessarily the case. + assert(b[y][x] == 0); + } + function i(uint x, uint y, uint v) public { + b[x][y] = v; + delete b[y]; + assert(b[y][x] == 0); + } + function j(uint x, uint y, uint z, uint v) public { + b[x][y] = v; + delete b[z]; + // Not necessarily the case. + assert(b[y][x] == 0); + } + function setA(uint x, uint y) public { + a[x] = y; + } + function setB(uint x, uint y, uint z) public { + b[x][y] = z; + } +} +// ---- +// Warning: (372-392): Assertion violation happens here +// Warning: (617-637): Assertion violation happens here From a73ec6a82f1da9f5cfa9ea1033a73ac78a9b0580 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 12:17:53 +0200 Subject: [PATCH 146/479] [SMTChecker] Fix ICE in inlining function calls while short circuiting --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 1 - libsolidity/formal/VariableUsage.cpp | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9006ac77786d..992436ea3ad1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -25,6 +25,7 @@ Bugfixes: * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. + * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index fd1acb66ff4f..be9bea10f867 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1791,7 +1791,6 @@ Expression const* SMTEncoder::leftmostBase(IndexAccess const& _indexAccess) set SMTEncoder::touchedVariables(ASTNode const& _node) { - solAssert(!m_callStack.empty(), ""); vector callStack; for (auto const& call: m_callStack) callStack.push_back(call.first); diff --git a/libsolidity/formal/VariableUsage.cpp b/libsolidity/formal/VariableUsage.cpp index 1871c09085fa..acfd34909b25 100644 --- a/libsolidity/formal/VariableUsage.cpp +++ b/libsolidity/formal/VariableUsage.cpp @@ -33,7 +33,8 @@ set VariableUsage::touchedVariables(ASTNode const& _ m_touchedVariables.clear(); m_callStack.clear(); m_callStack += _outerCallstack; - m_lastCall = m_callStack.back(); + if (!m_callStack.empty()) + m_lastCall = m_callStack.back(); _node.accept(*this); return m_touchedVariables; } From ec766958eace1acdb36abfce888f7d539b49c72c Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 12:40:08 +0200 Subject: [PATCH 147/479] Add test --- .../functions/internal_call_state_var_init.sol | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init.sol diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init.sol new file mode 100644 index 000000000000..8f6276e0ecc0 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init.sol @@ -0,0 +1,5 @@ +pragma experimental SMTChecker; +contract c { + bool b = (f() == 0) && (f() == 0); + function f() internal returns (uint) {} +} From c9593417207b04ca7fc6bd0b24f1009d63eaa046 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 28 May 2020 04:32:46 +0200 Subject: [PATCH 148/479] Add errorId to Error class --- liblangutil/ErrorReporter.cpp | 14 ++++++-------- liblangutil/ErrorReporter.h | 12 +----------- liblangutil/Exceptions.cpp | 7 ++++--- liblangutil/Exceptions.h | 18 ++++++++++++++++-- libsolidity/ast/Types.cpp | 9 +++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/liblangutil/ErrorReporter.cpp b/liblangutil/ErrorReporter.cpp index d06fbc65baa2..a8dccd55761b 100644 --- a/liblangutil/ErrorReporter.cpp +++ b/liblangutil/ErrorReporter.cpp @@ -28,8 +28,6 @@ using namespace std; using namespace solidity; using namespace solidity::langutil; -ErrorId solidity::langutil::operator"" _error(unsigned long long _error) { return ErrorId{ _error }; } - ErrorReporter& ErrorReporter::operator=(ErrorReporter const& _errorReporter) { if (&_errorReporter == this) @@ -62,12 +60,12 @@ void ErrorReporter::warning( error(_error, Error::Type::Warning, _location, _secondaryLocation, _description); } -void ErrorReporter::error(ErrorId, Error::Type _type, SourceLocation const& _location, string const& _description) +void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, string const& _description) { if (checkForExcessiveErrors(_type)) return; - auto err = make_shared(_type); + auto err = make_shared(_errorId, _type); *err << errinfo_sourceLocation(_location) << util::errinfo_comment(_description); @@ -75,12 +73,12 @@ void ErrorReporter::error(ErrorId, Error::Type _type, SourceLocation const& _loc m_errorList.push_back(err); } -void ErrorReporter::error(ErrorId, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) { if (checkForExcessiveErrors(_type)) return; - auto err = make_shared(_type); + auto err = make_shared(_errorId, _type); *err << errinfo_sourceLocation(_location) << errinfo_secondarySourceLocation(_secondaryLocation) << @@ -102,7 +100,7 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) if (m_warningCount == c_maxWarningsAllowed) { - auto err = make_shared(Error::Type::Warning); + auto err = make_shared(4591_error, Error::Type::Warning); *err << util::errinfo_comment("There are more than 256 warnings. Ignoring the rest."); m_errorList.push_back(err); } @@ -116,7 +114,7 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) if (m_errorCount > c_maxErrorsAllowed) { - auto err = make_shared(Error::Type::Warning); + auto err = make_shared(4013_error, Error::Type::Warning); *err << util::errinfo_comment("There are more than 256 errors. Aborting."); m_errorList.push_back(err); BOOST_THROW_EXCEPTION(FatalError()); diff --git a/liblangutil/ErrorReporter.h b/liblangutil/ErrorReporter.h index fed3430f2574..3dc8c59c7845 100644 --- a/liblangutil/ErrorReporter.h +++ b/liblangutil/ErrorReporter.h @@ -23,6 +23,7 @@ #pragma once #include +#include #include #include @@ -33,17 +34,6 @@ namespace solidity::langutil { -/** - * Unique identifiers are used to tag and track individual error cases. - * They are passed as the first parameter of error reporting functions. - * Suffix _error helps to find them in the sources. - * The struct ErrorId prevents incidental calls like typeError(3141) instead of typeError(3141_error). - * To create a new ID, one can add 0000_error and then run "python ./scripts/correct_error_ids.py" - * from the root of the repo. - */ -struct ErrorId { unsigned long long error = 0; }; -ErrorId operator"" _error(unsigned long long error); - class ErrorReporter { public: diff --git a/liblangutil/Exceptions.cpp b/liblangutil/Exceptions.cpp index f035f50444f3..fa65031cd66e 100644 --- a/liblangutil/Exceptions.cpp +++ b/liblangutil/Exceptions.cpp @@ -26,7 +26,8 @@ using namespace std; using namespace solidity; using namespace solidity::langutil; -Error::Error(Type _type, SourceLocation const& _location, string const& _description): +Error::Error(ErrorId _errorId, Type _type, SourceLocation const& _location, string const& _description): + m_errorId(_errorId), m_type(_type) { switch (m_type) @@ -57,8 +58,8 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip *this << util::errinfo_comment(_description); } -Error::Error(Error::Type _type, std::string const& _description, SourceLocation const& _location): - Error(_type) +Error::Error(ErrorId _errorId, Error::Type _type, std::string const& _description, SourceLocation const& _location): + Error(_errorId, _type) { if (_location.isValid()) *this << errinfo_sourceLocation(_location); diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index b8688afa6b39..42b76a1fe9e1 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -56,6 +56,17 @@ struct InvalidAstError: virtual util::Exception {}; #define astAssert(CONDITION, DESCRIPTION) \ assertThrow(CONDITION, ::solidity::langutil::InvalidAstError, DESCRIPTION) +/** + * Unique identifiers are used to tag and track individual error cases. + * They are passed as the first parameter of error reporting functions. + * Suffix _error helps to find them in the sources. + * The struct ErrorId prevents incidental calls like typeError(3141) instead of typeError(3141_error). + * To create a new ID, one can add 0000_error and then run "python ./scripts/correct_error_ids.py" + * from the root of the repo. + */ +struct ErrorId { unsigned long long error = 0; }; +constexpr ErrorId operator"" _error(unsigned long long _error) { return ErrorId{ _error }; } + class Error: virtual public util::Exception { public: @@ -69,14 +80,16 @@ class Error: virtual public util::Exception Warning }; - explicit Error( + Error( + ErrorId _errorId, Type _type, SourceLocation const& _location = SourceLocation(), std::string const& _description = std::string() ); - Error(Type _type, std::string const& _description, SourceLocation const& _location = SourceLocation()); + Error(ErrorId _errorId, Type _type, std::string const& _description, SourceLocation const& _location = SourceLocation()); + ErrorId errorId() const { return m_errorId; } Type type() const { return m_type; } std::string const& typeName() const { return m_typeName; } @@ -100,6 +113,7 @@ class Error: virtual public util::Exception return true; } private: + ErrorId m_errorId; Type m_type; std::string m_typeName; }; diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index fbb119e42829..66681ea10790 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -172,8 +172,7 @@ void StorageOffsets::computeOffsets(TypePointers const& _types) ++slotOffset; byteOffset = 0; } - if (slotOffset >= bigint(1) << 256) - BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Object too large for storage.")); + solAssert(slotOffset < bigint(1) << 256 ,"Object too large for storage."); offsets[i] = make_pair(u256(slotOffset), byteOffset); solAssert(type->storageSize() >= 1, "Invalid storage size."); if (type->storageSize() == 1 && byteOffset + type->storageBytes() <= 32) @@ -186,8 +185,7 @@ void StorageOffsets::computeOffsets(TypePointers const& _types) } if (byteOffset > 0) ++slotOffset; - if (slotOffset >= bigint(1) << 256) - BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Object too large for storage.")); + solAssert(slotOffset < bigint(1) << 256, "Object too large for storage."); m_storageSize = u256(slotOffset); swap(m_offsets, offsets); } @@ -1776,8 +1774,7 @@ u256 ArrayType::storageSize() const } else size = bigint(length()) * baseType()->storageSize(); - if (size >= bigint(1) << 256) - BOOST_THROW_EXCEPTION(Error(Error::Type::TypeError) << util::errinfo_comment("Array too large for storage.")); + solAssert(size < bigint(1) << 256, "Array too large for storage."); return max(1, u256(size)); } From b90fb1cab69ff186fe8ad0ad6480006850b263ee Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 11:26:32 +0200 Subject: [PATCH 149/479] [SMTChecker] Fix ICE on index access assignment inside single branches --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 573d83e5bec8..9f06339b84b8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,6 +27,7 @@ Bugfixes: * Code Generator: Trigger proper unimplemented errors on certain array copy operations. * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. + * SMTChecker: Fix internal error when assigning to index access inside branches. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index be9bea10f867..6729703b7b0e 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -361,7 +361,12 @@ void SMTEncoder::endVisit(Assignment const& _assignment) else if (!smt::isSupportedType(_assignment.annotation().type->category())) { // Give it a new index anyway to keep the SSA scheme sound. - if (auto varDecl = identifierToVariable(_assignment.leftHandSide())) + + Expression const* base = &_assignment.leftHandSide(); + if (auto const* indexAccess = dynamic_cast(base)) + base = leftmostBase(*indexAccess); + + if (auto varDecl = identifierToVariable(*base)) m_context.newValue(*varDecl); } else From 9b0146be422ce687909411455db08c6ffaec5cd8 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 28 May 2020 12:28:22 +0200 Subject: [PATCH 150/479] Add test --- .../types/mapping_struct_assignment.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol diff --git a/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol b/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol new file mode 100644 index 000000000000..1bcf2a2ebcae --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol @@ -0,0 +1,19 @@ +pragma experimental SMTChecker; +contract C +{ + struct S { + uint x; + } + mapping (uint => S) smap; + function f(uint y, uint v) public { + if (0==1) + smap[y] = S(v); + } +} +// ---- +// Warning: (140-144): Condition is always false. +// Warning: (149-156): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (159-160): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning: (159-163): Assertion checker does not yet implement type struct C.S memory +// Warning: (159-163): Assertion checker does not yet implement this expression. +// Warning: (149-163): Assertion checker does not yet implement type struct C.S storage ref From c96196c346b2c5895b25271be8ba69160763efca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 25 May 2020 20:57:04 +0200 Subject: [PATCH 151/479] Define constants to make flag meanings more apparent in binary wasm --- libyul/backends/wasm/BinaryTransform.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index f5dfd8410810..84e3650162e2 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -39,6 +39,18 @@ bytes toBytes(uint8_t _b) return bytes(1, _b); } +enum class LimitsKind: uint8_t +{ + Min = 0x00, + MinMax = 0x01, +}; + +enum class Mutability: uint8_t +{ + Const = 0x00, + Var = 0x01, +}; + enum class Section: uint8_t { CUSTOM = 0x00, @@ -530,8 +542,8 @@ bytes BinaryTransform::functionSection(vector const& _functi bytes BinaryTransform::memorySection() { bytes result = lebEncode(1); - result.push_back(0); // flags - result.push_back(1); // initial + result.push_back(static_cast(LimitsKind::Min)); + result.push_back(1); // initial length return makeSection(Section::MEMORY, std::move(result)); } @@ -540,8 +552,8 @@ bytes BinaryTransform::globalSection() bytes result = lebEncode(m_globals.size()); for (size_t i = 0; i < m_globals.size(); ++i) result += - // mutable i64 - bytes{uint8_t(ValueType::I64), 1} + + toBytes(ValueType::I64) + + lebEncode(static_cast(Mutability::Var)) + toBytes(Opcode::I64Const) + lebEncodeSigned(0) + toBytes(Opcode::End); From e5d25692a5cc77641e424fdd7375191a269359f6 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 29 May 2020 18:13:03 +0200 Subject: [PATCH 152/479] [SMTChecker] Fix BMC targets with FP --- libsolidity/formal/BMC.cpp | 13 +++++++-- libsolidity/formal/SMTEncoder.cpp | 29 +++++++++++++------ .../operators/fixed_point_add.sol | 12 ++++++++ .../operators/fixed_point_compound_add.sol | 8 +++++ 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index 8ec6b3564b6e..8f74dbb3e8b3 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -604,7 +604,11 @@ void BMC::checkUnderflow(BMCVerificationTarget& _target, smtutil::Expression con _target.type == VerificationTarget::Type::UnderOverflow, "" ); - auto intType = dynamic_cast(_target.expression->annotation().type); + IntegerType const* intType = nullptr; + if (auto const* type = dynamic_cast(_target.expression->annotation().type)) + intType = type; + else + intType = TypeProvider::uint256(); solAssert(intType, ""); checkCondition( _target.constraints && _constraints && _target.value < smt::minValue(*intType), @@ -626,7 +630,12 @@ void BMC::checkOverflow(BMCVerificationTarget& _target, smtutil::Expression cons _target.type == VerificationTarget::Type::UnderOverflow, "" ); - auto intType = dynamic_cast(_target.expression->annotation().type); + IntegerType const* intType = nullptr; + if (auto const* type = dynamic_cast(_target.expression->annotation().type)) + intType = type; + else + intType = TypeProvider::uint256(); + solAssert(intType, ""); checkCondition( _target.constraints && _constraints && _target.value > smt::maxValue(*intType), diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 6729703b7b0e..048c0930edbb 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1193,7 +1193,7 @@ void SMTEncoder::arithmeticOperation(BinaryOperation const& _op) { auto type = _op.annotation().commonType; solAssert(type, ""); - if (type->category() == Type::Category::Integer) + if (type->category() == Type::Category::Integer || type->category() == Type::Category::FixedPoint) { switch (_op.getOperator()) { @@ -1246,13 +1246,21 @@ pair SMTEncoder::arithmeticOperation( }; solAssert(validOperators.count(_op), ""); solAssert(_commonType, ""); - solAssert(_commonType->category() == Type::Category::Integer, ""); + solAssert( + _commonType->category() == Type::Category::Integer || _commonType->category() == Type::Category::FixedPoint, + "" + ); + + IntegerType const* intType = nullptr; + if (auto type = dynamic_cast(_commonType)) + intType = type; + else + intType = TypeProvider::uint256(); - auto const& intType = dynamic_cast(*_commonType); smtutil::Expression valueNoMod( _op == Token::Add ? _left + _right : _op == Token::Sub ? _left - _right : - _op == Token::Div ? division(_left, _right, intType) : + _op == Token::Div ? division(_left, _right, *intType) : _op == Token::Mul ? _left * _right : /*_op == Token::Mod*/ _left % _right ); @@ -1260,20 +1268,23 @@ pair SMTEncoder::arithmeticOperation( if (_op == Token::Div || _op == Token::Mod) m_context.addAssertion(_right != 0); - smtutil::Expression intValueRange = (0 - smt::minValue(intType)) + smt::maxValue(intType) + 1; + auto symbMin = smt::minValue(*intType); + auto symbMax = smt::maxValue(*intType); + + smtutil::Expression intValueRange = (0 - symbMin) + symbMax + 1; auto value = smtutil::Expression::ite( - valueNoMod > smt::maxValue(intType), + valueNoMod > symbMax, valueNoMod % intValueRange, smtutil::Expression::ite( - valueNoMod < smt::minValue(intType), + valueNoMod < symbMin, valueNoMod % intValueRange, valueNoMod ) ); - if (intType.isSigned()) + if (intType->isSigned()) value = smtutil::Expression::ite( - value > smt::maxValue(intType), + value > symbMax, value - intValueRange, value ); diff --git a/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol b/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol new file mode 100644 index 000000000000..23a05e619bd5 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; +contract test { + function f() internal pure { + ufixed a = uint64(1) + ufixed(2); + } +} +// ---- +// Warning: (80-88): Unused local variable. +// Warning: (91-100): Type conversion is not yet fully supported and might yield false positives. +// Warning: (103-112): Type conversion is not yet fully supported and might yield false positives. +// Warning: (91-112): Underflow (resulting value less than 0) happens here +// Warning: (91-112): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol b/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol new file mode 100644 index 000000000000..d4cbbc696f8c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol @@ -0,0 +1,8 @@ +pragma experimental SMTChecker; +contract C { + fixed[] b; + function f() internal { b[0] += 1; } +} +// ---- +// Warning: (84-93): Underflow (resulting value less than 0) happens here +// Warning: (84-93): Overflow (resulting value larger than 2**256 - 1) happens here From 2128ff9f137cd6be7be283a7bfc7cffb08773695 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 29 May 2020 19:13:27 +0200 Subject: [PATCH 153/479] Fix ICE on push for member access --- libsolidity/formal/SMTEncoder.cpp | 6 ++++ .../array_members/push_struct_member_1.sol | 27 +++++++++++++++ .../array_members/push_struct_member_2.sol | 33 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 6729703b7b0e..8ed8d71faa7c 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1150,6 +1150,12 @@ void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression } else if (auto const* indexAccess = dynamic_cast(&_expr)) arrayIndexAssignment(*indexAccess, _array); + else if (dynamic_cast(&_expr)) + m_errorReporter.warning( + 9599_error, + _expr.location(), + "Assertion checker does not yet implement this expression." + ); else solAssert(false, ""); } diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol new file mode 100644 index 000000000000..4647742dbba1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol @@ -0,0 +1,27 @@ +pragma experimental SMTChecker; +contract C { + struct S { + int[] b; + } + S s; + struct T { + S s; + } + T t; + function f() public { + s.b.push(); + t.s.b.push(); + } +} + +// ---- +// Warning: (72-75): Assertion checker does not yet support the type of this variable. +// Warning: (100-103): Assertion checker does not yet support the type of this variable. +// Warning: (130-133): Assertion checker does not yet support this expression. +// Warning: (130-131): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (130-133): Assertion checker does not yet implement this expression. +// Warning: (144-149): Assertion checker does not yet support this expression. +// Warning: (144-147): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (144-147): Assertion checker does not yet support this expression. +// Warning: (144-145): Assertion checker does not yet implement type struct C.T storage ref +// Warning: (144-149): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol new file mode 100644 index 000000000000..353d328fd175 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol @@ -0,0 +1,33 @@ +pragma experimental SMTChecker; +contract C { + struct S { + int[] b; + } + S s; + struct T { + S[] s; + } + T t; + function f() public { + s.b.push(); + t.s.push(); + t.s[0].b.push(); + } +} + +// ---- +// Warning: (72-75): Assertion checker does not yet support the type of this variable. +// Warning: (102-105): Assertion checker does not yet support the type of this variable. +// Warning: (132-135): Assertion checker does not yet support this expression. +// Warning: (132-133): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (132-135): Assertion checker does not yet implement this expression. +// Warning: (146-149): Assertion checker does not yet support this expression. +// Warning: (146-147): Assertion checker does not yet implement type struct C.T storage ref +// Warning: (146-156): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (146-149): Assertion checker does not yet implement this expression. +// Warning: (160-168): Assertion checker does not yet support this expression. +// Warning: (160-163): Assertion checker does not yet support this expression. +// Warning: (160-161): Assertion checker does not yet implement type struct C.T storage ref +// Warning: (160-166): Assertion checker does not yet implement type struct C.S storage ref +// Warning: (160-166): Assertion checker does not yet implement this expression. +// Warning: (160-168): Assertion checker does not yet implement this expression. From 7ce760388f24a3f63d95f81fa7fbc7a4cf09c88a Mon Sep 17 00:00:00 2001 From: Flash Sheridan Date: Fri, 29 May 2020 16:50:05 -0400 Subject: [PATCH 154/479] Spell-check --- docs/060-breaking-changes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index a1ee96d952df..a661f1518893 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -16,8 +16,8 @@ This section lists changes where the behaviour of your code might change without the compiler telling you about it. * The resulting type of an exponentiation is the type of the base. It used to be the smallest type - that can hold both the type of the base and the type of the exponent, as with symmentric - operations. Additionally, signed types are allowed for the base of the exponetation. + that can hold both the type of the base and the type of the exponent, as with symmetric + operations. Additionally, signed types are allowed for the base of the exponentiation. Explicitness Requirements From 36b54561a57894967bdf9e3495f303826aa07eb3 Mon Sep 17 00:00:00 2001 From: Flash Sheridan Date: Fri, 29 May 2020 17:09:15 -0400 Subject: [PATCH 155/479] Fix grammar and remove redundant words --- docs/060-breaking-changes.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index a1ee96d952df..45fb3dba33b3 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -36,9 +36,9 @@ For most of the topics the compiler will provide suggestions. like so: ``override(Base1, Base2)``. * Member-access to ``length`` of arrays is now always read-only, even for storage arrays. It is no - longer possible to resize storage arrays assigning a new value to their length. Use ``push()``, - ``push(value)`` or ``pop()`` instead, or assign a full array, which will of course overwrite existing content. - The reason behind this is to prevent storage collisions by gigantic + longer possible to resize storage arrays by assigning a new value to their length. Use ``push()``, + ``push(value)`` or ``pop()`` instead, or assign a full array, which will of course overwrite the existing content. + The reason behind this is to prevent storage collisions of gigantic storage arrays. * The new keyword ``abstract`` can be used to mark contracts as abstract. It has to be used @@ -86,7 +86,7 @@ New Features ============ This section lists things that were not possible prior to Solidity 0.6.0 -or at least were more difficult to achieve prior to Solidity 0.6.0. +or were more difficult to achieve. * The :ref:`try/catch statement ` allows you to react on failed external calls. * ``struct`` and ``enum`` types can be declared at file level. @@ -103,7 +103,7 @@ Interface Changes This section lists changes that are unrelated to the language itself, but that have an effect on the interfaces of the compiler. These may change the way how you use the compiler on the command line, how you use its programmable -interface or how you analyze the output produced by it. +interface, or how you analyze the output produced by it. New Error Reporter ~~~~~~~~~~~~~~~~~~ From ef133aa670db20d34177f674c927c2c82f3aeb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 29 May 2020 21:21:42 +0200 Subject: [PATCH 156/479] CommandLineInterface: Display an error instead of crashing when assembly variant has no Ewasm translation --- solc/CommandLineInterface.cpp | 6 ++++++ test/cmdlineTests/evm_to_wasm_unsupported_translation/args | 1 + test/cmdlineTests/evm_to_wasm_unsupported_translation/err | 1 + test/cmdlineTests/evm_to_wasm_unsupported_translation/exit | 1 + .../evm_to_wasm_unsupported_translation/input.yul | 3 +++ .../cmdlineTests/evm_to_wasm_unsupported_translation/output | 1 + 6 files changed, 13 insertions(+) create mode 100644 test/cmdlineTests/evm_to_wasm_unsupported_translation/args create mode 100644 test/cmdlineTests/evm_to_wasm_unsupported_translation/err create mode 100644 test/cmdlineTests/evm_to_wasm_unsupported_translation/exit create mode 100644 test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul create mode 100644 test/cmdlineTests/evm_to_wasm_unsupported_translation/output diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index a8e5cc5b7fba..1cee24807b33 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1172,6 +1172,12 @@ bool CommandLineInterface::processInput() endl; return false; } + if (targetMachine == Machine::Ewasm && inputLanguage != Input::StrictAssembly && inputLanguage != Input::Ewasm) + { + serr() << "The selected input language is not directly supported when targeting the Ewasm machine "; + serr() << "and automatic translation is not available." << endl; + return false; + } serr() << "Warning: Yul is still experimental. Please use the output with care." << endl; diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/args b/test/cmdlineTests/evm_to_wasm_unsupported_translation/args new file mode 100644 index 000000000000..cc6c07083182 --- /dev/null +++ b/test/cmdlineTests/evm_to_wasm_unsupported_translation/args @@ -0,0 +1 @@ +--assemble --machine ewasm diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/err b/test/cmdlineTests/evm_to_wasm_unsupported_translation/err new file mode 100644 index 000000000000..5ef050f64424 --- /dev/null +++ b/test/cmdlineTests/evm_to_wasm_unsupported_translation/err @@ -0,0 +1 @@ +The selected input language is not directly supported when targeting the Ewasm machine and automatic translation is not available. diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/exit b/test/cmdlineTests/evm_to_wasm_unsupported_translation/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/evm_to_wasm_unsupported_translation/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul b/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul new file mode 100644 index 000000000000..f21cd2b7e038 --- /dev/null +++ b/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul @@ -0,0 +1,3 @@ +{ + sstore(0, 1) +} diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/output b/test/cmdlineTests/evm_to_wasm_unsupported_translation/output new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/test/cmdlineTests/evm_to_wasm_unsupported_translation/output @@ -0,0 +1 @@ + From 311f025eb54f3b754f262d8a94043ffc402623a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 1 Jun 2020 18:17:50 +0200 Subject: [PATCH 157/479] SolidityExecutionFramework: Fix compileContract() to print Yul errors from the correct source --- test/libsolidity/SolidityExecutionFramework.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 0afe95c6d246..d5e9c82cf901 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -76,7 +76,7 @@ bytes SolidityExecutionFramework::compileContract( { langutil::SourceReferenceFormatter formatter(std::cerr); - for (auto const& error: m_compiler.errors()) + for (auto const& error: asmStack.errors()) formatter.printErrorInformation(*error); BOOST_ERROR("Assembly contract failed. IR: " + m_compiler.yulIROptimized({})); } From df7b82bf31ba23e23e4b5529523331fe6181d9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 1 Jun 2020 18:24:31 +0200 Subject: [PATCH 158/479] SolidityExecutionFramework: Remove dead code for handling errors from parsing and analysis - This code can never be reached because CompilerStack.compile() called above does the same analysis and fails if it's not successful. --- test/libsolidity/SolidityExecutionFramework.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index d5e9c82cf901..1ab2c1db0e44 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -72,14 +72,9 @@ bytes SolidityExecutionFramework::compileContract( // get code that does not exhaust the stack. OptimiserSettings::full() ); - if (!asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName))) - { - langutil::SourceReferenceFormatter formatter(std::cerr); + bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); + solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); - for (auto const& error: asmStack.errors()) - formatter.printErrorInformation(*error); - BOOST_ERROR("Assembly contract failed. IR: " + m_compiler.yulIROptimized({})); - } asmStack.optimize(); obj = std::move(*asmStack.assemble(yul::AssemblyStack::Machine::EVM).bytecode); } From 9bb9b6345c032635f15f1a63ddc0c4ab26196c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 1 Jun 2020 18:25:02 +0200 Subject: [PATCH 159/479] SolidityExecutionFramework: Fix indentation - This code can never be reached because CompilerStack.compile() called above does the same analysis and fails if it's not successful. --- test/libsolidity/SolidityExecutionFramework.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 1ab2c1db0e44..5e4ebe088b22 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -66,12 +66,12 @@ bytes SolidityExecutionFramework::compileContract( if (m_compileViaYul) { yul::AssemblyStack asmStack( - m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, - // Ignore optimiser settings here because we need Yul optimisation to - // get code that does not exhaust the stack. - OptimiserSettings::full() - ); + m_evmVersion, + yul::AssemblyStack::Language::StrictAssembly, + // Ignore optimiser settings here because we need Yul optimisation to + // get code that does not exhaust the stack. + OptimiserSettings::full() + ); bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); From 2d7edeea3fb0ba19a4b1a159519cb4bb8f4e79a9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 11 May 2020 15:41:39 +0100 Subject: [PATCH 160/479] Add shortcut to to/fromHex for empty input and fix signedness warning --- libsolutil/CommonData.cpp | 8 +++++++- libsolutil/CommonData.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index bb1a7696c974..d23a2ce6c0cf 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -53,6 +53,9 @@ string solidity::util::toHex(uint8_t _data, HexCase _case) string solidity::util::toHex(bytes const& _data, HexPrefix _prefix, HexCase _case) { + if (_data.empty()) + return {}; + std::string ret(_data.size() * 2 + (_prefix == HexPrefix::Add ? 2 : 0), 0); size_t i = 0; @@ -64,7 +67,7 @@ string solidity::util::toHex(bytes const& _data, HexPrefix _prefix, HexCase _cas // Mixed case will be handled inside the loop. char const* chars = _case == HexCase::Upper ? upperHexChars : lowerHexChars; - int rix = _data.size() - 1; + size_t rix = _data.size() - 1; for (uint8_t c: _data) { // switch hex case every four hexchars @@ -95,6 +98,9 @@ int solidity::util::fromHex(char _i, WhenError _throw) bytes solidity::util::fromHex(std::string const& _s, WhenError _throw) { + if (_s.empty()) + return {}; + unsigned s = (_s.size() >= 2 && _s[0] == '0' && _s[1] == 'x') ? 2 : 0; std::vector ret; ret.reserve((_s.size() - s + 1) / 2); diff --git a/libsolutil/CommonData.h b/libsolutil/CommonData.h index adac1fb051e8..8fbe20568a57 100644 --- a/libsolutil/CommonData.h +++ b/libsolutil/CommonData.h @@ -299,7 +299,7 @@ template inline bytes toCompactBigEndian(T _val, unsigned _min = 0) { static_assert(std::is_same::value || !std::numeric_limits::is_signed, "only unsigned types or bigint supported"); //bigint does not carry sign bit on shift - int i = 0; + unsigned i = 0; for (T v = _val; v; ++i, v >>= 8) {} bytes ret(std::max(_min, i), 0); toBigEndian(_val, ret); From 0bc9f772e776026548928a7f214b1498e69f7861 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Fri, 29 May 2020 17:21:16 +0530 Subject: [PATCH 161/479] Added an assert for FixedPointType in InlineAssembly --- libsolidity/analysis/TypeChecker.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6066893687bf..075078e66afd 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -699,6 +699,8 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } } + solAssert(!dynamic_cast(var->type()), "FixedPointType not implemented."); + if (requiresStorage) { if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage)) From ede39fc2dad819acc5027196af7cf9fae0a28fdd Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 29 May 2020 18:20:15 +0200 Subject: [PATCH 162/479] [SMTChecker] Relax assertion about callstack --- libsolidity/formal/VariableUsage.cpp | 3 +-- .../functions/internal_call_state_var_init_2.sol | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol diff --git a/libsolidity/formal/VariableUsage.cpp b/libsolidity/formal/VariableUsage.cpp index acfd34909b25..11ca44ff3be0 100644 --- a/libsolidity/formal/VariableUsage.cpp +++ b/libsolidity/formal/VariableUsage.cpp @@ -104,8 +104,7 @@ void VariableUsage::checkIdentifier(Identifier const& _identifier) solAssert(declaration, ""); if (VariableDeclaration const* varDecl = dynamic_cast(declaration)) { - solAssert(m_lastCall, ""); - if (!varDecl->isLocalVariable() || varDecl->functionOrModifierDefinition() == m_lastCall) + if (!varDecl->isLocalVariable() || (m_lastCall && varDecl->functionOrModifierDefinition() == m_lastCall)) m_touchedVariables.insert(varDecl); } } diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol new file mode 100644 index 000000000000..285bfb15d763 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; +contract c { + uint x; + function f() internal returns (uint) { + x = x + 1; + } + bool b = (f() > 0) || (f() > 0); +} +// ---- +// Warning: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning: (100-105): Underflow (resulting value less than 0) happens here +// Warning: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here From bdc2c63327fa52e80182f0ede34d2aee159207a9 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Thu, 28 May 2020 16:09:52 +0200 Subject: [PATCH 163/479] Output error when forward referencing constants in inline assembly --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 25 +++++++++++++------ .../const_forward_reference.sol | 8 ++++++ .../invalid/const_forward_reference.sol | 12 +++++++++ 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/const_forward_reference.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol diff --git a/Changelog.md b/Changelog.md index 573d83e5bec8..ebde3000b7bc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,6 +22,7 @@ Bugfixes: * Type Checker: Fix internal compiler error when accessing members of array slices. * Type Checker: Fix internal compiler error when trying to decode too large static arrays. * Type Checker: Fix wrong compiler error when referencing an overridden function without calling it. + * Type Checker: Fix internal compiler error when forward referencing non-literal constants from inline assembly. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index e6694043ce77..afdc7c869e56 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -691,14 +691,6 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) m_errorReporter.typeError(3224_error, _identifier.location, "Constant has no value."); return size_t(-1); } - else if (!var || !type(*var)->isValueType() || ( - dynamic_cast(var->value().get()) == nullptr && - type(*var->value())->category() != Type::Category::RationalNumber - )) - { - m_errorReporter.typeError(7615_error, _identifier.location, "Only direct number constants and references to such constants are supported by inline assembly."); - return size_t(-1); - } else if (_context == yul::IdentifierContext::LValue) { m_errorReporter.typeError(6252_error, _identifier.location, "Constant variables cannot be assigned to."); @@ -709,6 +701,23 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) m_errorReporter.typeError(6617_error, _identifier.location, "The suffixes _offset and _slot can only be used on non-constant storage variables."); return size_t(-1); } + else if (var && var->value() && !var->value()->annotation().type && !dynamic_cast(var->value().get())) + { + m_errorReporter.typeError( + 2249_error, + _identifier.location, + "Constant variables with non-literal values cannot be forward referenced from inline assembly." + ); + return size_t(-1); + } + else if (!var || !type(*var)->isValueType() || ( + !dynamic_cast(var->value().get()) && + type(*var->value())->category() != Type::Category::RationalNumber + )) + { + m_errorReporter.typeError(7615_error, _identifier.location, "Only direct number constants and references to such constants are supported by inline assembly."); + return size_t(-1); + } } if (requiresStorage) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/const_forward_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/const_forward_reference.sol new file mode 100644 index 000000000000..8c61d318d08d --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/const_forward_reference.sol @@ -0,0 +1,8 @@ +contract C { + function f() public pure { + assembly { + pop(add(add(1, 2), c)) + } + } + int constant c = 1; +} diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol new file mode 100644 index 000000000000..b8d7c021211a --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol @@ -0,0 +1,12 @@ +contract C { + function f() { + assembly { + c := add(add(1, 2), c) + } + } + int constant c = 0 + 1; +} +// ---- +// SyntaxError: (15-83): No visibility specified. Did you intend to add "public"? +// TypeError: (71-72): Constant variables with non-literal values cannot be forward referenced from inline assembly. +// TypeError: (51-52): Constant variables cannot be assigned to. From 79407c87fb7c54d6924d9262ee3f6a7d6d73cce5 Mon Sep 17 00:00:00 2001 From: ssi91 Date: Mon, 25 May 2020 20:31:24 +0700 Subject: [PATCH 164/479] remove extra definition of printIndented add CommonBaseTestCase class and inherit some of TestCase classes from it. Since that, remove print source extra definitions create the base defifnition for printUpdatedExpectations and remove extra definitions of the method make CommonBaseTestCase c-tor explicit include AnsiColorized.h and sort includes implement a common result checker move the common implementations into TastCase --- test/TestCase.cpp | 33 +++++++++++++++++++++++++-- test/TestCase.h | 9 ++++++-- test/libsolidity/ABIJsonTest.cpp | 21 +---------------- test/libsolidity/ABIJsonTest.h | 8 ------- test/libsolidity/ASTJSONTest.h | 1 - test/libsolidity/GasTest.h | 1 - test/libyul/EwasmTranslationTest.cpp | 22 +----------------- test/libyul/EwasmTranslationTest.h | 7 ------ test/libyul/FunctionSideEffects.cpp | 34 +--------------------------- test/libyul/FunctionSideEffects.h | 10 -------- test/libyul/ObjectCompilerTest.cpp | 33 +-------------------------- test/libyul/ObjectCompilerTest.h | 7 ------ test/libyul/YulInterpreterTest.cpp | 22 +----------------- test/libyul/YulInterpreterTest.h | 7 ------ test/libyul/YulOptimizerTest.cpp | 22 +----------------- test/libyul/YulOptimizerTest.h | 6 ----- 16 files changed, 44 insertions(+), 199 deletions(-) diff --git a/test/TestCase.cpp b/test/TestCase.cpp index 23f23ac7398b..e6f4b212aab5 100644 --- a/test/TestCase.cpp +++ b/test/TestCase.cpp @@ -18,11 +18,13 @@ #include #include -#include +#include + #include +#include -#include #include +#include using namespace std; using namespace solidity; @@ -78,6 +80,33 @@ void TestCase::printIndented(ostream& _stream, string const& _output, string con _stream << _linePrefix << line << endl; } +void TestCase::printSource(ostream& _stream, string const& _linePrefix, bool const) const +{ + printIndented(_stream, m_source, _linePrefix); +} + +void TestCase::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const +{ + printIndented(_stream, m_obtainedResult, _linePrefix); +} + +TestCase::TestResult TestCase::checkResult(std::ostream& _stream, const std::string& _linePrefix, bool const _formatted) +{ + if (m_expectation != m_obtainedResult) + { + string nextIndentLevel = _linePrefix + " "; + util::AnsiColorized(_stream, _formatted, {util::formatting::BOLD, util::formatting::CYAN}) + << _linePrefix << "Expected result:" << endl; + // TODO could compute a simple diff with highlighted lines + printIndented(_stream, m_expectation, nextIndentLevel); + util::AnsiColorized(_stream, _formatted, {util::formatting::BOLD, util::formatting::CYAN}) + << _linePrefix << "Obtained result:" << endl; + printIndented(_stream, m_obtainedResult, nextIndentLevel); + return TestResult::Failure; + } + return TestResult::Success; +} + EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase(string const& _filename): TestCase(_filename) { diff --git a/test/TestCase.h b/test/TestCase.h index 442b4fd5f16d..f846b7f87f46 100644 --- a/test/TestCase.h +++ b/test/TestCase.h @@ -57,14 +57,14 @@ class TestCase /// Each line of output is prefixed with @arg _linePrefix. /// If @arg _formatted is true, color-coding may be used to indicate /// error locations in the contract, if applicable. - virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0; + virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const; /// Outputs settings. virtual void printSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false); /// Outputs updated settings virtual void printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix = ""); /// Outputs test expectations to @arg _stream that match the actual results of the test. /// Each line of output is prefixed with @arg _linePrefix. - virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0; + virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const; static bool isTestFilename(boost::filesystem::path const& _filename); @@ -97,6 +97,11 @@ class TestCase } void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const; + TestCase::TestResult checkResult(std::ostream& _stream, const std::string& _linePrefix, bool const _formatted); + + std::string m_source; + std::string m_obtainedResult; + std::string m_expectation; TestCaseReader m_reader; bool m_shouldRun = true; diff --git a/test/libsolidity/ABIJsonTest.cpp b/test/libsolidity/ABIJsonTest.cpp index a46c1d470bc9..aa8153454d42 100644 --- a/test/libsolidity/ABIJsonTest.cpp +++ b/test/libsolidity/ABIJsonTest.cpp @@ -64,25 +64,6 @@ TestCase::TestResult ABIJsonTest::run(ostream& _stream, string const& _linePrefi m_obtainedResult += jsonPrettyPrint(compiler.contractABI(contractName)) + "\n"; first = false; } - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - -void ABIJsonTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void ABIJsonTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); + return checkResult(_stream, _linePrefix, _formatted); } diff --git a/test/libsolidity/ABIJsonTest.h b/test/libsolidity/ABIJsonTest.h index 3a7cd397cb72..702d36dbfe98 100644 --- a/test/libsolidity/ABIJsonTest.h +++ b/test/libsolidity/ABIJsonTest.h @@ -36,14 +36,6 @@ class ABIJsonTest: public TestCase ABIJsonTest(std::string const& _filename); TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - - void printSource(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - -private: - std::string m_source; - std::string m_expectation; - std::string m_obtainedResult; }; } diff --git a/test/libsolidity/ASTJSONTest.h b/test/libsolidity/ASTJSONTest.h index 92658edd6ccf..45d7a08b9c0b 100644 --- a/test/libsolidity/ASTJSONTest.h +++ b/test/libsolidity/ASTJSONTest.h @@ -41,7 +41,6 @@ class ASTJSONTest: public TestCase void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; private: std::vector> m_sources; - std::string m_expectation; std::string m_expectationLegacy; std::string m_astFilename; std::string m_legacyAstFilename; diff --git a/test/libsolidity/GasTest.h b/test/libsolidity/GasTest.h index 861e47bc93c0..d8bd0acadda0 100644 --- a/test/libsolidity/GasTest.h +++ b/test/libsolidity/GasTest.h @@ -47,7 +47,6 @@ class GasTest: AnalysisFramework, public TestCase bool m_optimise = false; bool m_optimiseYul = false; size_t m_optimiseRuns = 200; - std::string m_source; std::map> m_expectations; }; diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index 46ede42213fa..8ef5ba0a01a6 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -71,27 +71,7 @@ TestCase::TestResult EwasmTranslationTest::run(ostream& _stream, string const& _ m_obtainedResult = interpret(); - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - // TODO could compute a simple diff with highlighted lines - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - -void EwasmTranslationTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void EwasmTranslationTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); + return checkResult(_stream, _linePrefix, _formatted); } bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) diff --git a/test/libyul/EwasmTranslationTest.h b/test/libyul/EwasmTranslationTest.h index f9c6e1d3cb68..e0a90482bc46 100644 --- a/test/libyul/EwasmTranslationTest.h +++ b/test/libyul/EwasmTranslationTest.h @@ -42,20 +42,13 @@ class EwasmTranslationTest: public solidity::frontend::test::EVMVersionRestricte TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - private: bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted); std::string interpret(); static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors); - std::string m_source; - std::string m_expectation; - std::shared_ptr m_object; - std::string m_obtainedResult; }; } diff --git a/test/libyul/FunctionSideEffects.cpp b/test/libyul/FunctionSideEffects.cpp index 3d3461b0effb..aa7d1e503927 100644 --- a/test/libyul/FunctionSideEffects.cpp +++ b/test/libyul/FunctionSideEffects.cpp @@ -87,37 +87,5 @@ TestCase::TestResult FunctionSideEffects::run(ostream& _stream, string const& _l for (auto const& fun: functionSideEffectsStr) m_obtainedResult += fun.first + ":" + (fun.second.empty() ? "" : " ") + fun.second + "\n"; - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - - -void FunctionSideEffects::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void FunctionSideEffects::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); -} - -void FunctionSideEffects::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const -{ - stringstream output(_output); - string line; - while (getline(output, line)) - if (line.empty()) - // Avoid trailing spaces. - _stream << boost::trim_right_copy(_linePrefix) << endl; - else - _stream << _linePrefix << line << endl; + return checkResult(_stream, _linePrefix, _formatted); } diff --git a/test/libyul/FunctionSideEffects.h b/test/libyul/FunctionSideEffects.h index b35994b00722..23bebebcc846 100644 --- a/test/libyul/FunctionSideEffects.h +++ b/test/libyul/FunctionSideEffects.h @@ -36,16 +36,6 @@ class FunctionSideEffects: public solidity::frontend::test::TestCase explicit FunctionSideEffects(std::string const& _filename); TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - - void printSource(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - -private: - void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const; - - std::string m_source; - std::string m_expectation; - std::string m_obtainedResult; }; } diff --git a/test/libyul/ObjectCompilerTest.cpp b/test/libyul/ObjectCompilerTest.cpp index 9dd589748f80..4b34da7b11bd 100644 --- a/test/libyul/ObjectCompilerTest.cpp +++ b/test/libyul/ObjectCompilerTest.cpp @@ -78,38 +78,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li (obj.sourceMappings->empty() ? "" : " " + *obj.sourceMappings) + "\n"; - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - -void ObjectCompilerTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void ObjectCompilerTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); -} - -void ObjectCompilerTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const -{ - stringstream output(_output); - string line; - while (getline(output, line)) - if (line.empty()) - // Avoid trailing spaces. - _stream << boost::trim_right_copy(_linePrefix) << endl; - else - _stream << _linePrefix << line << endl; + return checkResult(_stream, _linePrefix, _formatted); } void ObjectCompilerTest::printErrors(ostream& _stream, ErrorList const& _errors) diff --git a/test/libyul/ObjectCompilerTest.h b/test/libyul/ObjectCompilerTest.h index dc02d504cfda..4a1c75486b1e 100644 --- a/test/libyul/ObjectCompilerTest.h +++ b/test/libyul/ObjectCompilerTest.h @@ -47,20 +47,13 @@ class ObjectCompilerTest: public solidity::frontend::test::TestCase TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - private: - void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const; bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted); void disambiguate(); static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors); - std::string m_source; bool m_optimize = false; - std::string m_expectation; - std::string m_obtainedResult; }; } diff --git a/test/libyul/YulInterpreterTest.cpp b/test/libyul/YulInterpreterTest.cpp index 69e2c8d10add..9925b95463f5 100644 --- a/test/libyul/YulInterpreterTest.cpp +++ b/test/libyul/YulInterpreterTest.cpp @@ -59,27 +59,7 @@ TestCase::TestResult YulInterpreterTest::run(ostream& _stream, string const& _li m_obtainedResult = interpret(); - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - // TODO could compute a simple diff with highlighted lines - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - -void YulInterpreterTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void YulInterpreterTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); + return checkResult(_stream, _linePrefix, _formatted); } bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) diff --git a/test/libyul/YulInterpreterTest.h b/test/libyul/YulInterpreterTest.h index ec60dbaf4d3d..ee60abe17671 100644 --- a/test/libyul/YulInterpreterTest.h +++ b/test/libyul/YulInterpreterTest.h @@ -47,21 +47,14 @@ class YulInterpreterTest: public solidity::frontend::test::EVMVersionRestrictedT TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - private: bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted); std::string interpret(); static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors); - std::string m_source; - std::string m_expectation; - std::shared_ptr m_ast; std::shared_ptr m_analysisInfo; - std::string m_obtainedResult; }; } diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 042d528dbedf..bda7c6514e20 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -354,27 +354,7 @@ TestCase::TestResult YulOptimizerTest::run(ostream& _stream, string const& _line m_obtainedResult = "step: " + m_optimizerStep + "\n\n" + AsmPrinter{ *m_dialect }(*m_ast) + "\n"; - if (m_expectation != m_obtainedResult) - { - string nextIndentLevel = _linePrefix + " "; - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl; - // TODO could compute a simple diff with highlighted lines - printIndented(_stream, m_expectation, nextIndentLevel); - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl; - printIndented(_stream, m_obtainedResult, nextIndentLevel); - return TestResult::Failure; - } - return TestResult::Success; -} - -void YulOptimizerTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const -{ - printIndented(_stream, m_source, _linePrefix); -} - -void YulOptimizerTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const -{ - printIndented(_stream, m_obtainedResult, _linePrefix); + return checkResult(_stream, _linePrefix, _formatted); } bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) diff --git a/test/libyul/YulOptimizerTest.h b/test/libyul/YulOptimizerTest.h index 374ea9b19226..3d351c3a2c06 100644 --- a/test/libyul/YulOptimizerTest.h +++ b/test/libyul/YulOptimizerTest.h @@ -56,9 +56,6 @@ class YulOptimizerTest: public solidity::frontend::test::EVMVersionRestrictedTes TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override; - void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override; - private: bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted); void disambiguate(); @@ -66,9 +63,7 @@ class YulOptimizerTest: public solidity::frontend::test::EVMVersionRestrictedTes static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors); - std::string m_source; std::string m_optimizerStep; - std::string m_expectation; Dialect const* m_dialect = nullptr; std::set m_reservedIdentifiers; @@ -77,7 +72,6 @@ class YulOptimizerTest: public solidity::frontend::test::EVMVersionRestrictedTes std::shared_ptr m_ast; std::shared_ptr m_analysisInfo; - std::string m_obtainedResult; }; } From 1ee6c490283a11ff796b8a7dfe91390a3955cc6a Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:46:37 +0200 Subject: [PATCH 165/479] Adding fixes for signedness warnings in test/tools/yulInterpreter --- test/tools/yulInterpreter/EVMInstructionInterpreter.cpp | 8 ++++---- test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp | 6 +++--- test/tools/yulInterpreter/Interpreter.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index d60b63b1090f..9c46ea856dce 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -48,10 +48,10 @@ u256 readZeroExtended(bytes const& _data, u256 const& _offset) if (_offset >= _data.size()) return 0; else if (_offset + 32 <= _data.size()) - return *reinterpret_cast(_data.data() + size_t(_offset)); + return *reinterpret_cast(_data.data() + static_cast(_offset)); else { - size_t off = size_t(_offset); + size_t off = static_cast(_offset); u256 val; for (size_t i = 0; i < 32; ++i) { @@ -88,7 +88,7 @@ u256 EVMInstructionInterpreter::eval( using evmasm::Instruction; auto info = instructionInfo(_instruction); - yulAssert(size_t(info.args) == _arguments.size(), ""); + yulAssert(static_cast(info.args) == _arguments.size(), ""); auto const& arg = _arguments; switch (_instruction) @@ -442,7 +442,7 @@ u256 EVMInstructionInterpreter::evalBuiltin(BuiltinFunctionForEVM const& _fun, c m_state.memory, m_state.code, size_t(_arguments.at(0)), - size_t(_arguments.at(1) & size_t(-1)), + size_t(_arguments.at(1) & numeric_limits::max()), size_t(_arguments.at(2)) ); } diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index e4c190e9cdca..b523e7efe2fb 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -87,9 +87,9 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a copyZeroExtended( m_state.memory, m_state.code, - size_t(_arguments.at(0)), - size_t(_arguments.at(1) & size_t(-1)), - size_t(_arguments.at(2)) + static_cast(_arguments.at(0)), + static_cast(_arguments.at(1) & numeric_limits::max()), + static_cast(_arguments.at(2)) ); return 0; } diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index 6f989b873bed..5f0861d143dd 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -54,7 +54,7 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const _out << "Memory dump:\n"; map words; for (auto const& [offset, value]: memory) - words[(offset / 0x20) * 0x20] |= u256(uint32_t(value)) << (256 - 8 - 8 * size_t(offset % 0x20)); + words[(offset / 0x20) * 0x20] |= u256(uint32_t(value)) << (256 - 8 - 8 * static_cast(offset % 0x20)); for (auto const& [offset, value]: words) if (value != 0) _out << " " << std::uppercase << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl; From 10162016ae9db4bdb07041acf261bed3dafb1e5d Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 29 May 2020 19:00:40 +0200 Subject: [PATCH 166/479] [SMTChecker] Fix internal error on try/catch --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 14 ++++++++++++++ libsolidity/formal/SMTEncoder.h | 1 + .../smtCheckerTests/control_flow/try_catch_1.sol | 12 ++++++++++++ .../smtCheckerTests/control_flow/try_catch_2.sol | 14 ++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol create mode 100644 test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol diff --git a/Changelog.md b/Changelog.md index 9f06339b84b8..9f716c799220 100644 --- a/Changelog.md +++ b/Changelog.md @@ -28,6 +28,7 @@ Bugfixes: * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. * SMTChecker: Fix internal error when assigning to index access inside branches. + * SMTChecker: Fix internal error on try/catch clauses with parameters. ### 0.6.8 (2020-05-14) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 8ed8d71faa7c..b06abbe6e95a 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -274,6 +274,20 @@ bool SMTEncoder::visit(InlineAssembly const& _inlineAsm) return false; } +bool SMTEncoder::visit(TryCatchClause const& _clause) +{ + if (auto params = _clause.parameters()) + for (auto const& var: params->parameters()) + createVariable(*var); + + m_errorReporter.warning( + 7645_error, + _clause.location(), + "Assertion checker does not support try/catch clauses." + ); + return false; +} + bool SMTEncoder::visit(IfStatement const& _node) { _node.condition().accept(*this); diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 8010ba820ef1..0e4c170fc78f 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -91,6 +91,7 @@ class SMTEncoder: public ASTConstVisitor bool visit(InlineAssembly const& _node) override; void endVisit(Break const&) override {} void endVisit(Continue const&) override {} + bool visit(TryCatchClause const& _node) override; /// Do not visit subtree if node is a RationalNumber. /// Symbolic _expr is the rational literal. diff --git a/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol b/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol new file mode 100644 index 000000000000..b41027ed4630 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; +contract C { + function g() public returns (uint) { + try this.g() returns (uint x) { x; } + catch Error(string memory s) { s; } + } +} +// ==== +// EVMVersion: >=byzantium +// ---- +// Warning: (98-121): Assertion checker does not support try/catch clauses. +// Warning: (124-159): Assertion checker does not support try/catch clauses. diff --git a/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol b/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol new file mode 100644 index 000000000000..96de0888613c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol @@ -0,0 +1,14 @@ +pragma experimental SMTChecker; +contract C { + function f() public { + try this.f() {} + catch (bytes memory x) { + x; + } + } +} +// ==== +// EVMVersion: >=byzantium +// ---- +// Warning: (83-85): Assertion checker does not support try/catch clauses. +// Warning: (88-122): Assertion checker does not support try/catch clauses. From 6f75476f52e9a992f5d89ccd3656b0dd2f9b1e2f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 2 Jun 2020 10:23:15 +0200 Subject: [PATCH 167/479] Fix documentation about return values. --- docs/contracts/functions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index f33258fe1884..acdfc01859c6 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -76,7 +76,7 @@ are initialized with their :ref:`default value ` and have that value until they are (re-)assigned. You can either explicitly assign to return variables and -then leave the function using ``return;``, +then leave the function as above, or you can provide return values (either a single or :ref:`multiple ones`) directly with the ``return`` statement:: @@ -94,8 +94,8 @@ statement:: } } -This form is equivalent to first assigning values to the -return variables and then using ``return;`` to leave the function. +If you use an early ``return`` to leave a function that has return variables, +you must provide return values together with the return statement. .. note:: You cannot return some types from non-internal functions, notably From d2924d83a2768ef749904d1d05a3b972b4c60436 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:37:45 +0200 Subject: [PATCH 168/479] Adding fixes for signedness warnings in smtutil --- libsmtutil/CVC4Interface.cpp | 2 +- libsmtutil/SMTLib2Interface.cpp | 2 +- libsmtutil/Z3Interface.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 4c1ef378a7f6..2af305e0eebf 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -201,7 +201,7 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) smtAssert(tupleSort, ""); CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); CVC4::Datatype const& dt = tt.getDatatype(); - size_t index = std::stoi(_expr.arguments[1].name); + size_t index = std::stoul(_expr.arguments[1].name); CVC4::Expr s = dt[0][index].getSelector(); return m_context.mkExpr(CVC4::kind::APPLY_SELECTOR, s, arguments[0]); } diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index 4e81444fef00..94da07aec08a 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -151,7 +151,7 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) { smtAssert(_expr.arguments.size() == 2, ""); auto tupleSort = dynamic_pointer_cast(_expr.arguments.at(0).sort); - unsigned index = std::stoi(_expr.arguments.at(1).name); + size_t index = std::stoul(_expr.arguments.at(1).name); smtAssert(index < tupleSort->members.size(), ""); sexpr += "|" + tupleSort->members.at(index) + "| " + toSExpr(_expr.arguments.at(0)); } diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index b42bc4765819..fed82cc8b734 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -194,7 +194,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) } else if (n == "tuple_get") { - size_t index = std::stoi(_expr.arguments[1].name); + size_t index = stoul(_expr.arguments[1].name); return z3::func_decl(m_context, Z3_get_tuple_sort_field_decl(m_context, z3Sort(*_expr.arguments[0].sort), index))(arguments[0]); } else if (n == "tuple_constructor") From b4454c49255e0276738f8512684c01682bb92110 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:40:27 +0200 Subject: [PATCH 169/479] Adding fixes for signedness warnings in libsolutil --- libsolutil/CommonData.cpp | 9 ++++++--- libsolutil/CommonData.h | 8 ++++---- libsolutil/CommonIO.cpp | 6 +++--- libsolutil/IpfsHash.cpp | 2 +- libsolutil/StringUtils.h | 8 ++++---- libsolutil/picosha2.h | 22 +++++++++++----------- test/libsolutil/IpfsHash.cpp | 8 ++++---- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index bb1a7696c974..72071acdeee1 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -64,15 +64,15 @@ string solidity::util::toHex(bytes const& _data, HexPrefix _prefix, HexCase _cas // Mixed case will be handled inside the loop. char const* chars = _case == HexCase::Upper ? upperHexChars : lowerHexChars; - int rix = _data.size() - 1; + size_t rix = _data.size() - 1; for (uint8_t c: _data) { // switch hex case every four hexchars if (_case == HexCase::Mixed) chars = (rix-- & 2) == 0 ? lowerHexChars : upperHexChars; - ret[i++] = chars[(unsigned(c) / 16) & 0xf]; - ret[i++] = chars[unsigned(c) & 0xf]; + ret[i++] = chars[(static_cast(c) >> 4ul) & 0xfu]; + ret[i++] = chars[c & 0xfu]; } assertThrow(i == ret.size(), Exception, ""); @@ -95,6 +95,9 @@ int solidity::util::fromHex(char _i, WhenError _throw) bytes solidity::util::fromHex(std::string const& _s, WhenError _throw) { + if (_s.empty()) + return {}; + unsigned s = (_s.size() >= 2 && _s[0] == '0' && _s[1] == 'x') ? 2 : 0; std::vector ret; ret.reserve((_s.size() - s + 1) / 2); diff --git a/libsolutil/CommonData.h b/libsolutil/CommonData.h index adac1fb051e8..a5c045646d4b 100644 --- a/libsolutil/CommonData.h +++ b/libsolutil/CommonData.h @@ -42,7 +42,7 @@ template std::vector& operator+=(std::vector& _a, U& _b) { for (auto const& i: _b) - _a.push_back(i); + _a.push_back(T(i)); return _a; } /// Concatenate the contents of a container onto a vector, move variant. @@ -299,7 +299,7 @@ template inline bytes toCompactBigEndian(T _val, unsigned _min = 0) { static_assert(std::is_same::value || !std::numeric_limits::is_signed, "only unsigned types or bigint supported"); //bigint does not carry sign bit on shift - int i = 0; + unsigned i = 0; for (T v = _val; v; ++i, v >>= 8) {} bytes ret(std::max(_min, i), 0); toBigEndian(_val, ret); @@ -379,7 +379,7 @@ void iterateReplacing(std::vector& _vector, F const& _f) { if (!useModified) { - std::move(_vector.begin(), _vector.begin() + i, back_inserter(modifiedVector)); + std::move(_vector.begin(), _vector.begin() + ptrdiff_t(i), back_inserter(modifiedVector)); useModified = true; } modifiedVector += std::move(*r); @@ -406,7 +406,7 @@ void iterateReplacingWindow(std::vector& _vector, F const& _f, std::index_seq { if (!useModified) { - std::move(_vector.begin(), _vector.begin() + i, back_inserter(modifiedVector)); + std::move(_vector.begin(), _vector.begin() + ptrdiff_t(i), back_inserter(modifiedVector)); useModified = true; } modifiedVector += std::move(*r); diff --git a/libsolutil/CommonIO.cpp b/libsolutil/CommonIO.cpp index ec6c33538f61..cbe68f0d143a 100644 --- a/libsolutil/CommonIO.cpp +++ b/libsolutil/CommonIO.cpp @@ -56,7 +56,7 @@ inline T readFile(std::string const& _file) return ret; // do not read empty file (MSVC does not like it) is.seekg(0, is.beg); - ret.resize((length + c_elementSize - 1) / c_elementSize); + ret.resize((static_cast(length) + c_elementSize - 1) / c_elementSize); is.read(const_cast(reinterpret_cast(ret.data())), length); return ret; } @@ -107,8 +107,8 @@ class DisableConsoleBuffering DisableConsoleBuffering() { tcgetattr(0, &m_termios); - m_termios.c_lflag &= ~ICANON; - m_termios.c_lflag &= ~ECHO; + m_termios.c_lflag &= ~tcflag_t(ICANON); + m_termios.c_lflag &= ~tcflag_t(ECHO); m_termios.c_cc[VMIN] = 1; m_termios.c_cc[VTIME] = 0; tcsetattr(0, TCSANOW, &m_termios); diff --git a/libsolutil/IpfsHash.cpp b/libsolutil/IpfsHash.cpp index 1f9435748848..6913d42f0808 100644 --- a/libsolutil/IpfsHash.cpp +++ b/libsolutil/IpfsHash.cpp @@ -62,7 +62,7 @@ string base58Encode(bytes const& _data) string output; while (data) { - output += alphabet[size_t(data % alphabet.size())]; + output += alphabet[static_cast(data % alphabet.size())]; data /= alphabet.size(); } reverse(output.begin(), output.end()); diff --git a/libsolutil/StringUtils.h b/libsolutil/StringUtils.h index 98158aa6d0b7..caea637a2325 100644 --- a/libsolutil/StringUtils.h +++ b/libsolutil/StringUtils.h @@ -156,14 +156,14 @@ inline std::string formatNumberReadable( if (_useTruncation) { // return as interior-truncated hex. - int len = str.size(); + size_t len = str.size(); if (len < 24) return str; - int const initialChars = (prefix == HexPrefix::Add) ? 6 : 4; - int const finalChars = 4; - int numSkipped = len - initialChars - finalChars; + size_t const initialChars = (prefix == HexPrefix::Add) ? 6 : 4; + size_t const finalChars = 4; + size_t numSkipped = len - initialChars - finalChars; return str.substr(0, initialChars) + "...{+" + diff --git a/libsolutil/picosha2.h b/libsolutil/picosha2.h index fdfabb5acac0..6994455a25c7 100644 --- a/libsolutil/picosha2.h +++ b/libsolutil/picosha2.h @@ -95,10 +95,10 @@ void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) { word_t w[64]; std::fill(w, w + 64, 0); for (std::size_t i = 0; i < 16; ++i) { - w[i] = (static_cast(mask_8bit(*(first + i * 4))) << 24) | - (static_cast(mask_8bit(*(first + i * 4 + 1))) << 16) | - (static_cast(mask_8bit(*(first + i * 4 + 2))) << 8) | - (static_cast(mask_8bit(*(first + i * 4 + 3)))); + w[i] = (static_cast(mask_8bit(*(first + long(i) * 4))) << 24) | + (static_cast(mask_8bit(*(first + long(i) * 4 + 1))) << 16) | + (static_cast(mask_8bit(*(first + long(i) * 4 + 2))) << 8) | + (static_cast(mask_8bit(*(first + long(i) * 4 + 3)))); } for (std::size_t i = 16; i < 64; ++i) { w[i] = mask_32bit(ssig1(w[i - 2]) + w[i - 7] + ssig0(w[i - 15]) + @@ -196,10 +196,10 @@ class hash256_one_by_one { std::copy(first, last, std::back_inserter(buffer_)); std::size_t i = 0; for (; i + 64 <= buffer_.size(); i += 64) { - detail::hash256_block(h_, buffer_.begin() + i, - buffer_.begin() + i + 64); + detail::hash256_block(h_, buffer_.begin() + long(i), + buffer_.begin() + long(i) + 64); } - buffer_.erase(buffer_.begin(), buffer_.begin() + i); + buffer_.erase(buffer_.begin(), buffer_.begin() + long(i)); } void finish() { @@ -297,20 +297,20 @@ void hash256_impl(RaIter first, RaIter last, OutIter first2, OutIter last2, int, template void hash256_impl(InputIter first, InputIter last, OutIter first2, - OutIter last2, int buffer_size, std::input_iterator_tag) { + OutIter last2, size_t buffer_size, std::input_iterator_tag) { std::vector buffer(buffer_size); hash256_one_by_one hasher; // hasher.init(); while (first != last) { - int size = buffer_size; - for (int i = 0; i != buffer_size; ++i, ++first) { + size_t size = buffer_size; + for (size_t i = 0; i != buffer_size; ++i, ++first) { if (first == last) { size = i; break; } buffer[i] = *first; } - hasher.process(buffer.begin(), buffer.begin() + size); + hasher.process(buffer.begin(), buffer.begin() + ptrdiff_t(size)); } hasher.finish(); hasher.get_hash_bytes(first2, last2); diff --git a/test/libsolutil/IpfsHash.cpp b/test/libsolutil/IpfsHash.cpp index 9c4fb56332fd..9d6f0f8fc2cb 100644 --- a/test/libsolutil/IpfsHash.cpp +++ b/test/libsolutil/IpfsHash.cpp @@ -36,10 +36,10 @@ BOOST_AUTO_TEST_CASE(test_small) BOOST_CHECK_EQUAL(ipfsHashBase58({}), "QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH"); BOOST_CHECK_EQUAL(ipfsHashBase58("x"), "QmULKig5Fxrs2sC4qt9nNduucXfb92AFYQ6Hi3YRqDmrYC"); BOOST_CHECK_EQUAL(ipfsHashBase58("Solidity\n"), "QmSsm9M7PQRBnyiz1smizk8hZw3URfk8fSeHzeTo3oZidS"); - BOOST_CHECK_EQUAL(ipfsHashBase58(string(size_t(200), char(0))), "QmSXR1N23uWzsANi8wpxMPw5dmmhqBVUAb4hUrHVLpNaMr"); - BOOST_CHECK_EQUAL(ipfsHashBase58(string(size_t(10250), char(0))), "QmVJJBB3gKKBWYC9QTywpH8ZL1bDeTDJ17B63Af5kino9i"); - BOOST_CHECK_EQUAL(ipfsHashBase58(string(size_t(100000), char(0))), "QmYgKa25YqEGpQmmZtPPFMNK3kpqqneHk6nMSEUYryEX1C"); - BOOST_CHECK_EQUAL(ipfsHashBase58(string(size_t(121071), char(0))), "QmdMdRshQmqvyc92N82r7AKYdUF5FRh4DJo6GtrmEk3wgj"); + BOOST_CHECK_EQUAL(ipfsHashBase58(string(200ul, char(0))), "QmSXR1N23uWzsANi8wpxMPw5dmmhqBVUAb4hUrHVLpNaMr"); + BOOST_CHECK_EQUAL(ipfsHashBase58(string(10250ul, char(0))), "QmVJJBB3gKKBWYC9QTywpH8ZL1bDeTDJ17B63Af5kino9i"); + BOOST_CHECK_EQUAL(ipfsHashBase58(string(100000ul, char(0))), "QmYgKa25YqEGpQmmZtPPFMNK3kpqqneHk6nMSEUYryEX1C"); + BOOST_CHECK_EQUAL(ipfsHashBase58(string(121071ul, char(0))), "QmdMdRshQmqvyc92N82r7AKYdUF5FRh4DJo6GtrmEk3wgj"); } BOOST_AUTO_TEST_CASE(test_medium) From 8ab8d5b1b0e2f15213cefb9035dc2261b7cda4d8 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 2 Jun 2020 19:55:33 +0200 Subject: [PATCH 170/479] Do not try compiling via yul if explicitly forbidden. --- test/libsolidity/SemanticTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 33d40c899c6a..39744fa59a26 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -62,6 +62,8 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer { m_runWithYul = false; m_runWithoutYul = true; + // Do not try to run via yul if explicitly denied. + m_enforceViaYul = false; } else BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + choice + ".")); From 41d8420718abab087d4f292fe59e7153e95e625b Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sun, 31 May 2020 05:08:37 +0200 Subject: [PATCH 171/479] Fix tabs in SolcReferenceFormatterHuman --- liblangutil/SourceReferenceFormatterHuman.cpp | 39 ++++++++++++------- libsolutil/UTF8.cpp | 9 ----- libsolutil/UTF8.h | 2 - test/cmdlineTests/message_format_utf16/err | 11 ------ .../message_format_utf16/input.sol | 3 -- test/cmdlineTests/message_format_utf8/err | 35 +++++++++++++++++ .../message_format_utf8/input.sol | 15 +++++++ 7 files changed, 75 insertions(+), 39 deletions(-) delete mode 100644 test/cmdlineTests/message_format_utf16/err delete mode 100644 test/cmdlineTests/message_format_utf16/input.sol create mode 100644 test/cmdlineTests/message_format_utf8/err create mode 100644 test/cmdlineTests/message_format_utf8/input.sol diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index cbf24cf3518a..b8fdba1635bf 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace std; using namespace solidity; @@ -30,6 +31,20 @@ using namespace solidity::langutil; using namespace solidity::util; using namespace solidity::util::formatting; +namespace +{ + +std::string replaceNonTabs(std::string_view _utf8Input, char _filler) +{ + std::string output; + for (char const c: _utf8Input) + if ((c & 0xc0) != 0x80) + output.push_back(c == '\t' ? '\t' : _filler); + return output; +} + +} + AnsiColorized SourceReferenceFormatterHuman::normalColored() const { return AnsiColorized(m_stream, m_colored, {WHITE}); @@ -85,6 +100,8 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ frameColored() << "-->"; m_stream << ' ' << _ref.sourceName << ':' << line << ':' << (_ref.position.column + 1) << ":\n"; + string_view text = _ref.text; + if (!_ref.multiline) { int const locationLength = _ref.endColumn - _ref.startColumn; @@ -96,21 +113,15 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ // line 2: frameColored() << line << " |"; - m_stream << ' ' << _ref.text.substr(0, _ref.startColumn); - highlightColored() << _ref.text.substr(_ref.startColumn, locationLength); - m_stream << _ref.text.substr(_ref.endColumn) << '\n'; + m_stream << ' ' << text.substr(0, _ref.startColumn); + highlightColored() << text.substr(_ref.startColumn, locationLength); + m_stream << text.substr(_ref.endColumn) << '\n'; // line 3: m_stream << leftpad << ' '; frameColored() << '|'; - m_stream << ' '; - - for_each( - _ref.text.cbegin(), - _ref.text.cbegin() + numCodepoints(_ref.text.substr(0, _ref.startColumn)), - [this](char ch) { m_stream << (ch == '\t' ? '\t' : ' '); } - ); - diagColored() << string(numCodepoints(_ref.text.substr(_ref.startColumn, locationLength)), '^'); + m_stream << ' ' << replaceNonTabs(text.substr(0, _ref.startColumn), ' '); + diagColored() << replaceNonTabs(text.substr(_ref.startColumn, locationLength), '^'); m_stream << '\n'; } else @@ -122,13 +133,13 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ // line 2: frameColored() << line << " |"; - m_stream << ' ' << _ref.text.substr(0, _ref.startColumn); - highlightColored() << _ref.text.substr(_ref.startColumn) << '\n'; + m_stream << ' ' << text.substr(0, _ref.startColumn); + highlightColored() << text.substr(_ref.startColumn) << '\n'; // line 3: m_stream << leftpad << ' '; frameColored() << '|'; - m_stream << ' ' << string(_ref.startColumn, ' '); + m_stream << ' ' << replaceNonTabs(text.substr(0, _ref.startColumn), ' '); diagColored() << "^ (Relevant source part starts here and spans across multiple lines)."; m_stream << '\n'; } diff --git a/libsolutil/UTF8.cpp b/libsolutil/UTF8.cpp index 82c87bb4445f..a7d55af6c382 100644 --- a/libsolutil/UTF8.cpp +++ b/libsolutil/UTF8.cpp @@ -138,13 +138,4 @@ bool validateUTF8(std::string const& _input, size_t& _invalidPosition) return validateUTF8(reinterpret_cast(_input.c_str()), _input.length(), _invalidPosition); } -size_t numCodepoints(std::string const& _utf8EncodedInput) -{ - size_t codepoint = 0; - for (char c: _utf8EncodedInput) - codepoint += (c & 0xc0) != 0x80; - - return codepoint; -} - } diff --git a/libsolutil/UTF8.h b/libsolutil/UTF8.h index fb5ee376ceab..cd84c3982590 100644 --- a/libsolutil/UTF8.h +++ b/libsolutil/UTF8.h @@ -38,6 +38,4 @@ inline bool validateUTF8(std::string const& _input) return validateUTF8(_input, invalidPos); } -size_t numCodepoints(std::string const& _utf8EncodedInput); - } diff --git a/test/cmdlineTests/message_format_utf16/err b/test/cmdlineTests/message_format_utf16/err deleted file mode 100644 index abe92d2e5c98..000000000000 --- a/test/cmdlineTests/message_format_utf16/err +++ /dev/null @@ -1,11 +0,0 @@ -Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. ---> message_format_utf16/input.sol - -Warning: Source file does not specify required compiler version! ---> message_format_utf16/input.sol - -Warning: Statement has no effect. - --> message_format_utf16/input.sol:2:58: - | -2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } - | ^^^^^^^^^^^^ diff --git a/test/cmdlineTests/message_format_utf16/input.sol b/test/cmdlineTests/message_format_utf16/input.sol deleted file mode 100644 index 2c1f9007a2a7..000000000000 --- a/test/cmdlineTests/message_format_utf16/input.sol +++ /dev/null @@ -1,3 +0,0 @@ -contract Foo { -/* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } -} diff --git a/test/cmdlineTests/message_format_utf8/err b/test/cmdlineTests/message_format_utf8/err new file mode 100644 index 000000000000..fcd1717b87a2 --- /dev/null +++ b/test/cmdlineTests/message_format_utf8/err @@ -0,0 +1,35 @@ +Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. +--> message_format_utf8/input.sol + +Warning: Source file does not specify required compiler version! +--> message_format_utf8/input.sol + +Warning: Statement has no effect. + --> message_format_utf8/input.sol:2:58: + | +2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } + | ^^^^^^^^^^^^ + +Warning: Statement has no effect. + --> message_format_utf8/input.sol:6:25: + | +6 | "S = π × r²"; + | ^^^^^^^^^^^^ + +Warning: Statement has no effect. + --> message_format_utf8/input.sol:7:39: + | +7 | /* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ "∑ 1/n! ≈ 2.7"; // tabs in-between + | ^^^^^^^^^^^^^^ + +Warning: Statement has no effect. + --> message_format_utf8/input.sol:8:30: + | +8 | /* Ŀŏŗėɯ ïƥŝʉɱ */ "μὴ χεῖρον βέλτιστον"; // tabs in-between and inside + | ^^^ ^^^^^^ ^^^^^^^^^^ + +Warning: Function state mutability can be restricted to pure + --> message_format_utf8/input.sol:12:2: + | +12 | function selector() public returns(uint) { // starts with tab + | ^ (Relevant source part starts here and spans across multiple lines). diff --git a/test/cmdlineTests/message_format_utf8/input.sol b/test/cmdlineTests/message_format_utf8/input.sol new file mode 100644 index 000000000000..51585efdebfc --- /dev/null +++ b/test/cmdlineTests/message_format_utf8/input.sol @@ -0,0 +1,15 @@ +contract Foo { +/* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } + + function f() public pure { + + "S = π × r²"; +/* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ "∑ 1/n! ≈ 2.7"; // tabs in-between +/* Ŀŏŗėɯ ïƥŝʉɱ */ "μὴ χεῖρον βέλτιστον"; // tabs in-between and inside + + } + + function selector() public returns(uint) { // starts with tab + return 0; + } +} From 3bf236cf8198fc09a0802b95167fccf3c90437d4 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 2 Jun 2020 02:52:29 +0200 Subject: [PATCH 172/479] Refactor error ID checker script --- .circleci/config.yml | 2 +- liblangutil/Exceptions.h | 2 +- ...{correct_error_ids.py => fix_error_ids.py} | 39 +++++++++++-------- 3 files changed, 24 insertions(+), 19 deletions(-) rename scripts/{correct_error_ids.py => fix_error_ids.py} (89%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f2b46a0c74b..624af2f0ed76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -323,7 +323,7 @@ jobs: - checkout - run: name: Check for error codes - command: ./scripts/correct_error_ids.py --noconfirm + command: ./scripts/fix_error_ids.py --check-only chk_pylint: docker: diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 42b76a1fe9e1..3fbf7711acac 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -61,7 +61,7 @@ struct InvalidAstError: virtual util::Exception {}; * They are passed as the first parameter of error reporting functions. * Suffix _error helps to find them in the sources. * The struct ErrorId prevents incidental calls like typeError(3141) instead of typeError(3141_error). - * To create a new ID, one can add 0000_error and then run "python ./scripts/correct_error_ids.py" + * To create a new ID, one can add 0000_error and then run "python ./scripts/fix_error_ids.py" * from the root of the repo. */ struct ErrorId { unsigned long long error = 0; }; diff --git a/scripts/correct_error_ids.py b/scripts/fix_error_ids.py similarity index 89% rename from scripts/correct_error_ids.py rename to scripts/fix_error_ids.py index cbbad8264d1d..d9a2011151e4 100755 --- a/scripts/correct_error_ids.py +++ b/scripts/fix_error_ids.py @@ -119,28 +119,19 @@ def find_source_files(top_dir): def main(argv): + check_only = False noconfirm = False - opts, args = getopt.getopt(argv, "", ["noconfirm"]) + opts, args = getopt.getopt(argv, "", ["check-only", "noconfirm"]) for opt, arg in opts: - if opt == '--noconfirm': + if opt == '--check-only': + check_only = True + elif opt == '--noconfirm': noconfirm = True random.seed() cwd = os.getcwd() - if not noconfirm: - answer = input( - f"This script checks and corrects *_error literals in .h and .cpp files\n" - f"in {cwd}, recursively.\n\n" - f"Please commit current changes first, and review the results when the script finishes.\n\n" - f"Do you want to start [Y/N]? " - ) - while len(answer) == 0 or answer not in "YNyn": - answer = input("[Y/N]? ") - if answer not in "yY": - exit(0) - source_file_names = find_source_files(cwd) used_ids = get_used_ids(source_file_names) @@ -160,11 +151,25 @@ def main(argv): if ok: print("No incorrect IDs found") exit(0) - else: - fix_ids(used_ids, source_file_names) - print("Fixing completed") + + if check_only: exit(1) + if not noconfirm: + answer = input( + "\nDo you want to fix incorrect IDs?\n" + "Please commit current changes first, and review the results when the script finishes.\n" + "[Y/N]? " + ) + while len(answer) == 0 or answer not in "YNyn": + answer = input("[Y/N]? ") + if answer not in "yY": + exit(1) + + fix_ids(used_ids, source_file_names) + print("Fixing completed") + exit(2) + if __name__ == "__main__": main(sys.argv[1:]) From 37e8d78cff0fdfd93edf56b932476130c0ae8312 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 28 May 2020 17:39:08 +0200 Subject: [PATCH 173/479] [Sol->Yul] Implement getters. --- libsolidity/codegen/YulUtilFunctions.cpp | 12 +- libsolidity/codegen/ir/IRGenerator.cpp | 206 +++++++++++------- .../semanticTests/getters/arrays.sol | 14 ++ .../semanticTests/getters/mapping.sol | 11 + .../semanticTests/getters/small_types.sol | 19 ++ .../storage/accessors_mapping_for_array.sol | 2 + 6 files changed, 179 insertions(+), 85 deletions(-) create mode 100644 test/libsolidity/semanticTests/getters/arrays.sol create mode 100644 test/libsolidity/semanticTests/getters/mapping.sol create mode 100644 test/libsolidity/semanticTests/getters/small_types.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 067fe3fea4a0..87142099e1d0 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1276,7 +1276,8 @@ string YulUtilFunctions::mappingIndexAccessFunction(MappingType const& _mappingT string YulUtilFunctions::readFromStorage(Type const& _type, size_t _offset, bool _splitFunctionTypes) { - solUnimplementedAssert(!_splitFunctionTypes, ""); + if (_type.category() == Type::Category::Function) + solUnimplementedAssert(!_splitFunctionTypes, ""); string functionName = "read_from_storage_" + string(_splitFunctionTypes ? "split_" : "") + @@ -1299,7 +1300,8 @@ string YulUtilFunctions::readFromStorage(Type const& _type, size_t _offset, bool string YulUtilFunctions::readFromStorageDynamic(Type const& _type, bool _splitFunctionTypes) { - solUnimplementedAssert(!_splitFunctionTypes, ""); + if (_type.category() == Type::Category::Function) + solUnimplementedAssert(!_splitFunctionTypes, ""); string functionName = "read_from_storage_dynamic" + string(_splitFunctionTypes ? "split_" : "") + @@ -1429,7 +1431,8 @@ string YulUtilFunctions::writeToMemoryFunction(Type const& _type) string YulUtilFunctions::extractFromStorageValueDynamic(Type const& _type, bool _splitFunctionTypes) { - solUnimplementedAssert(!_splitFunctionTypes, ""); + if (_type.category() == Type::Category::Function) + solUnimplementedAssert(!_splitFunctionTypes, ""); string functionName = "extract_from_storage_value_dynamic" + @@ -1474,7 +1477,8 @@ string YulUtilFunctions::extractFromStorageValue(Type const& _type, size_t _offs string YulUtilFunctions::cleanupFromStorageFunction(Type const& _type, bool _splitFunctionTypes) { solAssert(_type.isValueType(), ""); - solUnimplementedAssert(!_splitFunctionTypes, ""); + if (_type.category() == Type::Category::Function) + solUnimplementedAssert(!_splitFunctionTypes, ""); string functionName = string("cleanup_from_storage_") + (_splitFunctionTypes ? "split_" : "") + _type.identifier(); return m_functionCollector.createFunction(functionName, [&] { diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index 1bb6c7089443..92df1ba83e73 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -268,101 +268,145 @@ string IRGenerator::generateFunction(FunctionDefinition const& _function) string IRGenerator::generateGetter(VariableDeclaration const& _varDecl) { string functionName = IRNames::function(_varDecl); + return m_context.functionCollector().createFunction(functionName, [&]() { + Type const* type = _varDecl.annotation().type; - Type const* type = _varDecl.annotation().type; - - solAssert(_varDecl.isStateVariable(), ""); - - if (auto const* mappingType = dynamic_cast(type)) - return m_context.functionCollector().createFunction(functionName, [&]() { - solAssert(!_varDecl.isConstant() && !_varDecl.immutable(), ""); - pair slot_offset = m_context.storageLocationOfVariable(_varDecl); - solAssert(slot_offset.second == 0, ""); - FunctionType funType(_varDecl); - solUnimplementedAssert(funType.returnParameterTypes().size() == 1, ""); - TypePointer returnType = funType.returnParameterTypes().front(); - unsigned num_keys = 0; - stringstream indexAccesses; - string slot = m_context.newYulVariable(); - do - { - solUnimplementedAssert( - mappingType->keyType()->sizeOnStack() == 1, - "Multi-slot mapping key unimplemented - might not be a problem" - ); - indexAccesses << - slot << - " := " << - m_utils.mappingIndexAccessFunction(*mappingType, *mappingType->keyType()) << - "(" << - slot; - if (mappingType->keyType()->sizeOnStack() > 0) - indexAccesses << - ", " << - suffixedVariableNameList("key", num_keys, num_keys + mappingType->keyType()->sizeOnStack()); - indexAccesses << ")\n"; - num_keys += mappingType->keyType()->sizeOnStack(); - } - while ((mappingType = dynamic_cast(mappingType->valueType()))); + solAssert(_varDecl.isStateVariable(), ""); + FunctionType accessorType(_varDecl); + TypePointers paramTypes = accessorType.parameterTypes(); + if (_varDecl.immutable()) + { + solAssert(paramTypes.empty(), ""); + solUnimplementedAssert(type->sizeOnStack() == 1, ""); return Whiskers(R"( - function () -> rval { - let := - - rval := () + function () -> rval { + rval := loadimmutable("") } )") ("functionName", functionName) - ("keys", suffixedVariableNameList("key", 0, num_keys)) - ("readStorage", m_utils.readFromStorage(*returnType, 0, false)) - ("indexAccesses", indexAccesses.str()) - ("slot", slot) - ("base", slot_offset.first.str()) + ("id", to_string(_varDecl.id())) .render(); - }); - else - { - solUnimplementedAssert(type->isValueType(), ""); + } + else if (_varDecl.isConstant()) + { + solAssert(paramTypes.empty(), ""); + return Whiskers(R"( + function () -> { + := () + } + )") + ("functionName", functionName) + ("constantValueFunction", IRGeneratorForStatements(m_context, m_utils).constantValueFunction(_varDecl)) + ("ret", suffixedVariableNameList("ret_", 0, _varDecl.type()->sizeOnStack())) + .render(); + } + + string code; + + auto const& location = m_context.storageLocationOfVariable(_varDecl); + code += Whiskers(R"( + let slot := + let offset := + )") + ("slot", location.first.str()) + ("offset", to_string(location.second)) + .render(); - return m_context.functionCollector().createFunction(functionName, [&]() { - if (_varDecl.immutable()) + if (!paramTypes.empty()) + solAssert( + location.second == 0, + "If there are parameters, we are dealing with structs or mappings and thus should have offset zero." + ); + + // The code of an accessor is of the form `x[a][b][c]` (it is slightly more complicated + // if the final type is a struct). + // In each iteration of the loop below, we consume one parameter, perform an + // index access, reassign the yul variable `slot` and move @a currentType further "down". + // The initial value of @a currentType is only used if we skip the loop completely. + TypePointer currentType = _varDecl.annotation().type; + + vector parameters; + vector returnVariables; + + for (size_t i = 0; i < paramTypes.size(); ++i) + { + MappingType const* mappingType = dynamic_cast(currentType); + ArrayType const* arrayType = dynamic_cast(currentType); + solAssert(mappingType || arrayType, ""); + + vector keys = IRVariable("key_" + to_string(i), + mappingType ? *mappingType->keyType() : *TypeProvider::uint256() + ).stackSlots(); + parameters += keys; + code += Whiskers(R"( + slot, offset := (slot, ) + )") + ( + "indexAccess", + mappingType ? + m_utils.mappingIndexAccessFunction(*mappingType, *mappingType->keyType()) : + m_utils.storageArrayIndexAccessFunction(*arrayType) + ) + ("array", arrayType != nullptr) + ("keys", joinHumanReadable(keys)) + .render(); + + currentType = mappingType ? mappingType->valueType() : arrayType->baseType(); + } + + auto returnTypes = accessorType.returnParameterTypes(); + solAssert(returnTypes.size() >= 1, ""); + if (StructType const* structType = dynamic_cast(currentType)) + { + solAssert(location.second == 0, ""); + auto const& names = accessorType.returnParameterNames(); + for (size_t i = 0; i < names.size(); ++i) { - solUnimplementedAssert(type->sizeOnStack() == 1, ""); - return Whiskers(R"( - function () -> rval { - rval := loadimmutable("") - } + if (returnTypes[i]->category() == Type::Category::Mapping) + continue; + if (auto arrayType = dynamic_cast(returnTypes[i])) + if (!arrayType->isByteArray()) + continue; + + // TODO conversion from storage byte arrays is not yet implemented. + pair const& offsets = structType->storageOffsetsOfMember(names[i]); + vector retVars = IRVariable("ret_" + to_string(returnVariables.size()), *returnTypes[i]).stackSlots(); + returnVariables += retVars; + code += Whiskers(R"( + := (add(slot, )) )") - ("functionName", functionName) - ("id", to_string(_varDecl.id())) + ("ret", joinHumanReadable(retVars)) + ("readStorage", m_utils.readFromStorage(*returnTypes[i], offsets.second, true)) + ("slotOffset", offsets.first.str()) .render(); } - else if (_varDecl.isConstant()) - return Whiskers(R"( - function () -> { - := () - } - )") - ("functionName", functionName) - ("constantValueFunction", IRGeneratorForStatements(m_context, m_utils).constantValueFunction(_varDecl)) - ("ret", suffixedVariableNameList("ret_", 0, _varDecl.type()->sizeOnStack())) - .render(); - else - { - pair slot_offset = m_context.storageLocationOfVariable(_varDecl); + } + else + { + solAssert(returnTypes.size() == 1, ""); + vector retVars = IRVariable("ret", *returnTypes.front()).stackSlots(); + returnVariables += retVars; + // TODO conversion from storage byte arrays is not yet implemented. + code += Whiskers(R"( + := (slot, offset) + )") + ("ret", joinHumanReadable(retVars)) + ("readStorage", m_utils.readFromStorageDynamic(*returnTypes.front(), true)) + .render(); + } - return Whiskers(R"( - function () -> rval { - rval := () - } - )") - ("functionName", functionName) - ("readStorage", m_utils.readFromStorage(*type, slot_offset.second, false)) - ("slot", slot_offset.first.str()) - .render(); + return Whiskers(R"( + function () -> { + } - }); - } + )") + ("functionName", functionName) + ("params", joinHumanReadable(parameters)) + ("retVariables", joinHumanReadable(returnVariables)) + ("code", std::move(code)) + .render(); + }); } string IRGenerator::generateInitialAssignment(VariableDeclaration const& _varDecl) diff --git a/test/libsolidity/semanticTests/getters/arrays.sol b/test/libsolidity/semanticTests/getters/arrays.sol new file mode 100644 index 000000000000..2a8641a9b6a7 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/arrays.sol @@ -0,0 +1,14 @@ +contract C { + uint8[][2] public a; + constructor() public { + a[1].push(3); + a[1].push(4); + } +} +// ==== +// compileViaYul: also +// ---- +// a(uint256,uint256): 0, 0 -> FAILURE +// a(uint256,uint256): 1, 0 -> 3 +// a(uint256,uint256): 1, 1 -> 4 +// a(uint256,uint256): 2, 0 -> FAILURE diff --git a/test/libsolidity/semanticTests/getters/mapping.sol b/test/libsolidity/semanticTests/getters/mapping.sol new file mode 100644 index 000000000000..5b28a0f06929 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/mapping.sol @@ -0,0 +1,11 @@ +contract C { + mapping(uint => mapping(uint => uint)) public x; + constructor() public { + x[1][2] = 3; + } +} +// ==== +// compileViaYul: also +// ---- +// x(uint256,uint256): 1, 2 -> 3 +// x(uint256,uint256): 0, 0 -> 0 \ No newline at end of file diff --git a/test/libsolidity/semanticTests/getters/small_types.sol b/test/libsolidity/semanticTests/getters/small_types.sol new file mode 100644 index 000000000000..d970f9138a7b --- /dev/null +++ b/test/libsolidity/semanticTests/getters/small_types.sol @@ -0,0 +1,19 @@ +contract C { + uint8 public a; + uint16 public b; + uint128 public c; + uint public d; + constructor() public { + a = 3; + b = 4; + c = 5; + d = 6; + } +} +// ==== +// compileViaYul: also +// ---- +// a() -> 3 +// b() -> 4 +// c() -> 5 +// d() -> 6 diff --git a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol index 94bc11ff0842..e7f43d48daa7 100644 --- a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol +++ b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol @@ -8,6 +8,8 @@ contract test { dynamicData[2][2] = 8; } } +// ==== +// compileViaYul: also // ---- // data(uint256,uint256): 2, 2 -> 8 // data(uint256,uint256): 2, 8 -> FAILURE # NB: the original code contained a bug here # From 4b6c322279296ef9b0772bd9e572f5d1eb860cba Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 3 Jun 2020 10:27:23 +0200 Subject: [PATCH 174/479] Fixing various signedness warnings --- solc/CommandLineInterface.cpp | 4 ++-- test/CommonSyntaxTest.cpp | 6 +++--- test/EVMHost.cpp | 2 +- test/ExecutionFramework.cpp | 10 ++++++---- test/Metadata.cpp | 4 ++-- test/tools/fuzzer_common.cpp | 2 +- tools/solidityUpgrade/UpgradeChange.cpp | 7 +++++-- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index a8e5cc5b7fba..1a661b948641 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -629,8 +629,8 @@ bool CommandLineInterface::parseLibraryOption(string const& _input) serr() << "Colon separator missing in library address specifier \"" << lib << "\"" << endl; return false; } - string libName(lib.begin(), lib.begin() + colon); - string addrString(lib.begin() + colon + 1, lib.end()); + string libName(lib.begin(), lib.begin() + static_cast(colon)); + string addrString(lib.begin() + static_cast(colon) + 1, lib.end()); boost::trim(libName); boost::trim(addrString); if (addrString.substr(0, 2) == "0x") diff --git a/test/CommonSyntaxTest.cpp b/test/CommonSyntaxTest.cpp index e3edc3fb0e0d..cafcc58f7816 100644 --- a/test/CommonSyntaxTest.cpp +++ b/test/CommonSyntaxTest.cpp @@ -116,11 +116,11 @@ void CommonSyntaxTest::printSource(ostream& _stream, string const& _linePrefix, for (int i = error.locationStart; i < error.locationEnd; i++) if (isWarning) { - if (sourceFormatting[i] == formatting::RESET) - sourceFormatting[i] = formatting::ORANGE_BACKGROUND_256; + if (sourceFormatting[static_cast(i)] == formatting::RESET) + sourceFormatting[static_cast(i)] = formatting::ORANGE_BACKGROUND_256; } else - sourceFormatting[i] = formatting::RED_BACKGROUND; + sourceFormatting[static_cast(i)] = formatting::RED_BACKGROUND; } _stream << _linePrefix << sourceFormatting.front() << source.front(); diff --git a/test/EVMHost.cpp b/test/EVMHost.cpp index 836d61057273..108dae4f1e43 100644 --- a/test/EVMHost.cpp +++ b/test/EVMHost.cpp @@ -223,7 +223,7 @@ evmc::result EVMHost::call(evmc_message const& _message) noexcept if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2) { - result.gas_left -= evmasm::GasCosts::createDataGas * result.output_size; + result.gas_left -= static_cast(evmasm::GasCosts::createDataGas * result.output_size); if (result.gas_left < 0) { result.gas_left = 0; diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index ab11b2e98100..ebe63b2657c7 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -101,7 +101,9 @@ u256 ExecutionFramework::gasPrice() const u256 ExecutionFramework::blockHash(u256 const& _number) const { - return {EVMHost::convertFromEVMC(m_evmHost->get_block_hash(uint64_t(_number & numeric_limits::max())))}; + return {EVMHost::convertFromEVMC( + m_evmHost->get_block_hash(static_cast(_number & numeric_limits::max())) + )}; } u256 ExecutionFramework::blockNumber() const @@ -153,7 +155,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 if (m_showMessages) { cout << " out: " << toHex(m_output) << endl; - cout << " result: " << size_t(result.status_code) << endl; + cout << " result: " << static_cast(result.status_code) << endl; cout << " gas used: " << m_gasUsed.str() << endl; } } @@ -180,7 +182,7 @@ void ExecutionFramework::sendEther(Address const& _addr, u256 const& _amount) size_t ExecutionFramework::currentTimestamp() { - return m_evmHost->tx_context.block_timestamp; + return static_cast(m_evmHost->tx_context.block_timestamp); } size_t ExecutionFramework::blockTimestamp(u256 _block) @@ -188,7 +190,7 @@ size_t ExecutionFramework::blockTimestamp(u256 _block) if (_block > blockNumber()) return 0; else - return size_t((currentTimestamp() / blockNumber()) * _block); + return static_cast((currentTimestamp() / blockNumber()) * _block); } Address ExecutionFramework::account(size_t _idx) diff --git a/test/Metadata.cpp b/test/Metadata.cpp index cf61c4c9940d..cb5892b8af03 100644 --- a/test/Metadata.cpp +++ b/test/Metadata.cpp @@ -36,14 +36,14 @@ bytes onlyMetadata(bytes const& _bytecode) unsigned size = _bytecode.size(); if (size < 5) return bytes{}; - size_t metadataSize = (_bytecode[size - 2] << 8) + _bytecode[size - 1]; + size_t metadataSize = (static_cast(_bytecode[size - 2]) << 8ul) + static_cast(_bytecode[size - 1]); if (size < (metadataSize + 2)) return bytes{}; // Sanity check: assume the first byte is a fixed-size CBOR array with 1, 2 or 3 entries unsigned char firstByte = _bytecode[size - metadataSize - 2]; if (firstByte != 0xa1 && firstByte != 0xa2 && firstByte != 0xa3) return bytes{}; - return bytes(_bytecode.end() - metadataSize - 2, _bytecode.end() - 2); + return bytes(_bytecode.end() - static_cast(metadataSize) - 2, _bytecode.end() - 2); } bytes bytecodeSansMetadata(bytes const& _bytecode) diff --git a/test/tools/fuzzer_common.cpp b/test/tools/fuzzer_common.cpp index e4de0f185f38..fa167c437bc6 100644 --- a/test/tools/fuzzer_common.cpp +++ b/test/tools/fuzzer_common.cpp @@ -156,7 +156,7 @@ void FuzzerUtil::testConstantOptimizer(string const& _input, bool _quiet) assembly.append(n); } for (bool isCreation: {false, true}) - for (unsigned runs: {1, 2, 3, 20, 40, 100, 200, 400, 1000}) + for (unsigned runs: {1u, 2u, 3u, 20u, 40u, 100u, 200u, 400u, 1000u}) { // Make a copy here so that each time we start with the original state. Assembly tmp = assembly; diff --git a/tools/solidityUpgrade/UpgradeChange.cpp b/tools/solidityUpgrade/UpgradeChange.cpp index 8bbd6214cabe..ff7d6d68f575 100644 --- a/tools/solidityUpgrade/UpgradeChange.cpp +++ b/tools/solidityUpgrade/UpgradeChange.cpp @@ -27,7 +27,10 @@ using namespace solidity::tools; void UpgradeChange::apply() { - m_source.replace(m_location.start, m_location.end - m_location.start, m_patch); + m_source.replace( + static_cast(m_location.start), + static_cast(m_location.end - m_location.start), m_patch + ); } void UpgradeChange::log(bool const _shorten) const @@ -56,7 +59,7 @@ void UpgradeChange::log(bool const _shorten) const string line; while (getline(output, line)) { - os << string(leftpad, ' '); + os << string(static_cast(leftpad), ' '); AnsiColorized(os, true, {formatting::BOLD, formatting::BLUE}) << "| "; AnsiColorized(os, true, {}) << line << endl; } From e7f3c042b6923ddd5f51665ef22c2ea7ca1d585e Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 28 May 2020 21:11:06 +0200 Subject: [PATCH 175/479] Struct member access for storage and memory. --- .../codegen/ir/IRGeneratorForStatements.cpp | 38 ++++++++++++++++++- .../getters/mapping_to_struct.sol | 20 ++++++++++ .../storage/accessors_mapping_for_array.sol | 2 +- .../semanticTests/storage/struct_accessor.sol | 2 + 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/getters/mapping_to_struct.sol diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 2924ea535986..075cad1f32a8 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1467,7 +1467,43 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) break; case Type::Category::Struct: { - solUnimplementedAssert(false, ""); + auto const& structType = dynamic_cast(*_memberAccess.expression().annotation().type); + + IRVariable expression(_memberAccess.expression()); + switch (structType.location()) + { + case DataLocation::Storage: + { + pair const& offsets = structType.storageOffsetsOfMember(member); + string slot = m_context.newYulVariable(); + m_code << "let " << slot << " := " << + ("add(" + expression.name() + ", " + offsets.first.str() + ")\n"); + setLValue(_memberAccess, IRLValue{ + type(_memberAccess), + IRLValue::Storage{slot, offsets.second} + }); + break; + } + case DataLocation::Memory: + { + string pos = m_context.newYulVariable(); + m_code << "let " << pos << " := " << + ("add(" + expression.part("mpos").name() + ", " + structType.memoryOffsetOfMember(member).str() + ")\n"); + setLValue(_memberAccess, IRLValue{ + type(_memberAccess), + IRLValue::Memory{pos} + }); + break; + } + case DataLocation::CallData: + { + solUnimplementedAssert(false, ""); + break; + } + default: + solAssert(false, "Illegal data location for struct."); + } + break; } case Type::Category::Enum: { diff --git a/test/libsolidity/semanticTests/getters/mapping_to_struct.sol b/test/libsolidity/semanticTests/getters/mapping_to_struct.sol new file mode 100644 index 000000000000..fed9f6ec5e0e --- /dev/null +++ b/test/libsolidity/semanticTests/getters/mapping_to_struct.sol @@ -0,0 +1,20 @@ +contract C { + struct S { + uint8 a; + uint16 b; + uint128 c; + uint d; + } + mapping(uint => mapping(uint => S)) public x; + constructor() public { + x[1][2].a = 3; + x[1][2].b = 4; + x[1][2].c = 5; + x[1][2].d = 6; + } +} +// ==== +// compileViaYul: also +// ---- +// x(uint256,uint256): 1, 2 -> 3, 4, 5, 6 +// x(uint256,uint256): 0, 0 -> 0x00, 0x00, 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol index e7f43d48daa7..01460a1c86b1 100644 --- a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol +++ b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol @@ -12,6 +12,6 @@ contract test { // compileViaYul: also // ---- // data(uint256,uint256): 2, 2 -> 8 -// data(uint256,uint256): 2, 8 -> FAILURE # NB: the original code contained a bug here # +// data(uint256,uint256): 2, 8 -> FAILURE # NB: the original code contained a bug here # // dynamicData(uint256,uint256): 2, 2 -> 8 // dynamicData(uint256,uint256): 2, 8 -> FAILURE diff --git a/test/libsolidity/semanticTests/storage/struct_accessor.sol b/test/libsolidity/semanticTests/storage/struct_accessor.sol index 398cf750b185..de57d4697116 100644 --- a/test/libsolidity/semanticTests/storage/struct_accessor.sol +++ b/test/libsolidity/semanticTests/storage/struct_accessor.sol @@ -8,5 +8,7 @@ contract test { data[7].d = true; } } +// ==== +// compileViaYul: also // ---- // data(uint256): 7 -> 1, 2, true From 5b1426b55e59819df0b7e5ba30c14c0c29050071 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:45:03 +0200 Subject: [PATCH 176/479] Adding fixes for signedness warnings in liblangutil --- liblangutil/CharStream.cpp | 7 ++-- liblangutil/CharStream.h | 2 +- liblangutil/ParserBase.cpp | 2 +- liblangutil/Scanner.cpp | 42 +++++++++---------- liblangutil/Scanner.h | 6 +-- liblangutil/SemVerHandler.cpp | 12 +++--- liblangutil/SourceLocation.h | 8 +++- liblangutil/SourceReferenceExtractor.cpp | 21 +++++++--- liblangutil/SourceReferenceFormatter.cpp | 4 +- liblangutil/SourceReferenceFormatterHuman.cpp | 20 +++++---- liblangutil/Token.cpp | 2 +- 11 files changed, 71 insertions(+), 55 deletions(-) diff --git a/liblangutil/CharStream.cpp b/liblangutil/CharStream.cpp index 046aca5d37f7..6f2d47c4813c 100644 --- a/liblangutil/CharStream.cpp +++ b/liblangutil/CharStream.cpp @@ -85,7 +85,7 @@ string CharStream::lineAtPosition(int _position) const { // if _position points to \n, it returns the line before the \n using size_type = string::size_type; - size_type searchStart = min(m_source.size(), _position); + size_type searchStart = min(m_source.size(), size_type(_position)); if (searchStart > 0) searchStart--; size_type lineStart = m_source.rfind('\n', searchStart); @@ -105,8 +105,9 @@ string CharStream::lineAtPosition(int _position) const tuple CharStream::translatePositionToLineColumn(int _position) const { using size_type = string::size_type; - size_type searchPosition = min(m_source.size(), _position); - int lineNumber = count(m_source.begin(), m_source.begin() + searchPosition, '\n'); + using diff_type = string::difference_type; + size_type searchPosition = min(m_source.size(), size_type(_position)); + int lineNumber = count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n'); size_type lineStart; if (searchPosition == 0) lineStart = 0; diff --git a/liblangutil/CharStream.h b/liblangutil/CharStream.h index 6962864b979f..aa8f01af266c 100644 --- a/liblangutil/CharStream.h +++ b/liblangutil/CharStream.h @@ -72,7 +72,7 @@ class CharStream explicit CharStream(std::string _source, std::string name): m_source(std::move(_source)), m_name(std::move(name)) {} - int position() const { return m_position; } + size_t position() const { return m_position; } bool isPastEndOfInput(size_t _charsForward = 0) const { return (m_position + _charsForward) >= m_source.size(); } char get(size_t _charsForward = 0) const { return m_source[m_position + _charsForward]; } diff --git a/liblangutil/ParserBase.cpp b/liblangutil/ParserBase.cpp index be8ec3eb9ab1..c2162044a082 100644 --- a/liblangutil/ParserBase.cpp +++ b/liblangutil/ParserBase.cpp @@ -106,7 +106,7 @@ void ParserBase::expectTokenOrConsumeUntil(Token _value, string const& _currentN if (m_scanner->currentToken() == Token::EOS) { // rollback to where the token started, and raise exception to be caught at a higher level. - m_scanner->setPosition(startPosition); + m_scanner->setPosition(static_cast(startPosition)); m_inParserRecovery = true; fatalParserError(1957_error, errorLoc, msg); } diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index 6cf319067878..e703b53761a7 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -171,7 +171,7 @@ void Scanner::supportPeriodInIdentifier(bool _value) bool Scanner::scanHexByte(char& o_scannedByte) { char x = 0; - for (int i = 0; i < 2; i++) + for (size_t i = 0; i < 2; i++) { int d = hexValue(m_char); if (d < 0) @@ -189,7 +189,7 @@ bool Scanner::scanHexByte(char& o_scannedByte) std::optional Scanner::scanUnicode() { unsigned x = 0; - for (int i = 0; i < 4; i++) + for (size_t i = 0; i < 4; i++) { int d = hexValue(m_char); if (d < 0) @@ -197,7 +197,7 @@ std::optional Scanner::scanUnicode() rollback(i); return {}; } - x = x * 16 + d; + x = x * 16 + static_cast(d); advance(); } return x; @@ -207,17 +207,17 @@ std::optional Scanner::scanUnicode() void Scanner::addUnicodeAsUTF8(unsigned codepoint) { if (codepoint <= 0x7f) - addLiteralChar(codepoint); + addLiteralChar(char(codepoint)); else if (codepoint <= 0x7ff) { - addLiteralChar(0xc0 | (codepoint >> 6)); - addLiteralChar(0x80 | (codepoint & 0x3f)); + addLiteralChar(char(0xc0u | (codepoint >> 6u))); + addLiteralChar(char(0x80u | (codepoint & 0x3fu))); } else { - addLiteralChar(0xe0 | (codepoint >> 12)); - addLiteralChar(0x80 | ((codepoint >> 6) & 0x3f)); - addLiteralChar(0x80 | (codepoint & 0x3f)); + addLiteralChar(char(0xe0u | (codepoint >> 12u))); + addLiteralChar(char(0x80u | ((codepoint >> 6u) & 0x3fu))); + addLiteralChar(char(0x80u | (codepoint & 0x3fu))); } } @@ -225,10 +225,10 @@ void Scanner::rescan() { size_t rollbackTo = 0; if (m_skippedComments[Current].literal.empty()) - rollbackTo = m_tokens[Current].location.start; + rollbackTo = static_cast(m_tokens[Current].location.start); else - rollbackTo = m_skippedComments[Current].location.start; - m_char = m_source->rollback(size_t(m_source->position()) - rollbackTo); + rollbackTo = static_cast(m_skippedComments[Current].location.start); + m_char = m_source->rollback(m_source->position() - rollbackTo); next(); next(); next(); @@ -260,7 +260,7 @@ Token Scanner::selectToken(char _next, Token _then, Token _else) bool Scanner::skipWhitespace() { - int const startPosition = sourcePos(); + size_t const startPosition = sourcePos(); while (isWhiteSpace(m_char)) advance(); // Return whether or not we skipped any characters. @@ -269,7 +269,7 @@ bool Scanner::skipWhitespace() bool Scanner::skipWhitespaceExceptUnicodeLinebreak() { - int const startPosition = sourcePos(); + size_t const startPosition = sourcePos(); while (isWhiteSpace(m_char) && !isUnicodeLinebreak()) advance(); // Return whether or not we skipped any characters. @@ -309,10 +309,10 @@ bool Scanner::tryScanEndOfLine() return false; } -int Scanner::scanSingleLineDocComment() +size_t Scanner::scanSingleLineDocComment() { LiteralScope literal(this, LITERAL_TYPE_COMMENT); - int endPosition = m_source->position(); + size_t endPosition = m_source->position(); advance(); //consume the last '/' at /// skipWhitespaceExceptUnicodeLinebreak(); @@ -429,7 +429,7 @@ Token Scanner::scanMultiLineDocComment() Token Scanner::scanSlash() { - int firstSlashPosition = sourcePos(); + int firstSlashPosition = static_cast(sourcePos()); advance(); if (m_char == '/') { @@ -441,7 +441,7 @@ Token Scanner::scanSlash() m_skippedComments[NextNext].location.start = firstSlashPosition; m_skippedComments[NextNext].location.source = m_source; m_skippedComments[NextNext].token = Token::CommentLiteral; - m_skippedComments[NextNext].location.end = scanSingleLineDocComment(); + m_skippedComments[NextNext].location.end = static_cast(scanSingleLineDocComment()); return Token::Whitespace; } else @@ -467,7 +467,7 @@ Token Scanner::scanSlash() m_skippedComments[NextNext].location.start = firstSlashPosition; m_skippedComments[NextNext].location.source = m_source; comment = scanMultiLineDocComment(); - m_skippedComments[NextNext].location.end = sourcePos(); + m_skippedComments[NextNext].location.end = static_cast(sourcePos()); m_skippedComments[NextNext].token = comment; if (comment == Token::Illegal) return Token::Illegal; // error already set @@ -495,7 +495,7 @@ void Scanner::scanToken() do { // Remember the position of the next token - m_tokens[NextNext].location.start = sourcePos(); + m_tokens[NextNext].location.start = static_cast(sourcePos()); switch (m_char) { case '"': @@ -690,7 +690,7 @@ void Scanner::scanToken() // whitespace. } while (token == Token::Whitespace); - m_tokens[NextNext].location.end = sourcePos(); + m_tokens[NextNext].location.end = static_cast(sourcePos()); m_tokens[NextNext].location.source = m_source; m_tokens[NextNext].token = token; m_tokens[NextNext].extendedTokenInfo = make_tuple(m, n); diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h index d54bb7532bcd..5e613cfdff2c 100644 --- a/liblangutil/Scanner.h +++ b/liblangutil/Scanner.h @@ -196,7 +196,7 @@ class Scanner ///@} bool advance() { m_char = m_source->advanceAndGet(); return !m_source->isPastEndOfInput(); } - void rollback(int _amount) { m_char = m_source->rollback(_amount); } + void rollback(size_t _amount) { m_char = m_source->rollback(_amount); } /// Rolls back to the start of the current token and re-runs the scanner. void rescan(); @@ -231,7 +231,7 @@ class Scanner Token scanString(); Token scanHexString(); /// Scans a single line comment and returns its corrected end position. - int scanSingleLineDocComment(); + size_t scanSingleLineDocComment(); Token scanMultiLineDocComment(); /// Scans a slash '/' and depending on the characters returns the appropriate token Token scanSlash(); @@ -245,7 +245,7 @@ class Scanner bool isUnicodeLinebreak(); /// Return the current source position. - int sourcePos() const { return m_source->position(); } + size_t sourcePos() const { return m_source->position(); } bool isSourcePastEndOfInput() const { return m_source->isPastEndOfInput(); } bool m_supportPeriodInIdentifier = false; diff --git a/liblangutil/SemVerHandler.cpp b/liblangutil/SemVerHandler.cpp index 04b81206eda7..a626c5aa708b 100644 --- a/liblangutil/SemVerHandler.cpp +++ b/liblangutil/SemVerHandler.cpp @@ -37,7 +37,7 @@ SemVerVersion::SemVerVersion(string const& _versionString) { unsigned v = 0; for (; i != end && '0' <= *i && *i <= '9'; ++i) - v = v * 10 + (*i - '0'); + v = v * 10 + unsigned(*i - '0'); numbers[level] = v; if (level < 2) { @@ -100,10 +100,10 @@ bool SemVerMatchExpression::MatchComponent::matches(SemVerVersion const& _versio int cmp = 0; bool didCompare = false; for (unsigned i = 0; i < levelsPresent && cmp == 0; i++) - if (version.numbers[i] != unsigned(-1)) + if (version.numbers[i] != std::numeric_limits::max()) { didCompare = true; - cmp = _version.numbers[i] - version.numbers[i]; + cmp = static_cast(_version.numbers[i] - version.numbers[i]); } if (cmp == 0 && !_version.prerelease.empty() && didCompare) @@ -245,14 +245,14 @@ unsigned SemVerMatchExpressionParser::parseVersionPart() return 0; else if ('1' <= c && c <= '9') { - unsigned v = c - '0'; + unsigned v(c - '0'); // If we skip to the next token, the current number is terminated. while (m_pos == startPos && '0' <= currentChar() && currentChar() <= '9') { c = currentChar(); - if (v * 10 < v || v * 10 + (c - '0') < v * 10) + if (v * 10 < v || v * 10 + unsigned(c - '0') < v * 10) throw SemVerError(); - v = v * 10 + c - '0'; + v = v * 10 + unsigned(c - '0'); nextChar(); } return v; diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index e6f97942eae6..283c8a52420e 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -85,7 +85,7 @@ struct SourceLocation assertThrow(0 <= start, SourceLocationError, "Invalid source location."); assertThrow(start <= end, SourceLocationError, "Invalid source location."); assertThrow(end <= int(source->source().length()), SourceLocationError, "Invalid source location."); - return source->source().substr(start, end - start); + return source->source().substr(size_t(start), size_t(end - start)); } /// @returns the smallest SourceLocation that contains both @param _a and @param _b. @@ -113,7 +113,11 @@ struct SourceLocation std::shared_ptr source; }; -SourceLocation const parseSourceLocation(std::string const& _input, std::string const& _sourceName, size_t _maxIndex = -1); +SourceLocation const parseSourceLocation( + std::string const& _input, + std::string const& _sourceName, + size_t _maxIndex = std::numeric_limits::max() +); /// Stream output for Location (used e.g. in boost exceptions). inline std::ostream& operator<<(std::ostream& _out, SourceLocation const& _location) diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 0817e7750d8c..0a6ff0421ba1 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -58,11 +58,15 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio string line = source->lineAtPosition(_location->start); - int locationLength = isMultiline ? line.length() - start.column : end.column - start.column; + int locationLength = + isMultiline ? + int(line.length()) - start.column : + end.column - start.column; + if (locationLength > 150) { - int const lhs = start.column + 35; - int const rhs = (isMultiline ? line.length() : end.column) - 35; + auto const lhs = static_cast(start.column) + 35; + string::size_type const rhs = (isMultiline ? line.length() : static_cast(end.column)) - 35; line = line.substr(0, lhs) + " ... " + line.substr(rhs); end.column = start.column + 75; locationLength = 75; @@ -70,8 +74,13 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio if (line.length() > 150) { - int const len = line.length(); - line = line.substr(max(0, start.column - 35), min(start.column, 35) + min(locationLength + 35, len - start.column)); + int const len = static_cast(line.length()); + line = line.substr( + static_cast(max(0, start.column - 35)), + static_cast(min(start.column, 35)) + static_cast( + min(locationLength + 35,len - start.column) + ) + ); if (start.column + locationLength + 35 < len) line += " ..."; if (start.column > 35) @@ -79,7 +88,7 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio line = " ... " + line; start.column = 40; } - end.column = start.column + locationLength; + end.column = start.column + static_cast(locationLength); } return SourceReference{ diff --git a/liblangutil/SourceReferenceFormatter.cpp b/liblangutil/SourceReferenceFormatter.cpp index 6b1a8286a20a..965755a10cbe 100644 --- a/liblangutil/SourceReferenceFormatter.cpp +++ b/liblangutil/SourceReferenceFormatter.cpp @@ -51,7 +51,7 @@ void SourceReferenceFormatter::printSourceLocation(SourceReference const& _ref) ); m_stream << "^"; if (_ref.endColumn > _ref.startColumn + 2) - m_stream << string(_ref.endColumn - _ref.startColumn - 2, '-'); + m_stream << string(static_cast(_ref.endColumn - _ref.startColumn - 2), '-'); if (_ref.endColumn > _ref.startColumn + 1) m_stream << "^"; m_stream << endl; @@ -60,7 +60,7 @@ void SourceReferenceFormatter::printSourceLocation(SourceReference const& _ref) m_stream << _ref.text << endl << - string(_ref.startColumn, ' ') << + string(static_cast(_ref.startColumn), ' ') << "^ (Relevant source part starts here and spans across multiple lines)." << endl; } diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index b8fdba1635bf..3560955c7aa1 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -104,7 +104,7 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ if (!_ref.multiline) { - int const locationLength = _ref.endColumn - _ref.startColumn; + auto const locationLength = static_cast(_ref.endColumn - _ref.startColumn); // line 1: m_stream << leftpad << ' '; @@ -113,15 +113,17 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ // line 2: frameColored() << line << " |"; - m_stream << ' ' << text.substr(0, _ref.startColumn); - highlightColored() << text.substr(_ref.startColumn, locationLength); - m_stream << text.substr(_ref.endColumn) << '\n'; + + m_stream << ' ' << text.substr(0, static_cast(_ref.startColumn)); + highlightColored() << text.substr(static_cast(_ref.startColumn), locationLength); + m_stream << text.substr(static_cast(_ref.endColumn)) << '\n'; // line 3: m_stream << leftpad << ' '; frameColored() << '|'; - m_stream << ' ' << replaceNonTabs(text.substr(0, _ref.startColumn), ' '); - diagColored() << replaceNonTabs(text.substr(_ref.startColumn, locationLength), '^'); + + m_stream << ' ' << replaceNonTabs(text.substr(0, static_cast(_ref.startColumn)), ' '); + diagColored() << replaceNonTabs(text.substr(static_cast(_ref.startColumn), locationLength), '^'); m_stream << '\n'; } else @@ -133,13 +135,13 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ // line 2: frameColored() << line << " |"; - m_stream << ' ' << text.substr(0, _ref.startColumn); - highlightColored() << text.substr(_ref.startColumn) << '\n'; + m_stream << ' ' << text.substr(0, static_cast(_ref.startColumn)); + highlightColored() << text.substr(static_cast(_ref.startColumn)) << '\n'; // line 3: m_stream << leftpad << ' '; frameColored() << '|'; - m_stream << ' ' << replaceNonTabs(text.substr(0, _ref.startColumn), ' '); + m_stream << ' ' << replaceNonTabs(text.substr(0, static_cast(_ref.startColumn)), ' '); diagColored() << "^ (Relevant source part starts here and spans across multiple lines)."; m_stream << '\n'; } diff --git a/liblangutil/Token.cpp b/liblangutil/Token.cpp index e051bb552e1d..70b645992491 100644 --- a/liblangutil/Token.cpp +++ b/liblangutil/Token.cpp @@ -130,7 +130,7 @@ int parseSize(string::const_iterator _begin, string::const_iterator _end) { try { - unsigned int m = boost::lexical_cast(boost::make_iterator_range(_begin, _end)); + int m = boost::lexical_cast(boost::make_iterator_range(_begin, _end)); return m; } catch(boost::bad_lexical_cast const&) From c708a1bec2d5814f8340c24e25bd5698c345b48c Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 3 Jun 2020 11:28:01 +0200 Subject: [PATCH 177/479] AsmAnalysis: Fixes a superfluous whitespace in an error string --- libyul/AsmAnalysis.cpp | 2 +- .../syntaxTests/inlineAssembly/istanbul_on_petersburg.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 7a80377603af..256d2ac387d2 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -555,7 +555,7 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation + "\" instruction is " + vmKindMessage + " VMs " + - " (you are currently compiling for \"" + + "(you are currently compiling for \"" + m_evmVersion.name() + "\")." ); diff --git a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol b/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol index 249a79cc051c..a29a2ab3564e 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol @@ -13,7 +13,7 @@ contract C { // ==== // EVMVersion: =petersburg // ---- -// TypeError: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// TypeError: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError: (95-110): Variable count does not match number of values (1 vs. 0) -// TypeError: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// TypeError: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError: (209-228): Variable count does not match number of values (1 vs. 0) From 9820df58abfe918c5f92c6d4fa066e2da5c3bf35 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 27 May 2020 16:03:01 +0200 Subject: [PATCH 178/479] Remove Yul instruction PC and adapt tests accordingly. --- Changelog.md | 1 + libyul/AsmAnalysis.cpp | 16 +++++++++------- .../syntaxTests/inlineAssembly/pc.sol | 2 +- test/libyul/yulSyntaxTests/pc.yul | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 409569a9d770..0a8816ad2fd3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Breaking changes: * Type Checker: Disallow shifts by signed types. Language Features: + * Yul: Disallow EVM instruction `pc()`. Compiler Features: diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index fd8e44dfab8b..62a7f43ca8b1 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -556,16 +556,18 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation errorForVM("only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID()) errorForVM("only available for Istanbul-compatible"); + else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) + errorForVM("only available for Istanbul-compatible"); else if (_instr == evmasm::Instruction::PC) - m_errorReporter.warning( - 2450_error, + { + m_errorReporter.error( + 4316_error, + Error::Type::SyntaxError, _location, - "The \"" + - boost::to_lower_copy(instructionInfo(_instr).name) + - "\" instruction is deprecated and will be removed in the next breaking release." + "PC instruction is a low-level EVM feature. " + "Because of that PC is disallowed in strict assembly." ); - else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) - errorForVM("only available for Istanbul-compatible"); + } else if ( _instr == evmasm::Instruction::JUMP || _instr == evmasm::Instruction::JUMPI || diff --git a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol index 08b0238894e5..a3d4c31b158c 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release. +// SyntaxError: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. diff --git a/test/libyul/yulSyntaxTests/pc.yul b/test/libyul/yulSyntaxTests/pc.yul index 04804f150f3c..e818e926bc9a 100644 --- a/test/libyul/yulSyntaxTests/pc.yul +++ b/test/libyul/yulSyntaxTests/pc.yul @@ -4,4 +4,4 @@ // ==== // dialect: evmTyped // ---- -// Warning: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release. +// SyntaxError: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. From e4e3f4984458b17ccd7e9aaf83513b35adfebf48 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:10:14 +0200 Subject: [PATCH 179/479] Fixing signedness conversion warnings in libevmasm Co-authored-by: Harikrishnan Mulackal --- libevmasm/Assembly.cpp | 50 ++++++++++----------- libevmasm/AssemblyItem.cpp | 38 ++++++++-------- libevmasm/AssemblyItem.h | 6 +-- libevmasm/BlockDeduplicator.cpp | 7 +-- libevmasm/CommonSubexpressionEliminator.cpp | 16 ++++--- libevmasm/ConstantOptimiser.cpp | 4 +- libevmasm/ControlFlowGraph.h | 4 +- libevmasm/ExpressionClasses.cpp | 4 +- libevmasm/Instruction.cpp | 6 +-- libevmasm/JumpdestRemover.cpp | 4 +- libevmasm/KnownState.cpp | 26 +++++------ libevmasm/LinkerObject.cpp | 2 +- libevmasm/PeepholeOptimiser.cpp | 10 ++--- test/libevmasm/Assembler.cpp | 4 +- test/libevmasm/Optimiser.cpp | 10 ++--- 15 files changed, 98 insertions(+), 93 deletions(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 296a330abe02..8588832fe429 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -41,7 +41,7 @@ using namespace solidity::util; AssemblyItem const& Assembly::append(AssemblyItem const& _i) { assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow."); - m_deposit += _i.deposit(); + m_deposit += static_cast(_i.deposit()); m_items.emplace_back(_i); if (!m_items.back().location().isValid() && m_currentSourceLocation.isValid()) m_items.back().setLocation(m_currentSourceLocation); @@ -77,10 +77,10 @@ string locationFromSources(StringMap const& _sourceCodes, SourceLocation const& return ""; string const& source = it->second; - if (size_t(_location.start) >= source.size()) + if (static_cast(_location.start) >= source.size()) return ""; - string cut = source.substr(_location.start, _location.end - _location.start); + string cut = source.substr(static_cast(_location.start), static_cast(_location.end - _location.start)); auto newLinePos = cut.find_first_of("\n"); if (newLinePos != string::npos) cut = cut.substr(0, newLinePos) + "..."; @@ -106,7 +106,7 @@ class Functionalizer if (!( _item.canBeFunctional() && _item.returnValues() <= 1 && - _item.arguments() <= int(m_pending.size()) + _item.arguments() <= m_pending.size() )) { flush(); @@ -117,7 +117,7 @@ class Functionalizer if (_item.arguments() > 0) { expression += "("; - for (int i = 0; i < _item.arguments(); ++i) + for (size_t i = 0; i < _item.arguments(); ++i) { expression += m_pending.back(); m_pending.pop_back(); @@ -225,12 +225,12 @@ Json::Value Assembly::assemblyJSON(map const& _sourceIndices) Json::Value& collection = root[".code"] = Json::arrayValue; for (AssemblyItem const& i: m_items) { - unsigned sourceIndex = unsigned(-1); + int sourceIndex = -1; if (i.location().source) { auto iter = _sourceIndices.find(i.location().source->name()); if (iter != _sourceIndices.end()) - sourceIndex = iter->second; + sourceIndex = static_cast(iter->second); } switch (i.type()) @@ -340,7 +340,7 @@ AssemblyItem Assembly::namedTag(string const& _name) { assertThrow(!_name.empty(), AssemblyException, "Empty named tag."); if (!m_namedTags.count(_name)) - m_namedTags[_name] = size_t(newTag().data()); + m_namedTags[_name] = static_cast(newTag().data()); return AssemblyItem{Tag, m_namedTags.at(_name)}; } @@ -441,7 +441,7 @@ map Assembly::optimiseInternal( for (auto const& replacement: deduplicator.replacedTags()) { assertThrow( - replacement.first <= size_t(-1) && replacement.second <= size_t(-1), + replacement.first <= numeric_limits::max() && replacement.second <= numeric_limits::max(), OptimizerException, "Invalid tag replacement." ); @@ -451,8 +451,8 @@ map Assembly::optimiseInternal( "Replacement already known." ); tagReplacements[replacement.first] = replacement.second; - if (_tagsReferencedFromOutside.erase(size_t(replacement.first))) - _tagsReferencedFromOutside.insert(size_t(replacement.second)); + if (_tagsReferencedFromOutside.erase(static_cast(replacement.first))) + _tagsReferencedFromOutside.insert(static_cast(replacement.second)); } count++; } @@ -479,7 +479,7 @@ map Assembly::optimiseInternal( try { optimisedChunk = eliminator.getOptimizedItems(); - shouldReplace = (optimisedChunk.size() < size_t(iter - orig)); + shouldReplace = (optimisedChunk.size() < static_cast(iter - orig)); } catch (StackTooDeepException const&) { @@ -544,7 +544,7 @@ LinkerObject const& Assembly::assemble() const immutableReferencesBySub = linkerObject.immutableReferences; } for (size_t tagPos: sub->m_tagPositionsInBytecode) - if (tagPos != size_t(-1) && tagPos > subTagSize) + if (tagPos != numeric_limits::max() && tagPos > subTagSize) subTagSize = tagPos; } @@ -567,7 +567,7 @@ LinkerObject const& Assembly::assemble() const ); size_t bytesRequiredForCode = bytesRequired(subTagSize); - m_tagPositionsInBytecode = vector(m_usedTags, -1); + m_tagPositionsInBytecode = vector(m_usedTags, numeric_limits::max()); map> tagRef; multimap dataRef; multimap subRef; @@ -586,7 +586,7 @@ LinkerObject const& Assembly::assemble() const for (AssemblyItem const& i: m_items) { // store position of the invalid jump destination - if (i.type() != Tag && m_tagPositionsInBytecode[0] == size_t(-1)) + if (i.type() != Tag && m_tagPositionsInBytecode[0] == numeric_limits::max()) m_tagPositionsInBytecode[0] = ret.bytecode.size(); switch (i.type()) @@ -629,15 +629,15 @@ LinkerObject const& Assembly::assemble() const ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef); break; case PushSub: - assertThrow(i.data() <= size_t(-1), AssemblyException, ""); + assertThrow(i.data() <= numeric_limits::max(), AssemblyException, ""); ret.bytecode.push_back(dataRefPush); - subRef.insert(make_pair(size_t(i.data()), ret.bytecode.size())); + subRef.insert(make_pair(static_cast(i.data()), ret.bytecode.size())); ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef); break; case PushSubSize: { - assertThrow(i.data() <= size_t(-1), AssemblyException, ""); - auto s = m_subs.at(size_t(i.data()))->assemble().bytecode.size(); + assertThrow(i.data() <= numeric_limits::max(), AssemblyException, ""); + auto s = m_subs.at(static_cast(i.data()))->assemble().bytecode.size(); i.setPushedValue(u256(s)); uint8_t b = max(1, util::bytesRequired(s)); ret.bytecode.push_back((uint8_t)Instruction::PUSH1 - 1 + b); @@ -683,10 +683,10 @@ LinkerObject const& Assembly::assemble() const break; case Tag: assertThrow(i.data() != 0, AssemblyException, "Invalid tag position."); - assertThrow(i.splitForeignPushTag().first == size_t(-1), AssemblyException, "Foreign tag."); + assertThrow(i.splitForeignPushTag().first == numeric_limits::max(), AssemblyException, "Foreign tag."); assertThrow(ret.bytecode.size() < 0xffffffffL, AssemblyException, "Tag too large."); - assertThrow(m_tagPositionsInBytecode[size_t(i.data())] == size_t(-1), AssemblyException, "Duplicate tag position."); - m_tagPositionsInBytecode[size_t(i.data())] = ret.bytecode.size(); + assertThrow(m_tagPositionsInBytecode[static_cast(i.data())] == numeric_limits::max(), AssemblyException, "Duplicate tag position."); + m_tagPositionsInBytecode[static_cast(i.data())] = ret.bytecode.size(); ret.bytecode.push_back((uint8_t)Instruction::JUMPDEST); break; default: @@ -722,14 +722,14 @@ LinkerObject const& Assembly::assemble() const size_t subId; size_t tagId; tie(subId, tagId) = i.second; - assertThrow(subId == size_t(-1) || subId < m_subs.size(), AssemblyException, "Invalid sub id"); + assertThrow(subId == numeric_limits::max() || subId < m_subs.size(), AssemblyException, "Invalid sub id"); std::vector const& tagPositions = - subId == size_t(-1) ? + subId == numeric_limits::max() ? m_tagPositionsInBytecode : m_subs[subId]->m_tagPositionsInBytecode; assertThrow(tagId < tagPositions.size(), AssemblyException, "Reference to non-existing tag."); size_t pos = tagPositions[tagId]; - assertThrow(pos != size_t(-1), AssemblyException, "Reference to tag without position."); + assertThrow(pos != numeric_limits::max(), AssemblyException, "Reference to tag without position."); assertThrow(util::bytesRequired(pos) <= bytesPerTag, AssemblyException, "Tag too large for reserved space."); bytesRef r(ret.bytecode.data() + i.first, bytesPerTag); toBigEndian(pos, r); diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index 610c6f5dd246..c2e9056feb38 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -34,7 +34,7 @@ AssemblyItem AssemblyItem::toSubAssemblyTag(size_t _subId) const { assertThrow(data() < (u256(1) << 64), util::Exception, "Tag already has subassembly set."); assertThrow(m_type == PushTag || m_type == Tag, util::Exception, ""); - size_t tag = size_t(u256(data()) & 0xffffffffffffffffULL); + auto tag = static_cast(u256(data()) & 0xffffffffffffffffULL); AssemblyItem r = *this; r.m_type = PushTag; r.setPushTagSubIdAndTag(_subId, tag); @@ -45,8 +45,8 @@ pair AssemblyItem::splitForeignPushTag() const { assertThrow(m_type == PushTag || m_type == Tag, util::Exception, ""); u256 combined = u256(data()); - size_t subId = size_t((combined >> 64) - 1); - size_t tag = size_t(combined & 0xffffffffffffffffULL); + size_t subId = static_cast((combined >> 64) - 1); + size_t tag = static_cast(combined & 0xffffffffffffffffULL); return make_pair(subId, tag); } @@ -54,7 +54,7 @@ void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag) { assertThrow(m_type == PushTag || m_type == Tag, util::Exception, ""); u256 data = _tag; - if (_subId != size_t(-1)) + if (_subId != numeric_limits::max()) data |= (u256(_subId) + 1) << 64; setData(data); } @@ -93,22 +93,22 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const assertThrow(false, InvalidOpcode, ""); } -int AssemblyItem::arguments() const +size_t AssemblyItem::arguments() const { if (type() == Operation) - return instructionInfo(instruction()).args; + return static_cast(instructionInfo(instruction()).args); else if (type() == AssignImmutable) return 1; else return 0; } -int AssemblyItem::returnValues() const +size_t AssemblyItem::returnValues() const { switch (m_type) { case Operation: - return instructionInfo(instruction()).ret; + return static_cast(instructionInfo(instruction()).ret); case Push: case PushString: case PushTag: @@ -193,7 +193,7 @@ string AssemblyItem::toAssemblyText() const size_t sub{0}; size_t tag{0}; tie(sub, tag) = splitForeignPushTag(); - if (sub == size_t(-1)) + if (sub == numeric_limits::max()) text = string("tag_") + to_string(tag); else text = string("tag_") + to_string(sub) + "_" + to_string(tag); @@ -201,16 +201,16 @@ string AssemblyItem::toAssemblyText() const } case Tag: assertThrow(data() < 0x10000, AssemblyException, "Declaration of sub-assembly tag."); - text = string("tag_") + to_string(size_t(data())) + ":"; + text = string("tag_") + to_string(static_cast(data())) + ":"; break; case PushData: text = string("data_") + util::toHex(data()); break; case PushSub: - text = string("dataOffset(sub_") + to_string(size_t(data())) + ")"; + text = string("dataOffset(sub_") + to_string(static_cast(data())) + ")"; break; case PushSubSize: - text = string("dataSize(sub_") + to_string(size_t(data())) + ")"; + text = string("dataSize(sub_") + to_string(static_cast(data())) + ")"; break; case PushProgramSize: text = string("bytecodeSize"); @@ -262,7 +262,7 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item) case PushTag: { size_t subId = _item.splitForeignPushTag().first; - if (subId == size_t(-1)) + if (subId == numeric_limits::max()) _out << " PushTag " << _item.splitForeignPushTag().second; else _out << " PushTag " << subId << ":" << _item.splitForeignPushTag().second; @@ -272,13 +272,13 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item) _out << " Tag " << _item.data(); break; case PushData: - _out << " PushData " << hex << (unsigned)_item.data() << dec; + _out << " PushData " << hex << static_cast(_item.data()) << dec; break; case PushSub: - _out << " PushSub " << hex << size_t(_item.data()) << dec; + _out << " PushSub " << hex << static_cast(_item.data()) << dec; break; case PushSubSize: - _out << " PushSubSize " << hex << size_t(_item.data()) << dec; + _out << " PushSubSize " << hex << static_cast(_item.data()) << dec; break; case PushProgramSize: _out << " PushProgramSize"; @@ -317,7 +317,7 @@ std::string AssemblyItem::computeSourceMapping( int prevStart = -1; int prevLength = -1; int prevSourceIndex = -1; - size_t prevModifierDepth = -1; + int prevModifierDepth = -1; char prevJump = 0; for (auto const& item: _items) { @@ -328,14 +328,14 @@ std::string AssemblyItem::computeSourceMapping( int length = location.start != -1 && location.end != -1 ? location.end - location.start : -1; int sourceIndex = location.source && _sourceIndicesMap.count(location.source->name()) ? - _sourceIndicesMap.at(location.source->name()) : + static_cast(_sourceIndicesMap.at(location.source->name())) : -1; char jump = '-'; if (item.getJumpType() == evmasm::AssemblyItem::JumpType::IntoFunction) jump = 'i'; else if (item.getJumpType() == evmasm::AssemblyItem::JumpType::OutOfFunction) jump = 'o'; - size_t modifierDepth = item.m_modifierDepth; + int modifierDepth = static_cast(item.m_modifierDepth); unsigned components = 5; if (modifierDepth == prevModifierDepth) diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index fc8c63c6718b..6c5e01942be8 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -134,9 +134,9 @@ class AssemblyItem /// @returns an upper bound for the number of bytes required by this item, assuming that /// the value of a jump tag takes @a _addressLength bytes. unsigned bytesRequired(unsigned _addressLength) const; - int arguments() const; - int returnValues() const; - int deposit() const { return returnValues() - arguments(); } + size_t arguments() const; + size_t returnValues() const; + size_t deposit() const { return returnValues() - arguments(); } /// @returns true if the assembly item can be used in a functional context. bool canBeFunctional() const; diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index decfee65007f..95aba2a01d86 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -63,8 +63,9 @@ bool BlockDeduplicator::deduplicate() if (_j < m_items.size() && m_items.at(_j).type() == Tag) pushSecondTag = m_items.at(_j).pushTag(); - BlockIterator first{m_items.begin() + _i, m_items.end(), &pushFirstTag, &pushSelf}; - BlockIterator second{m_items.begin() + _j, m_items.end(), &pushSecondTag, &pushSelf}; + using diff_type = BlockIterator::difference_type; + BlockIterator first{m_items.begin() + diff_type(_i), m_items.end(), &pushFirstTag, &pushSelf}; + BlockIterator second{m_items.begin() + diff_type(_j), m_items.end(), &pushSecondTag, &pushSelf}; BlockIterator end{m_items.end(), m_items.end()}; if (first != end && (*first).type() == Tag) @@ -120,7 +121,7 @@ bool BlockDeduplicator::applyTagReplacement( if (it != _replacements.end()) { changed = true; - item.setPushTagSubIdAndTag(subId, size_t(it->second)); + item.setPushTagSubIdAndTag(subId, static_cast(it->second)); } } return changed; diff --git a/libevmasm/CommonSubexpressionEliminator.cpp b/libevmasm/CommonSubexpressionEliminator.cpp index 747f78f24aa2..7fa5c938bbc5 100644 --- a/libevmasm/CommonSubexpressionEliminator.cpp +++ b/libevmasm/CommonSubexpressionEliminator.cpp @@ -386,7 +386,11 @@ void CSECodeGenerator::generateClassElement(Id _c, bool _allowSequenced) "Opcodes with more than two arguments not implemented yet." ); for (size_t i = 0; i < arguments.size(); ++i) - assertThrow(m_stack[m_stackHeight - i] == arguments[i], OptimizerException, "Expected arguments not present." ); + assertThrow( + m_stack[m_stackHeight - static_cast(i)] == arguments[i], + OptimizerException, + "Expected arguments not present." + ); while (SemanticInformation::isCommutativeOperation(*expr.item) && !m_generatedItems.empty() && @@ -395,8 +399,8 @@ void CSECodeGenerator::generateClassElement(Id _c, bool _allowSequenced) appendOrRemoveSwap(m_stackHeight - 1, itemLocation); for (size_t i = 0; i < arguments.size(); ++i) { - m_classPositions[m_stack[m_stackHeight - i]].erase(m_stackHeight - i); - m_stack.erase(m_stackHeight - i); + m_classPositions[m_stack[m_stackHeight - static_cast(i)]].erase(m_stackHeight - static_cast(i)); + m_stack.erase(m_stackHeight - static_cast(i)); } appendItem(*expr.item); if (expr.item->type() != Operation || instructionInfo(expr.item->instruction()).ret == 1) @@ -467,7 +471,7 @@ void CSECodeGenerator::appendDup(int _fromPosition, SourceLocation const& _locat int instructionNum = 1 + m_stackHeight - _fromPosition; assertThrow(instructionNum <= 16, StackTooDeepException, "Stack too deep, try removing local variables."); assertThrow(1 <= instructionNum, OptimizerException, "Invalid stack access."); - appendItem(AssemblyItem(dupInstruction(instructionNum), _location)); + appendItem(AssemblyItem(dupInstruction(static_cast(instructionNum)), _location)); m_stack[m_stackHeight] = m_stack[_fromPosition]; m_classPositions[m_stack[m_stackHeight]].insert(m_stackHeight); } @@ -480,7 +484,7 @@ void CSECodeGenerator::appendOrRemoveSwap(int _fromPosition, SourceLocation cons int instructionNum = m_stackHeight - _fromPosition; assertThrow(instructionNum <= 16, StackTooDeepException, "Stack too deep, try removing local variables."); assertThrow(1 <= instructionNum, OptimizerException, "Invalid stack access."); - appendItem(AssemblyItem(swapInstruction(instructionNum), _location)); + appendItem(AssemblyItem(swapInstruction(static_cast(instructionNum)), _location)); if (m_stack[m_stackHeight] != m_stack[_fromPosition]) { @@ -502,5 +506,5 @@ void CSECodeGenerator::appendOrRemoveSwap(int _fromPosition, SourceLocation cons void CSECodeGenerator::appendItem(AssemblyItem const& _item) { m_generatedItems.push_back(_item); - m_stackHeight += _item.deposit(); + m_stackHeight += static_cast(_item.deposit()); } diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp index 8e6d991a5380..018be38ea43d 100644 --- a/libevmasm/ConstantOptimiser.cpp +++ b/libevmasm/ConstantOptimiser.cpp @@ -262,7 +262,7 @@ bool ComputeMethod::checkRepresentation(u256 const& _value, AssemblyItems const& { case Operation: { - if (stack.size() < size_t(item.arguments())) + if (stack.size() < item.arguments()) return false; u256* sp = &stack.back(); switch (item.instruction()) @@ -320,7 +320,7 @@ bool ComputeMethod::checkRepresentation(u256 const& _value, AssemblyItems const& bigint ComputeMethod::gasNeeded(AssemblyItems const& _routine) const { - size_t numExps = count(_routine.begin(), _routine.end(), Instruction::EXP); + auto numExps = static_cast(count(_routine.begin(), _routine.end(), Instruction::EXP)); return combineGas( simpleRunGas(_routine) + numExps * (GasCosts::expGas + GasCosts::expByteGas(m_params.evmVersion)), // Data gas for routine: Some bytes are zero, but we ignore them. diff --git a/libevmasm/ControlFlowGraph.h b/libevmasm/ControlFlowGraph.h index a0c2b9632bb3..5fceb6388440 100644 --- a/libevmasm/ControlFlowGraph.h +++ b/libevmasm/ControlFlowGraph.h @@ -45,8 +45,8 @@ class BlockId BlockId() { *this = invalid(); } explicit BlockId(unsigned _id): m_id(_id) {} explicit BlockId(u256 const& _id); - static BlockId initial() { return BlockId(-2); } - static BlockId invalid() { return BlockId(-1); } + static BlockId initial() { return BlockId(std::numeric_limits::max() - 1); } + static BlockId invalid() { return BlockId(std::numeric_limits::max()); } bool operator==(BlockId const& _other) const { return m_id == _other.m_id; } bool operator!=(BlockId const& _other) const { return m_id != _other.m_id; } diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp index 04686ec94567..a208fabe7dae 100644 --- a/libevmasm/ExpressionClasses.cpp +++ b/libevmasm/ExpressionClasses.cpp @@ -190,7 +190,7 @@ ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr) _expr.item->type() != Operation || !SemanticInformation::isDeterministic(*_expr.item) ) - return -1; + return numeric_limits::max(); if (auto match = rules.findFirstMatch(_expr, *this)) { @@ -208,7 +208,7 @@ ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr) return rebuildExpression(ExpressionTemplate(match->action(), _expr.item->location())); } - return -1; + return numeric_limits::max(); } ExpressionClasses::Id ExpressionClasses::rebuildExpression(ExpressionTemplate const& _template) diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp index 34fef1642496..0a61fbea041f 100644 --- a/libevmasm/Instruction.cpp +++ b/libevmasm/Instruction.cpp @@ -330,8 +330,8 @@ void solidity::evmasm::eachInstruction( { for (auto it = _mem.begin(); it < _mem.end(); ++it) { - Instruction instr = Instruction(*it); - size_t additional = 0; + auto instr = Instruction(*it); + int additional = 0; if (isValidInstruction(instr)) additional = instructionInfo(instr).additional; @@ -357,7 +357,7 @@ string solidity::evmasm::disassemble(bytes const& _mem) stringstream ret; eachInstruction(_mem, [&](Instruction _instr, u256 const& _data) { if (!isValidInstruction(_instr)) - ret << "0x" << std::uppercase << std::hex << int(_instr) << " "; + ret << "0x" << std::uppercase << std::hex << static_cast(_instr) << " "; else { InstructionInfo info = instructionInfo(_instr); diff --git a/libevmasm/JumpdestRemover.cpp b/libevmasm/JumpdestRemover.cpp index 6be05b198489..cbb498c01d85 100644 --- a/libevmasm/JumpdestRemover.cpp +++ b/libevmasm/JumpdestRemover.cpp @@ -30,7 +30,7 @@ using namespace solidity::evmasm; bool JumpdestRemover::optimise(set const& _tagsReferencedFromOutside) { - set references{referencedTags(m_items, -1)}; + set references{referencedTags(m_items, numeric_limits::max())}; references.insert(_tagsReferencedFromOutside.begin(), _tagsReferencedFromOutside.end()); size_t initialSize = m_items.size(); @@ -43,7 +43,7 @@ bool JumpdestRemover::optimise(set const& _tagsReferencedFromOutside) if (_item.type() != Tag) return false; auto asmIdAndTag = _item.splitForeignPushTag(); - assertThrow(asmIdAndTag.first == size_t(-1), OptimizerException, "Sub-assembly tag used as label."); + assertThrow(asmIdAndTag.first == numeric_limits::max(), OptimizerException, "Sub-assembly tag used as label."); size_t tag = asmIdAndTag.second; return !references.count(tag); } diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index 5f1ca736cb23..10e4a4f10fc3 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -41,7 +41,7 @@ ostream& KnownState::stream(ostream& _out) const if (!expr.item) _out << " no item"; else if (expr.item->type() == UndefinedItem) - _out << " unknown " << int(expr.item->data()); + _out << " unknown " << static_cast(expr.item->data()); else _out << *expr.item; if (expr.sequenceNumber) @@ -112,21 +112,21 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool setStackElement( m_stackHeight + 1, stackElement( - m_stackHeight - int(instruction) + int(Instruction::DUP1), + m_stackHeight - static_cast(instruction) + static_cast(Instruction::DUP1), _item.location() ) ); else if (SemanticInformation::isSwapInstruction(_item)) swapStackElements( m_stackHeight, - m_stackHeight - 1 - int(instruction) + int(Instruction::SWAP1), + m_stackHeight - 1 - static_cast(instruction) + static_cast(Instruction::SWAP1), _item.location() ); else if (instruction != Instruction::POP) { - vector arguments(info.args); - for (int i = 0; i < info.args; ++i) - arguments[i] = stackElement(m_stackHeight - i, _item.location()); + vector arguments(static_cast(info.args)); + for (size_t i = 0; i < static_cast(info.args); ++i) + arguments[i] = stackElement(m_stackHeight - static_cast(i), _item.location()); switch (_item.instruction()) { case Instruction::SSTORE: @@ -134,7 +134,7 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool break; case Instruction::SLOAD: setStackElement( - m_stackHeight + _item.deposit(), + m_stackHeight + static_cast(_item.deposit()), loadFromStorage(arguments[0], _item.location()) ); break; @@ -143,13 +143,13 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool break; case Instruction::MLOAD: setStackElement( - m_stackHeight + _item.deposit(), + m_stackHeight + static_cast(_item.deposit()), loadFromMemory(arguments[0], _item.location()) ); break; case Instruction::KECCAK256: setStackElement( - m_stackHeight + _item.deposit(), + m_stackHeight + static_cast(_item.deposit()), applyKeccak256(arguments.at(0), arguments.at(1), _item.location()) ); break; @@ -167,16 +167,16 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool assertThrow(info.ret <= 1, InvalidDeposit, ""); if (info.ret == 1) setStackElement( - m_stackHeight + _item.deposit(), + m_stackHeight + static_cast(_item.deposit()), m_expressionClasses->find(_item, arguments, _copyItem) ); } } m_stackElements.erase( - m_stackElements.upper_bound(m_stackHeight + _item.deposit()), + m_stackElements.upper_bound(m_stackHeight + static_cast(_item.deposit())), m_stackElements.end() ); - m_stackHeight += _item.deposit(); + m_stackHeight += static_cast(_item.deposit()); } return op; } @@ -388,7 +388,7 @@ KnownState::Id KnownState::applyKeccak256( bytes data; for (Id a: arguments) data += util::toBigEndian(*m_expressionClasses->knownConstant(a)); - data.resize(size_t(*l)); + data.resize(static_cast(*l)); v = m_expressionClasses->find(AssemblyItem(u256(util::keccak256(data)), _location)); } else diff --git a/libevmasm/LinkerObject.cpp b/libevmasm/LinkerObject.cpp index 21b2131013f1..b7ffaac6682f 100644 --- a/libevmasm/LinkerObject.cpp +++ b/libevmasm/LinkerObject.cpp @@ -40,7 +40,7 @@ void LinkerObject::link(map const& _libraryAddresses) std::map remainingRefs; for (auto const& linkRef: linkReferences) if (h160 const* address = matchLibrary(linkRef.second, _libraryAddresses)) - copy(address->data(), address->data() + 20, bytecode.begin() + linkRef.first); + copy(address->data(), address->data() + 20, bytecode.begin() + vector::difference_type(linkRef.first)); else remainingRefs.insert(linkRef); linkReferences.swap(remainingRefs); diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index e05abd3e4cbb..861cae0f2bdf 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -84,7 +84,7 @@ struct SimplePeepholeOptimizerMethod { if ( _state.i + WindowSize <= _state.items.size() && - ApplyRule::applyRule(_state.items.begin() + _state.i, _state.out) + ApplyRule::applyRule(_state.items.begin() + static_cast(_state.i), _state.out) ) { _state.i += WindowSize; @@ -303,7 +303,7 @@ struct UnreachableCode { static bool apply(OptimiserState& _state) { - auto it = _state.items.begin() + _state.i; + auto it = _state.items.begin() + static_cast(_state.i); auto end = _state.items.end(); if (it == end) return false; @@ -317,13 +317,13 @@ struct UnreachableCode ) return false; - size_t i = 1; + ptrdiff_t i = 1; while (it + i != end && it[i].type() != Tag) i++; if (i > 1) { *_state.out = it[0]; - _state.i += i; + _state.i += static_cast(i); return true; } else @@ -345,7 +345,7 @@ void applyMethods(OptimiserState& _state, Method, OtherMethods... _other) size_t numberOfPops(AssemblyItems const& _items) { - return std::count(_items.begin(), _items.end(), Instruction::POP); + return static_cast(std::count(_items.begin(), _items.end(), Instruction::POP)); } } diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index a402101c4ee2..cdb7046bef05 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(all_assembly_items) // PushSubSize auto sub = _assembly.appendSubroutine(_subAsmPtr); // PushSub - _assembly.pushSubroutineOffset(size_t(sub.data())); + _assembly.pushSubroutineOffset(static_cast(sub.data())); // PushDeployTimeAddress _assembly.append(PushDeployTimeAddress); // AssignImmutable. @@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(immutable) _assembly.appendImmutableAssignment("someOtherImmutable"); auto sub = _assembly.appendSubroutine(_subAsmPtr); - _assembly.pushSubroutineOffset(size_t(sub.data())); + _assembly.pushSubroutineOffset(static_cast(sub.data())); checkCompilation(_assembly); diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 536eaa9512f8..4690ceddc0a3 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -1227,7 +1227,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies) sub->append(t4.pushTag()); sub->append(Instruction::JUMP); - size_t subId = size_t(main.appendSubroutine(sub).data()); + size_t subId = static_cast(main.appendSubroutine(sub).data()); main.append(t1.toSubAssemblyTag(subId)); main.append(t1.toSubAssemblyTag(subId)); main.append(u256(8)); @@ -1281,10 +1281,10 @@ BOOST_AUTO_TEST_CASE(cse_remove_redundant_shift_masking) if (!solidity::test::CommonOptions::get().evmVersion().hasBitwiseShifting()) return; - for (int i = 1; i < 256; i++) + for (size_t i = 1; i < 256; i++) { checkCSE({ - u256(boost::multiprecision::pow(u256(2), i)-1), + u256(boost::multiprecision::pow(u256(2), i) - 1), Instruction::CALLVALUE, u256(256-i), Instruction::SHR, @@ -1309,10 +1309,10 @@ BOOST_AUTO_TEST_CASE(cse_remove_redundant_shift_masking) } // Check that opt. does NOT trigger - for (int i = 1; i < 255; i++) + for (size_t i = 1; i < 255; i++) { checkCSE({ - u256(boost::multiprecision::pow(u256(2), i)-1), + u256(boost::multiprecision::pow(u256(2), i) - 1), Instruction::CALLVALUE, u256(255-i), Instruction::SHR, From a6c773bd96d61361e9659fde4ca5704e4d1e2666 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 19 May 2020 17:53:39 +0200 Subject: [PATCH 180/479] Fix type inversion for shift and exp operators. --- Changelog.md | 1 + docs/types/value-types.rst | 5 +++ libsolidity/ast/TypeProvider.h | 1 + libsolidity/ast/Types.cpp | 36 ++++++++++++++++--- .../semanticTests/cleanup/exp_cleanup.sol | 2 +- .../exponentiation/literal_base.sol | 16 +++++++++ .../113_exp_warn_literal_base_1.sol | 1 - .../116_shift_warn_literal_base_1.sol | 1 - .../333_fixed_point_casting_exponents_15.sol | 2 +- .../334_fixed_point_casting_exponents_neg.sol | 2 +- .../shift_warn_literal_large_shift_amount.sol | 7 ++++ .../syntaxTests/signed_rational_modulus.sol | 2 +- 12 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 test/libsolidity/semanticTests/exponentiation/literal_base.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/shift_warn_literal_large_shift_amount.sol diff --git a/Changelog.md b/Changelog.md index 409569a9d770..c97020695b67 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Breaking changes: * Deprecated the identifier `now`. * JSON AST: Removes members with ``null`` value from JSON output. * Type Checker: Disallow shifts by signed types. + * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. Language Features: diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 5d7adc7cab2a..16c371c1833f 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -444,6 +444,11 @@ long as the operands are integers. If any of the two is fractional, bit operatio and exponentiation is disallowed if the exponent is fractional (because that might result in a non-rational number). +Shifts and exponentiation with literal numbers as left (or base) operand and integer types +as the right (exponent) operand are always performed +in the ``uint256`` (for non-negative literals) or ``int256`` (for a negative literals) type, +regardless of the type of the right (exponent) operand. + .. warning:: Division on integer literals used to truncate in Solidity prior to version 0.4.0, but it now converts into a rational number, i.e. ``5 / 2`` is not equal to ``2``, but to ``2.5``. diff --git a/libsolidity/ast/TypeProvider.h b/libsolidity/ast/TypeProvider.h index 38f2642eb8df..40cc4d384ab9 100644 --- a/libsolidity/ast/TypeProvider.h +++ b/libsolidity/ast/TypeProvider.h @@ -96,6 +96,7 @@ class TypeProvider static IntegerType const* uint(unsigned _bits) { return integer(_bits, IntegerType::Modifier::Unsigned); } static IntegerType const* uint256() { return uint(256); } + static IntegerType const* int256() { return integer(256, IntegerType::Modifier::Signed); } static FixedPointType const* fixedPoint(unsigned m, unsigned n, FixedPointType::Modifier _modifier); diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index f429bcf6f37d..e282f967bc18 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -967,10 +967,38 @@ TypeResult RationalNumberType::binaryOperatorResult(Token _operator, Type const* { if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint) { - auto commonType = Type::commonType(this, _other); - if (!commonType) - return nullptr; - return commonType->binaryOperatorResult(_operator, _other); + if (isFractional()) + return TypeResult::err("Fractional literals not supported."); + else if (!integerType()) + return TypeResult::err("Literal too large."); + + // Shift and exp are not symmetric, so it does not make sense to swap + // the types as below. As an exception, we always use uint here. + if (TokenTraits::isShiftOp(_operator)) + { + if (!isValidShiftAndAmountType(_operator, *_other)) + return nullptr; + return isNegative() ? TypeProvider::int256() : TypeProvider::uint256(); + } + else if (Token::Exp == _operator) + { + if (auto const* otherIntType = dynamic_cast(_other)) + { + if (otherIntType->isSigned()) + return TypeResult::err("Exponentiation power is not allowed to be a signed integer type."); + } + else if (dynamic_cast(_other)) + return TypeResult::err("Exponent is fractional."); + + return isNegative() ? TypeProvider::int256() : TypeProvider::uint256(); + } + else + { + auto commonType = Type::commonType(this, _other); + if (!commonType) + return nullptr; + return commonType->binaryOperatorResult(_operator, _other); + } } else if (_other->category() != category()) return nullptr; diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol index a81e2755ef8e..e6bd08b8fc44 100644 --- a/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol @@ -1,5 +1,5 @@ contract C { - function f() public pure returns (uint8 x) { + function f() public pure returns (uint x) { uint8 y = uint8(2)**uint8(8); return 0**y; } diff --git a/test/libsolidity/semanticTests/exponentiation/literal_base.sol b/test/libsolidity/semanticTests/exponentiation/literal_base.sol new file mode 100644 index 000000000000..2c11519d0867 --- /dev/null +++ b/test/libsolidity/semanticTests/exponentiation/literal_base.sol @@ -0,0 +1,16 @@ +contract test { + function f(uint x) public pure returns (uint, int) { + uint a = 2 ** x; + int b = -2 ** x; + return (a, b); + } +} +// ---- +// f(uint256): 0 -> 1, 1 +// f(uint256): 1 -> 2, -2 +// f(uint256): 2 -> 4, 4 +// f(uint256): 13 -> 0x2000, -8192 +// f(uint256): 113 -> 0x020000000000000000000000000000, -10384593717069655257060992658440192 +// f(uint256): 114 -> 0x040000000000000000000000000000, 20769187434139310514121985316880384 +// f(uint256): 1113 -> 0x00, 0 +// f(uint256): 1114 -> 0x00, 0 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol index 0d91fcab1119..e80497460256 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol @@ -5,4 +5,3 @@ contract test { } } // ---- -// Warning: (99-104): Result of exponentiation has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol index c6a4052ecef3..9de53237deeb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol @@ -5,4 +5,3 @@ contract test { } } // ---- -// Warning: (99-106): Result of shift has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol index 0fd5f331fb9a..91454ff24ec0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18 +// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18. Exponent is fractional. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol index 03d10f7c029a..57dc845f401c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18 +// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18. Exponent is fractional. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shift_warn_literal_large_shift_amount.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shift_warn_literal_large_shift_amount.sol new file mode 100644 index 000000000000..7ba9bf3db407 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shift_warn_literal_large_shift_amount.sol @@ -0,0 +1,7 @@ +contract test { + function f() pure public returns(uint) { + uint x = 100; + return 10 << x; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/signed_rational_modulus.sol b/test/libsolidity/syntaxTests/signed_rational_modulus.sol index d01d2fabf1ee..f7f5cf138ffa 100644 --- a/test/libsolidity/syntaxTests/signed_rational_modulus.sol +++ b/test/libsolidity/syntaxTests/signed_rational_modulus.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// UnimplementedFeatureError: Not yet implemented - FixedPointType. +// TypeError: (117-123): Operator % not compatible with types rational_const 1 / 2 and fixed128x18. Fractional literals not supported. From 6f8b5fe53b1e28191cbbc17fd8db499890b2abfb Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 3 Jun 2020 13:53:11 +0200 Subject: [PATCH 181/479] Disallow override with non-public state variables --- Changelog.md | 1 + libsolidity/analysis/OverrideChecker.cpp | 5 +++++ .../inheritance/override/private_state_variable.sol | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol diff --git a/Changelog.md b/Changelog.md index ec12a214b04e..a1592946bc2e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -23,6 +23,7 @@ Bugfixes: * Type Checker: Fix internal compiler error when trying to decode too large static arrays. * Type Checker: Fix wrong compiler error when referencing an overridden function without calling it. * Type Checker: Fix internal compiler error when forward referencing non-literal constants from inline assembly. + * Type Checker: Disallow usage of override with non-public state variables. * NatSpec: DocString block is terminated when encountering an empty line. * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. * Code Generator: Trigger proper unimplemented errors on certain array copy operations. diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 4b9a3b7f3ea7..89f9a6637846 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -481,7 +481,12 @@ void OverrideChecker::checkIllegalOverrides(ContractDefinition const& _contract) for (auto const* stateVar: _contract.stateVariables()) { if (!stateVar->isPublic()) + { + if (stateVar->overrides()) + m_errorReporter.typeError(8022_error, stateVar->location(), "Override can only be used with public state variables."); + continue; + } if (contains_if(inheritedMods, MatchByName{stateVar->name()})) m_errorReporter.typeError(1456_error, stateVar->location(), "Override changes modifier to public state variable."); diff --git a/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol new file mode 100644 index 000000000000..400da4a8ea4a --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol @@ -0,0 +1,9 @@ +contract C1 { + function f() external pure returns(int) { return 42; } +} + +contract C is C1 { + int override f; +} +// ---- +// TypeError: (96-110): Override can only be used with public state variables. From 010a2246c72113d9f8f8f147ad0f8236a7484abd Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 3 Jun 2020 21:47:24 +0200 Subject: [PATCH 182/479] More tests for getters. --- .../getters/array_mapping_struct.sol | 29 +++++++++++++++++++ .../getters/mapping_array_struct.sol | 27 +++++++++++++++++ .../getters/mapping_of_string.sol | 18 ++++++++++++ .../getters/struct_with_bytes.sol | 18 ++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 test/libsolidity/semanticTests/getters/array_mapping_struct.sol create mode 100644 test/libsolidity/semanticTests/getters/mapping_array_struct.sol create mode 100644 test/libsolidity/semanticTests/getters/mapping_of_string.sol create mode 100644 test/libsolidity/semanticTests/getters/struct_with_bytes.sol diff --git a/test/libsolidity/semanticTests/getters/array_mapping_struct.sol b/test/libsolidity/semanticTests/getters/array_mapping_struct.sol new file mode 100644 index 000000000000..534dcd8a6970 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/array_mapping_struct.sol @@ -0,0 +1,29 @@ +contract C { + struct Y { + uint a; + uint b; + } + mapping(uint256 => Y)[] public m; + mapping(uint256 => Y)[3] public n; + constructor() public { + m.push(); + m.push(); + m[1][0].a = 1; + m[1][0].b = 2; + m[1][1].a = 3; + m[1][1].b = 4; + n[1][0].a = 7; + n[1][0].b = 8; + n[1][1].a = 9; + n[1][1].b = 10; + } +} +// ---- +// m(uint256,uint256): 0, 0 -> 0x00, 0x00 +// m(uint256,uint256): 1, 0 -> 1, 2 +// m(uint256,uint256): 1, 1 -> 3, 4 +// m(uint256,uint256): 1, 2 -> 0x00, 0x00 +// n(uint256,uint256): 0, 0 -> 0x00, 0x00 +// n(uint256,uint256): 1, 0 -> 7, 8 +// n(uint256,uint256): 1, 1 -> 9, 0x0a +// n(uint256,uint256): 1, 2 -> 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/getters/mapping_array_struct.sol b/test/libsolidity/semanticTests/getters/mapping_array_struct.sol new file mode 100644 index 000000000000..2b237c4df9a0 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/mapping_array_struct.sol @@ -0,0 +1,27 @@ +contract C { + struct Y { + uint a; + uint b; + } + mapping(uint256 => Y[]) public m; + mapping(uint256 => Y[3]) public n; + constructor() public { + m[1].push().a = 1; + m[1][0].b = 2; + m[1].push().a = 3; + m[1][1].b = 4; + n[1][0].a = 7; + n[1][0].b = 8; + n[1][1].a = 9; + n[1][1].b = 10; + } +} +// ---- +// m(uint256,uint256): 0, 0 -> FAILURE +// m(uint256,uint256): 1, 0 -> 1, 2 +// m(uint256,uint256): 1, 1 -> 3, 4 +// m(uint256,uint256): 1, 2 -> FAILURE +// n(uint256,uint256): 0, 0 -> 0x00, 0x00 +// n(uint256,uint256): 1, 0 -> 7, 8 +// n(uint256,uint256): 1, 1 -> 9, 0x0a +// n(uint256,uint256): 1, 2 -> 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/getters/mapping_of_string.sol b/test/libsolidity/semanticTests/getters/mapping_of_string.sol new file mode 100644 index 000000000000..ea0a8b8f8a54 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/mapping_of_string.sol @@ -0,0 +1,18 @@ +contract C { + mapping(string => uint8[3]) public x; + constructor() public { + x["abc"][0] = 1; + x["abc"][2] = 3; + x["abc"][1] = 2; + x["def"][1] = 9; + } +} +// ==== +// compileViaYul: also +// ---- +// x(string,uint256): 0x40, 0, 3, "abc" -> 1 +// x(string,uint256): 0x40, 1, 3, "abc" -> 2 +// x(string,uint256): 0x40, 2, 3, "abc" -> 3 +// x(string,uint256): 0x40, 0, 3, "def" -> 0x00 +// x(string,uint256): 0x40, 1, 3, "def" -> 9 +// x(string,uint256): 0x40, 2, 3, "def" -> 0x00 diff --git a/test/libsolidity/semanticTests/getters/struct_with_bytes.sol b/test/libsolidity/semanticTests/getters/struct_with_bytes.sol new file mode 100644 index 000000000000..2bbd7e8b823e --- /dev/null +++ b/test/libsolidity/semanticTests/getters/struct_with_bytes.sol @@ -0,0 +1,18 @@ +contract C { + struct S { + uint a; + bytes b; + mapping(uint => uint) c; + uint[] d; + } + uint shifter; + S public s; + constructor() public { + s.a = 7; + s.b = "abc"; + s.c[0] = 9; + s.d.push(10); + } +} +// ---- +// s() -> 7, 0x40, 3, 0x6162630000000000000000000000000000000000000000000000000000000000 From 4fd55ae3974c13bcfbafc32710f311fc783b684a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 4 Jun 2020 10:01:55 +0200 Subject: [PATCH 183/479] Fix toHex() in case of empty data and non-empty prefix --- libsolutil/CommonData.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index d04dd15dfaf4..72071acdeee1 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -53,9 +53,6 @@ string solidity::util::toHex(uint8_t _data, HexCase _case) string solidity::util::toHex(bytes const& _data, HexPrefix _prefix, HexCase _case) { - if (_data.empty()) - return {}; - std::string ret(_data.size() * 2 + (_prefix == HexPrefix::Add ? 2 : 0), 0); size_t i = 0; From 9b4077aa98c104b655c2a9aecc8c827eff5c3214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 3 Jun 2020 19:22:41 +0200 Subject: [PATCH 184/479] Changelog entry for #9074 --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index a1592946bc2e..4818a4ee8260 100644 --- a/Changelog.md +++ b/Changelog.md @@ -31,6 +31,7 @@ Bugfixes: * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. * SMTChecker: Fix internal error when assigning to index access inside branches. * SMTChecker: Fix internal error on try/catch clauses with parameters. + * Commandline Interface: Fix internal error when using ``--assemble`` or ``--yul`` options with ``--machine ewasm`` but without specifying ``--yul-dialect``. ### 0.6.8 (2020-05-14) From fc4b3e33b737ef493c08d2a6e536d4bf995cec45 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 4 Jun 2020 12:37:07 +0200 Subject: [PATCH 185/479] Prepare 0.6.9. --- Changelog.md | 29 +++++++++++++++-------------- docs/bugs_by_version.json | 4 ++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4818a4ee8260..43d31035bd0f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,37 +1,38 @@ -### 0.6.9 (unreleased) +### 0.6.9 (2020-06-04) Language Features: * Permit calldata location for all variables. + * NatSpec: Support NatSpec comments on state variables. * Yul: EVM instruction `pc()` is marked deprecated and will be removed in the next breaking release. Compiler Features: - * Code Generator: Do not introduce new source references for small internal routines. * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. - * Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree instead of the root of the filesystem. + * Code Generator: Do not introduce new internal source references for small compiler routines. + * Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree (defaults to the root of the filesystem). * SMTChecker: Support array ``length``. * SMTChecker: Support array ``push`` and ``pop``. * SMTChecker: General support to BitVectors and the bitwise ``and`` operator. - * Add support for natspec comments on state variables. Bugfixes: + * Code Generator: Trigger proper unimplemented errors on certain array copy operations. + * Commandline Interface: Fix internal error when using ``--assemble`` or ``--yul`` options with ``--machine ewasm`` but without specifying ``--yul-dialect``. + * NatSpec: DocString block is terminated when encountering an empty line. * Optimizer: Fixed a bug in BlockDeDuplicator. + * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. + * SMTChecker: Fix internal error on try/catch clauses with parameters. + * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. + * SMTChecker: Fix internal error when assigning to index access inside branches. + * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. * Type Checker: Disallow assignments to storage variables of type ``mapping``. * Type Checker: Disallow inline arrays of non-nameable types. + * Type Checker: Disallow usage of override with non-public state variables. * Type Checker: Fix internal compiler error when accessing members of array slices. + * Type Checker: Fix internal compiler error when forward referencing non-literal constants from inline assembly. * Type Checker: Fix internal compiler error when trying to decode too large static arrays. * Type Checker: Fix wrong compiler error when referencing an overridden function without calling it. - * Type Checker: Fix internal compiler error when forward referencing non-literal constants from inline assembly. - * Type Checker: Disallow usage of override with non-public state variables. - * NatSpec: DocString block is terminated when encountering an empty line. - * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. - * Code Generator: Trigger proper unimplemented errors on certain array copy operations. - * SMTChecker: Fix internal error when applying arithmetic operators to fixed point variables. - * SMTChecker: Fix internal error when short circuiting Boolean expressions with function calls in state variable initialization. - * SMTChecker: Fix internal error when assigning to index access inside branches. - * SMTChecker: Fix internal error on try/catch clauses with parameters. - * Commandline Interface: Fix internal error when using ``--assemble`` or ``--yul`` options with ``--machine ewasm`` but without specifying ``--yul-dialect``. + ### 0.6.8 (2020-05-14) diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 248517b8bed9..2d81e8783b5d 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1163,5 +1163,9 @@ "0.6.8": { "bugs": [], "released": "2020-05-14" + }, + "0.6.9": { + "bugs": [], + "released": "2020-06-04" } } \ No newline at end of file From 59ee743f6ab5c71fc26aad0c003245bac88d32c8 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 3 Jun 2020 19:22:17 +0200 Subject: [PATCH 186/479] Switch to upstream docker image for emscripten build. --- .circleci/config.yml | 2 +- .circleci/docker/Dockerfile.emscripten | 9 ++++----- Changelog.md | 1 + cmake/EthCompilerSettings.cmake | 16 ++++++++-------- scripts/travis-emscripten/build_emscripten.sh | 4 ++++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 624af2f0ed76..4bebea97f794 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -598,7 +598,7 @@ jobs: b_ems: docker: - - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 + - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 environment: TERM: xterm steps: diff --git a/.circleci/docker/Dockerfile.emscripten b/.circleci/docker/Dockerfile.emscripten index 67432f6c59a8..d2456bb2ae0b 100644 --- a/.circleci/docker/Dockerfile.emscripten +++ b/.circleci/docker/Dockerfile.emscripten @@ -26,11 +26,9 @@ # contains a Makefile in the docker/ subdirectory that can be used to create the # required base image using: # -# make version=1.39.15-fastcomp build +# make version=1.39.15 build # -# TODO: switch to the upstream backend by removing "-fastcomp". -# -FROM emscripten/emsdk:1.39.15-fastcomp AS base +FROM emscripten/emsdk:1.39.15 AS base ADD emscripten.jam /usr/src RUN set -ex; \ @@ -47,6 +45,7 @@ RUN set -ex; \ -DZ3_BUILD_TEST_EXECUTABLES=OFF \ -DZ3_BUILD_EXECUTABLE=OFF \ -DZ3_SINGLE_THREADED=ON \ + -DCMAKE_CXX_FLAGS="-s DISABLE_EXCEPTION_CATCHING=0" \ ..; \ make; make install; \ rm -r /usr/src/z3; \ @@ -61,6 +60,6 @@ RUN set -ex; \ echo "using emscripten : : em++ ;" >> project-config.jam ; \ ./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \ --with-system --with-filesystem --with-test --with-program_options \ - cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ + cxxflags="-s DISABLE_EXCEPTION_CATCHING=0 -Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ --prefix=/emsdk/emscripten/sdk/system install; \ rm -r /usr/src/boost_1_73_0 diff --git a/Changelog.md b/Changelog.md index 43d31035bd0f..62ddd07ea576 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Language Features: Compiler Features: * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. + * Build system: Switch the emscripten build from the fastcomp backend to the upstream backend. * Code Generator: Do not introduce new internal source references for small compiler routines. * Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree (defaults to the root of the filesystem). * SMTChecker: Support array ``length``. diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index b36af7e3f8ed..1f7600d9b141 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -16,9 +16,11 @@ include(EthCheckCXXCompilerFlag) -eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support) -if(NOT have_stack_protector_strong_support) - eth_add_cxx_compiler_flag_if_supported(-fstack-protector) +if(NOT EMSCRIPTEN) + eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support) + if(NOT have_stack_protector_strong_support) + eth_add_cxx_compiler_flag_if_supported(-fstack-protector) + endif() endif() eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough) @@ -109,15 +111,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA # Re-enable exception catching (optimisations above -O1 disable it) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") # Remove any code related to exit (such as atexit) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXIT_RUNTIME=0") # Remove any code related to filesystem access - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_FILESYSTEM=1") - # Remove variables even if it needs to be duplicated (can improve speed at the cost of size) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s AGGRESSIVE_VARIABLE_ELIMINATION=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FILESYSTEM=0") # Allow memory growth, but disable some optimisations set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Disable eval() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DYNAMIC_EXECUTION=0") # Disable greedy exception catcher set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0") # Abort if linking results in any undefined symbols diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh index c338a19772e4..5c7e3f052a95 100755 --- a/scripts/travis-emscripten/build_emscripten.sh +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -54,6 +54,10 @@ cmake \ -DTESTS=0 \ .. make -j 4 soljson +# Patch soljson.js for backwards compatibility. +# TODO: remove this with 0.7. +# "viiiii" encodes the signature of the callback function. +sed -i -e 's/addFunction(func,sig){/addFunction(func,sig){sig=sig||"viiiii";/' libsolc/soljson.js cd .. mkdir -p upload From a49a12762795fc2b3940e01b330bb368924b9188 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:00:33 +0200 Subject: [PATCH 187/479] yul-phaser: Use ptrdiff_t for iterator arithmetic --- test/yulPhaser/Mutations.cpp | 4 ++-- tools/yulPhaser/Mutations.cpp | 20 ++++++++++---------- tools/yulPhaser/PairSelections.cpp | 15 +++++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/test/yulPhaser/Mutations.cpp b/test/yulPhaser/Mutations.cpp index 27e57be08f11..86e9992f95d7 100644 --- a/test/yulPhaser/Mutations.cpp +++ b/test/yulPhaser/Mutations.cpp @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(geneAddition_should_be_able_to_insert_before_first_position BOOST_TEST(mutatedChromosome.length() > chromosome.length()); vector suffix( - mutatedChromosome.optimisationSteps().end() - chromosome.length(), + mutatedChromosome.optimisationSteps().end() - static_cast(chromosome.length()), mutatedChromosome.optimisationSteps().end() ); BOOST_TEST(suffix == chromosome.optimisationSteps()); @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(geneAddition_should_be_able_to_insert_after_last_position) vector prefix( mutatedChromosome.optimisationSteps().begin(), - mutatedChromosome.optimisationSteps().begin() + chromosome.length() + mutatedChromosome.optimisationSteps().begin() + static_cast(chromosome.length()) ); BOOST_TEST(prefix == chromosome.optimisationSteps()); } diff --git a/tools/yulPhaser/Mutations.cpp b/tools/yulPhaser/Mutations.cpp index 2b988e62206c..f2876e395ab9 100644 --- a/tools/yulPhaser/Mutations.cpp +++ b/tools/yulPhaser/Mutations.cpp @@ -126,12 +126,12 @@ ChromosomePair fixedPointSwap( return { Chromosome( - vector(begin1, begin1 + _crossoverPoint) + - vector(begin2 + _crossoverPoint, end2) + vector(begin1, begin1 + static_cast(_crossoverPoint)) + + vector(begin2 + static_cast(_crossoverPoint), end2) ), Chromosome( - vector(begin2, begin2 + _crossoverPoint) + - vector(begin1 + _crossoverPoint, end1) + vector(begin2, begin2 + static_cast(_crossoverPoint)) + + vector(begin1 + static_cast(_crossoverPoint), end1) ), }; } @@ -196,8 +196,8 @@ ChromosomePair fixedTwoPointSwap( assert(_crossoverPoint2 <= _chromosome1.length()); assert(_crossoverPoint2 <= _chromosome2.length()); - size_t lowPoint = min(_crossoverPoint1, _crossoverPoint2); - size_t highPoint = max(_crossoverPoint1, _crossoverPoint2); + auto lowPoint = static_cast(min(_crossoverPoint1, _crossoverPoint2)); + auto highPoint = static_cast(max(_crossoverPoint1, _crossoverPoint2)); auto begin1 = _chromosome1.optimisationSteps().begin(); auto begin2 = _chromosome2.optimisationSteps().begin(); @@ -282,17 +282,17 @@ ChromosomePair uniformSwap(Chromosome const& _chromosome1, Chromosome const& _ch if (_chromosome1.length() > minLength) { if (swapTail) - steps2.insert(steps2.end(), begin1 + minLength, end1); + steps2.insert(steps2.end(), begin1 + static_cast(minLength), end1); else - steps1.insert(steps1.end(), begin1 + minLength, end1); + steps1.insert(steps1.end(), begin1 + static_cast(minLength), end1); } if (_chromosome2.length() > minLength) { if (swapTail) - steps1.insert(steps1.end(), begin2 + minLength, end2); + steps1.insert(steps1.end(), begin2 + static_cast(minLength), end2); else - steps2.insert(steps2.end(), begin2 + minLength, end2); + steps2.insert(steps2.end(), begin2 + static_cast(minLength), end2); } return {Chromosome(steps1), Chromosome(steps2)}; diff --git a/tools/yulPhaser/PairSelections.cpp b/tools/yulPhaser/PairSelections.cpp index 7e744ff7053c..8934c3e1789c 100644 --- a/tools/yulPhaser/PairSelections.cpp +++ b/tools/yulPhaser/PairSelections.cpp @@ -30,7 +30,7 @@ vector> RandomPairSelection::materialise(size_t _poolSize) if (_poolSize < 2) return {}; - size_t count = static_cast(round(_poolSize * m_selectionSize)); + auto count = static_cast(round(_poolSize * m_selectionSize)); vector> selection; for (size_t i = 0; i < count; ++i) @@ -64,7 +64,10 @@ vector> PairsFromRandomSubset::materialise(size_t _poolSiz } while (selectedIndices.size() % 2 != 0); } else - selectedIndices.erase(selectedIndices.begin() + SimulationRNG::uniformInt(0, selectedIndices.size() - 1)); + selectedIndices.erase( + selectedIndices.begin() + + static_cast(SimulationRNG::uniformInt(0, selectedIndices.size() - 1)) + ); } assert(selectedIndices.size() % 2 == 0); @@ -73,14 +76,14 @@ vector> PairsFromRandomSubset::materialise(size_t _poolSiz { size_t position1 = SimulationRNG::uniformInt(0, selectedIndices.size() - 1); size_t value1 = selectedIndices[position1]; - selectedIndices.erase(selectedIndices.begin() + position1); + selectedIndices.erase(selectedIndices.begin() + static_cast(position1)); size_t position2 = SimulationRNG::uniformInt(0, selectedIndices.size() - 1); size_t value2 = selectedIndices[position2]; - selectedIndices.erase(selectedIndices.begin() + position2); + selectedIndices.erase(selectedIndices.begin() + static_cast(position2)); - selectedPairs.push_back({value1, value2}); + selectedPairs.emplace_back(value1, value2); } - assert(selectedIndices.size() == 0); + assert(selectedIndices.empty()); return selectedPairs; } From 9b3d1c11ff40db588179af12b3f6c827eb833725 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:00:33 +0200 Subject: [PATCH 188/479] yul-phaser: A few more tweaks to ensure that signedness conversions do not cause warnings - Don't cast booleans to int when the result gets assigned to an unsigned type. Relace them with ifs. - Use unsigned initializer for a variable declared in a lambda capture. - Unsigned abs() of a difference of unsigned values. --- test/yulPhaser/Mutations.cpp | 4 ++-- test/yulPhaser/Population.cpp | 2 +- test/yulPhaser/TestHelpers.cpp | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/yulPhaser/Mutations.cpp b/test/yulPhaser/Mutations.cpp index 86e9992f95d7..b20cb8e4cb7a 100644 --- a/test/yulPhaser/Mutations.cpp +++ b/test/yulPhaser/Mutations.cpp @@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(alternativeMutations_should_choose_between_mutations_with_g for (size_t i = 0; i < 10; ++i) { Chromosome mutatedChromosome = mutation(chromosome); - cCount += static_cast(mutatedChromosome == Chromosome("c")); - fCount += static_cast(mutatedChromosome == Chromosome("f")); + cCount += (mutatedChromosome == Chromosome("c") ? 1 : 0); + fCount += (mutatedChromosome == Chromosome("f") ? 1 : 0); } // This particular seed results in 7 "c"s out of 10 which looks plausible given the 80% chance. diff --git a/test/yulPhaser/Population.cpp b/test/yulPhaser/Population.cpp index 1657e97c99c9..5fd8c2073cf1 100644 --- a/test/yulPhaser/Population.cpp +++ b/test/yulPhaser/Population.cpp @@ -135,7 +135,7 @@ BOOST_FIXTURE_TEST_CASE(makeRandom_should_get_chromosome_lengths_from_specified_ size_t maxLength = 5; assert(chromosomeCount % maxLength == 0); - auto nextLength = [counter = 0, maxLength]() mutable { return counter++ % maxLength; }; + auto nextLength = [counter = 0ul, maxLength]() mutable { return counter++ % maxLength; }; auto population = Population::makeRandom(m_fitnessMetric, chromosomeCount, nextLength); // We can't rely on the order since the population sorts its chromosomes immediately but diff --git a/test/yulPhaser/TestHelpers.cpp b/test/yulPhaser/TestHelpers.cpp index 2379016fe246..2f4b40b02bbe 100644 --- a/test/yulPhaser/TestHelpers.cpp +++ b/test/yulPhaser/TestHelpers.cpp @@ -72,9 +72,13 @@ size_t phaser::test::countDifferences(Chromosome const& _chromosome1, Chromosome { size_t count = 0; for (size_t i = 0; i < min(_chromosome1.length(), _chromosome2.length()); ++i) - count += static_cast(_chromosome1.optimisationSteps()[i] != _chromosome2.optimisationSteps()[i]); + if (_chromosome1.optimisationSteps()[i] != _chromosome2.optimisationSteps()[i]) + ++count; - return count + abs(static_cast(_chromosome1.length() - _chromosome2.length())); + return count + static_cast(abs( + static_cast(_chromosome1.length()) - + static_cast(_chromosome2.length()) + )); } TemporaryDirectory::TemporaryDirectory(std::string const& _prefix): From 8f55ead48d58ee4040e5b44623e5b0437b57913f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 3 Jun 2020 13:52:37 +0200 Subject: [PATCH 189/479] yul-phaser: Switch from uint32_t to size_t in SimulationRNG - Also pass the appriopriate type internally to the distribution instead of relying on the default (which is uint32_t) --- tools/yulPhaser/GeneticAlgorithms.cpp | 2 +- tools/yulPhaser/SimulationRNG.cpp | 23 ++++++++++++++++------- tools/yulPhaser/SimulationRNG.h | 4 ++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tools/yulPhaser/GeneticAlgorithms.cpp b/tools/yulPhaser/GeneticAlgorithms.cpp index 1da31645fd2e..4a90503aa1fd 100644 --- a/tools/yulPhaser/GeneticAlgorithms.cpp +++ b/tools/yulPhaser/GeneticAlgorithms.cpp @@ -155,7 +155,7 @@ Population ClassicGeneticAlgorithm::select(Population _population, size_t _selec vector selectedIndividuals; for (size_t i = 0; i < _selectionSize; ++i) { - uint32_t ball = SimulationRNG::uniformInt(0, rouletteRange - 1); + size_t ball = SimulationRNG::uniformInt(0, rouletteRange - 1); size_t cumulativeFitness = 0; for (auto const& individual: _population.individuals()) diff --git a/tools/yulPhaser/SimulationRNG.cpp b/tools/yulPhaser/SimulationRNG.cpp index 2b596f4ed732..26f438909718 100644 --- a/tools/yulPhaser/SimulationRNG.cpp +++ b/tools/yulPhaser/SimulationRNG.cpp @@ -17,12 +17,17 @@ #include +// NOTE: The code would work with std::random but the results for a given seed would not be reproducible +// across different STL implementations. Boost does not guarantee this either but at least it has only one +// implementation. Reproducibility is not a hard requirement for yul-phaser but it's nice to have. #include #include #include #include +#include +using namespace std; using namespace solidity; using namespace solidity::phaser; @@ -30,21 +35,25 @@ thread_local boost::random::mt19937 SimulationRNG::s_generator(SimulationRNG::ge bool SimulationRNG::bernoulliTrial(double _successProbability) { - boost::random::bernoulli_distribution<> distribution(_successProbability); + boost::random::bernoulli_distribution distribution(_successProbability); - return static_cast(distribution(s_generator)); + return distribution(s_generator); } -uint32_t SimulationRNG::uniformInt(uint32_t _min, uint32_t _max) +size_t SimulationRNG::uniformInt(size_t _min, size_t _max) { - boost::random::uniform_int_distribution<> distribution(_min, _max); + boost::random::uniform_int_distribution distribution(_min, _max); return distribution(s_generator); } -uint32_t SimulationRNG::binomialInt(uint32_t _numTrials, double _successProbability) +size_t SimulationRNG::binomialInt(size_t _numTrials, double _successProbability) { - boost::random::binomial_distribution<> distribution(_numTrials, _successProbability); - return distribution(s_generator); + // NOTE: binomial_distribution would not work because it internally tries to use abs() + // and fails to compile due to ambiguous conversion. + assert(_numTrials <= static_cast(numeric_limits::max())); + + boost::random::binomial_distribution distribution(static_cast(_numTrials), _successProbability); + return static_cast(distribution(s_generator)); } uint32_t SimulationRNG::generateSeed() diff --git a/tools/yulPhaser/SimulationRNG.h b/tools/yulPhaser/SimulationRNG.h index 1e8a1da18b11..d16189f9ebca 100644 --- a/tools/yulPhaser/SimulationRNG.h +++ b/tools/yulPhaser/SimulationRNG.h @@ -38,8 +38,8 @@ class SimulationRNG { public: static bool bernoulliTrial(double _successProbability); - static uint32_t uniformInt(uint32_t _min, uint32_t _max); - static uint32_t binomialInt(uint32_t _numTrials, double _successProbability); + static size_t uniformInt(size_t _min, size_t _max); + static size_t binomialInt(size_t _numTrials, double _successProbability); /// Resets generator to a known state given by the @a seed. Given the same seed, a fixed /// sequence of calls to the members generating random values is guaranteed to produce the From 4cf92bcd89668e89de0510239f507a04f6a3b846 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 4 Jun 2020 18:44:22 +0200 Subject: [PATCH 190/479] Set version to 0.6.10 --- CMakeLists.txt | 2 +- Changelog.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aa6647b2233..e7100f141a2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.9") +set(PROJECT_VERSION "0.6.10") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index 62ddd07ea576..ad91260391ac 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +### 0.6.10 (unreleased) + + + ### 0.6.9 (2020-06-04) Language Features: From 87ceb72b823e25e5cd0a38b5691e205b876aa59f Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 27 May 2020 19:24:48 +0200 Subject: [PATCH 191/479] [SMTChecker] Fix internal error in tuples of tuples. --- Changelog.md | 8 ++ libsolidity/formal/SMTEncoder.cpp | 114 ++++++++++-------- libsolidity/formal/SMTEncoder.h | 4 +- .../smtCheckerTests/types/tuple_tuple.sol | 6 + 4 files changed, 80 insertions(+), 52 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_tuple.sol diff --git a/Changelog.md b/Changelog.md index ad91260391ac..05bc998242b5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,13 @@ ### 0.6.10 (unreleased) +Language Features: + + +Compiler Features: + + +Bugfixes: + * SMTChecker: Fix internal error when encoding tuples of tuples. ### 0.6.9 (2020-06-04) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index b06abbe6e95a..285c64a9b7c3 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -385,44 +385,22 @@ void SMTEncoder::endVisit(Assignment const& _assignment) } else { - auto const& type = _assignment.annotation().type; - vector rightArguments; - if (auto const* tupleTypeRight = dynamic_cast(_assignment.rightHandSide().annotation().type)) - { - auto symbTupleLeft = dynamic_pointer_cast(m_context.expression(_assignment.leftHandSide())); - solAssert(symbTupleLeft, ""); - auto symbTupleRight = dynamic_pointer_cast(m_context.expression(_assignment.rightHandSide())); - solAssert(symbTupleRight, ""); - - auto const& leftComponents = symbTupleLeft->components(); - auto const& rightComponents = symbTupleRight->components(); - solAssert(leftComponents.size() == rightComponents.size(), ""); - - auto tupleTypeLeft = dynamic_cast(_assignment.leftHandSide().annotation().type); - solAssert(tupleTypeLeft, ""); - solAssert(tupleTypeLeft->components().size() == leftComponents.size(), ""); - auto const& typesLeft = tupleTypeLeft->components(); - - solAssert(tupleTypeRight->components().size() == rightComponents.size(), ""); - auto const& typesRight = tupleTypeRight->components(); - - for (unsigned i = 0; i < rightComponents.size(); ++i) - rightArguments.push_back(symbTupleRight->component(i, typesRight.at(i), typesLeft.at(i))); - } + if (dynamic_cast(_assignment.rightHandSide().annotation().type)) + tupleAssignment(_assignment.leftHandSide(), _assignment.rightHandSide()); else { + auto const& type = _assignment.annotation().type; auto rightHandSide = compoundOps.count(op) ? compoundAssignment(_assignment) : expr(_assignment.rightHandSide(), type); defineExpr(_assignment, rightHandSide); - rightArguments.push_back(expr(_assignment, type)); + assignment( + _assignment.leftHandSide(), + expr(_assignment, type), + type, + _assignment.location() + ); } - assignment( - _assignment.leftHandSide(), - rightArguments, - type, - _assignment.location() - ); } } @@ -1422,11 +1400,16 @@ smtutil::Expression SMTEncoder::division(smtutil::Expression _left, smtutil::Exp void SMTEncoder::assignment( Expression const& _left, - vector const& _right, + smtutil::Expression const& _right, TypePointer const& _type, langutil::SourceLocation const& _location ) { + solAssert( + _left.annotation().type->category() != Type::Category::Tuple, + "Tuple assignments should be handled by tupleAssignment." + ); + if (!smt::isSupportedType(_type->category())) { // Give it a new index anyway to keep the SSA scheme sound. @@ -1440,26 +1423,9 @@ void SMTEncoder::assignment( ); } else if (auto varDecl = identifierToVariable(_left)) - { - solAssert(_right.size() == 1, ""); - assignment(*varDecl, _right.front()); - } + assignment(*varDecl, _right); else if (dynamic_cast(&_left)) - { - solAssert(_right.size() == 1, ""); - arrayIndexAssignment(_left, _right.front()); - } - else if (auto tuple = dynamic_cast(&_left)) - { - auto const& components = tuple->components(); - if (!_right.empty()) - { - solAssert(_right.size() == components.size(), ""); - for (unsigned i = 0; i < _right.size(); ++i) - if (auto component = components.at(i)) - assignment(*component, {_right.at(i)}, component->annotation().type, component->location()); - } - } + arrayIndexAssignment(_left, _right); else m_errorReporter.warning( 8182_error, @@ -1468,6 +1434,52 @@ void SMTEncoder::assignment( ); } +void SMTEncoder::tupleAssignment(Expression const& _left, Expression const& _right) +{ + auto lTuple = dynamic_cast(&_left); + solAssert(lTuple, ""); + + auto const& lComponents = lTuple->components(); + + // If both sides are tuple expressions, we individually and potentially + // recursively assign each pair of components. + // This is because of potential type conversion. + if (auto rTuple = dynamic_cast(&_right)) + { + auto const& rComponents = rTuple->components(); + solAssert(lComponents.size() == rComponents.size(), ""); + for (unsigned i = 0; i < lComponents.size(); ++i) + { + if (!lComponents.at(i) || !rComponents.at(i)) + continue; + auto const& lExpr = *lComponents.at(i); + auto const& rExpr = *rComponents.at(i); + if (lExpr.annotation().type->category() == Type::Category::Tuple) + tupleAssignment(lExpr, rExpr); + else + { + auto type = lExpr.annotation().type; + assignment(lExpr, expr(rExpr, type), type, lExpr.location()); + } + } + } + else + { + auto rType = dynamic_cast(_right.annotation().type); + solAssert(rType, ""); + + auto const& rComponents = rType->components(); + solAssert(lComponents.size() == rComponents.size(), ""); + + auto symbRight = expr(_right); + solAssert(symbRight.sort->kind == smtutil::Kind::Tuple, ""); + + for (unsigned i = 0; i < lComponents.size(); ++i) + if (auto component = lComponents.at(i); component && rComponents.at(i)) + assignment(*component, smtutil::Expression::tuple_get(symbRight, i), component->annotation().type, component->location()); + } +} + smtutil::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment) { static map const compoundToArithmetic{ diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 0e4c170fc78f..d909255713cb 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -157,10 +157,12 @@ class SMTEncoder: public ASTConstVisitor /// Will also be used for assignments of tuple components. void assignment( Expression const& _left, - std::vector const& _right, + smtutil::Expression const& _right, TypePointer const& _type, langutil::SourceLocation const& _location ); + /// Handle assignments between tuples. + void tupleAssignment(Expression const& _left, Expression const& _right); /// Computes the right hand side of a compound assignment. smtutil::Expression compoundAssignment(Assignment const& _assignment); diff --git a/test/libsolidity/smtCheckerTests/types/tuple_tuple.sol b/test/libsolidity/smtCheckerTests/types/tuple_tuple.sol new file mode 100644 index 000000000000..c12e56a2d11e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_tuple.sol @@ -0,0 +1,6 @@ +pragma experimental SMTChecker; +contract C { + function f3() public pure { + ((, ), ) = ((7, 8), 9); + } +} From 976a0f9395fef66fde03145b64e84116294183e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 5 Jun 2020 14:56:21 +0200 Subject: [PATCH 192/479] wasm/BinaryTransform: Don't add an empty local entry in binary wasm if there are no locals --- libyul/backends/wasm/BinaryTransform.cpp | 11 ++++++++--- test/cmdlineTests/evm_to_wasm/output | 2 +- test/cmdlineTests/evm_to_wasm_break/output | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 84e3650162e2..1053f35a8340 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -430,9 +430,14 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function) // This is a kind of run-length-encoding of local types. Has to be adapted once // we have locals of different types. - ret += lebEncode(1); // number of locals groups - ret += lebEncode(_function.locals.size()); - ret += toBytes(ValueType::I64); + if (_function.locals.size() == 0) + ret += lebEncode(0); // number of locals groups + else + { + ret += lebEncode(1); // number of locals groups + ret += lebEncode(_function.locals.size()); + ret += toBytes(ValueType::I64); + } m_locals.clear(); size_t varIdx = 0; diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output index 31b982d0dba6..888c49d6a40c 100644 --- a/test/cmdlineTests/evm_to_wasm/output +++ b/test/cmdlineTests/evm_to_wasm/output @@ -45,7 +45,7 @@ object "object" { Binary representation: -0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acd01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b4101007e02402000a7200110043703002000a74208a76aada7200210043703002000a74210a76aada7200310043703002000a74218a76aada7200410043703000b0b +0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acb01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b3f0002402000a7200110043703002000a74208a76aada7200210043703002000a74210a76aada7200310043703002000a74218a76aada7200410043703000b0b Text representation: (module diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 2325fa737083..4e9108af821d 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -154,7 +154,7 @@ object "object" { Binary representation: -0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa9090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b4101007e02402000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b0b2701007e024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b +0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa5090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3f0002402000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b0b2500024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b Text representation: (module From fe0a0802b22e502379aa934103aaec23bb047915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 5 Jun 2020 19:25:47 +0200 Subject: [PATCH 193/479] wasm/BinaryTransform: Fix wrong alignment for .load/.store with arguments smaller than 64-bits --- libyul/backends/wasm/BinaryTransform.cpp | 8 ++++-- test/cmdlineTests/evm_to_wasm/output | 2 +- test/cmdlineTests/evm_to_wasm_break/output | 2 +- .../args | 1 + .../err | 1 + .../input.yul | 8 ++++++ .../output | 27 +++++++++++++++++++ 7 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args create mode 100644 test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/err create mode 100644 test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul create mode 100644 test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 1053f35a8340..1cf825dd4915 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -336,8 +336,12 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) _call.functionName.find(".load") != string::npos || _call.functionName.find(".store") != string::npos ) - // alignment and offset - ret += bytes{{3, 0}}; + // Alignment hint and offset. Interpreters ignore the alignment. JITs/AOTs can take it + // into account to generate more efficient code but if the hint is invalid it could + // actually be more expensive. It's best to hint at 1-byte alignment if we don't plan + // to control the memory layout accordingly. + ret += bytes{{0, 0}}; // 2^0 == 1-byte alignment + return ret; } } diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output index 888c49d6a40c..7e8bd21cc4b7 100644 --- a/test/cmdlineTests/evm_to_wasm/output +++ b/test/cmdlineTests/evm_to_wasm/output @@ -45,7 +45,7 @@ object "object" { Binary representation: -0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acb01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b3f0002402000a7200110043703002000a74208a76aada7200210043703002000a74210a76aada7200310043703002000a74218a76aada7200410043703000b0b +0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acb01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b3f0002402000a7200110043700002000a74208a76aada7200210043700002000a74210a76aada7200310043700002000a74218a76aada7200410043700000b0b Text representation: (module diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 4e9108af821d..4d5e10921121 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -154,7 +154,7 @@ object "object" { Binary representation: -0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa5090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290300100c21084200a74208a76aada7290300100c21094200a74210a76aada7290300100c210a4200a74218a76aada7290300100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3f0002402000a72001100c3703002000a74208a76aada72002100c3703002000a74210a76aada72003100c3703002000a74218a76aada72004100c3703000b0b2500024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b +0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa5090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290000100c21084200a74208a76aada7290000100c21094200a74210a76aada7290000100c210a4200a74218a76aada7290000100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3f0002402000a72001100c3700002000a74208a76aada72002100c3700002000a74210a76aada72003100c3700002000a74218a76aada72004100c3700000b0b2500024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b Text representation: (module diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args new file mode 100644 index 000000000000..04cd5f05ba49 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args @@ -0,0 +1 @@ +--yul --yul-dialect ewasm --machine ewasm diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/err b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/err new file mode 100644 index 000000000000..014a1178fa22 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/err @@ -0,0 +1 @@ +Warning: Yul is still experimental. Please use the output with care. diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul new file mode 100644 index 000000000000..731e6c9bb21a --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul @@ -0,0 +1,8 @@ +object "object" { + code { + function main() + { + i64.store8(0x01:i32, 42:i64) + } + } +} diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output new file mode 100644 index 000000000000..ef0b409fbd77 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output @@ -0,0 +1,27 @@ + +======= wasm_to_wasm_memory_instructions_alignment/input.yul (Ewasm) ======= + +Pretty printed source: +object "object" { + code { + function main() + { i64.store8(0x01:i32, 42) } + } +} + + +Binary representation: +0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0f010d0002404201a7422a3c00000b0b + +Text representation: +(module + (memory $memory (export "memory") 1) + (export "main" (func $main)) + +(func $main + (block $label_ + (i64.store8 (i32.wrap_i64 (i64.const 1)) (i64.const 42)) + ) +) + +) From 5333e35cd79cbe2e05211a285493fed031bc9751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 6 Jun 2020 00:13:01 +0200 Subject: [PATCH 194/479] CommandLineInterface: Reformat command-line option definitions for better readability - Don't mix single-line and multi-line formatting in the same group. The single-line options get visually "lost" between the multi-line ones. - Put semicolons on separate lines. This makes it easier to move options around without having to fix them constantly and also should make diffs a bit nicer. --- solc/CommandLineInterface.cpp | 64 ++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 44be43539325..f23854b5b985 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -752,7 +752,10 @@ Allowed options)").c_str(), "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " "byzantium, constantinople, petersburg, istanbul (default) or berlin." ) - (g_argPrettyJson.c_str(), "Output JSON in pretty format. Currently it only works with the combined JSON output.") + ( + g_argPrettyJson.c_str(), + "Output JSON in pretty format. Currently it only works with the combined JSON output." + ) ( g_argLibraries.c_str(), po::value>()->value_name("libs"), @@ -770,13 +773,19 @@ Allowed options)").c_str(), po::value()->value_name("path"), "If given, creates one file per component and contract/file at the specified directory." ) - (g_strOverwrite.c_str(), "Overwrite existing files (used together with -o).") + ( + g_strOverwrite.c_str(), + "Overwrite existing files (used together with -o)." + ) ( g_argCombinedJson.c_str(), po::value()->value_name(boost::join(g_combinedJsonArgs, ",")), "Output a single json document containing the specified information." ) - (g_argGas.c_str(), "Print an estimate of the maximal gas usage for each function.") + ( + g_argGas.c_str(), + "Print an estimate of the maximal gas usage for each function." + ) ( g_argStandardJSON.c_str(), "Switch to Standard JSON input / output mode, ignoring all options. " @@ -826,7 +835,10 @@ Allowed options)").c_str(), po::value()->value_name(boost::join(g_metadataHashArgs, ",")), "Choose hash method for the bytecode metadata or disable it." ) - (g_argMetadataLiteral.c_str(), "Store referenced sources as literal data in the metadata output.") + ( + g_argMetadataLiteral.c_str(), + "Store referenced sources as literal data in the metadata output." + ) ( g_argAllowPaths.c_str(), po::value()->value_name("path(s)"), @@ -837,12 +849,29 @@ Allowed options)").c_str(), po::value()->value_name("path"), "Use the given path as the root of the source tree instead of the root of the filesystem." ) - (g_argColor.c_str(), "Force colored output.") - (g_argNoColor.c_str(), "Explicitly disable colored output, disabling terminal auto-detection.") - (g_argOldReporter.c_str(), "Enables old diagnostics reporter.") - (g_argErrorRecovery.c_str(), "Enables additional parser error recovery.") - (g_argIgnoreMissingFiles.c_str(), "Ignore missing files."); + ( + g_argColor.c_str(), + "Force colored output." + ) + ( + g_argNoColor.c_str(), + "Explicitly disable colored output, disabling terminal auto-detection." + ) + ( + g_argOldReporter.c_str(), + "Enables old diagnostics reporter." + ) + ( + g_argErrorRecovery.c_str(), + "Enables additional parser error recovery." + ) + ( + g_argIgnoreMissingFiles.c_str(), + "Ignore missing files." + ) + ; po::options_description optimizerOptions("Optimizer options"); + optimizerOptions.add_options() (g_argOptimize.c_str(), "Enable bytecode optimizer.") ( @@ -851,14 +880,22 @@ Allowed options)").c_str(), "Set for how many contract runs to optimize. " "Lower values will optimize more for initial deployment cost, higher values will optimize more for high-frequency usage." ) - (g_strOptimizeYul.c_str(), ("Legacy option, ignored. Use the general --" + g_argOptimize + " to enable Yul optimizer.").c_str()) - (g_strNoOptimizeYul.c_str(), "Disable Yul optimizer in Solidity.") + ( + g_strOptimizeYul.c_str(), + ("Legacy option, ignored. Use the general --" + g_argOptimize + " to enable Yul optimizer.").c_str() + ) + ( + g_strNoOptimizeYul.c_str(), + "Disable Yul optimizer in Solidity." + ) ( g_strYulOptimizations.c_str(), po::value()->value_name("steps"), "Forces yul optimizer to use the specified sequence of optimization steps instead of the built-in one." - ); + ) + ; desc.add(optimizerOptions); + po::options_description outputComponents("Output Components"); outputComponents.add_options() (g_argAstJson.c_str(), "AST of all source files in JSON format.") @@ -876,7 +913,8 @@ Allowed options)").c_str(), (g_argNatspecUser.c_str(), "Natspec user documentation of all contracts.") (g_argNatspecDev.c_str(), "Natspec developer documentation of all contracts.") (g_argMetadata.c_str(), "Combined Metadata JSON whose Swarm hash is stored on-chain.") - (g_argStorageLayout.c_str(), "Slots, offsets and types of the contract's state variables."); + (g_argStorageLayout.c_str(), "Slots, offsets and types of the contract's state variables.") + ; desc.add(outputComponents); po::options_description allOptions = desc; From 7bd7ff3d7d084ae769ec1e288e19c914274a4f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 29 May 2020 22:28:07 +0200 Subject: [PATCH 195/479] CommandLineInterface: Group and reorder command-line options --- solc/CommandLineInterface.cpp | 187 +++++++++++++++++++++------------- 1 file changed, 115 insertions(+), 72 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index f23854b5b985..3d507c8a593d 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -738,7 +738,7 @@ remap paths using the context:prefix=path syntax. Example: solc --)" + g_argBinary + R"( -o /tmp/solcoutput dapp-bin=/usr/local/lib/dapp-bin contract.sol -Allowed options)").c_str(), +General Information)").c_str(), po::options_description::m_default_line_length, po::options_description::m_default_line_length - 23 ); @@ -746,28 +746,33 @@ Allowed options)").c_str(), (g_argHelp.c_str(), "Show help message and exit.") (g_argVersion.c_str(), "Show version and exit.") (g_strLicense.c_str(), "Show licensing information and exit.") + ; + + po::options_description inputOptions("Input Options"); + inputOptions.add_options() ( - g_strEVMVersion.c_str(), - po::value()->value_name("version"), - "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " - "byzantium, constantinople, petersburg, istanbul (default) or berlin." + g_argBasePath.c_str(), + po::value()->value_name("path"), + "Use the given path as the root of the source tree instead of the root of the filesystem." ) ( - g_argPrettyJson.c_str(), - "Output JSON in pretty format. Currently it only works with the combined JSON output." + g_argAllowPaths.c_str(), + po::value()->value_name("path(s)"), + "Allow a given path for imports. A list of paths can be supplied by separating them with a comma." ) ( - g_argLibraries.c_str(), - po::value>()->value_name("libs"), - "Direct string or file containing library addresses. Syntax: " - ":
[, or whitespace] ...\n" - "Address is interpreted as a hex string optionally prefixed by 0x." + g_argIgnoreMissingFiles.c_str(), + "Ignore missing files." ) ( - g_strRevertStrings.c_str(), - po::value()->value_name(boost::join(g_revertStringsArgs, ",")), - "Strip revert (and require) reason strings or add additional debugging information." + g_argErrorRecovery.c_str(), + "Enables additional parser error recovery." ) + ; + desc.add(inputOptions); + + po::options_description outputOptions("Output Options"); + outputOptions.add_options() ( (g_argOutputDir + ",o").c_str(), po::value()->value_name("path"), @@ -778,24 +783,30 @@ Allowed options)").c_str(), "Overwrite existing files (used together with -o)." ) ( - g_argCombinedJson.c_str(), - po::value()->value_name(boost::join(g_combinedJsonArgs, ",")), - "Output a single json document containing the specified information." + g_strEVMVersion.c_str(), + po::value()->value_name("version"), + "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " + "byzantium, constantinople, petersburg, istanbul (default) or berlin." ) ( - g_argGas.c_str(), - "Print an estimate of the maximal gas usage for each function." + g_strRevertStrings.c_str(), + po::value()->value_name(boost::join(g_revertStringsArgs, ",")), + "Strip revert (and require) reason strings or add additional debugging information." ) + ; + desc.add(outputOptions); + + po::options_description alternativeInputModes("Alternative Input Modes"); + alternativeInputModes.add_options() ( g_argStandardJSON.c_str(), "Switch to Standard JSON input / output mode, ignoring all options. " "It reads from standard input, if no input file was given, otherwise it reads from the provided input file. The result will be written to standard output." ) ( - g_argImportAst.c_str(), - ("Import ASTs to be compiled, assumes input holds the AST in compact JSON format. " - "Supported Inputs is the output of the --" + g_argStandardJSON + " or the one produced by " - "--" + g_argCombinedJson + " " + g_strAst + "," + g_strCompactJSON).c_str() + g_argLink.c_str(), + ("Switch to linker mode, ignoring all options apart from --" + g_argLibraries + " " + "and modify binaries in place.").c_str() ) ( g_argAssemble.c_str(), @@ -816,38 +827,46 @@ Allowed options)").c_str(), "and assumes input is strict assembly.").c_str() ) ( - g_strYulDialect.c_str(), - po::value()->value_name(boost::join(g_yulDialectArgs, ",")), - "Input dialect to use in assembly or yul mode." + g_argImportAst.c_str(), + ("Import ASTs to be compiled, assumes input holds the AST in compact JSON format. " + "Supported Inputs is the output of the --" + g_argStandardJSON + " or the one produced by " + "--" + g_argCombinedJson + " " + g_strAst + "," + g_strCompactJSON).c_str() ) + ; + desc.add(alternativeInputModes); + + po::options_description assemblyModeOptions("Assembly Mode Options"); + assemblyModeOptions.add_options() ( g_argMachine.c_str(), po::value()->value_name(boost::join(g_machineArgs, ",")), "Target machine in assembly or Yul mode." ) ( - g_argLink.c_str(), - ("Switch to linker mode, ignoring all options apart from --" + g_argLibraries + " " - "and modify binaries in place.").c_str() - ) - ( - g_argMetadataHash.c_str(), - po::value()->value_name(boost::join(g_metadataHashArgs, ",")), - "Choose hash method for the bytecode metadata or disable it." - ) - ( - g_argMetadataLiteral.c_str(), - "Store referenced sources as literal data in the metadata output." + g_strYulDialect.c_str(), + po::value()->value_name(boost::join(g_yulDialectArgs, ",")), + "Input dialect to use in assembly or yul mode." ) + ; + desc.add(assemblyModeOptions); + + po::options_description linkerModeOptions("Linker Mode Options"); + linkerModeOptions.add_options() ( - g_argAllowPaths.c_str(), - po::value()->value_name("path(s)"), - "Allow a given path for imports. A list of paths can be supplied by separating them with a comma." + g_argLibraries.c_str(), + po::value>()->value_name("libs"), + "Direct string or file containing library addresses. Syntax: " + ":
[, or whitespace] ...\n" + "Address is interpreted as a hex string optionally prefixed by 0x." ) + ; + desc.add(linkerModeOptions); + + po::options_description outputFormatting("Output Formatting"); + outputFormatting.add_options() ( - g_argBasePath.c_str(), - po::value()->value_name("path"), - "Use the given path as the root of the source tree instead of the root of the filesystem." + g_argPrettyJson.c_str(), + "Output JSON in pretty format. Currently it only works with the combined JSON output." ) ( g_argColor.c_str(), @@ -861,19 +880,64 @@ Allowed options)").c_str(), g_argOldReporter.c_str(), "Enables old diagnostics reporter." ) + ; + desc.add(outputFormatting); + + po::options_description outputComponents("Output Components"); + outputComponents.add_options() + (g_argAstJson.c_str(), "AST of all source files in JSON format.") + (g_argAstCompactJson.c_str(), "AST of all source files in a compact JSON format.") + (g_argAsm.c_str(), "EVM assembly of the contracts.") + (g_argAsmJson.c_str(), "EVM assembly of the contracts in JSON format.") + (g_argOpcodes.c_str(), "Opcodes of the contracts.") + (g_argBinary.c_str(), "Binary of the contracts in hex.") + (g_argBinaryRuntime.c_str(), "Binary of the runtime part of the contracts in hex.") + (g_argAbi.c_str(), "ABI specification of the contracts.") + (g_argIR.c_str(), "Intermediate Representation (IR) of all contracts (EXPERIMENTAL).") + (g_argIROptimized.c_str(), "Optimized intermediate Representation (IR) of all contracts (EXPERIMENTAL).") + (g_argEwasm.c_str(), "Ewasm text representation of all contracts (EXPERIMENTAL).") + (g_argSignatureHashes.c_str(), "Function signature hashes of the contracts.") + (g_argNatspecUser.c_str(), "Natspec user documentation of all contracts.") + (g_argNatspecDev.c_str(), "Natspec developer documentation of all contracts.") + (g_argMetadata.c_str(), "Combined Metadata JSON whose Swarm hash is stored on-chain.") + (g_argStorageLayout.c_str(), "Slots, offsets and types of the contract's state variables.") + ; + desc.add(outputComponents); + + po::options_description extraOutput("Extra Output"); + extraOutput.add_options() ( - g_argErrorRecovery.c_str(), - "Enables additional parser error recovery." + g_argGas.c_str(), + "Print an estimate of the maximal gas usage for each function." ) ( - g_argIgnoreMissingFiles.c_str(), - "Ignore missing files." + g_argCombinedJson.c_str(), + po::value()->value_name(boost::join(g_combinedJsonArgs, ",")), + "Output a single json document containing the specified information." + ) + ; + desc.add(extraOutput); + + po::options_description metadataOptions("Metadata Options"); + metadataOptions.add_options() + ( + g_argMetadataHash.c_str(), + po::value()->value_name(boost::join(g_metadataHashArgs, ",")), + "Choose hash method for the bytecode metadata or disable it." + ) + ( + g_argMetadataLiteral.c_str(), + "Store referenced sources as literal data in the metadata output." ) ; - po::options_description optimizerOptions("Optimizer options"); + desc.add(metadataOptions); + po::options_description optimizerOptions("Optimizer Options"); optimizerOptions.add_options() - (g_argOptimize.c_str(), "Enable bytecode optimizer.") + ( + g_argOptimize.c_str(), + "Enable bytecode optimizer." + ) ( g_argOptimizeRuns.c_str(), po::value()->value_name("n")->default_value(200), @@ -896,27 +960,6 @@ Allowed options)").c_str(), ; desc.add(optimizerOptions); - po::options_description outputComponents("Output Components"); - outputComponents.add_options() - (g_argAstJson.c_str(), "AST of all source files in JSON format.") - (g_argAstCompactJson.c_str(), "AST of all source files in a compact JSON format.") - (g_argAsm.c_str(), "EVM assembly of the contracts.") - (g_argAsmJson.c_str(), "EVM assembly of the contracts in JSON format.") - (g_argOpcodes.c_str(), "Opcodes of the contracts.") - (g_argBinary.c_str(), "Binary of the contracts in hex.") - (g_argBinaryRuntime.c_str(), "Binary of the runtime part of the contracts in hex.") - (g_argAbi.c_str(), "ABI specification of the contracts.") - (g_argIR.c_str(), "Intermediate Representation (IR) of all contracts (EXPERIMENTAL).") - (g_argIROptimized.c_str(), "Optimized intermediate Representation (IR) of all contracts (EXPERIMENTAL).") - (g_argEwasm.c_str(), "Ewasm text representation of all contracts (EXPERIMENTAL).") - (g_argSignatureHashes.c_str(), "Function signature hashes of the contracts.") - (g_argNatspecUser.c_str(), "Natspec user documentation of all contracts.") - (g_argNatspecDev.c_str(), "Natspec developer documentation of all contracts.") - (g_argMetadata.c_str(), "Combined Metadata JSON whose Swarm hash is stored on-chain.") - (g_argStorageLayout.c_str(), "Slots, offsets and types of the contract's state variables.") - ; - desc.add(outputComponents); - po::options_description allOptions = desc; allOptions.add_options()(g_argInputFile.c_str(), po::value>(), "input file"); From d303bb24f008f48ee13c8131ee792c196ca7ede1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 6 Jun 2020 00:27:43 +0200 Subject: [PATCH 196/479] CommandLineInterface: Add a note that --old-reporter is a legacy option --- solc/CommandLineInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 3d507c8a593d..e84ce6dd325b 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -878,7 +878,7 @@ General Information)").c_str(), ) ( g_argOldReporter.c_str(), - "Enables old diagnostics reporter." + "Enables old diagnostics reporter (legacy option, will be removed)." ) ; desc.add(outputFormatting); From 3841b2626b84c21872db06de00150a89fa54a92a Mon Sep 17 00:00:00 2001 From: Igor Line Date: Sat, 6 Jun 2020 16:57:26 +0200 Subject: [PATCH 197/479] Fix semantic urls for function and modifier overriding in documentation --- docs/contracts/inheritance.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index 83ccdf773bcc..07bb7463698e 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -194,10 +194,10 @@ not known in the context of the class where it is used, although its type is known. This is similar for ordinary virtual method lookup. -.. _function-overriding: - .. index:: ! overriding;function +.. _function-overriding: + Function Overriding =================== @@ -317,10 +317,10 @@ of the variable: While public state variables can override external functions, they themselves cannot be overridden. -.. _modifier-overriding: - .. index:: ! overriding;modifier +.. _modifier-overriding: + Modifier Overriding =================== From 2c31a5d15d667c185347b8bc1e7f48bda0417b51 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Sat, 6 Jun 2020 23:06:30 +0300 Subject: [PATCH 198/479] docs: add note about initialisation in 060-breaking-changes --- docs/060-breaking-changes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index 1a131a2c83ec..1d85e07f33eb 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -42,7 +42,8 @@ For most of the topics the compiler will provide suggestions. storage arrays. * The new keyword ``abstract`` can be used to mark contracts as abstract. It has to be used - if a contract does not implement all its functions. + if a contract does not implement all its functions. Abstract contracts cannot be initialised and solidity outputs no + no bytecode when compiling them. * Libraries have to implement all their functions, not only the internal ones. From f49e2424b23b924e41ca3efc2cf9b94dbc79f52b Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 5 Jun 2020 14:54:52 +0200 Subject: [PATCH 199/479] [SMTChecker] Erase knowledge when array variable is pushed --- libsolidity/formal/SMTEncoder.cpp | 71 ++++++++++--------- libsolidity/formal/SMTEncoder.h | 3 + .../push_storage_ref_unsafe_length.sol | 23 ++++++ 3 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index ea8aba1cc3d2..b9c43f2c5d94 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1001,38 +1001,7 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smtutil::Expressi solAssert(varDecl, ""); if (varDecl->hasReferenceOrMappingType()) - m_context.resetVariables([&](VariableDeclaration const& _var) { - if (_var == *varDecl) - return false; - - // If both are state variables no need to clear knowledge. - if (_var.isStateVariable() && varDecl->isStateVariable()) - return false; - - TypePointer prefix = _var.type(); - TypePointer originalType = typeWithoutPointer(varDecl->type()); - while ( - prefix->category() == Type::Category::Mapping || - prefix->category() == Type::Category::Array - ) - { - if (*originalType == *typeWithoutPointer(prefix)) - return true; - if (prefix->category() == Type::Category::Mapping) - { - auto mapPrefix = dynamic_cast(prefix); - solAssert(mapPrefix, ""); - prefix = mapPrefix->valueType(); - } - else - { - auto arrayPrefix = dynamic_cast(prefix); - solAssert(arrayPrefix, ""); - prefix = arrayPrefix->baseType(); - } - } - return false; - }); + resetReferences(*varDecl); auto symbArray = dynamic_pointer_cast(m_context.variable(*varDecl)); smtutil::Expression store = smtutil::Expression::store( @@ -1138,6 +1107,8 @@ void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression { auto varDecl = identifierToVariable(*id); solAssert(varDecl, ""); + if (varDecl->hasReferenceOrMappingType()) + resetReferences(*varDecl); m_context.addAssertion(m_context.newValue(*varDecl) == _array); } else if (auto const* indexAccess = dynamic_cast(&_expr)) @@ -1641,6 +1612,42 @@ void SMTEncoder::resetStateVariables() m_context.resetVariables([&](VariableDeclaration const& _variable) { return _variable.isStateVariable(); }); } +void SMTEncoder::resetReferences(VariableDeclaration const& _varDecl) +{ + m_context.resetVariables([&](VariableDeclaration const& _var) { + if (_var == _varDecl) + return false; + + // If both are state variables no need to clear knowledge. + if (_var.isStateVariable() && _varDecl.isStateVariable()) + return false; + + TypePointer prefix = _var.type(); + TypePointer originalType = typeWithoutPointer(_varDecl.type()); + while ( + prefix->category() == Type::Category::Mapping || + prefix->category() == Type::Category::Array + ) + { + if (*originalType == *typeWithoutPointer(prefix)) + return true; + if (prefix->category() == Type::Category::Mapping) + { + auto mapPrefix = dynamic_cast(prefix); + solAssert(mapPrefix, ""); + prefix = mapPrefix->valueType(); + } + else + { + auto arrayPrefix = dynamic_cast(prefix); + solAssert(arrayPrefix, ""); + prefix = arrayPrefix->baseType(); + } + } + return false; + }); +} + TypePointer SMTEncoder::typeWithoutPointer(TypePointer const& _type) { if (auto refType = dynamic_cast(_type)) diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index d909255713cb..824d39b34a15 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -183,6 +183,9 @@ class SMTEncoder: public ASTConstVisitor void initializeLocalVariables(FunctionDefinition const& _function); void initializeFunctionCallParameters(CallableDeclaration const& _function, std::vector const& _callArgs); void resetStateVariables(); + /// Resets all references/pointers that have the same type or have + /// a subexpression of the same type as _varDecl. + void resetReferences(VariableDeclaration const& _varDecl); /// @returns the type without storage pointer information if it has it. TypePointer typeWithoutPointer(TypePointer const& _type); diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol new file mode 100644 index 000000000000..70f8cb9fc51a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol @@ -0,0 +1,23 @@ +pragma experimental SMTChecker; + +contract C { + uint[][] a; + uint[][][] c; + uint[] d; + function f() public { + a.push(); + uint[] storage b = a[0]; + c[0][0][0] = 12; + d[5] = 7; + b.push(8); + assert(a[0].length == 0); + // Safe but knowledge about `c` is erased because `b` could be pointing to `c[x][y]`. + assert(c[0][0][0] == 12); + // Safe but knowledge about `d` is erased because `b` could be pointing to `d`. + assert(d[5] == 7); + } +} +// ---- +// Warning: (193-217): Assertion violation happens here +// Warning: (309-333): Assertion violation happens here +// Warning: (419-436): Assertion violation happens here From acbe7a947b835fac861b7c472ac0ff63fa6d875e Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 8 Jun 2020 10:23:57 +0200 Subject: [PATCH 200/479] Changelog entry --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 05bc998242b5..cc216d0ba562 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Compiler Features: Bugfixes: * SMTChecker: Fix internal error when encoding tuples of tuples. + * SMTChecker: Fix aliasing soundness after pushing to an array pointer. ### 0.6.9 (2020-06-04) From 2af45c62c83df3ce893549a1d940f98d767648d0 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 8 Jun 2020 16:46:55 +0200 Subject: [PATCH 201/479] [Yul] Removed now disabled pc() from wasm backend. --- libyul/backends/wasm/EVMToEwasmTranslator.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.cpp b/libyul/backends/wasm/EVMToEwasmTranslator.cpp index ebcdd961b98c..59b3baf4e0b9 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.cpp +++ b/libyul/backends/wasm/EVMToEwasmTranslator.cpp @@ -1023,11 +1023,6 @@ function sstore(x1, x2, x3, x4, y1, y2, y3, y4) { eth.storageStore(0:i32, 32:i32) } -// Needed? -function pc() -> z1, z2, z3, z4 { - // TODO implement - unreachable() -} function gas() -> z1, z2, z3, z4 { z4 := eth.getGasLeft() } From 91f4ae12a968defabd4b4a19811108b5338f007d Mon Sep 17 00:00:00 2001 From: ethers <6937903+ethers@users.noreply.github.com> Date: Mon, 8 Jun 2020 19:16:24 -0700 Subject: [PATCH 202/479] remove SHA-3 as Keccak-256 is clearer Reduce confusion as Keccak-256 is clear enough --- docs/abi-spec.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst index 1d3e8efd08c6..ccb76b37cb76 100644 --- a/docs/abi-spec.rst +++ b/docs/abi-spec.rst @@ -24,7 +24,7 @@ Function Selector ================= The first four bytes of the call data for a function call specifies the function to be called. It is the -first (left, high-order in big-endian) four bytes of the Keccak-256 (SHA-3) hash of the signature of +first (left, high-order in big-endian) four bytes of the Keccak-256 hash of the signature of the function. The signature is defined as the canonical expression of the basic prototype without data location specifier, i.e. the function name with the parenthesised list of parameter types. Parameter types are split by a single From 2724ce9511207be80d1a30096fbcac4248e16865 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 4 Jun 2020 10:49:05 +0200 Subject: [PATCH 203/479] Index access to fixed bytes and byte arrays. --- .../codegen/ir/IRGeneratorForStatements.cpp | 20 +++++++++++++++++-- .../semanticTests/array/index_access.sol | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/array/index_access.sol diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 075cad1f32a8..a62251ab150a 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1730,7 +1730,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) setLValue(_indexAccess, IRLValue{ *arrayType.baseType(), - IRLValue::Memory{memAddress} + IRLValue::Memory{memAddress, arrayType.isByteArray()} }); break; } @@ -1763,7 +1763,23 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) } } else if (baseType.category() == Type::Category::FixedBytes) - solUnimplementedAssert(false, ""); + { + auto const& fixedBytesType = dynamic_cast(baseType); + solAssert(_indexAccess.indexExpression(), "Index expression expected."); + + IRVariable index{m_context.newYulVariable(), *TypeProvider::uint256()}; + define(index, *_indexAccess.indexExpression()); + m_code << Whiskers(R"( + if iszero(lt(, )) { invalid() } + let := (byte(, )) + )") + ("index", index.name()) + ("length", to_string(fixedBytesType.numBytes())) + ("array", IRVariable(_indexAccess.baseExpression()).name()) + ("shl248", m_utils.shiftLeftFunction(256 - 8)) + ("result", IRVariable(_indexAccess).name()) + .render(); + } else if (baseType.category() == Type::Category::TypeType) { solAssert(baseType.sizeOnStack() == 0, ""); diff --git a/test/libsolidity/semanticTests/array/index_access.sol b/test/libsolidity/semanticTests/array/index_access.sol new file mode 100644 index 000000000000..acb33fc46b2f --- /dev/null +++ b/test/libsolidity/semanticTests/array/index_access.sol @@ -0,0 +1,20 @@ +contract C { + function to_little_endian_64(uint64 value) public pure returns (bytes memory ret) { + ret = new bytes(8); + bytes8 bytesValue = bytes8(value); + // Byteswapping during copying to bytes. + ret[0] = bytesValue[7]; + ret[1] = bytesValue[6]; + ret[2] = bytesValue[5]; + ret[3] = bytesValue[4]; + ret[4] = bytesValue[3]; + ret[5] = bytesValue[2]; + ret[6] = bytesValue[1]; + ret[7] = bytesValue[0]; + } +} +// ==== +// compileViaYul: also +// ---- +// to_little_endian_64(uint64): 0 -> 0x20, 8, 0x00 +// to_little_endian_64(uint64): 0x0102030405060708 -> 0x20, 8, 0x0807060504030201000000000000000000000000000000000000000000000000 From 970b69cf3eb5eca37384dca4817ea04b9c3a96b6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 11:21:18 +0200 Subject: [PATCH 204/479] Change wording with regards to creation or initialisation. --- docs/060-breaking-changes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index 1d85e07f33eb..3173bca69da7 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -42,8 +42,8 @@ For most of the topics the compiler will provide suggestions. storage arrays. * The new keyword ``abstract`` can be used to mark contracts as abstract. It has to be used - if a contract does not implement all its functions. Abstract contracts cannot be initialised and solidity outputs no - no bytecode when compiling them. + if a contract does not implement all its functions. Abstract contracts cannot be created using the ``new`` operator, + and it is not possible to generate bytecode for them during compilation. * Libraries have to implement all their functions, not only the internal ones. From 30235e79c07717a7a59211e15ed1459ef00ee0a6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 11:52:10 +0200 Subject: [PATCH 205/479] Update release checklist. --- ReleaseChecklist.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ReleaseChecklist.md b/ReleaseChecklist.md index b6422654e171..5c68f54d9b9f 100644 --- a/ReleaseChecklist.md +++ b/ReleaseChecklist.md @@ -6,9 +6,8 @@ - [ ] Readthedocs account, access to the Solidity project - [ ] Write access to https://github.com/ethereum/homebrew-ethereum -### Pre-release - - [ ] Ensure that a Github project exists for the release. - - [ ] Check that all issues and pull requests from the Github project to be released are merged to ``develop``. +### Blog Post + - [ ] Create a post on https://github.com/ethereum/solidity-blog and exlpain some of the new features or concepts. ### Changelog - [ ] Sort the changelog entries alphabetically and correct any errors you notice. @@ -33,8 +32,9 @@ - [ ] Wait for the ``~ethereum/ubuntu/ethereum-static`` PPA build to be finished and published for *all platforms*. SERIOUSLY: DO NOT PROCEED EARLIER!!! *After* the static builds are *published*, copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` and ``Xenial`` while selecting ``Copy existing binaries``. - [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh v0.x.x``). -### Homebrew +### Homebrew and MacOS - [ ] Update the version and the hash (``sha256sum solidity_x.x.x.tar.gz``) in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb + - [ ] Take the binary from the ``b_osx`` run of the released commit in circle-ci and add it to the release page as ``solc-macos``. ### Documentation - [ ] Build the new version on https://readthedocs.org/projects/solidity/ (select `latest` on the bottom of the page and click `BUILD`) From 73e634924e4ce4ea041c070e760fd2221f1094f9 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Wed, 13 May 2020 20:43:05 +0530 Subject: [PATCH 206/479] Warn on YUL switch statement with only default statement --- libyul/AsmAnalysis.cpp | 7 +++++++ .../assembly/switch_declaration_fine.sol | 1 + .../controlFlow/storageReturn/assembly/switch_fine.sol | 1 + 3 files changed, 9 insertions(+) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 256d2ac387d2..30a4cb2a343e 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -359,6 +359,13 @@ void AsmAnalyzer::operator()(Switch const& _switch) { yulAssert(_switch.expression, ""); + if (_switch.cases.size() == 1 && !_switch.cases[0].value) + m_errorReporter.warning( + 1878_error, + _switch.location, + "\"switch\" statement with only a default case." + ); + YulString valueType = expectExpression(*_switch.expression); set cases; diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol index d723109244a6..d1d09fc985b9 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol @@ -29,3 +29,4 @@ contract C { } } // ---- +// Warning: (141-190): "switch" statement with only a default case. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol index 9e73ecff1fc5..dfe6287a707c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol @@ -23,3 +23,4 @@ contract C { } } // ---- +// Warning: (142-191): "switch" statement with only a default case. From 5837aa6214e7c7d2d330b4a25f4d8e20e1d4226e Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 13:01:35 +0200 Subject: [PATCH 207/479] Update ReleaseChecklist.md Co-authored-by: Leonardo --- ReleaseChecklist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReleaseChecklist.md b/ReleaseChecklist.md index 5c68f54d9b9f..116b3dbe9e39 100644 --- a/ReleaseChecklist.md +++ b/ReleaseChecklist.md @@ -7,7 +7,7 @@ - [ ] Write access to https://github.com/ethereum/homebrew-ethereum ### Blog Post - - [ ] Create a post on https://github.com/ethereum/solidity-blog and exlpain some of the new features or concepts. + - [ ] Create a post on https://github.com/ethereum/solidity-blog and explain some of the new features or concepts. ### Changelog - [ ] Sort the changelog entries alphabetically and correct any errors you notice. From d8263d331e892b198367bdcb1438c7c9012553c3 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Wed, 27 May 2020 20:00:48 +0530 Subject: [PATCH 208/479] Ignore warnings for yulOptimizer tests --- Changelog.md | 1 + libyul/AsmAnalysis.cpp | 2 +- .../ASTJSON/assembly/switch_default.json | 36 ++++++++++++++----- .../ASTJSON/assembly/switch_default.sol | 2 +- .../assembly/switch_default_legacy.json | 12 +++---- test/libsolidity/InlineAssembly.cpp | 14 ++++++-- .../assembly/switch_declaration_fine.sol | 13 ++----- .../storageReturn/assembly/switch_fine.sol | 11 ++---- .../assembly/switch_only_default_warn.sol | 12 +++++++ test/libyul/Common.cpp | 4 +-- test/libyul/Metrics.cpp | 2 +- test/libyul/YulOptimizerTest.cpp | 2 +- 12 files changed, 67 insertions(+), 44 deletions(-) create mode 100644 test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol diff --git a/Changelog.md b/Changelog.md index cc216d0ba562..5da6cb372451 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Language Features: Compiler Features: + * Yul: Raise warning for switch statements that only have a default and no other cases. Bugfixes: diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 30a4cb2a343e..eee3beacbb1c 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -361,7 +361,7 @@ void AsmAnalyzer::operator()(Switch const& _switch) if (_switch.cases.size() == 1 && !_switch.cases[0].value) m_errorReporter.warning( - 1878_error, + 9592_error, _switch.location, "\"switch\" statement with only a default case." ); diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.json b/test/libsolidity/ASTJSON/assembly/switch_default.json index 2f15a82c5536..3a6c7186477c 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default.json @@ -33,14 +33,14 @@ { "id": 4, "nodeType": "Block", - "src": "42:48:1", + "src": "42:58:1", "statements": [ { "AST": { "nodeType": "YulBlock", - "src": "61:23:1", + "src": "61:33:1", "statements": [ { @@ -50,11 +50,29 @@ "body": { "nodeType": "YulBlock", - "src": "80:2:1", + "src": "79:2:1", "statements": [] }, "nodeType": "YulCase", - "src": "72:10:1", + "src": "72:9:1", + "value": + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "77:1:1", + "type": "", + "value": "0" + } + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "90:2:1", + "statements": [] + }, + "nodeType": "YulCase", + "src": "82:10:1", "value": "default" } ], @@ -67,7 +85,7 @@ "value": "0" }, "nodeType": "YulSwitch", - "src": "63:19:1" + "src": "63:29:1" } ] }, @@ -75,7 +93,7 @@ "externalReferences": [], "id": 3, "nodeType": "InlineAssembly", - "src": "52:32:1" + "src": "52:42:1" } ] }, @@ -103,15 +121,15 @@ "src": "42:0:1" }, "scope": 6, - "src": "17:73:1", + "src": "17:83:1", "stateMutability": "view", "virtual": false, "visibility": "public" } ], "scope": 7, - "src": "0:92:1" + "src": "0:102:1" } ], - "src": "0:93:1" + "src": "0:103:1" } diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.sol b/test/libsolidity/ASTJSON/assembly/switch_default.sol index 8bfba2c11568..1f61896fe275 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.sol +++ b/test/libsolidity/ASTJSON/assembly/switch_default.sol @@ -1,6 +1,6 @@ contract C { function g() view public { - assembly { switch 0 default {} } + assembly { switch 0 case 0 {} default {} } } } diff --git a/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json b/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json index 18e7c860c17d..3b79ccf44182 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default_legacy.json @@ -95,30 +95,30 @@ [ null ], - "operations": "{\n switch 0\n default { }\n}" + "operations": "{\n switch 0\n case 0 { }\n default { }\n}" }, "children": [], "id": 3, "name": "InlineAssembly", - "src": "52:32:1" + "src": "52:42:1" } ], "id": 4, "name": "Block", - "src": "42:48:1" + "src": "42:58:1" } ], "id": 5, "name": "FunctionDefinition", - "src": "17:73:1" + "src": "17:83:1" } ], "id": 6, "name": "ContractDefinition", - "src": "0:92:1" + "src": "0:102:1" } ], "id": 7, "name": "SourceUnit", - "src": "0:93:1" + "src": "0:103:1" } diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 2a1b72e500da..1d61484a9c48 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -314,9 +314,17 @@ BOOST_AUTO_TEST_CASE(switch_duplicate_case) BOOST_AUTO_TEST_CASE(switch_invalid_expression) { - CHECK_PARSE_ERROR("{ switch {} default {} }", ParserError, "Literal or identifier expected."); - CHECK_PARSE_ERROR("{ switch mload default {} }", ParserError, "Expected '(' but got reserved keyword 'default'"); - CHECK_PARSE_ERROR("{ switch mstore(1, 1) default {} }", TypeError, "Expected expression to evaluate to one value, but got 0 values instead."); + CHECK_PARSE_ERROR("{ switch {} case 1 {} default {} }", ParserError, "Literal or identifier expected."); + CHECK_PARSE_ERROR( + "{ switch mload case 1 {} default {} }", + ParserError, + "Expected '(' but got reserved keyword 'case'" + ); + CHECK_PARSE_ERROR( + "{ switch mstore(1, 1) case 1 {} default {} }", + TypeError, + "Expected expression to evaluate to one value, but got 0 values instead." + ); } BOOST_AUTO_TEST_CASE(switch_default_before_case) diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol index d1d09fc985b9..a32599d7bc1d 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol @@ -1,15 +1,7 @@ contract C { struct S { bool f; } S s; - function f(uint256 a) internal pure { - S storage c; - assembly { - switch a - default { c_slot := s_slot } - } - c; - } - function g(bool flag) internal pure { + function f(bool flag) internal pure { S storage c; assembly { switch flag @@ -18,7 +10,7 @@ contract C { } c; } - function h(uint256 a) internal pure { + function g(uint256 a) internal pure { S storage c; assembly { switch a @@ -29,4 +21,3 @@ contract C { } } // ---- -// Warning: (141-190): "switch" statement with only a default case. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol index dfe6287a707c..8d0b564fcfa3 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol @@ -1,20 +1,14 @@ contract C { struct S { bool f; } S s; - function f(uint256 a) internal pure returns (S storage c) { - assembly { - switch a - default { c_slot := s_slot } - } - } - function g(bool flag) internal pure returns (S storage c) { + function f(bool flag) internal pure returns (S storage c) { assembly { switch flag case 0 { c_slot := s_slot } default { c_slot := s_slot } } } - function h(uint256 a) internal pure returns (S storage c) { + function g(uint256 a) internal pure returns (S storage c) { assembly { switch a case 0 { revert(0, 0) } @@ -23,4 +17,3 @@ contract C { } } // ---- -// Warning: (142-191): "switch" statement with only a default case. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol new file mode 100644 index 000000000000..fff82c20d869 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol @@ -0,0 +1,12 @@ +contract C { + struct S { bool f; } + S s; + function f(uint256 a) internal pure returns (S storage c) { + assembly { + switch a + default { c_slot := s_slot } + } + } +} +// ---- +// Warning: (142-195): "switch" statement with only a default case. diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index ee6d77dab750..57ee7ffa619b 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -87,12 +87,12 @@ pair, shared_ptr> yul::test::parse( shared_ptr parserResult = yul::ObjectParser(errorReporter, _dialect).parse(scanner, false); if (!parserResult) return {}; - if (!parserResult->code || !errorReporter.errors().empty()) + if (!parserResult->code || errorReporter.hasErrors()) return {}; shared_ptr analysisInfo = make_shared(); AsmAnalyzer analyzer(*analysisInfo, errorReporter, _dialect, {}, parserResult->dataNames()); // TODO this should be done recursively. - if (!analyzer.analyze(*parserResult->code) || !errorReporter.errors().empty()) + if (!analyzer.analyze(*parserResult->code) || errorReporter.hasErrors()) return {}; return {std::move(parserResult->code), std::move(analysisInfo)}; } diff --git a/test/libyul/Metrics.cpp b/test/libyul/Metrics.cpp index 2d1cc1c4ec75..7ae9e44f5b00 100644 --- a/test/libyul/Metrics.cpp +++ b/test/libyul/Metrics.cpp @@ -332,7 +332,7 @@ BOOST_FIXTURE_TEST_CASE(if_statement_custom_weights, CustomWeightFixture) BOOST_AUTO_TEST_CASE(switch_statement_tiny) { BOOST_CHECK_EQUAL(codeSize( - "{ switch calldatasize() default {} }" + "{ switch calldatasize() case 0 {} }" ), 4); } diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index bda7c6514e20..a4507e18031c 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -362,7 +362,7 @@ bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool c ErrorList errors; soltestAssert(m_dialect, ""); std::tie(m_ast, m_analysisInfo) = yul::test::parse(m_source, *m_dialect, errors); - if (!m_ast || !m_analysisInfo || !errors.empty()) + if (!m_ast || !m_analysisInfo || !Error::containsOnlyWarnings(errors)) { AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl; printErrors(_stream, errors); From 9cb7b8070be9aa25fd373b51bd9482c9c95f91fa Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 14:43:22 +0200 Subject: [PATCH 209/479] Grammar fixes. --- docs/Solidity.g4 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index a415c19f97ff..fdc80822bddd 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -124,7 +124,11 @@ userDefinedTypeName : identifier ( '.' identifier )* ; mapping - : 'mapping' '(' (elementaryTypeName | userDefinedTypeName) '=>' typeName ')' ; + : 'mapping' '(' mappingKey '=>' typeName ')' ; + +mappingKey + : elementaryTypeName + | userDefinedTypeName ; functionTypeName : 'function' parameterList modifierList returnParameters? ; @@ -470,7 +474,7 @@ SingleQuotedStringCharacter : ~['\r\n\\] | ('\\' .) ; VersionLiteral - : [0-9]+ '.' [0-9]+ ('.' [0-9]+)? ; + : [0-9]+ ( '.' [0-9]+ ('.' [0-9]+)? )? ; WS : [ \t\r\n\u000C]+ -> skip ; From 81f54a170b1c2db9c77d0f47783543bb6b597bf4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 3 Jun 2020 21:54:43 +0200 Subject: [PATCH 210/479] Cleanup from storage. --- .../getters/struct_with_bytes_simple.sol | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol diff --git a/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol b/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol new file mode 100644 index 000000000000..974ca9e809c7 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol @@ -0,0 +1,17 @@ +contract C { + struct S { + uint a; + bytes b; + mapping(uint => uint) c; + uint[] d; + } + uint shifter; + S public s; + constructor() public { + s.a = 7; + s.b = "abc"; + s.c[0] = 9; + } +} +// ---- +// s() -> 0x07, 0x40, 0x03, 0x6162630000000000000000000000000000000000000000000000000000000000 From 4b1ea93b415129d34b8e410905c9c56fbe19c6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 8 Jun 2020 20:04:37 +0200 Subject: [PATCH 211/479] wasm/BinaryTransform: Put code for enumerating globals/functions/types in separate functions --- libyul/backends/wasm/BinaryTransform.cpp | 69 +++++++++++++++++++----- libyul/backends/wasm/BinaryTransform.h | 10 +++- 2 files changed, 64 insertions(+), 15 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 1cf825dd4915..f8e5a74a7286 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -24,6 +24,7 @@ #include #include +#include using namespace std; using namespace solidity; @@ -254,19 +255,21 @@ bytes BinaryTransform::run(Module const& _module) { BinaryTransform bt; - for (size_t i = 0; i < _module.globals.size(); ++i) - bt.m_globals[_module.globals[i].variableName] = i; + map> const types = typeToFunctionMap(_module.imports, _module.functions); - size_t funID = 0; - for (FunctionImport const& fun: _module.imports) - bt.m_functions[fun.internalName] = funID++; - for (FunctionDefinition const& fun: _module.functions) - bt.m_functions[fun.name] = funID++; + bt.m_globals = enumerateGlobals(_module); + bt.m_functions = enumerateFunctions(_module); + bt.m_functionTypes = enumerateFunctionTypes(types); + + yulAssert(bt.m_globals.size() == _module.globals.size(), ""); + yulAssert(bt.m_functions.size() == _module.imports.size() + _module.functions.size(), ""); + yulAssert(bt.m_functionTypes.size() == bt.m_functions.size(), ""); + yulAssert(bt.m_functionTypes.size() >= types.size(), ""); bytes ret{0, 'a', 's', 'm'}; // version ret += bytes{1, 0, 0, 0}; - ret += bt.typeSection(_module.imports, _module.functions); + ret += bt.typeSection(types); ret += bt.importSection(_module.imports); ret += bt.functionSection(_module.functions); ret += bt.memorySection(); @@ -496,9 +499,9 @@ vector BinaryTransform::encodeTypes(vector const& _typeNames) return result; } -bytes BinaryTransform::typeSection( - vector const& _imports, - vector const& _functions +map> BinaryTransform::typeToFunctionMap( + vector const& _imports, + vector const& _functions ) { map> types; @@ -507,12 +510,50 @@ bytes BinaryTransform::typeSection( for (auto const& fun: _functions) types[typeOf(fun)].emplace_back(fun.name); + return types; +} + +map BinaryTransform::enumerateGlobals(Module const& _module) +{ + map globals; + for (size_t i = 0; i < _module.globals.size(); ++i) + globals[_module.globals[i].variableName] = i; + + return globals; +} + +map BinaryTransform::enumerateFunctions(Module const& _module) +{ + map functions; + size_t funID = 0; + for (FunctionImport const& fun: _module.imports) + functions[fun.internalName] = funID++; + for (FunctionDefinition const& fun: _module.functions) + functions[fun.name] = funID++; + + return functions; +} + +map BinaryTransform::enumerateFunctionTypes(map> const& _typeToFunctionMap) +{ + map functionTypes; + size_t typeID = 0; + for (vector const& funNames: _typeToFunctionMap | boost::adaptors::map_values) + { + for (string const& name: funNames) + functionTypes[name] = typeID; + ++typeID; + } + + return functionTypes; +} + +bytes BinaryTransform::typeSection(map> const& _typeToFunctionMap) +{ bytes result; size_t index = 0; - for (auto const& [type, funNames]: types) + for (Type const& type: _typeToFunctionMap | boost::adaptors::map_keys) { - for (string const& name: funNames) - m_functionTypes[name] = index; result += toBytes(ValueType::Function); result += lebEncode(type.first.size()) + type.first; result += lebEncode(type.second.size()) + type.second; diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index c1c924dccb64..bfae97cb08b7 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -61,11 +61,19 @@ class BinaryTransform static uint8_t encodeType(std::string const& _typeName); static std::vector encodeTypes(std::vector const& _typeNames); - bytes typeSection( + + static std::map> typeToFunctionMap( std::vector const& _imports, std::vector const& _functions ); + static std::map enumerateGlobals(Module const& _module); + static std::map enumerateFunctions(Module const& _module); + static std::map enumerateFunctionTypes( + std::map> const& _typeToFunctionMap + ); + + bytes typeSection(std::map> const& _typeToFunctionMap); bytes importSection(std::vector const& _imports); bytes functionSection(std::vector const& _functions); bytes memorySection(); From adbd4be1514b32511f5b3fa2856e42d2f91d019c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 8 Jun 2020 20:12:12 +0200 Subject: [PATCH 212/479] wasm/BinaryTransform: Make global/function/type maps constant --- libyul/backends/wasm/BinaryTransform.cpp | 12 ++++++------ libyul/backends/wasm/BinaryTransform.h | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index f8e5a74a7286..cee28d5e1a03 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -253,13 +253,13 @@ bytes makeSection(Section _section, bytes _data) bytes BinaryTransform::run(Module const& _module) { - BinaryTransform bt; - map> const types = typeToFunctionMap(_module.imports, _module.functions); - bt.m_globals = enumerateGlobals(_module); - bt.m_functions = enumerateFunctions(_module); - bt.m_functionTypes = enumerateFunctionTypes(types); + BinaryTransform bt( + enumerateGlobals(_module), + enumerateFunctions(_module), + enumerateFunctionTypes(types) + ); yulAssert(bt.m_globals.size() == _module.globals.size(), ""); yulAssert(bt.m_functions.size() == _module.imports.size() + _module.functions.size(), ""); @@ -576,7 +576,7 @@ bytes BinaryTransform::importSection( encodeName(import.module) + encodeName(import.externalName) + toBytes(importKind) + - lebEncode(m_functionTypes[import.internalName]); + lebEncode(m_functionTypes.at(import.internalName)); } return makeSection(Section::IMPORT, std::move(result)); } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index bfae97cb08b7..49950a23776b 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -55,6 +55,16 @@ class BinaryTransform bytes operator()(wasm::FunctionDefinition const& _function); private: + BinaryTransform( + std::map _globals, + std::map _functions, + std::map _functionTypes + ): + m_globals(std::move(_globals)), + m_functions(std::move(_functions)), + m_functionTypes(std::move(_functionTypes)) + {} + using Type = std::pair, std::vector>; static Type typeOf(wasm::FunctionImport const& _import); static Type typeOf(wasm::FunctionDefinition const& _funDef); @@ -89,10 +99,11 @@ class BinaryTransform static bytes encodeName(std::string const& _name); + std::map const m_globals; + std::map const m_functions; + std::map const m_functionTypes; + std::map m_locals; - std::map m_globals; - std::map m_functions; - std::map m_functionTypes; std::vector m_labels; std::map> m_subModulePosAndSize; }; From b2a8639c2094cadff5bfb14775159c748c7e25bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 8 Jun 2020 20:17:59 +0200 Subject: [PATCH 213/479] wasm/BinaryTransform: Make most of section generation stateless and pass global/function/type maps via parameters --- libyul/backends/wasm/BinaryTransform.cpp | 64 ++++++++++++++---------- libyul/backends/wasm/BinaryTransform.h | 28 +++++++---- 2 files changed, 56 insertions(+), 36 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index cee28d5e1a03..669701471929 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -255,34 +255,42 @@ bytes BinaryTransform::run(Module const& _module) { map> const types = typeToFunctionMap(_module.imports, _module.functions); - BinaryTransform bt( - enumerateGlobals(_module), - enumerateFunctions(_module), - enumerateFunctionTypes(types) - ); + map const globals = enumerateGlobals(_module); + map const functions = enumerateFunctions(_module); + map const functionTypes = enumerateFunctionTypes(types); - yulAssert(bt.m_globals.size() == _module.globals.size(), ""); - yulAssert(bt.m_functions.size() == _module.imports.size() + _module.functions.size(), ""); - yulAssert(bt.m_functionTypes.size() == bt.m_functions.size(), ""); - yulAssert(bt.m_functionTypes.size() >= types.size(), ""); + yulAssert(globals.size() == _module.globals.size(), ""); + yulAssert(functions.size() == _module.imports.size() + _module.functions.size(), ""); + yulAssert(functionTypes.size() == functions.size(), ""); + yulAssert(functionTypes.size() >= types.size(), ""); bytes ret{0, 'a', 's', 'm'}; // version ret += bytes{1, 0, 0, 0}; - ret += bt.typeSection(types); - ret += bt.importSection(_module.imports); - ret += bt.functionSection(_module.functions); - ret += bt.memorySection(); - ret += bt.globalSection(); - ret += bt.exportSection(); + ret += typeSection(types); + ret += importSection(_module.imports, functionTypes); + ret += functionSection(_module.functions, functionTypes); + ret += memorySection(); + ret += globalSection(_module.globals); + ret += exportSection(functions); + + map> subModulePosAndSize; for (auto const& sub: _module.subModules) { // TODO should we prefix and / or shorten the name? bytes data = BinaryTransform::run(sub.second); size_t length = data.size(); - ret += bt.customSection(sub.first, std::move(data)); - bt.m_subModulePosAndSize[sub.first] = {ret.size() - length, length}; + ret += customSection(sub.first, std::move(data)); + subModulePosAndSize[sub.first] = {ret.size() - length, length}; } + + BinaryTransform bt( + move(globals), + move(functions), + move(functionTypes), + move(subModulePosAndSize) + ); + ret += bt.codeSection(_module.functions); return ret; } @@ -565,7 +573,8 @@ bytes BinaryTransform::typeSection(map> co } bytes BinaryTransform::importSection( - vector const& _imports + vector const& _imports, + map const& _functionTypes ) { bytes result = lebEncode(_imports.size()); @@ -576,16 +585,19 @@ bytes BinaryTransform::importSection( encodeName(import.module) + encodeName(import.externalName) + toBytes(importKind) + - lebEncode(m_functionTypes.at(import.internalName)); + lebEncode(_functionTypes.at(import.internalName)); } return makeSection(Section::IMPORT, std::move(result)); } -bytes BinaryTransform::functionSection(vector const& _functions) +bytes BinaryTransform::functionSection( + vector const& _functions, + map const& _functionTypes +) { bytes result = lebEncode(_functions.size()); for (auto const& fun: _functions) - result += lebEncode(m_functionTypes.at(fun.name)); + result += lebEncode(_functionTypes.at(fun.name)); return makeSection(Section::FUNCTION, std::move(result)); } @@ -597,10 +609,10 @@ bytes BinaryTransform::memorySection() return makeSection(Section::MEMORY, std::move(result)); } -bytes BinaryTransform::globalSection() +bytes BinaryTransform::globalSection(vector const& _globals) { - bytes result = lebEncode(m_globals.size()); - for (size_t i = 0; i < m_globals.size(); ++i) + bytes result = lebEncode(_globals.size()); + for (size_t i = 0; i < _globals.size(); ++i) result += toBytes(ValueType::I64) + lebEncode(static_cast(Mutability::Var)) + @@ -611,11 +623,11 @@ bytes BinaryTransform::globalSection() return makeSection(Section::GLOBAL, std::move(result)); } -bytes BinaryTransform::exportSection() +bytes BinaryTransform::exportSection(map const& _functions) { bytes result = lebEncode(2); result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0); - result += encodeName("main") + toBytes(Export::Function) + lebEncode(m_functions.at("main")); + result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functions.at("main")); return makeSection(Section::EXPORT, std::move(result)); } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index 49950a23776b..58ced6a431e7 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -58,11 +58,13 @@ class BinaryTransform BinaryTransform( std::map _globals, std::map _functions, - std::map _functionTypes + std::map _functionTypes, + std::map> _subModulePosAndSize ): m_globals(std::move(_globals)), m_functions(std::move(_functions)), - m_functionTypes(std::move(_functionTypes)) + m_functionTypes(std::move(_functionTypes)), + m_subModulePosAndSize(std::move(_subModulePosAndSize)) {} using Type = std::pair, std::vector>; @@ -83,13 +85,19 @@ class BinaryTransform std::map> const& _typeToFunctionMap ); - bytes typeSection(std::map> const& _typeToFunctionMap); - bytes importSection(std::vector const& _imports); - bytes functionSection(std::vector const& _functions); - bytes memorySection(); - bytes globalSection(); - bytes exportSection(); - bytes customSection(std::string const& _name, bytes _data); + static bytes typeSection(std::map> const& _typeToFunctionMap); + static bytes importSection( + std::vector const& _imports, + std::map const& _functionTypes + ); + static bytes functionSection( + std::vector const& _functions, + std::map const& _functionTypes + ); + static bytes memorySection(); + static bytes globalSection(std::vector const& _globals); + static bytes exportSection(std::map const& _functions); + static bytes customSection(std::string const& _name, bytes _data); bytes codeSection(std::vector const& _functions); bytes visit(std::vector const& _expressions); @@ -102,10 +110,10 @@ class BinaryTransform std::map const m_globals; std::map const m_functions; std::map const m_functionTypes; + std::map> const m_subModulePosAndSize; std::map m_locals; std::vector m_labels; - std::map> m_subModulePosAndSize; }; } From b9ecccdece09f7cdb13c12d9cb23999c1c027326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 9 Jun 2020 17:13:19 +0200 Subject: [PATCH 214/479] wasm/BinaryTransform: Rename globals and functions to globalIDs and functionIDs --- libyul/backends/wasm/BinaryTransform.cpp | 26 ++++++++++++------------ libyul/backends/wasm/BinaryTransform.h | 14 ++++++------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 669701471929..660ddf44fb21 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -255,13 +255,13 @@ bytes BinaryTransform::run(Module const& _module) { map> const types = typeToFunctionMap(_module.imports, _module.functions); - map const globals = enumerateGlobals(_module); - map const functions = enumerateFunctions(_module); + map const globalIDs = enumerateGlobals(_module); + map const functionIDs = enumerateFunctions(_module); map const functionTypes = enumerateFunctionTypes(types); - yulAssert(globals.size() == _module.globals.size(), ""); - yulAssert(functions.size() == _module.imports.size() + _module.functions.size(), ""); - yulAssert(functionTypes.size() == functions.size(), ""); + yulAssert(globalIDs.size() == _module.globals.size(), ""); + yulAssert(functionIDs.size() == _module.imports.size() + _module.functions.size(), ""); + yulAssert(functionTypes.size() == functionIDs.size(), ""); yulAssert(functionTypes.size() >= types.size(), ""); bytes ret{0, 'a', 's', 'm'}; @@ -272,7 +272,7 @@ bytes BinaryTransform::run(Module const& _module) ret += functionSection(_module.functions, functionTypes); ret += memorySection(); ret += globalSection(_module.globals); - ret += exportSection(functions); + ret += exportSection(functionIDs); map> subModulePosAndSize; for (auto const& sub: _module.subModules) @@ -285,8 +285,8 @@ bytes BinaryTransform::run(Module const& _module) } BinaryTransform bt( - move(globals), - move(functions), + move(globalIDs), + move(functionIDs), move(functionTypes), move(subModulePosAndSize) ); @@ -313,7 +313,7 @@ bytes BinaryTransform::operator()(LocalVariable const& _variable) bytes BinaryTransform::operator()(GlobalVariable const& _variable) { - return toBytes(Opcode::GlobalGet) + lebEncode(m_globals.at(_variable.name)); + return toBytes(Opcode::GlobalGet) + lebEncode(m_globalIDs.at(_variable.name)); } bytes BinaryTransform::operator()(BuiltinCall const& _call) @@ -359,7 +359,7 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) bytes BinaryTransform::operator()(FunctionCall const& _call) { - return visit(_call.arguments) + toBytes(Opcode::Call) + lebEncode(m_functions.at(_call.functionName)); + return visit(_call.arguments) + toBytes(Opcode::Call) + lebEncode(m_functionIDs.at(_call.functionName)); } bytes BinaryTransform::operator()(LocalAssignment const& _assignment) @@ -375,7 +375,7 @@ bytes BinaryTransform::operator()(GlobalAssignment const& _assignment) return std::visit(*this, *_assignment.value) + toBytes(Opcode::GlobalSet) + - lebEncode(m_globals.at(_assignment.variableName)); + lebEncode(m_globalIDs.at(_assignment.variableName)); } bytes BinaryTransform::operator()(If const& _if) @@ -623,11 +623,11 @@ bytes BinaryTransform::globalSection(vector con return makeSection(Section::GLOBAL, std::move(result)); } -bytes BinaryTransform::exportSection(map const& _functions) +bytes BinaryTransform::exportSection(map const& _functionIDs) { bytes result = lebEncode(2); result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0); - result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functions.at("main")); + result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main")); return makeSection(Section::EXPORT, std::move(result)); } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index 58ced6a431e7..f4444b2fd45c 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -56,13 +56,13 @@ class BinaryTransform private: BinaryTransform( - std::map _globals, - std::map _functions, + std::map _globalIDs, + std::map _functionIDs, std::map _functionTypes, std::map> _subModulePosAndSize ): - m_globals(std::move(_globals)), - m_functions(std::move(_functions)), + m_globalIDs(std::move(_globalIDs)), + m_functionIDs(std::move(_functionIDs)), m_functionTypes(std::move(_functionTypes)), m_subModulePosAndSize(std::move(_subModulePosAndSize)) {} @@ -96,7 +96,7 @@ class BinaryTransform ); static bytes memorySection(); static bytes globalSection(std::vector const& _globals); - static bytes exportSection(std::map const& _functions); + static bytes exportSection(std::map const& _functionIDs); static bytes customSection(std::string const& _name, bytes _data); bytes codeSection(std::vector const& _functions); @@ -107,8 +107,8 @@ class BinaryTransform static bytes encodeName(std::string const& _name); - std::map const m_globals; - std::map const m_functions; + std::map const m_globalIDs; + std::map const m_functionIDs; std::map const m_functionTypes; std::map> const m_subModulePosAndSize; From edfbae0167459efce91a6cb001e917ca3456f950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 9 Jun 2020 17:34:32 +0200 Subject: [PATCH 215/479] was/BinaryTransform: Remove unnecessary std:: prefixes from the .cpp file --- libyul/backends/wasm/BinaryTransform.cpp | 36 ++++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 660ddf44fb21..ce97225e05dc 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -131,7 +131,7 @@ bytes toBytes(Opcode _o) return toBytes(uint8_t(_o)); } -static std::map const builtins = { +static map const builtins = { {"i32.load", 0x28}, {"i64.load", 0x29}, {"i32.load8_s", 0x2c}, @@ -241,12 +241,12 @@ bytes lebEncodeSigned(int64_t _n) bytes prefixSize(bytes _data) { size_t size = _data.size(); - return lebEncode(size) + std::move(_data); + return lebEncode(size) + move(_data); } bytes makeSection(Section _section, bytes _data) { - return toBytes(_section) + prefixSize(std::move(_data)); + return toBytes(_section) + prefixSize(move(_data)); } } @@ -280,7 +280,7 @@ bytes BinaryTransform::run(Module const& _module) // TODO should we prefix and / or shorten the name? bytes data = BinaryTransform::run(sub.second); size_t length = data.size(); - ret += customSection(sub.first, std::move(data)); + ret += customSection(sub.first, move(data)); subModulePosAndSize[sub.first] = {ret.size() - length, length}; } @@ -322,12 +322,12 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) // they are references to object names that should not end up in the code. if (_call.functionName == "dataoffset") { - string name = std::get(_call.arguments.at(0)).value; + string name = get(_call.arguments.at(0)).value; return toBytes(Opcode::I64Const) + lebEncodeSigned(m_subModulePosAndSize.at(name).first); } else if (_call.functionName == "datasize") { - string name = std::get(_call.arguments.at(0)).value; + string name = get(_call.arguments.at(0)).value; return toBytes(Opcode::I64Const) + lebEncodeSigned(m_subModulePosAndSize.at(name).second); } @@ -342,7 +342,7 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) else { yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found"); - bytes ret = std::move(args) + toBytes(builtins.at(_call.functionName)); + bytes ret = move(args) + toBytes(builtins.at(_call.functionName)); if ( _call.functionName.find(".load") != string::npos || _call.functionName.find(".store") != string::npos @@ -468,7 +468,7 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function) yulAssert(m_labels.empty(), "Stray labels."); - return prefixSize(std::move(ret)); + return prefixSize(move(ret)); } BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import) @@ -569,7 +569,7 @@ bytes BinaryTransform::typeSection(map> co index++; } - return makeSection(Section::TYPE, lebEncode(index) + std::move(result)); + return makeSection(Section::TYPE, lebEncode(index) + move(result)); } bytes BinaryTransform::importSection( @@ -587,7 +587,7 @@ bytes BinaryTransform::importSection( toBytes(importKind) + lebEncode(_functionTypes.at(import.internalName)); } - return makeSection(Section::IMPORT, std::move(result)); + return makeSection(Section::IMPORT, move(result)); } bytes BinaryTransform::functionSection( @@ -598,7 +598,7 @@ bytes BinaryTransform::functionSection( bytes result = lebEncode(_functions.size()); for (auto const& fun: _functions) result += lebEncode(_functionTypes.at(fun.name)); - return makeSection(Section::FUNCTION, std::move(result)); + return makeSection(Section::FUNCTION, move(result)); } bytes BinaryTransform::memorySection() @@ -606,7 +606,7 @@ bytes BinaryTransform::memorySection() bytes result = lebEncode(1); result.push_back(static_cast(LimitsKind::Min)); result.push_back(1); // initial length - return makeSection(Section::MEMORY, std::move(result)); + return makeSection(Section::MEMORY, move(result)); } bytes BinaryTransform::globalSection(vector const& _globals) @@ -620,7 +620,7 @@ bytes BinaryTransform::globalSection(vector con lebEncodeSigned(0) + toBytes(Opcode::End); - return makeSection(Section::GLOBAL, std::move(result)); + return makeSection(Section::GLOBAL, move(result)); } bytes BinaryTransform::exportSection(map const& _functionIDs) @@ -628,13 +628,13 @@ bytes BinaryTransform::exportSection(map const& _functionIDs) bytes result = lebEncode(2); result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0); result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main")); - return makeSection(Section::EXPORT, std::move(result)); + return makeSection(Section::EXPORT, move(result)); } bytes BinaryTransform::customSection(string const& _name, bytes _data) { - bytes result = encodeName(_name) + std::move(_data); - return makeSection(Section::CUSTOM, std::move(result)); + bytes result = encodeName(_name) + move(_data); + return makeSection(Section::CUSTOM, move(result)); } bytes BinaryTransform::codeSection(vector const& _functions) @@ -642,7 +642,7 @@ bytes BinaryTransform::codeSection(vector const& _func bytes result = lebEncode(_functions.size()); for (FunctionDefinition const& fun: _functions) result += (*this)(fun); - return makeSection(Section::CODE, std::move(result)); + return makeSection(Section::CODE, move(result)); } bytes BinaryTransform::visit(vector const& _expressions) @@ -673,7 +673,7 @@ bytes BinaryTransform::encodeLabelIdx(string const& _label) const yulAssert(false, "Label not found."); } -bytes BinaryTransform::encodeName(std::string const& _name) +bytes BinaryTransform::encodeName(string const& _name) { // UTF-8 is allowed here by the Wasm spec, but since all names here should stem from // Solidity or Yul identifiers or similar, non-ascii characters ending up here From e5c19d8a2cd5d1614381f31a69a22d4293e0c180 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 17:56:58 +0200 Subject: [PATCH 216/479] Replace inContractKind by libraryFunction. --- libsolidity/analysis/TypeChecker.cpp | 20 ++++++++------------ libsolidity/analysis/ViewPureChecker.cpp | 2 +- libsolidity/ast/AST.cpp | 8 ++++---- libsolidity/ast/AST.h | 3 +-- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 763c34f21b14..00f91774db9a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -328,8 +328,6 @@ void TypeChecker::endVisit(ModifierDefinition const& _modifier) bool TypeChecker::visit(FunctionDefinition const& _function) { - bool isLibraryFunction = _function.inContractKind() == ContractKind::Library; - if (_function.markedVirtual()) { if (_function.annotation().contract->isInterface()) @@ -340,7 +338,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.isPayable()) { - if (isLibraryFunction) + if (_function.libraryFunction()) m_errorReporter.typeError(7708_error, _function.location(), "Library functions cannot be payable."); if (_function.isOrdinary() && !_function.isPartOfExternalInterface()) m_errorReporter.typeError(5587_error, _function.location(), "Internal functions cannot be payable."); @@ -350,15 +348,13 @@ bool TypeChecker::visit(FunctionDefinition const& _function) { if (var.referenceLocation() != VariableDeclaration::Location::Storage) { - if (!isLibraryFunction && _function.isPublic()) + if (!_function.libraryFunction() && _function.isPublic()) m_errorReporter.typeError(3442_error, var.location(), "Mapping types can only have a data location of \"storage\" and thus only be parameters or return variables for internal or library functions."); else m_errorReporter.typeError(5380_error, var.location(), "Mapping types can only have a data location of \"storage\"." ); } else - { - solAssert(isLibraryFunction || !_function.isPublic(), "Mapping types for parameters or return variables can only be used in internal or library functions."); - } + solAssert(_function.libraryFunction() || !_function.isPublic(), "Mapping types for parameters or return variables can only be used in internal or library functions."); } else { @@ -366,7 +362,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) m_errorReporter.typeError(3312_error, var.location(), "Type is required to live outside storage."); if (_function.isPublic()) { - auto iType = type(var)->interfaceType(isLibraryFunction); + auto iType = type(var)->interfaceType(_function.libraryFunction()); if (!iType) { @@ -378,7 +374,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if ( _function.isPublic() && !_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2) && - !typeSupportedByOldABIEncoder(*type(var), isLibraryFunction) + !typeSupportedByOldABIEncoder(*type(var), _function.libraryFunction()) ) m_errorReporter.typeError( 4957_error, @@ -435,7 +431,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) _function.body().accept(*this); else if (_function.isConstructor()) m_errorReporter.typeError(5700_error, _function.location(), "Constructor must be implemented if declared."); - else if (isLibraryFunction) + else if (_function.libraryFunction()) m_errorReporter.typeError(9231_error, _function.location(), "Library functions must be implemented if declared."); else if (!_function.virtualSemantics()) m_errorReporter.typeError(5424_error, _function.location(), "Functions without implementation must be marked virtual."); @@ -1830,7 +1826,7 @@ void TypeChecker::typeCheckFallbackFunction(FunctionDefinition const& _function) { solAssert(_function.isFallback(), ""); - if (_function.inContractKind() == ContractKind::Library) + if (_function.libraryFunction()) m_errorReporter.typeError(5982_error, _function.location(), "Libraries cannot have fallback functions."); if (_function.stateMutability() != StateMutability::NonPayable && _function.stateMutability() != StateMutability::Payable) m_errorReporter.typeError( @@ -1857,7 +1853,7 @@ void TypeChecker::typeCheckReceiveFunction(FunctionDefinition const& _function) { solAssert(_function.isReceive(), ""); - if (_function.inContractKind() == ContractKind::Library) + if (_function.libraryFunction()) m_errorReporter.typeError(4549_error, _function.location(), "Libraries cannot have receive ether functions."); if (_function.stateMutability() != StateMutability::Payable) diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index 230e0a8bab56..09c8a34b3c59 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -276,7 +276,7 @@ void ViewPureChecker::reportMutability( { // We do not warn for library functions because they cannot be payable anyway. // Also internal functions should be allowed to use `msg.value`. - if (m_currentFunction->isPublic() && m_currentFunction->inContractKind() != ContractKind::Library) + if (m_currentFunction->isPublic() && !m_currentFunction->libraryFunction()) { if (_nestedLocation) m_errorReporter.typeError( diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3edb08476e4a..c11a05a026c8 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -287,11 +287,11 @@ TypeDeclarationAnnotation& EnumDefinition::annotation() const return initAnnotation(); } -ContractKind FunctionDefinition::inContractKind() const +bool FunctionDefinition::libraryFunction() const { - auto contractDef = dynamic_cast(scope()); - solAssert(contractDef, "Enclosing Scope of FunctionDefinition was not set."); - return contractDef->contractKind(); + if (auto const* contractDef = dynamic_cast(scope())) + return contractDef->isLibrary(); + return false; } FunctionTypePointer FunctionDefinition::functionType(bool _internal) const diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 721e76791f88..c1c02b2bbe4c 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -799,6 +799,7 @@ class FunctionDefinition: public CallableDeclaration, public StructurallyDocumen void accept(ASTConstVisitor& _visitor) const override; StateMutability stateMutability() const { return m_stateMutability; } + bool libraryFunction() const; bool isOrdinary() const { return m_kind == Token::Function; } bool isConstructor() const { return m_kind == Token::Constructor; } bool isFallback() const { return m_kind == Token::Fallback; } @@ -825,8 +826,6 @@ class FunctionDefinition: public CallableDeclaration, public StructurallyDocumen /// @returns the external identifier of this function (the hash of the signature) as a hex string. std::string externalIdentifierHex() const; - ContractKind inContractKind() const; - TypePointer type() const override; TypePointer typeViaContractName() const override; From 062159214cd9dc00e39a7b4a1676607af01b5356 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2020 18:17:58 +0200 Subject: [PATCH 217/479] Rename scope to currentContract. --- libsolidity/analysis/TypeChecker.cpp | 28 ++++++++++++++-------------- libsolidity/analysis/TypeChecker.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 00f91774db9a..bdf27585ddf8 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -82,7 +82,7 @@ TypePointer const& TypeChecker::type(VariableDeclaration const& _variable) const bool TypeChecker::visit(ContractDefinition const& _contract) { - m_scope = &_contract; + m_currentContract = &_contract; ASTNode::listAccept(_contract.baseContracts(), *this); @@ -266,7 +266,7 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance) auto base = dynamic_cast(&dereference(_inheritance.name())); solAssert(base, "Base contract not available."); - if (m_scope->isInterface() && !base->isInterface()) + if (m_currentContract->isInterface() && !base->isInterface()) m_errorReporter.typeError(6536_error, _inheritance.location(), "Interfaces can only inherit from other interfaces."); if (base->isLibrary()) @@ -413,7 +413,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) else modifiers.insert(decl); } - if (m_scope->isInterface()) + if (m_currentContract->isInterface()) { if (_function.isImplemented()) m_errorReporter.typeError(4726_error, _function.location(), "Functions in interfaces cannot have an implementation."); @@ -424,7 +424,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.isConstructor()) m_errorReporter.typeError(6482_error, _function.location(), "Constructor cannot be defined in interfaces."); } - else if (m_scope->contractKind() == ContractKind::Library) + else if (m_currentContract->contractKind() == ContractKind::Library) if (_function.isConstructor()) m_errorReporter.typeError(7634_error, _function.location(), "Constructor cannot be defined in libraries."); if (_function.isImplemented()) @@ -1790,7 +1790,7 @@ void TypeChecker::typeCheckFunctionCall( if (_functionType->kind() == FunctionType::Kind::Declaration) { if ( - m_scope->derivesFrom(*_functionType->declaration().annotation().contract) && + m_currentContract->derivesFrom(*_functionType->declaration().annotation().contract) && !dynamic_cast(_functionType->declaration()).isImplemented() ) m_errorReporter.typeError( @@ -1912,7 +1912,7 @@ void TypeChecker::typeCheckABIEncodeFunctions( bool const isPacked = _functionType->kind() == FunctionType::Kind::ABIEncodePacked; solAssert(_functionType->padArguments() != isPacked, "ABI function with unexpected padding"); - bool const abiEncoderV2 = m_scope->sourceUnit().annotation().experimentalFeatures.count( + bool const abiEncoderV2 = m_currentContract->sourceUnit().annotation().experimentalFeatures.count( ExperimentalFeature::ABIEncoderV2 ); @@ -2312,7 +2312,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) case FunctionType::Kind::ABIDecode: { bool const abiEncoderV2 = - m_scope->sourceUnit().annotation().experimentalFeatures.count( + m_currentContract->sourceUnit().annotation().experimentalFeatures.count( ExperimentalFeature::ABIEncoderV2 ); returnTypes = typeCheckABIDecodeAndRetrieveReturnType(_functionCall, abiEncoderV2); @@ -2508,13 +2508,13 @@ void TypeChecker::endVisit(NewExpression const& _newExpression) if (contract->abstract()) m_errorReporter.typeError(4614_error, _newExpression.location(), "Cannot instantiate an abstract contract."); - solAssert(!!m_scope, ""); - m_scope->annotation().contractDependencies.insert(contract); + solAssert(!!m_currentContract, ""); + m_currentContract->annotation().contractDependencies.insert(contract); solAssert( !contract->annotation().linearizedBaseContracts.empty(), "Linearized base contracts not yet available." ); - if (contractDependenciesAreCyclic(*m_scope)) + if (contractDependenciesAreCyclic(*m_currentContract)) m_errorReporter.typeError( 4579_error, _newExpression.location(), @@ -2561,7 +2561,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) // Retrieve the types of the arguments if this is used to call a function. auto const& arguments = _memberAccess.annotation().arguments; - MemberList::MemberMap possibleMembers = exprType->members(m_scope).membersByName(memberName); + MemberList::MemberMap possibleMembers = exprType->members(m_currentContract).membersByName(memberName); size_t const initialMemberCount = possibleMembers.size(); if (initialMemberCount > 1 && arguments) { @@ -2587,7 +2587,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) DataLocation::Storage, exprType ); - if (!storageType->members(m_scope).membersByName(memberName).empty()) + if (!storageType->members(m_currentContract).membersByName(memberName).empty()) m_errorReporter.fatalTypeError( 4994_error, _memberAccess.location(), @@ -2743,7 +2743,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) { annotation.isPure = true; ContractType const& accessedContractType = dynamic_cast(*magicType->typeArgument()); - m_scope->annotation().contractDependencies.insert(&accessedContractType.contractDefinition()); + m_currentContract->annotation().contractDependencies.insert(&accessedContractType.contractDefinition()); if ( memberName == "runtimeCode" && @@ -2755,7 +2755,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) "\"runtimeCode\" is not available for contracts containing immutable variables." ); - if (contractDependenciesAreCyclic(*m_scope)) + if (contractDependenciesAreCyclic(*m_currentContract)) m_errorReporter.typeError( 4224_error, _memberAccess.location(), diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 5c327bf2e920..9997c700a630 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -165,7 +165,7 @@ class TypeChecker: private ASTConstVisitor /// Runs type checks on @a _expression to infer its type and then checks that it is an LValue. void requireLValue(Expression const& _expression, bool _ordinaryAssignment); - ContractDefinition const* m_scope = nullptr; + ContractDefinition const* m_currentContract = nullptr; langutil::EVMVersion m_evmVersion; From 7eb73b52a163d3b13e1d733ef0a8b9e72ae9a64a Mon Sep 17 00:00:00 2001 From: TrentZ Date: Tue, 9 Jun 2020 15:17:50 -0500 Subject: [PATCH 218/479] Rename blacklist for clarity. --- libyul/optimiser/VarNameCleaner.cpp | 10 +++++----- libyul/optimiser/VarNameCleaner.h | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libyul/optimiser/VarNameCleaner.cpp b/libyul/optimiser/VarNameCleaner.cpp index 2d7cae6c6619..f9b9e7899048 100644 --- a/libyul/optimiser/VarNameCleaner.cpp +++ b/libyul/optimiser/VarNameCleaner.cpp @@ -33,16 +33,16 @@ using namespace solidity::yul; VarNameCleaner::VarNameCleaner( Block const& _ast, Dialect const& _dialect, - set _blacklist + set _namesToKeep ): m_dialect{_dialect}, - m_blacklist{std::move(_blacklist)}, + m_namesToKeep{std::move(_namesToKeep)}, m_translatedNames{} { for (auto const& statement: _ast.statements) if (holds_alternative(statement)) - m_blacklist.insert(std::get(statement).name); - m_usedNames = m_blacklist; + m_namesToKeep.insert(std::get(statement).name); + m_usedNames = m_namesToKeep; } void VarNameCleaner::operator()(FunctionDefinition& _funDef) @@ -51,7 +51,7 @@ void VarNameCleaner::operator()(FunctionDefinition& _funDef) m_insideFunction = true; set globalUsedNames = std::move(m_usedNames); - m_usedNames = m_blacklist; + m_usedNames = m_namesToKeep; map globalTranslatedNames; swap(globalTranslatedNames, m_translatedNames); diff --git a/libyul/optimiser/VarNameCleaner.h b/libyul/optimiser/VarNameCleaner.h index 4bd4ca100e0a..911f67ca66e4 100644 --- a/libyul/optimiser/VarNameCleaner.h +++ b/libyul/optimiser/VarNameCleaner.h @@ -63,7 +63,7 @@ class VarNameCleaner: public ASTModifier VarNameCleaner( Block const& _ast, Dialect const& _dialect, - std::set _blacklist = {} + std::set _namesToKeep = {} ); /// Tries to rename a list of variables. @@ -77,11 +77,13 @@ class VarNameCleaner: public ASTModifier YulString findCleanName(YulString const& name) const; /// Tests whether a given name was already used within this pass - /// or is on the blacklist. + /// or was set to be kept. bool isUsedName(YulString const& _name) const; Dialect const& m_dialect; - std::set m_blacklist; + + /// These names will not be modified. + std::set m_namesToKeep; /// Set of names that are in use. std::set m_usedNames; From c6e4943089c0f5dc6be668841901cd50d5913a31 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:42:46 +0200 Subject: [PATCH 219/479] Adding fixes for signedness warnings in libsolidity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- libsolidity/analysis/OverrideChecker.cpp | 29 ++++++----- libsolidity/analysis/TypeChecker.cpp | 34 ++++++------- libsolidity/ast/AST.cpp | 2 +- libsolidity/ast/AST.h | 2 +- libsolidity/ast/ASTJsonConverter.cpp | 3 +- libsolidity/ast/ASTJsonImporter.cpp | 2 +- libsolidity/ast/Types.cpp | 10 ++-- libsolidity/codegen/ABIFunctions.cpp | 2 +- libsolidity/codegen/ArrayUtils.cpp | 2 +- libsolidity/codegen/CompilerContext.cpp | 20 ++++---- libsolidity/codegen/CompilerContext.h | 2 +- libsolidity/codegen/CompilerUtils.cpp | 4 +- libsolidity/codegen/ContractCompiler.cpp | 50 +++++++++---------- libsolidity/codegen/ExpressionCompiler.cpp | 20 ++++---- .../codegen/ir/IRGeneratorForStatements.cpp | 4 +- libsolidity/formal/CHC.cpp | 14 +++--- libsolidity/formal/CHC.h | 4 +- libsolidity/formal/SMTEncoder.cpp | 15 +++--- libsolidity/formal/SMTEncoder.h | 2 +- libsolidity/formal/SymbolicVariables.cpp | 10 ++-- libsolidity/formal/SymbolicVariables.h | 10 ++-- libsolidity/interface/CompilerStack.cpp | 2 +- libsolidity/interface/GasEstimator.cpp | 4 +- libsolidity/interface/StorageLayout.cpp | 2 +- test/libsolidity/ABIEncoderTests.cpp | 4 +- test/libsolidity/SMTCheckerJSONTest.cpp | 12 ++--- .../SolidityExpressionCompiler.cpp | 4 +- test/libsolidity/SolidityOptimizer.cpp | 2 +- test/libsolidity/SolidityParser.cpp | 2 +- test/libsolidity/SyntaxTest.cpp | 4 +- test/libsolidity/util/BytesUtils.cpp | 4 +- test/libsolidity/util/TestFileParserTests.cpp | 2 +- 32 files changed, 145 insertions(+), 138 deletions(-) diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 89f9a6637846..c488fd278a01 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -68,7 +68,7 @@ struct OverrideGraph std::map nodes; std::map nodeInv; std::map> edges; - int numNodes = 2; + size_t numNodes = 2; void addEdge(int _a, int _b) { edges[_a].insert(_b); @@ -82,7 +82,7 @@ struct OverrideGraph auto it = nodes.find(_function); if (it != nodes.end()) return it->second; - int currentNode = numNodes++; + int currentNode = static_cast(numNodes++); nodes[_function] = currentNode; nodeInv[currentNode] = _function; if (_function.overrides()) @@ -116,21 +116,24 @@ struct CutVertexFinder std::vector m_parent = std::vector(m_graph.numNodes, -1); std::set m_cutVertices{}; - void run(int _u = 0, int _depth = 0) + void run(size_t _u = 0, size_t _depth = 0) { m_visited.at(_u) = true; - m_depths.at(_u) = m_low.at(_u) = _depth; - for (int v: m_graph.edges.at(_u)) - if (!m_visited.at(v)) + m_depths.at(_u) = m_low.at(_u) = static_cast(_depth); + for (int const v: m_graph.edges.at(static_cast(_u))) + { + auto const vInd = static_cast(v); + if (!m_visited.at(vInd)) { - m_parent[v] = _u; - run(v, _depth + 1); - if (m_low[v] >= m_depths[_u] && m_parent[_u] != -1) - m_cutVertices.insert(m_graph.nodeInv.at(_u)); - m_low[_u] = min(m_low[_u], m_low[v]); + m_parent[vInd] = static_cast(_u); + run(vInd, _depth + 1); + if (m_low[vInd] >= m_depths[_u] && m_parent[_u] != -1) + m_cutVertices.insert(m_graph.nodeInv.at(static_cast(_u))); + m_low[_u] = min(m_low[_u], m_low[vInd]); } else if (v != m_parent[_u]) - m_low[_u] = min(m_low[_u], m_depths[v]); + m_low[_u] = min(m_low[_u], m_depths[vInd]); + } } }; @@ -213,7 +216,7 @@ bool OverrideProxy::CompareBySignature::operator()(OverrideProxy const& _a, Over size_t OverrideProxy::id() const { return std::visit(GenericVisitor{ - [&](auto const* _item) -> size_t { return _item->id(); } + [&](auto const* _item) -> size_t { return static_cast(_item->id()); } }, m_item); } diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index bdf27585ddf8..c308fadd8efe 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -666,7 +666,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) { auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier); if (ref == _inlineAssembly.annotation().externalReferences.end()) - return size_t(-1); + return numeric_limits::max(); Declaration const* declaration = ref->second.declaration; solAssert(!!declaration, ""); bool requiresStorage = ref->second.isSlot || ref->second.isOffset; @@ -676,7 +676,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (var->immutable()) { m_errorReporter.typeError(3773_error, _identifier.location, "Assembly access to immutable variables is not supported."); - return size_t(-1); + return numeric_limits::max(); } if (var->isConstant()) { @@ -685,17 +685,17 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (var && !var->value()) { m_errorReporter.typeError(3224_error, _identifier.location, "Constant has no value."); - return size_t(-1); + return numeric_limits::max(); } else if (_context == yul::IdentifierContext::LValue) { m_errorReporter.typeError(6252_error, _identifier.location, "Constant variables cannot be assigned to."); - return size_t(-1); + return numeric_limits::max(); } else if (requiresStorage) { m_errorReporter.typeError(6617_error, _identifier.location, "The suffixes _offset and _slot can only be used on non-constant storage variables."); - return size_t(-1); + return numeric_limits::max(); } else if (var && var->value() && !var->value()->annotation().type && !dynamic_cast(var->value().get())) { @@ -723,19 +723,19 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage)) { m_errorReporter.typeError(3622_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); - return size_t(-1); + return numeric_limits::max(); } else if (_context == yul::IdentifierContext::LValue) { if (var->isStateVariable()) { m_errorReporter.typeError(4713_error, _identifier.location, "State variables cannot be assigned to - you have to use \"sstore()\"."); - return size_t(-1); + return numeric_limits::max(); } else if (ref->second.isOffset) { m_errorReporter.typeError(9739_error, _identifier.location, "Only _slot can be assigned to."); - return size_t(-1); + return numeric_limits::max(); } else solAssert(ref->second.isSlot, ""); @@ -744,12 +744,12 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) else if (!var->isConstant() && var->isStateVariable()) { m_errorReporter.typeError(1408_error, _identifier.location, "Only local variables are supported. To access storage variables, use the _slot and _offset suffixes."); - return size_t(-1); + return numeric_limits::max(); } else if (var->type()->dataStoredIn(DataLocation::Storage)) { m_errorReporter.typeError(9068_error, _identifier.location, "You have to use the _slot or _offset suffix to access storage reference variables."); - return size_t(-1); + return numeric_limits::max(); } else if (var->type()->sizeOnStack() != 1) { @@ -757,21 +757,21 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) m_errorReporter.typeError(2370_error, _identifier.location, "Call data elements cannot be accessed directly. Copy to a local variable first or use \"calldataload\" or \"calldatacopy\" with manually determined offsets and sizes."); else m_errorReporter.typeError(9857_error, _identifier.location, "Only types that use one stack slot are supported."); - return size_t(-1); + return numeric_limits::max(); } } else if (requiresStorage) { m_errorReporter.typeError(7944_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); - return size_t(-1); + return numeric_limits::max(); } else if (_context == yul::IdentifierContext::LValue) { if (dynamic_cast(declaration)) - return size_t(-1); + return numeric_limits::max(); m_errorReporter.typeError(1990_error, _identifier.location, "Only local variables can be assigned to in inline assembly."); - return size_t(-1); + return numeric_limits::max(); } if (_context == yul::IdentifierContext::RValue) @@ -780,7 +780,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (dynamic_cast(declaration)) { m_errorReporter.declarationError(2025_error, _identifier.location, "Access to functions is not allowed in inline assembly."); - return size_t(-1); + return numeric_limits::max(); } else if (dynamic_cast(declaration)) { @@ -790,11 +790,11 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (!contract->isLibrary()) { m_errorReporter.typeError(4977_error, _identifier.location, "Expected a library."); - return size_t(-1); + return numeric_limits::max(); } } else - return size_t(-1); + return numeric_limits::max(); } ref->second.valueSize = 1; return size_t(1); diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index c11a05a026c8..3492bfc458ee 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -38,7 +38,7 @@ using namespace solidity; using namespace solidity::frontend; ASTNode::ASTNode(int64_t _id, SourceLocation _location): - m_id(_id), + m_id(static_cast(_id)), m_location(std::move(_location)) { } diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index c1c02b2bbe4c..c6c560988a0c 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -88,7 +88,7 @@ class ASTNode: private boost::noncopyable virtual ~ASTNode() {} /// @returns an identifier of this AST node that is unique for a single compilation run. - int64_t id() const { return m_id; } + int64_t id() const { return int64_t(m_id); } virtual void accept(ASTVisitor& _visitor) = 0; virtual void accept(ASTConstVisitor& _visitor) const = 0; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 8da1dddd719d..219151f89286 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -37,6 +37,7 @@ #include #include #include +#include using namespace std; using namespace solidity::langutil; @@ -134,7 +135,7 @@ size_t ASTJsonConverter::sourceIndexFromLocation(SourceLocation const& _location if (_location.source && m_sourceIndices.count(_location.source->name())) return m_sourceIndices.at(_location.source->name()); else - return size_t(-1); + return numeric_limits::max(); } string ASTJsonConverter::sourceLocationToString(SourceLocation const& _location) const diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 97e3ba964455..65f9fa718e88 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -92,7 +92,7 @@ SourceLocation const ASTJsonImporter::createSourceLocation(Json::Value const& _n { astAssert(member(_node, "src").isString(), "'src' must be a string"); - return solidity::langutil::parseSourceLocation(_node["src"].asString(), m_currentSourceName, int(m_sourceLocations.size())); + return solidity::langutil::parseSourceLocation(_node["src"].asString(), m_currentSourceName, m_sourceLocations.size()); } template diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 66681ea10790..669e54d0e74a 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -773,7 +773,7 @@ tuple RationalNumberType::parseRational(string const& _value) denominator = bigint(string(fractionalBegin, _value.end())); denominator /= boost::multiprecision::pow( bigint(10), - distance(radixPoint + 1, _value.end()) + static_cast(distance(radixPoint + 1, _value.end())) ); numerator = bigint(string(_value.begin(), radixPoint)); value = numerator + denominator; @@ -1065,7 +1065,7 @@ TypeResult RationalNumberType::binaryOperatorResult(Token _operator, Type const* if (_base == 1) return 1; else if (_base == -1) - return 1 - 2 * int(_exponent & 1); + return 1 - 2 * static_cast(_exponent & 1); else return boost::multiprecision::pow(_base, _exponent); }; @@ -1171,7 +1171,7 @@ string RationalNumberType::bigintToReadableString(bigint const& _num) string str = _num.str(); if (str.size() > 32) { - int omitted = str.size() - 8; + size_t omitted = str.size() - 8; str = str.substr(0, 4) + "...(" + to_string(omitted) + " digits omitted)..." + str.substr(str.size() - 4, 4); } return str; @@ -1201,7 +1201,7 @@ u256 RationalNumberType::literalValue(Literal const*) const { auto fixed = fixedPointType(); solAssert(fixed, "Rational number cannot be represented as fixed point type."); - int fractionalDigits = fixed->fractionalDigits(); + unsigned fractionalDigits = fixed->fractionalDigits(); shiftedValue = m_value.numerator() * boost::multiprecision::pow(bigint(10), fractionalDigits) / m_value.denominator(); } @@ -1291,7 +1291,7 @@ StringLiteralType::StringLiteralType(string _value): BoolResult StringLiteralType::isImplicitlyConvertibleTo(Type const& _convertTo) const { if (auto fixedBytes = dynamic_cast(&_convertTo)) - return size_t(fixedBytes->numBytes()) >= m_value.size(); + return static_cast(fixedBytes->numBytes()) >= m_value.size(); else if (auto arrayType = dynamic_cast(&_convertTo)) return arrayType->isByteArray() && diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 189fba165c8b..9f244fdb15dd 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -725,7 +725,7 @@ string ABIFunctions::abiEncodingFunctionCompactStorageArray( size_t itemsPerSlot = 32 / storageBytes; solAssert(itemsPerSlot > 0, ""); // The number of elements we need to handle manually after the loop. - size_t spill = size_t(_from.length() % itemsPerSlot); + size_t spill = static_cast(_from.length() % itemsPerSlot); Whiskers templ( R"( // -> diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index 732deca6f648..9f12f648f8c6 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -56,7 +56,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons bool directCopy = sourceIsStorage && sourceBaseType->isValueType() && *sourceBaseType == *targetBaseType; bool haveByteOffsetSource = !directCopy && sourceIsStorage && sourceBaseType->storageBytes() <= 16; bool haveByteOffsetTarget = !directCopy && targetBaseType->storageBytes() <= 16; - unsigned byteOffsetSize = (haveByteOffsetSource ? 1 : 0) + (haveByteOffsetTarget ? 1 : 0); + unsigned byteOffsetSize = (haveByteOffsetSource ? 1u : 0u) + (haveByteOffsetTarget ? 1u : 0u); // stack: source_ref [source_length] target_ref // store target_ref diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 9e2c0663bdd6..fea449f7fd5a 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -133,7 +133,7 @@ void CompilerContext::callLowLevelFunction( *this << lowLevelFunctionTag(_name, _inArgs, _outArgs, _generator); appendJump(evmasm::AssemblyItem::JumpType::IntoFunction); - adjustStackOffset(int(_outArgs) - 1 - _inArgs); + adjustStackOffset(static_cast(_outArgs) - 1 - static_cast(_inArgs)); *this << retTag.tag(); } @@ -147,7 +147,7 @@ void CompilerContext::callYulFunction( auto const retTag = pushNewTag(); CompilerUtils(*this).moveIntoStack(_inArgs); appendJumpTo(namedTag(_name)); - adjustStackOffset(int(_outArgs) - 1 - _inArgs); + adjustStackOffset(static_cast(_outArgs) - 1 - static_cast(_inArgs)); *this << retTag.tag(); } @@ -181,7 +181,7 @@ void CompilerContext::appendMissingLowLevelFunctions() tie(name, inArgs, outArgs, generator) = m_lowLevelFunctionGenerationQueue.front(); m_lowLevelFunctionGenerationQueue.pop(); - setStackOffset(inArgs + 1); + setStackOffset(static_cast(inArgs) + 1); *this << m_lowLevelFunctions.at(name).tag(); generator(*this); CompilerUtils(*this).moveToStackTop(outArgs); @@ -298,12 +298,12 @@ unsigned CompilerContext::baseStackOffsetOfVariable(Declaration const& _declarat unsigned CompilerContext::baseToCurrentStackOffset(unsigned _baseOffset) const { - return m_asm->deposit() - _baseOffset - 1; + return static_cast(m_asm->deposit()) - _baseOffset - 1; } unsigned CompilerContext::currentToBaseStackOffset(unsigned _offset) const { - return m_asm->deposit() - _offset - 1; + return static_cast(m_asm->deposit()) - _offset - 1; } pair CompilerContext::storageLocationOfVariable(Declaration const& _declaration) const @@ -371,7 +371,7 @@ void CompilerContext::appendInlineAssembly( OptimiserSettings const& _optimiserSettings ) { - int startStackHeight = stackHeight(); + unsigned startStackHeight = stackHeight(); set externallyUsedIdentifiers; for (auto const& fun: _externallyUsedFunctions) @@ -387,9 +387,9 @@ void CompilerContext::appendInlineAssembly( ) -> size_t { if (_insideFunction) - return size_t(-1); + return numeric_limits::max(); auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str()); - return it == _localVariables.end() ? size_t(-1) : 1; + return it == _localVariables.end() ? numeric_limits::max() : 1; }; identifierAccess.generateCode = [&]( yul::Identifier const& _identifier, @@ -399,8 +399,8 @@ void CompilerContext::appendInlineAssembly( { auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str()); solAssert(it != _localVariables.end(), ""); - int stackDepth = _localVariables.end() - it; - int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth; + auto stackDepth = static_cast(distance(it, _localVariables.end())); + size_t stackDiff = static_cast(_assembly.stackHeight()) - startStackHeight + stackDepth; if (_context == yul::IdentifierContext::LValue) stackDiff -= 1; if (stackDiff < 1 || stackDiff > 16) diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index 51d3afe1c1b5..c32b5140627f 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -377,7 +377,7 @@ class CompilerContext /// The runtime context if in Creation mode, this is used for generating tags that would be stored into the storage and then used at runtime. CompilerContext *m_runtimeContext; /// The index of the runtime subroutine. - size_t m_runtimeSub = -1; + size_t m_runtimeSub = std::numeric_limits::max(); /// An index of low-level function labels by name. std::map m_lowLevelFunctions; /// Collector for yul functions. diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 2735c2fce9ed..c3e81d13a860 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1351,7 +1351,7 @@ void CompilerUtils::popAndJump(unsigned _toHeight, evmasm::AssemblyItem const& _ unsigned amount = m_context.stackHeight() - _toHeight; popStackSlots(amount); m_context.appendJumpTo(_jumpTo); - m_context.adjustStackOffset(amount); + m_context.adjustStackOffset(static_cast(amount)); } unsigned CompilerUtils::sizeOnStack(vector const& _variableTypes) @@ -1436,7 +1436,7 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda { bool leftAligned = _type.category() == Type::Category::FixedBytes; // add leading or trailing zeros by dividing/multiplying depending on alignment - int shiftFactor = (32 - numBytes) * 8; + unsigned shiftFactor = (32 - numBytes) * 8; rightShiftNumberOnStack(shiftFactor); if (leftAligned) { diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 269d9a5bf3e0..6f8603a51230 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -185,7 +185,7 @@ size_t ContractCompiler::packIntoContractCreator(ContractDefinition const& _cont CompilerContext::LocationSetter locationSetter(m_context, _contract); m_context << deployRoutine; - solAssert(m_context.runtimeSub() != size_t(-1), "Runtime sub not registered"); + solAssert(m_context.runtimeSub() != numeric_limits::max(), "Runtime sub not registered"); ContractType contractType(_contract); auto const& immutables = contractType.immutableVariables(); @@ -221,7 +221,7 @@ size_t ContractCompiler::deployLibrary(ContractDefinition const& _contract) CompilerContext::LocationSetter locationSetter(m_context, _contract); - solAssert(m_context.runtimeSub() != size_t(-1), "Runtime sub not registered"); + solAssert(m_context.runtimeSub() != numeric_limits::max(), "Runtime sub not registered"); m_context.pushSubroutineSize(m_context.runtimeSub()); m_context.pushSubroutineOffset(m_context.runtimeSub()); // This code replaces the address added by appendDeployTimeAddress(). @@ -349,11 +349,11 @@ void ContractCompiler::appendInternalSelector( m_context << dupInstruction(1) << u256(FixedHash<4>::Arith(pivot)) << Instruction::GT; evmasm::AssemblyItem lessTag{m_context.appendConditionalJump()}; // Here, we have funid >= pivot - vector> larger{_ids.begin() + pivotIndex, _ids.end()}; + vector> larger{_ids.begin() + static_cast(pivotIndex), _ids.end()}; appendInternalSelector(_entryPoints, larger, _notFoundTag, _runs); m_context << lessTag; // Here, we have funid < pivot - vector> smaller{_ids.begin(), _ids.begin() + pivotIndex}; + vector> smaller{_ids.begin(), _ids.begin() + static_cast(pivotIndex)}; appendInternalSelector(_entryPoints, smaller, _notFoundTag, _runs); } else @@ -512,8 +512,8 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac m_context << returnTag; // Return tag and input parameters get consumed. m_context.adjustStackOffset( - CompilerUtils(m_context).sizeOnStack(functionType->returnParameterTypes()) - - CompilerUtils(m_context).sizeOnStack(functionType->parameterTypes()) - + static_cast(CompilerUtils::sizeOnStack(functionType->returnParameterTypes())) - + static_cast(CompilerUtils::sizeOnStack(functionType->parameterTypes())) - 1 ); // Consumes the return parameters. @@ -589,7 +589,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) unsigned parametersSize = CompilerUtils::sizeOnStack(_function.parameters()); if (!_function.isConstructor()) // adding 1 for return address. - m_context.adjustStackOffset(parametersSize + 1); + m_context.adjustStackOffset(static_cast(parametersSize) + 1); for (ASTPointer const& variable: _function.parameters()) { m_context.addVariable(*variable, parametersSize); @@ -609,7 +609,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) m_breakTags.clear(); m_continueTags.clear(); m_currentFunction = &_function; - m_modifierDepth = -1; + m_modifierDepth = numeric_limits::max(); m_scopeStackHeight.clear(); m_context.setModifierDepth(0); @@ -627,10 +627,10 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) unsigned const c_returnValuesSize = CompilerUtils::sizeOnStack(_function.returnParameters()); vector stackLayout; - stackLayout.push_back(c_returnValuesSize); // target of return address + stackLayout.push_back(static_cast(c_returnValuesSize)); // target of return address stackLayout += vector(c_argumentsSize, -1); // discard all arguments - for (unsigned i = 0; i < c_returnValuesSize; ++i) - stackLayout.push_back(i); + for (size_t i = 0; i < c_returnValuesSize; ++i) + stackLayout.push_back(static_cast(i)); if (stackLayout.size() > 17) BOOST_THROW_EXCEPTION( @@ -638,7 +638,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) errinfo_sourceLocation(_function.location()) << errinfo_comment("Stack too deep, try removing local variables.") ); - while (stackLayout.back() != int(stackLayout.size() - 1)) + while (stackLayout.back() != static_cast(stackLayout.size() - 1)) if (stackLayout.back() < 0) { m_context << Instruction::POP; @@ -646,11 +646,11 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) } else { - m_context << swapInstruction(stackLayout.size() - stackLayout.back() - 1); - swap(stackLayout[stackLayout.back()], stackLayout.back()); + m_context << swapInstruction(stackLayout.size() - static_cast(stackLayout.back()) - 1); + swap(stackLayout[static_cast(stackLayout.back())], stackLayout.back()); } - for (int i = 0; i < int(stackLayout.size()); ++i) - if (stackLayout[i] != i) + for (size_t i = 0; i < stackLayout.size(); ++i) + if (stackLayout[i] != static_cast(i)) solAssert(false, "Invalid stack layout on cleanup."); for (ASTPointer const& variable: _function.parameters() + _function.returnParameters()) @@ -677,7 +677,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) { auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier); if (ref == _inlineAssembly.annotation().externalReferences.end()) - return size_t(-1); + return numeric_limits::max(); return ref->second.valueSize; }; identifierAccess.generateCode = [&](yul::Identifier const& _identifier, yul::IdentifierContext _context, yul::AbstractAssembly& _assembly) @@ -696,7 +696,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) functionDef = &functionDef->resolveVirtual(m_context.mostDerivedContract()); auto functionEntryLabel = m_context.functionEntryLabel(*functionDef).pushTag(); solAssert(functionEntryLabel.data() <= std::numeric_limits::max(), ""); - _assembly.appendLabelReference(size_t(functionEntryLabel.data())); + _assembly.appendLabelReference(static_cast(functionEntryLabel.data())); // If there is a runtime context, we have to merge both labels into the same // stack slot in case we store it in storage. if (CompilerContext* rtc = m_context.runtimeContext()) @@ -705,7 +705,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) _assembly.appendInstruction(Instruction::MUL); auto runtimeEntryLabel = rtc->functionEntryLabel(*functionDef).toSubAssemblyTag(m_context.runtimeSub()); solAssert(runtimeEntryLabel.data() <= std::numeric_limits::max(), ""); - _assembly.appendLabelReference(size_t(runtimeEntryLabel.data())); + _assembly.appendLabelReference(static_cast(runtimeEntryLabel.data())); _assembly.appendInstruction(Instruction::OR); } } @@ -772,7 +772,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) } else if (m_context.isLocalVariable(decl)) { - int stackDiff = _assembly.stackHeight() - m_context.baseStackOffsetOfVariable(*variable); + unsigned stackDiff = static_cast(_assembly.stackHeight()) - m_context.baseStackOffsetOfVariable(*variable); if (ref->second.isSlot || ref->second.isOffset) { solAssert(variable->type()->dataStoredIn(DataLocation::Storage), ""); @@ -816,7 +816,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) } else solAssert(false, "Invalid declaration type."); - solAssert(_assembly.stackHeight() - depositBefore == int(ref->second.valueSize), ""); + solAssert(_assembly.stackHeight() - depositBefore == static_cast(ref->second.valueSize), ""); } else { @@ -828,7 +828,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) "Can only assign to stack variables in inline assembly." ); solAssert(variable->type()->sizeOnStack() == 1, ""); - int stackDiff = _assembly.stackHeight() - m_context.baseStackOffsetOfVariable(*variable) - 1; + unsigned stackDiff = static_cast(_assembly.stackHeight()) - m_context.baseStackOffsetOfVariable(*variable) - 1; if (stackDiff > 16 || stackDiff < 1) BOOST_THROW_EXCEPTION( CompilerError() << @@ -875,7 +875,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) false, m_optimiserSettings.optimizeStackAllocation ); - m_context.setStackOffset(startStackHeight); + m_context.setStackOffset(static_cast(startStackHeight)); return false; } @@ -914,7 +914,7 @@ bool ContractCompiler::visit(TryStatement const& _tryStatement) solAssert(params[i] && exprTypes[i] && *params[i]->annotation().type == *exprTypes[i], ""); } else - CompilerUtils(m_context).popStackSlots(returnSize); + CompilerUtils(m_context).popStackSlots(static_cast(returnSize)); _tryStatement.clauses().front()->accept(*this); } @@ -937,7 +937,7 @@ void ContractCompiler::handleCatch(vector> const& _ca else solAssert(false, ""); - solAssert(_catchClauses.size() == size_t(1 + (structured ? 1 : 0) + (fallback ? 1 : 0)), ""); + solAssert(_catchClauses.size() == 1ul + (structured ? 1 : 0) + (fallback ? 1 : 0), ""); evmasm::AssemblyItem endTag = m_context.newTag(); evmasm::AssemblyItem fallbackTag = m_context.newTag(); diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 6397c7492de6..a020551f36ac 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -100,7 +100,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& if (_varDecl.immutable()) solAssert(paramTypes.empty(), ""); - m_context.adjustStackOffset(1 + CompilerUtils::sizeOnStack(paramTypes)); + m_context.adjustStackOffset(static_cast(1 + CompilerUtils::sizeOnStack(paramTypes))); if (!_varDecl.immutable()) { @@ -242,7 +242,7 @@ bool ExpressionCompiler::visit(Conditional const& _condition) acceptAndConvert(_condition.falseExpression(), *_condition.annotation().type); evmasm::AssemblyItem endTag = m_context.appendJumpToNew(); m_context << trueTag; - int offset = _condition.annotation().type->sizeOnStack(); + int offset = static_cast(_condition.annotation().type->sizeOnStack()); m_context.adjustStackOffset(-offset); acceptAndConvert(_condition.trueExpression(), *_condition.annotation().type); m_context << endTag; @@ -619,7 +619,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) unsigned returnParametersSize = CompilerUtils::sizeOnStack(function.returnParameterTypes()); // callee adds return parameters, but removes arguments and return label - m_context.adjustStackOffset(returnParametersSize - parameterSize - 1); + m_context.adjustStackOffset(static_cast(returnParametersSize - parameterSize) - 1); break; } case FunctionType::Kind::BareCall: @@ -705,7 +705,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) acceptAndConvert(*arguments.front(), *TypeProvider::uint256(), true); // Note that function is not the original function, but the ".gas" function. // Its values of gasSet and valueSet is equal to the original function's though. - unsigned stackDepth = (function.gasSet() ? 1 : 0) + (function.valueSet() ? 1 : 0); + unsigned stackDepth = (function.gasSet() ? 1u : 0u) + (function.valueSet() ? 1u : 0u); if (stackDepth > 0) m_context << swapInstruction(stackDepth); if (function.gasSet()) @@ -814,7 +814,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) case FunctionType::Kind::Log3: case FunctionType::Kind::Log4: { - unsigned logNumber = int(function.kind()) - int(FunctionType::Kind::Log0); + unsigned logNumber = static_cast(function.kind()) - static_cast(FunctionType::Kind::Log0); for (unsigned arg = logNumber; arg > 0; --arg) acceptAndConvert(*arguments[arg], *function.parameterTypes()[arg], true); arguments.front()->accept(*this); @@ -1088,7 +1088,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) { utils().revertWithStringData(*arguments.at(1)->annotation().type); // Here, the argument is consumed, but in the other branch, it is still there. - m_context.adjustStackOffset(arguments.at(1)->annotation().type->sizeOnStack()); + m_context.adjustStackOffset(static_cast(arguments.at(1)->annotation().type->sizeOnStack())); } else m_context.appendRevert(); @@ -1271,9 +1271,9 @@ bool ExpressionCompiler::visit(FunctionCallOptions const& _functionCallOptions) acceptAndConvert(*_functionCallOptions.options()[i], *requiredType); solAssert(!contains(presentOptions, newOption), ""); - size_t insertPos = presentOptions.end() - lower_bound(presentOptions.begin(), presentOptions.end(), newOption); + ptrdiff_t insertPos = presentOptions.end() - lower_bound(presentOptions.begin(), presentOptions.end(), newOption); - utils().moveIntoStack(insertPos, 1); + utils().moveIntoStack(static_cast(insertPos), 1); presentOptions.insert(presentOptions.end() - insertPos, newOption); } @@ -2190,7 +2190,7 @@ void ExpressionCompiler::appendExternalFunctionCall( // contract address unsigned selfSize = _functionType.bound() ? _functionType.selfType()->sizeOnStack() : 0; - unsigned gasValueSize = (_functionType.gasSet() ? 1 : 0) + (_functionType.valueSet() ? 1 : 0); + unsigned gasValueSize = (_functionType.gasSet() ? 1u : 0u) + (_functionType.valueSet() ? 1u : 0u); unsigned contractStackPos = m_context.currentToBaseStackOffset(1 + gasValueSize + selfSize + (_functionType.isBareCall() ? 0 : 1)); unsigned gasStackPos = m_context.currentToBaseStackOffset(gasValueSize); unsigned valueStackPos = m_context.currentToBaseStackOffset(1); @@ -2361,7 +2361,7 @@ void ExpressionCompiler::appendExternalFunctionCall( m_context << Instruction::CALL; unsigned remainsSize = - 2 + // contract address, input_memory_end + 2u + // contract address, input_memory_end (_functionType.valueSet() ? 1 : 0) + (_functionType.gasSet() ? 1 : 0) + (!_functionType.isBareCall() ? 1 : 0); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index a62251ab150a..beaff69ae9fa 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -636,7 +636,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) }); solAssert(it != callArgumentNames.cend(), ""); - arguments.push_back(callArguments[std::distance(callArgumentNames.begin(), it)]); + arguments.push_back(callArguments[static_cast(std::distance(callArgumentNames.begin(), it))]); } auto memberAccess = dynamic_cast(&_functionCall.expression()); @@ -1092,7 +1092,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) case FunctionType::Kind::Log3: case FunctionType::Kind::Log4: { - unsigned logNumber = int(functionType->kind()) - int(FunctionType::Kind::Log0); + unsigned logNumber = static_cast(functionType->kind()) - static_cast(FunctionType::Kind::Log0); solAssert(arguments.size() == logNumber + 1, ""); ABIFunctions abi(m_context.evmVersion(), m_context.revertStrings(), m_context.functionCollector()); string indexedArgs; diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index f0ba6d0de096..791a4f41d2b8 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -104,7 +104,7 @@ void CHC::analyze(SourceUnit const& _source) for (auto const* assertion: assertions) { createErrorBlock(); - connectBlocks(target.value, error(), target.constraints && (target.errorId == assertion->id())); + connectBlocks(target.value, error(), target.constraints && (target.errorId == static_cast(assertion->id()))); auto [result, model] = query(error(), assertion->location()); // This should be fine but it's a bug in the old compiler (void)model; @@ -116,7 +116,7 @@ void CHC::analyze(SourceUnit const& _source) { solAssert(dynamic_cast(scope), ""); createErrorBlock(); - connectBlocks(target.value, error(), target.constraints && (target.errorId == scope->id())); + connectBlocks(target.value, error(), target.constraints && (target.errorId == static_cast(scope->id()))); auto [result, model] = query(error(), scope->location()); // This should be fine but it's a bug in the old compiler (void)model; @@ -533,7 +533,9 @@ void CHC::visitAssert(FunctionCall const& _funCall) connectBlocks( m_currentBlock, m_currentFunction->isConstructor() ? summary(*m_currentContract) : summary(*m_currentFunction), - currentPathConditions() && !m_context.expression(*args.front())->currentValue() && (m_error.currentValue() == _funCall.id()) + currentPathConditions() && !m_context.expression(*args.front())->currentValue() && ( + m_error.currentValue() == static_cast(_funCall.id()) + ) ); m_context.addAssertion(m_error.currentValue() == previousError); @@ -601,7 +603,7 @@ void CHC::makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) connectBlocks( m_currentBlock, m_currentFunction->isConstructor() ? summary(*m_currentContract) : summary(*m_currentFunction), - currentPathConditions() && symbArray->length() <= 0 && m_error.currentValue() == _arrayPop.id() + currentPathConditions() && symbArray->length() <= 0 && m_error.currentValue() == static_cast(_arrayPop.id()) ); m_context.addAssertion(m_error.currentValue() == previousError); @@ -891,13 +893,13 @@ vector CHC::initialStateVariables() return stateVariablesAtIndex(0); } -vector CHC::stateVariablesAtIndex(int _index) +vector CHC::stateVariablesAtIndex(unsigned _index) { solAssert(m_currentContract, ""); return applyMap(m_stateVariables, [&](auto _var) { return valueAtIndex(*_var, _index); }); } -vector CHC::stateVariablesAtIndex(int _index, ContractDefinition const& _contract) +vector CHC::stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract) { return applyMap( stateVariablesIncludingInheritedAndPrivate(_contract), diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index b1235a188cfe..b52ce6667382 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -149,8 +149,8 @@ class CHC: public SMTEncoder /// @returns the symbolic values of the state variables at the beginning /// of the current transaction. std::vector initialStateVariables(); - std::vector stateVariablesAtIndex(int _index); - std::vector stateVariablesAtIndex(int _index, ContractDefinition const& _contract); + std::vector stateVariablesAtIndex(unsigned _index); + std::vector stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract); /// @returns the current symbolic values of the current state variables. std::vector currentStateVariables(); diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index b9c43f2c5d94..82cd7557874c 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -154,15 +154,16 @@ void SMTEncoder::visitFunctionOrModifier() ++m_modifierDepthStack.back(); FunctionDefinition const& function = dynamic_cast(*m_callStack.back().first); - if (m_modifierDepthStack.back() == int(function.modifiers().size())) + if (m_modifierDepthStack.back() == static_cast(function.modifiers().size())) { if (function.isImplemented()) function.body().accept(*this); } else { - solAssert(m_modifierDepthStack.back() < int(function.modifiers().size()), ""); - ASTPointer const& modifierInvocation = function.modifiers()[m_modifierDepthStack.back()]; + solAssert(m_modifierDepthStack.back() < static_cast(function.modifiers().size()), ""); + ASTPointer const& modifierInvocation = + function.modifiers()[static_cast(m_modifierDepthStack.back())]; solAssert(modifierInvocation, ""); auto refDecl = modifierInvocation->name()->annotation().referencedDeclaration; if (dynamic_cast(refDecl)) @@ -1679,8 +1680,8 @@ void SMTEncoder::mergeVariables(set const& _variable for (auto const* decl: sortedVars) { solAssert(_indicesEndTrue.count(decl) && _indicesEndFalse.count(decl), ""); - int trueIndex = _indicesEndTrue.at(decl); - int falseIndex = _indicesEndFalse.at(decl); + auto trueIndex = static_cast(_indicesEndTrue.at(decl)); + auto falseIndex = static_cast(_indicesEndFalse.at(decl)); solAssert(trueIndex != falseIndex, ""); m_context.addAssertion(m_context.newValue(*decl) == smtutil::Expression::ite( _condition, @@ -1696,7 +1697,7 @@ smtutil::Expression SMTEncoder::currentValue(VariableDeclaration const& _decl) return m_context.variable(_decl)->currentValue(); } -smtutil::Expression SMTEncoder::valueAtIndex(VariableDeclaration const& _decl, int _index) +smtutil::Expression SMTEncoder::valueAtIndex(VariableDeclaration const& _decl, unsigned _index) { solAssert(m_context.knownVariable(_decl), ""); return m_context.variable(_decl)->valueAtIndex(_index); @@ -1819,7 +1820,7 @@ SMTEncoder::VariableIndices SMTEncoder::copyVariableIndices() void SMTEncoder::resetVariableIndices(VariableIndices const& _indices) { for (auto const& var: _indices) - m_context.variable(*var.first)->setIndex(var.second); + m_context.variable(*var.first)->setIndex(static_cast(var.second)); } void SMTEncoder::clearIndices(ContractDefinition const* _contract, FunctionDefinition const* _function) diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 824d39b34a15..86ed21ef97d8 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -201,7 +201,7 @@ class SMTEncoder: public ASTConstVisitor smtutil::Expression currentValue(VariableDeclaration const& _decl); /// @returns an expression denoting the value of the variable declared in @a _decl /// at the given index. Does not ensure that this index exists. - smtutil::Expression valueAtIndex(VariableDeclaration const& _decl, int _index); + smtutil::Expression valueAtIndex(VariableDeclaration const& _decl, unsigned _index); /// Returns the expression corresponding to the AST node. /// If _targetType is not null apply conversion. /// Throws if the expression does not exist. diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index 002df600214f..3f86b48d901c 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -66,12 +66,12 @@ string SymbolicVariable::currentName() const return uniqueSymbol(m_ssa->index()); } -smtutil::Expression SymbolicVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicVariable::valueAtIndex(unsigned _index) const { return m_context.newVariable(uniqueSymbol(_index), m_sort); } -string SymbolicVariable::nameAtIndex(int _index) const +string SymbolicVariable::nameAtIndex(unsigned _index) const { return uniqueSymbol(_index); } @@ -170,12 +170,12 @@ smtutil::Expression SymbolicFunctionVariable::currentFunctionValue() const return m_declaration; } -smtutil::Expression SymbolicFunctionVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicFunctionVariable::valueAtIndex(unsigned _index) const { return m_abstract.valueAtIndex(_index); } -smtutil::Expression SymbolicFunctionVariable::functionValueAtIndex(int _index) const +smtutil::Expression SymbolicFunctionVariable::functionValueAtIndex(unsigned _index) const { return SymbolicVariable::valueAtIndex(_index); } @@ -304,7 +304,7 @@ smtutil::Expression SymbolicArrayVariable::currentValue(frontend::TypePointer co return m_pair.currentValue(); } -smtutil::Expression SymbolicArrayVariable::valueAtIndex(int _index) const +smtutil::Expression SymbolicArrayVariable::valueAtIndex(unsigned _index) const { return m_pair.valueAtIndex(_index); } diff --git a/libsolidity/formal/SymbolicVariables.h b/libsolidity/formal/SymbolicVariables.h index a7c0bd1702fc..65dce43f02f8 100644 --- a/libsolidity/formal/SymbolicVariables.h +++ b/libsolidity/formal/SymbolicVariables.h @@ -54,8 +54,8 @@ class SymbolicVariable virtual smtutil::Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const; std::string currentName() const; - virtual smtutil::Expression valueAtIndex(int _index) const; - virtual std::string nameAtIndex(int _index) const; + virtual smtutil::Expression valueAtIndex(unsigned _index) const; + virtual std::string nameAtIndex(unsigned _index) const; virtual smtutil::Expression resetIndex(); virtual smtutil::Expression setIndex(unsigned _index); virtual smtutil::Expression increaseIndex(); @@ -165,10 +165,10 @@ class SymbolicFunctionVariable: public SymbolicVariable // Explicit request the function declaration. smtutil::Expression currentFunctionValue() const; - smtutil::Expression valueAtIndex(int _index) const override; + smtutil::Expression valueAtIndex(unsigned _index) const override; // Explicit request the function declaration. - smtutil::Expression functionValueAtIndex(int _index) const; + smtutil::Expression functionValueAtIndex(unsigned _index) const; smtutil::Expression resetIndex() override; smtutil::Expression setIndex(unsigned _index) override; @@ -251,7 +251,7 @@ class SymbolicArrayVariable: public SymbolicVariable SymbolicArrayVariable(SymbolicArrayVariable&&) = default; smtutil::Expression currentValue(frontend::TypePointer const& _targetType = TypePointer{}) const override; - smtutil::Expression valueAtIndex(int _index) const override; + smtutil::Expression valueAtIndex(unsigned _index) const override; smtutil::Expression resetIndex() override { SymbolicVariable::resetIndex(); return m_pair.resetIndex(); } smtutil::Expression setIndex(unsigned _index) override { SymbolicVariable::setIndex(_index); return m_pair.setIndex(_index); } smtutil::Expression increaseIndex() override { SymbolicVariable::increaseIndex(); return m_pair.increaseIndex(); } diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index f662d361e70b..a8efdfb0b95e 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -982,7 +982,7 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context bestMatchTarget = util::sanitizePath(redir.target); } string path = bestMatchTarget; - path.append(_path.begin() + longestPrefix, _path.end()); + path.append(_path.begin() + static_cast(longestPrefix), _path.end()); return path; } diff --git a/libsolidity/interface/GasEstimator.cpp b/libsolidity/interface/GasEstimator.cpp index 7282b15986b6..1a86f36ceef3 100644 --- a/libsolidity/interface/GasEstimator.cpp +++ b/libsolidity/interface/GasEstimator.cpp @@ -54,8 +54,8 @@ GasEstimator::ASTGasConsumptionSelfAccumulated GasEstimator::structuralEstimatio { solAssert(!!block.startState, ""); GasMeter meter(block.startState->copy(), m_evmVersion); - auto const end = _items.begin() + block.end; - for (auto iter = _items.begin() + block.begin; iter != end; ++iter) + auto const end = _items.begin() + static_cast(block.end); + for (auto iter = _items.begin() + static_cast(block.begin); iter != end; ++iter) particularCosts[iter->location()] += meter.estimateMax(*iter); } diff --git a/libsolidity/interface/StorageLayout.cpp b/libsolidity/interface/StorageLayout.cpp index 8e6915085dd2..806652cfe1b8 100644 --- a/libsolidity/interface/StorageLayout.cpp +++ b/libsolidity/interface/StorageLayout.cpp @@ -50,7 +50,7 @@ Json::Value StorageLayout::generate(VariableDeclaration const& _var, u256 const& TypePointer varType = _var.type(); varEntry["label"] = _var.name(); - varEntry["astId"] = int(_var.id()); + varEntry["astId"] = static_cast(_var.id()); varEntry["contract"] = m_contract->fullyQualifiedName(); varEntry["slot"] = _slot.str(); varEntry["offset"] = _offset; diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index b816de6fd211..2e50fe743549 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -606,7 +606,7 @@ BOOST_AUTO_TEST_CASE(bytesNN_arrays) BOTH_ENCODERS( for (size_t size = 1; size < 15; size++) { - for (size_t width: {1, 2, 4, 5, 7, 15, 16, 17, 31, 32}) + for (size_t width: {1u, 2u, 4u, 5u, 7u, 15u, 16u, 17u, 31u, 32u}) { string source = boost::algorithm::replace_all_copy(sourceCode, "SIZE", to_string(size)); source = boost::algorithm::replace_all_copy(source, "UINTWIDTH", to_string(width * 8)); @@ -651,7 +651,7 @@ BOOST_AUTO_TEST_CASE(bytesNN_arrays_dyn) BOTH_ENCODERS( for (size_t size = 0; size < 15; size++) { - for (size_t width: {1, 2, 4, 5, 7, 15, 16, 17, 31, 32}) + for (size_t width: {1u, 2u, 4u, 5u, 7u, 15u, 16u, 17u, 31u, 32u}) { string source = boost::algorithm::replace_all_copy(sourceCode, "SIZE", to_string(size)); source = boost::algorithm::replace_all_copy(source, "UINTWIDTH", to_string(width * 8)); diff --git a/test/libsolidity/SMTCheckerJSONTest.cpp b/test/libsolidity/SMTCheckerJSONTest.cpp index 484db13fff0e..396ecb280b27 100644 --- a/test/libsolidity/SMTCheckerJSONTest.cpp +++ b/test/libsolidity/SMTCheckerJSONTest.cpp @@ -116,21 +116,21 @@ TestCase::TestResult SMTCheckerJSONTest::run(ostream& _stream, string const& _li !location["end"].isInt() ) BOOST_THROW_EXCEPTION(runtime_error("Error must have a SourceLocation with start and end.")); - int start = location["start"].asInt(); - int end = location["end"].asInt(); + size_t start = location["start"].asUInt(); + size_t end = location["end"].asUInt(); std::string sourceName; if (location.isMember("source") && location["source"].isString()) sourceName = location["source"].asString(); - if (start >= static_cast(preamble.size())) + if (start >= preamble.size()) start -= preamble.size(); - if (end >= static_cast(preamble.size())) + if (end >= preamble.size()) end -= preamble.size(); m_errorList.emplace_back(SyntaxTestError{ error["type"].asString(), error["message"].asString(), sourceName, - start, - end + static_cast(start), + static_cast(end) }); } } diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index d40e64ebf5fd..41c850b4d90f 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -143,8 +143,8 @@ bytes compileFirstExpression( ); context.resetVisitedNodes(contract); context.setMostDerivedContract(*contract); - unsigned parametersSize = _localVariables.size(); // assume they are all one slot on the stack - context.adjustStackOffset(parametersSize); + size_t parametersSize = _localVariables.size(); // assume they are all one slot on the stack + context.adjustStackOffset(static_cast(parametersSize)); for (vector const& variable: _localVariables) context.addVariable( dynamic_cast(resolveDeclaration(*sourceUnit, variable, resolver)), diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index fec67f0e6a18..4062b1928b2b 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -491,7 +491,7 @@ BOOST_AUTO_TEST_CASE(constant_optimization_early_exit) #endif #endif #if __SANITIZE_ADDRESS__ - maxDuration = size_t(-1); + maxDuration = numeric_limits::max(); BOOST_TEST_MESSAGE("Disabled constant optimizer run time check for address sanitizer build."); #endif BOOST_CHECK_MESSAGE(duration <= maxDuration, "Compilation of constants took longer than 20 seconds."); diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 12fbc3fcec35..364c0e2d56ac 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -675,7 +675,7 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location) bool visit(InlineAssembly const& _inlineAsm) override { auto loc = _inlineAsm.location(); - auto asmStr = loc.source->source().substr(loc.start, loc.end - loc.start); + auto asmStr = loc.source->source().substr(static_cast(loc.start), static_cast(loc.end - loc.start)); BOOST_CHECK_EQUAL(asmStr, "assembly { a := 0x12345678 }"); visited = true; diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 55a77ed3090f..47411748e941 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -98,9 +98,9 @@ void SyntaxTest::filterObtainedErrors() { // ignore the version & license pragma inserted by the testing tool when calculating locations. if (location->start >= static_cast(preamble.size())) - locationStart = location->start - (preamble.size()); + locationStart = location->start - static_cast(preamble.size()); if (location->end >= static_cast(preamble.size())) - locationEnd = location->end - (preamble.size()); + locationEnd = location->end - static_cast(preamble.size()); if (location->source) sourceName = location->source->name(); } diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index 72f7c7594975..fd2cd2fcf730 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -348,10 +348,10 @@ string BytesUtils::formatBytesRange( size_t BytesUtils::countRightPaddedZeros(bytes const& _bytes) { - return find_if( + return static_cast(find_if( _bytes.rbegin(), _bytes.rend(), [](uint8_t b) { return b != '\0'; } - ) - _bytes.rbegin(); + ) - _bytes.rbegin()); } diff --git a/test/libsolidity/util/TestFileParserTests.cpp b/test/libsolidity/util/TestFileParserTests.cpp index d24a80b95290..4fb44d7cdd07 100644 --- a/test/libsolidity/util/TestFileParserTests.cpp +++ b/test/libsolidity/util/TestFileParserTests.cpp @@ -66,7 +66,7 @@ void testFunctionCall( ABI_CHECK(_call.expectations.rawBytes(), _expectations); BOOST_REQUIRE_EQUAL(_call.displayMode, _mode); BOOST_REQUIRE_EQUAL(_call.value.value, _value.value); - BOOST_REQUIRE_EQUAL(size_t(_call.value.unit), size_t(_value.unit)); + BOOST_REQUIRE_EQUAL(static_cast(_call.value.unit), static_cast(_value.unit)); BOOST_REQUIRE_EQUAL(_call.arguments.comment, _argumentComment); BOOST_REQUIRE_EQUAL(_call.expectations.comment, _expectationComment); From b17915a6ba84a5f2373a03c40c4b0d893f3ae625 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sat, 30 May 2020 01:42:36 +0200 Subject: [PATCH 220/479] Add error IDs to JSON --- Changelog.md | 1 + docs/using-the-compiler.rst | 4 +++- libsolidity/interface/StandardCompiler.cpp | 13 ++++++++++--- .../output_selection_all_A1/output.json | 6 +++--- .../output_selection_all_A2/output.json | 6 +++--- .../output_selection_all_blank/output.json | 6 +++--- .../output_selection_all_star/output.json | 6 +++--- .../output_selection_single_A1/output.json | 2 +- .../output_selection_single_B1/output.json | 4 ++-- .../output_selection_single_all/output.json | 2 +- .../cmdlineTests/recovery_standard_json/output.json | 4 ++-- .../standard_empty_file_name/output.json | 2 +- .../standard_immutable_references/output.json | 2 +- .../standard_secondary_source_location/output.json | 2 +- test/cmdlineTests/storage_layout_bytes/output.json | 2 +- .../storage_layout_dyn_array/output.json | 2 +- test/cmdlineTests/storage_layout_many/output.json | 2 +- .../cmdlineTests/storage_layout_mapping/output.json | 2 +- test/cmdlineTests/storage_layout_smoke/output.json | 2 +- .../storage_layout_smoke_two_contracts/output.json | 2 +- test/cmdlineTests/storage_layout_string/output.json | 2 +- test/cmdlineTests/storage_layout_struct/output.json | 2 +- .../storage_layout_struct_packed/output.json | 2 +- .../storage_layout_value_types/output.json | 2 +- .../storage_layout_value_types_packed/output.json | 2 +- test/libsolidity/StandardCompiler.cpp | 2 +- 26 files changed, 47 insertions(+), 37 deletions(-) diff --git a/Changelog.md b/Changelog.md index 5da6cb372451..417dacef67a4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Language Features: Compiler Features: * Yul: Raise warning for switch statements that only have a default and no other cases. + * Add error codes to JSON output. Bugfixes: diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 3f0252884d7b..65f3f7acee99 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -374,8 +374,10 @@ Output Description "component": "general", // Mandatory ("error" or "warning") "severity": "error", + // Optional: unique code for the cause of the error + "errorCode": "3141", // Mandatory - "message": "Invalid keyword" + "message": "Invalid keyword", // Optional: the message formatted with source location "formattedMessage": "sourceFile.sol:100: Invalid keyword" } diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index e04b0b2f17a6..7293f94bc8fb 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -111,7 +111,8 @@ Json::Value formatErrorWithException( bool const& _warning, string const& _type, string const& _component, - string const& _message + string const& _message, + optional _errorId = nullopt ) { string message; @@ -122,7 +123,7 @@ Json::Value formatErrorWithException( else message = _message; - return formatError( + Json::Value error = formatError( _warning, _type, _component, @@ -131,6 +132,11 @@ Json::Value formatErrorWithException( formatSourceLocation(boost::get_error_info(_exception)), formatSecondarySourceLocation(boost::get_error_info(_exception)) ); + + if (_errorId) + error["errorCode"] = to_string(_errorId.value().error); + + return error; } map> requestedContractNames(Json::Value const& _outputSelection) @@ -857,7 +863,8 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting err.type() == Error::Type::Warning, err.typeName(), "general", - "" + "", + err.errorId() )); } } diff --git a/test/cmdlineTests/output_selection_all_A1/output.json b/test/cmdlineTests/output_selection_all_A1/output.json index 074b2062b216..1e4a0b11f85b 100644 --- a/test/cmdlineTests/output_selection_all_A1/output.json +++ b/test/cmdlineTests/output_selection_all_A1/output.json @@ -1,6 +1,6 @@ -{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure +{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } } ^------------------------------------------^ ","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":93,"file":"b.sol","start":49},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_all_A2/output.json b/test/cmdlineTests/output_selection_all_A2/output.json index aa2ca9d0e121..5b0b55bbf6aa 100644 --- a/test/cmdlineTests/output_selection_all_A2/output.json +++ b/test/cmdlineTests/output_selection_all_A2/output.json @@ -1,6 +1,6 @@ -{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure +{"contracts":{"a.sol":{"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } } ^------------------------------------------^ ","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":93,"file":"b.sol","start":49},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_all_blank/output.json b/test/cmdlineTests/output_selection_all_blank/output.json index e0872ca8cbdf..32c04bf8ed9c 100644 --- a/test/cmdlineTests/output_selection_all_blank/output.json +++ b/test/cmdlineTests/output_selection_all_blank/output.json @@ -1,6 +1,6 @@ -{"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure +{"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } } ^------------------------------------------^ ","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":93,"file":"b.sol","start":49},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_all_star/output.json b/test/cmdlineTests/output_selection_all_star/output.json index 8997ed8e2dc6..d885876d905e 100644 --- a/test/cmdlineTests/output_selection_all_star/output.json +++ b/test/cmdlineTests/output_selection_all_star/output.json @@ -1,6 +1,6 @@ -{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure +{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}},"b.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } } ^------------------------------------------^ ","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":93,"file":"b.sol","start":49},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_single_A1/output.json b/test/cmdlineTests/output_selection_single_A1/output.json index 5bdef1db92be..b32b519ddbb1 100644 --- a/test/cmdlineTests/output_selection_single_A1/output.json +++ b/test/cmdlineTests/output_selection_single_A1/output.json @@ -1,2 +1,2 @@ -{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_single_B1/output.json b/test/cmdlineTests/output_selection_single_B1/output.json index c9c929b971f7..aeb29d7aefb5 100644 --- a/test/cmdlineTests/output_selection_single_B1/output.json +++ b/test/cmdlineTests/output_selection_single_B1/output.json @@ -1,5 +1,5 @@ -{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! -","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure +{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"b.sol: Warning: Source file does not specify required compiler version! +","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"b.sol","start":-1},"type":"Warning"},{"component":"general","errorCode":"2018","formattedMessage":"b.sol:2:15: Warning: Function state mutability can be restricted to pure contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } } ^------------------------------------------^ ","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":93,"file":"b.sol","start":49},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/output_selection_single_all/output.json b/test/cmdlineTests/output_selection_single_all/output.json index f9203fa301e2..07b1a5453d7e 100644 --- a/test/cmdlineTests/output_selection_single_all/output.json +++ b/test/cmdlineTests/output_selection_single_all/output.json @@ -1,2 +1,2 @@ -{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +{"contracts":{"a.sol":{"A1":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}},"A2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}} diff --git a/test/cmdlineTests/recovery_standard_json/output.json b/test/cmdlineTests/recovery_standard_json/output.json index 18a3b97ce2fd..a4113e18679e 100644 --- a/test/cmdlineTests/recovery_standard_json/output.json +++ b/test/cmdlineTests/recovery_standard_json/output.json @@ -1,7 +1,7 @@ -{"errors":[{"component":"general","formattedMessage":"A:2:58: ParserError: Expected type name +{"errors":[{"component":"general","errorCode":"3546","formattedMessage":"A:2:58: ParserError: Expected type name pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ } ^ -","message":"Expected type name","severity":"error","sourceLocation":{"end":94,"file":"A","start":93},"type":"ParserError"},{"component":"general","formattedMessage":"A:2:84: Warning: Recovered in ContractDefinition at '}'. +","message":"Expected type name","severity":"error","sourceLocation":{"end":94,"file":"A","start":93},"type":"ParserError"},{"component":"general","errorCode":"3796","formattedMessage":"A:2:84: Warning: Recovered in ContractDefinition at '}'. pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ } ^ ","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":120,"file":"A","start":119},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[3]},"id":4,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":3,"linearizedBaseContracts":[3],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}} diff --git a/test/cmdlineTests/standard_empty_file_name/output.json b/test/cmdlineTests/standard_empty_file_name/output.json index d1ab4c870f36..04bc54a92a9f 100644 --- a/test/cmdlineTests/standard_empty_file_name/output.json +++ b/test/cmdlineTests/standard_empty_file_name/output.json @@ -1,4 +1,4 @@ -{"errors":[{"component":"general","formattedMessage":":2:24: DeclarationError: Declaration \"A\" not found in \"\" (referenced as \".\"). +{"errors":[{"component":"general","errorCode":"2904","formattedMessage":":2:24: DeclarationError: Declaration \"A\" not found in \"\" (referenced as \".\"). pragma solidity >=0.0; import {A} from \".\"; ^------------------^ ","message":"Declaration \"A\" not found in \"\" (referenced as \".\").","severity":"error","type":"DeclarationError"}],"sources":{}} diff --git a/test/cmdlineTests/standard_immutable_references/output.json b/test/cmdlineTests/standard_immutable_references/output.json index f39a67c07a5d..48376adc5860 100644 --- a/test/cmdlineTests/standard_immutable_references/output.json +++ b/test/cmdlineTests/standard_immutable_references/output.json @@ -1,2 +1,2 @@ -{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}} diff --git a/test/cmdlineTests/standard_secondary_source_location/output.json b/test/cmdlineTests/standard_secondary_source_location/output.json index d9f56b80d688..b32b00028f95 100644 --- a/test/cmdlineTests/standard_secondary_source_location/output.json +++ b/test/cmdlineTests/standard_secondary_source_location/output.json @@ -1,4 +1,4 @@ -{"errors":[{"component":"general","formattedMessage":"A:2:112: DeclarationError: Base constructor arguments given twice. +{"errors":[{"component":"general","errorCode":"3364","formattedMessage":"A:2:112: DeclarationError: Base constructor arguments given twice. pragma solidity >=0.0; contract A { constructor(uint) public {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} ^-------------------^ A:2:81: First constructor call is here: diff --git a/test/cmdlineTests/storage_layout_bytes/output.json b/test/cmdlineTests/storage_layout_bytes/output.json index 4414b07d58c2..613189a2a869 100644 --- a/test/cmdlineTests/storage_layout_bytes/output.json +++ b/test/cmdlineTests/storage_layout_bytes/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_bytes_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_bytes_storage"}],"types":{"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_bytes_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_bytes_storage"}],"types":{"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_dyn_array/output.json b/test/cmdlineTests/storage_layout_dyn_array/output.json index 0581b35a1e93..8be650aa54f5 100644 --- a/test/cmdlineTests/storage_layout_dyn_array/output.json +++ b/test/cmdlineTests/storage_layout_dyn_array/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"array1","offset":0,"slot":"0","type":"t_array(t_uint256)dyn_storage"},{"astId":6,"contract":"fileA:A","label":"array2","offset":0,"slot":"1","type":"t_array(t_bool)dyn_storage"}],"types":{"t_array(t_bool)dyn_storage":{"base":"t_bool","encoding":"dynamic_array","label":"bool[]","numberOfBytes":"32"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"array1","offset":0,"slot":"0","type":"t_array(t_uint256)dyn_storage"},{"astId":6,"contract":"fileA:A","label":"array2","offset":0,"slot":"1","type":"t_array(t_bool)dyn_storage"}],"types":{"t_array(t_bool)dyn_storage":{"base":"t_bool","encoding":"dynamic_array","label":"bool[]","numberOfBytes":"32"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_many/output.json b/test/cmdlineTests/storage_layout_many/output.json index 8e14940a9347..a413e1027c1e 100644 --- a/test/cmdlineTests/storage_layout_many/output.json +++ b/test/cmdlineTests/storage_layout_many/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":26,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":29,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":31,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":33,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":26,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":29,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":31,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":33,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_mapping/output.json b/test/cmdlineTests/storage_layout_mapping/output.json index c380197cae0e..e3a4944fd2dc 100644 --- a/test/cmdlineTests/storage_layout_mapping/output.json +++ b/test/cmdlineTests/storage_layout_mapping/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":10,"contract":"fileA:A","label":"map","offset":0,"slot":"2","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":10,"contract":"fileA:A","label":"map","offset":0,"slot":"2","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_smoke/output.json b/test/cmdlineTests/storage_layout_smoke/output.json index fb8c544c6f6c..c5830bb00678 100644 --- a/test/cmdlineTests/storage_layout_smoke/output.json +++ b/test/cmdlineTests/storage_layout_smoke/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_smoke_two_contracts/output.json b/test/cmdlineTests/storage_layout_smoke_two_contracts/output.json index abbace7a94eb..8ec54ae260af 100644 --- a/test/cmdlineTests/storage_layout_smoke_two_contracts/output.json +++ b/test/cmdlineTests/storage_layout_smoke_two_contracts/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0},"fileB":{"id":1}}} diff --git a/test/cmdlineTests/storage_layout_string/output.json b/test/cmdlineTests/storage_layout_string/output.json index 6ce9e236db4c..59312174fa71 100644 --- a/test/cmdlineTests/storage_layout_string/output.json +++ b/test/cmdlineTests/storage_layout_string/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_string_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_string_storage"}],"types":{"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_string_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_string_storage"}],"types":{"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_struct/output.json b/test/cmdlineTests/storage_layout_struct/output.json index 6437d599ab2f..e8c2d6fdc498 100644 --- a/test/cmdlineTests/storage_layout_struct/output.json +++ b/test/cmdlineTests/storage_layout_struct/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_struct_packed/output.json b/test/cmdlineTests/storage_layout_struct_packed/output.json index 44adfefda243..7ac8c11eb5e8 100644 --- a/test/cmdlineTests/storage_layout_struct_packed/output.json +++ b/test/cmdlineTests/storage_layout_struct_packed/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_value_types/output.json b/test/cmdlineTests/storage_layout_value_types/output.json index 8b9d2437ffbf..2d10422a5a55 100644 --- a/test/cmdlineTests/storage_layout_value_types/output.json +++ b/test/cmdlineTests/storage_layout_value_types/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":6,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":10,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":6,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":10,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/cmdlineTests/storage_layout_value_types_packed/output.json b/test/cmdlineTests/storage_layout_value_types_packed/output.json index c7d9563616ee..634cb9305a8d 100644 --- a/test/cmdlineTests/storage_layout_value_types_packed/output.json +++ b/test/cmdlineTests/storage_layout_value_types_packed/output.json @@ -1,2 +1,2 @@ -{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint64"},{"astId":4,"contract":"fileA:A","label":"y","offset":8,"slot":"0","type":"t_uint128"},{"astId":6,"contract":"fileA:A","label":"z","offset":0,"slot":"1","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":12,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"},"t_uint64":{"encoding":"inplace","label":"uint64","numberOfBytes":"8"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! +{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint64"},{"astId":4,"contract":"fileA:A","label":"y","offset":8,"slot":"0","type":"t_uint128"},{"astId":6,"contract":"fileA:A","label":"z","offset":0,"slot":"1","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":12,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"},"t_uint64":{"encoding":"inplace","label":"uint64","numberOfBytes":"8"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}} diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 3b7b1d1284f8..f8ae1d873cf4 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -466,7 +466,7 @@ BOOST_AUTO_TEST_CASE(compilation_error) { BOOST_CHECK_EQUAL( util::jsonCompactPrint(error), - "{\"component\":\"general\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected identifier but got '}'\\n" + "{\"component\":\"general\",\"errorCode\":\"2314\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected identifier but got '}'\\n" "contract A { function }\\n ^\\n\",\"message\":\"Expected identifier but got '}'\"," "\"severity\":\"error\",\"sourceLocation\":{\"end\":23,\"file\":\"fileA\",\"start\":22},\"type\":\"ParserError\"}" ); From 51e64fe0b1c9e1b750f61e86104a2c063f37b6eb Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 4 Jun 2020 03:19:47 +0200 Subject: [PATCH 221/479] Add error IDs to console output --- Changelog.md | 2 +- liblangutil/SourceReferenceExtractor.cpp | 10 ++++++- liblangutil/SourceReferenceExtractor.h | 12 ++++----- liblangutil/SourceReferenceFormatter.cpp | 5 +--- liblangutil/SourceReferenceFormatterHuman.cpp | 2 ++ liblangutil/SourceReferenceFormatterHuman.h | 18 +++++-------- solc/CommandLineInterface.cpp | 12 +++++++-- solc/CommandLineInterface.h | 2 ++ test/cmdlineTests.sh | 1 + test/cmdlineTests/error_codes/args | 1 + test/cmdlineTests/error_codes/err | 26 +++++++++++++++++++ test/cmdlineTests/error_codes/exit | 1 + test/cmdlineTests/error_codes/input.sol | 8 ++++++ test/libsolidity/ASTJSONTest.cpp | 2 +- test/libsolidity/GasTest.cpp | 2 +- tools/solidityUpgrade/SourceUpgrade.cpp | 2 +- tools/solidityUpgrade/UpgradeChange.cpp | 2 +- 17 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 test/cmdlineTests/error_codes/args create mode 100644 test/cmdlineTests/error_codes/err create mode 100644 test/cmdlineTests/error_codes/exit create mode 100644 test/cmdlineTests/error_codes/input.sol diff --git a/Changelog.md b/Changelog.md index 417dacef67a4..bfe5b0d011bd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,7 +5,7 @@ Language Features: Compiler Features: * Yul: Raise warning for switch statements that only have a default and no other cases. - * Add error codes to JSON output. + * Output compilation error codes. Bugfixes: diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 0a6ff0421ba1..89f84011db71 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -38,7 +38,15 @@ SourceReferenceExtractor::Message SourceReferenceExtractor::extract(util::Except for (auto const& info: secondaryLocation->infos) secondary.emplace_back(extract(&info.second, info.first)); - return Message{std::move(primary), _category, std::move(secondary)}; + return Message{std::move(primary), _category, std::move(secondary), nullopt}; +} + +SourceReferenceExtractor::Message SourceReferenceExtractor::extract(Error const& _error) +{ + string category = (_error.type() == Error::Type::Warning) ? "Warning" : "Error"; + Message message = extract(_error, category); + message.errorId = _error.errorId(); + return message; } SourceReference SourceReferenceExtractor::extract(SourceLocation const* _location, std::string message) diff --git a/liblangutil/SourceReferenceExtractor.h b/liblangutil/SourceReferenceExtractor.h index 6aa0ab34a812..b9dababb9671 100644 --- a/liblangutil/SourceReferenceExtractor.h +++ b/liblangutil/SourceReferenceExtractor.h @@ -16,16 +16,14 @@ */ #pragma once +#include + #include +#include #include #include #include -namespace solidity::util -{ -struct Exception; -} - namespace solidity::langutil { @@ -58,8 +56,6 @@ struct SourceReference } }; -struct SourceLocation; - namespace SourceReferenceExtractor { struct Message @@ -67,9 +63,11 @@ namespace SourceReferenceExtractor SourceReference primary; std::string category; // "Error", "Warning", ... std::vector secondary; + std::optional errorId; }; Message extract(util::Exception const& _exception, std::string _category); + Message extract(Error const& _error); SourceReference extract(SourceLocation const* _location, std::string message = ""); } diff --git a/liblangutil/SourceReferenceFormatter.cpp b/liblangutil/SourceReferenceFormatter.cpp index 965755a10cbe..e10f251d5b21 100644 --- a/liblangutil/SourceReferenceFormatter.cpp +++ b/liblangutil/SourceReferenceFormatter.cpp @@ -80,10 +80,7 @@ void SourceReferenceFormatter::printExceptionInformation(util::Exception const& void SourceReferenceFormatter::printErrorInformation(Error const& _error) { - printExceptionInformation( - _error, - (_error.type() == Error::Type::Warning) ? "Warning" : "Error" - ); + printExceptionInformation(SourceReferenceExtractor::extract(_error)); } void SourceReferenceFormatter::printExceptionInformation(SourceReferenceExtractor::Message const& _msg) diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index 3560955c7aa1..998ca7bf59b6 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -151,6 +151,8 @@ void SourceReferenceFormatterHuman::printExceptionInformation(SourceReferenceExt { // exception header line errorColored() << _msg.category; + if (m_withErrorIds && _msg.errorId.has_value()) + errorColored() << " (" << _msg.errorId.value().error << ")"; messageColored() << ": " << _msg.primary.message << '\n'; printSourceLocation(_msg.primary); diff --git a/liblangutil/SourceReferenceFormatterHuman.h b/liblangutil/SourceReferenceFormatterHuman.h index 060adc00e362..b468f375651b 100644 --- a/liblangutil/SourceReferenceFormatterHuman.h +++ b/liblangutil/SourceReferenceFormatterHuman.h @@ -29,22 +29,14 @@ #include #include -namespace solidity::util -{ -struct Exception; // forward -} - namespace solidity::langutil { -struct SourceLocation; -struct SourceReference; - class SourceReferenceFormatterHuman: public SourceReferenceFormatter { public: - SourceReferenceFormatterHuman(std::ostream& _stream, bool colored): - SourceReferenceFormatter{_stream}, m_colored{colored} + SourceReferenceFormatterHuman(std::ostream& _stream, bool _colored, bool _withErrorIds): + SourceReferenceFormatter{_stream}, m_colored{_colored}, m_withErrorIds(_withErrorIds) {} void printSourceLocation(SourceReference const& _ref) override; @@ -54,12 +46,13 @@ class SourceReferenceFormatterHuman: public SourceReferenceFormatter static std::string formatExceptionInformation( util::Exception const& _exception, std::string const& _name, - bool colored = false + bool _colored = false, + bool _withErrorIds = false ) { std::ostringstream errorOutput; - SourceReferenceFormatterHuman formatter(errorOutput, colored); + SourceReferenceFormatterHuman formatter(errorOutput, _colored, _withErrorIds); formatter.printExceptionInformation(_exception, _name); return errorOutput.str(); } @@ -75,6 +68,7 @@ class SourceReferenceFormatterHuman: public SourceReferenceFormatter private: bool m_colored; + bool m_withErrorIds; }; } diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index e84ce6dd325b..8b6117a2d38a 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -177,6 +177,7 @@ static string const g_strVersion = "version"; static string const g_strIgnoreMissingFiles = "ignore-missing"; static string const g_strColor = "color"; static string const g_strNoColor = "no-color"; +static string const g_strErrorIds = "error-codes"; static string const g_strOldReporter = "old-reporter"; static string const g_argAbi = g_strAbi; @@ -222,6 +223,7 @@ static string const g_stdinFileName = g_stdinFileNameStr; static string const g_argIgnoreMissingFiles = g_strIgnoreMissingFiles; static string const g_argColor = g_strColor; static string const g_argNoColor = g_strNoColor; +static string const g_argErrorIds = g_strErrorIds; static string const g_argOldReporter = g_strOldReporter; /// Possible arguments to for --combined-json @@ -876,6 +878,10 @@ General Information)").c_str(), g_argNoColor.c_str(), "Explicitly disable colored output, disabling terminal auto-detection." ) + ( + g_argErrorIds.c_str(), + "Output error codes." + ) ( g_argOldReporter.c_str(), "Enables old diagnostics reporter (legacy option, will be removed)." @@ -989,6 +995,8 @@ General Information)").c_str(), m_coloredOutput = !m_args.count(g_argNoColor) && (isatty(STDERR_FILENO) || m_args.count(g_argColor)); + m_withErrorIds = m_args.count(g_argErrorIds); + if (m_args.count(g_argHelp) || (isatty(fileno(stdin)) && _argc == 1)) { sout() << desc; @@ -1294,7 +1302,7 @@ bool CommandLineInterface::processInput() if (m_args.count(g_argOldReporter)) formatter = make_unique(serr(false)); else - formatter = make_unique(serr(false), m_coloredOutput); + formatter = make_unique(serr(false), m_coloredOutput, m_withErrorIds); try { @@ -1732,7 +1740,7 @@ bool CommandLineInterface::assemble( if (m_args.count(g_argOldReporter)) formatter = make_unique(serr(false)); else - formatter = make_unique(serr(false), m_coloredOutput); + formatter = make_unique(serr(false), m_coloredOutput, m_withErrorIds); for (auto const& error: stack.errors()) { diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 00b9181ec069..2c871a670e8a 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -131,6 +131,8 @@ class CommandLineInterface CompilerStack::MetadataHash m_metadataHash = CompilerStack::MetadataHash::IPFS; /// Whether or not to colorize diagnostics output. bool m_coloredOutput = true; + /// Whether or not to output error IDs. + bool m_withErrorIds = false; }; } diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 07e249492c3e..448ba5a6e5ef 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -121,6 +121,7 @@ function test_solc_behaviour() rm "$stdout_path.bak" else sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path" + sed -i.bak -e '/^Warning (3805): This is a pre-release compiler version, please do not use it in production./d' "$stderr_path" sed -i.bak -e 's/\(^[ ]*auxdata: \)0x[0-9a-f]*$/\1AUXDATA REMOVED/' "$stdout_path" sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path" # Remove trailing empty lines. Needs a line break to make OSX sed happy. diff --git a/test/cmdlineTests/error_codes/args b/test/cmdlineTests/error_codes/args new file mode 100644 index 000000000000..330f811c7ac6 --- /dev/null +++ b/test/cmdlineTests/error_codes/args @@ -0,0 +1 @@ +--error-codes diff --git a/test/cmdlineTests/error_codes/err b/test/cmdlineTests/error_codes/err new file mode 100644 index 000000000000..1d983a7fd19e --- /dev/null +++ b/test/cmdlineTests/error_codes/err @@ -0,0 +1,26 @@ +Error (4937): No visibility specified. Did you intend to add "public"? + --> error_codes/input.sol:4:5: + | +4 | function f() { + | ^ (Relevant source part starts here and spans across multiple lines). + +Warning (3420): Source file does not specify required compiler version! +--> error_codes/input.sol + +Error (4247): Expression has to be an lvalue. + --> error_codes/input.sol:5:9: + | +5 | 2=0; + | ^ + +Error (7407): Type int_const 0 is not implicitly convertible to expected type int_const 2. + --> error_codes/input.sol:5:11: + | +5 | 2=0; + | ^ + +Error (2614): Indexed expression has to be a type, mapping or array (is literal_string "") + --> error_codes/input.sol:6:9: + | +6 | ""[2]; + | ^^ diff --git a/test/cmdlineTests/error_codes/exit b/test/cmdlineTests/error_codes/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/error_codes/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/error_codes/input.sol b/test/cmdlineTests/error_codes/input.sol new file mode 100644 index 000000000000..78aceb41f1e3 --- /dev/null +++ b/test/cmdlineTests/error_codes/input.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 + +contract C { + function f() { + 2=0; + ""[2]; + } +} diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp index 3cc8b3ab31a7..974e0f4863c9 100644 --- a/test/libsolidity/ASTJSONTest.cpp +++ b/test/libsolidity/ASTJSONTest.cpp @@ -134,7 +134,7 @@ TestCase::TestResult ASTJSONTest::run(ostream& _stream, string const& _linePrefi c.analyze(); else { - SourceReferenceFormatterHuman formatter(_stream, _formatted); + SourceReferenceFormatterHuman formatter(_stream, _formatted, false); for (auto const& error: c.errors()) formatter.printErrorInformation(*error); return TestResult::FatalError; diff --git a/test/libsolidity/GasTest.cpp b/test/libsolidity/GasTest.cpp index 893a20715f2e..d76979c9c7b6 100644 --- a/test/libsolidity/GasTest.cpp +++ b/test/libsolidity/GasTest.cpp @@ -118,7 +118,7 @@ TestCase::TestResult GasTest::run(ostream& _stream, string const& _linePrefix, b if (!compiler().parseAndAnalyze() || !compiler().compile()) { - SourceReferenceFormatterHuman formatter(_stream, _formatted); + SourceReferenceFormatterHuman formatter(_stream, _formatted, false); for (auto const& error: compiler().errors()) formatter.printErrorInformation(*error); return TestResult::FatalError; diff --git a/tools/solidityUpgrade/SourceUpgrade.cpp b/tools/solidityUpgrade/SourceUpgrade.cpp index 8c05ecc9fda2..7005fd336155 100644 --- a/tools/solidityUpgrade/SourceUpgrade.cpp +++ b/tools/solidityUpgrade/SourceUpgrade.cpp @@ -390,7 +390,7 @@ void SourceUpgrade::applyChange( void SourceUpgrade::printErrors() const { - auto formatter = make_unique(cout, true); + auto formatter = make_unique(cout, true, false); for (auto const& error: m_compiler->errors()) if (error->type() != langutil::Error::Type::Warning) diff --git a/tools/solidityUpgrade/UpgradeChange.cpp b/tools/solidityUpgrade/UpgradeChange.cpp index ff7d6d68f575..a897a4e130dc 100644 --- a/tools/solidityUpgrade/UpgradeChange.cpp +++ b/tools/solidityUpgrade/UpgradeChange.cpp @@ -36,7 +36,7 @@ void UpgradeChange::apply() void UpgradeChange::log(bool const _shorten) const { stringstream os; - SourceReferenceFormatterHuman formatter{os, true}; + SourceReferenceFormatterHuman formatter{os, true, false}; string start = to_string(m_location.start); string end = to_string(m_location.end); From 3d115a28fd5c8cec43d773c7cbad5f9398e0ebbb Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2020 11:24:35 +0200 Subject: [PATCH 222/479] Fix documentation example. --- docs/types/reference-types.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 6283eaa0e46d..5bd242f06b99 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -430,7 +430,13 @@ Array slices are useful to ABI-decode secondary data passed in function paramete /// Forward call to "setOwner(address)" that is implemented by client /// after doing basic validation on the address argument. function forward(bytes calldata _payload) external { - bytes4 sig = abi.decode(_payload[:4], (bytes4)); + // Since ABI decoding requires padded data, we cannot + // use abi.decode(_payload[:4], (bytes4)). + bytes4 sig = + _payload[0] | + (bytes4(_payload[1]) >> 8) | + (bytes4(_payload[2]) >> 16) | + (bytes4(_payload[3]) >> 24); if (sig == bytes4(keccak256("setOwner(address)"))) { address owner = abi.decode(_payload[4:], (address)); require(owner != address(0), "Address of owner cannot be zero."); From e73fe1727708c656e13d4d944e0e8ccd12991e0d Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 5 Jun 2020 10:37:00 +0200 Subject: [PATCH 223/479] Fixing ICE on calling externally a function that returns calldata pointers Co-authored-by: chriseth --- Changelog.md | 4 +--- libsolidity/ast/TypeProvider.h | 12 +++++++++-- libsolidity/ast/Types.cpp | 20 +++++++++++++------ .../calldata/calldata_bytes_external.sol | 12 +++++++++++ 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol diff --git a/Changelog.md b/Changelog.md index 5da6cb372451..83801c65c473 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,15 +2,13 @@ Language Features: - Compiler Features: * Yul: Raise warning for switch statements that only have a default and no other cases. - Bugfixes: * SMTChecker: Fix internal error when encoding tuples of tuples. * SMTChecker: Fix aliasing soundness after pushing to an array pointer. - + * Type system: Fix internal compiler error on calling externally a function that returns variables with calldata location. ### 0.6.9 (2020-06-04) diff --git a/libsolidity/ast/TypeProvider.h b/libsolidity/ast/TypeProvider.h index 38f2642eb8df..a86542d1688a 100644 --- a/libsolidity/ast/TypeProvider.h +++ b/libsolidity/ast/TypeProvider.h @@ -112,14 +112,22 @@ class TypeProvider /// @returns a copy of @a _type having the same location as this (and is not a pointer type) /// if _type is a reference type and an unmodified copy of _type otherwise. /// This function is mostly useful to modify inner types appropriately. - static Type const* withLocationIfReference(DataLocation _location, Type const* _type) + static Type const* withLocationIfReference(DataLocation _location, Type const* _type, bool _isPointer = false) { if (auto refType = dynamic_cast(_type)) - return withLocation(refType, _location, false); + return withLocation(refType, _location, _isPointer); return _type; } + static bool isReferenceWithLocation(Type const* _type, DataLocation _location) + { + if (auto const* refType = dynamic_cast(_type)) + if (refType->location() == _location) + return true; + return false; + } + /// @returns the internally-facing or externally-facing type of a function or the type of a function declaration. static FunctionType const* function(FunctionDefinition const& _function, FunctionType::Kind _kind = FunctionType::Kind::Declaration); diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 66681ea10790..8114be800c61 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3445,13 +3445,21 @@ FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, TypePointers parameterTypes; for (auto const& t: m_parameterTypes) - { - auto refType = dynamic_cast(t); - if (refType && refType->location() == DataLocation::CallData) - parameterTypes.push_back(TypeProvider::withLocation(refType, DataLocation::Memory, true)); + if (TypeProvider::isReferenceWithLocation(t, DataLocation::CallData)) + parameterTypes.push_back( + TypeProvider::withLocationIfReference(DataLocation::Memory, t, true) + ); else parameterTypes.push_back(t); - } + + TypePointers returnParameterTypes; + for (auto const& returnParamType: m_returnParameterTypes) + if (TypeProvider::isReferenceWithLocation(returnParamType, DataLocation::CallData)) + returnParameterTypes.push_back( + TypeProvider::withLocationIfReference(DataLocation::Memory, returnParamType, true) + ); + else + returnParameterTypes.push_back(returnParamType); Kind kind = m_kind; if (_inLibrary) @@ -3465,7 +3473,7 @@ FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, return TypeProvider::function( parameterTypes, - m_returnParameterTypes, + returnParameterTypes, m_parameterNames, m_returnParameterNames, kind, diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol new file mode 100644 index 000000000000..9917e736a945 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol @@ -0,0 +1,12 @@ +contract CalldataTest { + function test(bytes calldata x) public returns (bytes calldata) { + return x; + } + function tester(bytes calldata x) public returns (byte) { + return this.test(x)[2]; + } +} +// ==== +// EVMVersion: >=byzantium +// ---- +// tester(bytes): 0x20, 0x08, "abcdefgh" -> "c" From baabe65a84efd86e4975291a05a57a8be0313f1c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2020 16:46:02 +0200 Subject: [PATCH 224/479] Fix bound functions with calldata parameters. --- Changelog.md | 3 ++ docs/bugs.json | 8 ++++ docs/bugs_by_version.json | 4 +- libsolidity/ast/Types.cpp | 38 ++++++++++++++----- libsolidity/ast/Types.h | 7 +++- .../libraries/bound_returning_calldata.sol | 17 +++++++++ .../bound_returning_calldata_external.sol | 20 ++++++++++ .../libraries/bound_to_calldata.sol | 17 +++++++++ .../libraries/bound_to_calldata_external.sol | 20 ++++++++++ .../syntaxTests/bound/bound_calldata.sol | 9 +++++ 10 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol create mode 100644 test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol create mode 100644 test/libsolidity/semanticTests/libraries/bound_to_calldata.sol create mode 100644 test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol create mode 100644 test/libsolidity/syntaxTests/bound/bound_calldata.sol diff --git a/Changelog.md b/Changelog.md index 7f0f505f054e..a344d516dd7f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### 0.6.10 (unreleased) +Important Bugfixes: + * Fixed a bug related to internal library functions with ``calldata`` parameters called via ``using for``. + Language Features: Compiler Features: diff --git a/docs/bugs.json b/docs/bugs.json index 90f211c1f7cc..3a29ad352a4a 100644 --- a/docs/bugs.json +++ b/docs/bugs.json @@ -1,4 +1,12 @@ [ + { + "name": "UsingForCalldata", + "summary": "Function calls to internal library functions with calldata parameters called via ``using for`` can result in invalid data being read.", + "description": "Function calls to internal library functions using the ``using for`` mechanism copied all calldata parameters to memory first and passed them on like that, regardless of whether it was an internal or an external call. Due to that, the called function would receive a memory pointer that is interpreted as a calldata pointer.", + "introduced": "0.6.9", + "fixed": "0.6.10", + "severity": "very low" + }, { "name": "MissingEscapingInFormatting", "summary": "String literals containing double backslash characters passed directly to external or encoding function calls can lead to a different string being used when ABIEncoderV2 is enabled.", diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 2d81e8783b5d..37d4419e7757 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1165,7 +1165,9 @@ "released": "2020-05-14" }, "0.6.9": { - "bugs": [], + "bugs": [ + "UsingForCalldata" + ], "released": "2020-06-04" } } \ No newline at end of file diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 8114be800c61..828ff7815620 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -371,7 +371,8 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition seenFunctions.insert(function); if (function->parameters().empty()) continue; - FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asExternallyCallableFunction(true, true); + FunctionTypePointer fun = + dynamic_cast(*function->typeViaContractName()).asBoundFunction(); if (_type.isImplicitlyConvertibleTo(*fun->selfType())) members.emplace_back(function->name(), fun, function); } @@ -3438,11 +3439,32 @@ TypePointer FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bo ); } -FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, bool _bound) const +FunctionTypePointer FunctionType::asBoundFunction() const { - if (_bound) - solAssert(!m_parameterTypes.empty(), ""); + solAssert(!m_parameterTypes.empty(), ""); + FunctionDefinition const* fun = dynamic_cast(m_declaration); + solAssert(fun && fun->libraryFunction(), ""); + solAssert(!m_gasSet, ""); + solAssert(!m_valueSet, ""); + solAssert(!m_saltSet, ""); + return TypeProvider::function( + m_parameterTypes, + m_returnParameterTypes, + m_parameterNames, + m_returnParameterNames, + m_kind, + m_arbitraryParameters, + m_stateMutability, + m_declaration, + m_gasSet, + m_valueSet, + m_saltSet, + true + ); +} +FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary) const +{ TypePointers parameterTypes; for (auto const& t: m_parameterTypes) if (TypeProvider::isReferenceWithLocation(t, DataLocation::CallData)) @@ -3465,10 +3487,8 @@ FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, if (_inLibrary) { solAssert(!!m_declaration, "Declaration has to be available."); - if (!m_declaration->isPublic()) - kind = Kind::Internal; // will be inlined - else - kind = Kind::DelegateCall; + solAssert(m_declaration->isPublic(), ""); + kind = Kind::DelegateCall; } return TypeProvider::function( @@ -3483,7 +3503,7 @@ FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, m_gasSet, m_valueSet, m_saltSet, - _bound + m_bound ); } diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 609f2e9edf83..1b37dc4853c7 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1302,13 +1302,16 @@ class FunctionType: public Type /// of the parameters to false. TypePointer copyAndSetCallOptions(bool _setGas, bool _setValue, bool _setSalt) const; + /// @returns a copy of this function type with the `bound` flag set to true. + /// Should only be called on library functions. + FunctionTypePointer asBoundFunction() const; + /// @returns a copy of this function type where the location of reference types is changed /// from CallData to Memory. This is the type that would be used when the function is /// called externally, as opposed to the parameter types that are available inside the function body. /// Also supports variants to be used for library or bound calls. /// @param _inLibrary if true, uses DelegateCall as location. - /// @param _bound if true, the function type is set to be bound. - FunctionTypePointer asExternallyCallableFunction(bool _inLibrary, bool _bound = false) const; + FunctionTypePointer asExternallyCallableFunction(bool _inLibrary) const; protected: std::vector> makeStackItems() const override; diff --git a/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol new file mode 100644 index 000000000000..7451e9dc486d --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol @@ -0,0 +1,17 @@ +library D { + function f(bytes calldata _x) internal pure returns (bytes calldata) { + return _x; + } + function g(bytes calldata _x) internal pure returns (bytes memory) { + return _x; + } +} + +contract C { + using D for bytes; + function f(bytes calldata _x) public pure returns (byte, byte) { + return (_x.f()[0], _x.g()[0]); + } +} +// ---- +// f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol b/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol new file mode 100644 index 000000000000..3114f851071a --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/bound_returning_calldata_external.sol @@ -0,0 +1,20 @@ +library D { + function f(bytes calldata _x) public pure returns (bytes calldata) { + return _x; + } + function g(bytes calldata _x) public pure returns (bytes memory) { + return _x; + } +} + +contract C { + using D for bytes; + function f(bytes calldata _x) public pure returns (byte, byte) { + return (_x.f()[0], _x.g()[0]); + } +} +// ==== +// EVMVersion: >homestead +// ---- +// library: D +// f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol new file mode 100644 index 000000000000..0e9bb811b3ac --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol @@ -0,0 +1,17 @@ +library D { + function f(bytes calldata _x) internal pure returns (byte) { + return _x[0]; + } + function g(bytes memory _x) internal pure returns (byte) { + return _x[0]; + } +} + +contract C { + using D for bytes; + function f(bytes calldata _x) public pure returns (byte, byte) { + return (_x.f(), _x.g()); + } +} +// ---- +// f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol b/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol new file mode 100644 index 000000000000..2f8c7c7f3937 --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/bound_to_calldata_external.sol @@ -0,0 +1,20 @@ +library D { + function f(bytes calldata _x) public pure returns (byte) { + return _x[0]; + } + function g(bytes memory _x) public pure returns (byte) { + return _x[0]; + } +} + +contract C { + using D for bytes; + function f(bytes calldata _x) public pure returns (byte, byte) { + return (_x.f(), _x.g()); + } +} +// ==== +// EVMVersion: >homestead +// ---- +// library: D +// f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/syntaxTests/bound/bound_calldata.sol b/test/libsolidity/syntaxTests/bound/bound_calldata.sol new file mode 100644 index 000000000000..f6fcf82cbf6b --- /dev/null +++ b/test/libsolidity/syntaxTests/bound/bound_calldata.sol @@ -0,0 +1,9 @@ +library D { function f(bytes calldata) internal pure {} } +contract C { + using D for bytes; + function f(bytes memory _x) public pure { + _x.f(); + } +} +// ---- +// TypeError: (136-140): Member "f" not found or not visible after argument-dependent lookup in bytes memory. From 7908e6c3738cea10ab22f9231f957d935c0b24db Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2020 18:23:19 +0200 Subject: [PATCH 225/479] Fix compiler error. --- libsolidity/analysis/TypeChecker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 49b28bada9b5..ef30961aaeb0 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -334,7 +334,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) m_errorReporter.warning(5815_error, _function.location(), "Interface functions are implicitly \"virtual\""); if (_function.visibility() == Visibility::Private) m_errorReporter.typeError(3942_error, _function.location(), "\"virtual\" and \"private\" cannot be used together."); - if (isLibraryFunction) + if (_function.libraryFunction()) m_errorReporter.typeError(1878_error, _function.location(), "Library functions cannot be \"virtual\"."); } From a1165c135d15a5e8dcd92ac40f1ed3c39d040bb1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2020 18:25:19 +0200 Subject: [PATCH 226/479] Fix error codes. --- libsolidity/analysis/TypeChecker.cpp | 2 +- libyul/AsmAnalysis.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ef30961aaeb0..6ce458e9e917 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -335,7 +335,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.visibility() == Visibility::Private) m_errorReporter.typeError(3942_error, _function.location(), "\"virtual\" and \"private\" cannot be used together."); if (_function.libraryFunction()) - m_errorReporter.typeError(1878_error, _function.location(), "Library functions cannot be \"virtual\"."); + m_errorReporter.typeError(7801_error, _function.location(), "Library functions cannot be \"virtual\"."); } if (_function.isPayable()) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 2b69081428e9..a684fa963886 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -592,7 +592,7 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation else if (_instr == evmasm::Instruction::PC) { m_errorReporter.error( - 4316_error, + 2450_error, Error::Type::SyntaxError, _location, "PC instruction is a low-level EVM feature. " From 90b66a736250a1af0a897f0c5c67cecbdd4b74f6 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 10 Jun 2020 17:27:59 +0200 Subject: [PATCH 227/479] Fix struct member access for memory and implement for calldata. --- libsolidity/ast/Types.cpp | 15 +++++++ libsolidity/ast/Types.h | 2 + .../codegen/ir/IRGeneratorForStatements.cpp | 22 ++++++++++- .../viaYul/struct_member_access.sol | 39 +++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/viaYul/struct_member_access.sol diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 8114be800c61..dfddaef8e49d 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2457,6 +2457,21 @@ set StructType::membersMissingInMemory() const return missing; } +vector> StructType::makeStackItems() const +{ + switch (m_location) + { + case DataLocation::CallData: + return {std::make_tuple("offset", TypeProvider::uint256())}; + case DataLocation::Memory: + return {std::make_tuple("mpos", TypeProvider::uint256())}; + case DataLocation::Storage: + return {std::make_tuple("slot", TypeProvider::uint256())}; + } + solAssert(false, ""); +} + + TypePointer EnumType::encodingType() const { return TypeProvider::uint(8 * storageBytes()); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 609f2e9edf83..4ae780b63dc2 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -980,6 +980,8 @@ class StructType: public ReferenceType void clearCache() const override; +protected: + std::vector> makeStackItems() const override; private: StructDefinition const& m_struct; // Caches for interfaceType(bool) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index a62251ab150a..53e23d84972c 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1477,7 +1477,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) pair const& offsets = structType.storageOffsetsOfMember(member); string slot = m_context.newYulVariable(); m_code << "let " << slot << " := " << - ("add(" + expression.name() + ", " + offsets.first.str() + ")\n"); + ("add(" + expression.part("slot").name() + ", " + offsets.first.str() + ")\n"); setLValue(_memberAccess, IRLValue{ type(_memberAccess), IRLValue::Storage{slot, offsets.second} @@ -1497,7 +1497,25 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) } case DataLocation::CallData: { - solUnimplementedAssert(false, ""); + string baseRef = expression.part("offset").name(); + string offset = m_context.newYulVariable(); + m_code << "let " << offset << " := " << "add(" << baseRef << ", " << to_string(structType.calldataOffsetOfMember(member)) << ")\n"; + if (_memberAccess.annotation().type->isDynamicallyEncoded()) + define(_memberAccess) << + m_utils.accessCalldataTailFunction(*_memberAccess.annotation().type) << + "(" << + baseRef << + ", " << + offset << + ")" << + std::endl; + else + define(_memberAccess) << + m_utils.readFromCalldata(*_memberAccess.annotation().type) << + "(" << + offset << + ")" << + std::endl; break; } default: diff --git a/test/libsolidity/semanticTests/viaYul/struct_member_access.sol b/test/libsolidity/semanticTests/viaYul/struct_member_access.sol new file mode 100644 index 000000000000..60733d414033 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/struct_member_access.sol @@ -0,0 +1,39 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { + uint a; + uint[] b; + uint c; + } + + S s; + constructor() public { + s.a = 42; + s.b.push(1); + s.b.push(2); + s.b.push(3); + s.c = 21; + } + + function f(S memory m) public pure returns (uint, uint[] memory, uint) { + return (m.a, m.b, m.c); + } + function g(S calldata c) external pure returns (uint, uint, uint, uint, uint, uint) { + return (c.a, c.b.length, c.c, c.b[0], c.b[1], c.b[2]); + } + function g2(S calldata c1, S calldata c2) external pure returns (uint, uint, uint, uint, uint, uint) { + return (c1.a, c1.c, c2.a, c2.b.length, c2.c, c2.b[0]); + } + function h() external view returns (uint, uint, uint, uint, uint, uint) { + return (s.a, s.b.length, s.c, s.b[0], s.b[1], s.b[2]); + } +} +// ==== +// EVMVersion: >homestead +// compileViaYul: also +// ---- +// f((uint256,uint256[],uint256)): 0x20, 42, 0x60, 21, 3, 1, 2, 3 -> 42, 0x60, 21, 3, 1, 2, 3 +// g((uint256,uint256[],uint256)): 0x20, 42, 0x60, 21, 3, 1, 2, 3 -> 42, 3, 21, 1, 2, 3 +// g2((uint256,uint256[],uint256),(uint256,uint256[],uint256)): 0x40, 0x0120, 42, 0x60, 21, 2, 1, 2, 3, 7, 0x80, 9, 0, 1, 17 -> 42, 21, 7, 1, 9, 17 +// h() -> 42, 3, 21, 1, 2, 3 From 840ff40263e6463962afbbdec12a6b1a20f81a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 11 Jun 2020 00:54:12 +0200 Subject: [PATCH 228/479] Define wasm::Type enum and use it for import parameters and result --- libyul/backends/wasm/BinaryTransform.cpp | 17 +++++++++-------- libyul/backends/wasm/BinaryTransform.h | 4 ++-- libyul/backends/wasm/TextTransform.cpp | 16 ++++++++++++++-- libyul/backends/wasm/TextTransform.h | 2 ++ libyul/backends/wasm/WasmAST.h | 10 ++++++++-- libyul/backends/wasm/WasmCodeTransform.cpp | 22 ++++++++++++++++------ libyul/backends/wasm/WasmCodeTransform.h | 2 ++ 7 files changed, 53 insertions(+), 20 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index ce97225e05dc..4bc43f1213fc 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -25,6 +25,7 @@ #include #include +#include using namespace std; using namespace solidity; @@ -475,7 +476,7 @@ BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import) { return { encodeTypes(_import.paramTypes), - encodeTypes(_import.returnType ? vector(1, *_import.returnType) : vector()) + encodeTypes(_import.returnType ? vector(1, *_import.returnType) : vector()) }; } @@ -483,26 +484,26 @@ BinaryTransform::Type BinaryTransform::typeOf(FunctionDefinition const& _funDef) { return { - encodeTypes(vector(_funDef.parameterNames.size(), "i64")), - encodeTypes(vector(_funDef.returns ? 1 : 0, "i64")) + encodeTypes(vector(_funDef.parameterNames.size(), wasm::Type::i64)), + encodeTypes(vector(_funDef.returns ? 1 : 0, wasm::Type::i64)) }; } -uint8_t BinaryTransform::encodeType(string const& _typeName) +uint8_t BinaryTransform::encodeType(wasm::Type _type) { - if (_typeName == "i32") + if (_type == wasm::Type::i32) return uint8_t(ValueType::I32); - else if (_typeName == "i64") + else if (_type == wasm::Type::i64) return uint8_t(ValueType::I64); else yulAssert(false, ""); return 0; } -vector BinaryTransform::encodeTypes(vector const& _typeNames) +vector BinaryTransform::encodeTypes(vector const& _types) { vector result; - for (auto const& t: _typeNames) + for (wasm::Type t: _types) result.emplace_back(encodeType(t)); return result; } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index f4444b2fd45c..1f4ecf6631c7 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -71,8 +71,8 @@ class BinaryTransform static Type typeOf(wasm::FunctionImport const& _import); static Type typeOf(wasm::FunctionDefinition const& _funDef); - static uint8_t encodeType(std::string const& _typeName); - static std::vector encodeTypes(std::vector const& _typeNames); + static uint8_t encodeType(wasm::Type _type); + static std::vector encodeTypes(std::vector const& _types); static std::map> typeToFunctionMap( std::vector const& _imports, diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index fd8eaf746772..a14c8069b0c5 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -20,6 +20,8 @@ #include +#include + #include #include @@ -44,9 +46,9 @@ string TextTransform::run(wasm::Module const& _module) { ret += " (import \"" + imp.module + "\" \"" + imp.externalName + "\" (func $" + imp.internalName; if (!imp.paramTypes.empty()) - ret += " (param" + joinHumanReadablePrefixed(imp.paramTypes, " ", " ") + ")"; + ret += " (param" + joinHumanReadablePrefixed(imp.paramTypes | boost::adaptors::transformed(encodeType), " ", " ") + ")"; if (imp.returnType) - ret += " (result " + *imp.returnType + ")"; + ret += " (result " + encodeType(*imp.returnType) + ")"; ret += "))\n"; } @@ -193,3 +195,13 @@ string TextTransform::joinTransformed(vector const& _expressio } return ret; } + +string TextTransform::encodeType(wasm::Type _type) +{ + if (_type == wasm::Type::i32) + return "i32"; + else if (_type == wasm::Type::i64) + return "i64"; + else + yulAssert(false, "Invalid wasm type"); +} diff --git a/libyul/backends/wasm/TextTransform.h b/libyul/backends/wasm/TextTransform.h index ebbca4e9e7e6..b8b21f7f2e6d 100644 --- a/libyul/backends/wasm/TextTransform.h +++ b/libyul/backends/wasm/TextTransform.h @@ -63,6 +63,8 @@ class TextTransform std::vector const& _expressions, char _separator = ' ' ); + + static std::string encodeType(wasm::Type _type); }; } diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h index 7ba7066cbca2..e3a3368ea94d 100644 --- a/libyul/backends/wasm/WasmAST.h +++ b/libyul/backends/wasm/WasmAST.h @@ -30,6 +30,12 @@ namespace solidity::yul::wasm { +enum class Type +{ + i32, + i64, +}; + struct Literal; struct StringLiteral; struct LocalVariable; @@ -76,8 +82,8 @@ struct FunctionImport { std::string module; std::string externalName; std::string internalName; - std::vector paramTypes; - std::optional returnType; + std::vector paramTypes; + std::optional returnType; }; struct FunctionDefinition diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index f23f51eee92f..0e3a17f00e60 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -127,10 +127,10 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) builtin->name.str().substr(4), builtin->name.str(), {}, - builtin->returns.empty() ? nullopt : make_optional(builtin->returns.front().str()) + builtin->returns.empty() ? nullopt : make_optional(translatedType(builtin->returns.front())) }; for (auto const& param: builtin->parameters) - imp.paramTypes.emplace_back(param.str()); + imp.paramTypes.emplace_back(translatedType(param)); m_functionsToImport[builtin->name] = std::move(imp); } typeConversionNeeded = true; @@ -361,14 +361,14 @@ wasm::Expression WasmCodeTransform::injectTypeConversionIfNeeded(wasm::FunctionC { wasm::FunctionImport const& import = m_functionsToImport.at(YulString{_call.functionName}); for (size_t i = 0; i < _call.arguments.size(); ++i) - if (import.paramTypes.at(i) == "i32") + if (import.paramTypes.at(i) == wasm::Type::i32) _call.arguments[i] = wasm::BuiltinCall{"i32.wrap_i64", make_vector(std::move(_call.arguments[i]))}; else - yulAssert(import.paramTypes.at(i) == "i64", "Unknown type " + import.paramTypes.at(i)); + yulAssert(import.paramTypes.at(i) == wasm::Type::i64, "Invalid Wasm type"); - if (import.returnType && *import.returnType != "i64") + if (import.returnType && *import.returnType != wasm::Type::i64) { - yulAssert(*import.returnType == "i32", "Invalid type " + *import.returnType); + yulAssert(*import.returnType == wasm::Type::i32, "Invalid Wasm type"); return wasm::BuiltinCall{"i64.extend_i32_u", make_vector(std::move(_call))}; } return {std::move(_call)}; @@ -403,3 +403,13 @@ void WasmCodeTransform::allocateGlobals(size_t _amount) m_nameDispenser.newName("global_"_yulstring).str() }); } + +wasm::Type WasmCodeTransform::translatedType(yul::Type _yulType) +{ + if (_yulType == "i32"_yulstring) + return wasm::Type::i32; + else if (_yulType == "i64"_yulstring) + return wasm::Type::i64; + else + yulAssert(false, "This Yul type does not have a corresponding type in Wasm."); +} diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 26000e3852ab..5680269f4c54 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -89,6 +89,8 @@ class WasmCodeTransform /// Makes sure that there are at least @a _amount global variables. void allocateGlobals(size_t _amount); + static wasm::Type translatedType(yul::Type _yulType); + Dialect const& m_dialect; NameDispenser m_nameDispenser; From 6a82d32ef6f494edd9682f2a4495f066ac64d9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 28 May 2020 21:20:19 +0200 Subject: [PATCH 229/479] Add the ability to store variable types in wasm AST --- libyul/backends/wasm/BinaryTransform.cpp | 11 ++++++----- libyul/backends/wasm/TextTransform.cpp | 9 +++++---- libyul/backends/wasm/WasmAST.h | 13 ++++++++----- libyul/backends/wasm/WasmCodeTransform.cpp | 18 ++++++++++-------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 4bc43f1213fc..875d93dbfa6a 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -298,7 +298,8 @@ bytes BinaryTransform::run(Module const& _module) bytes BinaryTransform::operator()(Literal const& _literal) { - return toBytes(Opcode::I64Const) + lebEncodeSigned(_literal.value); + yulAssert(holds_alternative(_literal.value), ""); + return toBytes(Opcode::I64Const) + lebEncodeSigned(get(_literal.value)); } bytes BinaryTransform::operator()(StringLiteral const&) @@ -457,8 +458,8 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function) m_locals.clear(); size_t varIdx = 0; - for (size_t i = 0; i < _function.parameterNames.size(); ++i) - m_locals[_function.parameterNames[i]] = varIdx++; + for (size_t i = 0; i < _function.parameters.size(); ++i) + m_locals[_function.parameters[i].name] = varIdx++; for (size_t i = 0; i < _function.locals.size(); ++i) m_locals[_function.locals[i].variableName] = varIdx++; @@ -484,8 +485,8 @@ BinaryTransform::Type BinaryTransform::typeOf(FunctionDefinition const& _funDef) { return { - encodeTypes(vector(_funDef.parameterNames.size(), wasm::Type::i64)), - encodeTypes(vector(_funDef.returns ? 1 : 0, wasm::Type::i64)) + encodeTypes(vector(_funDef.parameters.size(), wasm::Type::i64)), + encodeTypes(vector(_funDef.returnType.has_value() ? 1 : 0, wasm::Type::i64)) }; } diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index a14c8069b0c5..84f2ce972d54 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -67,7 +67,8 @@ string TextTransform::run(wasm::Module const& _module) string TextTransform::operator()(wasm::Literal const& _literal) { - return "(i64.const " + to_string(_literal.value) + ")"; + yulAssert(holds_alternative(_literal.value), ""); + return "(i64.const " + to_string(get(_literal.value)) + ")"; } string TextTransform::operator()(wasm::StringLiteral const& _literal) @@ -164,9 +165,9 @@ string TextTransform::indented(string const& _in) string TextTransform::transform(wasm::FunctionDefinition const& _function) { string ret = "(func $" + _function.name + "\n"; - for (auto const& param: _function.parameterNames) - ret += " (param $" + param + " i64)\n"; - if (_function.returns) + for (auto const& param: _function.parameters) + ret += " (param $" + param.name + " i64)\n"; + if (_function.returnType.has_value()) ret += " (result i64)\n"; for (auto const& local: _function.locals) ret += " (local $" + local.variableName + " i64)\n"; diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h index e3a3368ea94d..b22b0db84430 100644 --- a/libyul/backends/wasm/WasmAST.h +++ b/libyul/backends/wasm/WasmAST.h @@ -36,6 +36,9 @@ enum class Type i64, }; +struct TypedName { std::string name; Type type; }; +using TypedNameList = std::vector; + struct Literal; struct StringLiteral; struct LocalVariable; @@ -56,7 +59,7 @@ using Expression = std::variant< Block, If, Loop, Branch, BranchIf, Return >; -struct Literal { uint64_t value; }; +struct Literal { std::variant value; }; struct StringLiteral { std::string value; }; struct LocalVariable { std::string name; }; struct GlobalVariable { std::string name; }; @@ -76,8 +79,8 @@ struct Branch { Label label; }; struct Return {}; struct BranchIf { Label label; std::unique_ptr condition; }; -struct VariableDeclaration { std::string variableName; }; -struct GlobalVariableDeclaration { std::string variableName; }; +struct VariableDeclaration { std::string variableName; Type type; }; +struct GlobalVariableDeclaration { std::string variableName; Type type; }; struct FunctionImport { std::string module; std::string externalName; @@ -89,8 +92,8 @@ struct FunctionImport { struct FunctionDefinition { std::string name; - std::vector parameterNames; - bool returns; + std::vector parameters; + std::optional returnType; std::vector locals; std::vector body; }; diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 0e3a17f00e60..8f987824c3d1 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -88,7 +88,7 @@ wasm::Expression WasmCodeTransform::operator()(VariableDeclaration const& _varDe for (auto const& var: _varDecl.variables) { variableNames.emplace_back(var.name.str()); - m_localVariables.emplace_back(wasm::VariableDeclaration{variableNames.back()}); + m_localVariables.emplace_back(wasm::VariableDeclaration{variableNames.back(), wasm::Type::i64}); } if (_varDecl.value) @@ -184,7 +184,7 @@ wasm::Expression WasmCodeTransform::operator()(Literal const& _literal) { u256 value = valueOfLiteral(_literal); yulAssert(value <= numeric_limits::max(), "Literal too large: " + value.str()); - return wasm::Literal{uint64_t(value)}; + return wasm::Literal{static_cast(value)}; } wasm::Expression WasmCodeTransform::operator()(If const& _if) @@ -193,7 +193,7 @@ wasm::Expression WasmCodeTransform::operator()(If const& _if) vector args; args.emplace_back(visitReturnByValue(*_if.condition)); - args.emplace_back(wasm::Literal{0}); + args.emplace_back(wasm::Literal{static_cast(0)}); return wasm::If{ make_unique(wasm::BuiltinCall{"i64.ne", std::move(args)}), visit(_if.body.statements), @@ -205,7 +205,7 @@ wasm::Expression WasmCodeTransform::operator()(Switch const& _switch) { wasm::Block block; string condition = m_nameDispenser.newName("condition"_yulstring).str(); - m_localVariables.emplace_back(wasm::VariableDeclaration{condition}); + m_localVariables.emplace_back(wasm::VariableDeclaration{condition, wasm::Type::i64}); block.statements.emplace_back(wasm::LocalAssignment{condition, visit(*_switch.expression)}); vector* currentBlock = &block.statements; @@ -325,10 +325,11 @@ wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefin wasm::FunctionDefinition fun; fun.name = _fun.name.str(); for (auto const& param: _fun.parameters) - fun.parameterNames.emplace_back(param.name.str()); + fun.parameters.push_back({param.name.str(), wasm::Type::i64}); for (auto const& retParam: _fun.returnVariables) - fun.locals.emplace_back(wasm::VariableDeclaration{retParam.name.str()}); - fun.returns = !_fun.returnVariables.empty(); + fun.locals.emplace_back(wasm::VariableDeclaration{retParam.name.str(), wasm::Type::i64}); + if (!_fun.returnVariables.empty()) + fun.returnType = wasm::Type::i64; yulAssert(m_localVariables.empty(), ""); yulAssert(m_functionBodyLabel.empty(), ""); @@ -400,7 +401,8 @@ void WasmCodeTransform::allocateGlobals(size_t _amount) { while (m_globalVariables.size() < _amount) m_globalVariables.emplace_back(wasm::GlobalVariableDeclaration{ - m_nameDispenser.newName("global_"_yulstring).str() + m_nameDispenser.newName("global_"_yulstring).str(), + wasm::Type::i64 }); } From e67f5072df6440cef895bf7dcd2c49267895658a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 28 May 2020 21:40:44 +0200 Subject: [PATCH 230/479] Add support for generating code with i32 variables in text and binary wasm --- libyul/backends/wasm/BinaryTransform.cpp | 98 ++++++++++++++----- libyul/backends/wasm/BinaryTransform.h | 1 + libyul/backends/wasm/TextTransform.cpp | 15 +-- .../args | 1 + .../err | 1 + .../input.yul | 17 ++++ .../output | 73 ++++++++++++++ 7 files changed, 177 insertions(+), 29 deletions(-) create mode 100644 test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args create mode 100644 test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/err create mode 100644 test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul create mode 100644 test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 875d93dbfa6a..b305b9c550aa 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -83,6 +84,16 @@ bytes toBytes(ValueType _vt) return toBytes(uint8_t(_vt)); } +ValueType toValueType(wasm::Type _type) +{ + if (_type == wasm::Type::i32) + return ValueType::I32; + else if (_type == wasm::Type::i64) + return ValueType::I64; + else + yulAssert(false, "Invalid wasm variable type"); +} + enum class Export: uint8_t { Function = 0x0, @@ -132,6 +143,16 @@ bytes toBytes(Opcode _o) return toBytes(uint8_t(_o)); } +Opcode constOpcodeFor(ValueType _type) +{ + if (_type == ValueType::I32) + return Opcode::I32Const; + else if (_type == ValueType::I64) + return Opcode::I64Const; + else + yulAssert(false, "Values of this type cannot be used with const opcode"); +} + static map const builtins = { {"i32.load", 0x28}, {"i64.load", 0x29}, @@ -250,6 +271,34 @@ bytes makeSection(Section _section, bytes _data) return toBytes(_section) + prefixSize(move(_data)); } +/// This is a kind of run-length-encoding of local types. +vector> groupLocalVariables(vector _localVariables) +{ + vector> localEntries; + + size_t entrySize = 0; + ValueType entryType = ValueType::I32; // Any type would work here + for (VariableDeclaration const& localVariable: _localVariables) + { + ValueType variableType = toValueType(localVariable.type); + + if (variableType != entryType) + { + if (entrySize > 0) + localEntries.emplace_back(entrySize, entryType); + + entryType = variableType; + entrySize = 0; + } + + ++entrySize; + } + if (entrySize > 0) + localEntries.emplace_back(entrySize, entryType); + + return localEntries; +} + } bytes BinaryTransform::run(Module const& _module) @@ -298,8 +347,10 @@ bytes BinaryTransform::run(Module const& _module) bytes BinaryTransform::operator()(Literal const& _literal) { - yulAssert(holds_alternative(_literal.value), ""); - return toBytes(Opcode::I64Const) + lebEncodeSigned(get(_literal.value)); + return std::visit(GenericVisitor{ + [&](uint32_t _value) -> bytes { return toBytes(Opcode::I32Const) + lebEncodeSigned(static_cast(_value)); }, + [&](uint64_t _value) -> bytes { return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(_value)); }, + }, _literal.value); } bytes BinaryTransform::operator()(StringLiteral const&) @@ -445,15 +496,12 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function) { bytes ret; - // This is a kind of run-length-encoding of local types. Has to be adapted once - // we have locals of different types. - if (_function.locals.size() == 0) - ret += lebEncode(0); // number of locals groups - else + vector> localEntries = groupLocalVariables(_function.locals); + ret += lebEncode(localEntries.size()); + for (pair const& entry: localEntries) { - ret += lebEncode(1); // number of locals groups - ret += lebEncode(_function.locals.size()); - ret += toBytes(ValueType::I64); + ret += lebEncode(entry.first); + ret += toBytes(entry.second); } m_locals.clear(); @@ -483,22 +531,15 @@ BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import) BinaryTransform::Type BinaryTransform::typeOf(FunctionDefinition const& _funDef) { - return { - encodeTypes(vector(_funDef.parameters.size(), wasm::Type::i64)), - encodeTypes(vector(_funDef.returnType.has_value() ? 1 : 0, wasm::Type::i64)) + encodeTypes(_funDef.parameters), + encodeTypes(_funDef.returnType ? vector(1, *_funDef.returnType) : vector()) }; } uint8_t BinaryTransform::encodeType(wasm::Type _type) { - if (_type == wasm::Type::i32) - return uint8_t(ValueType::I32); - else if (_type == wasm::Type::i64) - return uint8_t(ValueType::I64); - else - yulAssert(false, ""); - return 0; + return uint8_t(toValueType(_type)); } vector BinaryTransform::encodeTypes(vector const& _types) @@ -509,6 +550,14 @@ vector BinaryTransform::encodeTypes(vector const& _types) return result; } +vector BinaryTransform::encodeTypes(wasm::TypedNameList const& _typedNameList) +{ + vector result; + for (TypedName const& typedName: _typedNameList) + result.emplace_back(encodeType(typedName.type)); + return result; +} + map> BinaryTransform::typeToFunctionMap( vector const& _imports, vector const& _functions @@ -614,13 +663,16 @@ bytes BinaryTransform::memorySection() bytes BinaryTransform::globalSection(vector const& _globals) { bytes result = lebEncode(_globals.size()); - for (size_t i = 0; i < _globals.size(); ++i) + for (wasm::GlobalVariableDeclaration const& global: _globals) + { + ValueType globalType = toValueType(global.type); result += - toBytes(ValueType::I64) + + toBytes(globalType) + lebEncode(static_cast(Mutability::Var)) + - toBytes(Opcode::I64Const) + + toBytes(constOpcodeFor(globalType)) + lebEncodeSigned(0) + toBytes(Opcode::End); + } return makeSection(Section::GLOBAL, move(result)); } diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index 1f4ecf6631c7..c505fe2dc1b5 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -73,6 +73,7 @@ class BinaryTransform static uint8_t encodeType(wasm::Type _type); static std::vector encodeTypes(std::vector const& _types); + static std::vector encodeTypes(wasm::TypedNameList const& _typedNameList); static std::map> typeToFunctionMap( std::vector const& _imports, diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index 84f2ce972d54..b7f1e81ea512 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -58,7 +59,7 @@ string TextTransform::run(wasm::Module const& _module) ret += " (export \"main\" (func $main))\n"; for (auto const& g: _module.globals) - ret += " (global $" + g.variableName + " (mut i64) (i64.const 0))\n"; + ret += " (global $" + g.variableName + " (mut " + encodeType(g.type) + ") (" + encodeType(g.type) + ".const 0))\n"; ret += "\n"; for (auto const& f: _module.functions) ret += transform(f) + "\n"; @@ -67,8 +68,10 @@ string TextTransform::run(wasm::Module const& _module) string TextTransform::operator()(wasm::Literal const& _literal) { - yulAssert(holds_alternative(_literal.value), ""); - return "(i64.const " + to_string(get(_literal.value)) + ")"; + return std::visit(GenericVisitor{ + [&](uint32_t _value) -> string { return "(i32.const " + to_string(_value) + ")"; }, + [&](uint64_t _value) -> string { return "(i64.const " + to_string(_value) + ")"; }, + }, _literal.value); } string TextTransform::operator()(wasm::StringLiteral const& _literal) @@ -166,11 +169,11 @@ string TextTransform::transform(wasm::FunctionDefinition const& _function) { string ret = "(func $" + _function.name + "\n"; for (auto const& param: _function.parameters) - ret += " (param $" + param.name + " i64)\n"; + ret += " (param $" + param.name + " " + encodeType(param.type) + ")\n"; if (_function.returnType.has_value()) - ret += " (result i64)\n"; + ret += " (result " + encodeType(_function.returnType.value()) + ")\n"; for (auto const& local: _function.locals) - ret += " (local $" + local.variableName + " i64)\n"; + ret += " (local $" + local.variableName + " " + encodeType(local.type) + ")\n"; ret += indented(joinTransformed(_function.body, '\n')); if (ret.back() != '\n') ret += '\n'; diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args new file mode 100644 index 000000000000..04cd5f05ba49 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args @@ -0,0 +1 @@ +--yul --yul-dialect ewasm --machine ewasm diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/err b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/err new file mode 100644 index 000000000000..014a1178fa22 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/err @@ -0,0 +1 @@ +Warning: Yul is still experimental. Please use the output with care. diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul new file mode 100644 index 000000000000..2b1a6d9606c0 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul @@ -0,0 +1,17 @@ +object "object" { + code { + function main() + { + let m:i64, n:i32, p:i32, q:i64 := multireturn(1:i32, 2:i64, 3:i64, 4:i32) + } + + function multireturn(a:i32, b:i64, c:i64, d:i32) -> x:i64, y:i32, z:i32, w:i64 + { + x := b + w := c + + y := a + z := d + } + } +} diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output new file mode 100644 index 000000000000..a99808601e42 --- /dev/null +++ b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output @@ -0,0 +1,73 @@ + +======= wasm_to_wasm_function_returning_multiple_values/input.yul (Ewasm) ======= + +Pretty printed source: +object "object" { + code { + function main() + { + let m, n:i32, p:i32, q := multireturn(1:i32, 2, 3, 4:i32) + } + function multireturn(a:i32, b, c, d:i32) -> x, y:i32, z:i32, w + { + x := b + w := c + y := a + z := d + } + } +} + + +Binary representation: +0061736d01000000010c0260000060047e7e7e7e017e020100030302000105030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00000a4a022201047e024002404201420242034204100121002300210123012102230221030b0b0b2501047e0240200121042002210720002105200321060b20052400200624012007240220040b + +Text representation: +(module + (memory $memory (export "memory") 1) + (export "main" (func $main)) + (global $global_ (mut i64) (i64.const 0)) + (global $global__1 (mut i64) (i64.const 0)) + (global $global__2 (mut i64) (i64.const 0)) + +(func $main + (local $m i64) + (local $n i64) + (local $p i64) + (local $q i64) + (block $label_ + (block + (local.set $m (call $multireturn (i64.const 1) (i64.const 2) (i64.const 3) (i64.const 4))) + (local.set $n (global.get $global_)) + (local.set $p (global.get $global__1)) + (local.set $q (global.get $global__2)) + + ) + + ) +) + +(func $multireturn + (param $a i64) + (param $b i64) + (param $c i64) + (param $d i64) + (result i64) + (local $x i64) + (local $y i64) + (local $z i64) + (local $w i64) + (block $label__3 + (local.set $x (local.get $b)) + (local.set $w (local.get $c)) + (local.set $y (local.get $a)) + (local.set $z (local.get $d)) + + ) + (global.set $global_ (local.get $y)) + (global.set $global__1 (local.get $z)) + (global.set $global__2 (local.get $w)) + (local.get $x) +) + +) From c8759b8031a95a7d2ba0ef338d5d7864b6b1a762 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 5 Jun 2020 13:36:03 +0200 Subject: [PATCH 231/479] Fixing conversion warnings in CommonData.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- libsolutil/CommonData.cpp | 12 ++++++------ libsolutil/FixedHash.h | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index 72071acdeee1..2896804ca601 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -106,7 +106,7 @@ bytes solidity::util::fromHex(std::string const& _s, WhenError _throw) { int h = fromHex(_s[s++], _throw); if (h != -1) - ret.push_back(h); + ret.push_back(static_cast(h)); else return bytes(); } @@ -115,7 +115,7 @@ bytes solidity::util::fromHex(std::string const& _s, WhenError _throw) int h = fromHex(_s[i], _throw); int l = fromHex(_s[i + 1], _throw); if (h != -1 && l != -1) - ret.push_back((uint8_t)(h * 16 + l)); + ret.push_back(static_cast(h * 16 + l)); else return bytes(); } @@ -148,14 +148,14 @@ string solidity::util::getChecksummedAddress(string const& _addr) h256 hash = keccak256(boost::algorithm::to_lower_copy(s, std::locale::classic())); string ret = "0x"; - for (size_t i = 0; i < 40; ++i) + for (unsigned i = 0; i < 40; ++i) { char addressCharacter = s[i]; - unsigned nibble = (unsigned(hash[i / 2]) >> (4 * (1 - (i % 2)))) & 0xf; + uint8_t nibble = hash[i / 2u] >> (4u * (1u - (i % 2u))) & 0xf; if (nibble >= 8) - ret += toupper(addressCharacter); + ret += static_cast(toupper(addressCharacter)); else - ret += tolower(addressCharacter); + ret += static_cast(tolower(addressCharacter)); } return ret; } diff --git a/libsolutil/FixedHash.h b/libsolutil/FixedHash.h index 4fa5a3072b92..7fbb8eec9757 100644 --- a/libsolutil/FixedHash.h +++ b/libsolutil/FixedHash.h @@ -64,10 +64,44 @@ class FixedHash FixedHash(Arith const& _arith) { toBigEndian(_arith, m_data); } /// Explicitly construct, copying from a byte array. - explicit FixedHash(bytes const& _b, ConstructFromHashType _t = FailIfDifferent) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); else { m_data.fill(0); if (_t != FailIfDifferent) { auto c = std::min(_b.size(), N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _b[_t == AlignRight ? _b.size() - 1 - i : i]; } } } + explicit FixedHash(bytes const& _array, ConstructFromHashType _sizeMismatchBehavior = FailIfDifferent) + { + if (_array.size() == N) + memcpy(m_data.data(), _array.data(), _array.size()); + else + { + m_data.fill(0); + if (_sizeMismatchBehavior != FailIfDifferent) + { + auto bytesToCopy = std::min(_array.size(), N); + for (size_t i = 0; i < bytesToCopy; ++i) + if (_sizeMismatchBehavior == AlignRight) + m_data[N - 1 - i] = _array[_array.size() - 1 - i]; + else + m_data[i] = _array[i]; + } + } + } /// Explicitly construct, copying from a byte array. - explicit FixedHash(bytesConstRef _b, ConstructFromHashType _t = FailIfDifferent) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); else { m_data.fill(0); if (_t != FailIfDifferent) { auto c = std::min(_b.size(), N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _b[_t == AlignRight ? _b.size() - 1 - i : i]; } } } + explicit FixedHash(bytesConstRef _b, ConstructFromHashType _t = FailIfDifferent) + { + if (_b.size() == N) + memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); + else + { + m_data.fill(0); + if (_t != FailIfDifferent) + { + auto c = std::min(_b.size(), N); + for (size_t i = 0; i < c; ++i) + if (_t == AlignRight) + m_data[N - 1 - i] = _b[_b.size() - 1 - i]; + else + m_data[i] = _b[i]; + } + } + } /// Explicitly construct, copying from a string. explicit FixedHash(std::string const& _s, ConstructFromStringType _t = FromHex, ConstructFromHashType _ht = FailIfDifferent): FixedHash(_t == FromHex ? fromHex(_s, WhenError::Throw) : solidity::util::asBytes(_s), _ht) {} From 18a196c21d89aa21eed9197a6711f1030566babd Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 5 Jun 2020 14:13:35 +0200 Subject: [PATCH 232/479] Fixing Keccak256 conversion warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- libsolutil/Keccak256.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libsolutil/Keccak256.cpp b/libsolutil/Keccak256.cpp index d9e9363f631f..2a7a241c739f 100644 --- a/libsolutil/Keccak256.cpp +++ b/libsolutil/Keccak256.cpp @@ -69,25 +69,25 @@ static uint64_t const RC[24] = \ #define REPEAT6(e) e e e e e e #define REPEAT24(e) REPEAT6(e e e e) #define REPEAT5(e) e e e e e -#define FOR5(v, s, e) \ +#define FOR5(type, v, s, e) \ v = 0; \ - REPEAT5(e; v += s;) + REPEAT5(e; v = static_cast(v + s);) /*** Keccak-f[1600] ***/ static inline void keccakf(void* state) { - uint64_t* a = (uint64_t*)state; + auto* a = static_cast(state); uint64_t b[5] = {0}; for (int i = 0; i < 24; i++) { uint8_t x, y; // Theta - FOR5(x, 1, + FOR5(uint8_t, x, 1, b[x] = 0; - FOR5(y, 5, + FOR5(uint8_t, y, 5, b[x] ^= a[x + y]; )) - FOR5(x, 1, - FOR5(y, 5, + FOR5(uint8_t, x, 1, + FOR5(uint8_t, y, 5, a[y + x] ^= b[(x + 4) % 5] ^ rol(b[(x + 1) % 5], 1); )) // Rho and pi uint64_t t = a[1]; @@ -97,11 +97,12 @@ static inline void keccakf(void* state) { t = b[0]; x++; ) // Chi - FOR5(y, + FOR5(uint8_t, + y, 5, - FOR5(x, 1, + FOR5(uint8_t, x, 1, b[x] = a[y + x];) - FOR5(x, 1, + FOR5(uint8_t, x, 1, a[y + x] = b[x] ^ ((~b[(x + 1) % 5]) & b[(x + 2) % 5]); )) // Iota a[0] ^= RC[i]; From 731b2efc9732cb7a57bb3aa94e291370c653535b Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 5 Jun 2020 14:30:57 +0200 Subject: [PATCH 233/479] Fixing liblangutil conversion warnings --- liblangutil/CharStream.cpp | 2 +- liblangutil/Scanner.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/liblangutil/CharStream.cpp b/liblangutil/CharStream.cpp index 6f2d47c4813c..12e4f642c493 100644 --- a/liblangutil/CharStream.cpp +++ b/liblangutil/CharStream.cpp @@ -107,7 +107,7 @@ tuple CharStream::translatePositionToLineColumn(int _position) const using size_type = string::size_type; using diff_type = string::difference_type; size_type searchPosition = min(m_source.size(), size_type(_position)); - int lineNumber = count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n'); + int lineNumber = static_cast(count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n')); size_type lineStart; if (searchPosition == 0) lineStart = 0; diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index e703b53761a7..db0636fb91ec 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -179,7 +179,7 @@ bool Scanner::scanHexByte(char& o_scannedByte) rollback(i); return false; } - x = x * 16 + d; + x = static_cast(x * 16 + d); advance(); } o_scannedByte = x; @@ -197,7 +197,7 @@ std::optional Scanner::scanUnicode() rollback(i); return {}; } - x = x * 16 + static_cast(d); + x = x * 16 + static_cast(d); advance(); } return x; From 9e92fbccee818da1774eea8b313a63badfdc8595 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 5 Jun 2020 14:33:20 +0200 Subject: [PATCH 234/479] Refactoring bytesRequired to accept and return size_t --- libevmasm/AssemblyItem.cpp | 4 ++-- libevmasm/AssemblyItem.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index c2e9056feb38..b78c0e60c718 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -59,7 +59,7 @@ void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag) setData(data); } -unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const +size_t AssemblyItem::bytesRequired(size_t _addressLength) const { switch (m_type) { @@ -69,7 +69,7 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const case PushString: return 1 + 32; case Push: - return 1 + max(1, util::bytesRequired(data())); + return 1 + max(1, util::bytesRequired(data())); case PushSubSize: case PushProgramSize: return 1 + 4; // worst case: a 16MB program diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index 6c5e01942be8..4b0b7ca722e5 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -133,7 +133,7 @@ class AssemblyItem /// @returns an upper bound for the number of bytes required by this item, assuming that /// the value of a jump tag takes @a _addressLength bytes. - unsigned bytesRequired(unsigned _addressLength) const; + size_t bytesRequired(size_t _addressLength) const; size_t arguments() const; size_t returnValues() const; size_t deposit() const { return returnValues() - arguments(); } From 73cd009b8914bad0a6dfda84339be1d41b429c42 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 11 Jun 2020 12:10:33 +0200 Subject: [PATCH 235/479] Fix struct allocation in Sol->Yul. --- libsolidity/codegen/YulUtilFunctions.cpp | 3 +-- .../viaYul/memory_struct_allow.sol | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 87142099e1d0..f7d9711a260b 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1652,8 +1652,7 @@ string YulUtilFunctions::allocateAndInitializeMemoryStructFunction(StructType co return m_functionCollector.createFunction(functionName, [&]() { Whiskers templ(R"( function () -> memPtr { - let allocSize := () - memPtr := (allocSize) + memPtr := () let offset := memPtr <#member> mstore(offset, ()) diff --git a/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol b/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol new file mode 100644 index 000000000000..b1af4fab8563 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol @@ -0,0 +1,21 @@ +contract C { + struct S { + uint256 a; + uint256 b; + } + + function f() public pure returns (uint256 a, uint256 b){ + assembly { + // Make free memory dirty to check that the struct allocation cleans it up again. + let freeMem := mload(0x40) + mstore(freeMem, 42) + mstore(add(freeMem, 32), 42) + } + S memory s; + return (s.a, s.b); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 0, 0 From 6763234410a25f81f2cb693b478cd72ec29d0e21 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 11 Jun 2020 12:57:53 +0200 Subject: [PATCH 236/479] More details in bug list. --- docs/bugs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bugs.json b/docs/bugs.json index 3a29ad352a4a..34325f45b1be 100644 --- a/docs/bugs.json +++ b/docs/bugs.json @@ -2,7 +2,7 @@ { "name": "UsingForCalldata", "summary": "Function calls to internal library functions with calldata parameters called via ``using for`` can result in invalid data being read.", - "description": "Function calls to internal library functions using the ``using for`` mechanism copied all calldata parameters to memory first and passed them on like that, regardless of whether it was an internal or an external call. Due to that, the called function would receive a memory pointer that is interpreted as a calldata pointer.", + "description": "Function calls to internal library functions using the ``using for`` mechanism copied all calldata parameters to memory first and passed them on like that, regardless of whether it was an internal or an external call. Due to that, the called function would receive a memory pointer that is interpreted as a calldata pointer. Since dynamically sized arrays are passed using two stack slots for calldata, but only one for memory, this can lead to stack corruption. An affected library call will consider the JUMPDEST to which it is supposed to return as part of its arguments and will instead jump out to whatever was on the stack before the call.", "introduced": "0.6.9", "fixed": "0.6.10", "severity": "very low" From 549c90612c66c42f6b29a8afa40f6f71ac65e410 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2020 12:55:30 +0200 Subject: [PATCH 237/479] Fix using for with explicit reference types. --- Changelog.md | 1 + libsolidity/ast/Types.cpp | 16 +++++++++--- .../libraries/using_for_storage_structs.sol | 25 +++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/semanticTests/libraries/using_for_storage_structs.sol diff --git a/Changelog.md b/Changelog.md index a344d516dd7f..55238ed1219b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ Bugfixes: * SMTChecker: Fix internal error when encoding tuples of tuples. * SMTChecker: Fix aliasing soundness after pushing to an array pointer. * Type system: Fix internal compiler error on calling externally a function that returns variables with calldata location. + * Type system: Fix bug where a bound function was not found if ``using for`` is applied to explicit reference types. ### 0.6.9 (2020-06-04) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 828ff7815620..86d7f08fbe0f 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -356,10 +356,18 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts) for (UsingForDirective const* ufd: contract->usingForDirectives()) { - if (ufd->typeName() && _type != *TypeProvider::withLocationIfReference( - typeLocation, - ufd->typeName()->annotation().type - )) + // Convert both types to pointers for comparison to see if the `using for` + // directive applies. + // Further down, we check more detailed for each function if `_type` is + // convertible to the function parameter type. + if (ufd->typeName() && + *TypeProvider::withLocationIfReference(typeLocation, &_type, true) != + *TypeProvider::withLocationIfReference( + typeLocation, + ufd->typeName()->annotation().type, + true + ) + ) continue; auto const& library = dynamic_cast( *ufd->libraryName().annotation().referencedDeclaration diff --git a/test/libsolidity/semanticTests/libraries/using_for_storage_structs.sol b/test/libsolidity/semanticTests/libraries/using_for_storage_structs.sol new file mode 100644 index 000000000000..cd45726b676b --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/using_for_storage_structs.sol @@ -0,0 +1,25 @@ +struct Struct { uint x; } + +library L { + function f(Struct storage _x) internal view returns (uint256) { + return _x.x; + } +} + +contract C { + using L for Struct; + + Struct s; + + function h(Struct storage _s) internal view returns (uint) { + // _s is pointer + return _s.f(); + } + function g() public returns (uint, uint) { + s.x = 7; + // s is reference + return (s.f(), h(s)); + } +} +// ---- +// g() -> 7, 7 From 3c43216a752fa6928498530d83e135da9b1fae78 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2020 14:03:53 +0200 Subject: [PATCH 238/479] Set release date for 0.6.10. --- Changelog.md | 8 +++++--- docs/bugs_by_version.json | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 55238ed1219b..e52c63293909 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,13 +1,14 @@ -### 0.6.10 (unreleased) +### 0.6.10 (2020-06-11) Important Bugfixes: * Fixed a bug related to internal library functions with ``calldata`` parameters called via ``using for``. -Language Features: Compiler Features: + * Commandline Interface: Re-group help screen. + * Output compilation error codes in standard-json and when using ``--error-codes``. * Yul: Raise warning for switch statements that only have a default and no other cases. - * Output compilation error codes. + Bugfixes: * SMTChecker: Fix internal error when encoding tuples of tuples. @@ -15,6 +16,7 @@ Bugfixes: * Type system: Fix internal compiler error on calling externally a function that returns variables with calldata location. * Type system: Fix bug where a bound function was not found if ``using for`` is applied to explicit reference types. + ### 0.6.9 (2020-06-04) Language Features: diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 37d4419e7757..8472ed5e427a 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1105,6 +1105,10 @@ ], "released": "2020-01-02" }, + "0.6.10": { + "bugs": [], + "released": "2020-06-11" + }, "0.6.2": { "bugs": [ "MissingEscapingInFormatting", From c4464b6dcd24dd0b1b5dd61d568036e0f5aee626 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 11 Jun 2020 20:15:35 +0200 Subject: [PATCH 239/479] Update travis config to move to next docker image revision. --- .travis.yml | 2 +- scripts/build_emscripten.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36d3943df6fd..43bd5b9b9450 100644 --- a/.travis.yml +++ b/.travis.yml @@ -110,7 +110,7 @@ matrix: before_install: - nvm install 8 - nvm use 8 - - docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 + - docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 env: - SOLC_EMSCRIPTEN=On - SOLC_INSTALL_DEPS_TRAVIS=Off diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index 3d6e1721073b..7a052aa77eb6 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -34,5 +34,5 @@ else BUILD_DIR="$1" fi -docker run -v $(pwd):/root/project -w /root/project ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 \ +docker run -v $(pwd):/root/project -w /root/project ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 \ ./scripts/travis-emscripten/build_emscripten.sh $BUILD_DIR From 65937ab5c810a35113a84b7307af2c44fc81ef84 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2020 19:44:14 +0200 Subject: [PATCH 240/479] Set version to 0.6.11. --- CMakeLists.txt | 2 +- Changelog.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7100f141a2d..3374ff09d57f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.10") +set(PROJECT_VERSION "0.6.11") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index e52c63293909..a4b44052977b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,16 @@ +### 0.6.11 (unreleased) + +Language Features: + + +Compiler Features: + + +Bugfixes: + + + + ### 0.6.10 (2020-06-11) Important Bugfixes: From 33e7b24df05f53ba964d9dc4f315e989400f20eb Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 2 Jun 2020 15:34:28 +0200 Subject: [PATCH 241/479] Adding fixes for signedness conversion warnings in libyul MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- libyul/AsmAnalysis.cpp | 4 +- libyul/Utilities.cpp | 2 +- libyul/YulString.h | 4 +- libyul/backends/evm/AsmCodeGen.cpp | 6 +- libyul/backends/evm/EVMAssembly.cpp | 6 +- libyul/backends/evm/EVMCodeTransform.cpp | 69 ++++++++++++---------- libyul/backends/evm/EVMCodeTransform.h | 4 +- libyul/backends/evm/EVMDialect.cpp | 4 +- libyul/backends/evm/EVMMetrics.cpp | 6 +- libyul/backends/wasm/BinaryTransform.cpp | 4 +- libyul/backends/wasm/WordSizeTransform.cpp | 22 +++---- libyul/optimiser/DeadCodeEliminator.cpp | 5 +- libyul/optimiser/ExpressionJoiner.cpp | 2 +- libyul/optimiser/Semantics.cpp | 2 +- libyul/optimiser/StackCompressor.cpp | 6 +- 15 files changed, 78 insertions(+), 68 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index eee3beacbb1c..07db82095e36 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -137,7 +137,7 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) { bool insideFunction = m_currentScope->insideFunction(); size_t stackSize = m_resolver(_identifier, yul::IdentifierContext::RValue, insideFunction); - if (stackSize != size_t(-1)) + if (stackSize != numeric_limits::max()) { found = true; yulAssert(stackSize == 1, "Invalid stack size of external reference."); @@ -479,7 +479,7 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT { bool insideFunction = m_currentScope->insideFunction(); size_t variableSize = m_resolver(_variable, yul::IdentifierContext::LValue, insideFunction); - if (variableSize != size_t(-1)) + if (variableSize != numeric_limits::max()) { found = true; variableType = &m_dialect.defaultType; diff --git a/libyul/Utilities.cpp b/libyul/Utilities.cpp index a797258eb544..59e0adce3afd 100644 --- a/libyul/Utilities.cpp +++ b/libyul/Utilities.cpp @@ -45,7 +45,7 @@ string solidity::yul::reindent(string const& _code) auto const static countBraces = [](string const& _s) noexcept -> int { auto const i = _s.find("//"); - auto const e = i == _s.npos ? end(_s) : next(begin(_s), i); + auto const e = i == _s.npos ? end(_s) : next(begin(_s), static_cast(i)); auto const opening = count_if(begin(_s), e, [](auto ch) { return ch == '{' || ch == '('; }); auto const closing = count_if(begin(_s), e, [](auto ch) { return ch == '}' || ch == ')'; }); return opening - closing; diff --git a/libyul/YulString.h b/libyul/YulString.h index 9166cff3d59d..0abe1f38ddf5 100644 --- a/libyul/YulString.h +++ b/libyul/YulString.h @@ -71,10 +71,10 @@ class YulStringRepository { // FNV hash - can be replaced by a better one, e.g. xxhash64 std::uint64_t hash = emptyHash(); - for (auto c: v) + for (char c: v) { hash *= 1099511628211u; - hash ^= c; + hash ^= static_cast(c); } return hash; diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index eefff5b18229..6775214e8011 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -143,14 +143,14 @@ pair, AbstractAssembly::SubID> EthAssemblyAdapter:: { shared_ptr assembly{make_shared()}; auto sub = m_assembly.newSub(assembly); - return {make_shared(*assembly), size_t(sub.data())}; + return {make_shared(*assembly), static_cast(sub.data())}; } void EthAssemblyAdapter::appendDataOffset(AbstractAssembly::SubID _sub) { auto it = m_dataHashBySubId.find(_sub); if (it == m_dataHashBySubId.end()) - m_assembly.pushSubroutineOffset(size_t(_sub)); + m_assembly.pushSubroutineOffset(_sub); else m_assembly << evmasm::AssemblyItem(evmasm::PushData, it->second); } @@ -159,7 +159,7 @@ void EthAssemblyAdapter::appendDataSize(AbstractAssembly::SubID _sub) { auto it = m_dataHashBySubId.find(_sub); if (it == m_dataHashBySubId.end()) - m_assembly.pushSubroutineSize(size_t(_sub)); + m_assembly.pushSubroutineSize(static_cast(_sub)); else m_assembly << u256(m_assembly.data(h256(it->second)).size()); } diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index 47f7509a3902..c13a16083656 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -74,7 +74,7 @@ void EVMAssembly::appendLabelReference(LabelID _labelId) EVMAssembly::LabelID EVMAssembly::newLabelId() { - m_labelPositions[m_nextLabelId] = size_t(-1); + m_labelPositions[m_nextLabelId] = numeric_limits::max(); return m_nextLabelId++; } @@ -165,7 +165,7 @@ evmasm::LinkerObject EVMAssembly::finalize() size_t referencePos = ref.first; yulAssert(m_labelPositions.count(ref.second), ""); size_t labelPos = m_labelPositions.at(ref.second); - yulAssert(labelPos != size_t(-1), "Undefined but allocated label used."); + yulAssert(labelPos != numeric_limits::max(), "Undefined but allocated label used."); updateReference(referencePos, labelReferenceSize, u256(labelPos)); } @@ -177,7 +177,7 @@ evmasm::LinkerObject EVMAssembly::finalize() void EVMAssembly::setLabelToCurrentPosition(LabelID _labelId) { yulAssert(m_labelPositions.count(_labelId), "Label not found."); - yulAssert(m_labelPositions[_labelId] == size_t(-1), "Label already set."); + yulAssert(m_labelPositions[_labelId] == numeric_limits::max(), "Label already set."); m_labelPositions[_labelId] = m_bytecode.size(); } diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index a4e19998f80f..f57fd35f36e3 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -175,28 +175,29 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl) { yulAssert(m_scope, ""); - int const numVariables = _varDecl.variables.size(); - int heightAtStart = m_assembly.stackHeight(); + size_t const numVariables = _varDecl.variables.size(); + auto heightAtStart = static_cast(m_assembly.stackHeight()); if (_varDecl.value) { std::visit(*this, *_varDecl.value); - expectDeposit(numVariables, heightAtStart); + expectDeposit(static_cast(numVariables), static_cast(heightAtStart)); } else { m_assembly.setSourceLocation(_varDecl.location); - int variablesLeft = numVariables; + size_t variablesLeft = numVariables; while (variablesLeft--) m_assembly.appendConstant(u256(0)); } m_assembly.setSourceLocation(_varDecl.location); bool atTopOfStack = true; - for (int varIndex = numVariables - 1; varIndex >= 0; --varIndex) + for (size_t varIndex = 0; varIndex < numVariables; ++varIndex) { - YulString varName = _varDecl.variables[varIndex].name; + size_t varIndexReverse = numVariables - 1 - varIndex; + YulString varName = _varDecl.variables[varIndexReverse].name; auto& var = std::get(m_scope->identifiers.at(varName)); - m_context->variableStackHeights[&var] = heightAtStart + varIndex; + m_context->variableStackHeights[&var] = heightAtStart + varIndexReverse; if (!m_allowStackOpt) continue; @@ -214,10 +215,10 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl) atTopOfStack = false; else { - int slot = *m_unusedStackSlots.begin(); + auto slot = static_cast(*m_unusedStackSlots.begin()); m_unusedStackSlots.erase(m_unusedStackSlots.begin()); m_context->variableStackHeights[&var] = slot; - if (int heightDiff = variableHeightDiff(var, varName, true)) + if (size_t heightDiff = variableHeightDiff(var, varName, true)) m_assembly.appendInstruction(evmasm::swapInstruction(heightDiff - 1)); m_assembly.appendInstruction(evmasm::Instruction::POP); } @@ -240,7 +241,7 @@ void CodeTransform::operator()(Assignment const& _assignment) { int height = m_assembly.stackHeight(); std::visit(*this, *_assignment.value); - expectDeposit(_assignment.variableNames.size(), height); + expectDeposit(static_cast(_assignment.variableNames.size()), height); m_assembly.setSourceLocation(_assignment.location); generateMultiAssignment(_assignment.variableNames); @@ -263,7 +264,7 @@ void CodeTransform::operator()(FunctionCall const& _call) else { m_assembly.setSourceLocation(_call.location); - EVMAssembly::LabelID returnLabel(-1); // only used for evm 1.0 + EVMAssembly::LabelID returnLabel(numeric_limits::max()); // only used for evm 1.0 if (!m_evm15) { returnLabel = m_assembly.newLabelId(); @@ -281,10 +282,17 @@ void CodeTransform::operator()(FunctionCall const& _call) visitExpression(arg); m_assembly.setSourceLocation(_call.location); if (m_evm15) - m_assembly.appendJumpsub(functionEntryID(_call.functionName.name, *function), function->arguments.size(), function->returns.size()); + m_assembly.appendJumpsub( + functionEntryID(_call.functionName.name, *function), + static_cast(function->arguments.size()), + static_cast(function->returns.size()) + ); else { - m_assembly.appendJumpTo(functionEntryID(_call.functionName.name, *function), function->returns.size() - function->arguments.size() - 1); + m_assembly.appendJumpTo( + functionEntryID(_call.functionName.name, *function), + static_cast(function->returns.size() - function->arguments.size()) - 1 + ); m_assembly.appendLabel(returnLabel); } } @@ -300,7 +308,7 @@ void CodeTransform::operator()(Identifier const& _identifier) { // TODO: opportunity for optimization: Do not DUP if this is the last reference // to the top most element of the stack - if (int heightDiff = variableHeightDiff(_var, _identifier.name, false)) + if (size_t heightDiff = variableHeightDiff(_var, _identifier.name, false)) m_assembly.appendInstruction(evmasm::dupInstruction(heightDiff)); else // Store something to balance the stack @@ -407,7 +415,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) int const stackHeightBefore = m_assembly.stackHeight(); if (m_evm15) - m_assembly.appendBeginsub(functionEntryID(_function.name, function), _function.parameters.size()); + m_assembly.appendBeginsub(functionEntryID(_function.name, function), static_cast(_function.parameters.size())); else m_assembly.appendLabel(functionEntryID(_function.name, function)); @@ -465,15 +473,15 @@ void CodeTransform::operator()(FunctionDefinition const& _function) // modified parallel to the actual stack. vector stackLayout; if (!m_evm15) - stackLayout.push_back(_function.returnVariables.size()); // Move return label to the top + stackLayout.push_back(static_cast(_function.returnVariables.size())); // Move return label to the top stackLayout += vector(_function.parameters.size(), -1); // discard all arguments for (size_t i = 0; i < _function.returnVariables.size(); ++i) - stackLayout.push_back(i); // Move return values down, but keep order. + stackLayout.push_back(static_cast(i)); // Move return values down, but keep order. if (stackLayout.size() > 17) { - StackTooDeepError error(_function.name, YulString{}, stackLayout.size() - 17); + StackTooDeepError error(_function.name, YulString{}, static_cast(stackLayout.size()) - 17); error << errinfo_comment( "The function " + _function.name.str() + @@ -481,11 +489,11 @@ void CodeTransform::operator()(FunctionDefinition const& _function) to_string(stackLayout.size() - 17) + " parameters or return variables too many to fit the stack size." ); - stackError(std::move(error), m_assembly.stackHeight() - _function.parameters.size()); + stackError(std::move(error), m_assembly.stackHeight() - static_cast(_function.parameters.size())); } else { - while (!stackLayout.empty() && stackLayout.back() != int(stackLayout.size() - 1)) + while (!stackLayout.empty() && stackLayout.back() != static_cast(stackLayout.size() - 1)) if (stackLayout.back() < 0) { m_assembly.appendInstruction(evmasm::Instruction::POP); @@ -493,17 +501,17 @@ void CodeTransform::operator()(FunctionDefinition const& _function) } else { - m_assembly.appendInstruction(evmasm::swapInstruction(stackLayout.size() - stackLayout.back() - 1)); - swap(stackLayout[stackLayout.back()], stackLayout.back()); + m_assembly.appendInstruction(evmasm::swapInstruction(stackLayout.size() - static_cast(stackLayout.back()) - 1)); + swap(stackLayout[static_cast(stackLayout.back())], stackLayout.back()); } - for (int i = 0; size_t(i) < stackLayout.size(); ++i) - yulAssert(i == stackLayout[i], "Error reshuffling stack."); + for (size_t i = 0; i < stackLayout.size(); ++i) + yulAssert(i == static_cast(stackLayout[i]), "Error reshuffling stack."); } } if (m_evm15) - m_assembly.appendReturnsub(_function.returnVariables.size(), stackHeightBefore); + m_assembly.appendReturnsub(static_cast(_function.returnVariables.size()), stackHeightBefore); else - m_assembly.appendJump(stackHeightBefore - _function.returnVariables.size()); + m_assembly.appendJump(stackHeightBefore - static_cast(_function.returnVariables.size())); m_assembly.setStackHeight(stackHeightBefore); } @@ -683,7 +691,7 @@ void CodeTransform::generateAssignment(Identifier const& _variableName) if (auto var = m_scope->lookup(_variableName.name)) { Scope::Variable const& _var = std::get(*var); - if (int heightDiff = variableHeightDiff(_var, _variableName.name, true)) + if (size_t heightDiff = variableHeightDiff(_var, _variableName.name, true)) m_assembly.appendInstruction(evmasm::swapInstruction(heightDiff - 1)); m_assembly.appendInstruction(evmasm::Instruction::POP); decreaseReference(_variableName.name, _var); @@ -698,12 +706,12 @@ void CodeTransform::generateAssignment(Identifier const& _variableName) } } -int CodeTransform::variableHeightDiff(Scope::Variable const& _var, YulString _varName, bool _forSwap) +size_t CodeTransform::variableHeightDiff(Scope::Variable const& _var, YulString _varName, bool _forSwap) { yulAssert(m_context->variableStackHeights.count(&_var), ""); - int heightDiff = m_assembly.stackHeight() - m_context->variableStackHeights[&_var]; + size_t heightDiff = static_cast(m_assembly.stackHeight()) - m_context->variableStackHeights[&_var]; yulAssert(heightDiff > (_forSwap ? 1 : 0), "Negative stack difference for variable."); - int limit = _forSwap ? 17 : 16; + size_t limit = _forSwap ? 17 : 16; if (heightDiff > limit) { m_stackErrors.emplace_back(_varName, heightDiff - limit); @@ -723,4 +731,3 @@ void CodeTransform::expectDeposit(int _deposit, int _oldHeight) const { yulAssert(m_assembly.stackHeight() == _oldHeight + _deposit, "Invalid stack deposit."); } - diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 6447aa7b1d13..3c9506b4797f 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -54,7 +54,7 @@ struct StackTooDeepError: virtual YulException struct CodeTransformContext { std::map functionEntryIDs; - std::map variableStackHeights; + std::map variableStackHeights; std::map variableReferences; struct JumpInfo @@ -200,7 +200,7 @@ class CodeTransform /// Determines the stack height difference to the given variables. Throws /// if it is not yet in scope or the height difference is too large. Returns /// the (positive) stack height difference otherwise. - int variableHeightDiff(Scope::Variable const& _var, YulString _name, bool _forSwap); + size_t variableHeightDiff(Scope::Variable const& _var, YulString _name, bool _forSwap); void expectDeposit(int _deposit, int _oldHeight) const; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index b5b5eda6ed81..6875df234b2c 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -63,8 +63,8 @@ pair createEVMFunction( evmasm::InstructionInfo info = evmasm::instructionInfo(_instruction); BuiltinFunctionForEVM f; f.name = YulString{_name}; - f.parameters.resize(info.args); - f.returns.resize(info.ret); + f.parameters.resize(static_cast(info.args)); + f.returns.resize(static_cast(info.ret)); f.sideEffects = EVMDialect::sideEffectsOfInstruction(_instruction); f.controlFlowSideEffects.terminates = evmasm::SemanticInformation::terminatesControlFlow(_instruction); f.controlFlowSideEffects.reverts = evmasm::SemanticInformation::reverts(_instruction); diff --git a/libyul/backends/evm/EVMMetrics.cpp b/libyul/backends/evm/EVMMetrics.cpp index 4d1103578749..f3508afb34d9 100644 --- a/libyul/backends/evm/EVMMetrics.cpp +++ b/libyul/backends/evm/EVMMetrics.cpp @@ -91,7 +91,11 @@ void GasMeterVisitor::operator()(Literal const& _lit) m_runGas += evmasm::GasMeter::runGas(evmasm::Instruction::PUSH1); m_dataGas += singleByteDataGas() + - size_t(evmasm::GasMeter::dataGas(toCompactBigEndian(valueOfLiteral(_lit), 1), m_isCreation, m_dialect.evmVersion())); + static_cast(evmasm::GasMeter::dataGas( + toCompactBigEndian(valueOfLiteral(_lit), 1), + m_isCreation, + m_dialect.evmVersion() + )); } void GasMeterVisitor::operator()(Identifier const&) diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index b305b9c550aa..82de96b518ae 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -376,12 +376,12 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) if (_call.functionName == "dataoffset") { string name = get(_call.arguments.at(0)).value; - return toBytes(Opcode::I64Const) + lebEncodeSigned(m_subModulePosAndSize.at(name).first); + return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(m_subModulePosAndSize.at(name).first)); } else if (_call.functionName == "datasize") { string name = get(_call.arguments.at(0)).value; - return toBytes(Opcode::I64Const) + lebEncodeSigned(m_subModulePosAndSize.at(name).second); + return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(m_subModulePosAndSize.at(name).second)); } bytes args = visit(_call.arguments); diff --git a/libyul/backends/wasm/WordSizeTransform.cpp b/libyul/backends/wasm/WordSizeTransform.cpp index edcc089238d9..473f7324f3d6 100644 --- a/libyul/backends/wasm/WordSizeTransform.cpp +++ b/libyul/backends/wasm/WordSizeTransform.cpp @@ -112,7 +112,7 @@ void WordSizeTransform::operator()(Block& _block) yulAssert(varDecl.variables.size() == 1, ""); auto newLhs = generateU64IdentifierNames(varDecl.variables[0].name); vector ret; - for (int i = 0; i < 3; i++) + for (size_t i = 0; i < 3; i++) ret.emplace_back(VariableDeclaration{ varDecl.location, {TypedName{varDecl.location, newLhs[i], m_targetDialect.defaultType}}, @@ -143,7 +143,7 @@ void WordSizeTransform::operator()(Block& _block) auto newRhs = expandValue(*varDecl.value); auto newLhs = generateU64IdentifierNames(varDecl.variables[0].name); vector ret; - for (int i = 0; i < 4; i++) + for (size_t i = 0; i < 4; i++) ret.emplace_back(VariableDeclaration{ varDecl.location, {TypedName{varDecl.location, newLhs[i], m_targetDialect.defaultType}}, @@ -172,7 +172,7 @@ void WordSizeTransform::operator()(Block& _block) yulAssert(assignment.variableNames.size() == 1, ""); auto newLhs = generateU64IdentifierNames(assignment.variableNames[0].name); vector ret; - for (int i = 0; i < 3; i++) + for (size_t i = 0; i < 3; i++) ret.emplace_back(Assignment{ assignment.location, {Identifier{assignment.location, newLhs[i]}}, @@ -203,7 +203,7 @@ void WordSizeTransform::operator()(Block& _block) auto newRhs = expandValue(*assignment.value); YulString lhsName = assignment.variableNames[0].name; vector ret; - for (int i = 0; i < 4; i++) + for (size_t i = 0; i < 4; i++) ret.emplace_back(Assignment{ assignment.location, {Identifier{assignment.location, m_variableMapping.at(lhsName)[i]}}, @@ -382,7 +382,7 @@ std::vector WordSizeTransform::handleSwitch(Switch& _switch) array WordSizeTransform::generateU64IdentifierNames(YulString const& _s) { yulAssert(m_variableMapping.find(_s) == m_variableMapping.end(), ""); - for (int i = 0; i < 4; i++) + for (size_t i = 0; i < 4; i++) m_variableMapping[_s][i] = m_nameDispenser.newName(YulString{_s.str() + "_" + to_string(i)}); return m_variableMapping[_s]; } @@ -392,19 +392,20 @@ array, 4> WordSizeTransform::expandValue(Expression const array, 4> ret; if (holds_alternative(_e)) { - Identifier const& id = std::get(_e); - for (int i = 0; i < 4; i++) + auto const& id = std::get(_e); + for (size_t i = 0; i < 4; i++) ret[i] = make_unique(Identifier{id.location, m_variableMapping.at(id.name)[i]}); } else if (holds_alternative(_e)) { - Literal const& lit = std::get(_e); + auto const& lit = std::get(_e); u256 val = valueOfLiteral(lit); - for (int i = 3; i >= 0; i--) + for (size_t exprIndex = 0; exprIndex < 4; ++exprIndex) { + size_t exprIndexReverse = 3 - exprIndex; u256 currentVal = val & std::numeric_limits::max(); val >>= 64; - ret[i] = make_unique( + ret[exprIndexReverse] = make_unique( Literal{ lit.location, LiteralKind::Number, @@ -426,4 +427,3 @@ vector WordSizeTransform::expandValueToVector(Expression const& _e) ret.emplace_back(std::move(*val)); return ret; } - diff --git a/libyul/optimiser/DeadCodeEliminator.cpp b/libyul/optimiser/DeadCodeEliminator.cpp index 890161bf0c7a..2416af514f58 100644 --- a/libyul/optimiser/DeadCodeEliminator.cpp +++ b/libyul/optimiser/DeadCodeEliminator.cpp @@ -51,10 +51,10 @@ void DeadCodeEliminator::operator()(Block& _block) tie(controlFlowChange, index) = TerminationFinder{m_dialect}.firstUnconditionalControlFlowChange(_block.statements); // Erase everything after the terminating statement that is not a function definition. - if (controlFlowChange != TerminationFinder::ControlFlow::FlowOut && index != size_t(-1)) + if (controlFlowChange != TerminationFinder::ControlFlow::FlowOut && index != std::numeric_limits::max()) _block.statements.erase( remove_if( - _block.statements.begin() + index + 1, + _block.statements.begin() + static_cast(index) + 1, _block.statements.end(), [] (Statement const& _s) { return !holds_alternative(_s); } ), @@ -63,4 +63,3 @@ void DeadCodeEliminator::operator()(Block& _block) ASTModifier::operator()(_block); } - diff --git a/libyul/optimiser/ExpressionJoiner.cpp b/libyul/optimiser/ExpressionJoiner.cpp index ba38fa86e3d2..45c23dcc3022 100644 --- a/libyul/optimiser/ExpressionJoiner.cpp +++ b/libyul/optimiser/ExpressionJoiner.cpp @@ -119,7 +119,7 @@ void ExpressionJoiner::decrementLatestStatementPointer() void ExpressionJoiner::resetLatestStatementPointer() { m_currentBlock = nullptr; - m_latestStatementInBlock = size_t(-1); + m_latestStatementInBlock = numeric_limits::max(); } Statement* ExpressionJoiner::latestStatement() diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index a6f41b8445e6..f9d831b7abef 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -180,7 +180,7 @@ pair TerminationFinder::firstUncondition if (controlFlow != ControlFlow::FlowOut) return {controlFlow, i}; } - return {ControlFlow::FlowOut, size_t(-1)}; + return {ControlFlow::FlowOut, numeric_limits::max()}; } TerminationFinder::ControlFlow TerminationFinder::controlFlowKind(Statement const& _statement) diff --git a/libyul/optimiser/StackCompressor.cpp b/libyul/optimiser/StackCompressor.cpp index cfb2fef82112..d011c64b8b8e 100644 --- a/libyul/optimiser/StackCompressor.cpp +++ b/libyul/optimiser/StackCompressor.cpp @@ -178,14 +178,14 @@ bool StackCompressor::run( eliminateVariables( _dialect, std::get(_object.code->statements.at(0)), - stackSurplus.at({}), + static_cast(stackSurplus.at({})), allowMSizeOptimzation ); } for (size_t i = 1; i < _object.code->statements.size(); ++i) { - FunctionDefinition& fun = std::get(_object.code->statements[i]); + auto& fun = std::get(_object.code->statements[i]); if (!stackSurplus.count(fun.name)) continue; @@ -193,7 +193,7 @@ bool StackCompressor::run( eliminateVariables( _dialect, fun, - stackSurplus.at(fun.name), + static_cast(stackSurplus.at(fun.name)), allowMSizeOptimzation ); } From 9264135bef2365cf1a1caec4d7eca8a99de5d80a Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 6 May 2020 17:58:57 +0200 Subject: [PATCH 242/479] Add tests to validate clearing dirty bits via inline assembly operations --- .../semanticTests/dirty_calldata_bytes.sol | 12 ++++++++++ .../dirty_calldata_dynamic_array.sol | 12 ++++++++++ .../dirty_memory_bytes_to_storgage_copy.sol | 16 +++++++++++++ .../viaYul/dirty_calldata_struct.sol | 18 +++++++++++++++ .../viaYul/dirty_memory_dynamic_array.sol | 18 +++++++++++++++ .../viaYul/dirty_memory_int32.sol | 18 +++++++++++++++ .../viaYul/dirty_memory_read.sol | 15 ------------ .../viaYul/dirty_memory_static_array.sol | 18 +++++++++++++++ .../viaYul/dirty_memory_struct.sol | 22 ++++++++++++++++++ .../viaYul/dirty_memory_uint32.sol | 18 +++++++++++++++ .../viaYul/storage/dirty_storage_bytes.sol | 18 +++++++++++++++ .../storage/dirty_storage_bytes_long.sol | 20 ++++++++++++++++ .../storage/dirty_storage_dynamic_array.sol | 20 ++++++++++++++++ .../storage/dirty_storage_static_array.sol | 18 +++++++++++++++ .../viaYul/storage/dirty_storage_struct.sol | 23 +++++++++++++++++++ 15 files changed, 251 insertions(+), 15 deletions(-) create mode 100644 test/libsolidity/semanticTests/dirty_calldata_bytes.sol create mode 100644 test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol create mode 100644 test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_calldata_struct.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol delete mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_read.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol create mode 100644 test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol create mode 100644 test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol create mode 100644 test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol create mode 100644 test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol create mode 100644 test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol create mode 100644 test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol diff --git a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol new file mode 100644 index 000000000000..05a3793f60b7 --- /dev/null +++ b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol @@ -0,0 +1,12 @@ +contract C { + function f(bytes calldata b) public returns (bool correct) { + byte a = b[3]; + uint r; + assembly { + r := a + } + correct = r == (0x64 << 248); + } +} +// ---- +// f(bytes): 0x20, 0x04, "dead" -> true \ No newline at end of file diff --git a/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol b/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol new file mode 100644 index 000000000000..1c9d7db3022b --- /dev/null +++ b/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol @@ -0,0 +1,12 @@ +contract C { + function f(int16[] calldata a) external returns (bool correct) { + uint32 x = uint32(a[1]); + uint r; + assembly { + r := x + } + correct = r == 0x7fff; + } +} +// ---- +// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true \ No newline at end of file diff --git a/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol b/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol new file mode 100644 index 000000000000..8fc6c33ec4cc --- /dev/null +++ b/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol @@ -0,0 +1,16 @@ +contract C { + bytes x; + function f() public returns (uint r) { + bytes memory m = "tmp"; + assembly { + mstore(m, 8) + mstore(add(m, 32), "deadbeef15dead") + } + x = m; + assembly { + r := sload(x_slot) + } + } +} +// ---- +// f() -> 0x6465616462656566313564656164000000000000000000000000000000000010 diff --git a/test/libsolidity/semanticTests/viaYul/dirty_calldata_struct.sol b/test/libsolidity/semanticTests/viaYul/dirty_calldata_struct.sol new file mode 100644 index 000000000000..633fc45c6d48 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_calldata_struct.sol @@ -0,0 +1,18 @@ +pragma experimental ABIEncoderV2; +contract C { + struct S { + uint16[] m; + } + function f(S calldata s) public pure returns (bool correct) { + int8 x = int8(s.m[0]); + uint r; + assembly { + r := x + } + correct = r == 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80; + } +} +// ==== +// compileViaYul: true +// ---- +// f((uint16[])): 0x20, 0x20, 0x01, 0x0180 -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol new file mode 100644 index 000000000000..36a253b02452 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure returns (bool correct) { + uint8[] memory m = new uint8[](1); + assembly { + mstore(add(m, 32), 258) + } + uint8 x = m[0]; + uint r; + assembly { + r := x + } + correct = (m[0] == 0x02) && (r == 0x02); + } +} +// ==== +// compileViaYul: true +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol new file mode 100644 index 000000000000..f4f0525bd1ae --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure returns (bool correct) { + uint256[1] memory m; + assembly { + mstore(m, 0xdeadbeef15dead) + } + int32 x = int32(m[0]); + uint r; + assembly { + r := x + } + correct = (m[0] == 0xdeadbeef15dead) && (r == (((2 ** 224 - 1) << 32) | 0xef15dead)); + } +} +// ==== +// compileViaYul: true +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_read.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_read.sol deleted file mode 100644 index d03aa489f620..000000000000 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_read.sol +++ /dev/null @@ -1,15 +0,0 @@ -contract C { - function f() public pure returns (uint8 x, bool a, bool b) { - uint8[1] memory m; - assembly { - mstore(m, 257) - } - x = m[0]; - a = (m[0] == 0x01); - b = (m[0] == 0x0101); - } -} -// ==== -// compileViaYul: also -// ---- -// f() -> 1, true, false diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol new file mode 100644 index 000000000000..4742bae2dfdf --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure returns (bool correct) { + uint8[1] memory m; + assembly { + mstore(m, 257) + } + uint8 x = m[0]; + uint r; + assembly { + r := x + } + correct = (m[0] == 0x01) && (r == 0x01); + } +} +// ==== +// compileViaYul: true +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol new file mode 100644 index 000000000000..411cbe069e6a --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol @@ -0,0 +1,22 @@ +contract C { + struct S { + uint8[] m; + } + function f() public pure returns (bool correct) { + S memory s; + s.m = new uint8[](1); + assembly { + mstore(add(s, 64), 257) + } + uint8 x = s.m[0]; + uint r; + assembly { + r := x + } + correct = r == 0x01; + } +} +// ==== +// compileViaYul: true +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol new file mode 100644 index 000000000000..a23a566c5bbe --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure returns (bool correct) { + uint256[1] memory m; + assembly { + mstore(m, 0xdeadbeef15dead) + } + uint32 x = uint32(m[0]); + uint r; + assembly { + r := x + } + correct = (r == 0xef15dead) && (m[0] == 0xdeadbeef15dead); + } +} +// ==== +// compileViaYul: true +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol new file mode 100644 index 000000000000..ea0112fe521a --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol @@ -0,0 +1,18 @@ +contract C { + bytes b; + function f() public returns (bool correct) { + assembly { + sstore(b_slot, or("deadbeef", 0x08)) + } + byte s = b[3]; + uint r; + assembly { + r := s + } + correct = r == (0x64 << 248); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol new file mode 100644 index 000000000000..9cb01d63a814 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol @@ -0,0 +1,20 @@ +contract C { + bytes b; + function f() public returns (bool correct) { + assembly { + sstore(b_slot, 0x41) + mstore(0, b_slot) + sstore(keccak256(0, 0x20), "deadbeefdeadbeefdeadbeefdeadbeef") + } + byte s = b[31]; + uint r; + assembly { + r := s + } + correct = r == (0x66 << 248); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true \ No newline at end of file diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol new file mode 100644 index 000000000000..bc886b93d914 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol @@ -0,0 +1,20 @@ +contract C { + uint8[] s; + function f() public returns (bool correct) { + s.push(); + assembly { + mstore(0, s_slot) + sstore(keccak256(0, 0x20), 257) + } + uint8 x = s[0]; + uint r; + assembly { + r := x + } + correct = (s[0] == 0x01) && (r == 0x01); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol new file mode 100644 index 000000000000..7d7298fee7ad --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol @@ -0,0 +1,18 @@ +contract C { + uint8[1] s; + function f() public returns (bool correct) { + assembly { + sstore(s_slot, 257) + } + uint8 x = s[0]; + uint r; + assembly { + r := x + } + correct = (s[0] == 0x01) && (r == 0x01); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol new file mode 100644 index 000000000000..1cf19c5beb21 --- /dev/null +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol @@ -0,0 +1,23 @@ +contract C { + struct S { + uint8[] m; + } + S s; + function f() public returns (bool correct) { + s.m.push(); + assembly { + mstore(0, s_slot) + sstore(keccak256(0, 0x20), 257) + } + uint8 x = s.m[0]; + uint r; + assembly { + r := x + } + correct = r == 0x01; + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true From 07c116713610e94eba4c1ae9004d2a3c3d24aa10 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2020 17:17:07 +0200 Subject: [PATCH 243/479] Refactor name and type resolution. --- libsolidity/analysis/NameAndTypeResolver.cpp | 17 +++---- libsolidity/analysis/NameAndTypeResolver.h | 7 +-- libsolidity/analysis/TypeChecker.cpp | 4 +- libsolidity/analysis/TypeChecker.h | 4 +- libsolidity/interface/CompilerStack.cpp | 45 +++++++++---------- test/libsolidity/Assembly.cpp | 22 +++------ .../SolidityExpressionCompiler.cpp | 13 ++---- 7 files changed, 46 insertions(+), 66 deletions(-) diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index fa1840d06a43..9fbd219f91b9 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -123,11 +123,13 @@ bool NameAndTypeResolver::performImports(SourceUnit& _sourceUnit, map const& node: _source.nodes()) + if (!resolveNamesAndTypesInternal(*node, true)) + return false; } catch (langutil::FatalError const&) { @@ -135,6 +137,7 @@ bool NameAndTypeResolver::resolveNamesAndTypes(ASTNode& _node, bool _resolveInsi throw; // Something is weird here, rather throw again. return false; } + return true; } bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration) @@ -227,13 +230,14 @@ bool NameAndTypeResolver::resolveNamesAndTypesInternal(ASTNode& _node, bool _res bool success = true; setScope(contract->scope()); solAssert(!!m_currentScope, ""); + solAssert(_resolveInsideCode, ""); m_globalContext.setCurrentContract(*contract); updateDeclaration(*m_globalContext.currentSuper()); updateDeclaration(*m_globalContext.currentThis()); for (ASTPointer const& baseContract: contract->baseContracts()) - if (!resolveNamesAndTypes(*baseContract, true)) + if (!resolveNamesAndTypesInternal(*baseContract, true)) success = false; setScope(contract); @@ -254,23 +258,20 @@ bool NameAndTypeResolver::resolveNamesAndTypesInternal(ASTNode& _node, bool _res for (ASTPointer const& node: contract->subNodes()) { setScope(contract); - if (!resolveNamesAndTypes(*node, false)) + if (!resolveNamesAndTypesInternal(*node, false)) success = false; } if (!success) return false; - if (!_resolveInsideCode) - return success; - setScope(contract); // now resolve references inside the code for (ASTPointer const& node: contract->subNodes()) { setScope(contract); - if (!resolveNamesAndTypes(*node, true)) + if (!resolveNamesAndTypesInternal(*node, true)) success = false; } return success; diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h index 8a315510fba8..efb4040380e0 100644 --- a/libsolidity/analysis/NameAndTypeResolver.h +++ b/libsolidity/analysis/NameAndTypeResolver.h @@ -65,12 +65,9 @@ class NameAndTypeResolver: private boost::noncopyable bool registerDeclarations(SourceUnit& _sourceUnit, ASTNode const* _currentScope = nullptr); /// Applies the effect of import directives. bool performImports(SourceUnit& _sourceUnit, std::map const& _sourceUnits); - /// Resolves all names and types referenced from the given AST Node. - /// This is usually only called at the contract level, but with a bit of care, it can also - /// be called at deeper levels. - /// @param _resolveInsideCode if false, does not descend into nodes that contain code. + /// Resolves all names and types referenced from the given Source Node. /// @returns false in case of error. - bool resolveNamesAndTypes(ASTNode& _node, bool _resolveInsideCode = true); + bool resolveNamesAndTypes(SourceUnit& _source); /// Updates the given global declaration (used for "this"). Not to be used with declarations /// that create their own scope. /// @returns false in case of error. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c308fadd8efe..a85f4f9e93bd 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -62,9 +62,9 @@ bool TypeChecker::typeSupportedByOldABIEncoder(Type const& _type, bool _isLibrar return true; } -bool TypeChecker::checkTypeRequirements(ASTNode const& _contract) +bool TypeChecker::checkTypeRequirements(SourceUnit const& _source) { - _contract.accept(*this); + _source.accept(*this); return Error::containsOnlyWarnings(m_errorReporter.errors()); } diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 9997c700a630..948d63648c29 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -51,9 +51,9 @@ class TypeChecker: private ASTConstVisitor m_errorReporter(_errorReporter) {} - /// Performs type checking on the given contract and all of its sub-nodes. + /// Performs type checking on the given source and all of its sub-nodes. /// @returns true iff all checks passed. Note even if all checks passed, errors() can still contain warnings - bool checkTypeRequirements(ASTNode const& _contract); + bool checkTypeRequirements(SourceUnit const& _source); /// @returns the type of an expression and asserts that it is present. TypePointer const& type(Expression const& _expression) const; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index a8efdfb0b95e..eef773095d49 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -326,28 +326,28 @@ bool CompilerStack::analyze() if (source->ast && !resolver.performImports(*source->ast, sourceUnitsByName)) return false; - // This is the main name and type resolution loop. Needs to be run for every contract, because - // the special variables "this" and "super" must be set appropriately. + for (Source const* source: m_sourceOrder) + if (source->ast && !resolver.resolveNamesAndTypes(*source->ast)) + return false; + + // Store contract definitions. for (Source const* source: m_sourceOrder) if (source->ast) - for (ASTPointer const& node: source->ast->nodes()) + for ( + ContractDefinition const* contract: + ASTNode::filteredNodes(source->ast->nodes()) + ) { - if (!resolver.resolveNamesAndTypes(*node)) - return false; - if (ContractDefinition* contract = dynamic_cast(node.get())) - { - // Note that we now reference contracts by their fully qualified names, and - // thus contracts can only conflict if declared in the same source file. This - // should already cause a double-declaration error elsewhere. - if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end()) - m_contracts[contract->fullyQualifiedName()].contract = contract; - else - solAssert( - m_errorReporter.hasErrors(), - "Contract already present (name clash?), but no error was reported." - ); - } - + // Note that we now reference contracts by their fully qualified names, and + // thus contracts can only conflict if declared in the same source file. This + // should already cause a double-declaration error elsewhere. + if (!m_contracts.count(contract->fullyQualifiedName())) + m_contracts[contract->fullyQualifiedName()].contract = contract; + else + solAssert( + m_errorReporter.hasErrors(), + "Contract already present (name clash?), but no error was reported." + ); } DeclarationTypeChecker declarationTypeChecker(m_errorReporter, m_evmVersion); @@ -376,11 +376,8 @@ bool CompilerStack::analyze() // which is only done one step later. TypeChecker typeChecker(m_evmVersion, m_errorReporter); for (Source const* source: m_sourceOrder) - if (source->ast) - for (ASTPointer const& node: source->ast->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - if (!typeChecker.checkTypeRequirements(*contract)) - noErrors = false; + if (source->ast && !typeChecker.checkTypeRequirements(*source->ast)) + noErrors = false; if (noErrors) { diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 0484bf95cc00..885f0b2d3c71 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -63,27 +63,19 @@ evmasm::AssemblyItems compileContract(std::shared_ptr _sourceCode) DeclarationTypeChecker declarationTypeChecker(errorReporter, solidity::test::CommonOptions::get().evmVersion()); solAssert(Error::containsOnlyWarnings(errorReporter.errors()), ""); resolver.registerDeclarations(*sourceUnit); - for (ASTPointer const& node: sourceUnit->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - { - BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract)); - if (!Error::containsOnlyWarnings(errorReporter.errors())) - return AssemblyItems(); - } + BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*sourceUnit)); + if (!Error::containsOnlyWarnings(errorReporter.errors())) + return AssemblyItems(); for (ASTPointer const& node: sourceUnit->nodes()) { BOOST_REQUIRE_NO_THROW(declarationTypeChecker.check(*node)); if (!Error::containsOnlyWarnings(errorReporter.errors())) return AssemblyItems(); } - for (ASTPointer const& node: sourceUnit->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - { - TypeChecker checker(solidity::test::CommonOptions::get().evmVersion(), errorReporter); - BOOST_REQUIRE_NO_THROW(checker.checkTypeRequirements(*contract)); - if (!Error::containsOnlyWarnings(errorReporter.errors())) - return AssemblyItems(); - } + TypeChecker checker(solidity::test::CommonOptions::get().evmVersion(), errorReporter); + BOOST_REQUIRE_NO_THROW(checker.checkTypeRequirements(*sourceUnit)); + if (!Error::containsOnlyWarnings(errorReporter.errors())) + return AssemblyItems(); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 41c850b4d90f..4d1e9e23a13e 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -118,19 +118,12 @@ bytes compileFirstExpression( GlobalContext globalContext; NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), errorReporter); resolver.registerDeclarations(*sourceUnit); - for (ASTPointer const& node: sourceUnit->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - BOOST_REQUIRE_MESSAGE(resolver.resolveNamesAndTypes(*contract), "Resolving names failed"); + BOOST_REQUIRE_MESSAGE(resolver.resolveNamesAndTypes(*sourceUnit), "Resolving names failed"); DeclarationTypeChecker declarationTypeChecker(errorReporter, solidity::test::CommonOptions::get().evmVersion()); for (ASTPointer const& node: sourceUnit->nodes()) BOOST_REQUIRE(declarationTypeChecker.check(*node)); - for (ASTPointer const& node: sourceUnit->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - { - ErrorReporter errorReporter(errors); - TypeChecker typeChecker(solidity::test::CommonOptions::get().evmVersion(), errorReporter); - BOOST_REQUIRE(typeChecker.checkTypeRequirements(*contract)); - } + TypeChecker typeChecker(solidity::test::CommonOptions::get().evmVersion(), errorReporter); + BOOST_REQUIRE(typeChecker.checkTypeRequirements(*sourceUnit)); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { From 194c2b8c9c53710826c84e5aa6b778eaa36875ef Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jun 2020 00:16:24 +0200 Subject: [PATCH 244/479] Directly determine if experimental feature active. --- libsolidity/analysis/TypeChecker.cpp | 29 +++++++++++++++++----------- libsolidity/analysis/TypeChecker.h | 3 +++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index a85f4f9e93bd..c6b9fcbf5c5a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -64,7 +64,9 @@ bool TypeChecker::typeSupportedByOldABIEncoder(Type const& _type, bool _isLibrar bool TypeChecker::checkTypeRequirements(SourceUnit const& _source) { + m_currentSourceUnit = &_source; _source.accept(*this); + m_currentSourceUnit = nullptr; return Error::containsOnlyWarnings(m_errorReporter.errors()); } @@ -373,7 +375,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) } if ( _function.isPublic() && - !_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2) && + !experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2) && !typeSupportedByOldABIEncoder(*type(var), _function.libraryFunction()) ) m_errorReporter.typeError( @@ -511,7 +513,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) else if (_variable.visibility() >= Visibility::Public) { FunctionType getter(_variable); - if (!_variable.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2)) + if (!experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2)) { vector unsupportedTypes; for (auto const& param: getter.parameterTypes() + getter.returnParameterTypes()) @@ -622,7 +624,7 @@ bool TypeChecker::visit(EventDefinition const& _eventDef) if (!type(*var)->interfaceType(false)) m_errorReporter.typeError(3417_error, var->location(), "Internal or recursive type is not allowed as event parameter type."); if ( - !_eventDef.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2) && + !experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2) && !typeSupportedByOldABIEncoder(*type(*var), false /* isLibrary */) ) m_errorReporter.typeError( @@ -1912,9 +1914,7 @@ void TypeChecker::typeCheckABIEncodeFunctions( bool const isPacked = _functionType->kind() == FunctionType::Kind::ABIEncodePacked; solAssert(_functionType->padArguments() != isPacked, "ABI function with unexpected padding"); - bool const abiEncoderV2 = m_currentContract->sourceUnit().annotation().experimentalFeatures.count( - ExperimentalFeature::ABIEncoderV2 - ); + bool const abiEncoderV2 = experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2); // Check for named arguments if (!_functionCall.names().empty()) @@ -2311,11 +2311,10 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) { case FunctionType::Kind::ABIDecode: { - bool const abiEncoderV2 = - m_currentContract->sourceUnit().annotation().experimentalFeatures.count( - ExperimentalFeature::ABIEncoderV2 - ); - returnTypes = typeCheckABIDecodeAndRetrieveReturnType(_functionCall, abiEncoderV2); + returnTypes = typeCheckABIDecodeAndRetrieveReturnType( + _functionCall, + experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2) + ); break; } case FunctionType::Kind::ABIEncode: @@ -3256,3 +3255,11 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss m_errorReporter.typeError(errorId, _expression.location(), description); } + +bool TypeChecker::experimentalFeatureActive(ExperimentalFeature _feature) const +{ + solAssert(m_currentSourceUnit, ""); + if (m_currentContract) + solAssert(m_currentSourceUnit == &m_currentContract->sourceUnit(), ""); + return m_currentSourceUnit->annotation().experimentalFeatures.count(_feature); +} diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 948d63648c29..732f6275aa34 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -165,6 +165,9 @@ class TypeChecker: private ASTConstVisitor /// Runs type checks on @a _expression to infer its type and then checks that it is an LValue. void requireLValue(Expression const& _expression, bool _ordinaryAssignment); + bool experimentalFeatureActive(ExperimentalFeature _feature) const; + + SourceUnit const* m_currentSourceUnit = nullptr; ContractDefinition const* m_currentContract = nullptr; langutil::EVMVersion m_evmVersion; From 3c4e2863908cc158edf083aa570d3940430b98ca Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 9 Jun 2020 13:07:40 +0200 Subject: [PATCH 245/479] [SMTChecker] Replace wrap mod by slack vars --- libsolidity/formal/EncodingContext.cpp | 11 +++ libsolidity/formal/EncodingContext.h | 7 ++ libsolidity/formal/SMTEncoder.cpp | 69 +++++++++++++------ .../functions_recursive_indirect.sol | 1 - .../loops/for_1_false_positive.sol | 2 - ..._loop_array_assignment_storage_storage.sol | 2 - 6 files changed, 66 insertions(+), 26 deletions(-) diff --git a/libsolidity/formal/EncodingContext.cpp b/libsolidity/formal/EncodingContext.cpp index 51dd37a3d26f..57686ace460d 100644 --- a/libsolidity/formal/EncodingContext.cpp +++ b/libsolidity/formal/EncodingContext.cpp @@ -32,12 +32,23 @@ EncodingContext::EncodingContext(): void EncodingContext::reset() { resetAllVariables(); + resetSlackId(); m_expressions.clear(); m_globalContext.clear(); m_state.reset(); m_assertions.clear(); } +void EncodingContext::resetSlackId() +{ + m_nextSlackId = 0; +} + +unsigned EncodingContext::newSlackId() +{ + return m_nextSlackId++; +} + void EncodingContext::clear() { m_variables.clear(); diff --git a/libsolidity/formal/EncodingContext.h b/libsolidity/formal/EncodingContext.h index 79f9567a5284..fcfd5e149456 100644 --- a/libsolidity/formal/EncodingContext.h +++ b/libsolidity/formal/EncodingContext.h @@ -40,6 +40,10 @@ class EncodingContext /// alive because of state variables and inlined function calls. /// To be used in the beginning of a root function visit. void reset(); + /// Resets the fresh id for slack variables. + void resetSlackId(); + /// Returns the current fresh slack id and increments it. + unsigned newSlackId(); /// Clears the entire context, erasing everything. /// To be used before a model checking engine starts. void clear(); @@ -168,6 +172,9 @@ class EncodingContext /// Whether to conjoin assertions in the assertion stack. bool m_accumulateAssertions = true; //@} + + /// Fresh ids for slack variables to be created deterministically. + unsigned m_nextSlackId = 0; }; } diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 82cd7557874c..6faaaf600ce8 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1204,7 +1204,7 @@ pair SMTEncoder::arithmeticOperation( smtutil::Expression const& _left, smtutil::Expression const& _right, TypePointer const& _commonType, - Expression const& + Expression const& _operation ) { static set validOperators{ @@ -1227,39 +1227,66 @@ pair SMTEncoder::arithmeticOperation( else intType = TypeProvider::uint256(); - smtutil::Expression valueNoMod( - _op == Token::Add ? _left + _right : - _op == Token::Sub ? _left - _right : - _op == Token::Div ? division(_left, _right, *intType) : - _op == Token::Mul ? _left * _right : - /*_op == Token::Mod*/ _left % _right - ); + auto valueUnbounded = [&]() -> smtutil::Expression { + switch (_op) + { + case Token::Add: return _left + _right; + case Token::Sub: return _left - _right; + case Token::Mul: return _left * _right; + case Token::Div: return division(_left, _right, *intType); + case Token::Mod: return _left % _right; + default: solAssert(false, ""); + } + }(); if (_op == Token::Div || _op == Token::Mod) + { m_context.addAssertion(_right != 0); + // mod and unsigned division never underflow/overflow + if (_op == Token::Mod || !intType->isSigned()) + return {valueUnbounded, valueUnbounded}; + + // The only case where division overflows is + // - type is signed + // - LHS is type.min + // - RHS is -1 + // the result is then -(type.min), which wraps back to type.min + smtutil::Expression maxLeft = _left == smt::minValue(*intType); + smtutil::Expression minusOneRight = _right == -1; + smtutil::Expression wrap = smtutil::Expression::ite(maxLeft && minusOneRight, smt::minValue(*intType), valueUnbounded); + return {wrap, valueUnbounded}; + } + auto symbMin = smt::minValue(*intType); auto symbMax = smt::maxValue(*intType); smtutil::Expression intValueRange = (0 - symbMin) + symbMax + 1; + string suffix = to_string(_operation.id()) + "_" + to_string(m_context.newSlackId()); + smt::SymbolicIntVariable k(intType, intType, "k_" + suffix, m_context); + smt::SymbolicIntVariable m(intType, intType, "m_" + suffix, m_context); + + // To wrap around valueUnbounded in case of overflow or underflow, we replace it with a k, given: + // 1. k + m * intValueRange = valueUnbounded + // 2. k is in range of the desired integer type + auto wrap = k.currentValue(); + m_context.addAssertion(valueUnbounded == (k.currentValue() + intValueRange * m.currentValue())); + m_context.addAssertion(k.currentValue() >= symbMin); + m_context.addAssertion(k.currentValue() <= symbMax); + + // TODO this could be refined: + // for unsigned types it's enough to check only the upper bound. auto value = smtutil::Expression::ite( - valueNoMod > symbMax, - valueNoMod % intValueRange, + valueUnbounded > symbMax, + wrap, smtutil::Expression::ite( - valueNoMod < symbMin, - valueNoMod % intValueRange, - valueNoMod + valueUnbounded < symbMin, + wrap, + valueUnbounded ) ); - if (intType->isSigned()) - value = smtutil::Expression::ite( - value > symbMax, - value - intValueRange, - value - ); - - return {value, valueNoMod}; + return {value, valueUnbounded}; } void SMTEncoder::compareOperation(BinaryOperation const& _op) diff --git a/test/libsolidity/smtCheckerTests/functions/functions_recursive_indirect.sol b/test/libsolidity/smtCheckerTests/functions/functions_recursive_indirect.sol index 5d3292992ad3..7cb7b22b1aaa 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_recursive_indirect.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_recursive_indirect.sol @@ -22,4 +22,3 @@ contract C } } // ---- -// Warning: (130-144): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol index 11cd22d11840..c37df70c41db 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol @@ -14,6 +14,4 @@ contract C } } // ---- -// Warning: (296-309): Error trying to invoke SMT solver. // Warning: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (296-309): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index 5c664f214861..a90053024d47 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,7 +19,5 @@ contract LoopFor2 { } } // ---- -// Warning: (317-337): Error trying to invoke SMT solver. -// Warning: (317-337): Assertion violation happens here // Warning: (341-360): Assertion violation happens here // Warning: (364-383): Assertion violation happens here From 7c28953a61ebb3b7cf5ccd0e79cbab8b63981a9a Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2020 14:49:14 +0200 Subject: [PATCH 246/479] Missing changelog entry. --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index e5f4da7b5ba4..2a0d2caf6fce 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Breaking changes: * Deprecated dot syntax for `value` and `gas`. * Deprecated the identifier `now`. * JSON AST: Removes members with ``null`` value from JSON output. + * Parser: NatSpec comments on variables are only allowed for public state variables. * Type Checker: Disallow shifts by signed types. * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. From d54e7f50ed137fd3e928c86ff196a9b98a6e4650 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 9 Jun 2020 17:30:17 +0200 Subject: [PATCH 247/479] Natspec: Output "type" and "version" in documenation --- Changelog.md | 1 + libsolidity/interface/Natspec.cpp | 6 ++++++ libsolidity/interface/Natspec.h | 2 ++ test/libsolidity/SolidityNatspecJSON.cpp | 5 +++++ test/libsolidity/StandardCompiler.cpp | 4 ++-- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index a4b44052977b..2510afc2e527 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Language Features: Compiler Features: + * NatSpec: Add fields "kind" and "version" to the JSON output. Bugfixes: diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 25dcd794e0e2..9fadd41219d3 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -37,6 +37,9 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) Json::Value doc; Json::Value methods(Json::objectValue); + doc["version"] = Json::Value(c_natspecVersion); + doc["kind"] = Json::Value("user"); + auto constructorDefinition(_contractDef.constructor()); if (constructorDefinition) { @@ -87,6 +90,9 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef) Json::Value doc; Json::Value methods(Json::objectValue); + doc["version"] = Json::Value(c_natspecVersion); + doc["kind"] = Json::Value("dev"); + auto author = extractDoc(_contractDef.annotation().docTags, "author"); if (!author.empty()) doc["author"] = author; diff --git a/libsolidity/interface/Natspec.h b/libsolidity/interface/Natspec.h index fc13519e4c2a..8d414e71a4ca 100644 --- a/libsolidity/interface/Natspec.h +++ b/libsolidity/interface/Natspec.h @@ -40,6 +40,8 @@ struct DocTag; class Natspec { public: + static unsigned int constexpr c_natspecVersion = 1; + /// Get the User documentation of the contract /// @param _contractDef The contract definition /// @return A JSON representation of the contract's user documentation diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index fa1d2614d2e0..06a4fc4fb614 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -56,6 +57,10 @@ class DocumentationChecker generatedDocumentation = m_compilerStack.natspecDev(_contractName); Json::Value expectedDocumentation; util::jsonParseStrict(_expectedDocumentationString, expectedDocumentation); + + expectedDocumentation["version"] = Json::Value(Natspec::c_natspecVersion); + expectedDocumentation["kind"] = Json::Value(_userDocumentation ? "user" : "dev"); + BOOST_CHECK_MESSAGE( expectedDocumentation == generatedDocumentation, "Expected:\n" << expectedDocumentation.toStyledString() << diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index f8ae1d873cf4..e4f77b581f2d 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -354,9 +354,9 @@ BOOST_AUTO_TEST_CASE(basic_compilation) BOOST_CHECK(contract["abi"].isArray()); BOOST_CHECK_EQUAL(util::jsonCompactPrint(contract["abi"]), "[]"); BOOST_CHECK(contract["devdoc"].isObject()); - BOOST_CHECK_EQUAL(util::jsonCompactPrint(contract["devdoc"]), "{\"methods\":{}}"); + BOOST_CHECK_EQUAL(util::jsonCompactPrint(contract["devdoc"]), R"({"kind":"dev","methods":{},"version":1})"); BOOST_CHECK(contract["userdoc"].isObject()); - BOOST_CHECK_EQUAL(util::jsonCompactPrint(contract["userdoc"]), "{\"methods\":{}}"); + BOOST_CHECK_EQUAL(util::jsonCompactPrint(contract["userdoc"]), R"({"kind":"user","methods":{},"version":1})"); BOOST_CHECK(contract["evm"].isObject()); /// @TODO check evm.methodIdentifiers, legacyAssembly, bytecode, deployedBytecode BOOST_CHECK(contract["evm"]["bytecode"].isObject()); From a806d48ad5f49a5f563c79e8c7d3f4a48ab54767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 30 May 2020 00:25:06 +0200 Subject: [PATCH 248/479] CommandLineInterface: Add countEnabledOptions() and joinOptionNames() helpers --- solc/CommandLineInterface.cpp | 18 ++++++++++++++++++ solc/CommandLineInterface.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 8b6117a2d38a..6cfcdc37e8c2 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -58,6 +58,7 @@ #include #include +#include #include #ifdef _WIN32 // windows @@ -1879,4 +1880,21 @@ void CommandLineInterface::outputCompilationResults() } } +size_t CommandLineInterface::countEnabledOptions(vector const& _optionNames) const +{ + size_t count = 0; + for (string const& _option: _optionNames) + count += m_args.count(_option); + + return count; +} + +string CommandLineInterface::joinOptionNames(vector const& _optionNames, string _separator) +{ + return boost::algorithm::join( + _optionNames | boost::adaptors::transformed([](string const& _option){ return "--" + _option; }), + _separator + ); +} + } diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 2c871a670e8a..1aed728216f9 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -103,6 +103,9 @@ class CommandLineInterface /// @arg _json json string to be written void createJson(std::string const& _fileName, std::string const& _json); + size_t countEnabledOptions(std::vector const& _optionNames) const; + static std::string joinOptionNames(std::vector const& _optionNames, std::string _separator = ", "); + bool m_error = false; ///< If true, some error occurred. bool m_onlyAssemble = false; From 8396002fe7a6216ef60d37ea7087a2991147fffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 29 May 2020 21:38:19 +0200 Subject: [PATCH 249/479] CommandLineInterface: Disallow using --assemble, --strict-assembly, --yul, --link, --standard-json and --import-ast at the same time --- solc/CommandLineInterface.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 6cfcdc37e8c2..23294cefb4c1 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1130,6 +1130,21 @@ bool CommandLineInterface::processInput() } } + vector const exclusiveModes = { + g_argStandardJSON, + g_argLink, + g_argAssemble, + g_argStrictAssembly, + g_argYul, + g_argImportAst, + }; + if (countEnabledOptions(exclusiveModes) > 1) + { + serr() << "The following options are mutually exclusive: " << joinOptionNames(exclusiveModes) << ". "; + serr() << "Select at most one." << endl; + return false; + } + if (m_args.count(g_argStandardJSON)) { vector inputFiles; From 0d7b3ae503e6d6b839e9cede329d9d21738ed697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 29 May 2020 23:28:09 +0200 Subject: [PATCH 250/479] CommandLineInterface: Disallow --yul-dialect and --machine when not in assembly mode --- solc/CommandLineInterface.cpp | 7 +++++++ test/cmdlineTests/strict_asm_options_in_non_asm_mode/args | 1 + test/cmdlineTests/strict_asm_options_in_non_asm_mode/err | 1 + test/cmdlineTests/strict_asm_options_in_non_asm_mode/exit | 1 + .../strict_asm_options_in_non_asm_mode/input.sol | 7 +++++++ 5 files changed, 17 insertions(+) create mode 100644 test/cmdlineTests/strict_asm_options_in_non_asm_mode/args create mode 100644 test/cmdlineTests/strict_asm_options_in_non_asm_mode/err create mode 100644 test/cmdlineTests/strict_asm_options_in_non_asm_mode/exit create mode 100644 test/cmdlineTests/strict_asm_options_in_non_asm_mode/input.sol diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 23294cefb4c1..712740cd07ed 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1289,6 +1289,13 @@ bool CommandLineInterface::processInput() return assemble(inputLanguage, targetMachine, optimize, yulOptimiserSteps); } + else if (countEnabledOptions({g_strYulDialect, g_argMachine}) >= 1) + { + serr() << "--" << g_strYulDialect << " and --" << g_argMachine << " "; + serr() << "are only valid in assembly mode." << endl; + return false; + } + if (m_args.count(g_argLink)) { // switch to linker mode diff --git a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args new file mode 100644 index 000000000000..6f9a273ab6a0 --- /dev/null +++ b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args @@ -0,0 +1 @@ +--yul-dialect evm --machine ewasm diff --git a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/err b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/err new file mode 100644 index 000000000000..6d67f2b5bfa2 --- /dev/null +++ b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/err @@ -0,0 +1 @@ +--yul-dialect and --machine are only valid in assembly mode. diff --git a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/exit b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/input.sol b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/input.sol new file mode 100644 index 000000000000..6923ca7023b3 --- /dev/null +++ b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/input.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; + +contract C +{ + function f() public pure {} +} From 4bd078ed7e92698d1250a0d73cf66e4a02c0d000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 30 May 2020 00:32:35 +0200 Subject: [PATCH 251/479] CommandLineInterface: Disallow --output-dir, --gas and --combined-json in assembly mode --- solc/CommandLineInterface.cpp | 26 ++++++++++++------- .../strict_asm_invalid_option_output_dir/args | 1 + .../strict_asm_invalid_option_output_dir/err | 1 + .../strict_asm_invalid_option_output_dir/exit | 1 + .../input.yul | 3 +++ 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 test/cmdlineTests/strict_asm_invalid_option_output_dir/args create mode 100644 test/cmdlineTests/strict_asm_invalid_option_output_dir/err create mode 100644 test/cmdlineTests/strict_asm_invalid_option_output_dir/exit create mode 100644 test/cmdlineTests/strict_asm_invalid_option_output_dir/input.yul diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 712740cd07ed..bbf0eeb532e7 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1190,6 +1190,22 @@ bool CommandLineInterface::processInput() if (m_args.count(g_argAssemble) || m_args.count(g_argStrictAssembly) || m_args.count(g_argYul)) { + vector const nonAssemblyModeOptions = { + // TODO: The list is not complete. Add more. + g_argOutputDir, + g_argGas, + g_argCombinedJson, + g_strOptimizeYul, + g_strNoOptimizeYul, + }; + if (countEnabledOptions(nonAssemblyModeOptions) >= 1) + { + serr() << "The following options are invalid in assembly mode: "; + serr() << joinOptionNames(nonAssemblyModeOptions) << ". "; + serr() << "Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl; + return false; + } + // switch to assembly mode m_onlyAssemble = true; using Input = yul::AssemblyStack::Language; @@ -1197,16 +1213,6 @@ bool CommandLineInterface::processInput() Input inputLanguage = m_args.count(g_argYul) ? Input::Yul : (m_args.count(g_argStrictAssembly) ? Input::StrictAssembly : Input::Assembly); Machine targetMachine = Machine::EVM; bool optimize = m_args.count(g_argOptimize); - if (m_args.count(g_strOptimizeYul)) - { - serr() << "--" << g_strOptimizeYul << " is invalid in assembly mode. Use --" << g_argOptimize << " instead." << endl; - return false; - } - if (m_args.count(g_strNoOptimizeYul)) - { - serr() << "--" << g_strNoOptimizeYul << " is invalid in assembly mode. Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl; - return false; - } optional yulOptimiserSteps; if (m_args.count(g_strYulOptimizations)) diff --git a/test/cmdlineTests/strict_asm_invalid_option_output_dir/args b/test/cmdlineTests/strict_asm_invalid_option_output_dir/args new file mode 100644 index 000000000000..ba341ccc5de8 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_output_dir/args @@ -0,0 +1 @@ +--strict-assembly --output-dir /tmp/ diff --git a/test/cmdlineTests/strict_asm_invalid_option_output_dir/err b/test/cmdlineTests/strict_asm_invalid_option_output_dir/err new file mode 100644 index 000000000000..a9b56e9c7ac3 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_output_dir/err @@ -0,0 +1 @@ +The following options are invalid in assembly mode: --output-dir, --gas, --combined-json, --optimize-yul, --no-optimize-yul. Optimization is disabled by default and can be enabled with --optimize. diff --git a/test/cmdlineTests/strict_asm_invalid_option_output_dir/exit b/test/cmdlineTests/strict_asm_invalid_option_output_dir/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_output_dir/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/strict_asm_invalid_option_output_dir/input.yul b/test/cmdlineTests/strict_asm_invalid_option_output_dir/input.yul new file mode 100644 index 000000000000..f21cd2b7e038 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_output_dir/input.yul @@ -0,0 +1,3 @@ +{ + sstore(0, 1) +} From c5fb5f6d575c8b002d8bd2bf031c7203d92b35c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 3 Jun 2020 18:58:52 +0200 Subject: [PATCH 252/479] List command-line interface changes in the changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 2510afc2e527..874d861c1c21 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Language Features: Compiler Features: * NatSpec: Add fields "kind" and "version" to the JSON output. + * Commandline Interface: Prevent some incompatible commandline options from being used together. Bugfixes: From 00f280057075a4e315bfb00cf7df93342b0a99ce Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2020 15:44:44 +0200 Subject: [PATCH 253/479] Explain how to build proper release. --- docs/installing-solidity.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index 27a20b3bc537..4f03a6b76be5 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -314,6 +314,16 @@ you should fork Solidity and add your personal fork as a second remote: git remote add personal git@github.com:[username]/solidity.git +.. note:: + This method will result in a prerelease build leading to e.g. a flag + being set in each bytecode produced by such a compiler. + If you want to re-build a released Solidity compiler, then + please use the source tarball on the github release page: + + https://github.com/ethereum/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz + + (not the "Source code" provided by github). + Command-Line Build ------------------ From 5fdbb5c3e31c5369a1141e0a80cbbe8c645263a7 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2020 18:46:31 +0200 Subject: [PATCH 254/479] Simplify inline assembly resolver. --- libsolidity/analysis/TypeChecker.cpp | 51 +++++++++++++------------ libsolidity/codegen/CompilerContext.cpp | 7 ++-- libyul/AsmAnalysis.cpp | 20 +++------- libyul/backends/evm/AbstractAssembly.h | 2 +- 4 files changed, 36 insertions(+), 44 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c308fadd8efe..32a4666be956 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -666,17 +666,18 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) { auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier); if (ref == _inlineAssembly.annotation().externalReferences.end()) - return numeric_limits::max(); - Declaration const* declaration = ref->second.declaration; + return false; + InlineAssemblyAnnotation::ExternalIdentifierInfo& identifierInfo = ref->second; + Declaration const* declaration = identifierInfo.declaration; solAssert(!!declaration, ""); - bool requiresStorage = ref->second.isSlot || ref->second.isOffset; + bool requiresStorage = identifierInfo.isSlot || identifierInfo.isOffset; if (auto var = dynamic_cast(declaration)) { solAssert(var->type(), "Expected variable type!"); if (var->immutable()) { m_errorReporter.typeError(3773_error, _identifier.location, "Assembly access to immutable variables is not supported."); - return numeric_limits::max(); + return false; } if (var->isConstant()) { @@ -685,17 +686,17 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (var && !var->value()) { m_errorReporter.typeError(3224_error, _identifier.location, "Constant has no value."); - return numeric_limits::max(); + return false; } else if (_context == yul::IdentifierContext::LValue) { m_errorReporter.typeError(6252_error, _identifier.location, "Constant variables cannot be assigned to."); - return numeric_limits::max(); + return false; } else if (requiresStorage) { m_errorReporter.typeError(6617_error, _identifier.location, "The suffixes _offset and _slot can only be used on non-constant storage variables."); - return numeric_limits::max(); + return false; } else if (var && var->value() && !var->value()->annotation().type && !dynamic_cast(var->value().get())) { @@ -704,7 +705,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) _identifier.location, "Constant variables with non-literal values cannot be forward referenced from inline assembly." ); - return size_t(-1); + return false; } else if (!var || !type(*var)->isValueType() || ( !dynamic_cast(var->value().get()) && @@ -712,7 +713,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) )) { m_errorReporter.typeError(7615_error, _identifier.location, "Only direct number constants and references to such constants are supported by inline assembly."); - return size_t(-1); + return false; } } @@ -723,33 +724,33 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage)) { m_errorReporter.typeError(3622_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); - return numeric_limits::max(); + return false; } else if (_context == yul::IdentifierContext::LValue) { if (var->isStateVariable()) { m_errorReporter.typeError(4713_error, _identifier.location, "State variables cannot be assigned to - you have to use \"sstore()\"."); - return numeric_limits::max(); + return false; } - else if (ref->second.isOffset) + else if (identifierInfo.isOffset) { m_errorReporter.typeError(9739_error, _identifier.location, "Only _slot can be assigned to."); - return numeric_limits::max(); + return false; } else - solAssert(ref->second.isSlot, ""); + solAssert(identifierInfo.isSlot, ""); } } else if (!var->isConstant() && var->isStateVariable()) { m_errorReporter.typeError(1408_error, _identifier.location, "Only local variables are supported. To access storage variables, use the _slot and _offset suffixes."); - return numeric_limits::max(); + return false; } else if (var->type()->dataStoredIn(DataLocation::Storage)) { m_errorReporter.typeError(9068_error, _identifier.location, "You have to use the _slot or _offset suffix to access storage reference variables."); - return numeric_limits::max(); + return false; } else if (var->type()->sizeOnStack() != 1) { @@ -757,21 +758,21 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) m_errorReporter.typeError(2370_error, _identifier.location, "Call data elements cannot be accessed directly. Copy to a local variable first or use \"calldataload\" or \"calldatacopy\" with manually determined offsets and sizes."); else m_errorReporter.typeError(9857_error, _identifier.location, "Only types that use one stack slot are supported."); - return numeric_limits::max(); + return false; } } else if (requiresStorage) { m_errorReporter.typeError(7944_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); - return numeric_limits::max(); + return false; } else if (_context == yul::IdentifierContext::LValue) { if (dynamic_cast(declaration)) - return numeric_limits::max(); + return false; m_errorReporter.typeError(1990_error, _identifier.location, "Only local variables can be assigned to in inline assembly."); - return numeric_limits::max(); + return false; } if (_context == yul::IdentifierContext::RValue) @@ -780,7 +781,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (dynamic_cast(declaration)) { m_errorReporter.declarationError(2025_error, _identifier.location, "Access to functions is not allowed in inline assembly."); - return numeric_limits::max(); + return false; } else if (dynamic_cast(declaration)) { @@ -790,14 +791,14 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) if (!contract->isLibrary()) { m_errorReporter.typeError(4977_error, _identifier.location, "Expected a library."); - return numeric_limits::max(); + return false; } } else - return numeric_limits::max(); + return false; } - ref->second.valueSize = 1; - return size_t(1); + identifierInfo.valueSize = 1; + return true; }; solAssert(!_inlineAssembly.annotation().analysisInfo, ""); _inlineAssembly.annotation().analysisInfo = make_shared(); diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index fea449f7fd5a..3af9a7c94d2b 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -384,12 +384,11 @@ void CompilerContext::appendInlineAssembly( yul::Identifier const& _identifier, yul::IdentifierContext, bool _insideFunction - ) -> size_t + ) -> bool { if (_insideFunction) - return numeric_limits::max(); - auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str()); - return it == _localVariables.end() ? numeric_limits::max() : 1; + return false; + return contains(_localVariables, _identifier.name.str()); }; identifierAccess.generateCode = [&]( yul::Identifier const& _identifier, diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 07db82095e36..eeb80263ee90 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -132,17 +132,11 @@ vector AsmAnalyzer::operator()(Identifier const& _identifier) } else { - bool found = false; - if (m_resolver) - { - bool insideFunction = m_currentScope->insideFunction(); - size_t stackSize = m_resolver(_identifier, yul::IdentifierContext::RValue, insideFunction); - if (stackSize != numeric_limits::max()) - { - found = true; - yulAssert(stackSize == 1, "Invalid stack size of external reference."); - } - } + bool found = m_resolver && m_resolver( + _identifier, + yul::IdentifierContext::RValue, + m_currentScope->insideFunction() + ); if (!found && watcher.ok()) // Only add an error message if the callback did not do it. m_errorReporter.declarationError(8198_error, _identifier.location, "Identifier not found."); @@ -478,12 +472,10 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT else if (m_resolver) { bool insideFunction = m_currentScope->insideFunction(); - size_t variableSize = m_resolver(_variable, yul::IdentifierContext::LValue, insideFunction); - if (variableSize != numeric_limits::max()) + if (m_resolver(_variable, yul::IdentifierContext::LValue, insideFunction)) { found = true; variableType = &m_dialect.defaultType; - yulAssert(variableSize == 1, "Invalid stack size of external reference."); } } diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index 2f86270b0f7e..b46c2f734855 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -118,7 +118,7 @@ enum class IdentifierContext { LValue, RValue, VariableDeclaration }; /// to inline assembly (not used in standalone assembly mode). struct ExternalIdentifierAccess { - using Resolver = std::function; + using Resolver = std::function; /// Resolve an external reference given by the identifier in the given context. /// @returns the size of the value (number of stack slots) or size_t(-1) if not found. Resolver resolve; From 645c3508a88b4d63d4f9263625691eb3b5d3c513 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2020 19:11:03 +0200 Subject: [PATCH 255/479] Prepare for allowing bound functions and using for everywhere. --- libsolidity/ast/Types.cpp | 108 ++++++++++++++++++++++---------------- libsolidity/ast/Types.h | 28 +++++----- 2 files changed, 77 insertions(+), 59 deletions(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index bb202e8755ac..5ea018107388 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -311,10 +311,15 @@ TypePointer Type::commonType(Type const* _a, Type const* _b) return nullptr; } -MemberList const& Type::members(ContractDefinition const* _currentScope) const +MemberList const& Type::members(ASTNode const* _currentScope) const { if (!m_members[_currentScope]) { + solAssert( + _currentScope == nullptr || + dynamic_cast(_currentScope) || + dynamic_cast(_currentScope), + ""); MemberList::MemberMap members = nativeMembers(_currentScope); if (_currentScope) members += boundFunctions(*this, *_currentScope); @@ -344,8 +349,20 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c return encodingType; } -MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition const& _scope) +MemberList::MemberMap Type::boundFunctions(Type const& _type, ASTNode const& _scope) { + vector usingForDirectives; + if (auto const* sourceUnit = dynamic_cast(&_scope)) + usingForDirectives += ASTNode::filteredNodes(sourceUnit->nodes()); + else if (auto const* contract = dynamic_cast(&_scope)) + { + for (ContractDefinition const* contract: contract->annotation().linearizedBaseContracts) + usingForDirectives += contract->usingForDirectives(); + usingForDirectives += ASTNode::filteredNodes(contract->sourceUnit().nodes()); + } + else + solAssert(false, ""); + // Normalise data location of type. DataLocation typeLocation = DataLocation::Storage; if (auto refType = dynamic_cast(&_type)) @@ -353,38 +370,39 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition set seenFunctions; MemberList::MemberMap members; - for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts) - for (UsingForDirective const* ufd: contract->usingForDirectives()) - { - // Convert both types to pointers for comparison to see if the `using for` - // directive applies. - // Further down, we check more detailed for each function if `_type` is - // convertible to the function parameter type. - if (ufd->typeName() && - *TypeProvider::withLocationIfReference(typeLocation, &_type, true) != - *TypeProvider::withLocationIfReference( - typeLocation, - ufd->typeName()->annotation().type, - true - ) + + for (UsingForDirective const* ufd: usingForDirectives) + { + // Convert both types to pointers for comparison to see if the `using for` + // directive applies. + // Further down, we check more detailed for each function if `_type` is + // convertible to the function parameter type. + if (ufd->typeName() && + *TypeProvider::withLocationIfReference(typeLocation, &_type, true) != + *TypeProvider::withLocationIfReference( + typeLocation, + ufd->typeName()->annotation().type, + true ) + ) + continue; + auto const& library = dynamic_cast( + *ufd->libraryName().annotation().referencedDeclaration + ); + for (FunctionDefinition const* function: library.definedFunctions()) + { + if (!function->isVisibleAsLibraryMember() || seenFunctions.count(function)) continue; - auto const& library = dynamic_cast( - *ufd->libraryName().annotation().referencedDeclaration - ); - for (FunctionDefinition const* function: library.definedFunctions()) - { - if (!function->isVisibleAsLibraryMember() || seenFunctions.count(function)) - continue; - seenFunctions.insert(function); - if (function->parameters().empty()) - continue; - FunctionTypePointer fun = - dynamic_cast(*function->typeViaContractName()).asBoundFunction(); - if (_type.isImplicitlyConvertibleTo(*fun->selfType())) - members.emplace_back(function->name(), fun, function); - } + seenFunctions.insert(function); + if (function->parameters().empty()) + continue; + FunctionTypePointer fun = + dynamic_cast(*function->typeViaContractName()).asBoundFunction(); + if (_type.isImplicitlyConvertibleTo(*fun->selfType())) + members.emplace_back(function->name(), fun, function); } + } + return members; } @@ -464,7 +482,7 @@ bool AddressType::operator==(Type const& _other) const return other.m_stateMutability == m_stateMutability; } -MemberList::MemberMap AddressType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap AddressType::nativeMembers(ASTNode const*) const { MemberList::MemberMap members = { {"balance", TypeProvider::uint256()}, @@ -1400,7 +1418,7 @@ TypeResult FixedBytesType::binaryOperatorResult(Token _operator, Type const* _ot return nullptr; } -MemberList::MemberMap FixedBytesType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap FixedBytesType::nativeMembers(ASTNode const*) const { return MemberList::MemberMap{MemberList::Member{"length", TypeProvider::uint(8)}}; } @@ -1856,7 +1874,7 @@ string ArrayType::signatureInExternalFunction(bool _structsByName) const } } -MemberList::MemberMap ArrayType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap ArrayType::nativeMembers(ASTNode const*) const { MemberList::MemberMap members; if (!isString()) @@ -2029,10 +2047,9 @@ string ContractType::canonicalName() const return m_contract.annotation().canonicalName; } -MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _contract) const +MemberList::MemberMap ContractType::nativeMembers(ASTNode const*) const { MemberList::MemberMap members; - solAssert(_contract, ""); if (m_super) { // add the most derived of all functions which are visible in derived contracts @@ -2063,14 +2080,13 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con } } else if (!m_contract.isLibrary()) - { for (auto const& it: m_contract.interfaceFunctions()) members.emplace_back( it.second->declaration().name(), it.second->asExternallyCallableFunction(m_contract.isLibrary()), &it.second->declaration() ); - } + return members; } @@ -2241,7 +2257,7 @@ string StructType::toString(bool _short) const return ret; } -MemberList::MemberMap StructType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap StructType::nativeMembers(ASTNode const*) const { MemberList::MemberMap members; for (ASTPointer const& variable: m_struct.members()) @@ -3146,7 +3162,7 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const ); } -MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const* _scope) const +MemberList::MemberMap FunctionType::nativeMembers(ASTNode const* _scope) const { switch (m_kind) { @@ -3165,7 +3181,8 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const* _sco functionDefinition->isPartOfExternalInterface() ) { - solAssert(_scope->derivesFrom(*functionDefinition->annotation().contract), ""); + auto const* contractScope = dynamic_cast(_scope); + solAssert(contractScope && contractScope->derivesFrom(*functionDefinition->annotation().contract), ""); return {{"selector", TypeProvider::fixedBytes(4)}}; } else @@ -3640,13 +3657,14 @@ vector> TypeType::makeStackItems() const return {}; } -MemberList::MemberMap TypeType::nativeMembers(ContractDefinition const* _currentScope) const +MemberList::MemberMap TypeType::nativeMembers(ASTNode const* _currentScope) const { MemberList::MemberMap members; if (m_actualType->category() == Category::Contract) { + auto const* contractScope = dynamic_cast(_currentScope); ContractDefinition const& contract = dynamic_cast(*m_actualType).contractDefinition(); - bool inDerivingScope = _currentScope && _currentScope->derivesFrom(contract); + bool inDerivingScope = contractScope && contractScope->derivesFrom(contract); for (auto const* declaration: contract.declarations()) { @@ -3748,7 +3766,7 @@ bool ModuleType::operator==(Type const& _other) const return &m_sourceUnit == &dynamic_cast(_other).m_sourceUnit; } -MemberList::MemberMap ModuleType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap ModuleType::nativeMembers(ASTNode const*) const { MemberList::MemberMap symbols; for (auto const& symbolName: m_sourceUnit.annotation().exportedSymbols) @@ -3789,7 +3807,7 @@ bool MagicType::operator==(Type const& _other) const return other.m_kind == m_kind; } -MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const*) const +MemberList::MemberMap MagicType::nativeMembers(ASTNode const*) const { switch (m_kind) { diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index a82700808a55..b902a1c77de1 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -315,9 +315,9 @@ class Type /// Returns the list of all members of this type. Default implementation: no members apart from bound. /// @param _currentScope scope in which the members are accessed. - MemberList const& members(ContractDefinition const* _currentScope) const; + MemberList const& members(ASTNode const* _currentScope) const; /// Convenience method, returns the type of the given named member or an empty pointer if no such member exists. - TypePointer memberType(std::string const& _name, ContractDefinition const* _currentScope = nullptr) const + TypePointer memberType(std::string const& _name, ASTNode const* _currentScope = nullptr) const { return members(_currentScope).memberType(_name); } @@ -361,12 +361,12 @@ class Type private: /// @returns a member list containing all members added to this type by `using for` directives. - static MemberList::MemberMap boundFunctions(Type const& _type, ContractDefinition const& _scope); + static MemberList::MemberMap boundFunctions(Type const& _type, ASTNode const& _scope); protected: /// @returns the members native to this type depending on the given context. This function /// is used (in conjunction with boundFunctions to fill m_members below. - virtual MemberList::MemberMap nativeMembers(ContractDefinition const* /*_currentScope*/) const + virtual MemberList::MemberMap nativeMembers(ASTNode const* /*_currentScope*/) const { return MemberList::MemberMap(); } @@ -379,7 +379,7 @@ class Type /// List of member types (parameterised by scape), will be lazy-initialized. - mutable std::map> m_members; + mutable std::map> m_members; mutable std::optional>> m_stackItems; mutable std::optional m_stackSize; }; @@ -408,7 +408,7 @@ class AddressType: public Type bool isValueType() const override { return true; } bool nameable() const override { return true; } - MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; + MemberList::MemberMap nativeMembers(ASTNode const*) const override; std::string toString(bool _short) const override; std::string canonicalName() const override; @@ -649,7 +649,7 @@ class FixedBytesType: public Type bool nameable() const override { return true; } std::string toString(bool) const override { return "bytes" + util::toString(m_bytes); } - MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; + MemberList::MemberMap nativeMembers(ASTNode const*) const override; TypePointer encodingType() const override { return this; } TypeResult interfaceType(bool) const override { return this; } @@ -786,7 +786,7 @@ class ArrayType: public ReferenceType std::string toString(bool _short) const override; std::string canonicalName() const override; std::string signatureInExternalFunction(bool _structsByName) const override; - MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; + MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; TypePointer encodingType() const override; TypePointer decodingType() const override; TypeResult interfaceType(bool _inLibrary) const override; @@ -889,7 +889,7 @@ class ContractType: public Type std::string toString(bool _short) const override; std::string canonicalName() const override; - MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; + MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; Type const* encodingType() const override; @@ -949,7 +949,7 @@ class StructType: public ReferenceType bool nameable() const override { return true; } std::string toString(bool _short) const override; - MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; + MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; Type const* encodingType() const override; TypeResult interfaceType(bool _inLibrary) const override; @@ -1220,7 +1220,7 @@ class FunctionType: public Type bool nameable() const override; bool canLiveOutsideStorage() const override { return m_kind == Kind::Internal || m_kind == Kind::External; } bool hasSimpleZeroValueInMemory() const override { return false; } - MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; + MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; TypePointer encodingType() const override; TypeResult interfaceType(bool _inLibrary) const override; @@ -1389,7 +1389,7 @@ class TypeType: public Type bool canLiveOutsideStorage() const override { return false; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; } - MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override; + MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override; protected: @@ -1441,7 +1441,7 @@ class ModuleType: public Type bool canBeStored() const override { return false; } bool canLiveOutsideStorage() const override { return true; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } - MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; + MemberList::MemberMap nativeMembers(ASTNode const*) const override; std::string toString(bool _short) const override; @@ -1481,7 +1481,7 @@ class MagicType: public Type bool canBeStored() const override { return false; } bool canLiveOutsideStorage() const override { return true; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } - MemberList::MemberMap nativeMembers(ContractDefinition const*) const override; + MemberList::MemberMap nativeMembers(ASTNode const*) const override; std::string toString(bool _short) const override; From 5d63fa09e903afe0809ed94814126ffc9c19ea46 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sat, 13 Jun 2020 02:02:32 +0200 Subject: [PATCH 256/479] Fix false ////- and /***-natspec --- Changelog.md | 3 +- liblangutil/Scanner.cpp | 23 +++++--- test/libsolidity/SolidityNatspecJSON.cpp | 68 ++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 874d861c1c21..22f1d1e5dec7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,8 +9,7 @@ Compiler Features: Bugfixes: - - + * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. ### 0.6.10 (2020-06-11) diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index db0636fb91ec..64821ecb514a 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -313,7 +313,6 @@ size_t Scanner::scanSingleLineDocComment() { LiteralScope literal(this, LITERAL_TYPE_COMMENT); size_t endPosition = m_source->position(); - advance(); //consume the last '/' at /// skipWhitespaceExceptUnicodeLinebreak(); @@ -332,6 +331,8 @@ size_t Scanner::scanSingleLineDocComment() m_source->get(1) == '/' && m_source->get(2) == '/') { + if (!m_source->isPastEndOfInput(4) && m_source->get(3) == '/') + break; // "////" is not a documentation comment m_char = m_source->advanceAndGet(3); if (atEndOfLine()) continue; @@ -353,7 +354,6 @@ size_t Scanner::scanSingleLineDocComment() Token Scanner::skipMultiLineComment() { - advance(); while (!isSourcePastEndOfInput()) { char ch = m_char; @@ -437,6 +437,11 @@ Token Scanner::scanSlash() return Token::Whitespace; else if (m_char == '/') { + advance(); //consume the last '/' at /// + + // "////" + if (m_char == '/') + return skipSingleLineComment(); // doxygen style /// comment m_skippedComments[NextNext].location.start = firstSlashPosition; m_skippedComments[NextNext].location.source = m_source; @@ -462,11 +467,14 @@ Token Scanner::scanSlash() advance(); //skip the closing slash return Token::Whitespace; } + // "/***" + if (m_char == '*') + // "/***/" may be interpreted as empty natspec or skipped; skipping is simpler + return skipMultiLineComment(); // we actually have a multiline documentation comment - Token comment; m_skippedComments[NextNext].location.start = firstSlashPosition; m_skippedComments[NextNext].location.source = m_source; - comment = scanMultiLineDocComment(); + Token comment = scanMultiLineDocComment(); m_skippedComments[NextNext].location.end = static_cast(sourcePos()); m_skippedComments[NextNext].token = comment; if (comment == Token::Illegal) @@ -754,17 +762,16 @@ bool Scanner::isUnicodeLinebreak() if (0x0a <= m_char && m_char <= 0x0d) // line feed, vertical tab, form feed, carriage return return true; - else if (!m_source->isPastEndOfInput(1) && uint8_t(m_source->get(0)) == 0xc2 && uint8_t(m_source->get(1)) == 0x85) + if (!m_source->isPastEndOfInput(1) && uint8_t(m_source->get(0)) == 0xc2 && uint8_t(m_source->get(1)) == 0x85) // NEL - U+0085, C2 85 in utf8 return true; - else if (!m_source->isPastEndOfInput(2) && uint8_t(m_source->get(0)) == 0xe2 && uint8_t(m_source->get(1)) == 0x80 && ( + if (!m_source->isPastEndOfInput(2) && uint8_t(m_source->get(0)) == 0xe2 && uint8_t(m_source->get(1)) == 0x80 && ( uint8_t(m_source->get(2)) == 0xa8 || uint8_t(m_source->get(2)) == 0xa9 )) // LS - U+2028, E2 80 A8 in utf8 // PS - U+2029, E2 80 A9 in utf8 return true; - else - return false; + return false; } Token Scanner::scanString() diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 06a4fc4fb614..6b69904d3ead 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -1146,6 +1146,74 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function) checkNatspec(sourceCode, "test", natspec, false); } +BOOST_AUTO_TEST_CASE(slash4) +{ + char const* sourceCode = R"( + contract test { + //// @notice lorem ipsum + function f() public { } + } + )"; + + char const* natspec = R"( { "methods": {} } )"; + + checkNatspec(sourceCode, "test", natspec, true); +} + +BOOST_AUTO_TEST_CASE(star3) +{ + char const* sourceCode = R"( + contract test { + /*** + * @notice lorem ipsum + */ + function f() public { } + } + )"; + + char const* natspec = R"( { "methods": {} } )"; + + checkNatspec(sourceCode, "test", natspec, true); +} + +BOOST_AUTO_TEST_CASE(slash3_slash3) +{ + char const* sourceCode = R"( + contract test { + /// @notice lorem + /// ipsum + function f() public { } + } + )"; + + char const* natspec = R"ABCDEF({ + "methods": { + "f()": { "notice": "lorem ipsum" } + } + })ABCDEF"; + + checkNatspec(sourceCode, "test", natspec, true); +} + +BOOST_AUTO_TEST_CASE(slash3_slash4) +{ + char const* sourceCode = R"( + contract test { + /// @notice lorem + //// ipsum + function f() public { } + } + )"; + + char const* natspec = R"ABCDEF({ + "methods": { + "f()": { "notice": "lorem" } + } + })ABCDEF"; + + checkNatspec(sourceCode, "test", natspec, true); +} + BOOST_AUTO_TEST_SUITE_END() } From 50e8d6850f32d0c7c674009fd3ec46908cc18bc1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 4 Feb 2020 23:28:44 +0100 Subject: [PATCH 257/479] Remove wasm type conversions. --- libyul/backends/wasm/WasmCodeTransform.cpp | 57 ++-------------------- libyul/backends/wasm/WasmCodeTransform.h | 6 --- 2 files changed, 3 insertions(+), 60 deletions(-) diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 8f987824c3d1..8de291402c0d 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -112,8 +112,6 @@ wasm::Expression WasmCodeTransform::operator()(ExpressionStatement const& _state wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) { - bool typeConversionNeeded = false; - if (BuiltinFunction const* builtin = m_dialect.builtin(_call.functionName.name)) { if (_call.functionName.name.str().substr(0, 4) == "eth.") @@ -133,7 +131,6 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) imp.paramTypes.emplace_back(translatedType(param)); m_functionsToImport[builtin->name] = std::move(imp); } - typeConversionNeeded = true; } else if (builtin->literalArguments && contains(builtin->literalArguments.value(), true)) { @@ -147,18 +144,10 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) return wasm::BuiltinCall{_call.functionName.name.str(), std::move(literals)}; } else - { - wasm::BuiltinCall call{ + return wasm::BuiltinCall{ _call.functionName.name.str(), - injectTypeConversionIfNeeded(visit(_call.arguments), builtin->parameters) + visit(_call.arguments) }; - if (!builtin->returns.empty() && !builtin->returns.front().empty() && builtin->returns.front() != "i64"_yulstring) - { - yulAssert(builtin->returns.front() == "i32"_yulstring, "Invalid type " + builtin->returns.front().str()); - call = wasm::BuiltinCall{"i64.extend_i32_u", make_vector(std::move(call))}; - } - return {std::move(call)}; - } } // If this function returns multiple values, then the first one will @@ -166,13 +155,7 @@ wasm::Expression WasmCodeTransform::operator()(FunctionCall const& _call) // The values have to be used right away in an assignment or variable declaration, // so it is handled there. - wasm::FunctionCall funCall{_call.functionName.name.str(), visit(_call.arguments)}; - if (typeConversionNeeded) - // Inject type conversion if needed on the fly. This is just a temporary measure - // and can be removed once we have proper types in Yul. - return injectTypeConversionIfNeeded(std::move(funCall)); - else - return {std::move(funCall)}; + return wasm::FunctionCall{_call.functionName.name.str(), visit(_call.arguments)}; } wasm::Expression WasmCodeTransform::operator()(Identifier const& _identifier) @@ -358,40 +341,6 @@ wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefin return fun; } -wasm::Expression WasmCodeTransform::injectTypeConversionIfNeeded(wasm::FunctionCall _call) const -{ - wasm::FunctionImport const& import = m_functionsToImport.at(YulString{_call.functionName}); - for (size_t i = 0; i < _call.arguments.size(); ++i) - if (import.paramTypes.at(i) == wasm::Type::i32) - _call.arguments[i] = wasm::BuiltinCall{"i32.wrap_i64", make_vector(std::move(_call.arguments[i]))}; - else - yulAssert(import.paramTypes.at(i) == wasm::Type::i64, "Invalid Wasm type"); - - if (import.returnType && *import.returnType != wasm::Type::i64) - { - yulAssert(*import.returnType == wasm::Type::i32, "Invalid Wasm type"); - return wasm::BuiltinCall{"i64.extend_i32_u", make_vector(std::move(_call))}; - } - return {std::move(_call)}; -} - -vector WasmCodeTransform::injectTypeConversionIfNeeded( - vector _arguments, - vector const& _parameterTypes -) const -{ - for (size_t i = 0; i < _arguments.size(); ++i) - if (_parameterTypes.at(i) == "i32"_yulstring) - _arguments[i] = wasm::BuiltinCall{"i32.wrap_i64", make_vector(std::move(_arguments[i]))}; - else - yulAssert( - _parameterTypes.at(i).empty() || _parameterTypes.at(i) == "i64"_yulstring, - "Unknown type " + _parameterTypes.at(i).str() - ); - - return _arguments; -} - string WasmCodeTransform::newLabel() { return m_nameDispenser.newName("label_"_yulstring).str(); diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 5680269f4c54..68aeb86a385a 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -79,12 +79,6 @@ class WasmCodeTransform wasm::FunctionDefinition translateFunction(yul::FunctionDefinition const& _funDef); - wasm::Expression injectTypeConversionIfNeeded(wasm::FunctionCall _call) const; - std::vector injectTypeConversionIfNeeded( - std::vector _arguments, - std::vector const& _parameterTypes - ) const; - std::string newLabel(); /// Makes sure that there are at least @a _amount global variables. void allocateGlobals(size_t _amount); From d9ca02b47aad5d53cd7c38efeaceb143f90d2ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 28 May 2020 21:44:52 +0200 Subject: [PATCH 258/479] Enable translation of i32 Yul variables/literals to i32 wasm variables/literals - Until now they were being translated to i64 --- libyul/backends/wasm/WasmCodeTransform.cpp | 117 ++++++++++++++++----- libyul/backends/wasm/WasmCodeTransform.h | 16 ++- 2 files changed, 105 insertions(+), 28 deletions(-) diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 8de291402c0d..d04d84c0e052 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -20,6 +20,8 @@ #include +#include + #include #include @@ -40,7 +42,8 @@ wasm::Module WasmCodeTransform::run(Dialect const& _dialect, yul::Block const& _ { wasm::Module module; - WasmCodeTransform transform(_dialect, _ast); + TypeInfo typeInfo(_dialect, _ast); + WasmCodeTransform transform(_dialect, _ast, typeInfo); for (auto const& statement: _ast.statements) { @@ -70,14 +73,18 @@ wasm::Expression WasmCodeTransform::generateMultiAssignment( if (_variableNames.size() == 1) return { std::move(assignment) }; - allocateGlobals(_variableNames.size() - 1); + vector typesForGlobals; + for (size_t i = 1; i < _variableNames.size(); ++i) + typesForGlobals.push_back(translatedType(m_typeInfo.typeOfVariable(YulString(_variableNames[i])))); + vector allocatedIndices = allocateGlobals(typesForGlobals); + yulAssert(allocatedIndices.size() == _variableNames.size() - 1, ""); wasm::Block block; block.statements.emplace_back(move(assignment)); for (size_t i = 1; i < _variableNames.size(); ++i) block.statements.emplace_back(wasm::LocalAssignment{ move(_variableNames.at(i)), - make_unique(wasm::GlobalVariable{m_globalVariables.at(i - 1).variableName}) + make_unique(wasm::GlobalVariable{m_globalVariables.at(allocatedIndices[i - 1]).variableName}) }); return { std::move(block) }; } @@ -88,7 +95,7 @@ wasm::Expression WasmCodeTransform::operator()(VariableDeclaration const& _varDe for (auto const& var: _varDecl.variables) { variableNames.emplace_back(var.name.str()); - m_localVariables.emplace_back(wasm::VariableDeclaration{variableNames.back(), wasm::Type::i64}); + m_localVariables.emplace_back(wasm::VariableDeclaration{variableNames.back(), translatedType(var.type)}); } if (_varDecl.value) @@ -165,20 +172,21 @@ wasm::Expression WasmCodeTransform::operator()(Identifier const& _identifier) wasm::Expression WasmCodeTransform::operator()(Literal const& _literal) { - u256 value = valueOfLiteral(_literal); - yulAssert(value <= numeric_limits::max(), "Literal too large: " + value.str()); - return wasm::Literal{static_cast(value)}; + return makeLiteral(translatedType(_literal.type), valueOfLiteral(_literal)); } wasm::Expression WasmCodeTransform::operator()(If const& _if) { - // TODO converting i64 to i32 might not always be needed. + yul::Type conditionType = m_typeInfo.typeOf(*_if.condition); + YulString ne_instruction = YulString(conditionType.str() + ".ne"); + yulAssert(WasmDialect::instance().builtin(ne_instruction), ""); + // TODO converting i64 to i32 might not always be needed. vector args; args.emplace_back(visitReturnByValue(*_if.condition)); - args.emplace_back(wasm::Literal{static_cast(0)}); + args.emplace_back(makeLiteral(translatedType(conditionType), 0)); return wasm::If{ - make_unique(wasm::BuiltinCall{"i64.ne", std::move(args)}), + make_unique(wasm::BuiltinCall{ne_instruction.str(), std::move(args)}), visit(_if.body.statements), {} }; @@ -186,9 +194,13 @@ wasm::Expression WasmCodeTransform::operator()(If const& _if) wasm::Expression WasmCodeTransform::operator()(Switch const& _switch) { + yul::Type expressionType = m_typeInfo.typeOf(*_switch.expression); + YulString eq_instruction = YulString(expressionType.str() + ".eq"); + yulAssert(WasmDialect::instance().builtin(eq_instruction), ""); + wasm::Block block; string condition = m_nameDispenser.newName("condition"_yulstring).str(); - m_localVariables.emplace_back(wasm::VariableDeclaration{condition, wasm::Type::i64}); + m_localVariables.emplace_back(wasm::VariableDeclaration{condition, translatedType(expressionType)}); block.statements.emplace_back(wasm::LocalAssignment{condition, visit(*_switch.expression)}); vector* currentBlock = &block.statements; @@ -197,7 +209,7 @@ wasm::Expression WasmCodeTransform::operator()(Switch const& _switch) Case const& c = _switch.cases.at(i); if (c.value) { - wasm::BuiltinCall comparison{"i64.eq", make_vector( + wasm::BuiltinCall comparison{eq_instruction.str(), make_vector( wasm::LocalVariable{condition}, visitReturnByValue(*c.value) )}; @@ -236,11 +248,15 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) string continueLabel = newLabel(); m_breakContinueLabelNames.push({breakLabel, continueLabel}); + yul::Type conditionType = m_typeInfo.typeOf(*_for.condition); + YulString eqz_instruction = YulString(conditionType.str() + ".eqz"); + yulAssert(WasmDialect::instance().builtin(eqz_instruction), ""); + wasm::Loop loop; loop.labelName = newLabel(); loop.statements = visit(_for.pre.statements); loop.statements.emplace_back(wasm::BranchIf{wasm::Label{breakLabel}, make_unique( - wasm::BuiltinCall{"i64.eqz", make_vector( + wasm::BuiltinCall{eqz_instruction.str(), make_vector( visitReturnByValue(*_for.condition) )} )}); @@ -308,11 +324,11 @@ wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefin wasm::FunctionDefinition fun; fun.name = _fun.name.str(); for (auto const& param: _fun.parameters) - fun.parameters.push_back({param.name.str(), wasm::Type::i64}); + fun.parameters.push_back({param.name.str(), translatedType(param.type)}); for (auto const& retParam: _fun.returnVariables) - fun.locals.emplace_back(wasm::VariableDeclaration{retParam.name.str(), wasm::Type::i64}); + fun.locals.emplace_back(wasm::VariableDeclaration{retParam.name.str(), translatedType(retParam.type)}); if (!_fun.returnVariables.empty()) - fun.returnType = wasm::Type::i64; + fun.returnType = translatedType(_fun.returnVariables[0].type); yulAssert(m_localVariables.empty(), ""); yulAssert(m_functionBodyLabel.empty(), ""); @@ -330,10 +346,15 @@ wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefin { // First return variable is returned directly, the others are stored // in globals. - allocateGlobals(_fun.returnVariables.size() - 1); + vector typesForGlobals; + for (size_t i = 1; i < _fun.returnVariables.size(); ++i) + typesForGlobals.push_back(translatedType(_fun.returnVariables[i].type)); + vector allocatedIndices = allocateGlobals(typesForGlobals); + yulAssert(allocatedIndices.size() == _fun.returnVariables.size() - 1, ""); + for (size_t i = 1; i < _fun.returnVariables.size(); ++i) fun.body.emplace_back(wasm::GlobalAssignment{ - m_globalVariables.at(i - 1).variableName, + m_globalVariables.at(allocatedIndices[i - 1]).variableName, make_unique(wasm::LocalVariable{_fun.returnVariables.at(i).name.str()}) }); fun.body.emplace_back(wasm::LocalVariable{_fun.returnVariables.front().name.str()}); @@ -346,13 +367,45 @@ string WasmCodeTransform::newLabel() return m_nameDispenser.newName("label_"_yulstring).str(); } -void WasmCodeTransform::allocateGlobals(size_t _amount) +vector WasmCodeTransform::allocateGlobals(vector const& _typesForGlobals) { - while (m_globalVariables.size() < _amount) - m_globalVariables.emplace_back(wasm::GlobalVariableDeclaration{ - m_nameDispenser.newName("global_"_yulstring).str(), - wasm::Type::i64 - }); + map availableGlobals; + for (wasm::GlobalVariableDeclaration const& global: m_globalVariables) + ++availableGlobals[global.type]; + + map neededGlobals; + for (wasm::Type const& type: _typesForGlobals) + ++neededGlobals[type]; + + for (auto [type, neededGlobalCount]: neededGlobals) + while (availableGlobals[type] < neededGlobalCount) + { + m_globalVariables.emplace_back(wasm::GlobalVariableDeclaration{ + m_nameDispenser.newName("global_"_yulstring).str(), + type, + }); + + ++availableGlobals[type]; + } + + vector allocatedIndices; + map nextGlobal; + for (wasm::Type const& type: _typesForGlobals) + { + while (m_globalVariables[nextGlobal[type]].type != type) + ++nextGlobal[type]; + + allocatedIndices.push_back(nextGlobal[type]++); + } + + yulAssert(all_of( + allocatedIndices.begin(), + allocatedIndices.end(), + [this](size_t index){ return index < m_globalVariables.size(); } + ), ""); + yulAssert(allocatedIndices.size() == set(allocatedIndices.begin(), allocatedIndices.end()).size(), "Indices not unique"); + yulAssert(allocatedIndices.size() == _typesForGlobals.size(), ""); + return allocatedIndices; } wasm::Type WasmCodeTransform::translatedType(yul::Type _yulType) @@ -364,3 +417,19 @@ wasm::Type WasmCodeTransform::translatedType(yul::Type _yulType) else yulAssert(false, "This Yul type does not have a corresponding type in Wasm."); } + +wasm::Literal WasmCodeTransform::makeLiteral(wasm::Type _type, u256 _value) +{ + if (_type == wasm::Type::i32) + { + yulAssert(_value <= numeric_limits::max(), "Literal too large: " + _value.str()); + return wasm::Literal{static_cast(_value)}; + } + else if (_type == wasm::Type::i64) + { + yulAssert(_value <= numeric_limits::max(), "Literal too large: " + _value.str()); + return wasm::Literal{static_cast(_value)}; + } + else + yulAssert(false, "Invalid Wasm literal type"); +} diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 68aeb86a385a..326778b3de8d 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -24,6 +24,9 @@ #include #include #include +#include + +#include #include #include @@ -56,10 +59,12 @@ class WasmCodeTransform private: WasmCodeTransform( Dialect const& _dialect, - Block const& _ast + Block const& _ast, + TypeInfo& _typeInfo ): m_dialect(_dialect), - m_nameDispenser(_dialect, _ast) + m_nameDispenser(_dialect, _ast), + m_typeInfo(_typeInfo) {} std::unique_ptr visit(yul::Expression const& _expression); @@ -80,10 +85,12 @@ class WasmCodeTransform wasm::FunctionDefinition translateFunction(yul::FunctionDefinition const& _funDef); std::string newLabel(); - /// Makes sure that there are at least @a _amount global variables. - void allocateGlobals(size_t _amount); + /// Selects a subset of global variables matching specified sequence of variable types. + /// Defines more global variables of a given type if there's not enough. + std::vector allocateGlobals(std::vector const& _typesForGlobals); static wasm::Type translatedType(yul::Type _yulType); + static wasm::Literal makeLiteral(wasm::Type _type, u256 _value); Dialect const& m_dialect; NameDispenser m_nameDispenser; @@ -93,6 +100,7 @@ class WasmCodeTransform std::map m_functionsToImport; std::string m_functionBodyLabel; std::stack> m_breakContinueLabelNames; + TypeInfo& m_typeInfo; }; } From 50b426e37b39652db797511c66711df3a2034c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 5 Jun 2020 21:36:44 +0200 Subject: [PATCH 259/479] Update the expected output of command-line tests after wasm changes --- test/cmdlineTests/evm_to_wasm/output | 18 +-- test/cmdlineTests/evm_to_wasm_break/output | 110 +++++++++--------- .../standard_eWasm_requested/output.json | 52 ++++----- .../output | 20 ++-- .../output | 4 +- 5 files changed, 102 insertions(+), 102 deletions(-) diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output index 7e8bd21cc4b7..11b63c6a2cfc 100644 --- a/test/cmdlineTests/evm_to_wasm/output +++ b/test/cmdlineTests/evm_to_wasm/output @@ -45,7 +45,7 @@ object "object" { Binary representation: -0061736d0100000001160460000060017e017e60057e7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010acb01052b01017e0240420021004200200020002000200010054220200020002000420110054200a74220a710000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b3f0002402000a7200110043700002000a74208a76aada7200210043700002000a74210a76aada7200310043700002000a74218a76aada7200410043700000b0b +0061736d0100000001160460000060017e017e60057f7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010abc01052901017e0240420021004100200020002000200010054120200020002000420110054100412010000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b32000240200020011004370000200041086a20021004370000200041106a20031004370000200041186a200410043700000b0b Text representation: (module @@ -57,9 +57,9 @@ Text representation: (local $_1 i64) (block $label_ (local.set $_1 (i64.const 0)) - (call $mstore_internal (i64.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) - (call $mstore_internal (i64.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1)) - (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + (call $mstore_internal (i32.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) + (call $mstore_internal (i32.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1)) + (call $eth.storageStore (i32.const 0) (i32.const 32)) ) ) @@ -101,16 +101,16 @@ Text representation: ) (func $mstore_internal - (param $pos i64) + (param $pos i32) (param $y1 i64) (param $y2 i64) (param $y3 i64) (param $y4 i64) (block $label__4 - (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + (i64.store (local.get $pos) (call $endian_swap (local.get $y1))) + (i64.store (i32.add (local.get $pos) (i32.const 8)) (call $endian_swap (local.get $y2))) + (i64.store (i32.add (local.get $pos) (i32.const 16)) (call $endian_swap (local.get $y3))) + (i64.store (i32.add (local.get $pos) (i32.const 24)) (call $endian_swap (local.get $y4))) ) ) diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 4d5e10921121..ddeb0452905b 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -154,7 +154,7 @@ object "object" { Binary representation: -0061736d0100000001480a60000060017e017e60027e7e017e60037e7e7e017e60047e7e7e7e017e60057e7e7e7e7e0060087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003070407020704010101050605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020aa5090df302011f7e02404200210002402000200020002000100921012300210223012103230221040b2001210520022106200321072004210842012109200020008420002009848450ada745ada745ad210a02400340200aa745ad500d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f20108420112012848450ada745ad42005204400c030b024020052006200720082000200020004202100621132300211423012115230221160b201320148420152016848450ada745ad42005204400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a848450ada745ad42005204400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2f01037e0240200020017c2105200520027c21032005200054ada72003200554ada772ada7ad21040b2004240020030b72010b7e0240200320077c210c200c42007c210b024020022006200c200354ada7200b200c54ada772ada7ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2601047e0240200020018420022003848450ada7ad21070b20052400200624012007240220040b4901047e02402000200451ad42005204402001200551ad42005204402002200651ad42005204402003200751ad42005204404201210b0b0b0b0b0b20092400200a2401200b240220080b2d01027e024002402000200154ad21032003420151044042ffffffff0f2102052000200152ad21020b0b0b20020b960101087e02404200210c0240200020041007210d200d42005104400240200120051007210e200e42005104400240200220061007210f200f42005104402003200754ad210c05200f42015104404200210c054201210c0b0b0b05200e42015104404200210c054201210c0b0b0b05200d42015104404200210c054201210c0b0b0b200ca7ad210b0b20092400200a2401200b240220080b8f0101087e02404200200020018420028452ad4200520440000b4200200342208852ad4200520440000b4200a72003a7ada74220a710014200a7290000100c21084200a74208a76aada7290000100c21094200a74210a76aada7290000100c210a4200a74218a76aada7290000100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3f0002402000a72001100c3700002000a74208a76aada72002100c3700002000a74210a76aada72003100c3700002000a74218a76aada72004100c3700000b0b2500024042002000200120022003100d42202004200520062007100d4200a74220a710000b0b +0061736d0100000001480a60000060017e017e60027e7e017f60037e7e7e017e60047e7e7e7e017e60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60057f7e7e7e7e0060027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003060406020604010101070505030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020ac3080dde02030a7e017f147e02404200210002402000200020002000100921012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004202100621132300211423012115230221160b2013201484201520168484504504400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a8484504504400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b3901047e0240200020045104402001200551044020022006510440200320075104404201210b0b0b0b0b0b20092400200a2401200b240220080b2701027f024002402000200154210320034101460440417f210205200020015221020b0b0b20020b960102047e047f02404100210c0240200020041007210d200d41004604400240200120051007210e200e41004604400240200220061007210f200f41004604402003200754210c05200f41014604404100210c054101210c0b0b0b05200e41014604404100210c054101210c0b0b0b05200d41014604404100210c054101210c0b0b0b200cad210b0b20092400200a2401200b240220080b7601087e024042002000200184200284520440000b42002003422088520440000b41002003a7412010014100290000100c2108410041086a290000100c2109410041106a290000100c210a410041186a290000100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3200024020002001100c370000200041086a2002100c370000200041106a2003100c370000200041186a2004100c3700000b0b2300024041002000200120022003100d41202004200520062007100d4100412010000b0b Text representation: (module @@ -177,7 +177,7 @@ Text representation: (local $x_6 i64) (local $x_7 i64) (local $_2 i64) - (local $_3 i64) + (local $_3 i32) (local $_4 i64) (local $_5 i64) (local $_6 i64) @@ -212,10 +212,10 @@ Text representation: (local.set $x_6 (local.get $x_2)) (local.set $x_7 (local.get $x_3)) (local.set $_2 (i64.const 1)) - (local.set $_3 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))))))) + (local.set $_3 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2))))))) (block $label__3 (loop $label__5 - (br_if $label__3 (i64.eqz (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (local.get $_3)))))) + (br_if $label__3 (i32.eqz (i32.eqz (local.get $_3)))) (block $label__4 (block (local.set $_4 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))) @@ -231,7 +231,7 @@ Text representation: (local.set $_11 (global.get $global__2)) ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11)))))))) (i64.const 0)) (then + (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11))))) (then (br $label__3) )) (block @@ -241,7 +241,7 @@ Text representation: (local.set $_15 (global.get $global__2)) ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15)))))))) (i64.const 0)) (then + (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15))))) (then (br $label__3) )) (block @@ -251,7 +251,7 @@ Text representation: (local.set $_19 (global.get $global__2)) ) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $_16) (local.get $_17)) (i64.or (local.get $_18) (local.get $_19)))))))) (i64.const 0)) (then + (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_16) (local.get $_17)) (i64.or (local.get $_18) (local.get $_19))))) (then (br $label__4) )) @@ -286,7 +286,7 @@ Text representation: (block $label__6 (local.set $t (i64.add (local.get $x) (local.get $y))) (local.set $r (i64.add (local.get $t) (local.get $c))) - (local.set $r_c (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r) (local.get $t))))))))) + (local.set $r_c (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x)) (i64.lt_u (local.get $r) (local.get $t))))) ) (global.set $global_ (local.get $r_c)) @@ -318,7 +318,7 @@ Text representation: (local.set $t (i64.add (local.get $x4) (local.get $y4))) (local.set $r4 (i64.add (local.get $t) (i64.const 0))) (block - (local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i32.or (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $t) (local.get $x4)))) (i32.wrap_i64 (i64.extend_i32_u (i64.lt_u (local.get $r4) (local.get $t)))))))))) + (local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t)))))) (local.set $carry (global.get $global_)) ) @@ -354,7 +354,7 @@ Text representation: (local $r3 i64) (local $r4 i64) (block $label__8 - (local.set $r4 (i64.extend_i32_u (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4)))))))) + (local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4)))))) ) (global.set $global_ (local.get $r2)) @@ -378,10 +378,10 @@ Text representation: (local $r3 i64) (local $r4 i64) (block $label__9 - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x1) (local.get $y1))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x2) (local.get $y2))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x3) (local.get $y3))) (i64.const 0)) (then - (if (i64.ne (i64.extend_i32_u (i64.eq (local.get $x4) (local.get $y4))) (i64.const 0)) (then + (if (i64.eq (local.get $x1) (local.get $y1)) (then + (if (i64.eq (local.get $x2) (local.get $y2)) (then + (if (i64.eq (local.get $x3) (local.get $y3)) (then + (if (i64.eq (local.get $x4) (local.get $y4)) (then (local.set $r4 (i64.const 1)) )) )) @@ -398,16 +398,16 @@ Text representation: (func $cmp (param $a i64) (param $b i64) - (result i64) - (local $r i64) - (local $condition i64) + (result i32) + (local $r i32) + (local $condition i32) (block $label__10 (block - (local.set $condition (i64.extend_i32_u (i64.lt_u (local.get $a) (local.get $b)))) - (if (i64.eq (local.get $condition) (i64.const 1)) (then - (local.set $r (i64.const 4294967295)) + (local.set $condition (i64.lt_u (local.get $a) (local.get $b))) + (if (i32.eq (local.get $condition) (i32.const 1)) (then + (local.set $r (i32.const 4294967295)) )(else - (local.set $r (i64.extend_i32_u (i64.ne (local.get $a) (local.get $b)))) + (local.set $r (i64.ne (local.get $a) (local.get $b))) )) ) @@ -430,50 +430,50 @@ Text representation: (local $z2 i64) (local $z3 i64) (local $z4 i64) - (local $z i64) - (local $condition_12 i64) - (local $condition_13 i64) - (local $condition_14 i64) + (local $z i32) + (local $condition_12 i32) + (local $condition_13 i32) + (local $condition_14 i32) (block $label__11 - (local.set $z (i64.const 0)) + (local.set $z (i32.const 0)) (block (local.set $condition_12 (call $cmp (local.get $x1) (local.get $y1))) - (if (i64.eq (local.get $condition_12) (i64.const 0)) (then + (if (i32.eq (local.get $condition_12) (i32.const 0)) (then (block (local.set $condition_13 (call $cmp (local.get $x2) (local.get $y2))) - (if (i64.eq (local.get $condition_13) (i64.const 0)) (then + (if (i32.eq (local.get $condition_13) (i32.const 0)) (then (block (local.set $condition_14 (call $cmp (local.get $x3) (local.get $y3))) - (if (i64.eq (local.get $condition_14) (i64.const 0)) (then - (local.set $z (i64.extend_i32_u (i64.lt_u (local.get $x4) (local.get $y4)))) + (if (i32.eq (local.get $condition_14) (i32.const 0)) (then + (local.set $z (i64.lt_u (local.get $x4) (local.get $y4))) )(else - (if (i64.eq (local.get $condition_14) (i64.const 1)) (then - (local.set $z (i64.const 0)) + (if (i32.eq (local.get $condition_14) (i32.const 1)) (then + (local.set $z (i32.const 0)) )(else - (local.set $z (i64.const 1)) + (local.set $z (i32.const 1)) )) )) ) )(else - (if (i64.eq (local.get $condition_13) (i64.const 1)) (then - (local.set $z (i64.const 0)) + (if (i32.eq (local.get $condition_13) (i32.const 1)) (then + (local.set $z (i32.const 0)) )(else - (local.set $z (i64.const 1)) + (local.set $z (i32.const 1)) )) )) ) )(else - (if (i64.eq (local.get $condition_12) (i64.const 1)) (then - (local.set $z (i64.const 0)) + (if (i32.eq (local.get $condition_12) (i32.const 1)) (then + (local.set $z (i32.const 0)) )(else - (local.set $z (i64.const 1)) + (local.set $z (i32.const 1)) )) )) ) - (local.set $z4 (i64.extend_i32_u (i32.wrap_i64 (local.get $z)))) + (local.set $z4 (i64.extend_i32_u (local.get $z))) ) (global.set $global_ (local.get $z2)) @@ -497,15 +497,15 @@ Text representation: (local $z3_1 i64) (local $z4_1 i64) (block $label__15 - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then + (if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then (unreachable))) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then + (if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then (unreachable))) - (call $eth.callDataCopy (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) (i32.wrap_i64 (i64.const 32))) - (local.set $z1_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) - (local.set $z2_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) - (local.set $z3_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) - (local.set $z4_1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))) + (call $eth.callDataCopy (i32.const 0) (i32.wrap_i64 (local.get $x4)) (i32.const 32)) + (local.set $z1_1 (call $endian_swap (i64.load (i32.const 0)))) + (local.set $z2_1 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 8))))) + (local.set $z3_1 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 16))))) + (local.set $z4_1 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 24))))) (local.set $z1 (local.get $z1_1)) (local.set $z2 (local.get $z2_1)) (local.set $z3 (local.get $z3_1)) @@ -556,16 +556,16 @@ Text representation: ) (func $mstore_internal - (param $pos i64) + (param $pos i32) (param $y1 i64) (param $y2 i64) (param $y3 i64) (param $y4 i64) (block $label__19 - (i64.store (i32.wrap_i64 (local.get $pos)) (call $endian_swap (local.get $y1))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 8))))) (call $endian_swap (local.get $y2))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 16))))) (call $endian_swap (local.get $y3))) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $pos)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (local.get $y4))) + (i64.store (local.get $pos) (call $endian_swap (local.get $y1))) + (i64.store (i32.add (local.get $pos) (i32.const 8)) (call $endian_swap (local.get $y2))) + (i64.store (i32.add (local.get $pos) (i32.const 16)) (call $endian_swap (local.get $y3))) + (i64.store (i32.add (local.get $pos) (i32.const 24)) (call $endian_swap (local.get $y4))) ) ) @@ -579,9 +579,9 @@ Text representation: (param $y3 i64) (param $y4 i64) (block $label__20 - (call $mstore_internal (i64.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) - (call $mstore_internal (i64.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) - (call $eth.storageStore (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 32))) + (call $mstore_internal (i32.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) + (call $mstore_internal (i32.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) + (call $eth.storageStore (i32.const 0) (i32.const 32)) ) ) diff --git a/test/cmdlineTests/standard_eWasm_requested/output.json b/test/cmdlineTests/standard_eWasm_requested/output.json index b604b384d4ed..a3885d128238 100644 --- a/test/cmdlineTests/standard_eWasm_requested/output.json +++ b/test/cmdlineTests/standard_eWasm_requested/output.json @@ -9,8 +9,8 @@ (func $main (local $_1 i64) - (local $p i64) - (local $r i64) + (local $p i32) + (local $r i32) (local $_2 i64) (local $z1 i64) (local $z2 i64) @@ -19,19 +19,19 @@ (block $label_ (local.set $_1 (i64.const 0)) (local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64))) - (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) - (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then + (local.set $r (i32.add (local.get $p) (i32.const 64))) + (if (i32.lt_u (local.get $r) (local.get $p)) (then (unreachable))) (local.set $_2 (call $endian_swap (local.get $_1))) - (i64.store (i32.wrap_i64 (local.get $r)) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 8))))) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 16))))) (local.get $_2)) - (i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 24))))) (call $endian_swap (i64.const 128))) - (call $eth.getCallValue (i32.wrap_i64 (i64.const 0))) - (local.set $z1 (call $endian_swap (i64.load (i32.wrap_i64 (i64.const 0))))) - (local.set $z2 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 8)))))))) - (local.set $z3 (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 16)))))))) - (if (i64.ne (i64.extend_i32_u (i32.eqz (i32.wrap_i64 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $endian_swap (i64.load (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (i64.const 0)) (i32.wrap_i64 (i64.const 24)))))))))))))) (i64.const 0)) (then + (i64.store (local.get $r) (local.get $_2)) + (i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $_2)) + (i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $_2)) + (i64.store (i32.add (local.get $r) (i32.const 24)) (call $endian_swap (i64.const 128))) + (call $eth.getCallValue (i32.const 0)) + (local.set $z1 (call $endian_swap (i64.load (i32.const 0)))) + (local.set $z2 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 8))))) + (local.set $z3 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 16))))) + (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 24)))))))) (then (call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))) (local.set $_3 (datasize \"C_2_deployed\")) (call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) @@ -44,14 +44,14 @@ (param $x2 i64) (param $x3 i64) (param $x4 i64) - (result i64) - (local $v i64) + (result i32) + (local $v i32) (block $label__1 - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then + (if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then (unreachable))) - (if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then + (if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then (unreachable))) - (local.set $v (i64.extend_i32_u (i32.wrap_i64 (local.get $x4)))) + (local.set $v (i32.wrap_i64 (local.get $x4))) ) (local.get $v) @@ -62,13 +62,13 @@ (param $x2 i64) (param $x3 i64) (param $x4 i64) - (result i64) - (local $r i64) - (local $p i64) + (result i32) + (local $r i32) + (local $p i32) (block $label__2 (local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) - (local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64))))) - (if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then + (local.set $r (i32.add (local.get $p) (i32.const 64))) + (if (i32.lt_u (local.get $r) (local.get $p)) (then (unreachable))) ) @@ -89,7 +89,7 @@ (param $z3 i64) (param $z4 i64) (block $label__3 - (call $eth.codeCopy (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4)))) + (call $eth.codeCopy (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4))) ) ) @@ -140,7 +140,7 @@ (param $y3 i64) (param $y4 i64) (block $label__7 - (call $eth.finish (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + (call $eth.finish (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))) ) ) @@ -154,7 +154,7 @@ (param $y3 i64) (param $y4 i64) (block $label__8 - (call $eth.revert (i32.wrap_i64 (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))) (i32.wrap_i64 (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))) + (call $eth.revert (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))) ) ) diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output index a99808601e42..4a3ef4eba760 100644 --- a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output +++ b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output @@ -20,24 +20,24 @@ object "object" { Binary representation: -0061736d01000000010c0260000060047e7e7e7e017e020100030302000105030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00000a4a022201047e024002404201420242034204100121002300210123012102230221030b0b0b2501047e0240200121042002210720002105200321060b20052400200624012007240220040b +0061736d01000000010c0260000060047f7e7e7f017e020100030302000105030100010610037f0141000b7f0141000b7e0142000b071102066d656d6f72790200046d61696e00000a52022603017e027f017e024002404101420242034104100121002300210123012102230221030b0b0b2903017e027f017e0240200121042002210720002105200321060b20052400200624012007240220040b Text representation: (module (memory $memory (export "memory") 1) (export "main" (func $main)) - (global $global_ (mut i64) (i64.const 0)) - (global $global__1 (mut i64) (i64.const 0)) + (global $global_ (mut i32) (i32.const 0)) + (global $global__1 (mut i32) (i32.const 0)) (global $global__2 (mut i64) (i64.const 0)) (func $main (local $m i64) - (local $n i64) - (local $p i64) + (local $n i32) + (local $p i32) (local $q i64) (block $label_ (block - (local.set $m (call $multireturn (i64.const 1) (i64.const 2) (i64.const 3) (i64.const 4))) + (local.set $m (call $multireturn (i32.const 1) (i64.const 2) (i64.const 3) (i32.const 4))) (local.set $n (global.get $global_)) (local.set $p (global.get $global__1)) (local.set $q (global.get $global__2)) @@ -48,14 +48,14 @@ Text representation: ) (func $multireturn - (param $a i64) + (param $a i32) (param $b i64) (param $c i64) - (param $d i64) + (param $d i32) (result i64) (local $x i64) - (local $y i64) - (local $z i64) + (local $y i32) + (local $z i32) (local $w i64) (block $label__3 (local.set $x (local.get $b)) diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output index ef0b409fbd77..e0cc44e57771 100644 --- a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output +++ b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output @@ -11,7 +11,7 @@ object "object" { Binary representation: -0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0f010d0002404201a7422a3c00000b0b +0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0e010c0002404101422a3c00000b0b Text representation: (module @@ -20,7 +20,7 @@ Text representation: (func $main (block $label_ - (i64.store8 (i32.wrap_i64 (i64.const 1)) (i64.const 42)) + (i64.store8 (i32.const 1) (i64.const 42)) ) ) From 06e1b38d1d24628bb728b1f26d359a420f10f8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 15 Jun 2020 19:30:06 +0200 Subject: [PATCH 260/479] WasmCodeTransform: Convert Yul 'if's with i32 argument directly to wasm 'if' without an extra comparison with zero --- libyul/backends/wasm/WasmCodeTransform.cpp | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index d04d84c0e052..d2bceaa90bbb 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -178,18 +178,23 @@ wasm::Expression WasmCodeTransform::operator()(Literal const& _literal) wasm::Expression WasmCodeTransform::operator()(If const& _if) { yul::Type conditionType = m_typeInfo.typeOf(*_if.condition); - YulString ne_instruction = YulString(conditionType.str() + ".ne"); - yulAssert(WasmDialect::instance().builtin(ne_instruction), ""); - - // TODO converting i64 to i32 might not always be needed. - vector args; - args.emplace_back(visitReturnByValue(*_if.condition)); - args.emplace_back(makeLiteral(translatedType(conditionType), 0)); - return wasm::If{ - make_unique(wasm::BuiltinCall{ne_instruction.str(), std::move(args)}), - visit(_if.body.statements), - {} - }; + + wasm::Expression condition; + if (conditionType == "i32"_yulstring) + condition = visitReturnByValue(*_if.condition); + else if (conditionType == "i64"_yulstring) + { + vector args; + args.emplace_back(visitReturnByValue(*_if.condition)); + args.emplace_back(makeLiteral(translatedType("i64"_yulstring), 0)); + + // NOTE: `if` in wasm requires an i32 argument + condition = wasm::BuiltinCall{"i64.ne", std::move(args)}; + } + else + yulAssert(false, "Invalid condition type"); + + return wasm::If{make_unique(move(condition)), visit(_if.body.statements), {}}; } wasm::Expression WasmCodeTransform::operator()(Switch const& _switch) From 76468f19fec1ab2398552b98dda503c4f6e960ae Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2020 17:44:48 +0200 Subject: [PATCH 261/479] Check if using for refers to a library earlier. --- Changelog.md | 1 + libsolidity/analysis/DeclarationTypeChecker.cpp | 9 +++++++++ libsolidity/analysis/DeclarationTypeChecker.h | 1 + libsolidity/analysis/TypeChecker.cpp | 9 --------- libsolidity/analysis/TypeChecker.h | 1 - test/libsolidity/syntaxTests/bound/bound_to_struct.sol | 10 ++++++++++ 6 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 test/libsolidity/syntaxTests/bound/bound_to_struct.sol diff --git a/Changelog.md b/Changelog.md index 22f1d1e5dec7..2c855de10492 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Compiler Features: Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. + * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. ### 0.6.10 (2020-06-11) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index b5b27222d302..07e8f606675f 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -395,6 +395,15 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) } +void DeclarationTypeChecker::endVisit(UsingForDirective const& _usingFor) +{ + ContractDefinition const* library = dynamic_cast( + _usingFor.libraryName().annotation().referencedDeclaration + ); + if (!library || !library->isLibrary()) + m_errorReporter.fatalTypeError(4357_error, _usingFor.libraryName().location(), "Library name expected."); +} + bool DeclarationTypeChecker::check(ASTNode const& _node) { auto watcher = m_errorReporter.errorWatcher(); diff --git a/libsolidity/analysis/DeclarationTypeChecker.h b/libsolidity/analysis/DeclarationTypeChecker.h index 764a66e1d786..0edd97bd94ed 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.h +++ b/libsolidity/analysis/DeclarationTypeChecker.h @@ -58,6 +58,7 @@ class DeclarationTypeChecker: private ASTConstVisitor void endVisit(ArrayTypeName const& _typeName) override; void endVisit(VariableDeclaration const& _variable) override; bool visit(StructDefinition const& _struct) override; + void endVisit(UsingForDirective const& _usingForDirective) override; langutil::ErrorReporter& m_errorReporter; langutil::EVMVersion m_evmVersion; diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 4a99764c3ad2..3bdb2de90a14 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -313,15 +313,6 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance) } } -void TypeChecker::endVisit(UsingForDirective const& _usingFor) -{ - ContractDefinition const* library = dynamic_cast( - _usingFor.libraryName().annotation().referencedDeclaration - ); - if (!library || !library->isLibrary()) - m_errorReporter.fatalTypeError(4357_error, _usingFor.libraryName().location(), "Library name expected."); -} - void TypeChecker::endVisit(ModifierDefinition const& _modifier) { if (!_modifier.isImplemented() && !_modifier.virtualSemantics()) diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 732f6275aa34..9e5f9470f556 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -111,7 +111,6 @@ class TypeChecker: private ASTConstVisitor ); void endVisit(InheritanceSpecifier const& _inheritance) override; - void endVisit(UsingForDirective const& _usingFor) override; void endVisit(ModifierDefinition const& _modifier) override; bool visit(FunctionDefinition const& _function) override; bool visit(VariableDeclaration const& _variable) override; diff --git a/test/libsolidity/syntaxTests/bound/bound_to_struct.sol b/test/libsolidity/syntaxTests/bound/bound_to_struct.sol new file mode 100644 index 000000000000..eefe9f6bf963 --- /dev/null +++ b/test/libsolidity/syntaxTests/bound/bound_to_struct.sol @@ -0,0 +1,10 @@ +contract C { + struct S { uint t; } + function r() public { + S memory x; + x.d; + } + using S for S; +} +// ---- +// TypeError: (113-114): Library name expected. From 2a0d701f709673162e8417d2f388b8171a34e892 Mon Sep 17 00:00:00 2001 From: step21 Date: Wed, 17 Jun 2020 16:31:22 +0200 Subject: [PATCH 262/479] added raspbian --- scripts/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index f3062e21a9bd..a825a6d84f70 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -170,7 +170,7 @@ case $(uname -s) in # Debian #------------------------------------------------------------------------------ - Debian*) + Debian*|Raspbian) #Debian . /etc/os-release install_z3="" From b00014c51d8a2db47d48bcda2c17512de3704da2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2020 17:56:51 +0200 Subject: [PATCH 263/479] Fix source location of yul multi-assignemnt. --- Changelog.md | 1 + libyul/AsmParser.cpp | 9 +++------ .../syntaxTests/inlineAssembly/assignment_location.sol | 8 ++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol diff --git a/Changelog.md b/Changelog.md index 2c855de10492..843d47ba5233 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Compiler Features: Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. + * Yul: Fix source location of variable multi-assignment. ### 0.6.10 (2020-06-11) diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 19574446d102..d3d74ac350d5 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -175,7 +175,8 @@ Statement Parser::parseStatement() case Token::Comma: case Token::AssemblyAssign: { - std::vector variableNames; + Assignment assignment; + assignment.location = locationOf(elementary); while (true) { @@ -197,7 +198,7 @@ Statement Parser::parseStatement() if (m_dialect.builtin(identifier.name)) fatalParserError(6272_error, "Cannot assign to builtin function \"" + identifier.name.str() + "\"."); - variableNames.emplace_back(identifier); + assignment.variableNames.emplace_back(identifier); if (currentToken() != Token::Comma) break; @@ -207,10 +208,6 @@ Statement Parser::parseStatement() elementary = parseElementaryOperation(); } - Assignment assignment; - assignment.location = std::get(elementary).location; - assignment.variableNames = std::move(variableNames); - expectToken(Token::AssemblyAssign); assignment.value = make_unique(parseExpression()); diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol new file mode 100644 index 000000000000..b6b8f8e4a7cd --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol @@ -0,0 +1,8 @@ +contract C { + function f() pure public { + uint x; uint y; + assembly { x, y := 7 } + } +} +// ---- +// DeclarationError: (87-96): Variable count does not match number of values (2 vs. 1) From cd2cc76f20d3f6b9c49bcd0916f0cfdcc1b7e6dd Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2020 16:49:31 +0200 Subject: [PATCH 264/479] Modules are pure. --- libsolidity/analysis/TypeChecker.cpp | 5 ++++- libsolidity/codegen/ExpressionCompiler.cpp | 14 ++++++++++++++ .../syntaxTests/imports/import_access_struct.sol | 14 ++++++++++++++ .../syntaxTests/imports/transitive.sol | 15 +++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/imports/import_access_struct.sol create mode 100644 test/libsolidity/syntaxTests/imports/transitive.sol diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 3bdb2de90a14..8ac88d506c45 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2704,6 +2704,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) annotation.isPure = _memberAccess.expression().annotation().isPure; } } + else if (exprType->category() == Type::Category::Module) + annotation.isPure = _memberAccess.expression().annotation().isPure; // TODO some members might be pure, but for example `address(0x123).balance` is not pure // although every subexpression is, so leaving this limited for now. @@ -3053,7 +3055,8 @@ bool TypeChecker::visit(Identifier const& _identifier) } else if (dynamic_cast(annotation.type)) annotation.isPure = true; - + else if (dynamic_cast(annotation.type)) + annotation.isPure = true; // Check for deprecated function names. // The check is done here for the case without an actual function call. diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index a020551f36ac..cbacd0a7e901 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1718,6 +1718,16 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) solAssert(false, "Illegal fixed bytes member."); break; } + case Type::Category::Module: + { + Type::Category category = _memberAccess.annotation().type->category(); + solAssert( + category == Type::Category::TypeType || + category == Type::Category::Module, + "" + ); + break; + } default: solAssert(false, "Member access to unknown type."); } @@ -1933,6 +1943,10 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier) { // no-op } + else if (dynamic_cast(declaration)) + { + // no-op + } else { solAssert(false, "Identifier type not expected in expression context."); diff --git a/test/libsolidity/syntaxTests/imports/import_access_struct.sol b/test/libsolidity/syntaxTests/imports/import_access_struct.sol new file mode 100644 index 000000000000..81552a7caed6 --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/import_access_struct.sol @@ -0,0 +1,14 @@ +==== Source: a ==== +struct S { uint x; } +==== Source: b ==== +import "a" as A; +struct T { uint x; } +contract C { + function f() public pure { + T; + A.S; + } +} +// ---- +// Warning: (b:90-91): Statement has no effect. +// Warning: (b:101-104): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/imports/transitive.sol b/test/libsolidity/syntaxTests/imports/transitive.sol new file mode 100644 index 000000000000..e6a5771e997b --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/transitive.sol @@ -0,0 +1,15 @@ +==== Source: a ==== +struct S { uint[2] mS; } +==== Source: b ==== +import "a" as A; +struct T { A.S[2] mT; } +==== Source: c ==== +pragma experimental ABIEncoderV2; +import "b" as B; +contract C { + function f(B.T memory y, B.A.S memory z) public pure returns (uint, uint) { + z = B.A.S([uint(2), 3]); + y = B.T([z, z]); + return (y.mT[0].mS[0], z.mS[0]); + } +} From 44e39f36260dc87eb33ec31d4c87368dc4f75a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 18 Jun 2020 13:50:36 +0200 Subject: [PATCH 265/479] docs/yul.rst: Fix typos in setimmutable/loadimmutable docs --- docs/yul.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/yul.rst b/docs/yul.rst index 2e8bc4a104d7..b928bf85e0ec 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -904,7 +904,7 @@ In some internal dialects, there are additional functions: datasize, dataoffset, datacopy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The functions ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)``, +The functions ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)`` are used to access other parts of a Yul object. ``datasize`` and ``dataoffset`` can only take string literals (the names of other objects) @@ -916,9 +916,9 @@ setimmutable, loadimmutable ^^^^^^^^^^^^^^^^^^^^^^^^^^^ The functions ``setimmutable("name", value)`` and ``loadimmutable("name")`` are -used for the immutable mechanism in Solidity and do not nicely map to pur Yul. +used for the immutable mechanism in Solidity and do not nicely map to pure Yul. The function ``setimmutable`` assumes that the runtime code of a contract -is currently copied to memory at offsot zero. The call to ``setimmutable("name", value)`` +is currently copied to memory at offset zero. The call to ``setimmutable("name", value)`` will store ``value`` at all points in memory that contain a call to ``loadimmutable("name")``. From e04cedafc509e2b56f311e2478b3413ca94bcd20 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Fri, 19 Jun 2020 02:26:46 +0200 Subject: [PATCH 266/479] Added error codes to SyntaxTest expectations (updated tests) --- .../constructor_recovers.sol | 4 +- .../errorRecoveryTests/contract_recovery.sol | 4 +- .../do_not_delete_at_error.sol | 2 +- .../errorRecoveryTests/error_to_eos.sol | 8 +- .../errorRecoveryTests/missing_rhs.sol | 4 +- .../errorRecoveryTests/multiple_errors.sol | 12 +- .../length_1d_struct_array_1.sol | 14 +- .../length_1d_struct_array_2d_1.sol | 18 +- .../array_members/length_basic.sol | 2 +- .../length_same_after_assignment_2_fail.sol | 6 +- .../length_same_after_assignment_3_fail.sol | 8 +- .../array_members/pop_1_unsafe.sol | 2 +- .../array_members/pop_2d_unsafe.sol | 2 +- .../array_members/pop_constructor_unsafe.sol | 2 +- .../array_members/pop_loop_unsafe.sol | 2 +- .../array_members/push_2d_arg_1_unsafe.sol | 4 +- .../push_storage_ref_safe_aliasing.sol | 4 +- .../push_storage_ref_unsafe_aliasing.sol | 2 +- .../push_storage_ref_unsafe_length.sol | 6 +- .../array_members/push_struct_member_1.sol | 20 +- .../array_members/push_struct_member_2.sol | 30 +- .../array_members/push_zero_2d_unsafe.sol | 2 +- .../array_members/push_zero_unsafe.sol | 2 +- .../smtCheckerTests/complex/MerkleProof.sol | 8 +- .../complex/slither/const_state_variables.sol | 8 +- .../complex/slither/data_dependency.sol | 40 +- .../complex/slither/external_function.sol | 28 +- .../complex/warn_on_struct.sol | 10 +- .../complex/warn_on_typecast.sol | 2 +- .../function_call_inside_branch.sol | 6 +- .../function_call_inside_branch_2.sol | 10 +- .../function_call_inside_branch_3.sol | 10 +- .../function_call_inside_branch_4.sol | 8 +- .../function_call_inside_else_branch.sol | 6 +- .../function_call_inside_modifier_branch.sol | 6 +- ...ide_placeholder_inside_modifier_branch.sol | 6 +- .../control_flow/short_circuit_and.sol | 2 +- .../control_flow/short_circuit_and_fail.sol | 4 +- .../short_circuit_and_inside_branch.sol | 6 +- .../short_circuit_and_need_both.sol | 2 +- .../short_circuit_and_need_both_fail.sol | 4 +- .../short_circuit_and_touched.sol | 10 +- .../short_circuit_and_touched_function.sol | 10 +- .../control_flow/short_circuit_or.sol | 2 +- .../control_flow/short_circuit_or_fail.sol | 4 +- .../short_circuit_or_inside_branch.sol | 4 +- .../short_circuit_or_need_both.sol | 2 +- .../short_circuit_or_need_both_fail.sol | 4 +- .../control_flow/short_circuit_or_touched.sol | 10 +- .../short_circuit_or_touched_function.sol | 10 +- .../control_flow/try_catch_1.sol | 4 +- .../control_flow/try_catch_2.sol | 4 +- .../ways_to_merge_variables_1.sol | 2 +- .../ways_to_merge_variables_2.sol | 2 +- .../ways_to_merge_variables_3.sol | 2 +- .../functions/abi_encode_functions.sol | 8 +- .../functions/constructor_hierarchy.sol | 2 +- .../functions/constructor_hierarchy_2.sol | 2 +- .../functions/constructor_hierarchy_3.sol | 6 +- .../functions/constructor_hierarchy_4.sol | 6 +- .../constructor_hierarchy_diamond.sol | 8 +- .../constructor_hierarchy_diamond_2.sol | 8 +- .../constructor_hierarchy_diamond_3.sol | 16 +- ...tructor_hierarchy_diamond_empty_middle.sol | 4 +- .../constructor_hierarchy_empty_chain.sol | 4 +- .../constructor_hierarchy_empty_middle.sol | 4 +- ...r_hierarchy_empty_middle_no_invocation.sol | 4 +- .../constructor_hierarchy_mixed_chain.sol | 4 +- ...uctor_hierarchy_mixed_chain_local_vars.sol | 4 +- ...ctor_hierarchy_mixed_chain_with_params.sol | 6 +- ...or_hierarchy_mixed_chain_with_params_2.sol | 4 +- .../constructor_hierarchy_modifier.sol | 2 +- .../constructor_hierarchy_same_var.sol | 4 +- .../functions/constructor_simple.sol | 2 +- .../functions/constructor_state_value.sol | 2 +- .../constructor_state_value_inherited.sol | 2 +- .../constructor_state_value_parameter.sol | 4 +- .../functions/constructor_this.sol | 4 +- .../function_call_state_var_init.sol | 4 +- ...unction_inside_branch_modify_state_var.sol | 2 +- ...ction_inside_branch_modify_state_var_3.sol | 4 +- .../functions/functions_bound_1_fail.sol | 2 +- .../functions/functions_external_1.sol | 2 +- .../functions/functions_external_2.sol | 2 +- .../functions/functions_external_3.sol | 2 +- .../functions/functions_external_4.sol | 2 +- .../functions/functions_identity_1_fail.sol | 2 +- .../functions/functions_identity_2_fail.sol | 2 +- .../functions_identity_as_tuple_fail.sol | 2 +- .../functions/functions_library_1.sol | 2 +- .../functions/functions_library_1_fail.sol | 4 +- .../functions_storage_var_1_fail.sol | 2 +- .../functions_storage_var_2_fail.sol | 2 +- .../functions_trivial_condition_for.sol | 2 +- .../functions_trivial_condition_if.sol | 2 +- .../functions_trivial_condition_require.sol | 2 +- .../functions_trivial_condition_while.sol | 2 +- .../functions/internal_call_inheritance.sol | 2 +- .../functions/internal_call_inheritance_2.sol | 2 +- .../internal_call_state_var_init_2.sol | 6 +- .../internal_call_with_assertion_1.sol | 6 +- .../internal_call_with_assertion_1_fail.sol | 20 +- ...rnal_call_with_assertion_inheritance_1.sol | 4 +- ...call_with_assertion_inheritance_1_fail.sol | 14 +- ...ternal_multiple_calls_with_assertion_1.sol | 10 +- ...l_multiple_calls_with_assertion_1_fail.sol | 16 +- .../functions/library_after_contract.sol | 4 +- .../functions/library_constant.sol | 10 +- .../functions/recursive_multi_return_2.sol | 4 +- .../smtCheckerTests/functions/this_fake.sol | 4 +- ...ctor_hierarchy_mixed_chain_with_params.sol | 6 +- .../constructor_state_variable_init.sol | 2 +- .../constructor_state_variable_init_base.sol | 2 +- .../constructor_state_variable_init_chain.sol | 2 +- ...or_state_variable_init_chain_alternate.sol | 2 +- ...ctor_state_variable_init_chain_run_all.sol | 18 +- ...or_state_variable_init_chain_run_all_2.sol | 14 +- ...onstructor_state_variable_init_diamond.sol | 2 +- ...tor_state_variable_init_diamond_middle.sol | 2 +- .../smtCheckerTests/inheritance/fallback.sol | 8 +- .../inheritance/fallback_receive.sol | 10 +- .../inheritance/functions_1.sol | 8 +- .../inheritance/functions_2.sol | 8 +- .../inheritance/functions_3.sol | 18 +- .../smtCheckerTests/inheritance/receive.sol | 8 +- .../inheritance/receive_fallback.sol | 10 +- .../smtCheckerTests/inline_assembly/empty.sol | 2 +- .../inline_assembly/local_var.sol | 2 +- .../invariants/state_machine_1_fail.sol | 2 +- .../smtCheckerTests/loops/do_while_1_fail.sol | 4 +- .../loops/do_while_1_false_positives.sol | 2 +- .../smtCheckerTests/loops/do_while_break.sol | 4 +- .../loops/do_while_break_2.sol | 4 +- .../loops/do_while_break_2_fail.sol | 6 +- .../loops/do_while_break_fail.sol | 6 +- .../loops/do_while_continue.sol | 2 +- .../loops/for_1_break_fail.sol | 2 +- .../loops/for_1_continue_fail.sol | 4 +- .../smtCheckerTests/loops/for_1_fail.sol | 4 +- .../loops/for_1_false_positive.sol | 2 +- .../loops/for_break_direct.sol | 2 +- .../smtCheckerTests/loops/for_loop_4.sol | 2 +- .../smtCheckerTests/loops/for_loop_5.sol | 2 +- ...or_loop_array_assignment_memory_memory.sol | 6 +- ...r_loop_array_assignment_memory_storage.sol | 4 +- ...r_loop_array_assignment_storage_memory.sol | 2 +- ..._loop_array_assignment_storage_storage.sol | 4 +- .../loops/for_loop_trivial_condition_1.sol | 2 +- .../loops/for_loop_trivial_condition_2.sol | 2 +- .../loops/for_loop_trivial_condition_3.sol | 2 +- .../loops/for_loop_unreachable_1.sol | 2 +- .../loops/while_1_break_fail.sol | 2 +- .../loops/while_1_continue_fail.sol | 4 +- .../smtCheckerTests/loops/while_1_fail.sol | 2 +- .../smtCheckerTests/loops/while_2_break.sol | 2 +- .../loops/while_2_break_fail.sol | 4 +- .../loops/while_break_direct.sol | 2 +- ...le_loop_array_assignment_memory_memory.sol | 6 +- ...e_loop_array_assignment_memory_storage.sol | 4 +- ..._loop_array_assignment_storage_storage.sol | 4 +- .../loops/while_loop_simple_1.sol | 2 +- .../loops/while_loop_simple_3.sol | 2 +- .../loops/while_loop_simple_5.sol | 2 +- .../loops/while_nested_break_fail.sol | 4 +- .../loops/while_nested_continue_fail.sol | 4 +- .../modifier_code_after_placeholder.sol | 4 +- .../modifiers/modifier_control_flow.sol | 2 +- ...modifier_inline_function_inside_branch.sol | 4 +- .../modifier_inside_branch_assignment.sol | 2 +- ...difier_inside_branch_assignment_branch.sol | 2 +- ...nside_branch_assignment_multi_branches.sol | 2 +- .../modifiers/modifier_multi.sol | 2 +- .../modifiers/modifier_multi_functions.sol | 2 +- .../modifiers/modifier_multi_parameters.sol | 2 +- .../modifiers/modifier_overflow.sol | 2 +- .../modifiers/modifier_parameter_copy.sol | 2 +- .../modifier_same_local_variables.sol | 2 +- .../modifiers/modifier_two_placeholders.sol | 2 +- .../operators/bitwise_and_int.sol | 2 +- .../operators/bitwise_and_rational.sol | 2 +- .../operators/bitwise_and_uint.sol | 6 +- .../operators/compound_add.sol | 2 +- .../operators/compound_add_array_index.sol | 2 +- .../operators/compound_add_mapping.sol | 2 +- .../compound_assignment_division_1.sol | 6 +- .../compound_assignment_division_2.sol | 6 +- .../compound_assignment_division_3.sol | 6 +- .../operators/compound_bitwise_and_1.sol | 4 +- .../operators/compound_bitwise_or_1.sol | 4 +- .../operators/compound_bitwise_xor_1.sol | 4 +- .../operators/compound_mul.sol | 2 +- .../operators/compound_mul_array_index.sol | 2 +- .../operators/compound_mul_mapping.sol | 2 +- .../operators/compound_shl_1.sol | 4 +- .../operators/compound_shr_1.sol | 4 +- .../operators/compound_sub.sol | 2 +- .../operators/compound_sub_array_index.sol | 2 +- .../operators/compound_sub_mapping.sol | 2 +- .../operators/delete_array.sol | 2 +- .../operators/delete_array_index.sol | 2 +- .../operators/delete_array_index_2d.sol | 2 +- .../operators/delete_function.sol | 2 +- .../operators/delete_multid_array.sol | 4 +- .../operators/delete_struct.sol | 22 +- .../smtCheckerTests/operators/division_1.sol | 2 +- .../smtCheckerTests/operators/division_3.sol | 2 +- .../division_truncates_correctly_1.sol | 2 +- .../division_truncates_correctly_2.sol | 2 +- .../division_truncates_correctly_3.sol | 2 +- .../division_truncates_correctly_4.sol | 2 +- .../division_truncates_correctly_5.sol | 2 +- .../operators/fixed_point_add.sol | 10 +- .../operators/fixed_point_compound_add.sol | 4 +- .../operators/index_access_for_bytes.sol | 4 +- .../smtCheckerTests/operators/mod.sol | 2 +- .../smtCheckerTests/operators/mod_even.sol | 2 +- .../smtCheckerTests/operators/mod_n.sol | 2 +- .../operators/mod_n_uint16.sol | 2 +- .../smtCheckerTests/operators/slices_1.sol | 6 +- .../smtCheckerTests/operators/unary_add.sol | 2 +- .../operators/unary_add_array.sol | 2 +- .../operators/unary_add_mapping.sol | 2 +- .../smtCheckerTests/operators/unary_sub.sol | 2 +- .../operators/unary_sub_array.sol | 2 +- .../operators/unary_sub_mapping.sol | 2 +- .../smtCheckerTests/overflow/overflow_mul.sol | 4 +- .../overflow/overflow_mul_signed.sol | 4 +- .../smtCheckerTests/overflow/overflow_sum.sol | 4 +- .../overflow/overflow_sum_signed.sol | 6 +- .../overflow/simple_overflow.sol | 2 +- .../overflow/underflow_sub.sol | 4 +- .../overflow/underflow_sub_signed.sol | 6 +- .../special/abi_decode_memory_v2.sol | 12 +- .../abi_decode_memory_v2_value_types.sol | 14 +- .../special/abi_decode_simple.sol | 24 +- .../smtCheckerTests/special/blockhash.sol | 4 +- .../smtCheckerTests/special/difficulty.sol | 2 +- .../smtCheckerTests/special/gasleft.sol | 4 +- .../smtCheckerTests/special/many.sol | 18 +- .../smtCheckerTests/special/msg_data.sol | 2 +- .../smtCheckerTests/special/msg_sender_2.sol | 2 +- .../special/msg_sender_fail_1.sol | 2 +- .../smtCheckerTests/special/msg_sig.sol | 2 +- .../smtCheckerTests/special/this.sol | 2 +- .../typecast/cast_address_1.sol | 4 +- .../typecast/cast_different_size_1.sol | 12 +- .../typecast/cast_larger_1.sol | 2 +- .../typecast/cast_larger_2.sol | 2 +- .../typecast/cast_larger_2_fail.sol | 4 +- .../typecast/cast_larger_3.sol | 6 +- .../typecast/cast_smaller_1.sol | 2 +- .../typecast/cast_smaller_2.sol | 4 +- .../typecast/cast_smaller_3.sol | 4 +- .../typecast/enum_from_uint.sol | 6 +- .../typecast/enum_to_uint_max_value.sol | 2 +- ...unction_type_to_function_type_external.sol | 2 +- ...unction_type_to_function_type_internal.sol | 20 +- .../typecast/slice_to_bytes.sol | 6 +- ...g_literal_to_fixed_bytes_function_call.sol | 4 +- ...string_literal_to_fixed_bytes_modifier.sol | 2 +- .../string_literal_to_fixed_bytes_return.sol | 2 +- ...ng_literal_to_fixed_bytes_return_multi.sol | 2 +- .../smtCheckerTests/types/address_balance.sol | 6 +- .../smtCheckerTests/types/address_call.sol | 10 +- .../types/address_delegatecall.sol | 10 +- .../types/address_staticcall.sol | 10 +- .../types/address_transfer.sol | 4 +- .../types/address_transfer_2.sol | 6 +- .../types/address_transfer_insufficient.sol | 6 +- .../types/array_aliasing_memory_1.sol | 2 +- .../types/array_aliasing_memory_2.sol | 2 +- .../types/array_aliasing_memory_3.sol | 2 +- .../types/array_aliasing_storage_1.sol | 20 +- .../types/array_aliasing_storage_2.sol | 4 +- .../types/array_aliasing_storage_3.sol | 8 +- .../types/array_aliasing_storage_4.sol | 8 +- .../types/array_aliasing_storage_5.sol | 8 +- .../smtCheckerTests/types/array_branch_1d.sol | 4 +- .../smtCheckerTests/types/array_branch_2d.sol | 2 +- .../smtCheckerTests/types/array_branch_3d.sol | 2 +- .../types/array_branches_1d.sol | 2 +- .../types/array_dynamic_1_fail.sol | 2 +- .../types/array_dynamic_2_fail.sol | 2 +- .../types/array_dynamic_3_fail.sol | 2 +- .../types/array_dynamic_parameter_1_fail.sol | 2 +- .../smtCheckerTests/types/array_literal_1.sol | 4 +- .../types/array_mapping_aliasing_1.sol | 8 +- .../types/array_mapping_aliasing_2.sol | 4 +- .../types/array_static_1_fail.sol | 2 +- .../types/array_static_2_fail.sol | 2 +- .../types/array_static_3_fail.sol | 2 +- .../types/array_static_aliasing_memory_5.sol | 4 +- .../types/array_static_aliasing_storage_5.sol | 6 +- .../types/array_static_mapping_aliasing_1.sol | 8 +- .../types/array_static_mapping_aliasing_2.sol | 4 +- .../types/array_struct_array_branches_2d.sol | 32 +- .../smtCheckerTests/types/bool_simple_1.sol | 2 +- .../smtCheckerTests/types/bool_simple_2.sol | 2 +- .../smtCheckerTests/types/bytes_1.sol | 2 +- .../smtCheckerTests/types/bytes_2_fail.sol | 2 +- .../smtCheckerTests/types/contract.sol | 2 +- .../smtCheckerTests/types/contract_2.sol | 2 +- .../types/contract_address_conversion.sol | 2 +- .../types/enum_explicit_values_2.sol | 2 +- .../types/enum_in_library_2.sol | 2 +- .../smtCheckerTests/types/enum_in_struct.sol | 14 +- .../smtCheckerTests/types/enum_storage_eq.sol | 2 +- .../smtCheckerTests/types/fixed_bytes_1.sol | 4 +- .../smtCheckerTests/types/fixed_bytes_2.sol | 2 +- .../types/function_in_tuple_1.sol | 4 +- .../types/function_in_tuple_2.sol | 4 +- .../types/function_type_arrays.sol | 2 +- .../types/function_type_call.sol | 4 +- .../types/function_type_external_address.sol | 4 +- .../types/function_type_members.sol | 10 +- .../types/function_type_nested.sol | 14 +- .../types/function_type_nested_return.sol | 16 +- .../smtCheckerTests/types/mapping_1_fail.sol | 2 +- .../smtCheckerTests/types/mapping_2.sol | 2 +- .../types/mapping_2d_1_fail.sol | 2 +- .../types/mapping_3d_1_fail.sol | 2 +- .../smtCheckerTests/types/mapping_5.sol | 2 +- .../types/mapping_aliasing_1.sol | 2 +- .../types/mapping_aliasing_2.sol | 18 +- .../types/mapping_as_local_var_1.sol | 6 +- .../types/mapping_as_parameter_1.sol | 2 +- .../types/mapping_equal_keys_2.sol | 2 +- .../types/mapping_struct_assignment.sol | 12 +- .../types/no_effect_statements.sol | 24 +- .../types/rational_large_1.sol | 2 +- .../types/storage_value_vars_1.sol | 2 +- .../types/storage_value_vars_2.sol | 2 +- .../types/storage_value_vars_4.sol | 2 +- .../smtCheckerTests/types/string_1.sol | 2 +- .../smtCheckerTests/types/string_2.sol | 2 +- .../types/string_literal_assignment_1.sol | 2 +- .../types/string_literal_assignment_2.sol | 2 +- .../types/string_literal_assignment_3.sol | 2 +- .../types/string_literal_assignment_4.sol | 2 +- .../types/string_literal_assignment_5.sol | 2 +- .../types/string_literal_comparison_1.sol | 2 +- .../types/string_literal_comparison_2.sol | 4 +- .../smtCheckerTests/types/struct_1.sol | 20 +- .../types/struct_array_branches_1d.sol | 36 +- .../types/struct_array_branches_2d.sol | 36 +- .../types/struct_array_branches_3d.sol | 34 +- .../types/tuple_assignment_array_empty.sol | 2 +- .../types/tuple_assignment_compound.sol | 2 +- .../types/tuple_assignment_empty.sol | 2 +- .../types/tuple_declarations_function_2.sol | 2 +- .../tuple_declarations_function_empty.sol | 2 +- .../smtCheckerTests/types/tuple_function.sol | 4 +- .../types/tuple_function_2.sol | 2 +- .../types/tuple_function_3.sol | 4 +- .../types/tuple_return_branch.sol | 14 +- .../types/tuple_single_element_1.sol | 2 +- .../types/tuple_single_element_2.sol | 2 +- .../types/tuple_single_non_tuple_element.sol | 2 +- .../types/type_expression_array_2d.sol | 6 +- .../types/type_expression_array_3d.sol | 8 +- .../types/type_expression_tuple_array_2d.sol | 8 +- .../types/type_expression_tuple_array_3d.sol | 10 +- .../constant_condition_1.sol | 4 +- .../constant_condition_2.sol | 4 +- .../constant_condition_3.sol | 2 +- .../verification_target/simple_assert.sol | 2 +- ...abstract_contract_because_of_interface.sol | 2 +- .../abstract_contract_instantiation.sol | 2 +- .../syntaxTests/abstract/abstract_only.sol | 4 +- .../abstract/abstract_without_contract.sol | 2 +- .../syntaxTests/abstract/interface.sol | 2 +- .../syntaxTests/abstract/library.sol | 2 +- .../abstract/unimplemented_functions.sol | 2 +- .../unimplemented_functions_inherited.sol | 2 +- .../syntaxTests/array/array_pop_arg.sol | 2 +- .../syntaxTests/array/calldata_assign.sol | 2 +- .../array/calldata_multi_dynamic_V1.sol | 4 +- .../syntaxTests/array/calldata_resize.sol | 2 +- .../array/dynamic_memory_array_pop.sol | 2 +- .../array/invalid/contract_index_access.sol | 2 +- .../array/invalid/library_index_access.sol | 2 +- .../length/abi_decode_length_too_large.sol | 2 +- ..._cannot_be_constant_function_parameter.sol | 6 +- .../array/length/bytes32_too_large.sol | 2 +- .../length/bytes32_too_large_multidim.sol | 2 +- .../array/length/cannot_be_assigned.sol | 2 +- .../length/cannot_be_assigned_mapping.sol | 2 +- .../length/cannot_be_assigned_struct.sol | 2 +- .../array/length/cannot_be_function.sol | 2 +- .../array/length/cannot_be_function_call.sol | 2 +- .../array/length/complex_cyclic_constant.sol | 2 +- .../length/const_cannot_be_fractional.sol | 2 +- .../array/length/cyclic_constant.sol | 2 +- .../fixed_size_multidim_zero_length.sol | 12 +- .../array/length/fixed_size_zero_length.sol | 12 +- .../syntaxTests/array/length/inline_array.sol | 2 +- .../array/length/invalid_expression_1.sol | 2 +- .../array/length/invalid_expression_2.sol | 2 +- .../array/length/invalid_expression_3.sol | 2 +- .../array/length/invalid_expression_4.sol | 2 +- .../array/length/invalid_expression_5.sol | 2 +- .../array/length/local_memory_too_large.sol | 8 +- .../array/length/non_integer_constant_var.sol | 2 +- .../length/not_convertible_to_integer.sol | 2 +- .../array/length/parameter_too_large.sol | 2 +- .../length/parameter_too_large_multidim.sol | 8 +- .../parameter_too_large_multidim_ABIv2.sol | 4 +- .../array/length/pure_functions.sol | 2 +- .../syntaxTests/array/length/too_large.sol | 2 +- .../syntaxTests/array/length/tuples.sol | 2 +- .../array/length/uint_too_large_multidim.sol | 2 +- .../syntaxTests/array/new_no_parentheses.sol | 2 +- .../syntaxTests/array/no_array_pop.sol | 2 +- .../syntaxTests/array/pop/calldata_pop.sol | 2 +- .../syntaxTests/array/pop/memory_pop.sol | 2 +- .../syntaxTests/array/push/calldata_push.sol | 2 +- .../syntaxTests/array/push/memory_push.sol | 2 +- .../array/slice/assign_to_storage.sol | 2 +- .../syntaxTests/array/slice/bytes_memory.sol | 2 +- .../syntaxTests/array/slice/bytes_storage.sol | 2 +- .../calldata_dynamic_convert_to_memory.sol | 2 +- .../array/slice/calldata_dynamic_forward.sol | 2 +- .../array/slice/calldata_static.sol | 2 +- .../syntaxTests/array/slice/member_access.sol | 2 +- .../array/slice/memory_dynamic.sol | 2 +- .../syntaxTests/array/slice/memory_static.sol | 2 +- .../syntaxTests/array/slice/slice_literal.sol | 2 +- .../array/slice/slice_memory_bytes.sol | 2 +- .../array/slice/slice_memory_string.sol | 2 +- .../syntaxTests/array/slice/slice_string.sol | 2 +- .../array/slice/storage_dynamic.sol | 2 +- .../array/slice/storage_static.sol | 2 +- .../array/static_storage_array_pop.sol | 2 +- .../syntaxTests/array/string_pop.sol | 2 +- .../array/uninitialized_storage_var.sol | 4 +- .../syntaxTests/bound/bound_calldata.sol | 2 +- .../syntaxTests/bound/bound_to_struct.sol | 2 +- .../syntaxTests/bytecode_too_large.sol | 2 +- .../constants/addmod_mulmod_rational.sol | 4 +- .../syntaxTests/constants/addmod_zero.sol | 6 +- .../assign_constant_function_value.sol | 2 +- .../constants/cyclic_dependency_1.sol | 2 +- .../constants/cyclic_dependency_2.sol | 6 +- .../constants/cyclic_dependency_3.sol | 8 +- .../constants/division_by_zero.sol | 4 +- .../syntaxTests/constants/mod_zero.sol | 4 +- .../syntaxTests/constants/mulmod_zero.sol | 6 +- .../constants/pure_non_rational.sol | 2 +- .../abstract_creation_forward_reference.sol | 2 +- .../constructor/constructor_no_visibility.sol | 2 +- .../constructor/constructor_old.sol | 4 +- .../constructor/constructor_override.sol | 2 +- .../constructor_state_mutability.sol | 4 +- .../constructor/constructor_virtual.sol | 2 +- .../constructor/constructor_visibility.sol | 4 +- .../constructor_without_implementation.sol | 2 +- .../constructor/external_constructor.sol | 2 +- .../function_named_constructor.sol | 2 +- .../inconstructible_internal_constructor.sol | 2 +- ...ructible_internal_constructor_inverted.sol | 2 +- .../constructor/interface_constructor.sol | 6 +- .../constructor/library_constructor.sol | 4 +- .../constructor/nonpayable_new.sol | 8 +- .../constructor/not_a_contract.sol | 2 +- .../constructor/overriding_constructor.sol | 4 +- .../constructor/returns_in_constructor.sol | 2 +- .../constructor/two_constructors.sol | 2 +- .../syntaxTests/constructor_this.sol | 4 +- .../controlFlow/leave_outside_function.sol | 2 +- .../if_declaration_err.sol | 2 +- .../assembly/for_declaration_err.sol | 9 +- .../assembly/if_declaration_err.sol | 2 +- .../reverting_function_declaration.sol | 2 +- .../assembly/switch_declaration_err.sol | 4 +- .../dowhile_declaration_err.sol | 18 +- .../dowhile_declaration_fine.sol | 2 +- .../for_declaration_err.sol | 4 +- .../if_declaration_err.sol | 4 +- .../short_circuit_declaration_err.sol | 6 +- .../ternary_assignment_err.sol | 2 +- .../ternary_declaration_err.sol | 4 +- .../try_declaration_err.sol | 8 +- .../while_declaration_err.sol | 2 +- .../controlFlow/mappingReturn/named_err.sol | 2 +- .../controlFlow/mappingReturn/unnamed_err.sol | 2 +- .../storageReturn/assembly/for_err.sol | 8 +- .../storageReturn/assembly/if_err.sol | 2 +- .../assembly/reverting_function.sol | 2 +- .../storageReturn/assembly/switch_err.sol | 4 +- .../assembly/switch_only_default_warn.sol | 2 +- .../storageReturn/assembly_err.sol | 2 +- .../controlFlow/storageReturn/dowhile_err.sol | 18 +- .../storageReturn/dowhile_fine.sol | 2 +- .../controlFlow/storageReturn/for_err.sol | 4 +- .../controlFlow/storageReturn/if_err.sol | 4 +- .../storageReturn/modifier_err.sol | 4 +- .../storageReturn/short_circuit_err.sol | 6 +- .../controlFlow/storageReturn/ternary_err.sol | 4 +- .../controlFlow/storageReturn/try_err.sol | 8 +- .../storageReturn/unimplemented_library.sol | 10 +- .../controlFlow/storageReturn/while_err.sol | 2 +- .../uninitializedAccess/always_revert.sol | 2 +- .../uninitializedAccess/assembly.sol | 2 +- .../modifier_order_fail.sol | 2 +- .../modifier_post_access.sol | 2 +- .../modifier_pre_access.sol | 2 +- .../controlFlow/uninitializedAccess/smoke.sol | 2 +- .../uninitializedAccess/struct.sol | 2 +- .../uninitializedAccess/unreachable.sol | 2 +- .../assembly/double_revert.sol | 4 +- .../unreachableCode/assembly/for_break.sol | 4 +- .../unreachableCode/assembly/for_continue.sol | 2 +- .../unreachableCode/assembly/return.sol | 4 +- .../unreachableCode/assembly/revert.sol | 4 +- .../unreachableCode/do_while_continue.sol | 2 +- .../unreachableCode/double_return.sol | 2 +- .../unreachableCode/double_revert.sol | 2 +- .../controlFlow/unreachableCode/for_break.sol | 4 +- .../unreachableCode/if_both_return.sol | 2 +- .../controlFlow/unreachableCode/revert.sol | 2 +- .../unreachableCode/revert_empty.sol | 2 +- .../unreachableCode/while_break.sol | 2 +- .../unreachableCode/while_continue.sol | 2 +- ...explicit_conversion_address_to_payable.sol | 2 +- ...icit_conversion_from_storage_array_ref.sol | 4 +- .../explicit_conversion_sender_to_payable.sol | 4 +- .../explicit_conversion_this_to_payable.sol | 2 +- .../conversion/function_cast_value_set.sol | 2 +- .../function_type_nonpayable_payable.sol | 2 +- .../function_type_nonpayable_pure.sol | 2 +- .../function_type_nonpayable_view.sol | 2 +- .../conversion/function_type_payable_pure.sol | 2 +- .../conversion/function_type_payable_view.sol | 2 +- .../conversion/function_type_pure_payable.sol | 2 +- .../conversion/function_type_view_payable.sol | 2 +- .../conversion/function_type_view_pure.sol | 2 +- .../not_allowed_conversion_from_super.sol | 2 +- .../cycle_checker_function_type.sol | 2 +- .../data_location_in_function_type_fail.sol | 2 +- ...ion_return_parameters_no_data_location.sol | 2 +- ...ocation_specifier_test_external_memory.sol | 4 +- ...cation_specifier_test_external_storage.sol | 2 +- ...tion_specifier_test_non_reference_type.sol | 2 +- ...ation_specifier_test_internal_calldata.sol | 4 +- ...l_function_parameters_no_data_location.sol | 2 +- ...ion_return_parameters_no_data_location.sol | 2 +- ...ernal_function_params_no_data_location.sol | 8 +- ...ernal_function_return_no_data_location.sol | 8 +- ...brary_function_with_data_location_fine.sol | 12 +- ...ary_internal_function_no_data_location.sol | 16 +- ...rary_private_function_no_data_location.sol | 16 +- ...brary_public_function_no_data_location.sol | 16 +- .../memory_storage_data_location.sol | 4 +- ...e_function_parameters_no_data_location.sol | 2 +- ...ion_return_parameters_no_data_location.sol | 2 +- ...ocation_specifier_test_public_calldata.sol | 4 +- ...location_specifier_test_public_storage.sol | 2 +- ...c_function_parameters_no_data_location.sol | 2 +- ...ion_return_parameters_no_data_location.sol | 2 +- ...tion_specifier_test_non_reference_type.sol | 8 +- .../combining_hex_and_denomination.sol | 2 +- .../denominations/deprecated_year.sol | 2 +- .../denominations/fixed_point_division.sol | 2 +- .../syntaxTests/deprecated_functions.sol | 4 +- .../double_stateVariable_declaration.sol | 2 +- .../double_variable_declaration.sol | 2 +- .../syntaxTests/emit/emit_empty.sol | 2 +- .../syntaxTests/emit/emit_non_event.sol | 2 +- test/libsolidity/syntaxTests/empty_struct.sol | 2 +- .../enums/global_enum_contract_name_clash.sol | 2 +- .../enums/global_enum_name_clash.sol | 2 +- .../enums/global_enum_shadowing.sol | 2 +- .../syntaxTests/events/event_nested_array.sol | 2 +- .../events/event_nested_array_in_struct.sol | 2 +- .../syntaxTests/events/event_struct.sol | 2 +- .../events/event_struct_indexed.sol | 2 +- .../syntaxTests/fallback/arguments.sol | 2 +- .../fallback/default_visibility.sol | 4 +- .../fallback/fallback_as_function_name.sol | 2 +- .../syntaxTests/fallback/old_syntax.sol | 2 +- ...able_fallback_without_receive_nonempty.sol | 2 +- ...ithout_receive_nonempty_by_inheritance.sol | 2 +- .../syntaxTests/fallback/pure_modifier.sol | 2 +- .../fallback/return_value_number.sol | 2 +- .../fallback/return_value_type.sol | 2 +- .../fallback/return_value_unsupported.sol | 2 +- .../syntaxTests/fallback/view_modifier.sol | 2 +- ...y_parameters_but_restricted_first_type.sol | 8 +- .../functionCalls/call_options_overload.sol | 2 +- .../functionCalls/calloptions_duplicated.sol | 10 +- .../calloptions_on_delegatecall.sol | 4 +- .../calloptions_on_internal_function.sol | 2 +- .../functionCalls/calloptions_repeated.sol | 16 +- .../functionCalls/int_not_callable.sol | 2 +- .../invalid_expressions_with_calloptions1.sol | 2 +- .../invalid_expressions_with_calloptions2.sol | 2 +- .../invalid_expressions_with_calloptions3.sol | 6 +- ...nctions_that_take_arbitrary_parameters.sol | 2 +- .../named_arguments_overload_failing1.sol | 2 +- .../named_arguments_overload_failing2.sol | 2 +- .../named_arguments_overload_failing3.sol | 2 +- .../new_with_calloptions_unsupported.sol | 6 +- .../new_with_invalid_calloptions.sol | 22 +- .../functionCalls/this_not_callable.sol | 2 +- .../call_value_on_non_constructor.sol | 2 +- ...all_value_on_non_payable_function_type.sol | 2 +- ...e_options_on_non_payable_function_type.sol | 2 +- .../functionTypes/conversion_to_address.sol | 2 +- .../delete_external_function_type_invalid.sol | 2 +- .../delete_function_type_invalid.sol | 2 +- ...ernal_function_type_returning_internal.sol | 2 +- ...external_function_type_taking_internal.sol | 2 +- ...ernal_function_type_to_address_payable.sol | 2 +- .../external_function_type_to_uint.sol | 2 +- .../function_type_constructor.sol | 4 +- .../function_type_constructor_local.sol | 2 +- ...function_type_internal_public_variable.sol | 2 +- ...tion_type_return_parameters_with_names.sol | 2 +- .../function_type_struct_undefined_member.sol | 2 +- ...nction_type_variable_external_internal.sol | 2 +- ...nction_types_internal_visibility_error.sol | 2 +- ...external_parameter_in_library_external.sol | 2 +- ...external_parameter_in_library_external.sol | 2 +- ...nternal_function_as_external_parameter.sol | 2 +- ...external_parameter_in_library_external.sol | 2 +- ...function_returned_from_public_function.sol | 2 +- ...external_parameter_in_library_external.sol | 2 +- .../internal_function_type_to_address.sol | 2 +- .../payable_internal_function_type.sol | 2 +- ...le_internal_function_type_is_not_fatal.sol | 2 +- .../functionTypes/private_function_type.sol | 2 +- .../functionTypes/public_function_type.sol | 2 +- .../warn_deprecate_gas_function.sol | 2 +- .../warn_deprecate_value_constructor.sol | 2 +- .../warn_deprecate_value_function.sol | 2 +- ...rn_function_type_parameters_with_names.sol | 2 +- .../syntaxTests/getter/nested_structs.sol | 2 +- .../syntaxTests/getter/recursive_struct.sol | 2 +- .../call_with_wrong_arg_count.sol | 8 +- .../callcode_with_wrong_arg_count.sol | 6 +- .../delegatecall_with_wrong_arg_count.sol | 6 +- .../keccak256_with_wrong_arg_count.sol | 6 +- .../ripemd160_with_wrong_arg_count.sol | 6 +- .../sha256_with_wrong_arg_count.sol | 6 +- .../globalFunctions/sha3_no_call.sol | 2 +- .../globalFunctions/sha3_override.sol | 2 +- .../syntaxTests/globalFunctions/sha3_var.sol | 2 +- .../globalFunctions/suicide_no_call.sol | 2 +- .../globalFunctions/suicide_override.sol | 2 +- .../globalFunctions/suicide_var.sol | 2 +- .../declaration_bitnot_tuple.sol | 2 +- .../declaration_dec_tuple.sol | 2 +- .../declaration_delete_tuple.sol | 4 +- .../declaration_inc_tuple.sol | 2 +- .../declaration_unary_tuple.sol | 18 +- .../identifier_collision_return_declare.sol | 2 +- .../large_array_in_memory_struct.sol | 2 +- .../large_array_in_memory_struct_2.sol | 2 +- .../iceRegressionTests/large_struct_array.sol | 2 +- .../memory_mapping_array.sol | 2 +- .../recursive_struct_memory.sol | 2 +- .../immutable/as_function_param.sol | 2 +- .../syntaxTests/immutable/assembly.sol | 2 +- .../conditional_return_uninitialized.sol | 2 +- .../immutable/conditionally_initialized.sol | 2 +- .../ctor_indirect_initialization.sol | 2 +- .../ctor_initialization_indirect_reading.sol | 2 +- .../immutable/ctor_initialization_reading.sol | 2 +- .../immutable/ctor_modifier_args.sol | 2 +- .../ctor_modifier_initialization.sol | 2 +- .../immutable/ctor_modifier_reading.sol | 2 +- .../syntaxTests/immutable/decrement.sol | 2 +- .../syntaxTests/immutable/delete.sol | 2 +- .../immutable/double_specifier.sol | 4 +- .../immutable/external_function_pointer.sol | 2 +- .../function_initialization_reading.sol | 2 +- .../function_pointer_initializing.sol | 4 +- .../immutable/function_pointer_reading.sol | 2 +- .../syntaxTests/immutable/increment.sol | 2 +- .../indirect_reading_during_statevar_init.sol | 2 +- .../immutable/inheritance_ctor_argument.sol | 2 +- ...e_ctor_inherit_specifier_argument_init.sol | 2 +- ...tor_inherit_specifier_argument_reading.sol | 2 +- .../inheritance_virtual_functions.sol | 2 +- ...eritance_virtual_functions_direct_call.sol | 2 +- .../inheritance_virtual_functions_super.sol | 2 +- .../inheritance_virtual_modifiers.sol | 2 +- .../immutable/inheritance_wrong_ctor.sol | 4 +- .../immutable/loop_initialized.sol | 2 +- ...multiple_inheritance_virtual_functions.sol | 2 +- ...heritance_virtual_functions_with_super.sol | 2 +- .../immutable/multiple_initializations.sol | 2 +- .../syntaxTests/immutable/non-value_type.sol | 2 +- .../immutable/private_state_var.sol | 2 +- .../reading_during_statevar_init.sol | 2 +- .../immutable/return_uninitialized.sol | 2 +- .../syntaxTests/immutable/runtimeCode.sol | 2 +- .../immutable/runtimeCodeInheritance.sol | 2 +- .../syntaxTests/immutable/selector.sol | 4 +- .../immutable/selector_function_name.sol | 4 +- .../syntaxTests/immutable/uninitialized.sol | 2 +- .../uninitialized_private_state_var.sol | 4 +- .../writing_after_initialization.sol | 4 +- .../writing_after_initialization_modifier.sol | 4 +- .../imports/filename_with_period.sol | 2 +- .../imports/import_access_struct.sol | 4 +- .../import_does_not_clutter_importee.sol | 2 +- .../inheritance_abi_encoder_mismatch_1.sol | 2 +- .../inheritance_abi_encoder_mismatch_2.sol | 2 +- .../imports/library_name_clash.sol | 2 +- .../imports/name_clash_in_import_1.sol | 2 +- .../imports/name_clash_in_import_2.sol | 2 +- .../imports/name_clash_in_import_3.sol | 2 +- .../imports/name_clash_in_import_4.sol | 2 +- ...name_clash_in_import_contract_struct_1.sol | 2 +- ...name_clash_in_import_contract_struct_2.sol | 2 +- ...name_clash_in_import_contract_struct_3.sol | 2 +- ...name_clash_in_import_contract_struct_4.sol | 2 +- .../imports/name_clash_in_import_enum.sol | 2 +- .../name_clash_in_import_enum_contract.sol | 2 +- .../name_clash_in_import_enum_struct.sol | 2 +- .../imports/name_clash_in_import_struct_1.sol | 2 +- .../imports/name_clash_in_import_struct_2.sol | 2 +- .../imports/name_clash_in_import_struct_3.sol | 2 +- .../imports/name_clash_in_import_struct_4.sol | 2 +- ...name_clash_in_import_struct_contract_1.sol | 2 +- ...name_clash_in_import_struct_contract_2.sol | 2 +- ...name_clash_in_import_struct_contract_3.sol | 2 +- ...name_clash_in_import_struct_contract_4.sol | 2 +- .../imports/shadowing_builtins_with_alias.sol | 2 +- .../shadowing_builtins_with_imports.sol | 2 +- ...adowing_builtins_with_multiple_imports.sol | 8 +- .../imports/shadowing_via_import.sol | 2 +- .../indexing/array_multidim_rational.sol | 8 +- .../indexing/array_multim_overflow_index.sol | 8 +- .../indexing/array_negative_index.sol | 2 +- .../indexing/array_noninteger_index.sol | 2 +- .../indexing/array_out_of_bounds_index.sol | 2 +- .../indexing/array_without_index.sol | 2 +- .../indexing/fixedbytes_negative_index.sol | 4 +- .../indexing/fixedbytes_noninteger_index.sol | 4 +- .../fixedbytes_out_of_bounds_index.sol | 2 +- .../indexing/fixedbytes_without_index.sol | 2 +- .../syntaxTests/indexing/function_type.sol | 2 +- .../indexing/function_type_without_index.sol | 2 +- .../struct_array_noninteger_index.sol | 2 +- .../base_arguments_empty_parentheses.sol | 2 +- .../base_arguments_multiple_inheritance.sol | 2 +- ...low_modifier_style_without_parentheses.sol | 2 +- .../duplicated_constructor_call/ancestor.sol | 2 +- .../duplicated_constructor_call/base.sol | 2 +- .../base_multi.sol | 4 +- .../base_multi_no_constructor.sol | 2 +- ...se_multi_no_constructor_modifier_style.sol | 2 +- .../fallback_overrides_receive.sol | 2 +- .../fallback_without_override.sol | 2 +- ...fallback_without_override_intermediate.sol | 2 +- .../receive_overrides_fallback.sol | 2 +- .../receive_without_override.sol | 2 +- .../receive_without_override_intermediate.sol | 2 +- .../inheritance/interface/contract_base.sol | 2 +- .../interface/implementation/partial.sol | 2 +- .../linearization/invalid/lists_a.sol | 2 +- .../linearization/invalid/lists_b.sol | 2 +- .../linearization/invalid/lists_both.sol | 2 +- .../interface/multiple_parents.sol | 2 +- .../interface/overrides_multiple.sol | 12 +- .../interface/overrides_single.sol | 2 +- .../inheritance/interface_virtual_warning.sol | 2 +- .../inheritance/override/add_view.sol | 4 +- ...biguous_base_and_unique_implementation.sol | 4 +- .../ambiguous_base_and_unique_mention.sol | 2 +- ...den_in_intermediate_base_unimplemented.sol | 6 +- .../override/calldata_memory_conflict.sol | 8 +- .../change_return_types_in_interface.sol | 4 +- .../common_base_and_unique_implementation.sol | 4 +- .../override/detect_double_override.sol | 4 +- ...ate_public_state_variable_and_function.sol | 2 +- ...ate_public_state_variable_and_function.sol | 2 +- ...tate_variable_and_function_implemented.sol | 2 +- ...iate_implemented_public_state_variable.sol | 2 +- ...ted_intermediate_public_state_variable.sol | 2 +- .../inheritance/override/function_pointer.sol | 2 +- ...t_internal_function_by_public_variable.sol | 2 +- ...nt_private_function_by_public_variable.sol | 4 +- .../override/internal_external.sol | 2 +- .../internal_external_inheritance.sol | 2 +- .../override/modifier_ambiguous_fail.sol | 2 +- ...modifier_inherited_different_signature.sol | 2 +- ...inherited_different_signature_override.sol | 2 +- ..._common_base_and_unique_implementation.sol | 4 +- ...ase_and_unique_implementation_modifier.sol | 2 +- .../override/override_ambiguous.sol | 2 +- .../override/override_empty_list.sol | 2 +- .../override/override_missing_virtual.sol | 4 +- .../override_modifier_no_override.sol | 2 +- .../override/override_multiple_duplicated.sol | 8 +- .../override/override_multiple_fail1.sol | 2 +- .../override/override_multiple_fail2.sol | 2 +- .../override/override_multiple_fail3.sol | 2 +- .../override/override_multiple_fail4.sol | 2 +- .../override/override_multiple_missing.sol | 4 +- .../override/override_multiple_no_virtual.sol | 2 +- .../override_multiple_no_virtual2.sol | 2 +- .../override/override_multiple_unresolved.sol | 2 +- .../override/override_public_vars.sol | 4 +- .../override/override_return_mismatch.sol | 2 +- .../override/override_type_mismatch.sol | 4 +- .../override/override_unimplemented_fail.sol | 4 +- .../override/private_state_variable.sol | 2 +- ...blic_var_implements_parallel_interface.sol | 4 +- .../override/public_var_missing_override.sol | 2 +- .../public_var_no_override_but_function.sol | 4 +- .../public_var_overrides_public_var.sol | 4 +- .../override/public_var_parallel_funciton.sol | 2 +- .../override/public_var_surplus_override.sol | 2 +- .../override/public_vars_multiple.sol | 2 +- .../override/public_vars_multiple1.sol | 6 +- .../override/public_vars_multiple3.sol | 2 +- .../override/public_vars_multiple5.sol | 2 +- .../override/public_vars_multiple_diamond.sol | 2 +- .../public_vars_multiple_diamond1.sol | 6 +- .../public_vars_multiple_diamond2.sol | 8 +- .../override/public_vars_wrong_override.sol | 2 +- .../inheritance/override/remove_view.sol | 4 +- .../override/state_variable_function.sol | 6 +- .../inheritance/override/triangle_impl.sol | 2 +- .../inheritance/override/virtual_private.sol | 2 +- .../inheritance/reference_non_base_ctor.sol | 2 +- .../inheritance/shadowing_base_state_vars.sol | 2 +- .../inheritance/super_on_external.sol | 2 +- .../inheritance/too_few_base_arguments.sol | 4 +- .../unimplemented_without_virtual.sol | 2 +- .../inheritance/virtual/duplicate.sol | 4 +- .../inheritance/wrong_type_base_arguments.sol | 2 +- .../assignment_from_contract.sol | 2 +- .../assignment_from_functiontype.sol | 2 +- .../assignment_from_functiontype2.sol | 2 +- .../inlineAssembly/assignment_from_super.sol | 2 +- .../inlineAssembly/assignment_location.sol | 2 +- .../inlineAssembly/assignment_to_special.sol | 12 +- .../inlineAssembly/const_from_non_const.sol | 4 +- .../inlineAssembly/const_from_this.sol | 6 +- .../constant_access_non_initialized.sol | 4 +- .../inlineAssembly/constant_array.sol | 2 +- .../inlineAssembly/constant_bytes_ref.sol | 2 +- .../function_call_invalid_argument_count.sol | 4 +- .../function_call_not_found.sol | 2 +- .../function_call_to_variable.sol | 2 +- .../inlineAssembly/function_without_call.sol | 2 +- .../syntaxTests/inlineAssembly/immutables.sol | 4 +- .../invalid/assign_to_instruction.sol | 2 +- .../invalid/bare_instructions_disallowed.sol | 2 +- .../invalid/calldata_variables.sol | 2 +- .../invalid/const_forward_reference.sol | 6 +- .../invalid/constant_assignment.sol | 2 +- .../invalid/constant_variable_via_offset.sol | 2 +- .../invalid/empty_fun_arg_beginning.sol | 2 +- .../invalid/empty_fun_arg_end.sol | 2 +- .../invalid/empty_fun_arg_middle.sol | 2 +- .../invalid/empty_function_name.sol | 2 +- .../inlineAssembly/invalid/invalid_number.sol | 2 +- .../invalid/jump_disallowed.sol | 2 +- .../invalid/label_disallowed.sol | 2 +- .../invalid/leave_items_on_tack.sol | 2 +- .../invalid/literals_on_stack_disallowed.sol | 2 +- ...local_variable_access_out_of_functions.sol | 2 +- ...le_access_out_of_functions_storage_ptr.sol | 2 +- .../invalid/missing_variable.sol | 2 +- .../invalid/missing_variable_in_assign.sol | 2 +- .../multiple_assign_to_instruction.sol | 2 +- .../invalid/nested_function_local_access.sol | 2 +- .../invalid/storage_assignment.sol | 2 +- .../storage_assignment_in_modifier.sol | 2 +- .../invalid/unbalanced_negative_stack.sol | 2 +- .../invalid/unbalanced_positive_stack.sol | 2 +- .../invalid/unbalanced_two_stack_load.sol | 2 +- .../variable_declaration_suffix_offset.sol | 8 +- .../invalid/whitespace_in_assignment.sol | 2 +- .../whitespace_in_multiple_assignment.sol | 2 +- .../inlineAssembly/istanbul_on_petersburg.sol | 8 +- .../inlineAssembly/leave_invalid.sol | 2 +- .../inlineAssembly/overloaded_reference.sol | 2 +- .../syntaxTests/inlineAssembly/pc.sol | 2 +- .../inlineAssembly/shadowing/argument.sol | 2 +- .../inlineAssembly/shadowing/constant.sol | 2 +- .../inlineAssembly/shadowing/contract.sol | 2 +- .../inlineAssembly/shadowing/function.sol | 2 +- .../shadowing/local_variable.sol | 2 +- .../shadowing/name_clash_in_import.sol | 4 +- .../shadowing/qualified_names.sol | 4 +- .../inlineAssembly/storage_reference.sol | 2 +- .../storage_reference_assignment.sol | 2 +- .../storage_reference_assignment_statevar.sol | 4 +- .../storage_reference_empty_offset.sol | 2 +- .../storage_reference_empty_slot.sol | 2 +- .../storage_reference_on_function.sol | 2 +- .../storage_reference_on_memory.sol | 4 +- .../inlineAssembly/storage_slot_assign.yul | 2 +- .../inlineAssembly/two_stack_slots.sol | 2 +- .../use_msize_with_optimizer.sol | 2 +- .../inline_arrays/dynamic_inline_array.sol | 4 +- ...ration_and_passing_implicit_conversion.sol | 2 +- ...nd_passing_implicit_conversion_strings.sol | 2 +- ...array_declaration_const_int_conversion.sol | 2 +- ...ay_declaration_const_string_conversion.sol | 2 +- .../inline_array_declaration_no_type.sol | 2 +- ...line_array_declaration_no_type_strings.sol | 2 +- .../inline_array_fixed_types.sol | 4 +- .../inline_array_of_mapping_type.sol | 2 +- .../inline_arrays/inline_array_rationals.sol | 4 +- .../invalid_types_in_inline_array.sol | 2 +- .../inline_arrays/lvalues_as_inline_array.sol | 2 +- .../unnamed_types_in_inline_array_1.sol | 2 +- .../unnamed_types_in_inline_array_2.sol | 2 +- .../syntaxTests/license/license_double.sol | 2 +- .../literalOperations/division_by_zero.sol | 2 +- .../division_by_zero_complex.sol | 2 +- .../literalOperations/exponent.sol | 4 +- .../literalOperations/mod_zero.sol | 2 +- .../literalOperations/mod_zero_complex.sol | 2 +- .../hex_string_duplicate_underscore.sol | 2 +- .../hex_string_leading_underscore.sol | 2 +- .../hex_string_misaligned_underscore.sol | 2 +- .../hex_string_trailing_underscore.sol | 2 +- .../lvalues/calldata_index_access.sol | 2 +- .../lvalues/calldata_member_access.sol | 2 +- .../lvalues/external_reference_argument.sol | 2 +- .../syntaxTests/lvalues/functions.sol | 4 +- .../syntaxTests/lvalues/library_mapping.sol | 2 +- .../contract_not_payable_send.sol | 2 +- .../contract_not_payable_transfer.sol | 2 +- .../memberLookup/failed_function_lookup.sol | 2 +- .../failed_function_lookup_in_library.sol | 2 +- .../memberLookup/member_not_unique.sol | 2 +- .../memberLookup/member_value_not_unique.sol | 2 +- ...tructs_with_mapping_array_struct_array.sol | 2 +- .../memory_structs_with_mappings.sol | 2 +- .../memberLookup/msg_value_modifier_pure.sol | 2 +- .../memberLookup/msg_value_modifier_view.sol | 2 +- .../memberLookup/push_on_memory_types.sol | 2 +- .../metaTypes/codeAccessAbstractCreation.sol | 2 +- .../metaTypes/codeAccessAbstractRuntime.sol | 2 +- .../syntaxTests/metaTypes/codeAccessBase.sol | 8 +- .../metaTypes/codeAccessCyclic.sol | 2 +- .../syntaxTests/metaTypes/codeIsNoLValue.sol | 4 +- .../syntaxTests/metaTypes/contract_min.sol | 2 +- .../syntaxTests/metaTypes/int_name.sol | 2 +- .../syntaxTests/metaTypes/integer_err.sol | 6 +- .../syntaxTests/metaTypes/integer_pure.sol | 4 +- .../syntaxTests/metaTypes/noArgForType.sol | 2 +- .../metaTypes/runtimeCodeWarningAssembly.sol | 4 +- .../metaTypes/tooManyArgsForType.sol | 2 +- .../typeNotRegularIdentifierContractName.sol | 2 +- .../typeNotRegularIdentifierFunction.sol | 2 +- .../typeNotRegularIdentifierParameter.sol | 2 +- .../typeNotRegularIdentifierStateVariable.sol | 2 +- .../typeNotRegularIdentifierVariable.sol | 2 +- .../syntaxTests/metaTypes/typeOfContract.sol | 2 +- .../syntaxTests/metaTypes/typeRecursive.sol | 4 +- .../metaTypes/unsupportedArgForType.sol | 2 +- .../missing_functions_duplicate_bug.sol | 2 +- .../syntaxTests/missing_state_variable.sol | 2 +- .../base_constructor_double_invocation.sol | 4 +- .../modifiers/constructor_as_modifier.sol | 2 +- .../constructor_call_invalid_arg_count.sol | 2 +- .../modifiers/empty_modifier_err.sol | 6 +- ...on_modifier_invocation_local_variables.sol | 2 +- .../modifiers/function_overrides_modifier.sol | 4 +- .../modifiers/illegal_modifier_override.sol | 6 +- .../invalid_function_modifier_type.sol | 2 +- .../modifiers/modifier_overrides_function.sol | 4 +- .../modifiers/modifier_returns_value.sol | 2 +- .../modifiers/modifier_without_underscore.sol | 2 +- ..._on_abstract_functions_no_parser_error.sol | 4 +- .../non-virtual_modifier_override.sol | 2 +- .../unimplemented_function_and_modifier.sol | 6 +- .../modifiers/use_in_invalid_context.sol | 2 +- .../more_than_256_declarationerrors.sol | 514 +++++++++--------- .../more_than_256_importerrors.sol | 514 +++++++++--------- .../more_than_256_syntaxerrors.sol | 514 +++++++++--------- .../multiSource/error_in_first.sol | 2 +- .../syntaxTests/multiSource/import.sol | 4 +- .../multiSource/import_not_found.sol | 2 +- .../syntaxTests/multiSource/no_import.sol | 2 +- .../syntaxTests/multiSource/one_source.sol | 2 +- .../multiSource/warning_in_both.sol | 4 +- .../differentNumberOfComponents.sol | 16 +- .../differentNumberOfComponentsFromReturn.sol | 16 +- .../disallowWildcards.sol | 18 +- .../disallowWildcardsFromReturn.sol | 20 +- .../multiVariableDeclarationEmpty.sol | 6 +- .../multiVariableDeclarationInvalidType.sol | 4 +- .../multiVariableDeclarationScoping.sol | 2 +- .../multiVariableDeclarationScoping2.sol | 6 +- ...ltiVariableDeclarationThatIsExpression.sol | 2 +- .../oneElementTuple.sol | 2 +- .../001_name_references.sol | 2 +- .../002_undeclared_name.sol | 2 +- .../003_undeclared_name_is_not_fatal.sol | 4 +- .../010_type_conversion_for_comparison.sol | 4 +- ...type_conversion_for_comparison_invalid.sol | 2 +- .../013_large_string_literal.sol | 4 +- .../nameAndTypeResolution/014_balance.sol | 4 +- .../015_balance_invalid.sol | 2 +- .../019_comparison_bitop_precedence.sol | 2 +- .../020_comparison_of_function_types_lt_1.sol | 2 +- .../021_comparison_of_function_types_lt_2.sol | 2 +- .../022_comparison_of_function_types_gt_1.sol | 2 +- .../023_comparison_of_function_types_gt_2.sol | 2 +- .../024_comparison_of_function_types_eq.sol | 4 +- .../025_comparison_of_mapping_types.sol | 2 +- .../029_create_abstract_contract.sol | 2 +- ...lemented_abstract_function_as_abstract.sol | 2 +- ...ns_with_identical_structs_in_interface.sol | 2 +- ...cts_of_non_external_types_in_interface.sol | 2 +- ...s_of_non_external_types_in_interface_2.sol | 2 +- ...non_external_types_in_interface_nested.sol | 2 +- ...045_returning_multi_dimensional_arrays.sol | 2 +- ...urning_multi_dimensional_static_arrays.sol | 2 +- ...048_returning_arrays_in_structs_arrays.sol | 2 +- ...n_external_call_not_allowed_conversion.sol | 2 +- ...nction_internal_not_allowed_conversion.sol | 2 +- .../053_hash_collision_in_interface.sol | 2 +- .../056_cyclic_inheritance.sol | 2 +- .../059_illegal_override_visibility.sol | 4 +- .../060_complex_inheritance.sol | 2 +- ...061_missing_base_constructor_arguments.sol | 2 +- ...62_base_constructor_arguments_override.sol | 2 +- ...63_implicit_derived_to_base_conversion.sol | 4 +- ...64_implicit_base_to_derived_conversion.sol | 2 +- .../065_super_excludes_current_contract.sol | 2 +- ...ion_clash_with_state_variable_accessor.sol | 2 +- ...069_base_class_state_variable_accessor.sol | 2 +- .../070_struct_accessor_one_array_only.sol | 2 +- ...e_class_state_variable_internal_member.sol | 2 +- ..._state_variable_member_of_wrong_class1.sol | 2 +- ..._state_variable_member_of_wrong_class2.sol | 2 +- .../075_fallback_function_with_arguments.sol | 2 +- .../076_fallback_function_in_library.sol | 2 +- .../076_receive_function_in_library.sol | 4 +- ...llback_function_with_return_parameters.sol | 2 +- .../078_fallback_function_twice.sol | 2 +- .../081_event_too_many_indexed.sol | 2 +- .../083_anonymous_event_too_many_indexed.sol | 2 +- .../087_double_event_declaration.sol | 2 +- ...le_event_declaration_ignores_anonymous.sol | 2 +- ...uble_event_declaration_ignores_indexed.sol | 2 +- .../091_event_function_inheritance_clash.sol | 2 +- .../092_function_event_inheritance_clash.sol | 2 +- .../093_function_event_in_contract_clash.sol | 2 +- .../097_access_to_internal_function.sol | 2 +- ...s_to_default_state_variable_visibility.sol | 2 +- .../099_access_to_internal_state_variable.sol | 2 +- .../100_error_count_in_named_args.sol | 4 +- .../101_empty_in_named_args.sol | 4 +- ...uplicate_parameter_names_in_named_args.sol | 4 +- ..._invalid_parameter_names_in_named_args.sol | 4 +- .../105_constant_input_parameter.sol | 2 +- ...ty_name_input_parameter_with_named_one.sol | 2 +- ...y_name_return_parameter_with_named_one.sol | 2 +- .../111_overflow_caused_by_ether_units.sol | 2 +- .../112_exp_operator_exponent_too_big.sol | 2 +- .../113_exp_warn_literal_base_1.sol | 2 +- .../116_shift_warn_literal_base_1.sol | 2 +- ...5_enum_member_access_accross_contracts.sol | 2 +- .../126_enum_invalid_member_access.sol | 2 +- .../127_enum_invalid_direct_member_access.sol | 2 +- ...um_implicit_conversion_is_not_okay_256.sol | 2 +- ...num_implicit_conversion_is_not_okay_64.sol | 2 +- ...32_enum_to_enum_conversion_is_not_okay.sol | 2 +- .../133_enum_duplicate_values.sol | 2 +- ...resolution_under_current_contract_name.sol | 2 +- .../135_private_visibility.sol | 2 +- ...te_visibility_via_explicit_base_access.sol | 2 +- .../137_external_visibility.sol | 2 +- .../138_similar_name_suggestions_expected.sol | 2 +- .../139_no_name_suggestion.sol | 2 +- .../140_multiple_similar_suggestions.sol | 2 +- .../141_multiple_scopes_suggestions.sol | 2 +- .../142_inheritence_suggestions.sol | 2 +- ...s_identifier_suggestions_with_submatch.sol | 2 +- ...144_no_spurious_identifier_suggestions.sol | 2 +- .../145_external_base_visibility.sol | 2 +- .../148_external_argument_delete.sol | 2 +- ..._override_function_with_bytearray_type.sol | 2 +- .../150_array_with_nonconstant_length.sol | 4 +- .../151_array_with_negative_length.sol | 4 +- .../152_array_copy_with_different_types1.sol | 2 +- .../153_array_copy_with_different_types2.sol | 2 +- ...py_with_different_types_dynamic_static.sol | 2 +- .../157_array_of_undeclared_type.sol | 2 +- ...initialization_with_incorrect_type_int.sol | 2 +- ...tialization_with_incorrect_type_string.sol | 2 +- .../160_test_byte_is_alias_of_byte1.sol | 4 +- .../164_assigning_value_to_const_variable.sol | 2 +- .../165_assigning_state_to_const_variable.sol | 2 +- ...nt_string_literal_disallows_assignment.sol | 2 +- .../171_assignment_to_const_array_vars.sol | 2 +- .../173_constant_struct.sol | 2 +- .../175_uninitialized_const_variable.sol | 2 +- ...176_overloaded_function_cannot_resolve.sol | 2 +- .../177_ambiguous_overloaded_function.sol | 2 +- ...8_assignment_of_nonoverloaded_function.sol | 2 +- .../179_assignment_of_overloaded_function.sol | 2 +- .../180_external_types_clash.sol | 2 +- .../181_override_changes_return_types.sol | 2 +- .../182_equal_overload.sol | 2 +- .../185_invalid_utf8_implicit.sol | 2 +- .../186_invalid_utf8_explicit.sol | 2 +- .../188_string_index.sol | 2 +- .../189_string_length.sol | 2 +- ...gative_integers_to_signed_out_of_bound.sol | 2 +- ...sitive_integers_to_signed_out_of_bound.sol | 2 +- .../194_negative_integers_to_unsigned.sol | 2 +- ...tive_integers_to_unsigned_out_of_bound.sol | 2 +- .../196_integer_boolean_or.sol | 2 +- .../197_integer_boolean_and.sol | 2 +- .../198_integer_boolean_not.sol | 2 +- .../199_integer_unsigned_exp_signed.sol | 2 +- .../201_integer_signed_exp_signed.sol | 6 +- .../202_bytes_reference_compare_operators.sol | 2 +- ...203_struct_reference_compare_operators.sol | 2 +- ...05_overwrite_storage_location_external.sol | 2 +- .../207_no_mappings_in_memory_array.sol | 2 +- ...signment_mem_to_local_storage_variable.sol | 2 +- ...age_assign_to_different_local_variable.sol | 2 +- .../210_uninitialized_mapping_variable.sol | 2 +- ...1_uninitialized_mapping_array_variable.sol | 2 +- .../213_no_delete_on_storage_pointers.sol | 2 +- .../215_function_argument_mem_to_storage.sol | 2 +- ...mem_array_assignment_changes_base_type.sol | 2 +- .../219_memory_arrays_not_resizeable.sol | 2 +- .../220_struct_constructor.sol | 4 +- .../221_struct_constructor_nested.sol | 4 +- .../222_struct_named_constructor.sol | 4 +- .../223_literal_strings.sol | 2 +- .../225_inheriting_from_library.sol | 2 +- .../226_inheriting_library.sol | 2 +- .../227_library_having_variables.sol | 2 +- .../229_call_to_library_function.sol | 2 +- ..._creating_contract_within_the_contract.sol | 2 +- .../231_array_out_of_bound_access.sol | 2 +- .../232_literal_string_to_storage_pointer.sol | 2 +- .../233_non_initialized_references.sol | 2 +- ...abi_encode_with_large_integer_constant.sol | 2 +- .../236_cyclic_binary_dependency.sol | 2 +- ...clic_binary_dependency_via_inheritance.sol | 2 +- .../245_tuples_empty_components.sol | 2 +- .../252_using_for_not_library.sol | 2 +- .../253_using_for_function_exists.sol | 4 +- .../254_using_for_function_on_int.sol | 2 +- .../258_using_for_mismatch.sol | 2 +- .../259_using_for_not_used.sol | 2 +- .../261_using_for_arbitrary_mismatch.sol | 2 +- .../262_bound_function_in_var.sol | 4 +- .../263_create_memory_arrays.sol | 2 +- .../264_mapping_in_memory_array.sol | 2 +- .../265_new_for_non_array.sol | 2 +- .../275_inline_struct_declaration_arrays.sol | 4 +- .../279_break_not_in_loop.sol | 2 +- .../280_continue_not_in_loop.sol | 2 +- .../281_continue_not_in_loop_2.sol | 2 +- ...erent_types_for_conditional_expression.sol | 2 +- ...nditional_expression_not_supported_yet.sol | 4 +- ...ional_expression_with_different_struct.sol | 2 +- ...xpression_with_different_function_type.sol | 2 +- ...itional_expression_with_different_enum.sol | 2 +- ...onal_expression_with_different_mapping.sol | 2 +- .../288_conditional_with_all_types.sol | 6 +- .../289_uint7_and_uintM_as_identifier.sol | 2 +- .../290_varM_disqualified_as_keyword_1.sol | 2 +- .../290_varM_disqualified_as_keyword_2.sol | 2 +- .../290_varM_disqualified_as_keyword_3.sol | 2 +- .../291_modifier_is_not_a_valid_typename.sol | 2 +- ...r_is_not_a_valid_typename_is_not_fatal.sol | 2 +- .../293_function_is_not_a_valid_typename.sol | 2 +- .../294_long_uint_variable_fails.sol | 2 +- .../295_bytes10abc_is_identifier.sol | 4 +- .../296_int10abc_is_identifier.sol | 2 +- ...97_library_functions_do_not_have_value.sol | 2 +- .../298_invalid_fixed_types_0x7_mxn.sol | 2 +- ...id_fixed_types_long_invalid_identifier.sol | 2 +- .../300_invalid_fixed_types_7x8_mxn.sol | 2 +- .../301_library_instances_cannot_be_used.sol | 4 +- .../302_invalid_fixed_type_long.sol | 2 +- .../303_fixed_type_int_conversion.sol | 2 +- ...304_fixed_type_rational_int_conversion.sol | 2 +- ...ixed_type_rational_fraction_conversion.sol | 2 +- ...lid_int_implicit_conversion_from_fixed.sol | 2 +- .../308_rational_unary_plus_operation.sol | 2 +- .../313_fixed_type_size_capabilities.sol | 4 +- .../314_fixed_type_zero_handling.sol | 2 +- ..._type_invalid_implicit_conversion_size.sol | 2 +- ..._invalid_implicit_conversion_lost_data.sol | 2 +- ..._fixed_type_valid_explicit_conversions.sol | 2 +- ...nvalid_array_declaration_with_rational.sol | 4 +- ...ray_declaration_with_signed_fixed_type.sol | 4 +- ...y_declaration_with_unsigned_fixed_type.sol | 4 +- ..._rational_to_bytes_implicit_conversion.sol | 2 +- ...322_fixed_to_bytes_implicit_conversion.sol | 2 +- .../327_rational_index_access.sol | 2 +- ...8_rational_to_fixed_literal_expression.sol | 4 +- .../329_rational_as_exponent_value_signed.sol | 2 +- ...30_rational_as_exponent_value_unsigned.sol | 2 +- .../331_rational_as_exponent_half.sol | 2 +- ...rational_as_exponent_value_neg_quarter.sol | 2 +- .../333_fixed_point_casting_exponents_15.sol | 2 +- .../334_fixed_point_casting_exponents_neg.sol | 2 +- .../338_rational_bitnot_unary_operation.sol | 2 +- .../339_rational_bitor_binary_operation.sol | 2 +- .../340_rational_bitxor_binary_operation.sol | 2 +- .../341_rational_bitand_binary_operation.sol | 2 +- .../342_missing_bool_conversion.sol | 2 +- .../343_integer_and_fixed_interaction.sol | 4 +- ...ne_divided_by_three_integer_conversion.sol | 2 +- .../346_unused_return_value_send.sol | 2 +- .../347_unused_return_value_call.sol | 2 +- .../348_unused_return_value_call_value.sol | 6 +- .../350_unused_return_value_delegatecall.sol | 2 +- .../351_callcode_deprecated.sol | 2 +- .../354_payable_in_library.sol | 2 +- .../356_payable_internal.sol | 2 +- .../357_payable_private.sol | 2 +- .../358_illegal_override_payable.sol | 4 +- ...59_illegal_override_payable_nonpayable.sol | 4 +- .../360_function_variable_mixin.sol | 2 +- .../361_calling_payable.sol | 4 +- .../362_calling_nonpayable.sol | 4 +- .../363_non_payable_constructor.sol | 2 +- .../366_invalid_array_as_statement.sol | 2 +- ...7_using_directive_for_missing_selftype.sol | 2 +- ...68_shift_constant_left_negative_rvalue.sol | 2 +- ...9_shift_constant_right_negative_rvalue.sol | 2 +- ...0_shift_constant_left_excessive_rvalue.sol | 2 +- ..._shift_constant_right_excessive_rvalue.sol | 2 +- .../372_shift_constant_right_fractional.sol | 2 +- .../396_invalid_mobile_type.sol | 4 +- ...g_value_in_non_payable_public_function.sol | 2 +- .../402_assignment_to_constant.sol | 2 +- .../406_invalid_address_checksum.sol | 2 +- .../407_invalid_address_no_checksum.sol | 2 +- .../408_invalid_address_length_short.sol | 2 +- .../409_invalid_address_length_long.sol | 2 +- ...t_convertible_to_address_as_assignment.sol | 2 +- ...convertible_to_address_as_return_value.sol | 2 +- .../412_early_exit_on_fatal_errors.sol | 4 +- .../416_interface_function_bodies.sol | 2 +- .../420_interface_variables.sol | 2 +- .../426_throw_is_deprecated.sol | 2 +- .../nameAndTypeResolution/428_bare_revert.sol | 2 +- .../430_bare_selfdestruct.sol | 2 +- .../nameAndTypeResolution/431_bare_assert.sol | 2 +- .../432_bare_require.sol | 2 +- .../433_pure_statement_in_for_loop.sol | 2 +- .../462_callable_crash.sol | 2 +- .../471_unspecified_storage_fail.sol | 4 +- ...ocation_non_array_or_struct_disallowed.sol | 2 +- ...rray_or_struct_disallowed_is_not_fatal.sol | 2 +- .../475_implicit_conversion_disallowed.sol | 2 +- ...too_large_arrays_for_calldata_external.sol | 2 +- ...too_large_arrays_for_calldata_internal.sol | 2 +- ...8_too_large_arrays_for_calldata_public.sol | 2 +- ...t_literal_to_storage_string_assignment.sol | 2 +- ...teral_to_unspecified_string_assignment.sol | 2 +- ...explicit_literal_to_unspecified_string.sol | 2 +- .../484_function_types_selector_1.sol | 2 +- .../485_function_types_selector_2.sol | 2 +- .../486_function_types_selector_3.sol | 2 +- .../491_using_this_in_constructor.sol | 2 +- .../492_do_not_crash_on_not_lvalue.sol | 2 +- .../493_builtin_keccak256_reject_gas.sol | 2 +- .../494_builtin_sha256_reject_gas.sol | 2 +- .../495_builtin_ripemd160_reject_gas.sol | 2 +- .../496_builtin_ecrecover_reject_gas.sol | 2 +- .../498_msg_gas_deprecated.sol | 2 +- .../500_gasleft_shadowing_1.sol | 2 +- .../501_gasleft_shadowing_2.sol | 2 +- .../502_builtin_keccak256_reject_value.sol | 2 +- .../503_builtin_sha256_reject_value.sol | 2 +- .../504_builtin_ripemd160_reject_value.sol | 2 +- .../505_builtin_ecrecover_reject_value.sol | 2 +- .../507_large_storage_array_simple.sol | 2 +- .../508_large_storage_arrays_combined.sol | 2 +- .../509_large_storage_arrays_struct.sol | 2 +- .../510_large_storage_array_mapping.sol | 2 +- ...function_without_implementation_public.sol | 2 +- ...nction_without_implementation_internal.sol | 2 +- ...unction_without_implementation_private.sol | 2 +- .../514_using_for_with_non_library.sol | 2 +- .../515_experimental_pragma_empty.sol | 2 +- ...rimental_pragma_unknown_number_literal.sol | 2 +- ...rimental_pragma_unknown_string_literal.sol | 2 +- ...l_pragma_unknown_quoted_string_literal.sol | 2 +- ...xperimental_pragma_empy_string_literal.sol | 2 +- ...experimental_pragma_multiple_same_line.sol | 2 +- .../521_experimental_pragma_test_warning.sol | 2 +- .../522_experimental_pragma_duplicate.sol | 4 +- .../523_reject_interface_creation.sol | 2 +- .../525_reject_interface_constructors.sol | 2 +- .../527_fallback_marked_internal.sol | 2 +- .../528_fallback_marked_private.sol | 2 +- .../529_fallback_marked_public.sol | 2 +- ...ple_invalid_literal_too_large_for_uint.sol | 2 +- ...e_invalid_literal_too_large_unassigned.sol | 2 +- ...valid_literal_too_large_for_uint_multi.sol | 2 +- ...33_tuple_invalid_literal_too_large_exp.sol | 2 +- ...e_invalid_literal_too_large_expression.sol | 2 +- .../535_address_overload_resolution.sol | 2 +- ...ength_invalid_expression_negative_bool.sol | 2 +- ...th_invalid_expression_int_divides_bool.sol | 2 +- ...th_invalid_expression_bool_divides_int.sol | 2 +- ..._invalid_expression_scientific_literal.sol | 2 +- ...th_invalid_expression_division_by_zero.sol | 2 +- ...ut_address_members_on_contract_balance.sol | 2 +- ...t_address_members_on_contract_transfer.sol | 2 +- ...about_address_members_on_contract_send.sol | 2 +- ...about_address_members_on_contract_call.sol | 2 +- ...t_address_members_on_contract_callcode.sol | 2 +- ...dress_members_on_contract_delegatecall.sol | 2 +- ...s_members_on_non_this_contract_balance.sol | 2 +- ..._members_on_non_this_contract_transfer.sol | 2 +- ...ress_members_on_non_this_contract_send.sol | 2 +- ...ress_members_on_non_this_contract_call.sol | 2 +- ..._members_on_non_this_contract_callcode.sol | 2 +- ...bers_on_non_this_contract_delegatecall.sol | 2 +- .../563_event_without_emit_deprecated.sol | 2 +- .../569_block_blockhash_deprecated.sol | 2 +- .../570_function_type_undeclared_type.sol | 2 +- ...function_type_undeclared_type_external.sol | 2 +- ...tion_type_undeclared_type_multi_nested.sol | 2 +- ...ilar_name_longer_than_80_not_suggested.sol | 2 +- ...similar_name_shorter_than_80_suggested.sol | 2 +- ...member_getter_call_without_parentheses.sol | 2 +- ...member_getter_call_without_parentheses.sol | 2 +- ...l_without_parentheses_missing_function.sol | 2 +- ...member_getter_call_without_parentheses.sol | 2 +- ...l_without_parentheses_private_function.sol | 2 +- ...ve_name_suggestion_one_and_two_letters.sol | 6 +- ..._improve_name_suggestion_three_letters.sol | 4 +- ...2_improve_name_suggestion_four_letters.sol | 12 +- ...e_packed_with_rational_number_constant.sol | 2 +- ..._decode_with_tuple_of_other_than_types.sol | 2 +- .../585_abi_decode_with_unsupported_types.sol | 2 +- .../587_event_param_type_outside_storage.sol | 6 +- .../588_interface_function_modifier.sol | 2 +- .../compoundAssignment/incomp_types.sol | 2 +- .../compoundAssignment/tuple.sol | 2 +- .../tuple_invalid_inline_array_type.sol | 2 +- .../constant_mapping.sol | 4 +- .../invalidArgs/creating_memory_array.sol | 2 +- .../invalidArgs/creating_struct.sol | 2 +- .../creating_struct_members_skipped.sol | 2 +- .../invalidArgs/explicit_conversions.sol | 4 +- .../invalidTypes/conditional_expression.sol | 12 +- .../invalidTypes/constructor_call.sol | 2 +- .../no_effect_statements.sol | 10 +- .../shadowsBuiltin/events.sol | 2 +- .../shadowsBuiltin/functions.sol | 2 +- .../shadowsBuiltin/global_scope.sol | 2 +- .../shadowsBuiltin/parameters.sol | 2 +- .../shadowsBuiltin/return_parameters.sol | 2 +- .../shadowsBuiltin/storage_variables.sol | 2 +- .../shadowsBuiltin/this_super.sol | 8 +- .../shadowsBuiltin/variables.sol | 2 +- .../typeChecking/library_instances.sol | 6 +- .../typeChecking/return.sol | 2 +- .../return_tuple_not_convertible.sol | 2 +- .../typeChecking/return_wrong_number.sol | 2 +- .../typeChecking/return_wrong_type.sol | 2 +- .../warnUnused/local.sol | 2 +- .../warnUnused/local_assignment.sol | 2 +- .../docstring_author_title_state_variable.sol | 2 +- .../natspec/docstring_empty_description.sol | 2 +- .../natspec/docstring_empty_tag.sol | 2 +- ..._non_public_state_variable_with_return.sol | 2 +- .../docstring_private_state_variable.sol | 2 +- ...ng_state_variable_too_many_return_tags.sol | 2 +- .../docstring_too_many_return_tags.sol | 2 +- .../natspec/docstring_variable.sol | 2 +- .../docstring_named_return_param_mismatch.sol | 2 +- .../natspec/invalid/docstring_parameter.sol | 4 +- .../docstring_return_size_mismatch.sol | 4 +- .../parsing/address_constant_payable.sol | 2 +- .../address_invalid_state_mutability.sol | 20 +- .../parsing/address_payable_conversion.sol | 2 +- .../address_payable_type_expression.sol | 2 +- .../parsing/address_public_payable_error.sol | 2 +- .../parsing/array_range_conversion.sol | 10 +- .../parsing/array_range_nested_invalid.sol | 8 +- .../syntaxTests/parsing/array_type_range.sol | 8 +- .../parsing/arrays_in_expressions.sol | 2 +- .../parsing/assembly_invalid_type.sol | 2 +- .../parsing/conditional_multiple.sol | 4 +- .../conditional_true_false_literal.sol | 6 +- .../parsing/conditional_with_constants.sol | 6 +- .../parsing/conditional_with_variables.sol | 6 +- .../parsing/constant_is_keyword.sol | 2 +- .../parsing/constant_state_modifier.sol | 2 +- .../declaring_fixed_and_ufixed_variables.sol | 10 +- .../declaring_fixed_literal_variables.sol | 2 +- ...ary_non_address_payable_state_variable.sol | 26 +- ...lementary_non_address_payable_argument.sol | 26 +- .../elementary_non_address_payable_local.sol | 26 +- .../elementary_non_address_payable_return.sol | 26 +- .../syntaxTests/parsing/else_if_statement.sol | 2 +- .../parsing/emit_without_event.sol | 2 +- .../syntaxTests/parsing/empty_enum.sol | 2 +- .../parsing/event_with_no_argument_list.sol | 2 +- .../syntaxTests/parsing/exp_expression.sol | 4 +- .../syntaxTests/parsing/external_variable.sol | 2 +- .../fixed_literal_with_double_radix.sol | 2 +- .../parsing/for_loop_simple_initexpr.sol | 10 +- .../parsing/for_loop_simple_noexpr.sol | 8 +- .../parsing/for_loop_single_stmt_body.sol | 4 +- .../parsing/for_loop_vardef_initexpr.sol | 10 +- ...ype_as_storage_variable_with_modifiers.sol | 2 +- .../parsing/function_type_in_expression.sol | 4 +- .../parsing/function_type_in_struct.sol | 4 +- .../syntaxTests/parsing/if_statement.sol | 4 +- .../syntaxTests/parsing/import_complex.sol | 2 +- .../parsing/import_complex_invalid_from.sol | 2 +- .../parsing/import_complex_without_from.sol | 2 +- .../syntaxTests/parsing/import_empty.sol | 2 +- .../parsing/import_invalid_token.sol | 2 +- .../syntaxTests/parsing/import_simple.sol | 2 +- .../inline_array_empty_cells_check_lvalue.sol | 2 +- ...array_empty_cells_check_without_lvalue.sol | 2 +- ..._fixed_conversion_leading_zeroes_check.sol | 2 +- ..._numbers_with_underscores_decimal_fail.sol | 8 +- ...er_numbers_with_underscores_fixed_fail.sol | 12 +- ...exer_numbers_with_underscores_hex_fail.sol | 2 +- ..._constants_with_ether_subdenominations.sol | 2 +- .../parsing/local_const_variable.sol | 2 +- .../location_specifiers_for_locals_multi.sol | 6 +- .../location_specifiers_for_params.sol | 2 +- .../location_specifiers_for_params_multi.sol | 4 +- ...ocation_specifiers_for_state_variables.sol | 2 +- ...n_specifiers_for_state_variables_multi.sol | 2 +- .../parsing/location_specifiers_with_var.sol | 2 +- .../parsing/malformed_enum_declaration.sol | 2 +- .../parsing/mapping_from_address_payable.sol | 2 +- .../parsing/mapping_nonelementary_key_1.sol | 2 +- .../parsing/mapping_nonelementary_key_2.sol | 2 +- .../parsing/mapping_nonelementary_key_3.sol | 2 +- .../parsing/mapping_nonelementary_key_4.sol | 2 +- .../missing_argument_in_named_args.sol | 2 +- .../missing_parameter_name_in_named_args.sol | 2 +- .../missing_variable_name_in_declaration.sol | 2 +- .../parsing/modifier_without_semicolon.sol | 2 +- .../multiple_event_arg_trailing_comma.sol | 2 +- ...multiple_function_param_trailing_comma.sol | 2 +- .../multiple_modifier_arg_trailing_comma.sol | 2 +- .../multiple_return_param_trailing_comma.sol | 2 +- .../multiple_statemutability_specifiers.sol | 16 +- .../parsing/new_invalid_type_name.sol | 2 +- .../parsing/overloaded_functions.sol | 4 +- .../syntaxTests/parsing/payable_accessor.sol | 2 +- .../parsing/payable_without_arguments.sol | 2 +- .../placeholder_in_function_context.sol | 2 +- .../syntaxTests/parsing/pragma_illegal.sol | 4 +- .../syntaxTests/parsing/return_var.sol | 28 +- .../single_event_arg_trailing_comma.sol | 2 +- .../single_function_param_trailing_comma.sol | 2 +- .../single_modifier_arg_trailing_comma.sol | 2 +- .../single_return_param_trailing_comma.sol | 2 +- .../parsing/trailing_comma_in_named_args.sol | 2 +- .../syntaxTests/parsing/trailing_dot1.sol | 2 +- .../syntaxTests/parsing/trailing_dot2.sol | 2 +- .../syntaxTests/parsing/trailing_dot3.sol | 2 +- .../parsing/tuples_decl_without_rhs.sol | 2 +- .../parsing/tuples_without_commas.sol | 2 +- .../parsing/two_exact_functions.sol | 2 +- .../parsing/unary_plus_expression.sol | 4 +- .../syntaxTests/parsing/var_array.sol | 2 +- .../parsing/var_in_function_arguments.sol | 28 +- .../syntaxTests/parsing/var_storage_var.sol | 2 +- .../variable_definition_in_mapping.sol | 2 +- .../parsing/visibility_specifiers.sol | 2 +- .../syntaxTests/parsing/while_loop.sol | 2 +- .../syntaxTests/pragma/invalid_pragma.sol | 2 +- .../syntaxTests/pragma/unknown_pragma.sol | 2 +- .../syntaxTests/receiveEther/arguments.sol | 2 +- .../receiveEther/default_visibility.sol | 6 +- .../syntaxTests/receiveEther/old_syntax.sol | 2 +- .../receiveEther/pure_modifier.sol | 2 +- .../receiveEther/receive_as_function_name.sol | 2 +- .../syntaxTests/receiveEther/return_value.sol | 4 +- .../receiveEther/view_modifier.sol | 2 +- .../single_return_mismatching_number.sol | 4 +- ...single_return_mismatching_number_named.sol | 4 +- .../single_return_mismatching_type.sol | 2 +- .../tuple_return_mismatching_number.sol | 6 +- .../tuple_return_mismatching_number_named.sol | 6 +- .../scoping/double_function_declaration.sol | 2 +- ...le_variable_declaration_disjoint_scope.sol | 4 +- ..._declaration_disjoint_scope_activation.sol | 4 +- ...le_declaration_same_and_disjoint_scope.sol | 4 +- ...double_variable_declaration_same_scope.sol | 2 +- .../function_state_variable_conflict.sol | 2 +- .../syntaxTests/scoping/name_shadowing.sol | 2 +- .../poly_variable_declaration_same_scope.sol | 10 +- .../syntaxTests/scoping/scoping.sol | 2 +- .../scoping/scoping_activation.sol | 2 +- .../scoping/scoping_activation_old.sol | 2 +- .../syntaxTests/scoping/scoping_for3.sol | 2 +- .../scoping/scoping_for_decl_in_body.sol | 2 +- .../syntaxTests/scoping/scoping_old.sol | 2 +- .../syntaxTests/scoping/scoping_self_use.sol | 2 +- .../state_variable_function_conflict.sol | 2 +- ...ariable_function_conflict_former_crash.sol | 4 +- test/libsolidity/syntaxTests/smoke_test.sol | 2 +- .../abi_encodePacked_structs_v2.sol | 4 +- .../specialFunctions/abi_encode_structs.sol | 8 +- .../abi_encode_structs_abiv2.sol | 6 +- .../abi_functions_member_access.sol | 10 +- .../abidecode/abi_decode_calldata.sol | 2 +- .../abidecode/abi_decode_empty.sol | 2 +- .../abi_decode_invalid_arg_count.sol | 8 +- .../abidecode/abi_decode_invalid_arg_type.sol | 4 +- .../abidecode/abi_decode_memory.sol | 2 +- .../abidecode/abi_decode_nontuple.sol | 6 +- .../abidecode/abi_decode_storage.sol | 2 +- .../encodePacked_array_of_structs.sol | 2 +- .../encodePacked_dynamic_string_array_v2.sol | 4 +- .../functionCallOptions_err.sol | 6 +- .../specialFunctions/single_non_bytes_arg.sol | 6 +- ...nspecified_encoding_internal_functions.sol | 8 +- ...ith_unspecified_encoding_special_types.sol | 10 +- ...ypes_with_unspecified_encoding_structs.sol | 4 +- .../types_with_unspecified_encoding_types.sol | 10 +- .../string_multipart_hex_valid_parts.sol | 2 +- ...g_multipart_newline_without_hex_prefix.sol | 2 +- .../string/string_multipart_only_hex.sol | 2 +- .../string/string_multipart_only_regular.sol | 2 +- .../syntaxTests/string/string_new_line.sol | 2 +- .../string/string_terminated_by_backslash.sol | 2 +- .../string/string_unterminated.sol | 2 +- .../string_unterminated_no_new_line.sol | 2 +- .../structs/address_member_access.sol | 2 +- .../structs/address_member_declaration.sol | 2 +- .../structs/calldata_array_assign.sol | 2 +- .../syntaxTests/structs/calldata_assign.sol | 2 +- .../contract_global_struct_name_clash.sol | 2 +- .../global_struct_contract_name_clash.sol | 2 +- .../structs/global_struct_shadowing.sol | 2 +- .../structs/global_structs_name_clash.sol | 2 +- .../structs/member_type_eq_name.sol | 2 +- .../syntaxTests/structs/member_type_func.sol | 2 +- .../structs/memory_to_calldata.sol | 8 +- ..._struct_as_contract_function_parameter.sol | 2 +- ...t_as_memory_library_function_parameter.sol | 2 +- .../recursive_struct_forward_reference.sol | 2 +- ...function_as_library_function_parameter.sol | 2 +- .../recursion/return_recursive_structs.sol | 2 +- .../recursion/return_recursive_structs2.sol | 2 +- .../recursion/return_recursive_structs3.sol | 2 +- .../struct_definition_directly_recursive.sol | 2 +- ...inition_directly_recursive_fixed_array.sol | 2 +- ...struct_definition_indirectly_recursive.sol | 2 +- ...efinition_indirectly_recursive_complex.sol | 2 +- ...tion_indirectly_recursive_fixed_array1.sol | 2 +- ...tion_indirectly_recursive_fixed_array2.sol | 2 +- ...tion_indirectly_recursive_fixed_array3.sol | 2 +- ...indirectly_recursive_fixed_multi_array.sol | 2 +- .../syntaxTests/structs/struct_var_member.sol | 2 +- .../syntaxTests/tight_packing_literals.sol | 2 +- .../tryCatch/almost_call_options.sol | 2 +- .../syntaxTests/tryCatch/empty_catch.sol | 2 +- .../syntaxTests/tryCatch/empty_returns.sol | 2 +- .../tryCatch/error_with_wrong_type.sol | 2 +- .../tryCatch/invalid_error_name.sol | 4 +- .../syntaxTests/tryCatch/invalid_returns.sol | 4 +- .../tryCatch/low_level_pre-byzantium.sol | 2 +- .../tryCatch/low_level_with_wrong_type.sol | 2 +- .../syntaxTests/tryCatch/no_catch.sol | 2 +- .../syntaxTests/tryCatch/no_external_call.sol | 2 +- .../tryCatch/structured_pre_byzantium.sol | 2 +- .../tryCatch/two_error_catch_clauses.sol | 2 +- .../tryCatch/two_low_level_catch_clauses.sol | 2 +- .../tupleAssignments/double_storage_crash.sol | 2 +- .../tupleAssignments/empty_tuples_lhs.sol | 22 +- .../tupleAssignments/err_fill_assignment.sol | 4 +- .../tupleAssignments/error_fill.sol | 4 +- .../tupleAssignments/tuple_in_tuple_long.sol | 10 +- .../warn_multiple_storage_storage_copies.sol | 2 +- .../address/address_binary_operators.sol | 8 +- .../address/address_constant_assignment.sol | 4 +- .../types/address/address_in_struct_fail.sol | 2 +- .../address/address_members_in_contract.sol | 2 +- .../address_nonpayable_selfdestruct.sol | 2 +- .../address_payable_external_overload.sol | 2 +- ...ress_payable_internal_overload_payable.sol | 2 +- ...ddress_payable_memory_array_conversion.sol | 4 +- .../address_payable_public_overload.sol | 2 +- ...dress_payable_storage_array_conversion.sol | 2 +- ..._payable_storage_array_conversion_fail.sol | 2 +- .../address_to_contract_implicitly.sol | 2 +- .../address_to_contract_payable_fallback.sol | 2 +- .../address/address_to_payable_address.sol | 4 +- .../address_to_payable_address_double.sol | 2 +- .../types/address/address_tuple_fail.sol | 2 +- .../address/bytes_long_to_payable_address.sol | 4 +- .../bytes_short_to_payable_address.sol | 4 +- ...ontract_no_fallback_to_payable_address.sol | 2 +- ...on_payable_fallback_to_payable_address.sol | 2 +- ...ct_payable_fallback_to_payable_address.sol | 2 +- ...fallback_to_payable_address_implicitly.sol | 4 +- ..._receive_to_payable_address_implicitly.sol | 2 +- .../contract_to_address_implicitly.sol | 2 +- ...e_address_to_contract_payable_fallback.sol | 4 +- ...nonpayable_address_to_contract_receive.sol | 2 +- .../types/array_index_too_large.sol | 2 +- .../syntaxTests/types/bool_ops.sol | 38 +- test/libsolidity/syntaxTests/types/bytes0.sol | 2 +- .../syntaxTests/types/bytes1_to_uint256.sol | 2 +- .../syntaxTests/types/bytes256.sol | 2 +- .../syntaxTests/types/bytes32_to_uint32.sol | 2 +- .../libsolidity/syntaxTests/types/bytes33.sol | 2 +- .../types/bytesXX_index_assign.sol | 2 +- .../syntaxTests/types/bytes_to_contract.sol | 2 +- .../constant_of_invalid_function_type.sol | 2 +- .../assign_function_via_base_name_to_var.sol | 4 +- ...sign_function_via_contract_name_to_var.sol | 4 +- .../members/base_contract_invalid.sol | 4 +- .../call_function_via_contract_name.sol | 6 +- .../members/call_unimplemented_base.sol | 2 +- .../function_via_contract_name_internal.sol | 2 +- .../function_via_contract_name_overloaded.sol | 2 +- .../function_via_contract_name_private.sol | 2 +- .../contractTypeType/members/modifier.sol | 2 +- .../members/modifier_base.sol | 2 +- .../syntaxTests/types/contract_to_derived.sol | 2 +- .../types/contract_to_unrelated_contract.sol | 2 +- ...c_dependency_check_on_consts_exhausted.sol | 2 +- ...c_dependency_check_on_struct_exhausted.sol | 2 +- .../decimal_literal_to_bytesXX_explicit.sol | 18 +- .../decimal_literal_to_bytesXX_implicit.sol | 18 +- .../syntaxTests/types/empty_tuple_event.sol | 2 +- .../types/empty_tuple_function.sol | 4 +- .../syntaxTests/types/empty_tuple_lvalue.sol | 6 +- .../types/empty_tuple_lvalue_array.sol | 2 +- .../syntaxTests/types/encoding_fractional.sol | 2 +- .../encoding_fractional_abiencoderv2.sol | 2 +- .../types/encoding_packed_fractional.sol | 4 +- ...ncoding_packed_fractional_abiencoderv2.sol | 4 +- .../syntaxTests/types/function_call_fail.sol | 2 +- .../syntaxTests/types/function_call_fail2.sol | 2 +- .../function_definition_expression.sol | 2 +- .../function_parameter_return_types_fail.sol | 14 +- .../function_state_mutability_fail.sol | 22 +- .../state_variable_selector_contract_name.sol | 2 +- .../state_variable_selector_not_pure.sol | 6 +- .../state_variable_selector_super.sol | 2 +- .../types/global_struct_recursive.sol | 2 +- ...ral_to_bytesXX_different_size_explicit.sol | 26 +- ...ral_to_bytesXX_different_size_implicit.sol | 26 +- .../library_function_selector_internal.sol | 2 +- ...brary_function_selector_private_inside.sol | 2 +- ...rary_function_selector_private_outside.sol | 2 +- .../types/library_to_address_payable.sol | 2 +- .../types/mapping/access_index_omitted.sol | 2 +- .../types/mapping/argument_external.sol | 2 +- .../types/mapping/argument_public.sol | 2 +- .../types/mapping/array_argument_external.sol | 2 +- .../types/mapping/array_argument_public.sol | 2 +- .../types/mapping/assignment_local_err.sol | 2 +- .../types/mapping/assignment_map.sol | 8 +- .../mapping/assignment_state_variable.sol | 8 +- .../types/mapping/assignment_struct.sol | 8 +- .../mapping/assignment_type_mismatch.sol | 2 +- .../mapping/contract_mapping_invalid.sol | 6 +- .../types/mapping/enum_mapping_invalid.sol | 4 +- .../function_type_argument_external.sol | 2 +- .../mapping/function_type_return_external.sol | 2 +- .../library_array_argument_external.sol | 2 +- .../mapping/library_array_argument_public.sol | 2 +- .../types/mapping/library_mapping.sol | 2 +- ..._data_location_function_param_external.sol | 4 +- .../mapping/mapping_array_return_external.sol | 2 +- .../mapping/mapping_array_return_public.sol | 2 +- .../mapping_data_location_calldata.sol | 2 +- .../mapping/mapping_data_location_default.sol | 2 +- ..._data_location_function_param_external.sol | 4 +- ..._data_location_function_param_internal.sol | 2 +- ...ng_data_location_function_param_public.sol | 2 +- .../mapping/mapping_data_location_memory.sol | 2 +- .../types/mapping/mapping_return_external.sol | 2 +- .../types/mapping/mapping_return_public.sol | 2 +- .../mapping/mapping_return_public_memory.sol | 2 +- .../syntaxTests/types/no_singleton_tuple.sol | 2 +- .../rational_number_array_index_limit.sol | 2 +- .../types/rational_number_bitshift_limit.sol | 8 +- .../types/rational_number_div_limit.sol | 4 +- .../types/rational_number_exp_limit_fail.sol | 52 +- .../types/rational_number_huge_fail.sol | 2 +- .../types/rational_number_literal_limit_1.sol | 2 +- .../types/rational_number_literal_limit_2.sol | 2 +- .../types/rational_number_literal_limit_3.sol | 2 +- .../types/rational_number_mul_limit.sol | 4 +- .../rational_number_signed_to_unsigned.sol | 2 +- .../types/rational_number_too_large.sol | 2 +- .../types/struct_mapping_recursion.sol | 2 +- .../types/too_small_negative_numbers.sol | 2 +- .../syntaxTests/types/uint256_to_bytes1.sol | 2 +- .../syntaxTests/types/uint32_to_bytes32.sol | 2 +- .../syntaxTests/types/unnamed_tuple_decl.sol | 6 +- .../types/var_decl_val_mismatch.sol | 2 +- .../syntaxTests/types/var_empty_decl_0.sol | 4 +- .../syntaxTests/types/var_empty_decl_1.sol | 2 +- .../syntaxTests/types/var_empty_decl_2.sol | 2 +- .../syntaxTests/types/var_empty_decl_3.sol | 2 +- .../types/var_type_invalid_rational.sol | 2 +- .../syntaxTests/types/var_type_suggest.sol | 16 +- .../syntaxTests/unicode_escape_literals.sol | 2 +- .../unimplemented_super_function.sol | 2 +- .../unimplemented_super_function_derived.sol | 2 +- .../unterminatedBlocks/one_dot.sol | 2 +- .../unterminatedBlocks/one_dot_x.sol | 2 +- .../unterminatedBlocks/zero_dot.sol | 2 +- .../unterminatedBlocks/zero_dot_x.sol | 2 +- .../syntaxTests/unusedVariables/try_catch.sol | 8 +- .../variableDeclaration/do_while.sol | 2 +- .../syntaxTests/variableDeclaration/else.sol | 2 +- .../syntaxTests/variableDeclaration/for.sol | 2 +- .../syntaxTests/variableDeclaration/if.sol | 2 +- .../syntaxTests/variableDeclaration/while.sol | 2 +- .../view_pure_abi_encode_arguments.sol | 2 +- .../access_to_base_member_function.sol | 2 +- .../access_to_base_member_struct.sol | 8 +- .../access_to_base_members.sol | 4 +- .../array/access_to_array_push_view.sol | 2 +- .../array/access_to_base_member_array.sol | 8 +- .../builtin_functions_restrict_warning.sol | 4 +- .../builtin_functions_view_fail.sol | 10 +- .../call_internal_functions_fail.sol | 4 +- ...callvalue_nonpayable_assembly_function.sol | 2 +- ..._nonpayable_assembly_function_internal.sol | 2 +- .../constant_restrict_warning.sol | 4 +- .../viewPureChecker/creation_view_fail.sol | 2 +- .../viewPureChecker/function_types_fail.sol | 6 +- .../gas_value_without_call.sol | 12 +- .../gas_with_call_nonpayable.sol | 18 +- .../syntaxTests/viewPureChecker/immutable.sol | 2 +- .../local_storage_variables_fail.sol | 4 +- .../viewPureChecker/modifiers_fail.sol | 4 +- .../viewPureChecker/msg_value_modifier.sol | 2 +- .../msg_value_modifier_view.sol | 2 +- .../viewPureChecker/overriding_fail.sol | 6 +- .../read_storage_pure_fail.sol | 2 +- .../returning_structs_fail.sol | 4 +- .../viewPureChecker/selector_complex.sol | 2 +- .../viewPureChecker/staticcall_gas_view.sol | 4 +- .../viewPureChecker/suggest_view.sol | 2 +- .../value_with_call_nonpayable.sol | 18 +- .../viewPureChecker/write_storage_fail.sol | 2 +- .../visibility/function_no_visibility.sol | 2 +- .../visibility/interface/function_default.sol | 4 +- .../interface/function_internal.sol | 2 +- .../visibility/interface/function_private.sol | 2 +- .../visibility/interface/function_public.sol | 2 +- .../interface_contract_function_default.sol | 6 +- .../visibility/library_self_delegatecall.sol | 2 +- .../libyul/yulSyntaxTests/assignment_fail.yul | 4 +- .../for_loop_condition_fail.yul | 2 +- .../for_loop_condition_fail_ewasm.yul | 2 +- test/libyul/yulSyntaxTests/invalid_type.yul | 2 +- test/libyul/yulSyntaxTests/invalid_type2.yul | 4 +- test/libyul/yulSyntaxTests/invalid_type3.yul | 4 +- test/libyul/yulSyntaxTests/invalid_type4.yul | 4 +- test/libyul/yulSyntaxTests/pc.yul | 2 +- .../yulSyntaxTests/type_check_cases_fail.yul | 4 +- .../type_check_cases_fail_evmtyped.yul | 4 +- .../type_check_if_condition_fail.yul | 2 +- .../user_defined_functions_fail.yul | 4 +- 1775 files changed, 3951 insertions(+), 3952 deletions(-) diff --git a/test/libsolidity/errorRecoveryTests/constructor_recovers.sol b/test/libsolidity/errorRecoveryTests/constructor_recovers.sol index 804bb728317c..393a638cae26 100644 --- a/test/libsolidity/errorRecoveryTests/constructor_recovers.sol +++ b/test/libsolidity/errorRecoveryTests/constructor_recovers.sol @@ -16,5 +16,5 @@ contract Error1 { } } // ---- -// ParserError: (95-96): Expected primary expression. -// Warning: (95-96): Recovered in Statement at ';'. +// ParserError 6933: (95-96): Expected primary expression. +// Warning 3347: (95-96): Recovered in Statement at ';'. diff --git a/test/libsolidity/errorRecoveryTests/contract_recovery.sol b/test/libsolidity/errorRecoveryTests/contract_recovery.sol index 4047adb314a0..980c2beaba5c 100644 --- a/test/libsolidity/errorRecoveryTests/contract_recovery.sol +++ b/test/libsolidity/errorRecoveryTests/contract_recovery.sol @@ -3,5 +3,5 @@ contract Errort6 { } // ---- -// ParserError: (36-37): Expected type name -// Warning: (59-60): Recovered in ContractDefinition at '}'. +// ParserError 3546: (36-37): Expected type name +// Warning 3796: (59-60): Recovered in ContractDefinition at '}'. diff --git a/test/libsolidity/errorRecoveryTests/do_not_delete_at_error.sol b/test/libsolidity/errorRecoveryTests/do_not_delete_at_error.sol index a7e4254b0d68..cc3c1561af13 100644 --- a/test/libsolidity/errorRecoveryTests/do_not_delete_at_error.sol +++ b/test/libsolidity/errorRecoveryTests/do_not_delete_at_error.sol @@ -10,4 +10,4 @@ contract Error2 { mapping (address => uint balances; // missing ) before "balances" } // ---- -// ParserError: (417-425): Expected ')' but got identifier +// ParserError 6635: (417-425): Expected ')' but got identifier diff --git a/test/libsolidity/errorRecoveryTests/error_to_eos.sol b/test/libsolidity/errorRecoveryTests/error_to_eos.sol index d396207b0e7b..17d51a62d374 100644 --- a/test/libsolidity/errorRecoveryTests/error_to_eos.sol +++ b/test/libsolidity/errorRecoveryTests/error_to_eos.sol @@ -17,7 +17,7 @@ contract SendCoin { } // ---- -// ParserError: (212-220): Expected ')' but got identifier -// ParserError: (220-221): Expected ';' but got ')' -// ParserError: (220-221): Function, variable, struct or modifier declaration expected. -// Warning: (235-236): Recovered in ContractDefinition at '}'. +// ParserError 6635: (212-220): Expected ')' but got identifier +// ParserError 6635: (220-221): Expected ';' but got ')' +// ParserError 9182: (220-221): Function, variable, struct or modifier declaration expected. +// Warning 3796: (235-236): Recovered in ContractDefinition at '}'. diff --git a/test/libsolidity/errorRecoveryTests/missing_rhs.sol b/test/libsolidity/errorRecoveryTests/missing_rhs.sol index 991525b4677c..6cd99f76a68c 100644 --- a/test/libsolidity/errorRecoveryTests/missing_rhs.sol +++ b/test/libsolidity/errorRecoveryTests/missing_rhs.sol @@ -7,5 +7,5 @@ contract Error3 { } // ---- -// ParserError: (95-96): Expected primary expression. -// Warning: (95-96): Recovered in Statement at ';'. +// ParserError 6933: (95-96): Expected primary expression. +// Warning 3347: (95-96): Recovered in Statement at ';'. diff --git a/test/libsolidity/errorRecoveryTests/multiple_errors.sol b/test/libsolidity/errorRecoveryTests/multiple_errors.sol index 9127ef387977..2beccac727a8 100644 --- a/test/libsolidity/errorRecoveryTests/multiple_errors.sol +++ b/test/libsolidity/errorRecoveryTests/multiple_errors.sol @@ -21,9 +21,9 @@ contract Error4 { } // ---- -// ParserError: (249-250): Expected ';' but got 'Number' -// ParserError: (471-479): Expected ';' but got identifier -// ParserError: (529-533): Expected ';' but got 'emit' -// ParserError: (577-583): Expected ',' but got 'return' -// ParserError: (577-583): Expected primary expression. -// Warning: (588-589): Recovered in Statement at ';'. +// ParserError 6635: (249-250): Expected ';' but got 'Number' +// ParserError 6635: (471-479): Expected ';' but got identifier +// ParserError 6635: (529-533): Expected ';' but got 'emit' +// ParserError 6635: (577-583): Expected ',' but got 'return' +// ParserError 6933: (577-583): Expected primary expression. +// Warning 3796: (588-589): Recovered in Statement at ';'. diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol index 68be993a897f..78693bcbb91b 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol @@ -11,10 +11,10 @@ contract C { } } // ---- -// Warning: (76-80): Assertion checker does not yet support the type of this variable. -// Warning: (83-87): Assertion checker does not yet support the type of this variable. -// Warning: (126-132): Assertion checker does not yet support this expression. -// Warning: (126-128): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (143-149): Assertion checker does not yet support this expression. -// Warning: (143-145): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (119-157): Assertion violation happens here +// Warning 8115: (76-80): Assertion checker does not yet support the type of this variable. +// Warning 8115: (83-87): Assertion checker does not yet support the type of this variable. +// Warning 7650: (126-132): Assertion checker does not yet support this expression. +// Warning 8364: (126-128): Assertion checker does not yet implement type struct C.S storage ref +// Warning 7650: (143-149): Assertion checker does not yet support this expression. +// Warning 8364: (143-145): Assertion checker does not yet implement type struct C.S storage ref +// Warning 4661: (119-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol index bb248c43e5a4..2bb5caf02251 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol @@ -11,12 +11,12 @@ contract C { } } // ---- -// Warning: (78-82): Assertion checker does not yet support the type of this variable. -// Warning: (85-89): Assertion checker does not yet support the type of this variable. -// Warning: (128-134): Assertion checker does not yet support this expression. -// Warning: (128-130): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (128-137): Assertion checker does not yet implement this expression. -// Warning: (148-154): Assertion checker does not yet support this expression. -// Warning: (148-150): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (148-157): Assertion checker does not yet implement this expression. -// Warning: (121-165): Assertion violation happens here +// Warning 8115: (78-82): Assertion checker does not yet support the type of this variable. +// Warning 8115: (85-89): Assertion checker does not yet support the type of this variable. +// Warning 7650: (128-134): Assertion checker does not yet support this expression. +// Warning 8364: (128-130): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9118: (128-137): Assertion checker does not yet implement this expression. +// Warning 7650: (148-154): Assertion checker does not yet support this expression. +// Warning 8364: (148-150): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9118: (148-157): Assertion checker does not yet implement this expression. +// Warning 4661: (121-165): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_basic.sol b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol index cd1041f7c6aa..60abe98db133 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_basic.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning: (153-176): Assertion violation happens here +// Warning 4661: (153-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol index e5356d24027c..4d4469ae85fe 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol @@ -14,6 +14,6 @@ contract C { } } // ---- -// Warning: (198-224): Assertion violation happens here -// Warning: (228-254): Assertion violation happens here -// Warning: (258-281): Assertion violation happens here +// Warning 4661: (198-224): Assertion violation happens here +// Warning 4661: (228-254): Assertion violation happens here +// Warning 4661: (258-281): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol index 92da0cf61937..afdf1a8d832c 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol @@ -16,7 +16,7 @@ contract C { } } // ---- -// Warning: (222-248): Assertion violation happens here -// Warning: (252-278): Assertion violation happens here -// Warning: (282-305): Assertion violation happens here -// Warning: (309-335): Assertion violation happens here +// Warning 4661: (222-248): Assertion violation happens here +// Warning 4661: (252-278): Assertion violation happens here +// Warning 4661: (282-305): Assertion violation happens here +// Warning 4661: (309-335): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol index e6f2273f8aad..eb752828a96f 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (82-89): Empty array "pop" detected here. +// Warning 2529: (82-89): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol index 1161ab92e5f6..2795dfe51b8e 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (111-121): Empty array "pop" detected here. +// Warning 2529: (111-121): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol index a86d1a3f350c..fc1264ddcd89 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (83-90): Empty array "pop" detected here. +// Warning 2529: (83-90): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol index 5d4241984c96..1564a2328a93 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (150-157): Empty array "pop" detected here. +// Warning 2529: (150-157): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol index d5bd19bb13f9..20adaca824c7 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// Warning: (162-177): Underflow (resulting value less than 0) happens here -// Warning: (150-184): Assertion violation happens here +// Warning 4144: (162-177): Underflow (resulting value less than 0) happens here +// Warning 4661: (150-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol index 8ad5cdcad037..113ff8fcae19 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol @@ -12,5 +12,5 @@ contract C { } } // ---- -// Warning: (217-232): Underflow (resulting value less than 0) happens here -// Warning: (205-239): Assertion violation happens here +// Warning 4144: (217-232): Underflow (resulting value less than 0) happens here +// Warning 4661: (205-239): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol index f54fc8d83f34..aa491d91cb49 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// Warning: (167-188): Assertion violation happens here +// Warning 4661: (167-188): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol index 70f8cb9fc51a..5a996d875b95 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol @@ -18,6 +18,6 @@ contract C { } } // ---- -// Warning: (193-217): Assertion violation happens here -// Warning: (309-333): Assertion violation happens here -// Warning: (419-436): Assertion violation happens here +// Warning 4661: (193-217): Assertion violation happens here +// Warning 4661: (309-333): Assertion violation happens here +// Warning 4661: (419-436): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol index 4647742dbba1..f2c30c84dc0f 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol @@ -15,13 +15,13 @@ contract C { } // ---- -// Warning: (72-75): Assertion checker does not yet support the type of this variable. -// Warning: (100-103): Assertion checker does not yet support the type of this variable. -// Warning: (130-133): Assertion checker does not yet support this expression. -// Warning: (130-131): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (130-133): Assertion checker does not yet implement this expression. -// Warning: (144-149): Assertion checker does not yet support this expression. -// Warning: (144-147): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (144-147): Assertion checker does not yet support this expression. -// Warning: (144-145): Assertion checker does not yet implement type struct C.T storage ref -// Warning: (144-149): Assertion checker does not yet implement this expression. +// Warning 8115: (72-75): Assertion checker does not yet support the type of this variable. +// Warning 8115: (100-103): Assertion checker does not yet support the type of this variable. +// Warning 7650: (130-133): Assertion checker does not yet support this expression. +// Warning 8364: (130-131): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9599: (130-133): Assertion checker does not yet implement this expression. +// Warning 7650: (144-149): Assertion checker does not yet support this expression. +// Warning 8364: (144-147): Assertion checker does not yet implement type struct C.S storage ref +// Warning 7650: (144-147): Assertion checker does not yet support this expression. +// Warning 8364: (144-145): Assertion checker does not yet implement type struct C.T storage ref +// Warning 9599: (144-149): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol index 353d328fd175..a717c8d4b238 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol @@ -16,18 +16,18 @@ contract C { } // ---- -// Warning: (72-75): Assertion checker does not yet support the type of this variable. -// Warning: (102-105): Assertion checker does not yet support the type of this variable. -// Warning: (132-135): Assertion checker does not yet support this expression. -// Warning: (132-133): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (132-135): Assertion checker does not yet implement this expression. -// Warning: (146-149): Assertion checker does not yet support this expression. -// Warning: (146-147): Assertion checker does not yet implement type struct C.T storage ref -// Warning: (146-156): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (146-149): Assertion checker does not yet implement this expression. -// Warning: (160-168): Assertion checker does not yet support this expression. -// Warning: (160-163): Assertion checker does not yet support this expression. -// Warning: (160-161): Assertion checker does not yet implement type struct C.T storage ref -// Warning: (160-166): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (160-166): Assertion checker does not yet implement this expression. -// Warning: (160-168): Assertion checker does not yet implement this expression. +// Warning 8115: (72-75): Assertion checker does not yet support the type of this variable. +// Warning 8115: (102-105): Assertion checker does not yet support the type of this variable. +// Warning 7650: (132-135): Assertion checker does not yet support this expression. +// Warning 8364: (132-133): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9599: (132-135): Assertion checker does not yet implement this expression. +// Warning 7650: (146-149): Assertion checker does not yet support this expression. +// Warning 8364: (146-147): Assertion checker does not yet implement type struct C.T storage ref +// Warning 8364: (146-156): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9599: (146-149): Assertion checker does not yet implement this expression. +// Warning 7650: (160-168): Assertion checker does not yet support this expression. +// Warning 7650: (160-163): Assertion checker does not yet support this expression. +// Warning 8364: (160-161): Assertion checker does not yet implement type struct C.T storage ref +// Warning 8364: (160-166): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9118: (160-166): Assertion checker does not yet implement this expression. +// Warning 9599: (160-168): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol index 9b9516ccd199..524baad380dd 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (111-144): Assertion violation happens here +// Warning 4661: (111-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol index 966b4e1bd154..b90b0c8726f8 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning: (94-124): Assertion violation happens here +// Warning 4661: (94-124): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol index aa69285ba289..5d6d3d3cb705 100644 --- a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol +++ b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol @@ -34,7 +34,7 @@ library MerkleProof { } // ---- -// Warning: (988-991): Assertion checker does not yet implement type abi -// Warning: (988-1032): Assertion checker does not yet implement this type of function call. -// Warning: (1175-1178): Assertion checker does not yet implement type abi -// Warning: (1175-1219): Assertion checker does not yet implement this type of function call. +// Warning 8364: (988-991): Assertion checker does not yet implement type abi +// Warning 4588: (988-1032): Assertion checker does not yet implement this type of function call. +// Warning 8364: (1175-1178): Assertion checker does not yet implement type abi +// Warning 4588: (1175-1219): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/complex/slither/const_state_variables.sol b/test/libsolidity/smtCheckerTests/complex/slither/const_state_variables.sol index a37a7e64eb3b..44808ce4c71c 100644 --- a/test/libsolidity/smtCheckerTests/complex/slither/const_state_variables.sol +++ b/test/libsolidity/smtCheckerTests/complex/slither/const_state_variables.sol @@ -51,7 +51,7 @@ contract MyConc{ } // ---- -// Warning: (773-792): This declaration shadows an existing declaration. -// Warning: (1009-1086): Function state mutability can be restricted to view -// Warning: (985-1002): Underflow (resulting value less than 0) happens here. -// Warning: (985-1002): Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 2519: (773-792): This declaration shadows an existing declaration. +// Warning 2018: (1009-1086): Function state mutability can be restricted to view +// Warning 6084: (985-1002): Underflow (resulting value less than 0) happens here. +// Warning 6084: (985-1002): Overflow (resulting value larger than 2**256 - 1) happens here. diff --git a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol index 29f15c689a1e..b75ef605ff93 100644 --- a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol +++ b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol @@ -117,23 +117,23 @@ contract PropagateThroughReturnValue { } } // ---- -// Warning: (1886-1954): Function state mutability can be restricted to view -// Warning: (318-332): Assertion checker does not yet support the type of this variable. -// Warning: (338-347): Assertion checker does not yet support the type of this variable. -// Warning: (353-378): Assertion checker does not yet support the type of this variable. -// Warning: (384-409): Assertion checker does not yet support the type of this variable. -// Warning: (464-479): Assertion checker does not yet support this expression. -// Warning: (464-475): Assertion checker does not yet implement type struct Reference.St storage ref -// Warning: (464-494): Assertion checker does not yet implement such assignments. -// Warning: (539-554): Assertion checker does not yet support this expression. -// Warning: (539-550): Assertion checker does not yet implement type struct Reference.St storage ref -// Warning: (557-567): Assertion checker does not yet support this expression. -// Warning: (557-563): Assertion checker does not yet implement type struct Reference.St storage ref -// Warning: (539-567): Assertion checker does not yet implement such assignments. -// Warning: (629-643): Assertion checker does not yet support the type of this variable. -// Warning: (646-668): Assertion checker does not yet implement type struct Reference.St storage ref -// Warning: (706-728): Assertion checker does not yet implement type struct Reference.St storage ref -// Warning: (700-728): Assertion checker does not yet implement type struct Reference.St storage pointer -// Warning: (748-755): Assertion checker does not yet support this expression. -// Warning: (748-751): Assertion checker does not yet implement type struct Reference.St storage pointer -// Warning: (748-770): Assertion checker does not yet implement such assignments. +// Warning 2018: (1886-1954): Function state mutability can be restricted to view +// Warning 8115: (318-332): Assertion checker does not yet support the type of this variable. +// Warning 8115: (338-347): Assertion checker does not yet support the type of this variable. +// Warning 8115: (353-378): Assertion checker does not yet support the type of this variable. +// Warning 8115: (384-409): Assertion checker does not yet support the type of this variable. +// Warning 7650: (464-479): Assertion checker does not yet support this expression. +// Warning 8364: (464-475): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 8182: (464-494): Assertion checker does not yet implement such assignments. +// Warning 7650: (539-554): Assertion checker does not yet support this expression. +// Warning 8364: (539-550): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 7650: (557-567): Assertion checker does not yet support this expression. +// Warning 8364: (557-563): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 8182: (539-567): Assertion checker does not yet implement such assignments. +// Warning 8115: (629-643): Assertion checker does not yet support the type of this variable. +// Warning 8364: (646-668): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 8364: (706-728): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 8364: (700-728): Assertion checker does not yet implement type struct Reference.St storage pointer +// Warning 7650: (748-755): Assertion checker does not yet support this expression. +// Warning 8364: (748-751): Assertion checker does not yet implement type struct Reference.St storage pointer +// Warning 8182: (748-770): Assertion checker does not yet implement such assignments. diff --git a/test/libsolidity/smtCheckerTests/complex/slither/external_function.sol b/test/libsolidity/smtCheckerTests/complex/slither/external_function.sol index 43bd10cf7f74..885200cf5096 100644 --- a/test/libsolidity/smtCheckerTests/complex/slither/external_function.sol +++ b/test/libsolidity/smtCheckerTests/complex/slither/external_function.sol @@ -73,17 +73,17 @@ contract InternalCall { } // ---- -// Warning: (760-815): Return value of low-level calls not used. -// Warning: (117-126): Unused local variable. -// Warning: (260-269): Unused local variable. -// Warning: (667-676): Unused local variable. -// Warning: (75-137): Function state mutability can be restricted to pure -// Warning: (218-280): Function state mutability can be restricted to pure -// Warning: (470-539): Function state mutability can be restricted to pure -// Warning: (1144-1206): Function state mutability can be restricted to pure -// Warning: (1212-1274): Function state mutability can be restricted to pure -// Warning: (1280-1342): Function state mutability can be restricted to pure -// Warning: (771-774): Assertion checker does not yet implement type abi -// Warning: (782-813): Type conversion is not yet fully supported and might yield false positives. -// Warning: (771-814): Assertion checker does not yet implement this type of function call. -// Warning: (1403-1408): Assertion checker does not yet implement this type of function call. +// Warning 9302: (760-815): Return value of low-level calls not used. +// Warning 2072: (117-126): Unused local variable. +// Warning 2072: (260-269): Unused local variable. +// Warning 2072: (667-676): Unused local variable. +// Warning 2018: (75-137): Function state mutability can be restricted to pure +// Warning 2018: (218-280): Function state mutability can be restricted to pure +// Warning 2018: (470-539): Function state mutability can be restricted to pure +// Warning 2018: (1144-1206): Function state mutability can be restricted to pure +// Warning 2018: (1212-1274): Function state mutability can be restricted to pure +// Warning 2018: (1280-1342): Function state mutability can be restricted to pure +// Warning 8364: (771-774): Assertion checker does not yet implement type abi +// Warning 5084: (782-813): Type conversion is not yet fully supported and might yield false positives. +// Warning 4588: (771-814): Assertion checker does not yet implement this type of function call. +// Warning 5729: (1403-1408): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/complex/warn_on_struct.sol b/test/libsolidity/smtCheckerTests/complex/warn_on_struct.sol index 33cf71e814ed..287e7e8f6a0c 100644 --- a/test/libsolidity/smtCheckerTests/complex/warn_on_struct.sol +++ b/test/libsolidity/smtCheckerTests/complex/warn_on_struct.sol @@ -7,8 +7,8 @@ contract C { } } // ---- -// Warning: (133-143): Unused local variable. -// Warning: (133-143): Assertion checker does not yet support the type of this variable. -// Warning: (146-147): Assertion checker does not yet implement type type(struct C.A storage pointer) -// Warning: (146-163): Assertion checker does not yet implement type struct C.A memory -// Warning: (146-163): Assertion checker does not yet implement this expression. +// Warning 2072: (133-143): Unused local variable. +// Warning 8115: (133-143): Assertion checker does not yet support the type of this variable. +// Warning 8364: (146-147): Assertion checker does not yet implement type type(struct C.A storage pointer) +// Warning 8364: (146-163): Assertion checker does not yet implement type struct C.A memory +// Warning 4639: (146-163): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/complex/warn_on_typecast.sol b/test/libsolidity/smtCheckerTests/complex/warn_on_typecast.sol index 8ecfe41e0a8e..383f907e92ed 100644 --- a/test/libsolidity/smtCheckerTests/complex/warn_on_typecast.sol +++ b/test/libsolidity/smtCheckerTests/complex/warn_on_typecast.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (106-114): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (106-114): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch.sol index 70596bf0ef2a..fc54d5a01040 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch.sol @@ -15,6 +15,6 @@ contract C } } // ---- -// Warning: (208-218): Type conversion is not yet fully supported and might yield false positives. -// Warning: (123-133): Type conversion is not yet fully supported and might yield false positives. -// Warning: (208-218): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (208-218): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (208-218): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_2.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_2.sol index fe49493f8f08..0114ab9886cc 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_2.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_2.sol @@ -20,8 +20,8 @@ contract C } } // ---- -// Warning: (271-281): Type conversion is not yet fully supported and might yield false positives. -// Warning: (123-133): Type conversion is not yet fully supported and might yield false positives. -// Warning: (271-281): Type conversion is not yet fully supported and might yield false positives. -// Warning: (186-196): Type conversion is not yet fully supported and might yield false positives. -// Warning: (271-281): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (186-196): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (271-281): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_3.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_3.sol index 9ccbbd932902..f0003590518f 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_3.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_3.sol @@ -20,8 +20,8 @@ contract C } } // ---- -// Warning: (275-285): Type conversion is not yet fully supported and might yield false positives. -// Warning: (123-133): Type conversion is not yet fully supported and might yield false positives. -// Warning: (275-285): Type conversion is not yet fully supported and might yield false positives. -// Warning: (189-199): Type conversion is not yet fully supported and might yield false positives. -// Warning: (275-285): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (189-199): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_4.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_4.sol index f0b31dbe7db2..e8f08cc3edd2 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_4.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_branch_4.sol @@ -25,7 +25,7 @@ contract C } // ---- -// Warning: (275-285): Type conversion is not yet fully supported and might yield false positives. -// Warning: (123-133): Type conversion is not yet fully supported and might yield false positives. -// Warning: (189-199): Type conversion is not yet fully supported and might yield false positives. -// Warning: (275-285): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (123-133): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (189-199): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (275-285): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_else_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_else_branch.sol index 258d95a10d6c..23ba4ff054ce 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_else_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_else_branch.sol @@ -16,6 +16,6 @@ contract C } } // ---- -// Warning: (219-229): Type conversion is not yet fully supported and might yield false positives. -// Warning: (134-144): Type conversion is not yet fully supported and might yield false positives. -// Warning: (219-229): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (219-229): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (134-144): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (219-229): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_modifier_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_modifier_branch.sol index 8bbc685cd2a2..755d44ff678d 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_modifier_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_modifier_branch.sol @@ -19,6 +19,6 @@ contract C } } // ---- -// Warning: (249-259): Type conversion is not yet fully supported and might yield false positives. -// Warning: (118-128): Type conversion is not yet fully supported and might yield false positives. -// Warning: (249-259): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (249-259): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (118-128): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (249-259): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_placeholder_inside_modifier_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_placeholder_inside_modifier_branch.sol index 43c42c94beb5..e8d22edcf2c5 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_placeholder_inside_modifier_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/function_call_inside_placeholder_inside_modifier_branch.sol @@ -20,6 +20,6 @@ contract C } } // ---- -// Warning: (247-257): Type conversion is not yet fully supported and might yield false positives. -// Warning: (162-172): Type conversion is not yet fully supported and might yield false positives. -// Warning: (247-257): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (247-257): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (162-172): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (247-257): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and.sol index 0bf30e46d568..e969e3c3d3e0 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and.sol @@ -15,4 +15,4 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol index ee2307521cb2..1e3eb573360a 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (227-236): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (227-236): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol index 290d738726c3..3bca1c268e5b 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol @@ -17,6 +17,6 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (202-218): Assertion violation happens here -// Warning: (242-252): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (202-218): Assertion violation happens here +// Warning 4661: (242-252): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both.sol index 1a4b1edf5ef6..ff526db604d3 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both.sol @@ -15,4 +15,4 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol index c3b6eb8fc140..a4d60dd4928b 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (225-235): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched.sol index e7588ed6193d..c596f4f90682 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched.sol @@ -12,8 +12,8 @@ contract C } } // ---- -// Warning: (84-110): Condition is always false. -// Warning: (121-147): Condition is always true. -// Warning: (158-183): Condition is always false. -// Warning: (194-221): Condition is always false. -// Warning: (232-247): Condition is always true. +// Warning 6838: (84-110): Condition is always false. +// Warning 6838: (121-147): Condition is always true. +// Warning 6838: (158-183): Condition is always false. +// Warning 6838: (194-221): Condition is always false. +// Warning 6838: (232-247): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched_function.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched_function.sol index 311fe9838f01..127ebfccec3c 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched_function.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_touched_function.sol @@ -16,8 +16,8 @@ contract C } } // ---- -// Warning: (156-179): Condition is always false. -// Warning: (190-213): Condition is always true. -// Warning: (224-243): Condition is always false. -// Warning: (254-277): Condition is always false. -// Warning: (288-300): Condition is always true. +// Warning 6838: (156-179): Condition is always false. +// Warning 6838: (190-213): Condition is always true. +// Warning 6838: (224-243): Condition is always false. +// Warning 6838: (254-277): Condition is always false. +// Warning 6838: (288-300): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or.sol index 55c218968e1b..d6007e6764ca 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or.sol @@ -15,4 +15,4 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol index 31abebec90d5..c9c24a2fbab2 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (225-235): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol index c699eaac2706..39d6f28cfe6d 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol @@ -24,5 +24,5 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (360-370): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (360-370): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both.sol index 323ba8f94600..c585abdb486e 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both.sol @@ -15,4 +15,4 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol index 4169717cf94c..9b26f8a1676c 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- -// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (225-235): Assertion violation happens here +// Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched.sol index 37ce5c4cb74e..e629b188cc92 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched.sol @@ -12,8 +12,8 @@ contract C } } // ---- -// Warning: (84-110): Condition is always true. -// Warning: (121-147): Condition is always true. -// Warning: (158-183): Condition is always true. -// Warning: (194-221): Condition is always true. -// Warning: (232-248): Condition is always false. +// Warning 6838: (84-110): Condition is always true. +// Warning 6838: (121-147): Condition is always true. +// Warning 6838: (158-183): Condition is always true. +// Warning 6838: (194-221): Condition is always true. +// Warning 6838: (232-248): Condition is always false. diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched_function.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched_function.sol index 5cc5a7a7a868..3ec6a53dbcd8 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched_function.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_touched_function.sol @@ -16,8 +16,8 @@ contract C } } // ---- -// Warning: (156-179): Condition is always true. -// Warning: (190-213): Condition is always true. -// Warning: (224-243): Condition is always true. -// Warning: (254-277): Condition is always true. -// Warning: (288-301): Condition is always false. +// Warning 6838: (156-179): Condition is always true. +// Warning 6838: (190-213): Condition is always true. +// Warning 6838: (224-243): Condition is always true. +// Warning 6838: (254-277): Condition is always true. +// Warning 6838: (288-301): Condition is always false. diff --git a/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol b/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol index b41027ed4630..56d4dd804a43 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/try_catch_1.sol @@ -8,5 +8,5 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// Warning: (98-121): Assertion checker does not support try/catch clauses. -// Warning: (124-159): Assertion checker does not support try/catch clauses. +// Warning 7645: (98-121): Assertion checker does not support try/catch clauses. +// Warning 7645: (124-159): Assertion checker does not support try/catch clauses. diff --git a/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol b/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol index 96de0888613c..dfe2a4428308 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/try_catch_2.sol @@ -10,5 +10,5 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// Warning: (83-85): Assertion checker does not support try/catch clauses. -// Warning: (88-122): Assertion checker does not support try/catch clauses. +// Warning 7645: (83-85): Assertion checker does not support try/catch clauses. +// Warning 7645: (88-122): Assertion checker does not support try/catch clauses. diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol index 16d6fdfef57d..6d5f7eaf499c 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (159-173): Assertion violation happens here +// Warning 4661: (159-173): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol index e25ab20f76dc..951e168f8af7 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (159-173): Assertion violation happens here +// Warning 4661: (159-173): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol index 03ae7216df41..b197c543277d 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (161-175): Assertion violation happens here +// Warning 4661: (161-175): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/abi_encode_functions.sol b/test/libsolidity/smtCheckerTests/functions/abi_encode_functions.sol index fc34426fc9fe..d03cd4bb5fb0 100644 --- a/test/libsolidity/smtCheckerTests/functions/abi_encode_functions.sol +++ b/test/libsolidity/smtCheckerTests/functions/abi_encode_functions.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// Warning: (162-165): Assertion checker does not yet implement type abi -// Warning: (162-176): Assertion checker does not yet implement this type of function call. -// Warning: (178-181): Assertion checker does not yet implement type abi -// Warning: (178-203): Assertion checker does not yet implement this type of function call. +// Warning 8364: (162-165): Assertion checker does not yet implement type abi +// Warning 4588: (162-176): Assertion checker does not yet implement this type of function call. +// Warning 8364: (178-181): Assertion checker does not yet implement type abi +// Warning 4588: (178-203): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol index 9a772b27ecd0..1521f833dcf4 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol @@ -13,4 +13,4 @@ contract A is C { } } // ---- -// Warning: (166-180): Assertion violation happens here +// Warning 4661: (166-180): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol index b5a3f36d8fb9..7efa68b94967 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol @@ -4,4 +4,4 @@ contract A is C { constructor() C(2) public { assert(a == 2); } } contract B is C { constructor() C(3) public { assert(a == 3); } } contract J is C { constructor() C(3) public { assert(a == 4); } } // ---- -// Warning: (271-285): Assertion violation happens here +// Warning 4661: (271-285): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol index f6e32d10a8a1..638b29f5e077 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol @@ -19,6 +19,6 @@ contract A is B { } } // ---- -// Warning: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (265-270): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (253-271): Assertion violation happens here +// Warning 2661: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (265-270): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (253-271): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol index 69a7f5ec9b47..aa964a10237c 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol @@ -18,6 +18,6 @@ contract A is B { } } // ---- -// Warning: (221-226): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (212-217): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (251-256): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (221-226): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (212-217): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (251-256): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol index 79f0c03dc02c..1427498c407a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol @@ -25,7 +25,7 @@ contract A is B2, B1 { } } // ---- -// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (330-348): Assertion violation happens here +// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (330-348): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol index d33247a0e346..18505a24eb49 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol @@ -25,7 +25,7 @@ contract A is B2, B1 { } } // ---- -// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (330-348): Assertion violation happens here +// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (330-348): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol index b5428d15b44e..caa4e67e2740 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol @@ -27,11 +27,11 @@ contract A is B2, B1 { } } // ---- -// Warning: (174-179): Underflow (resulting value less than 0) happens here -// Warning: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (362-378): Assertion violation happens here +// Warning 4144: (174-179): Underflow (resulting value less than 0) happens here +// Warning 2661: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (362-378): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol index 7819019e9b2a..b9e6232e2e49 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol @@ -19,5 +19,5 @@ contract A is B, B2 { } } // ---- -// Warning: (171-177): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (208-222): Assertion violation happens here +// Warning 5667: (171-177): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (208-222): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol index 2c7d8827d44f..7e4a1a28fa77 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol @@ -18,5 +18,5 @@ contract A is B { } } // ---- -// Warning: (201-207): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (238-252): Assertion violation happens here +// Warning 5667: (201-207): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (238-252): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol index fbd3436dc8db..3e2d932e7e4f 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol @@ -16,5 +16,5 @@ contract A is B { } } // ---- -// Warning: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (186-200): Assertion violation happens here +// Warning 5667: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (186-200): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol index 8b94c53a96a3..ffcc13c99f31 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol @@ -15,5 +15,5 @@ contract A is B { } } // ---- -// Warning: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (164-178): Assertion violation happens here +// Warning 5667: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (164-178): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol index ec534a431615..189297364f07 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol @@ -26,5 +26,5 @@ contract A is B { } } // ---- -// Warning: (275-281): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (312-326): Assertion violation happens here +// Warning 5667: (275-281): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (312-326): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol index eaa7c5dc4d1c..6f3e1e55fe93 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol @@ -31,5 +31,5 @@ contract A is B { } } // ---- -// Warning: (317-323): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (385-400): Assertion violation happens here +// Warning 5667: (317-323): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (385-400): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol index b6363f8efaf0..179c9bc7b73a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol @@ -25,6 +25,6 @@ contract A is B { } } // ---- -// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (356-370): Assertion violation happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (356-370): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol index 835949ada6e5..6bbc33d1e894 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol @@ -23,5 +23,5 @@ contract B is C { contract A is B { } // ---- -// Warning: (287-301): Assertion violation happens here -// Warning: (287-301): Assertion violation happens here +// Warning 4661: (287-301): Assertion violation happens here +// Warning 4661: (287-301): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol index 3feff4dae7bf..d0aa94920471 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol @@ -14,4 +14,4 @@ contract A is C { } } // ---- -// Warning: (202-216): Assertion violation happens here +// Warning 4661: (202-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol index c4dbe02191bc..572c04aa842b 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol @@ -13,5 +13,5 @@ contract A is C { } } // ---- -// Warning: (148-162): Assertion violation happens here -// Warning: (166-182): Assertion violation happens here +// Warning 4661: (148-162): Assertion violation happens here +// Warning 4661: (166-182): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol index b4f68e33a857..5503f66abf66 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning: (148-162): Assertion violation happens here +// Warning 4661: (148-162): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol index 1df298f13b0c..b238a0c1bc14 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning: (152-166): Assertion violation happens here +// Warning 4661: (152-166): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol index e7349e044340..27b3c8b30571 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol @@ -15,4 +15,4 @@ contract C is B { } } // ---- -// Warning: (172-186): Assertion violation happens here +// Warning 4661: (172-186): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol index 214eb1cd6aef..80e633f6aa83 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// Warning: (169-183): Assertion violation happens here -// Warning: (122-127): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (169-183): Assertion violation happens here +// Warning 2661: (122-127): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_this.sol b/test/libsolidity/smtCheckerTests/functions/constructor_this.sol index 0a308a16659c..591cd8245469 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_this.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_this.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (204-208): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. -// Warning: (223-227): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (204-208): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (223-227): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol b/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol index 9044cf99a07e..f91a6b6634dd 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (116-132): Assertion violation happens here -// Warning: (116-132): Assertion violation happens here +// Warning 4661: (116-132): Assertion violation happens here +// Warning 4661: (116-132): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol index 9ea612aa3ccd..6848b9ae7dc7 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning: (209-223): Assertion violation happens here +// Warning 4661: (209-223): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol index e5f312e93a98..5c1fd38564a4 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol @@ -24,5 +24,5 @@ contract C } // ---- -// Warning: (209-223): Assertion violation happens here -// Warning: (321-335): Assertion violation happens here +// Warning 4661: (209-223): Assertion violation happens here +// Warning 4661: (321-335): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol index 99c785d08ed5..64bbcddbc7fd 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol @@ -18,4 +18,4 @@ contract C } } // ---- -// Warning: (261-277): Assertion violation happens here +// Warning 4661: (261-277): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol index 4f1a64783ee9..cce33f8a6174 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol @@ -17,4 +17,4 @@ contract C } } // ---- -// Warning: (257-271): Assertion violation happens here +// Warning 4661: (257-271): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol index a0c59c0b7230..8da1b5e169aa 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol @@ -17,4 +17,4 @@ contract C } } // ---- -// Warning: (297-321): Assertion violation happens here +// Warning 4661: (297-321): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol index 0f4de76f6b9a..15f1f6001185 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol @@ -18,4 +18,4 @@ contract C } } // ---- -// Warning: (355-379): Assertion violation happens here +// Warning 4661: (355-379): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol index e200d42e924d..02813f1d7adf 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol @@ -16,4 +16,4 @@ contract D } } // ---- -// Warning: (191-206): Assertion violation happens here +// Warning 4661: (191-206): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol index a70aaf61d3c1..6bdc8a0e88c9 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol @@ -12,4 +12,4 @@ contract C } // ---- -// Warning: (161-174): Assertion violation happens here +// Warning 4661: (161-174): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol index 9baeb935176b..95e06b4c392a 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol @@ -16,4 +16,4 @@ contract C } // ---- -// Warning: (229-242): Assertion violation happens here +// Warning 4661: (229-242): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol index e3c805947719..b057accde265 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol @@ -12,4 +12,4 @@ contract C } // ---- -// Warning: (163-176): Assertion violation happens here +// Warning 4661: (163-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol index 85387017b402..04a66621991f 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol @@ -17,4 +17,4 @@ contract C } } // ---- -// Warning: (228-229): Assertion checker does not yet implement type type(library L) +// Warning 8364: (228-229): Assertion checker does not yet implement type type(library L) diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol index 5eda70213bba..7182890f3474 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol @@ -17,5 +17,5 @@ contract C } } // ---- -// Warning: (228-229): Assertion checker does not yet implement type type(library L) -// Warning: (245-261): Assertion violation happens here +// Warning 8364: (228-229): Assertion checker does not yet implement type type(library L) +// Warning 4661: (245-261): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol index ad7357684cba..d63f583a0eac 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol @@ -13,4 +13,4 @@ contract C } // ---- -// Warning: (144-157): Assertion violation happens here +// Warning 4661: (144-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol index 5d972f966a66..84319b4adb17 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol @@ -14,4 +14,4 @@ contract C } // ---- -// Warning: (152-165): Assertion violation happens here +// Warning 4661: (152-165): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol index a93245f023c3..ff2c68ef5256 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol @@ -5,4 +5,4 @@ contract C function f(bool x) public pure { require(x); for (;x;) {} } } // ---- -// Warning: (98-99): Condition is always true. +// Warning 6838: (98-99): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_if.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_if.sol index 364fe8d173b8..619b0d5f825b 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_if.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_if.sol @@ -4,4 +4,4 @@ contract C function f(bool x) public pure { require(x); if (x) {} } } // ---- -// Warning: (95-96): Condition is always true. +// Warning 6838: (95-96): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require.sol index e76badf2d6af..86dfba66dbdd 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require.sol @@ -5,4 +5,4 @@ contract C function f(bool x) public pure { x = true; require(x); } } // ---- -// Warning: (98-99): Condition is always true. +// Warning 6838: (98-99): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol index 607da9e7ebf7..3ba28289d448 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol @@ -5,4 +5,4 @@ contract C function f(bool x) public pure { require(x); while (x) {} } } // ---- -// Warning: (99-100): Condition is always true. +// Warning 6838: (99-100): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol index 5332dc59061a..c395525a3bf0 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol @@ -17,4 +17,4 @@ contract A is B { } } // ---- -// Warning: (254-268): Assertion violation happens here +// Warning 4661: (254-268): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol index 262f0e498be9..af7d6d28fdcf 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol @@ -21,4 +21,4 @@ contract A is B { } } // ---- -// Warning: (274-288): Assertion violation happens here +// Warning 4661: (274-288): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol index 285bfb15d763..3439ec6d43a7 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_state_var_init_2.sol @@ -7,6 +7,6 @@ contract c { bool b = (f() > 0) || (f() > 0); } // ---- -// Warning: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (100-105): Underflow (resulting value less than 0) happens here -// Warning: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (100-105): Underflow (resulting value less than 0) happens here +// Warning 2661: (100-105): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol index e17e384ddc7e..3ea4f4c467a3 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol @@ -20,6 +20,6 @@ contract C{ } } // ---- -// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (245-248): Underflow (resulting value less than 0) happens here +// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (245-248): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol index 3f765ecd29f0..d433912551b8 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol @@ -20,13 +20,13 @@ contract C{ } } // ---- -// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (145-159): Assertion violation happens here -// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (227-241): Assertion violation happens here -// Warning: (252-266): Assertion violation happens here -// Warning: (177-191): Assertion violation happens here -// Warning: (227-241): Assertion violation happens here -// Warning: (245-248): Underflow (resulting value less than 0) happens here -// Warning: (252-266): Assertion violation happens here -// Warning: (89-103): Assertion violation happens here +// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (145-159): Assertion violation happens here +// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (227-241): Assertion violation happens here +// Warning 4661: (252-266): Assertion violation happens here +// Warning 4661: (177-191): Assertion violation happens here +// Warning 4661: (227-241): Assertion violation happens here +// Warning 4144: (245-248): Underflow (resulting value less than 0) happens here +// Warning 4661: (252-266): Assertion violation happens here +// Warning 4661: (89-103): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol index 0d2a3c79476f..ec3b88ed53fe 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol @@ -17,5 +17,5 @@ contract C is A { } } // ---- -// Warning: (100-103): Underflow (resulting value less than 0) happens here -// Warning: (100-103): Underflow (resulting value less than 0) happens here +// Warning 4144: (100-103): Underflow (resulting value less than 0) happens here +// Warning 4144: (100-103): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol index da8dec6a204b..1e239016452e 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol @@ -17,10 +17,10 @@ contract C is A { } } // ---- -// Warning: (82-96): Assertion violation happens here -// Warning: (100-103): Underflow (resulting value less than 0) happens here -// Warning: (82-96): Assertion violation happens here -// Warning: (100-103): Underflow (resulting value less than 0) happens here -// Warning: (155-169): Assertion violation happens here -// Warning: (82-96): Assertion violation happens here -// Warning: (187-201): Assertion violation happens here +// Warning 4661: (82-96): Assertion violation happens here +// Warning 4144: (100-103): Underflow (resulting value less than 0) happens here +// Warning 4661: (82-96): Assertion violation happens here +// Warning 4144: (100-103): Underflow (resulting value less than 0) happens here +// Warning 4661: (155-169): Assertion violation happens here +// Warning 4661: (82-96): Assertion violation happens here +// Warning 4661: (187-201): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol index b052f5070870..338a91cd7554 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol @@ -20,8 +20,8 @@ contract C{ } } // ---- -// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (241-244): Underflow (resulting value less than 0) happens here +// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (241-244): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol index cb50a931e699..509bf241d1ec 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol @@ -20,11 +20,11 @@ contract C{ } } // ---- -// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (145-159): Assertion violation happens here -// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (191-205): Assertion violation happens here -// Warning: (241-244): Underflow (resulting value less than 0) happens here -// Warning: (89-103): Assertion violation happens here +// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (145-159): Assertion violation happens here +// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (191-205): Assertion violation happens here +// Warning 4144: (241-244): Underflow (resulting value less than 0) happens here +// Warning 4661: (89-103): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol b/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol index 5e69f7830b2d..c621041dd7f3 100644 --- a/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol +++ b/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol @@ -14,5 +14,5 @@ library L { } // ---- -// Warning: (131-190): Function state mutability can be restricted to pure -// Warning: (86-87): Assertion checker does not yet implement type type(library L) +// Warning 2018: (131-190): Function state mutability can be restricted to pure +// Warning 8364: (86-87): Assertion checker does not yet implement type type(library L) diff --git a/test/libsolidity/smtCheckerTests/functions/library_constant.sol b/test/libsolidity/smtCheckerTests/functions/library_constant.sol index e32b8565b29b..98518ee0b9dd 100644 --- a/test/libsolidity/smtCheckerTests/functions/library_constant.sol +++ b/test/libsolidity/smtCheckerTests/functions/library_constant.sol @@ -19,8 +19,8 @@ contract C { } } // ---- -// Warning: (136-155): Assertion violation happens here -// Warning: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (300-302): Assertion checker does not yet implement type type(library l1) -// Warning: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (327-332): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (136-155): Assertion violation happens here +// Warning 2661: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 8364: (300-302): Assertion checker does not yet implement type type(library l1) +// Warning 2661: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (327-332): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/recursive_multi_return_2.sol b/test/libsolidity/smtCheckerTests/functions/recursive_multi_return_2.sol index 00f78df3cc6c..cb4773841d24 100644 --- a/test/libsolidity/smtCheckerTests/functions/recursive_multi_return_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/recursive_multi_return_2.sol @@ -23,5 +23,5 @@ a; } } // ---- -// Warning: (72-90): Statement has no effect. -// Warning: (96-107): Statement has no effect. +// Warning 6133: (72-90): Statement has no effect. +// Warning 6133: (96-107): Statement has no effect. diff --git a/test/libsolidity/smtCheckerTests/functions/this_fake.sol b/test/libsolidity/smtCheckerTests/functions/this_fake.sol index 3a7511a5472a..057c95fb9110 100644 --- a/test/libsolidity/smtCheckerTests/functions/this_fake.sol +++ b/test/libsolidity/smtCheckerTests/functions/this_fake.sol @@ -20,5 +20,5 @@ contract C } } // ---- -// Warning: (160-166): This declaration shadows a builtin symbol. -// Warning: (268-282): Assertion violation happens here +// Warning 2319: (160-166): This declaration shadows a builtin symbol. +// Warning 4661: (268-282): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol index b6363f8efaf0..179c9bc7b73a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol @@ -25,6 +25,6 @@ contract A is B { } } // ---- -// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (356-370): Assertion violation happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (356-370): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol index bef807b811cc..ec6c995e57be 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning: (104-118): Assertion violation happens here +// Warning 4661: (104-118): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol index 179b2c6c6e0d..8112ddb59e5f 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol @@ -11,4 +11,4 @@ contract D is C { } } // ---- -// Warning: (124-138): Assertion violation happens here +// Warning 4661: (124-138): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol index e43d9e73a1a0..c7b42c04377c 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol @@ -19,4 +19,4 @@ contract D is C { } } // ---- -// Warning: (232-246): Assertion violation happens here +// Warning 4661: (232-246): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol index ee1b098a52d8..820829a9e3b9 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol @@ -18,4 +18,4 @@ contract D is C { } } // ---- -// Warning: (199-213): Assertion violation happens here +// Warning 4661: (199-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol index 7be0676d2c72..c75e003b233a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol @@ -22,12 +22,12 @@ contract A is B { } // ---- -// Warning: (171-176): Underflow (resulting value less than 0) happens here -// Warning: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (230-235): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (260-265): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (282-287): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (282-291): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (308-313): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (296-314): Assertion violation happens here +// Warning 4144: (171-176): Underflow (resulting value less than 0) happens here +// Warning 2661: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (230-235): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (260-265): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (282-287): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (282-291): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (308-313): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (296-314): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol index ff316ce477e9..cac1394468ee 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol @@ -22,10 +22,10 @@ contract A is B { } // ---- -// Warning: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (231-236): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (283-289): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (306-311): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (294-312): Assertion violation happens here +// Warning 2661: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (231-236): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (283-289): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (306-311): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (294-312): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol index 65fddfe52ebe..066651f7234d 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol @@ -17,4 +17,4 @@ contract D is B, C { } } // ---- -// Warning: (169-183): Assertion violation happens here +// Warning 4661: (169-183): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol index 5a28788c45e7..1b5563c69094 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol @@ -19,4 +19,4 @@ contract D is B, C { } } // ---- -// Warning: (235-249): Assertion violation happens here +// Warning 4661: (235-249): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/fallback.sol b/test/libsolidity/smtCheckerTests/inheritance/fallback.sol index c1319be2880c..76d1722d520d 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/fallback.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/fallback.sol @@ -21,7 +21,7 @@ contract B is A { } } // ---- -// Warning: (122-136): Assertion violation happens here -// Warning: (171-185): Assertion violation happens here -// Warning: (288-302): Assertion violation happens here -// Warning: (171-185): Assertion violation happens here +// Warning 4661: (122-136): Assertion violation happens here +// Warning 4661: (171-185): Assertion violation happens here +// Warning 4661: (288-302): Assertion violation happens here +// Warning 4661: (171-185): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol b/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol index 4a78ac268460..cda56f068f2a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol @@ -21,8 +21,8 @@ contract B is A { } } // ---- -// Warning: (114-128): Assertion violation happens here -// Warning: (163-177): Assertion violation happens here -// Warning: (289-303): Assertion violation happens here -// Warning: (114-128): Assertion violation happens here -// Warning: (163-177): Assertion violation happens here +// Warning 4661: (114-128): Assertion violation happens here +// Warning 4661: (163-177): Assertion violation happens here +// Warning 4661: (289-303): Assertion violation happens here +// Warning 4661: (114-128): Assertion violation happens here +// Warning 4661: (163-177): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol index 0a11df6c42a7..cbfac8b9340c 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol @@ -19,7 +19,7 @@ contract B is A { } } // ---- -// Warning: (121-135): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here -// Warning: (276-290): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here +// Warning 4661: (121-135): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here +// Warning 4661: (276-290): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol index d462e7c9a0b1..a18adee825ff 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol @@ -21,7 +21,7 @@ contract B is A { } } // ---- -// Warning: (121-135): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here -// Warning: (286-300): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here +// Warning 4661: (121-135): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here +// Warning 4661: (286-300): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol index a2d1d9f3e240..3137dd18f7ad 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol @@ -36,12 +36,12 @@ contract C is B { } } // ---- -// Warning: (121-135): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here -// Warning: (296-310): Assertion violation happens here -// Warning: (345-359): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here -// Warning: (468-482): Assertion violation happens here -// Warning: (517-531): Assertion violation happens here -// Warning: (345-359): Assertion violation happens here -// Warning: (170-184): Assertion violation happens here +// Warning 4661: (121-135): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here +// Warning 4661: (296-310): Assertion violation happens here +// Warning 4661: (345-359): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here +// Warning 4661: (468-482): Assertion violation happens here +// Warning 4661: (517-531): Assertion violation happens here +// Warning 4661: (345-359): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/receive.sol b/test/libsolidity/smtCheckerTests/inheritance/receive.sol index 8372db502e04..88f50081d2eb 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/receive.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/receive.sol @@ -21,7 +21,7 @@ contract B is A { } } // ---- -// Warning: (128-142): Assertion violation happens here -// Warning: (177-191): Assertion violation happens here -// Warning: (300-314): Assertion violation happens here -// Warning: (177-191): Assertion violation happens here +// Warning 4661: (128-142): Assertion violation happens here +// Warning 4661: (177-191): Assertion violation happens here +// Warning 4661: (300-314): Assertion violation happens here +// Warning 4661: (177-191): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol b/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol index 277912227850..f93e47abe631 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol @@ -21,8 +21,8 @@ contract B is A { } } // ---- -// Warning: (120-134): Assertion violation happens here -// Warning: (169-183): Assertion violation happens here -// Warning: (288-302): Assertion violation happens here -// Warning: (120-134): Assertion violation happens here -// Warning: (169-183): Assertion violation happens here +// Warning 4661: (120-134): Assertion violation happens here +// Warning 4661: (169-183): Assertion violation happens here +// Warning 4661: (288-302): Assertion violation happens here +// Warning 4661: (120-134): Assertion violation happens here +// Warning 4661: (169-183): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inline_assembly/empty.sol b/test/libsolidity/smtCheckerTests/inline_assembly/empty.sol index bb221e58b84c..607c27bc3f27 100644 --- a/test/libsolidity/smtCheckerTests/inline_assembly/empty.sol +++ b/test/libsolidity/smtCheckerTests/inline_assembly/empty.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (76-90): Assertion checker does not support inline assembly. +// Warning 7737: (76-90): Assertion checker does not support inline assembly. diff --git a/test/libsolidity/smtCheckerTests/inline_assembly/local_var.sol b/test/libsolidity/smtCheckerTests/inline_assembly/local_var.sol index 888f7ef16286..d452ca474af6 100644 --- a/test/libsolidity/smtCheckerTests/inline_assembly/local_var.sol +++ b/test/libsolidity/smtCheckerTests/inline_assembly/local_var.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (97-121): Assertion checker does not support inline assembly. +// Warning 7737: (97-121): Assertion checker does not support inline assembly. diff --git a/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol b/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol index 99711368933a..d2f492233043 100644 --- a/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol @@ -31,4 +31,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (311-324): Assertion violation happens here +// Warning 4661: (311-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol index ebf023e27c13..f44013b5371c 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol @@ -14,5 +14,5 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (150-155): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (179-193): Assertion violation happens here +// Warning 2661: (150-155): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (179-193): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol b/test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol index f46a3f5a422c..55f7975f0eb0 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol @@ -16,4 +16,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (150-155): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (150-155): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break.sol index 0c870972dabe..c4b1ee8c458a 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break.sol @@ -13,5 +13,5 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (104-109): Unreachable code. -// Warning: (122-128): Unreachable code. +// Warning 5740: (104-109): Unreachable code. +// Warning 5740: (122-128): Unreachable code. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break_2.sol index a209c480778e..2e471d001abb 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break_2.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break_2.sol @@ -17,5 +17,5 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (128-133): Unreachable code. -// Warning: (147-151): Unreachable code. +// Warning 5740: (128-133): Unreachable code. +// Warning 5740: (147-151): Unreachable code. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol index 90f4d3cf84ea..2a80acd6bf56 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol @@ -17,6 +17,6 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (128-133): Unreachable code. -// Warning: (147-151): Unreachable code. -// Warning: (180-194): Assertion violation happens here +// Warning 5740: (128-133): Unreachable code. +// Warning 5740: (147-151): Unreachable code. +// Warning 4661: (180-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol index fa23aafd2cf0..3427a32aa2b0 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol @@ -13,6 +13,6 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (104-109): Unreachable code. -// Warning: (122-128): Unreachable code. -// Warning: (133-147): Assertion violation happens here +// Warning 5740: (104-109): Unreachable code. +// Warning 5740: (122-128): Unreachable code. +// Warning 4661: (133-147): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_continue.sol b/test/libsolidity/smtCheckerTests/loops/do_while_continue.sol index 88c38ebda956..f6e7126800d4 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_continue.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_continue.sol @@ -13,4 +13,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (107-112): Unreachable code. +// Warning 5740: (107-112): Unreachable code. diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol index 2422cc177a4f..4c4aef38132d 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol @@ -17,4 +17,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (201-216): Assertion violation happens here +// Warning 4661: (201-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol index 4b97a7ea0b4e..53e0e4ff53e7 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol @@ -13,5 +13,5 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (66-72): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (142-156): Assertion violation happens here +// Warning 5667: (66-72): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (142-156): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol index 11c08b7688ed..7d8692f6191b 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol @@ -14,5 +14,5 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (189-203): Assertion violation happens here +// Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (189-203): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol index c37df70c41db..b05b47f53529 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_break_direct.sol b/test/libsolidity/smtCheckerTests/loops/for_break_direct.sol index df99d17aff0b..42bb84e51a2e 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_break_direct.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_break_direct.sol @@ -11,4 +11,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (102-105): Unreachable code. +// Warning 5740: (102-105): Unreachable code. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol index c242a5800e82..7030704d85df 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol @@ -9,4 +9,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (136-150): Assertion violation happens here +// Warning 4661: (136-150): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol index 066a3e76d4cc..edef7a326d9b 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol @@ -11,4 +11,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (167-181): Assertion violation happens here +// Warning 4661: (167-181): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol index 0694493f52c7..61136c817204 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol @@ -15,6 +15,6 @@ contract LoopFor2 { } } // ---- -// Warning: (281-301): Assertion violation happens here -// Warning: (305-324): Assertion violation happens here -// Warning: (328-347): Assertion violation happens here +// Warning 4661: (281-301): Assertion violation happens here +// Warning 4661: (305-324): Assertion violation happens here +// Warning 4661: (328-347): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol index 82a91bf75638..e66672c1522b 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol @@ -19,5 +19,5 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning: (274-294): Assertion violation happens here -// Warning: (321-340): Assertion violation happens here +// Warning 4661: (274-294): Assertion violation happens here +// Warning 4661: (321-340): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol index 2466e1efd28c..7b6ca1e68fd1 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol @@ -19,4 +19,4 @@ contract LoopFor2 { } } // ---- -// Warning: (363-382): Assertion violation happens here +// Warning 4661: (363-382): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index a90053024d47..0796baa78bec 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,5 +19,5 @@ contract LoopFor2 { } } // ---- -// Warning: (341-360): Assertion violation happens here -// Warning: (364-383): Assertion violation happens here +// Warning 4661: (341-360): Assertion violation happens here +// Warning 4661: (364-383): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol index 321da4e4abc2..2f74a8993446 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol @@ -9,4 +9,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (122-128): Condition is always true. +// Warning 6838: (122-128): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol index 2bca54b24deb..ccf65cb2977f 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol @@ -12,4 +12,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (138-144): Condition is always true. +// Warning 6838: (138-144): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_3.sol index 433e003c1f23..57993a00fa14 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_3.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_3.sol @@ -16,4 +16,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (115-121): Unused local variable. +// Warning 2072: (115-121): Unused local variable. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol index 563e7cb1615a..632d7ecac206 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol @@ -9,4 +9,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (122-127): Condition is always false. +// Warning 6838: (122-127): Condition is always false. diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol index 1e8157ceeab3..3803ea4cd90f 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol @@ -18,4 +18,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (218-233): Assertion violation happens here +// Warning 4661: (218-233): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol index 06b6eba2e06c..b1d8cb99f1fd 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol @@ -20,5 +20,5 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (169-176): Unreachable code. -// Warning: (227-242): Assertion violation happens here +// Warning 5740: (169-176): Unreachable code. +// Warning 4661: (227-242): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol index 793907bdd61c..c108d4ce64ad 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol @@ -13,4 +13,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (139-153): Assertion violation happens here +// Warning 4661: (139-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_2_break.sol b/test/libsolidity/smtCheckerTests/loops/while_2_break.sol index 680b42be04db..98de2d868a97 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_2_break.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_2_break.sol @@ -15,4 +15,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (128-131): Unreachable code. +// Warning 5740: (128-131): Unreachable code. diff --git a/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol index 78cac6021c31..4736ede49bb6 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol @@ -14,5 +14,5 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (120-123): Unreachable code. -// Warning: (131-145): Assertion violation happens here +// Warning 5740: (120-123): Unreachable code. +// Warning 4661: (131-145): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol b/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol index 0ed591599a8b..58d4c6f0ae94 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol @@ -12,4 +12,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (98-104): Condition is always true. +// Warning 6838: (98-104): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol index 92a8a8be7aa4..b267ed373a56 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol @@ -19,6 +19,6 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning: (281-301): Assertion violation happens here -// Warning: (305-324): Assertion violation happens here -// Warning: (328-347): Assertion violation happens here +// Warning 4661: (281-301): Assertion violation happens here +// Warning 4661: (305-324): Assertion violation happens here +// Warning 4661: (328-347): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol index c4669b1ba131..20e1359b9f94 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol @@ -23,5 +23,5 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning: (362-382): Assertion violation happens here -// Warning: (409-428): Assertion violation happens here +// Warning 4661: (362-382): Assertion violation happens here +// Warning 4661: (409-428): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol index 96f171054f78..b64a43b9ae75 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol @@ -21,5 +21,5 @@ contract LoopFor2 { } } // ---- -// Warning: (320-339): Assertion violation happens here -// Warning: (343-362): Assertion violation happens here +// Warning 4661: (320-339): Assertion violation happens here +// Warning 4661: (343-362): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol index 3caaf138820a..29da40e6d6e8 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol @@ -12,4 +12,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (194-208): Assertion violation happens here +// Warning 4661: (194-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol index 7476d2853994..cb06bf44adc8 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol @@ -10,4 +10,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (187-201): Assertion violation happens here +// Warning 4661: (187-201): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol index e022e0f299ba..492a54839289 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol @@ -12,4 +12,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning: (224-238): Assertion violation happens here +// Warning 4661: (224-238): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol index 986e7205b764..96bf7c534120 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol @@ -29,5 +29,5 @@ contract C } } // ---- -// Warning: (329-344): Assertion violation happens here -// Warning: (380-395): Assertion violation happens here +// Warning 4661: (329-344): Assertion violation happens here +// Warning 4661: (380-395): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol index 71238c3be6e5..d9d6bacfc05e 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol @@ -27,5 +27,5 @@ contract C } } // ---- -// Warning: (323-338): Assertion violation happens here -// Warning: (362-377): Assertion violation happens here +// Warning 4661: (323-338): Assertion violation happens here +// Warning 4661: (362-377): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol index 702c24f4b612..2633789a342d 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol @@ -21,5 +21,5 @@ contract C } } // ---- -// Warning: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (136-149): Assertion violation happens here +// Warning 2661: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (136-149): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol index 7a8d9264d69e..3ee3933fe822 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (144-157): Assertion violation happens here +// Warning 4661: (144-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inline_function_inside_branch.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inline_function_inside_branch.sol index 7871a8a8c3e4..bb46594fe86e 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inline_function_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inline_function_inside_branch.sol @@ -17,5 +17,5 @@ contract C } } // ---- -// Warning: (205-215): Type conversion is not yet fully supported and might yield false positives. -// Warning: (205-215): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (205-215): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (205-215): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol index 089cfffe3136..d31b515653a4 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol @@ -20,4 +20,4 @@ contract C { } } // ---- -// Warning: (287-300): Assertion violation happens here +// Warning 4661: (287-300): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_branch.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_branch.sol index eb56bfdd51ef..82a2c67e942a 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_branch.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_branch.sol @@ -24,4 +24,4 @@ contract C { } } // ---- -// Warning: (266-271): Condition is always true. +// Warning 6838: (266-271): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol index 387047bb716f..214dbd5f5985 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol @@ -32,4 +32,4 @@ contract C { } } // ---- -// Warning: (461-475): Assertion violation happens here +// Warning 4661: (461-475): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol index 241a367eaef1..d7134c2e9916 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol @@ -26,4 +26,4 @@ contract C } } // ---- -// Warning: (170-183): Assertion violation happens here +// Warning 4661: (170-183): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol index 0ad3ed2383fa..3315656decae 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol @@ -22,4 +22,4 @@ contract C } } // ---- -// Warning: (311-324): Assertion violation happens here +// Warning 4661: (311-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol index ec6ce47de998..bf5c6201dacd 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol @@ -13,4 +13,4 @@ contract C } } // ---- -// Warning: (164-177): Assertion violation happens here +// Warning 4661: (164-177): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_overflow.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_overflow.sol index 60b35e59dfa6..2b5f131d754c 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_overflow.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_overflow.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (145-150): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (145-150): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol index b91d2ee51608..0546c4ac9420 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (128-142): Assertion violation happens here +// Warning 4661: (128-142): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol index 7c43a311d8e0..39927e3454af 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (121-135): Assertion violation happens here +// Warning 4661: (121-135): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol index 65b07f8811a8..fba4d2a2cc63 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol @@ -23,4 +23,4 @@ contract C } } // ---- -// Warning: (156-170): Assertion violation happens here +// Warning 4661: (156-170): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol index 579702632a6a..9a14cd2431f1 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol @@ -15,4 +15,4 @@ contract C { } } // ---- -// Warning: (104-122): Assertion violation happens here +// Warning 4661: (104-122): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol index 4efdafdeb75f..3171240c0528 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (76-94): Assertion violation happens here +// Warning 4661: (76-94): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol index ce8400dbeb62..0f70434a026d 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol @@ -13,6 +13,6 @@ contract C { } } // ---- -// Warning: (107-125): Assertion violation happens here -// Warning: (180-203): Assertion violation happens here -// Warning: (207-230): Assertion violation happens here +// Warning 4661: (107-125): Assertion violation happens here +// Warning 4661: (180-203): Assertion violation happens here +// Warning 4661: (207-230): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add.sol b/test/libsolidity/smtCheckerTests/operators/compound_add.sol index fcbd7edc7d3f..c031ea6a0d32 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (151-166): Assertion violation happens here +// Warning 4661: (151-166): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol index c4acd3842b6b..4d63e46bf1d8 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (192-214): Assertion violation happens here +// Warning 4661: (192-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol index eab7df2f0b32..70903e8ef39d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (198-218): Assertion violation happens here +// Warning 4661: (198-218): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol index e3a8ea1fb75c..b19d038d36fa 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol @@ -9,6 +9,6 @@ contract C { } } // ---- -// Warning: (129-143): Error trying to invoke SMT solver. -// Warning: (147-161): Error trying to invoke SMT solver. -// Warning: (147-161): Assertion violation happens here +// Warning 1218: (129-143): Error trying to invoke SMT solver. +// Warning 1218: (147-161): Error trying to invoke SMT solver. +// Warning 4661: (147-161): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol index 83bd7cb6b0ae..427703366529 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol @@ -10,6 +10,6 @@ contract C { } } // ---- -// Warning: (163-184): Error trying to invoke SMT solver. -// Warning: (188-209): Error trying to invoke SMT solver. -// Warning: (188-209): Assertion violation happens here +// Warning 1218: (163-184): Error trying to invoke SMT solver. +// Warning 1218: (188-209): Error trying to invoke SMT solver. +// Warning 4661: (188-209): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol index b941a5767c40..da3b81254752 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol @@ -10,6 +10,6 @@ contract C { } } // ---- -// Warning: (171-190): Error trying to invoke SMT solver. -// Warning: (194-213): Error trying to invoke SMT solver. -// Warning: (194-213): Assertion violation happens here +// Warning 1218: (171-190): Error trying to invoke SMT solver. +// Warning 1218: (194-213): Error trying to invoke SMT solver. +// Warning 4661: (194-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol index 2e35014e6e8f..b2fba57692f4 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning: (116-130): Assertion violation happens here +// Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. +// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol index e9d65408899b..a17f2f466efc 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning: (116-130): Assertion violation happens here +// Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. +// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol index a96e2efe8db1..74466c9fd917 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning: (116-130): Assertion violation happens here +// Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. +// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul.sol index a62cefa0661b..7bc2d2b8875d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (150-164): Assertion violation happens here +// Warning 4661: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol index 110eb868e381..4836db3431c7 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (191-212): Assertion violation happens here +// Warning 4661: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol index cd73bc6875aa..a933665ccd75 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (197-216): Assertion violation happens here +// Warning 4661: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol index 8f84e5127125..cb5a8658338f 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (112-119): Assertion checker does not yet implement this assignment operator. -// Warning: (123-136): Assertion violation happens here +// Warning 9149: (112-119): Assertion checker does not yet implement this assignment operator. +// Warning 4661: (123-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol index 8b58b79a007e..c415f9baf3bc 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (106-113): Assertion checker does not yet implement this assignment operator. -// Warning: (117-130): Assertion violation happens here +// Warning 9149: (106-113): Assertion checker does not yet implement this assignment operator. +// Warning 4661: (117-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub.sol index 6e9cfa3cdcf6..12149f345e8d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (150-164): Assertion violation happens here +// Warning 4661: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol index 8c8f8462729c..6f32145ed573 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (191-212): Assertion violation happens here +// Warning 4661: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol index 92e3158324b0..0a502f05d470 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (197-216): Assertion violation happens here +// Warning 4661: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array.sol b/test/libsolidity/smtCheckerTests/operators/delete_array.sol index d34b0862c8c2..9c513e140050 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (118-119): Condition is always true. +// Warning 6838: (118-119): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index.sol index d36907c2739f..517fdf0ae830 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (119-120): Condition is always false. +// Warning 6838: (119-120): Condition is always false. diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol index 1892441cab51..2a5910c34996 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol @@ -17,4 +17,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (191-211): Assertion violation happens here +// Warning 4661: (191-211): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_function.sol b/test/libsolidity/smtCheckerTests/operators/delete_function.sol index 62579d7da5cd..64e397ae11eb 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_function.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_function.sol @@ -21,4 +21,4 @@ contract C } } // ---- -// Warning: (201-202): Condition is always true. +// Warning 6838: (201-202): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol index 0d19b2877716..3554f78882bb 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol @@ -38,5 +38,5 @@ contract C { } } // ---- -// Warning: (372-392): Assertion violation happens here -// Warning: (617-637): Assertion violation happens here +// Warning 4661: (372-392): Assertion violation happens here +// Warning 4661: (617-637): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol index 57a10c1ebf38..748fc59adb1a 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol @@ -17,14 +17,14 @@ contract C } } // ---- -// Warning: (73-192): Function state mutability can be restricted to pure -// Warning: (103-113): Assertion checker does not yet support the type of this variable. -// Warning: (117-120): Assertion checker does not yet support this expression. -// Warning: (117-118): Assertion checker does not yet implement type struct C.S memory -// Warning: (117-124): Assertion checker does not yet implement such assignments. -// Warning: (165-168): Assertion checker does not yet support this expression. -// Warning: (165-166): Assertion checker does not yet implement type struct C.S memory -// Warning: (158-168): Assertion checker does not yet implement "delete" for this expression. -// Warning: (179-182): Assertion checker does not yet support this expression. -// Warning: (179-180): Assertion checker does not yet implement type struct C.S memory -// Warning: (172-188): Assertion violation happens here +// Warning 2018: (73-192): Function state mutability can be restricted to pure +// Warning 8115: (103-113): Assertion checker does not yet support the type of this variable. +// Warning 7650: (117-120): Assertion checker does not yet support this expression. +// Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S memory +// Warning 8182: (117-124): Assertion checker does not yet implement such assignments. +// Warning 7650: (165-168): Assertion checker does not yet support this expression. +// Warning 8364: (165-166): Assertion checker does not yet implement type struct C.S memory +// Warning 2683: (158-168): Assertion checker does not yet implement "delete" for this expression. +// Warning 7650: (179-182): Assertion checker does not yet support this expression. +// Warning 8364: (179-180): Assertion checker does not yet implement type struct C.S memory +// Warning 4661: (172-188): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/division_1.sol b/test/libsolidity/smtCheckerTests/operators/division_1.sol index 9f434cbbcfb0..85e978905730 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (111-116): Division by zero happens here +// Warning 3046: (111-116): Division by zero happens here diff --git a/test/libsolidity/smtCheckerTests/operators/division_3.sol b/test/libsolidity/smtCheckerTests/operators/division_3.sol index 348a2e183dfb..03af864efd31 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_3.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (127-132): Overflow (resulting value larger than 0x80 * 2**248 - 1) happens here +// Warning 2661: (127-132): Overflow (resulting value larger than 0x80 * 2**248 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol index b0ea1e34de0a..cd1365997d1b 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (107-125): Error trying to invoke SMT solver. +// Warning 1218: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol index e8afbdf59441..6473b98f3720 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (105-123): Error trying to invoke SMT solver. +// Warning 1218: (105-123): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol index 81ab88a4eceb..c9a932a427b5 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (106-125): Error trying to invoke SMT solver. +// Warning 1218: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol index f6e6b57d140e..95743c934d7b 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (106-125): Error trying to invoke SMT solver. +// Warning 1218: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol index d93a508f3547..2570b375f537 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (107-125): Error trying to invoke SMT solver. +// Warning 1218: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol b/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol index 23a05e619bd5..c92a1ac5dbe5 100644 --- a/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/fixed_point_add.sol @@ -5,8 +5,8 @@ contract test { } } // ---- -// Warning: (80-88): Unused local variable. -// Warning: (91-100): Type conversion is not yet fully supported and might yield false positives. -// Warning: (103-112): Type conversion is not yet fully supported and might yield false positives. -// Warning: (91-112): Underflow (resulting value less than 0) happens here -// Warning: (91-112): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2072: (80-88): Unused local variable. +// Warning 5084: (91-100): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (103-112): Type conversion is not yet fully supported and might yield false positives. +// Warning 4144: (91-112): Underflow (resulting value less than 0) happens here +// Warning 2661: (91-112): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol b/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol index d4cbbc696f8c..b815b0c9429e 100644 --- a/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/fixed_point_compound_add.sol @@ -4,5 +4,5 @@ contract C { function f() internal { b[0] += 1; } } // ---- -// Warning: (84-93): Underflow (resulting value less than 0) happens here -// Warning: (84-93): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (84-93): Underflow (resulting value less than 0) happens here +// Warning 2661: (84-93): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/operators/index_access_for_bytes.sol b/test/libsolidity/smtCheckerTests/operators/index_access_for_bytes.sol index 0169efaec1a5..e4550c4dba7b 100644 --- a/test/libsolidity/smtCheckerTests/operators/index_access_for_bytes.sol +++ b/test/libsolidity/smtCheckerTests/operators/index_access_for_bytes.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// Warning: (116-120): Assertion checker does not yet support index accessing fixed bytes. -// Warning: (108-122): Assertion checker does not yet support index accessing fixed bytes. +// Warning 7989: (116-120): Assertion checker does not yet support index accessing fixed bytes. +// Warning 7989: (108-122): Assertion checker does not yet support index accessing fixed bytes. diff --git a/test/libsolidity/smtCheckerTests/operators/mod.sol b/test/libsolidity/smtCheckerTests/operators/mod.sol index 358b52df247c..de7f7b135b49 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (166-182): Error trying to invoke SMT solver. +// Warning 1218: (166-182): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_even.sol b/test/libsolidity/smtCheckerTests/operators/mod_even.sol index 1bbdc38b72b4..ab88a7ede1c9 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_even.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_even.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (122-142): Error trying to invoke SMT solver. +// Warning 1218: (122-142): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n.sol b/test/libsolidity/smtCheckerTests/operators/mod_n.sol index f4b1ee3e86b4..fb3643107489 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (126-139): Error trying to invoke SMT solver. +// Warning 1218: (126-139): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol index 9c4241f0bc58..2231d78349eb 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (130-149): Error trying to invoke SMT solver. +// Warning 1218: (130-149): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/slices_1.sol b/test/libsolidity/smtCheckerTests/operators/slices_1.sol index c723472a86b4..15e3c8e171f0 100644 --- a/test/libsolidity/smtCheckerTests/operators/slices_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/slices_1.sol @@ -8,6 +8,6 @@ contract C { } } // ---- -// Warning: (94-109): Assertion checker does not yet implement this expression. -// Warning: (113-128): Assertion checker does not yet implement this expression. -// Warning: (132-165): Assertion checker does not yet implement this expression. +// Warning 2923: (94-109): Assertion checker does not yet implement this expression. +// Warning 2923: (113-128): Assertion checker does not yet implement this expression. +// Warning 2923: (132-165): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add.sol b/test/libsolidity/smtCheckerTests/operators/unary_add.sol index 9cb463696f55..606b396dbddc 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (194-207): Assertion violation happens here +// Warning 4661: (194-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol b/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol index c6370b34f8cd..6d08f3596bbc 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (240-253): Assertion violation happens here +// Warning 4661: (240-253): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol b/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol index e75d5e113604..925b74187780 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (244-257): Assertion violation happens here +// Warning 4661: (244-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub.sol index 3a2aaf408fd6..9689d795a7b6 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (194-207): Assertion violation happens here +// Warning 4661: (194-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol index 220ae0a444ae..82f01475b0e7 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (240-253): Assertion violation happens here +// Warning 4661: (240-253): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol index a1c3df860992..c1735a6fa99e 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (244-257): Assertion violation happens here +// Warning 4661: (244-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/overflow_mul.sol b/test/libsolidity/smtCheckerTests/overflow/overflow_mul.sol index 4d91771803ed..86697dea0b65 100644 --- a/test/libsolidity/smtCheckerTests/overflow/overflow_mul.sol +++ b/test/libsolidity/smtCheckerTests/overflow/overflow_mul.sol @@ -13,5 +13,5 @@ contract C } } // ---- -// Warning: (120-125): Overflow (resulting value larger than 255) happens here -// Warning: (163-168): Overflow (resulting value larger than 255) happens here +// Warning 2661: (120-125): Overflow (resulting value larger than 255) happens here +// Warning 2661: (163-168): Overflow (resulting value larger than 255) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/overflow_mul_signed.sol b/test/libsolidity/smtCheckerTests/overflow/overflow_mul_signed.sol index 5dc11647e6e7..7663fa34ec6a 100644 --- a/test/libsolidity/smtCheckerTests/overflow/overflow_mul_signed.sol +++ b/test/libsolidity/smtCheckerTests/overflow/overflow_mul_signed.sol @@ -12,5 +12,5 @@ contract C } } // ---- -// Warning: (117-122): Overflow (resulting value larger than 127) happens here -// Warning: (150-157): Overflow (resulting value larger than 127) happens here +// Warning 2661: (117-122): Overflow (resulting value larger than 127) happens here +// Warning 2661: (150-157): Overflow (resulting value larger than 127) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/overflow_sum.sol b/test/libsolidity/smtCheckerTests/overflow/overflow_sum.sol index 1f19f56fa537..3eb3fd13f507 100644 --- a/test/libsolidity/smtCheckerTests/overflow/overflow_sum.sol +++ b/test/libsolidity/smtCheckerTests/overflow/overflow_sum.sol @@ -14,5 +14,5 @@ contract C } } // ---- -// Warning: (154-159): Overflow (resulting value larger than 255) happens here -// Warning: (185-192): Overflow (resulting value larger than 255) happens here +// Warning 2661: (154-159): Overflow (resulting value larger than 255) happens here +// Warning 2661: (185-192): Overflow (resulting value larger than 255) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/overflow_sum_signed.sol b/test/libsolidity/smtCheckerTests/overflow/overflow_sum_signed.sol index 09ebb5944788..7e9938c74413 100644 --- a/test/libsolidity/smtCheckerTests/overflow/overflow_sum_signed.sol +++ b/test/libsolidity/smtCheckerTests/overflow/overflow_sum_signed.sol @@ -14,6 +14,6 @@ contract C } } // ---- -// Warning: (117-122): Overflow (resulting value larger than 127) happens here -// Warning: (151-158): Overflow (resulting value larger than 127) happens here -// Warning: (197-205): Underflow (resulting value less than -128) happens here +// Warning 2661: (117-122): Overflow (resulting value larger than 127) happens here +// Warning 2661: (151-158): Overflow (resulting value larger than 127) happens here +// Warning 4144: (197-205): Underflow (resulting value less than -128) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/simple_overflow.sol b/test/libsolidity/smtCheckerTests/overflow/simple_overflow.sol index ec819b80c76d..117554ecab46 100644 --- a/test/libsolidity/smtCheckerTests/overflow/simple_overflow.sol +++ b/test/libsolidity/smtCheckerTests/overflow/simple_overflow.sol @@ -3,4 +3,4 @@ contract C { function f(uint a, uint b) public pure returns (uint) { return a + b; } } // ---- -// Warning: (112-117): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (112-117): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/underflow_sub.sol b/test/libsolidity/smtCheckerTests/overflow/underflow_sub.sol index d41cfaa71572..1029e90a5be8 100644 --- a/test/libsolidity/smtCheckerTests/overflow/underflow_sub.sol +++ b/test/libsolidity/smtCheckerTests/overflow/underflow_sub.sol @@ -12,5 +12,5 @@ contract C } } // ---- -// Warning: (117-122): Underflow (resulting value less than 0) happens here -// Warning: (150-157): Underflow (resulting value less than 0) happens here +// Warning 4144: (117-122): Underflow (resulting value less than 0) happens here +// Warning 4144: (150-157): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/overflow/underflow_sub_signed.sol b/test/libsolidity/smtCheckerTests/overflow/underflow_sub_signed.sol index 40416498d7fd..84634a213e99 100644 --- a/test/libsolidity/smtCheckerTests/overflow/underflow_sub_signed.sol +++ b/test/libsolidity/smtCheckerTests/overflow/underflow_sub_signed.sol @@ -16,6 +16,6 @@ contract C } } // ---- -// Warning: (116-123): Underflow (resulting value less than -128) happens here -// Warning: (163-170): Underflow (resulting value less than -128) happens here -// Warning: (207-217): Overflow (resulting value larger than 127) happens here +// Warning 4144: (116-123): Underflow (resulting value less than -128) happens here +// Warning 4144: (163-170): Underflow (resulting value less than -128) happens here +// Warning 2661: (207-217): Overflow (resulting value larger than 127) happens here diff --git a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2.sol b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2.sol index a38c93e6ff62..513166872f1e 100644 --- a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2.sol +++ b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2.sol @@ -8,9 +8,9 @@ contract C { } } // ---- -// Warning: (151-159): Assertion checker does not yet support the type of this variable. -// Warning: (206-209): Assertion checker does not yet implement type abi -// Warning: (225-226): Assertion checker does not yet implement type type(struct C.S storage pointer) -// Warning: (235-241): Assertion checker does not yet implement type type(uint256[] memory) -// Warning: (235-244): Assertion checker does not yet implement type type(uint256[] memory[2] memory) -// Warning: (206-246): Assertion checker does not yet implement this type of function call. +// Warning 8115: (151-159): Assertion checker does not yet support the type of this variable. +// Warning 8364: (206-209): Assertion checker does not yet implement type abi +// Warning 8364: (225-226): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning 8364: (235-241): Assertion checker does not yet implement type type(uint256[] memory) +// Warning 8364: (235-244): Assertion checker does not yet implement type type(uint256[] memory[2] memory) +// Warning 4588: (206-246): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol index dea9b411f7eb..c1db0e0573a0 100644 --- a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol +++ b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol @@ -10,10 +10,10 @@ contract C { } } // ---- -// Warning: (125-132): Unused local variable. -// Warning: (183-190): Unused local variable. -// Warning: (136-139): Assertion checker does not yet implement type abi -// Warning: (136-167): Assertion checker does not yet implement this type of function call. -// Warning: (194-197): Assertion checker does not yet implement type abi -// Warning: (194-225): Assertion checker does not yet implement this type of function call. -// Warning: (303-319): Assertion violation happens here +// Warning 2072: (125-132): Unused local variable. +// Warning 2072: (183-190): Unused local variable. +// Warning 8364: (136-139): Assertion checker does not yet implement type abi +// Warning 4588: (136-167): Assertion checker does not yet implement this type of function call. +// Warning 8364: (194-197): Assertion checker does not yet implement type abi +// Warning 4588: (194-225): Assertion checker does not yet implement this type of function call. +// Warning 4661: (303-319): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol b/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol index c06577e0fede..73e91f2689d1 100644 --- a/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol +++ b/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol @@ -10,15 +10,15 @@ contract C { } // ---- -// Warning: (88-98): Unused local variable. -// Warning: (100-104): Unused local variable. -// Warning: (161-171): Unused local variable. -// Warning: (173-177): Unused local variable. -// Warning: (108-111): Assertion checker does not yet implement type abi -// Warning: (142-143): Assertion checker does not yet implement type type(contract C) -// Warning: (108-145): Assertion checker does not yet implement this type of function call. -// Warning: (181-184): Assertion checker does not yet implement type abi -// Warning: (215-216): Assertion checker does not yet implement type type(contract C) -// Warning: (181-218): Assertion checker does not yet implement this type of function call. -// Warning: (296-312): Assertion violation happens here -// Warning: (315-331): Assertion violation happens here +// Warning 2072: (88-98): Unused local variable. +// Warning 2072: (100-104): Unused local variable. +// Warning 2072: (161-171): Unused local variable. +// Warning 2072: (173-177): Unused local variable. +// Warning 8364: (108-111): Assertion checker does not yet implement type abi +// Warning 8364: (142-143): Assertion checker does not yet implement type type(contract C) +// Warning 4588: (108-145): Assertion checker does not yet implement this type of function call. +// Warning 8364: (181-184): Assertion checker does not yet implement type abi +// Warning 8364: (215-216): Assertion checker does not yet implement type type(contract C) +// Warning 4588: (181-218): Assertion checker does not yet implement this type of function call. +// Warning 4661: (296-312): Assertion violation happens here +// Warning 4661: (315-331): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/blockhash.sol b/test/libsolidity/smtCheckerTests/special/blockhash.sol index 59a529228178..920bdfc46433 100644 --- a/test/libsolidity/smtCheckerTests/special/blockhash.sol +++ b/test/libsolidity/smtCheckerTests/special/blockhash.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning: (85-109): Assertion violation happens here -// Warning: (113-137): Assertion violation happens here +// Warning 4661: (85-109): Assertion violation happens here +// Warning 4661: (113-137): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/difficulty.sol b/test/libsolidity/smtCheckerTests/special/difficulty.sol index 4469d4e57a66..4e7917504d16 100644 --- a/test/libsolidity/smtCheckerTests/special/difficulty.sol +++ b/test/libsolidity/smtCheckerTests/special/difficulty.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (91-129): Assertion violation happens here +// Warning 4661: (91-129): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/gasleft.sol b/test/libsolidity/smtCheckerTests/special/gasleft.sol index 857230febd94..8f95f1e6736c 100644 --- a/test/libsolidity/smtCheckerTests/special/gasleft.sol +++ b/test/libsolidity/smtCheckerTests/special/gasleft.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning: (76-97): Assertion violation happens here -// Warning: (123-144): Assertion violation happens here +// Warning 4661: (76-97): Assertion violation happens here +// Warning 4661: (123-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol index a8ae53997a8e..83afe0fde93d 100644 --- a/test/libsolidity/smtCheckerTests/special/many.sol +++ b/test/libsolidity/smtCheckerTests/special/many.sol @@ -15,12 +15,12 @@ contract C } } // ---- -// Warning: (79-115): Assertion violation happens here -// Warning: (119-161): Assertion violation happens here -// Warning: (165-204): Assertion violation happens here -// Warning: (208-240): Assertion violation happens here -// Warning: (244-275): Assertion violation happens here -// Warning: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (304-332): Assertion violation happens here -// Warning: (336-352): Assertion violation happens here -// Warning: (356-379): Assertion violation happens here +// Warning 4661: (79-115): Assertion violation happens here +// Warning 4661: (119-161): Assertion violation happens here +// Warning 4661: (165-204): Assertion violation happens here +// Warning 4661: (208-240): Assertion violation happens here +// Warning 4661: (244-275): Assertion violation happens here +// Warning 2661: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (304-332): Assertion violation happens here +// Warning 4661: (336-352): Assertion violation happens here +// Warning 4661: (356-379): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_data.sol b/test/libsolidity/smtCheckerTests/special/msg_data.sol index 9db24dbcbc91..f1059fd2b472 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_data.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_data.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (79-106): Assertion violation happens here +// Warning 4661: (79-106): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol index f122f4f2309d..df5620d8b483 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (98-108): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (98-108): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol index 9a4eefd5291c..055ca5c93951 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (155-178): Assertion violation happens here +// Warning 4661: (155-178): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_sig.sol b/test/libsolidity/smtCheckerTests/special/msg_sig.sol index 109470a8373a..141c54f42fb7 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_sig.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_sig.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (79-108): Assertion violation happens here +// Warning 4661: (79-108): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/this.sol b/test/libsolidity/smtCheckerTests/special/this.sol index 06fc07404fd7..4d1ade2f5fbc 100644 --- a/test/libsolidity/smtCheckerTests/special/this.sol +++ b/test/libsolidity/smtCheckerTests/special/this.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (85-111): Assertion violation happens here +// Warning 4661: (85-111): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_address_1.sol b/test/libsolidity/smtCheckerTests/typecast/cast_address_1.sol index 885118a5b0f9..0bce016c9c8e 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_address_1.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_address_1.sol @@ -8,5 +8,5 @@ contract C } } // ---- -// Warning: (98-108): Type conversion is not yet fully supported and might yield false positives. -// Warning: (125-135): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (98-108): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (125-135): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol b/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol index 6676c4d68947..e31a01ada865 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol @@ -18,9 +18,9 @@ contract C } } // ---- -// Warning: (186-195): Type conversion is not yet fully supported and might yield false positives. -// Warning: (317-333): Type conversion is not yet fully supported and might yield false positives. -// Warning: (451-460): Type conversion is not yet fully supported and might yield false positives. -// Warning: (280-303): Assertion violation happens here -// Warning: (414-431): Assertion violation happens here -// Warning: (542-559): Assertion violation happens here +// Warning 5084: (186-195): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (317-333): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (451-460): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (280-303): Assertion violation happens here +// Warning 4661: (414-431): Assertion violation happens here +// Warning 4661: (542-559): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_1.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_1.sol index 4b0f42e7e2b9..af7f1fdf6b4d 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_1.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_1.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (94-103): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (94-103): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2.sol index 1f981c8c7f12..34ef9aef24d1 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (108-117): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol index 7f7073816f15..886063ee08e8 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol @@ -9,5 +9,5 @@ contract C } } // ---- -// Warning: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning: (149-163): Assertion violation happens here +// Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (149-163): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol index cc51639edd2c..77bb74374420 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol @@ -12,6 +12,6 @@ contract C } } // ---- -// Warning: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning: (207-230): Assertion violation happens here -// Warning: (273-287): Assertion violation happens here +// Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (207-230): Assertion violation happens here +// Warning 4661: (273-287): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_1.sol b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_1.sol index 3e964dfd77c8..223141476a26 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_1.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_1.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (94-102): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (94-102): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol index 2527010865c4..bbc8819b115d 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning: (112-121): Type conversion is not yet fully supported and might yield false positives. -// Warning: (208-227): Assertion violation happens here +// Warning 5084: (112-121): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (208-227): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol index 1c9ea545afa0..1af3f58b2e94 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning: (198-215): Assertion violation happens here +// Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (198-215): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol b/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol index 33a7d972b120..d7e87b02cccb 100644 --- a/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol +++ b/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol @@ -10,6 +10,6 @@ contract C } } // ---- -// Warning: (132-133): Assertion checker does not yet implement type type(enum C.D) -// Warning: (132-136): Type conversion is not yet fully supported and might yield false positives. -// Warning: (140-160): Assertion violation happens here +// Warning 8364: (132-133): Assertion checker does not yet implement type type(enum C.D) +// Warning 5084: (132-136): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (140-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/enum_to_uint_max_value.sol b/test/libsolidity/smtCheckerTests/typecast/enum_to_uint_max_value.sol index b061777f97cc..419cc6c2d3b4 100644 --- a/test/libsolidity/smtCheckerTests/typecast/enum_to_uint_max_value.sol +++ b/test/libsolidity/smtCheckerTests/typecast/enum_to_uint_max_value.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (113-121): Type conversion is not yet fully supported and might yield false positives. +// Warning 5084: (113-121): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol index 7998525926fb..1f2ee2a1f3d9 100644 --- a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol +++ b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (155-175): Assertion violation happens here +// Warning 4661: (155-175): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol index abee678c0503..fccf18dda7d0 100644 --- a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol +++ b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol @@ -11,13 +11,13 @@ contract C { } } // ---- -// Warning: (214-218): Assertion checker does not yet implement this type of function call. -// Warning: (222-226): Assertion checker does not yet implement this type of function call. -// Warning: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons -// Warning: (207-227): Assertion violation happens here -// Warning: (231-245): Assertion violation happens here -// Warning: (214-218): Assertion checker does not yet implement this type of function call. -// Warning: (222-226): Assertion checker does not yet implement this type of function call. -// Warning: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons -// Warning: (207-227): Assertion violation happens here -// Warning: (231-245): Assertion violation happens here +// Warning 5729: (214-218): Assertion checker does not yet implement this type of function call. +// Warning 5729: (222-226): Assertion checker does not yet implement this type of function call. +// Warning 7229: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons +// Warning 4661: (207-227): Assertion violation happens here +// Warning 4661: (231-245): Assertion violation happens here +// Warning 5729: (214-218): Assertion checker does not yet implement this type of function call. +// Warning 5729: (222-226): Assertion checker does not yet implement this type of function call. +// Warning 7229: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons +// Warning 4661: (207-227): Assertion violation happens here +// Warning 4661: (231-245): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/slice_to_bytes.sol b/test/libsolidity/smtCheckerTests/typecast/slice_to_bytes.sol index 1fb74bac9cec..ff3760dd4575 100644 --- a/test/libsolidity/smtCheckerTests/typecast/slice_to_bytes.sol +++ b/test/libsolidity/smtCheckerTests/typecast/slice_to_bytes.sol @@ -8,6 +8,6 @@ contract C { } } // ---- -// Warning: (100-115): Assertion checker does not yet implement this expression. -// Warning: (126-141): Assertion checker does not yet implement this expression. -// Warning: (152-185): Assertion checker does not yet implement this expression. +// Warning 2923: (100-115): Assertion checker does not yet implement this expression. +// Warning 2923: (126-141): Assertion checker does not yet implement this expression. +// Warning 2923: (152-185): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol index d94f3204b9ef..8867cba8b33a 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol @@ -9,5 +9,5 @@ contract B { } } // ---- -// Warning: (162-184): Assertion violation happens here -// Warning: (162-184): Assertion violation happens here +// Warning 4661: (162-184): Assertion violation happens here +// Warning 4661: (162-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol index 41459169fd0c..f42bc60d1a8e 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol @@ -8,4 +8,4 @@ contract B { } } // ---- -// Warning: (152-174): Assertion violation happens here +// Warning 4661: (152-174): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol index 09fd68ef639f..04c88481c227 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (238-259): Assertion violation happens here +// Warning 4661: (238-259): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol index f2ba3ce23d33..0387b3fdaf7a 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// Warning: (442-461): Assertion violation happens here +// Warning 4661: (442-461): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_balance.sol b/test/libsolidity/smtCheckerTests/types/address_balance.sol index 4464cfdee9b4..e631479526bf 100644 --- a/test/libsolidity/smtCheckerTests/types/address_balance.sol +++ b/test/libsolidity/smtCheckerTests/types/address_balance.sol @@ -8,6 +8,6 @@ contract C } } // ---- -// Warning: (96-102): Unused local variable. -// Warning: (105-127): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (131-160): Assertion violation happens here +// Warning 2072: (96-102): Unused local variable. +// Warning 2661: (105-127): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (131-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_call.sol b/test/libsolidity/smtCheckerTests/types/address_call.sol index da87778e6d43..f0da1a2cc46f 100644 --- a/test/libsolidity/smtCheckerTests/types/address_call.sol +++ b/test/libsolidity/smtCheckerTests/types/address_call.sol @@ -18,8 +18,8 @@ contract C // ==== // EVMVersion: >spuriousDragon // ---- -// Warning: (224-240): Unused local variable. -// Warning: (260-275): Assertion violation happens here -// Warning: (279-293): Assertion violation happens here -// Warning: (297-316): Assertion violation happens here -// Warning: (320-344): Assertion violation happens here +// Warning 2072: (224-240): Unused local variable. +// Warning 4661: (260-275): Assertion violation happens here +// Warning 4661: (279-293): Assertion violation happens here +// Warning 4661: (297-316): Assertion violation happens here +// Warning 4661: (320-344): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol b/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol index b9d3bcaea4d1..b93c0d8d6f36 100644 --- a/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol +++ b/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol @@ -18,8 +18,8 @@ contract C // ==== // EVMVersion: >spuriousDragon // ---- -// Warning: (224-240): Unused local variable. -// Warning: (268-283): Assertion violation happens here -// Warning: (287-301): Assertion violation happens here -// Warning: (305-324): Assertion violation happens here -// Warning: (328-352): Assertion violation happens here +// Warning 2072: (224-240): Unused local variable. +// Warning 4661: (268-283): Assertion violation happens here +// Warning 4661: (287-301): Assertion violation happens here +// Warning 4661: (305-324): Assertion violation happens here +// Warning 4661: (328-352): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol index 32e4cbb9a634..e4644ed8afce 100644 --- a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol +++ b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol @@ -18,8 +18,8 @@ contract C // ==== // EVMVersion: >spuriousDragon // ---- -// Warning: (224-240): Unused local variable. -// Warning: (266-281): Assertion violation happens here -// Warning: (285-299): Assertion violation happens here -// Warning: (303-322): Assertion violation happens here -// Warning: (326-350): Assertion violation happens here +// Warning 2072: (224-240): Unused local variable. +// Warning 4661: (266-281): Assertion violation happens here +// Warning 4661: (285-299): Assertion violation happens here +// Warning 4661: (303-322): Assertion violation happens here +// Warning 4661: (326-350): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer.sol b/test/libsolidity/smtCheckerTests/types/address_transfer.sol index 80abfbc3866a..f369ec3ba589 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer.sol @@ -11,5 +11,5 @@ contract C } } // ---- -// Warning: (131-146): Insufficient funds happens here -// Warning: (195-219): Assertion violation happens here +// Warning 1236: (131-146): Insufficient funds happens here +// Warning 4661: (195-219): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol b/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol index a83ed00add49..6da8ace7977e 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol @@ -14,6 +14,6 @@ contract C } } // ---- -// Warning: (217-232): Insufficient funds happens here -// Warning: (236-251): Insufficient funds happens here -// Warning: (295-324): Assertion violation happens here +// Warning 1236: (217-232): Insufficient funds happens here +// Warning 1236: (236-251): Insufficient funds happens here +// Warning 4661: (295-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol b/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol index d0df06e227c6..003d73aec8b6 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol @@ -11,6 +11,6 @@ contract C } } // ---- -// Warning: (134-149): Insufficient funds happens here -// Warning: (153-169): Insufficient funds happens here -// Warning: (213-237): Assertion violation happens here +// Warning 1236: (134-149): Insufficient funds happens here +// Warning 1236: (153-169): Insufficient funds happens here +// Warning 4661: (213-237): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol index 00d2965bc9f2..212e06526df6 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol @@ -26,4 +26,4 @@ contract C } } // ---- -// Warning: (400-457): Assertion violation happens here +// Warning 4661: (400-457): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol index 94e7ccfcf633..30817e87cf58 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning: (321-338): Assertion violation happens here +// Warning 4661: (321-338): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol index 1ae2b935613a..90948eedf13f 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol @@ -20,4 +20,4 @@ contract C } } // ---- -// Warning: (476-493): Assertion violation happens here +// Warning 4661: (476-493): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol index 2aacc5c0d9fa..4accc29df945 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol @@ -44,13 +44,13 @@ contract C } } // ---- -// Warning: (468-485): Assertion violation happens here -// Warning: (532-554): Assertion violation happens here -// Warning: (606-633): Assertion violation happens here -// Warning: (774-796): Assertion violation happens here -// Warning: (936-962): Assertion violation happens here -// Warning: (468-485): Assertion violation happens here -// Warning: (532-554): Assertion violation happens here -// Warning: (606-633): Assertion violation happens here -// Warning: (774-796): Assertion violation happens here -// Warning: (936-962): Assertion violation happens here +// Warning 4661: (468-485): Assertion violation happens here +// Warning 4661: (532-554): Assertion violation happens here +// Warning 4661: (606-633): Assertion violation happens here +// Warning 4661: (774-796): Assertion violation happens here +// Warning 4661: (936-962): Assertion violation happens here +// Warning 4661: (468-485): Assertion violation happens here +// Warning 4661: (532-554): Assertion violation happens here +// Warning 4661: (606-633): Assertion violation happens here +// Warning 4661: (774-796): Assertion violation happens here +// Warning 4661: (936-962): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol index 3d60c836a896..3caf62fa74db 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol @@ -20,5 +20,5 @@ contract C } } // ---- -// Warning: (436-453): Assertion violation happens here -// Warning: (436-453): Assertion violation happens here +// Warning 4661: (436-453): Assertion violation happens here +// Warning 4661: (436-453): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol index 68438eb6dcbe..900d39463bf1 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol @@ -23,7 +23,7 @@ contract C } } // ---- -// Warning: (524-542): Assertion violation happens here -// Warning: (585-602): Assertion violation happens here -// Warning: (524-542): Assertion violation happens here -// Warning: (585-602): Assertion violation happens here +// Warning 4661: (524-542): Assertion violation happens here +// Warning 4661: (585-602): Assertion violation happens here +// Warning 4661: (524-542): Assertion violation happens here +// Warning 4661: (585-602): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol index 384a89b4fe6e..c967d6509c68 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol @@ -19,7 +19,7 @@ contract C } } // ---- -// Warning: (225-242): Assertion violation happens here -// Warning: (289-307): Assertion violation happens here -// Warning: (225-242): Assertion violation happens here -// Warning: (289-307): Assertion violation happens here +// Warning 4661: (225-242): Assertion violation happens here +// Warning 4661: (289-307): Assertion violation happens here +// Warning 4661: (225-242): Assertion violation happens here +// Warning 4661: (289-307): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol index e94ad4580419..afe21ea3472b 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol @@ -26,7 +26,7 @@ contract C } } // ---- -// Warning: (431-449): Assertion violation happens here -// Warning: (504-521): Assertion violation happens here -// Warning: (431-449): Assertion violation happens here -// Warning: (504-521): Assertion violation happens here +// Warning 4661: (431-449): Assertion violation happens here +// Warning 4661: (504-521): Assertion violation happens here +// Warning 4661: (431-449): Assertion violation happens here +// Warning 4661: (504-521): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol index f4b22cf32c35..9c10255d8d08 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning: (47-148): Function state mutability can be restricted to pure -// Warning: (128-144): Assertion violation happens here +// Warning 2018: (47-148): Function state mutability can be restricted to pure +// Warning 4661: (128-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol index a68ea8b60ae6..c62b953c28f3 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (130-149): Assertion violation happens here +// Warning 4661: (130-149): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol index 87eda064c1e1..ff42ff18a560 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (138-160): Assertion violation happens here +// Warning 4661: (138-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branches_1d.sol b/test/libsolidity/smtCheckerTests/types/array_branches_1d.sol index a7bc62eb0deb..bad0bd6f3acd 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branches_1d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branches_1d.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (47-168): Function state mutability can be restricted to pure +// Warning 2018: (47-168): Function state mutability can be restricted to pure diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol index 79864d35ac34..dd0a81bb4c7e 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (137-159): Assertion violation happens here +// Warning 4661: (137-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol index 8555b061329b..8f1cd0cf28cc 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (243-268): Assertion violation happens here +// Warning 4661: (243-268): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol index d7eb8bccbb51..4a6f5ec9a620 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (274-302): Assertion violation happens here +// Warning 4661: (274-302): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol index a9754b611064..2b7cfc1638f3 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (148-170): Assertion violation happens here +// Warning 4661: (148-170): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_literal_1.sol b/test/libsolidity/smtCheckerTests/types/array_literal_1.sol index 99e350ba0971..a72031f1dfbc 100644 --- a/test/libsolidity/smtCheckerTests/types/array_literal_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_literal_1.sol @@ -7,5 +7,5 @@ contract C } } // ---- -// Warning: (76-96): Unused local variable. -// Warning: (99-114): Assertion checker does not yet implement inline arrays. +// Warning 2072: (76-96): Unused local variable. +// Warning 2177: (99-114): Assertion checker does not yet implement inline arrays. diff --git a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol index dc69dd55aa29..f9344a257f7c 100644 --- a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol @@ -23,7 +23,7 @@ contract C } } // ---- -// Warning: (421-452): Assertion violation happens here -// Warning: (635-671): Assertion violation happens here -// Warning: (421-452): Assertion violation happens here -// Warning: (635-671): Assertion violation happens here +// Warning 4661: (421-452): Assertion violation happens here +// Warning 4661: (635-671): Assertion violation happens here +// Warning 4661: (421-452): Assertion violation happens here +// Warning 4661: (635-671): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol index 2e16e7b5da3c..0c5dc7a1f104 100644 --- a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol @@ -26,5 +26,5 @@ contract C } } // ---- -// Warning: (777-797): Assertion violation happens here -// Warning: (777-797): Assertion violation happens here +// Warning 4661: (777-797): Assertion violation happens here +// Warning 4661: (777-797): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol index 017df8f297b9..126aa16fcd6a 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (139-161): Assertion violation happens here +// Warning 4661: (139-161): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol index b230886de7a9..433b5589a39a 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (186-211): Assertion violation happens here +// Warning 4661: (186-211): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol index 22a2f0506090..684e665d8be2 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (280-308): Assertion violation happens here +// Warning 4661: (280-308): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol index dd846b483a3a..40b35b6d9c07 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol @@ -14,5 +14,5 @@ contract C } } // ---- -// Warning: (228-246): Assertion violation happens here -// Warning: (293-310): Assertion violation happens here +// Warning 4661: (228-246): Assertion violation happens here +// Warning 4661: (293-310): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol index 45c12263be79..02072491f723 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol @@ -21,6 +21,6 @@ contract C } } // ---- -// Warning: (338-355): Assertion violation happens here -// Warning: (338-355): Assertion violation happens here -// Warning: (338-355): Assertion violation happens here +// Warning 4661: (338-355): Assertion violation happens here +// Warning 4661: (338-355): Assertion violation happens here +// Warning 4661: (338-355): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol index 7e31b10ae6a6..b5e8d37e4547 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol @@ -23,7 +23,7 @@ contract C } } // ---- -// Warning: (425-456): Assertion violation happens here -// Warning: (639-675): Assertion violation happens here -// Warning: (425-456): Assertion violation happens here -// Warning: (639-675): Assertion violation happens here +// Warning 4661: (425-456): Assertion violation happens here +// Warning 4661: (639-675): Assertion violation happens here +// Warning 4661: (425-456): Assertion violation happens here +// Warning 4661: (639-675): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol index e2f597943df3..826065f6a512 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol @@ -26,5 +26,5 @@ contract C } } // ---- -// Warning: (781-801): Assertion violation happens here -// Warning: (781-801): Assertion violation happens here +// Warning 4661: (781-801): Assertion violation happens here +// Warning 4661: (781-801): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol b/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol index ee92be251f0f..1363e4184aba 100644 --- a/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol @@ -14,19 +14,19 @@ contract C } } // ---- -// Warning: (124-130): Assertion checker does not yet support this expression. -// Warning: (124-128): Assertion checker does not yet implement type struct C.S memory -// Warning: (124-133): Assertion checker does not yet implement this expression. -// Warning: (124-136): Assertion checker does not yet implement this expression. -// Warning: (154-160): Assertion checker does not yet support this expression. -// Warning: (154-158): Assertion checker does not yet implement type struct C.S memory -// Warning: (154-163): Assertion checker does not yet implement this expression. -// Warning: (154-166): Assertion checker does not yet implement this expression. -// Warning: (182-188): Assertion checker does not yet support this expression. -// Warning: (182-186): Assertion checker does not yet implement type struct C.S memory -// Warning: (182-191): Assertion checker does not yet implement this expression. -// Warning: (182-194): Assertion checker does not yet implement this expression. -// Warning: (209-215): Assertion checker does not yet support this expression. -// Warning: (209-213): Assertion checker does not yet implement type struct C.S memory -// Warning: (209-218): Assertion checker does not yet implement this expression. -// Warning: (202-226): Assertion violation happens here +// Warning 7650: (124-130): Assertion checker does not yet support this expression. +// Warning 8364: (124-128): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (124-133): Assertion checker does not yet implement this expression. +// Warning 9056: (124-136): Assertion checker does not yet implement this expression. +// Warning 7650: (154-160): Assertion checker does not yet support this expression. +// Warning 8364: (154-158): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (154-163): Assertion checker does not yet implement this expression. +// Warning 9056: (154-166): Assertion checker does not yet implement this expression. +// Warning 7650: (182-188): Assertion checker does not yet support this expression. +// Warning 8364: (182-186): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (182-191): Assertion checker does not yet implement this expression. +// Warning 9056: (182-194): Assertion checker does not yet implement this expression. +// Warning 7650: (209-215): Assertion checker does not yet support this expression. +// Warning 8364: (209-213): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (209-218): Assertion checker does not yet implement this expression. +// Warning 4661: (202-226): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol b/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol index 76b4b08b848b..a30121141695 100644 --- a/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol +++ b/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (90-99): Assertion violation happens here +// Warning 4661: (90-99): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol b/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol index 5c166c022454..9f6cacc75b0c 100644 --- a/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol +++ b/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (98-112): Assertion violation happens here +// Warning 4661: (98-112): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bytes_1.sol b/test/libsolidity/smtCheckerTests/types/bytes_1.sol index 92a616d4321d..6958f29530fc 100644 --- a/test/libsolidity/smtCheckerTests/types/bytes_1.sol +++ b/test/libsolidity/smtCheckerTests/types/bytes_1.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (113-127): Unused local variable. +// Warning 2072: (113-127): Unused local variable. diff --git a/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol b/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol index e5f1b3a80af0..82a2f5497334 100644 --- a/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (119-141): Assertion violation happens here +// Warning 4661: (119-141): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract.sol b/test/libsolidity/smtCheckerTests/types/contract.sol index 3d8af499eb5f..a346fad5f213 100644 --- a/test/libsolidity/smtCheckerTests/types/contract.sol +++ b/test/libsolidity/smtCheckerTests/types/contract.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (84-98): Assertion violation happens here +// Warning 4661: (84-98): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract_2.sol b/test/libsolidity/smtCheckerTests/types/contract_2.sol index 8cb8bc9cfbc6..3302cc076fec 100644 --- a/test/libsolidity/smtCheckerTests/types/contract_2.sol +++ b/test/libsolidity/smtCheckerTests/types/contract_2.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (109-123): Assertion violation happens here +// Warning 4661: (109-123): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol b/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol index 96baf62a5a5d..0985fa180b51 100644 --- a/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol +++ b/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (90-113): Assertion violation happens here +// Warning 4661: (90-113): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol b/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol index 3fd43ac9fdfb..343f22ad8936 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (144-159): Assertion violation happens here +// Warning 4661: (144-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol b/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol index be1d40be4036..69aa61149d51 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (159-179): Assertion violation happens here +// Warning 4661: (159-179): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol b/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol index 4821518fdc2b..c5d107ab00d2 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol @@ -11,10 +11,10 @@ contract C } } // ---- -// Warning: (143-153): Assertion checker does not yet support the type of this variable. -// Warning: (171-174): Assertion checker does not yet support this expression. -// Warning: (171-172): Assertion checker does not yet implement type struct C.S memory -// Warning: (171-183): Assertion checker does not yet implement such assignments. -// Warning: (194-197): Assertion checker does not yet support this expression. -// Warning: (194-195): Assertion checker does not yet implement type struct C.S memory -// Warning: (187-208): Assertion violation happens here +// Warning 8115: (143-153): Assertion checker does not yet support the type of this variable. +// Warning 7650: (171-174): Assertion checker does not yet support this expression. +// Warning 8364: (171-172): Assertion checker does not yet implement type struct C.S memory +// Warning 8182: (171-183): Assertion checker does not yet implement such assignments. +// Warning 7650: (194-197): Assertion checker does not yet support this expression. +// Warning 8364: (194-195): Assertion checker does not yet implement type struct C.S memory +// Warning 4661: (187-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol b/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol index 0d8b1362747c..b963e11e7b32 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (115-130): Assertion violation happens here +// Warning 4661: (115-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol index 541fff54e912..c4c4b7cac1b8 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol @@ -12,5 +12,5 @@ contract C } } // ---- -// Warning: (96-110): Assertion violation happens here -// Warning: (114-130): Assertion violation happens here +// Warning 4661: (96-110): Assertion violation happens here +// Warning 4661: (114-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol index bb2513790959..688804153fa6 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning: (116-130): Assertion violation happens here +// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/function_in_tuple_1.sol b/test/libsolidity/smtCheckerTests/types/function_in_tuple_1.sol index 4d1d954f7b38..40b0c0b7a616 100644 --- a/test/libsolidity/smtCheckerTests/types/function_in_tuple_1.sol +++ b/test/libsolidity/smtCheckerTests/types/function_in_tuple_1.sol @@ -6,5 +6,5 @@ contract K { } } // ---- -// Warning: (76-91): Statement has no effect. -// Warning: (77-80): Assertion checker does not yet implement type abi +// Warning 6133: (76-91): Statement has no effect. +// Warning 8364: (77-80): Assertion checker does not yet implement type abi diff --git a/test/libsolidity/smtCheckerTests/types/function_in_tuple_2.sol b/test/libsolidity/smtCheckerTests/types/function_in_tuple_2.sol index 5b9c2f41c6d3..cecb9f967a6d 100644 --- a/test/libsolidity/smtCheckerTests/types/function_in_tuple_2.sol +++ b/test/libsolidity/smtCheckerTests/types/function_in_tuple_2.sol @@ -6,5 +6,5 @@ contract K { } } // ---- -// Warning: (76-92): Statement has no effect. -// Warning: (77-80): Assertion checker does not yet implement type abi +// Warning 6133: (76-92): Statement has no effect. +// Warning 8364: (77-80): Assertion checker does not yet implement type abi diff --git a/test/libsolidity/smtCheckerTests/types/function_type_arrays.sol b/test/libsolidity/smtCheckerTests/types/function_type_arrays.sol index f004b5514e09..e2810721b90f 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_arrays.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_arrays.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (361-410): Assertion checker does not yet implement this type of function call. +// Warning 4588: (361-410): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/types/function_type_call.sol b/test/libsolidity/smtCheckerTests/types/function_type_call.sol index 90a80dd9e32e..52b019947366 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_call.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_call.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (121-125): Assertion checker does not yet implement this type of function call. -// Warning: (121-125): Assertion checker does not yet implement this type of function call. +// Warning 5729: (121-125): Assertion checker does not yet implement this type of function call. +// Warning 5729: (121-125): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/types/function_type_external_address.sol b/test/libsolidity/smtCheckerTests/types/function_type_external_address.sol index 5f10ccf599a7..549701105bba 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_external_address.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_external_address.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// Warning: (128-137): Assertion checker does not yet support this expression. -// Warning: (141-155): Assertion violation happens here +// Warning 7650: (128-137): Assertion checker does not yet support this expression. +// Warning 4661: (141-155): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/function_type_members.sol b/test/libsolidity/smtCheckerTests/types/function_type_members.sol index 923767dd7366..9ac6036bf522 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_members.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_members.sol @@ -7,8 +7,8 @@ contract C { } } // ---- -// Warning: (122-127): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (122-136): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (108-118): Assertion checker does not yet support this expression. -// Warning: (122-130): Assertion checker does not yet implement this type of function call. -// Warning: (122-139): Assertion checker does not yet implement this type of function call. +// Warning 1621: (122-127): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (122-136): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 7650: (108-118): Assertion checker does not yet support this expression. +// Warning 4588: (122-130): Assertion checker does not yet implement this type of function call. +// Warning 4588: (122-139): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/types/function_type_nested.sol b/test/libsolidity/smtCheckerTests/types/function_type_nested.sol index 90d101f4dbc5..2b6a0e538b8f 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_nested.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_nested.sol @@ -12,10 +12,10 @@ contract C { } } // ---- -// Warning: (123-128): Assertion checker does not yet implement this type of function call. -// Warning: (152-197): Assertion checker does not yet support the type of this variable. -// Warning: (212-214): Assertion checker does not yet implement type function (function (uint256)) -// Warning: (212-219): Assertion checker does not yet implement this type of function call. -// Warning: (255-257): Internal error: Expression undefined for SMT solver. -// Warning: (255-257): Assertion checker does not yet implement type function (function (uint256)) -// Warning: (212-219): Assertion checker does not yet implement this type of function call. +// Warning 5729: (123-128): Assertion checker does not yet implement this type of function call. +// Warning 8115: (152-197): Assertion checker does not yet support the type of this variable. +// Warning 8364: (212-214): Assertion checker does not yet implement type function (function (uint256)) +// Warning 5729: (212-219): Assertion checker does not yet implement this type of function call. +// Warning 6031: (255-257): Internal error: Expression undefined for SMT solver. +// Warning 8364: (255-257): Assertion checker does not yet implement type function (function (uint256)) +// Warning 5729: (212-219): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/types/function_type_nested_return.sol b/test/libsolidity/smtCheckerTests/types/function_type_nested_return.sol index d9a10370b51c..65f321656c9b 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_nested_return.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_nested_return.sol @@ -15,11 +15,11 @@ contract C { } } // ---- -// Warning: (195-200): Assertion checker does not yet implement this type of function call. -// Warning: (224-269): Assertion checker does not yet support the type of this variable. -// Warning: (284-286): Assertion checker does not yet implement type function (function (uint256)) -// Warning: (287-288): Assertion checker does not yet support this global variable. -// Warning: (284-291): Assertion checker does not yet implement this type of function call. -// Warning: (327-329): Internal error: Expression undefined for SMT solver. -// Warning: (327-329): Assertion checker does not yet implement type function (function (uint256)) -// Warning: (284-291): Assertion checker does not yet implement this type of function call. +// Warning 5729: (195-200): Assertion checker does not yet implement this type of function call. +// Warning 8115: (224-269): Assertion checker does not yet support the type of this variable. +// Warning 8364: (284-286): Assertion checker does not yet implement type function (function (uint256)) +// Warning 1695: (287-288): Assertion checker does not yet support this global variable. +// Warning 5729: (284-291): Assertion checker does not yet implement this type of function call. +// Warning 6031: (327-329): Internal error: Expression undefined for SMT solver. +// Warning 8364: (327-329): Assertion checker does not yet implement type function (function (uint256)) +// Warning 5729: (284-291): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol index 83c963ad77ac..e76149e2742b 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (134-153): Assertion violation happens here +// Warning 4661: (134-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_2.sol index 06d618bda2c1..75d1e092d63c 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_2.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (111-130): Assertion violation happens here +// Warning 4661: (111-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol index 6072d3f2e6e5..77f801c2c409 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (154-178): Assertion violation happens here +// Warning 4661: (154-178): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol index aed10ca1fbfa..7fb8472a2375 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (176-204): Assertion violation happens here +// Warning 4661: (176-204): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_5.sol b/test/libsolidity/smtCheckerTests/types/mapping_5.sol index 4acea501e3e9..190a736a03d0 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_5.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_5.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (125-144): Assertion violation happens here +// Warning 4661: (125-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol index 8170d67e6200..0092e4b5b2dc 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning: (266-286): Assertion violation happens here +// Warning 4661: (266-286): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol index f31192b3a71e..e061b2fecc55 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol @@ -30,12 +30,12 @@ contract C } } // ---- -// Warning: (397-417): Assertion violation happens here -// Warning: (463-481): Assertion violation happens here -// Warning: (533-557): Assertion violation happens here -// Warning: (397-417): Assertion violation happens here -// Warning: (463-481): Assertion violation happens here -// Warning: (533-557): Assertion violation happens here -// Warning: (397-417): Assertion violation happens here -// Warning: (463-481): Assertion violation happens here -// Warning: (533-557): Assertion violation happens here +// Warning 4661: (397-417): Assertion violation happens here +// Warning 4661: (463-481): Assertion violation happens here +// Warning 4661: (533-557): Assertion violation happens here +// Warning 4661: (397-417): Assertion violation happens here +// Warning 4661: (463-481): Assertion violation happens here +// Warning 4661: (533-557): Assertion violation happens here +// Warning 4661: (397-417): Assertion violation happens here +// Warning 4661: (463-481): Assertion violation happens here +// Warning 4661: (533-557): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol index e005fbef15dc..a32509d484b3 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol @@ -16,6 +16,6 @@ contract c { } } // ---- -// Warning: (166-178): Internal error: Expression undefined for SMT solver. -// Warning: (288-324): Assertion violation happens here -// Warning: (336-372): Assertion violation happens here +// Warning 6031: (166-178): Internal error: Expression undefined for SMT solver. +// Warning 4661: (288-324): Assertion violation happens here +// Warning 4661: (336-372): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol index 9aeed32b7bdf..22e3d3888ad2 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol @@ -12,4 +12,4 @@ contract c { } } // ---- -// Warning: (289-306): Assertion violation happens here +// Warning 4661: (289-306): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol index 93b249df0cba..92e15765c03d 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (119-133): Assertion violation happens here +// Warning 4661: (119-133): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol b/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol index 1bcf2a2ebcae..ec9ca8145a62 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_struct_assignment.sol @@ -11,9 +11,9 @@ contract C } } // ---- -// Warning: (140-144): Condition is always false. -// Warning: (149-156): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (159-160): Assertion checker does not yet implement type type(struct C.S storage pointer) -// Warning: (159-163): Assertion checker does not yet implement type struct C.S memory -// Warning: (159-163): Assertion checker does not yet implement this expression. -// Warning: (149-163): Assertion checker does not yet implement type struct C.S storage ref +// Warning 6838: (140-144): Condition is always false. +// Warning 8364: (149-156): Assertion checker does not yet implement type struct C.S storage ref +// Warning 8364: (159-160): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning 8364: (159-163): Assertion checker does not yet implement type struct C.S memory +// Warning 4639: (159-163): Assertion checker does not yet implement this expression. +// Warning 8364: (149-163): Assertion checker does not yet implement type struct C.S storage ref diff --git a/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol b/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol index f4d1299e9ca5..761b401c26a7 100644 --- a/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol +++ b/test/libsolidity/smtCheckerTests/types/no_effect_statements.sol @@ -10,15 +10,15 @@ contract test { } } // ---- -// Warning: (125-126): Statement has no effect. -// Warning: (130-136): Statement has no effect. -// Warning: (140-144): Statement has no effect. -// Warning: (148-152): Statement has no effect. -// Warning: (156-163): Statement has no effect. -// Warning: (125-126): Assertion checker does not yet implement type type(struct test.s storage pointer) -// Warning: (130-131): Assertion checker does not yet implement type type(struct test.s storage pointer) -// Warning: (130-136): Assertion checker does not yet implement type struct test.s memory -// Warning: (130-136): Assertion checker does not yet implement this expression. -// Warning: (140-141): Assertion checker does not yet implement type type(struct test.s storage pointer) -// Warning: (140-144): Assertion checker does not yet implement type type(struct test.s memory[7] memory) -// Warning: (156-163): Assertion checker does not yet implement type type(uint256[7] memory) +// 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: (125-126): Assertion checker does not yet implement type type(struct test.s storage pointer) +// Warning 8364: (130-131): Assertion checker does not yet implement type type(struct test.s storage pointer) +// Warning 8364: (130-136): Assertion checker does not yet implement type struct test.s memory +// Warning 4639: (130-136): Assertion checker does not yet implement this expression. +// Warning 8364: (140-141): Assertion checker does not yet implement type type(struct test.s storage pointer) +// 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) diff --git a/test/libsolidity/smtCheckerTests/types/rational_large_1.sol b/test/libsolidity/smtCheckerTests/types/rational_large_1.sol index 152b29f0904a..fe057d0bdf66 100644 --- a/test/libsolidity/smtCheckerTests/types/rational_large_1.sol +++ b/test/libsolidity/smtCheckerTests/types/rational_large_1.sol @@ -7,4 +7,4 @@ contract c { } } // ---- -// Warning: (128-142): Assertion violation happens here +// Warning 4661: (128-142): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol index 84f6c77e416c..273c43cbd978 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol @@ -19,4 +19,4 @@ contract C } } // ---- -// Warning: (362-421): Assertion violation happens here +// Warning 4661: (362-421): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol index bceddb38041b..76e274a8bfc6 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning: (123-136): Assertion violation happens here +// Warning 4661: (123-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol index 88b6b0aeaab6..134a3958749d 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol @@ -7,4 +7,4 @@ contract C uint c; } // ---- -// Warning: (84-97): Assertion violation happens here +// Warning 4661: (84-97): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_1.sol b/test/libsolidity/smtCheckerTests/types/string_1.sol index 2f2f644886e5..a71420074376 100644 --- a/test/libsolidity/smtCheckerTests/types/string_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_1.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (110-154): Assertion violation happens here +// Warning 4661: (110-154): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_2.sol b/test/libsolidity/smtCheckerTests/types/string_2.sol index 44909afd54da..15664c32ef90 100644 --- a/test/libsolidity/smtCheckerTests/types/string_2.sol +++ b/test/libsolidity/smtCheckerTests/types/string_2.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (76-91): Unused local variable. +// Warning 2072: (76-91): Unused local variable. diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol index 2e805ab7e8a2..592ed1d0172a 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning: (175-190): Assertion violation happens here +// Warning 4661: (175-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol index bd9efea5e373..3d11c4e22f4d 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (176-191): Assertion violation happens here +// Warning 4661: (176-191): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol index 730f05cd5d65..e2a770305a0f 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (186-201): Assertion violation happens here +// Warning 4661: (186-201): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol index 5c1ae89b98af..70d922f0ef67 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol @@ -15,4 +15,4 @@ contract C { } } // ---- -// Warning: (261-276): Assertion violation happens here +// Warning 4661: (261-276): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol index 6682466472fd..ee3418da4f92 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning: (251-266): Assertion violation happens here +// Warning 4661: (251-266): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol index 5f79de141666..f3f57304eea7 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning: (170-190): Assertion violation happens here +// Warning 4661: (170-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol index afb9a9ea0ac1..c54a8ce6a729 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// Warning: (147-166): Assertion violation happens here -// Warning: (170-190): Assertion violation happens here +// Warning 4661: (147-166): Assertion violation happens here +// Warning 4661: (170-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_1.sol b/test/libsolidity/smtCheckerTests/types/struct_1.sol index 89c10c73cb3f..e58d5c18fa79 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_1.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_1.sol @@ -14,13 +14,13 @@ contract C } } // ---- -// Warning: (157-170): Unused local variable. -// Warning: (157-170): Assertion checker does not yet support the type of this variable. -// Warning: (139-146): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (149-150): Assertion checker does not yet implement type type(struct C.S storage pointer) -// Warning: (149-153): Assertion checker does not yet implement type struct C.S memory -// Warning: (149-153): Assertion checker does not yet implement this expression. -// Warning: (139-153): Assertion checker does not yet implement type struct C.S storage ref -// Warning: (173-174): Assertion checker does not yet implement type type(struct C.S storage pointer) -// Warning: (173-177): Assertion checker does not yet implement type struct C.S memory -// Warning: (173-177): Assertion checker does not yet implement this expression. +// Warning 2072: (157-170): Unused local variable. +// Warning 8115: (157-170): Assertion checker does not yet support the type of this variable. +// Warning 8364: (139-146): Assertion checker does not yet implement type struct C.S storage ref +// Warning 8364: (149-150): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning 8364: (149-153): Assertion checker does not yet implement type struct C.S memory +// Warning 4639: (149-153): Assertion checker does not yet implement this expression. +// Warning 8364: (139-153): Assertion checker does not yet implement type struct C.S storage ref +// Warning 8364: (173-174): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning 8364: (173-177): Assertion checker does not yet implement type struct C.S memory +// Warning 4639: (173-177): Assertion checker does not yet implement this expression. diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol index 295e98788e2b..e20bdd6326e6 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol @@ -14,21 +14,21 @@ contract C } } // ---- -// Warning: (71-197): Function state mutability can be restricted to pure -// Warning: (101-111): Assertion checker does not yet support the type of this variable. -// Warning: (115-118): Assertion checker does not yet support this expression. -// Warning: (115-116): Assertion checker does not yet implement type struct C.S memory -// Warning: (115-121): Assertion checker does not yet implement this expression. -// Warning: (115-121): Assertion checker does not yet implement this expression. -// Warning: (139-142): Assertion checker does not yet support this expression. -// Warning: (139-140): Assertion checker does not yet implement type struct C.S memory -// Warning: (139-145): Assertion checker does not yet implement this expression. -// Warning: (139-145): Assertion checker does not yet implement this expression. -// Warning: (161-164): Assertion checker does not yet support this expression. -// Warning: (161-162): Assertion checker does not yet implement type struct C.S memory -// Warning: (161-167): Assertion checker does not yet implement this expression. -// Warning: (161-167): Assertion checker does not yet implement this expression. -// Warning: (182-185): Assertion checker does not yet support this expression. -// Warning: (182-183): Assertion checker does not yet implement type struct C.S memory -// Warning: (182-188): Assertion checker does not yet implement this expression. -// Warning: (175-193): Assertion violation happens here +// Warning 2018: (71-197): Function state mutability can be restricted to pure +// Warning 8115: (101-111): Assertion checker does not yet support the type of this variable. +// Warning 7650: (115-118): Assertion checker does not yet support this expression. +// Warning 8364: (115-116): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (115-121): Assertion checker does not yet implement this expression. +// Warning 9056: (115-121): Assertion checker does not yet implement this expression. +// Warning 7650: (139-142): Assertion checker does not yet support this expression. +// Warning 8364: (139-140): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (139-145): Assertion checker does not yet implement this expression. +// Warning 9056: (139-145): Assertion checker does not yet implement this expression. +// Warning 7650: (161-164): Assertion checker does not yet support this expression. +// Warning 8364: (161-162): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (161-167): Assertion checker does not yet implement this expression. +// Warning 9056: (161-167): Assertion checker does not yet implement this expression. +// Warning 7650: (182-185): Assertion checker does not yet support this expression. +// Warning 8364: (182-183): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (182-188): Assertion checker does not yet implement this expression. +// Warning 4661: (175-193): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol index fe5fca87f2e6..9d10d0f69cae 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol @@ -14,21 +14,21 @@ contract C } } // ---- -// Warning: (73-211): Function state mutability can be restricted to pure -// Warning: (103-113): Assertion checker does not yet support the type of this variable. -// Warning: (117-120): Assertion checker does not yet support this expression. -// Warning: (117-118): Assertion checker does not yet implement type struct C.S memory -// Warning: (117-123): Assertion checker does not yet implement this expression. -// Warning: (117-126): Assertion checker does not yet implement this expression. -// Warning: (144-147): Assertion checker does not yet support this expression. -// Warning: (144-145): Assertion checker does not yet implement type struct C.S memory -// Warning: (144-150): Assertion checker does not yet implement this expression. -// Warning: (144-153): Assertion checker does not yet implement this expression. -// Warning: (169-172): Assertion checker does not yet support this expression. -// Warning: (169-170): Assertion checker does not yet implement type struct C.S memory -// Warning: (169-175): Assertion checker does not yet implement this expression. -// Warning: (169-178): Assertion checker does not yet implement this expression. -// Warning: (193-196): Assertion checker does not yet support this expression. -// Warning: (193-194): Assertion checker does not yet implement type struct C.S memory -// Warning: (193-199): Assertion checker does not yet implement this expression. -// Warning: (186-207): Assertion violation happens here +// Warning 2018: (73-211): Function state mutability can be restricted to pure +// Warning 8115: (103-113): Assertion checker does not yet support the type of this variable. +// Warning 7650: (117-120): Assertion checker does not yet support this expression. +// Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (117-123): Assertion checker does not yet implement this expression. +// Warning 9056: (117-126): Assertion checker does not yet implement this expression. +// Warning 7650: (144-147): Assertion checker does not yet support this expression. +// Warning 8364: (144-145): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (144-150): Assertion checker does not yet implement this expression. +// Warning 9056: (144-153): Assertion checker does not yet implement this expression. +// Warning 7650: (169-172): Assertion checker does not yet support this expression. +// Warning 8364: (169-170): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (169-175): Assertion checker does not yet implement this expression. +// Warning 9056: (169-178): Assertion checker does not yet implement this expression. +// Warning 7650: (193-196): Assertion checker does not yet support this expression. +// Warning 8364: (193-194): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (193-199): Assertion checker does not yet implement this expression. +// Warning 4661: (186-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol index c91e163ba175..f537d39df835 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol @@ -14,20 +14,20 @@ contract C } } // ---- -// Warning: (110-120): Assertion checker does not yet support the type of this variable. -// Warning: (124-127): Assertion checker does not yet support this expression. -// Warning: (124-125): Assertion checker does not yet implement type struct C.S memory -// Warning: (124-130): Assertion checker does not yet implement this expression. -// Warning: (124-136): Assertion checker does not yet implement this expression. -// Warning: (154-157): Assertion checker does not yet support this expression. -// Warning: (154-155): Assertion checker does not yet implement type struct C.S memory -// Warning: (154-160): Assertion checker does not yet implement this expression. -// Warning: (154-166): Assertion checker does not yet implement this expression. -// Warning: (182-185): Assertion checker does not yet support this expression. -// Warning: (182-183): Assertion checker does not yet implement type struct C.S memory -// Warning: (182-188): Assertion checker does not yet implement this expression. -// Warning: (182-194): Assertion checker does not yet implement this expression. -// Warning: (209-212): Assertion checker does not yet support this expression. -// Warning: (209-210): Assertion checker does not yet implement type struct C.S memory -// Warning: (209-215): Assertion checker does not yet implement this expression. -// Warning: (202-226): Assertion violation happens here +// Warning 8115: (110-120): Assertion checker does not yet support the type of this variable. +// Warning 7650: (124-127): Assertion checker does not yet support this expression. +// Warning 8364: (124-125): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (124-130): Assertion checker does not yet implement this expression. +// Warning 9056: (124-136): Assertion checker does not yet implement this expression. +// Warning 7650: (154-157): Assertion checker does not yet support this expression. +// Warning 8364: (154-155): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (154-160): Assertion checker does not yet implement this expression. +// Warning 9056: (154-166): Assertion checker does not yet implement this expression. +// Warning 7650: (182-185): Assertion checker does not yet support this expression. +// Warning 8364: (182-183): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (182-188): Assertion checker does not yet implement this expression. +// Warning 9056: (182-194): Assertion checker does not yet implement this expression. +// Warning 7650: (209-212): Assertion checker does not yet support this expression. +// Warning 8364: (209-210): Assertion checker does not yet implement type struct C.S memory +// Warning 9118: (209-215): Assertion checker does not yet implement this expression. +// Warning 4661: (202-226): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol index fcdbf816d7be..c7b7cdc45589 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (136-153): Assertion violation happens here +// Warning 4661: (136-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol index 68b4f9d680d7..06f9263f70f4 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (122-136): Assertion violation happens here +// Warning 4661: (122-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol index 79020452e311..e17a1ff590ad 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning: (132-146): Assertion violation happens here +// Warning 4661: (132-146): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_2.sol index 4ae855137ce0..0a89c9975848 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_2.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_2.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning: (152-157): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (152-157): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol index 1d4c333be3b5..b6d5ea2f1a55 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (224-234): Assertion violation happens here +// Warning 4661: (224-234): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function.sol b/test/libsolidity/smtCheckerTests/types/tuple_function.sol index 8103a02038c7..828c5514bae4 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function.sol @@ -14,5 +14,5 @@ contract C } } // ---- -// Warning: (182-196): Assertion violation happens here -// Warning: (200-214): Assertion violation happens here +// Warning 4661: (182-196): Assertion violation happens here +// Warning 4661: (200-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol index 54223bea0c99..aec7d059acd8 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning: (199-213): Assertion violation happens here +// Warning 4661: (199-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol b/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol index e76db56d1245..0f58ec650c02 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol @@ -16,5 +16,5 @@ contract C } } // ---- -// Warning: (205-219): Assertion violation happens here -// Warning: (223-237): Assertion violation happens here +// Warning 4661: (205-219): Assertion violation happens here +// Warning 4661: (223-237): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol b/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol index b6ee9fa3a83d..19b53cc3b0c8 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol @@ -14,10 +14,10 @@ contract C { } } // ---- -// Warning: (112-120): Assertion checker does not yet support the type of this variable. -// Warning: (137-138): Assertion checker does not yet implement type type(struct C.S storage pointer) -// Warning: (137-141): Assertion checker does not yet implement type struct C.S memory -// Warning: (137-141): Assertion checker does not yet implement this expression. -// Warning: (193-203): Assertion checker does not yet support the type of this variable. -// Warning: (137-141): Assertion checker does not yet implement this expression. -// Warning: (227-228): Assertion checker does not yet implement type struct C.S memory +// Warning 8115: (112-120): Assertion checker does not yet support the type of this variable. +// Warning 8364: (137-138): Assertion checker does not yet implement type type(struct C.S storage pointer) +// Warning 8364: (137-141): Assertion checker does not yet implement type struct C.S memory +// Warning 4639: (137-141): Assertion checker does not yet implement this expression. +// Warning 8115: (193-203): Assertion checker does not yet support the type of this variable. +// Warning 4639: (137-141): Assertion checker does not yet implement this expression. +// Warning 6191: (227-228): Assertion checker does not yet implement type struct C.S memory diff --git a/test/libsolidity/smtCheckerTests/types/tuple_single_element_1.sol b/test/libsolidity/smtCheckerTests/types/tuple_single_element_1.sol index f14ca9bc1579..c76a9d75142b 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_single_element_1.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_single_element_1.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (76-85): Statement has no effect. +// Warning 6133: (76-85): Statement has no effect. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_single_element_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_single_element_2.sol index 29b9c974775a..08dfa3ef045a 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_single_element_2.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_single_element_2.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (76-86): Statement has no effect. +// Warning 6133: (76-86): Statement has no effect. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_single_non_tuple_element.sol b/test/libsolidity/smtCheckerTests/types/tuple_single_non_tuple_element.sol index 2a99a552e5b1..850170d52824 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_single_non_tuple_element.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_single_non_tuple_element.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (76-79): Statement has no effect. +// Warning 6133: (76-79): Statement has no effect. diff --git a/test/libsolidity/smtCheckerTests/types/type_expression_array_2d.sol b/test/libsolidity/smtCheckerTests/types/type_expression_array_2d.sol index 2bd64030d2c1..d98fc7b5c717 100644 --- a/test/libsolidity/smtCheckerTests/types/type_expression_array_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/type_expression_array_2d.sol @@ -5,6 +5,6 @@ function f() public pure { int[][]; } } // ---- -// Warning: (73-80): Statement has no effect. -// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory) -// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory) +// Warning 6133: (73-80): Statement has no effect. +// Warning 8364: (73-78): Assertion checker does not yet implement type type(int256[] memory) +// Warning 8364: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory) diff --git a/test/libsolidity/smtCheckerTests/types/type_expression_array_3d.sol b/test/libsolidity/smtCheckerTests/types/type_expression_array_3d.sol index 3f0967caf0a4..1bd3118973a0 100644 --- a/test/libsolidity/smtCheckerTests/types/type_expression_array_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/type_expression_array_3d.sol @@ -5,7 +5,7 @@ function f() public pure { int[][][]; } } // ---- -// Warning: (73-82): Statement has no effect. -// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory) -// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory) -// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) +// Warning 6133: (73-82): Statement has no effect. +// Warning 8364: (73-78): Assertion checker does not yet implement type type(int256[] memory) +// Warning 8364: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory) +// Warning 8364: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) diff --git a/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_2d.sol b/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_2d.sol index e648b5d6dd9d..b653f8415928 100644 --- a/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_2d.sol @@ -5,7 +5,7 @@ function f() public pure { (int[][]); } } // ---- -// Warning: (73-82): Statement has no effect. -// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory) -// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory) -// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory) +// Warning 6133: (73-82): Statement has no effect. +// Warning 8364: (74-79): Assertion checker does not yet implement type type(int256[] memory) +// Warning 8364: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory) +// Warning 8364: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory) diff --git a/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_3d.sol b/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_3d.sol index 2d66a3bb2f9d..524b59ace1c7 100644 --- a/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/type_expression_tuple_array_3d.sol @@ -5,8 +5,8 @@ function f() public pure { (int[][][]); } } // ---- -// Warning: (73-84): Statement has no effect. -// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory) -// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory) -// Warning: (74-83): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) -// Warning: (73-84): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) +// Warning 6133: (73-84): Statement has no effect. +// Warning 8364: (74-79): Assertion checker does not yet implement type type(int256[] memory) +// Warning 8364: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory) +// Warning 8364: (74-83): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) +// Warning 8364: (73-84): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory) diff --git a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_1.sol b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_1.sol index b9fae4ee0364..00060c778264 100644 --- a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_1.sol +++ b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_1.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// Warning: (94-100): Condition is always true. -// Warning: (104-112): Assertion checker does not yet implement this type of function call. +// Warning 6838: (94-100): Condition is always true. +// Warning 4588: (104-112): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_2.sol b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_2.sol index aaa613eab1c6..9d52fa7c53a6 100644 --- a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_2.sol +++ b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_2.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// Warning: (109-115): Condition is always false. -// Warning: (119-127): Assertion checker does not yet implement this type of function call. +// Warning 6838: (109-115): Condition is always false. +// Warning 4588: (119-127): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_3.sol b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_3.sol index f22cd65e5633..ba6b7f0f6dde 100644 --- a/test/libsolidity/smtCheckerTests/verification_target/constant_condition_3.sol +++ b/test/libsolidity/smtCheckerTests/verification_target/constant_condition_3.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (136-144): Assertion checker does not yet implement this type of function call. +// Warning 4588: (136-144): Assertion checker does not yet implement this type of function call. diff --git a/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol b/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol index 8bd6e61a6cab..970a900dcad4 100644 --- a/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol +++ b/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol @@ -3,4 +3,4 @@ contract C { function f(uint a) public pure { assert(a == 2); } } // ---- -// Warning: (82-96): Assertion violation happens here +// Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/syntaxTests/abstract/abstract_contract_because_of_interface.sol b/test/libsolidity/syntaxTests/abstract/abstract_contract_because_of_interface.sol index 950e1664e74d..4851172a2169 100644 --- a/test/libsolidity/syntaxTests/abstract/abstract_contract_because_of_interface.sol +++ b/test/libsolidity/syntaxTests/abstract/abstract_contract_because_of_interface.sol @@ -4,4 +4,4 @@ interface A { contract B is A { } // ---- -// TypeError: (69-88): Contract "B" should be marked as abstract. +// TypeError 3656: (69-88): Contract "B" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol b/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol index 97365bad16fa..1c374383cb45 100644 --- a/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol +++ b/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (215-235): Cannot instantiate an abstract contract. +// TypeError 4614: (215-235): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/abstract/abstract_only.sol b/test/libsolidity/syntaxTests/abstract/abstract_only.sol index 1445324a2875..2df81582aa6e 100644 --- a/test/libsolidity/syntaxTests/abstract/abstract_only.sol +++ b/test/libsolidity/syntaxTests/abstract/abstract_only.sol @@ -1,4 +1,4 @@ abstract // ---- -// ParserError: (9-9): Expected keyword "contract", "interface" or "library". -// ParserError: (9-9): Expected identifier but got end of source +// ParserError 3515: (9-9): Expected keyword "contract", "interface" or "library". +// ParserError 2314: (9-9): Expected identifier but got end of source diff --git a/test/libsolidity/syntaxTests/abstract/abstract_without_contract.sol b/test/libsolidity/syntaxTests/abstract/abstract_without_contract.sol index 5e5e25bbe12f..b432b3ab18eb 100644 --- a/test/libsolidity/syntaxTests/abstract/abstract_without_contract.sol +++ b/test/libsolidity/syntaxTests/abstract/abstract_without_contract.sol @@ -1,3 +1,3 @@ abstract A { } // ---- -// ParserError: (9-10): Expected keyword "contract", "interface" or "library". +// ParserError 3515: (9-10): Expected keyword "contract", "interface" or "library". diff --git a/test/libsolidity/syntaxTests/abstract/interface.sol b/test/libsolidity/syntaxTests/abstract/interface.sol index 215657cabc91..74c22227a84f 100644 --- a/test/libsolidity/syntaxTests/abstract/interface.sol +++ b/test/libsolidity/syntaxTests/abstract/interface.sol @@ -1,4 +1,4 @@ interface B { } abstract interface A { } // ---- -// TypeError: (16-40): Interfaces do not need the "abstract" keyword, they are abstract implicitly. +// TypeError 9348: (16-40): Interfaces do not need the "abstract" keyword, they are abstract implicitly. diff --git a/test/libsolidity/syntaxTests/abstract/library.sol b/test/libsolidity/syntaxTests/abstract/library.sol index c2bd40edb2c0..67fd4ec03943 100644 --- a/test/libsolidity/syntaxTests/abstract/library.sol +++ b/test/libsolidity/syntaxTests/abstract/library.sol @@ -1,3 +1,3 @@ abstract library A { } // ---- -// TypeError: (0-22): Libraries cannot be abstract. +// TypeError 9571: (0-22): Libraries cannot be abstract. diff --git a/test/libsolidity/syntaxTests/abstract/unimplemented_functions.sol b/test/libsolidity/syntaxTests/abstract/unimplemented_functions.sol index efad376d84e0..d2ce28f71c12 100644 --- a/test/libsolidity/syntaxTests/abstract/unimplemented_functions.sol +++ b/test/libsolidity/syntaxTests/abstract/unimplemented_functions.sol @@ -2,4 +2,4 @@ contract A { function a() public virtual; } // ---- -// TypeError: (0-47): Contract "A" should be marked as abstract. +// TypeError 3656: (0-47): Contract "A" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/abstract/unimplemented_functions_inherited.sol b/test/libsolidity/syntaxTests/abstract/unimplemented_functions_inherited.sol index fc7f6c829b31..d71c7feee62f 100644 --- a/test/libsolidity/syntaxTests/abstract/unimplemented_functions_inherited.sol +++ b/test/libsolidity/syntaxTests/abstract/unimplemented_functions_inherited.sol @@ -4,4 +4,4 @@ abstract contract A { contract B is A { } // ---- -// TypeError: (57-76): Contract "B" should be marked as abstract. +// TypeError 3656: (57-76): Contract "B" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/array/array_pop_arg.sol b/test/libsolidity/syntaxTests/array/array_pop_arg.sol index bb7803e28b11..5d383d867417 100644 --- a/test/libsolidity/syntaxTests/array/array_pop_arg.sol +++ b/test/libsolidity/syntaxTests/array/array_pop_arg.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-76): Wrong argument count for function call: 1 arguments given but expected 0. +// TypeError 6160: (65-76): Wrong argument count for function call: 1 arguments given but expected 0. diff --git a/test/libsolidity/syntaxTests/array/calldata_assign.sol b/test/libsolidity/syntaxTests/array/calldata_assign.sol index 2720539996c6..694c9e580783 100644 --- a/test/libsolidity/syntaxTests/array/calldata_assign.sol +++ b/test/libsolidity/syntaxTests/array/calldata_assign.sol @@ -3,4 +3,4 @@ contract Test { function f(uint256[] calldata s) external { s[0] = 4; } } // ---- -// TypeError: (98-102): Calldata arrays are read-only. +// TypeError 6182: (98-102): Calldata arrays are read-only. diff --git a/test/libsolidity/syntaxTests/array/calldata_multi_dynamic_V1.sol b/test/libsolidity/syntaxTests/array/calldata_multi_dynamic_V1.sol index 7f5cb6aa7800..c6dab54cf773 100644 --- a/test/libsolidity/syntaxTests/array/calldata_multi_dynamic_V1.sol +++ b/test/libsolidity/syntaxTests/array/calldata_multi_dynamic_V1.sol @@ -3,5 +3,5 @@ contract Test { function g(uint[][1] calldata) external { } } // ---- -// TypeError: (31-48): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. -// TypeError: (78-96): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 4957: (31-48): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 4957: (78-96): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/array/calldata_resize.sol b/test/libsolidity/syntaxTests/array/calldata_resize.sol index 298d838aaec1..36de4e724139 100644 --- a/test/libsolidity/syntaxTests/array/calldata_resize.sol +++ b/test/libsolidity/syntaxTests/array/calldata_resize.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (75-83): Member "length" is read-only and cannot be used to resize arrays. +// TypeError 7567: (75-83): Member "length" is read-only and cannot be used to resize arrays. diff --git a/test/libsolidity/syntaxTests/array/dynamic_memory_array_pop.sol b/test/libsolidity/syntaxTests/array/dynamic_memory_array_pop.sol index 5a79afc93bc7..c8e9252576cc 100644 --- a/test/libsolidity/syntaxTests/array/dynamic_memory_array_pop.sol +++ b/test/libsolidity/syntaxTests/array/dynamic_memory_array_pop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (74-82): Member "pop" is not available in uint256[] memory outside of storage. +// TypeError 4994: (74-82): Member "pop" is not available in uint256[] memory outside of storage. diff --git a/test/libsolidity/syntaxTests/array/invalid/contract_index_access.sol b/test/libsolidity/syntaxTests/array/invalid/contract_index_access.sol index 9f79f30183c4..efa8679be205 100644 --- a/test/libsolidity/syntaxTests/array/invalid/contract_index_access.sol +++ b/test/libsolidity/syntaxTests/array/invalid/contract_index_access.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-56): Index access for contracts or libraries is not possible. +// TypeError 2876: (52-56): Index access for contracts or libraries is not possible. diff --git a/test/libsolidity/syntaxTests/array/invalid/library_index_access.sol b/test/libsolidity/syntaxTests/array/invalid/library_index_access.sol index 442150c974d0..d81e36bab255 100644 --- a/test/libsolidity/syntaxTests/array/invalid/library_index_access.sol +++ b/test/libsolidity/syntaxTests/array/invalid/library_index_access.sol @@ -4,4 +4,4 @@ library C { } } // ---- -// TypeError: (51-55): Index access for contracts or libraries is not possible. +// TypeError 2876: (51-55): Index access for contracts or libraries is not possible. 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 f16ebadae355..d68ec2d42c7b 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 @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (75-90): Type too large for memory. +// TypeError 6118: (75-90): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol index 0d332bf1a3cd..c63967c38292 100644 --- a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol +++ b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol @@ -4,6 +4,6 @@ contract C { } } // ---- -// DeclarationError: (28-45): The "constant" keyword can only be used for state variables. -// TypeError: (69-72): Invalid array length, expected integer literal or constant expression. -// TypeError: (64-75): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// DeclarationError 1788: (28-45): The "constant" keyword can only be used for state variables. +// TypeError 5462: (69-72): Invalid array length, expected integer literal or constant expression. +// TypeError 6651: (64-75): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol b/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol index 1742c80dfa00..37f1948999f8 100644 --- a/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol +++ b/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol @@ -2,4 +2,4 @@ contract C { bytes32[8**90] ids; } // ---- -// TypeError: (25-30): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol index 1344574c3023..1a4e7f64ca8b 100644 --- a/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol +++ b/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol @@ -2,4 +2,4 @@ contract C { bytes32[8**90][500] ids; } // ---- -// TypeError: (25-30): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned.sol b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned.sol index 603f3ba38e5a..0c8f08e86275 100644 --- a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned.sol +++ b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// TypeError: (72-91): Member "length" is read-only and cannot be used to resize arrays. +// TypeError 7567: (72-91): Member "length" is read-only and cannot be used to resize arrays. diff --git a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_mapping.sol b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_mapping.sol index f20ae2227d13..c4a9e81bd53e 100644 --- a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_mapping.sol +++ b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_mapping.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (80-93): Member "length" is read-only and cannot be used to resize arrays. +// TypeError 7567: (80-93): Member "length" is read-only and cannot be used to resize arrays. diff --git a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_struct.sol b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_struct.sol index 465e04b13e70..179d7cf287ab 100644 --- a/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_struct.sol +++ b/test/libsolidity/syntaxTests/array/length/cannot_be_assigned_struct.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (95-105): Member "length" is read-only and cannot be used to resize arrays. +// TypeError 7567: (95-105): Member "length" is read-only and cannot be used to resize arrays. diff --git a/test/libsolidity/syntaxTests/array/length/cannot_be_function.sol b/test/libsolidity/syntaxTests/array/length/cannot_be_function.sol index 2ad97d27c9ba..61521192f7e6 100644 --- a/test/libsolidity/syntaxTests/array/length/cannot_be_function.sol +++ b/test/libsolidity/syntaxTests/array/length/cannot_be_function.sol @@ -3,4 +3,4 @@ contract C { uint[f] ids; } // ---- -// TypeError: (49-50): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (49-50): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/cannot_be_function_call.sol b/test/libsolidity/syntaxTests/array/length/cannot_be_function_call.sol index bb8cc599be86..c0decec5763c 100644 --- a/test/libsolidity/syntaxTests/array/length/cannot_be_function_call.sol +++ b/test/libsolidity/syntaxTests/array/length/cannot_be_function_call.sol @@ -4,4 +4,4 @@ contract C { uint[LEN] ids; } // ---- -// TypeError: (84-87): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (84-87): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/complex_cyclic_constant.sol b/test/libsolidity/syntaxTests/array/length/complex_cyclic_constant.sol index ee1070787b9e..38018165ce05 100644 --- a/test/libsolidity/syntaxTests/array/length/complex_cyclic_constant.sol +++ b/test/libsolidity/syntaxTests/array/length/complex_cyclic_constant.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (36-39): Cyclic constant definition (or maximum recursion depth exhausted). +// TypeError 5210: (36-39): Cyclic constant definition (or maximum recursion depth exhausted). diff --git a/test/libsolidity/syntaxTests/array/length/const_cannot_be_fractional.sol b/test/libsolidity/syntaxTests/array/length/const_cannot_be_fractional.sol index 397bbbcd8427..ca200cdd09e5 100644 --- a/test/libsolidity/syntaxTests/array/length/const_cannot_be_fractional.sol +++ b/test/libsolidity/syntaxTests/array/length/const_cannot_be_fractional.sol @@ -3,4 +3,4 @@ contract C { uint[L] ids; } // ---- -// TypeError: (51-52): Array with fractional length specified. +// TypeError 3208: (51-52): Array with fractional length specified. diff --git a/test/libsolidity/syntaxTests/array/length/cyclic_constant.sol b/test/libsolidity/syntaxTests/array/length/cyclic_constant.sol index 3adc0e9ba68d..08a5f1cf904f 100644 --- a/test/libsolidity/syntaxTests/array/length/cyclic_constant.sol +++ b/test/libsolidity/syntaxTests/array/length/cyclic_constant.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (37-40): Cyclic constant definition (or maximum recursion depth exhausted). +// TypeError 5210: (37-40): Cyclic constant definition (or maximum recursion depth exhausted). 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 fd8f307824e9..0b5ceafab64e 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 @@ -7,9 +7,9 @@ contract C { function e() public pure returns(string[0][500] memory) {} } // ---- -// TypeError: (52-53): Array with zero length specified. -// TypeError: (111-112): Array with zero length specified. -// TypeError: (170-171): Array with zero length specified. -// TypeError: (232-233): Array with zero length specified. -// TypeError: (292-293): Array with zero length specified. -// TypeError: (353-354): Array with zero length specified. +// 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. 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 b38939e39686..cd7b8e47ae66 100644 --- a/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol +++ b/test/libsolidity/syntaxTests/array/length/fixed_size_zero_length.sol @@ -7,9 +7,9 @@ contract C { string[0] f; } // ---- -// TypeError: (19-20): Array with zero length specified. -// TypeError: (32-33): Array with zero length specified. -// TypeError: (45-46): Array with zero length specified. -// TypeError: (61-62): Array with zero length specified. -// TypeError: (75-76): Array with zero length specified. -// TypeError: (90-91): Array with zero length specified. +// 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. diff --git a/test/libsolidity/syntaxTests/array/length/inline_array.sol b/test/libsolidity/syntaxTests/array/length/inline_array.sol index a30745d32a16..71e738804766 100644 --- a/test/libsolidity/syntaxTests/array/length/inline_array.sol +++ b/test/libsolidity/syntaxTests/array/length/inline_array.sol @@ -2,4 +2,4 @@ contract C { uint[[2]] a15; } // ---- -// TypeError: (22-25): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-25): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/invalid_expression_1.sol b/test/libsolidity/syntaxTests/array/length/invalid_expression_1.sol index c92861eb4e69..14fc21ac173f 100644 --- a/test/libsolidity/syntaxTests/array/length/invalid_expression_1.sol +++ b/test/libsolidity/syntaxTests/array/length/invalid_expression_1.sol @@ -2,4 +2,4 @@ contract C { uint[-true] ids; } // ---- -// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/invalid_expression_2.sol b/test/libsolidity/syntaxTests/array/length/invalid_expression_2.sol index 92e3c3cfb614..5cb91b94229e 100644 --- a/test/libsolidity/syntaxTests/array/length/invalid_expression_2.sol +++ b/test/libsolidity/syntaxTests/array/length/invalid_expression_2.sol @@ -2,4 +2,4 @@ contract C { uint[true/1] ids; } // ---- -// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/invalid_expression_3.sol b/test/libsolidity/syntaxTests/array/length/invalid_expression_3.sol index 26add45cad1b..dbedaaa3b766 100644 --- a/test/libsolidity/syntaxTests/array/length/invalid_expression_3.sol +++ b/test/libsolidity/syntaxTests/array/length/invalid_expression_3.sol @@ -2,4 +2,4 @@ contract C { uint[1/true] ids; } // ---- -// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/invalid_expression_4.sol b/test/libsolidity/syntaxTests/array/length/invalid_expression_4.sol index a0d58f4a970b..dc588eb4b8f8 100644 --- a/test/libsolidity/syntaxTests/array/length/invalid_expression_4.sol +++ b/test/libsolidity/syntaxTests/array/length/invalid_expression_4.sol @@ -2,4 +2,4 @@ contract C { uint[1.111111E1111111111111] ids; } // ---- -// TypeError: (22-44): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-44): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/invalid_expression_5.sol b/test/libsolidity/syntaxTests/array/length/invalid_expression_5.sol index 38a80867d665..4e8b76d711b3 100644 --- a/test/libsolidity/syntaxTests/array/length/invalid_expression_5.sol +++ b/test/libsolidity/syntaxTests/array/length/invalid_expression_5.sol @@ -2,4 +2,4 @@ contract C { uint[3/0] ids; } // ---- -// TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0 +// TypeError 6020: (22-25): Operator / not compatible with types int_const 3 and int_const 0 diff --git a/test/libsolidity/syntaxTests/array/length/local_memory_too_large.sol b/test/libsolidity/syntaxTests/array/length/local_memory_too_large.sol index 9e0d6d62d5c9..c9ab030a4d81 100644 --- a/test/libsolidity/syntaxTests/array/length/local_memory_too_large.sol +++ b/test/libsolidity/syntaxTests/array/length/local_memory_too_large.sol @@ -8,7 +8,7 @@ contract C { } } // ---- -// TypeError: (48-90): Type too large for memory. -// TypeError: (96-118): Type too large for memory. -// TypeError: (124-153): Type too large for memory. -// TypeError: (159-188): Type too large for memory. +// TypeError 1534: (48-90): Type too large for memory. +// TypeError 1534: (96-118): Type too large for memory. +// TypeError 1534: (124-153): Type too large for memory. +// TypeError 1534: (159-188): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/non_integer_constant_var.sol b/test/libsolidity/syntaxTests/array/length/non_integer_constant_var.sol index 7a853a345604..0a9e82443754 100644 --- a/test/libsolidity/syntaxTests/array/length/non_integer_constant_var.sol +++ b/test/libsolidity/syntaxTests/array/length/non_integer_constant_var.sol @@ -3,4 +3,4 @@ contract C { uint[LEN] ids; } // ---- -// TypeError: (52-55): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (52-55): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/not_convertible_to_integer.sol b/test/libsolidity/syntaxTests/array/length/not_convertible_to_integer.sol index b44ccfe9318c..b32e6232aee4 100644 --- a/test/libsolidity/syntaxTests/array/length/not_convertible_to_integer.sol +++ b/test/libsolidity/syntaxTests/array/length/not_convertible_to_integer.sol @@ -2,4 +2,4 @@ contract C { uint[true] ids; } // ---- -// TypeError: (22-26): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-26): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol index 7c7cf4fa0f8d..5426af5d2eb1 100644 --- a/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol @@ -2,4 +2,4 @@ contract C { function f(bytes32[1263941234127518272] memory) public pure {} } // ---- -// TypeError: (26-61): Type too large for memory. +// TypeError 1534: (26-61): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol index 737c99feb8ac..00a302252e54 100644 --- a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol @@ -5,7 +5,7 @@ contract C { function f(uint[2**16][2**16][] memory) public pure {} } // ---- -// TypeError: (26-66): Type too large for memory. -// TypeError: (96-116): Type too large for memory. -// TypeError: (146-173): Type too large for memory. -// TypeError: (203-230): Type too large for memory. +// TypeError 1534: (26-66): Type too large for memory. +// TypeError 1534: (96-116): Type too large for memory. +// TypeError 1534: (146-173): Type too large for memory. +// TypeError 1534: (203-230): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol index 26a683aa7b32..a837d1b5f0a0 100644 --- a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol +++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol @@ -5,5 +5,5 @@ contract C { function f(uint[2**30][2**30][][] memory) public pure {} } // ---- -// TypeError: (61-101): Type too large for memory. -// TypeError: (131-160): Type too large for memory. +// TypeError 1534: (61-101): Type too large for memory. +// TypeError 1534: (131-160): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/array/length/pure_functions.sol b/test/libsolidity/syntaxTests/array/length/pure_functions.sol index b620db76348c..dc9b4a872779 100644 --- a/test/libsolidity/syntaxTests/array/length/pure_functions.sol +++ b/test/libsolidity/syntaxTests/array/length/pure_functions.sol @@ -3,4 +3,4 @@ contract C { uint[LEN] ids; } // ---- -// TypeError: (72-75): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (72-75): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/too_large.sol b/test/libsolidity/syntaxTests/array/length/too_large.sol index c90a7494e663..687e80303c80 100644 --- a/test/libsolidity/syntaxTests/array/length/too_large.sol +++ b/test/libsolidity/syntaxTests/array/length/too_large.sol @@ -2,4 +2,4 @@ contract C { uint[8**90] ids; } // ---- -// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/tuples.sol b/test/libsolidity/syntaxTests/array/length/tuples.sol index bc10b3b5de4f..9d90798506e1 100644 --- a/test/libsolidity/syntaxTests/array/length/tuples.sol +++ b/test/libsolidity/syntaxTests/array/length/tuples.sol @@ -2,4 +2,4 @@ contract C { uint[(1,2)] a15; } // ---- -// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol index 901bc28afb6f..6ea3eda5050f 100644 --- a/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol +++ b/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol @@ -2,4 +2,4 @@ contract C { uint[8**90][500] ids; } // ---- -// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/new_no_parentheses.sol b/test/libsolidity/syntaxTests/array/new_no_parentheses.sol index d42c75539756..99287f8fc5ef 100644 --- a/test/libsolidity/syntaxTests/array/new_no_parentheses.sol +++ b/test/libsolidity/syntaxTests/array/new_no_parentheses.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (60-67): Length has to be placed in parentheses after the array type for new expression. +// TypeError 3904: (60-67): Length has to be placed in parentheses after the array type for new expression. diff --git a/test/libsolidity/syntaxTests/array/no_array_pop.sol b/test/libsolidity/syntaxTests/array/no_array_pop.sol index 79a68ef1235a..a53a195993b6 100644 --- a/test/libsolidity/syntaxTests/array/no_array_pop.sol +++ b/test/libsolidity/syntaxTests/array/no_array_pop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (63-71): Member "pop" not found or not visible after argument-dependent lookup in uint256. +// TypeError 9582: (63-71): Member "pop" not found or not visible after argument-dependent lookup in uint256. diff --git a/test/libsolidity/syntaxTests/array/pop/calldata_pop.sol b/test/libsolidity/syntaxTests/array/pop/calldata_pop.sol index ca11428ee363..03f038eed219 100644 --- a/test/libsolidity/syntaxTests/array/pop/calldata_pop.sol +++ b/test/libsolidity/syntaxTests/array/pop/calldata_pop.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (66-71): Member "pop" is not available in uint256[] calldata outside of storage. +// TypeError 4994: (66-71): Member "pop" is not available in uint256[] calldata outside of storage. diff --git a/test/libsolidity/syntaxTests/array/pop/memory_pop.sol b/test/libsolidity/syntaxTests/array/pop/memory_pop.sol index 8984341aa432..96235dcb0773 100644 --- a/test/libsolidity/syntaxTests/array/pop/memory_pop.sol +++ b/test/libsolidity/syntaxTests/array/pop/memory_pop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (72-77): Member "pop" is not available in uint256[] memory outside of storage. +// TypeError 4994: (72-77): Member "pop" is not available in uint256[] memory outside of storage. diff --git a/test/libsolidity/syntaxTests/array/push/calldata_push.sol b/test/libsolidity/syntaxTests/array/push/calldata_push.sol index fb46bf328e59..30f34455583d 100644 --- a/test/libsolidity/syntaxTests/array/push/calldata_push.sol +++ b/test/libsolidity/syntaxTests/array/push/calldata_push.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (66-72): Member "push" is not available in uint256[] calldata outside of storage. +// TypeError 4994: (66-72): Member "push" is not available in uint256[] calldata outside of storage. diff --git a/test/libsolidity/syntaxTests/array/push/memory_push.sol b/test/libsolidity/syntaxTests/array/push/memory_push.sol index 5e0890e63375..446d7576f073 100644 --- a/test/libsolidity/syntaxTests/array/push/memory_push.sol +++ b/test/libsolidity/syntaxTests/array/push/memory_push.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (72-78): Member "push" is not available in uint256[] memory outside of storage. +// TypeError 4994: (72-78): Member "push" is not available in uint256[] memory outside of storage. diff --git a/test/libsolidity/syntaxTests/array/slice/assign_to_storage.sol b/test/libsolidity/syntaxTests/array/slice/assign_to_storage.sol index 7b443949a668..12fd827105ca 100644 --- a/test/libsolidity/syntaxTests/array/slice/assign_to_storage.sol +++ b/test/libsolidity/syntaxTests/array/slice/assign_to_storage.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// TypeError: (63-74): Type bytes calldata slice is not implicitly convertible to expected type bytes storage ref. +// TypeError 7407: (63-74): Type bytes calldata slice is not implicitly convertible to expected type bytes storage ref. diff --git a/test/libsolidity/syntaxTests/array/slice/bytes_memory.sol b/test/libsolidity/syntaxTests/array/slice/bytes_memory.sol index c2bfc4f6213d..c75f27c63fc2 100644 --- a/test/libsolidity/syntaxTests/array/slice/bytes_memory.sol +++ b/test/libsolidity/syntaxTests/array/slice/bytes_memory.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (66-72): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (66-72): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/bytes_storage.sol b/test/libsolidity/syntaxTests/array/slice/bytes_storage.sol index dd7ed0893594..a42193d618de 100644 --- a/test/libsolidity/syntaxTests/array/slice/bytes_storage.sol +++ b/test/libsolidity/syntaxTests/array/slice/bytes_storage.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-71): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (65-71): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_convert_to_memory.sol b/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_convert_to_memory.sol index a3e2fccc1cc8..76a36075488f 100644 --- a/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_convert_to_memory.sol +++ b/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_convert_to_memory.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (65-88): Type bytes calldata slice is not implicitly convertible to expected type bytes memory. +// TypeError 9574: (65-88): Type bytes calldata slice is not implicitly convertible to expected type bytes memory. diff --git a/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_forward.sol b/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_forward.sol index a2d6e0f02183..ccb70bbbde40 100644 --- a/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_forward.sol +++ b/test/libsolidity/syntaxTests/array/slice/calldata_dynamic_forward.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (79-85): Invalid type for argument in function call. Invalid implicit conversion from bytes calldata slice to bytes memory requested. +// TypeError 9553: (79-85): Invalid type for argument in function call. Invalid implicit conversion from bytes calldata slice to bytes memory requested. diff --git a/test/libsolidity/syntaxTests/array/slice/calldata_static.sol b/test/libsolidity/syntaxTests/array/slice/calldata_static.sol index 0fca7ff3c218..c78e2a12e16c 100644 --- a/test/libsolidity/syntaxTests/array/slice/calldata_static.sol +++ b/test/libsolidity/syntaxTests/array/slice/calldata_static.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (76-82): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (76-82): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/member_access.sol b/test/libsolidity/syntaxTests/array/slice/member_access.sol index e3f09cae8b5a..1abcf4b45b96 100644 --- a/test/libsolidity/syntaxTests/array/slice/member_access.sol +++ b/test/libsolidity/syntaxTests/array/slice/member_access.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (92-100): Member "a" not found or not visible after argument-dependent lookup in uint256[] calldata slice. +// TypeError 9582: (92-100): Member "a" not found or not visible after argument-dependent lookup in uint256[] calldata slice. diff --git a/test/libsolidity/syntaxTests/array/slice/memory_dynamic.sol b/test/libsolidity/syntaxTests/array/slice/memory_dynamic.sol index d6dbbc2706fd..0a881ef62363 100644 --- a/test/libsolidity/syntaxTests/array/slice/memory_dynamic.sol +++ b/test/libsolidity/syntaxTests/array/slice/memory_dynamic.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (70-76): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (70-76): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/memory_static.sol b/test/libsolidity/syntaxTests/array/slice/memory_static.sol index dc12cb660ca1..89f49ed963af 100644 --- a/test/libsolidity/syntaxTests/array/slice/memory_static.sol +++ b/test/libsolidity/syntaxTests/array/slice/memory_static.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (72-78): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (72-78): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/slice_literal.sol b/test/libsolidity/syntaxTests/array/slice/slice_literal.sol index 9164c10db4d7..50fc27bbb9be 100644 --- a/test/libsolidity/syntaxTests/array/slice/slice_literal.sol +++ b/test/libsolidity/syntaxTests/array/slice/slice_literal.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-57): Index range access is only possible for arrays and array slices. +// TypeError 4781: (52-57): Index range access is only possible for arrays and array slices. diff --git a/test/libsolidity/syntaxTests/array/slice/slice_memory_bytes.sol b/test/libsolidity/syntaxTests/array/slice/slice_memory_bytes.sol index 88e7f0596a7f..6b93721fc401 100644 --- a/test/libsolidity/syntaxTests/array/slice/slice_memory_bytes.sol +++ b/test/libsolidity/syntaxTests/array/slice/slice_memory_bytes.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (76-82): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (76-82): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/slice_memory_string.sol b/test/libsolidity/syntaxTests/array/slice/slice_memory_string.sol index cb0b1f4c396b..cfb1da8b52a4 100644 --- a/test/libsolidity/syntaxTests/array/slice/slice_memory_string.sol +++ b/test/libsolidity/syntaxTests/array/slice/slice_memory_string.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (77-83): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (77-83): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/slice_string.sol b/test/libsolidity/syntaxTests/array/slice/slice_string.sol index 593fbe9fa4c3..40b4c13cc088 100644 --- a/test/libsolidity/syntaxTests/array/slice/slice_string.sol +++ b/test/libsolidity/syntaxTests/array/slice/slice_string.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-58): Index range access is only possible for arrays and array slices. +// TypeError 4781: (52-58): Index range access is only possible for arrays and array slices. diff --git a/test/libsolidity/syntaxTests/array/slice/storage_dynamic.sol b/test/libsolidity/syntaxTests/array/slice/storage_dynamic.sol index c02afd55a8aa..270209550197 100644 --- a/test/libsolidity/syntaxTests/array/slice/storage_dynamic.sol +++ b/test/libsolidity/syntaxTests/array/slice/storage_dynamic.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (69-75): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (69-75): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/slice/storage_static.sol b/test/libsolidity/syntaxTests/array/slice/storage_static.sol index 77d619d777d8..415276c18f5d 100644 --- a/test/libsolidity/syntaxTests/array/slice/storage_static.sol +++ b/test/libsolidity/syntaxTests/array/slice/storage_static.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (71-77): Index range access is only supported for dynamic calldata arrays. +// TypeError 1227: (71-77): Index range access is only supported for dynamic calldata arrays. diff --git a/test/libsolidity/syntaxTests/array/static_storage_array_pop.sol b/test/libsolidity/syntaxTests/array/static_storage_array_pop.sol index 8414f43dd69d..178a22e153c3 100644 --- a/test/libsolidity/syntaxTests/array/static_storage_array_pop.sol +++ b/test/libsolidity/syntaxTests/array/static_storage_array_pop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (66-74): Member "pop" not found or not visible after argument-dependent lookup in uint256[3] storage ref. +// TypeError 9582: (66-74): Member "pop" not found or not visible after argument-dependent lookup in uint256[3] storage ref. diff --git a/test/libsolidity/syntaxTests/array/string_pop.sol b/test/libsolidity/syntaxTests/array/string_pop.sol index 700fda16a899..d4a5f725a03f 100644 --- a/test/libsolidity/syntaxTests/array/string_pop.sol +++ b/test/libsolidity/syntaxTests/array/string_pop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-73): Member "pop" not found or not visible after argument-dependent lookup in string storage ref. +// TypeError 9582: (65-73): Member "pop" not found or not visible after argument-dependent lookup in string storage ref. diff --git a/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol b/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol index 4966b4e858fa..76b49050b5c9 100644 --- a/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol +++ b/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (80-81): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (85-86): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (80-81): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (85-86): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/bound/bound_calldata.sol b/test/libsolidity/syntaxTests/bound/bound_calldata.sol index f6fcf82cbf6b..ea03a3bd6859 100644 --- a/test/libsolidity/syntaxTests/bound/bound_calldata.sol +++ b/test/libsolidity/syntaxTests/bound/bound_calldata.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (136-140): Member "f" not found or not visible after argument-dependent lookup in bytes memory. +// TypeError 9582: (136-140): Member "f" not found or not visible after argument-dependent lookup in bytes memory. diff --git a/test/libsolidity/syntaxTests/bound/bound_to_struct.sol b/test/libsolidity/syntaxTests/bound/bound_to_struct.sol index eefe9f6bf963..0e1cbddb87d2 100644 --- a/test/libsolidity/syntaxTests/bound/bound_to_struct.sol +++ b/test/libsolidity/syntaxTests/bound/bound_to_struct.sol @@ -7,4 +7,4 @@ contract C { using S for S; } // ---- -// TypeError: (113-114): Library name expected. +// TypeError 4357: (113-114): Library name expected. diff --git a/test/libsolidity/syntaxTests/bytecode_too_large.sol b/test/libsolidity/syntaxTests/bytecode_too_large.sol index ea8831e1356d..58446e0dafc3 100644 --- a/test/libsolidity/syntaxTests/bytecode_too_large.sol +++ b/test/libsolidity/syntaxTests/bytecode_too_large.sol @@ -7,4 +7,4 @@ contract test { // ==== // EVMVersion: >=spuriousDragon // ---- -// Warning: (0-27133): Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. +// Warning 5574: (0-27133): Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. diff --git a/test/libsolidity/syntaxTests/constants/addmod_mulmod_rational.sol b/test/libsolidity/syntaxTests/constants/addmod_mulmod_rational.sol index 267127356c51..741cd56ee60d 100644 --- a/test/libsolidity/syntaxTests/constants/addmod_mulmod_rational.sol +++ b/test/libsolidity/syntaxTests/constants/addmod_mulmod_rational.sol @@ -3,5 +3,5 @@ contract C { uint constant b = mulmod(3, 4, 0.1); } // ---- -// TypeError: (48-51): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested. -// TypeError: (89-92): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested. +// TypeError 9553: (48-51): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested. +// TypeError 9553: (89-92): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested. diff --git a/test/libsolidity/syntaxTests/constants/addmod_zero.sol b/test/libsolidity/syntaxTests/constants/addmod_zero.sol index 18f7d64addaa..2c5a0de49d80 100644 --- a/test/libsolidity/syntaxTests/constants/addmod_zero.sol +++ b/test/libsolidity/syntaxTests/constants/addmod_zero.sol @@ -6,6 +6,6 @@ contract c { uint constant b3 = addmod(3, 4, a2 - 1); } // ---- -// TypeError: (88-103): Arithmetic modulo zero. -// TypeError: (128-144): Arithmetic modulo zero. -// TypeError: (169-189): Arithmetic modulo zero. +// TypeError 4195: (88-103): Arithmetic modulo zero. +// TypeError 4195: (128-144): Arithmetic modulo zero. +// TypeError 4195: (169-189): Arithmetic modulo zero. diff --git a/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol b/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol index 0e242b304a8a..5f5624084d9d 100644 --- a/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol +++ b/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol @@ -3,4 +3,4 @@ contract C { uint constant y = x(); } // ---- -// TypeError: (74-77): Initial value for constant variable has to be compile-time constant. +// TypeError 8349: (74-77): Initial value for constant variable has to be compile-time constant. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol index cb553fbe409e..ebd81d4a2335 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol @@ -2,4 +2,4 @@ contract C { uint constant a = a; } // ---- -// TypeError: (17-36): The value of the constant a has a cyclic dependency via a. +// TypeError 6161: (17-36): The value of the constant a has a cyclic dependency via a. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol index 9f1d97227fe6..676f534cc66e 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol @@ -5,6 +5,6 @@ contract C { uint constant d = 2 + a; } // ---- -// TypeError: (17-40): The value of the constant a has a cyclic dependency via c. -// TypeError: (71-129): The value of the constant c has a cyclic dependency via d. -// TypeError: (135-158): The value of the constant d has a cyclic dependency via a. +// TypeError 6161: (17-40): The value of the constant a has a cyclic dependency via c. +// TypeError 6161: (71-129): The value of the constant c has a cyclic dependency via d. +// TypeError 6161: (135-158): The value of the constant d has a cyclic dependency via a. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol index 969ed50d385d..e280f4a97fdd 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol @@ -5,7 +5,7 @@ contract C { uint constant c = b; } // ---- -// TypeError: (17-36): The value of the constant x has a cyclic dependency via a. -// TypeError: (42-65): The value of the constant a has a cyclic dependency via b. -// TypeError: (71-90): The value of the constant b has a cyclic dependency via c. -// TypeError: (96-115): The value of the constant c has a cyclic dependency via b. +// TypeError 6161: (17-36): The value of the constant x has a cyclic dependency via a. +// TypeError 6161: (42-65): The value of the constant a has a cyclic dependency via b. +// TypeError 6161: (71-90): The value of the constant b has a cyclic dependency via c. +// TypeError 6161: (96-115): The value of the constant c has a cyclic dependency via b. diff --git a/test/libsolidity/syntaxTests/constants/division_by_zero.sol b/test/libsolidity/syntaxTests/constants/division_by_zero.sol index bf6000ec10bc..f734ba40cae3 100644 --- a/test/libsolidity/syntaxTests/constants/division_by_zero.sol +++ b/test/libsolidity/syntaxTests/constants/division_by_zero.sol @@ -5,5 +5,5 @@ contract c { uint constant b2 = 7 / (a2 - 1); } // ---- -// TypeError: (88-94): Division by zero. -// TypeError: (119-131): Division by zero. +// TypeError 1211: (88-94): Division by zero. +// TypeError 1211: (119-131): Division by zero. diff --git a/test/libsolidity/syntaxTests/constants/mod_zero.sol b/test/libsolidity/syntaxTests/constants/mod_zero.sol index f5e4a23ac153..0fe34b62a30f 100644 --- a/test/libsolidity/syntaxTests/constants/mod_zero.sol +++ b/test/libsolidity/syntaxTests/constants/mod_zero.sol @@ -5,5 +5,5 @@ contract c { uint constant b2 = 3 % (a2 - 1); } // ---- -// TypeError: (88-94): Modulo zero. -// TypeError: (119-131): Modulo zero. +// TypeError 1211: (88-94): Modulo zero. +// TypeError 1211: (119-131): Modulo zero. diff --git a/test/libsolidity/syntaxTests/constants/mulmod_zero.sol b/test/libsolidity/syntaxTests/constants/mulmod_zero.sol index 856d01eb9f69..5b4e69a04c52 100644 --- a/test/libsolidity/syntaxTests/constants/mulmod_zero.sol +++ b/test/libsolidity/syntaxTests/constants/mulmod_zero.sol @@ -6,6 +6,6 @@ contract c { uint constant b3 = mulmod(3, 4, a2 - 1); } // ---- -// TypeError: (88-103): Arithmetic modulo zero. -// TypeError: (128-144): Arithmetic modulo zero. -// TypeError: (169-189): Arithmetic modulo zero. +// TypeError 4195: (88-103): Arithmetic modulo zero. +// TypeError 4195: (128-144): Arithmetic modulo zero. +// TypeError 4195: (169-189): Arithmetic modulo zero. diff --git a/test/libsolidity/syntaxTests/constants/pure_non_rational.sol b/test/libsolidity/syntaxTests/constants/pure_non_rational.sol index 4b96f1c7dfbb..642ac39f733d 100644 --- a/test/libsolidity/syntaxTests/constants/pure_non_rational.sol +++ b/test/libsolidity/syntaxTests/constants/pure_non_rational.sol @@ -8,4 +8,4 @@ contract C { uint[c] mem; } // ---- -// TypeError: (392-393): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (392-393): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol b/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol index 668b2d47703d..3f989b001620 100644 --- a/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol +++ b/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol @@ -12,4 +12,4 @@ contract Parent { contract Child is Parent { } // ---- -// TypeError: (233-261): Contract "Child" should be marked as abstract. +// TypeError 3656: (233-261): Contract "Child" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol index 586329b137db..0b8f45947a8f 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol @@ -1,3 +1,3 @@ contract A { constructor() {} } // ---- -// SyntaxError: (13-29): No visibility specified. Did you intend to add "public"? +// SyntaxError 4937: (13-29): No visibility specified. Did you intend to add "public"? diff --git a/test/libsolidity/syntaxTests/constructor/constructor_old.sol b/test/libsolidity/syntaxTests/constructor/constructor_old.sol index 9ead6858aaf4..f89a9641241c 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_old.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_old.sol @@ -1,4 +1,4 @@ contract A { function A() public {} } // ---- -// SyntaxError: (13-35): Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it. -// Warning: (13-35): This declaration shadows an existing declaration. +// SyntaxError 5796: (13-35): Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it. +// Warning 2519: (13-35): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_override.sol b/test/libsolidity/syntaxTests/constructor/constructor_override.sol index 48203a27d31c..ddcafcf7a293 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_override.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_override.sol @@ -2,4 +2,4 @@ contract C { constructor() override public {} } // ---- -// TypeError: (17-49): Constructors cannot override. +// TypeError 1209: (17-49): Constructors cannot override. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol index 39bf6384f651..37bf60bb59bf 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol @@ -5,5 +5,5 @@ contract test2 { constructor() public pure {} } // ---- -// TypeError: (19-47): Constructor must be payable or non-payable, but is "view". -// TypeError: (69-97): Constructor must be payable or non-payable, but is "pure". +// TypeError 1558: (19-47): Constructor must be payable or non-payable, but is "view". +// TypeError 1558: (69-97): Constructor must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol b/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol index cd692dbcdc56..7d75eec38ced 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol @@ -2,4 +2,4 @@ contract C { constructor() virtual public {} } // ---- -// TypeError: (17-48): Constructors cannot be virtual. +// TypeError 7001: (17-48): Constructors cannot be virtual. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol index ab2d82d5611d..f2ebd21d251c 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol @@ -9,5 +9,5 @@ contract B is A { } } // ---- -// TypeError: (131-301): Contract "B" should be marked as abstract. -// TypeError: (250-254): Explicit type conversion not allowed from "string memory" to "contract A". +// TypeError 3656: (131-301): Contract "B" should be marked as abstract. +// TypeError 9640: (250-254): Explicit type conversion not allowed from "string memory" to "contract A". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol index 6bbb83ceec50..0d65fe9842f8 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol @@ -2,4 +2,4 @@ contract C { constructor() public; } // ---- -// TypeError: (14-35): Constructor must be implemented if declared. +// TypeError 5700: (14-35): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/external_constructor.sol b/test/libsolidity/syntaxTests/constructor/external_constructor.sol index 30cf0668c128..d3f21b8fa3ed 100644 --- a/test/libsolidity/syntaxTests/constructor/external_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/external_constructor.sol @@ -2,4 +2,4 @@ contract test { constructor() external {} } // ---- -// TypeError: (17-42): Constructor must be public or internal. +// TypeError 9239: (17-42): Constructor must be public or internal. diff --git a/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol b/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol index 68273c0a0c9a..e6a2ca3bea99 100644 --- a/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol @@ -2,4 +2,4 @@ contract C { function constructor() public; } // ---- -// ParserError: (26-37): This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) { ... }" without the "function" keyword to define it. +// ParserError 3323: (26-37): This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) { ... }" without the "function" keyword to define it. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol index 2511c751c508..1c03e249b08c 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol @@ -5,4 +5,4 @@ contract D { function f() public { C c = new C(); c; } } // ---- -// TypeError: (84-89): Contract with internal constructor cannot be created directly. +// TypeError 9054: (84-89): Contract with internal constructor cannot be created directly. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol index 17cb701d753b..76ba9766375c 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol @@ -10,4 +10,4 @@ contract A { constructor(address) internal {} } // ---- -// TypeError: (141-146): Contract with internal constructor cannot be created directly. +// TypeError 9054: (141-146): Contract with internal constructor cannot be created directly. diff --git a/test/libsolidity/syntaxTests/constructor/interface_constructor.sol b/test/libsolidity/syntaxTests/constructor/interface_constructor.sol index 87585a62188b..864e4e6d2d4f 100644 --- a/test/libsolidity/syntaxTests/constructor/interface_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/interface_constructor.sol @@ -2,6 +2,6 @@ interface I { constructor() public; } // ---- -// TypeError: (15-36): Functions in interfaces must be declared external. -// TypeError: (15-36): Constructor cannot be defined in interfaces. -// TypeError: (15-36): Constructor must be implemented if declared. +// TypeError 1560: (15-36): Functions in interfaces must be declared external. +// TypeError 6482: (15-36): Constructor cannot be defined in interfaces. +// TypeError 5700: (15-36): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/library_constructor.sol b/test/libsolidity/syntaxTests/constructor/library_constructor.sol index 38934f8d1662..230b144f518c 100644 --- a/test/libsolidity/syntaxTests/constructor/library_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/library_constructor.sol @@ -2,5 +2,5 @@ library Lib { constructor() public; } // ---- -// TypeError: (15-36): Constructor cannot be defined in libraries. -// TypeError: (15-36): Constructor must be implemented if declared. +// TypeError 7634: (15-36): Constructor cannot be defined in libraries. +// TypeError 5700: (15-36): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol b/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol index c89508743f2b..fa94ee4e50b3 100644 --- a/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol +++ b/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol @@ -17,7 +17,7 @@ contract C { } } // ---- -// TypeError: (235-252): Cannot set option "value", since the constructor of contract B1 is not payable. -// TypeError: (258-275): Cannot set option "value", since the constructor of contract B2 is not payable. -// TypeError: (281-298): Cannot set option "value", since the constructor of contract B3 is not payable. -// TypeError: (304-321): Cannot set option "value", since the constructor of contract B4 is not payable. +// TypeError 7006: (235-252): Cannot set option "value", since the constructor of contract B1 is not payable. +// TypeError 7006: (258-275): Cannot set option "value", since the constructor of contract B2 is not payable. +// TypeError 7006: (281-298): Cannot set option "value", since the constructor of contract B3 is not payable. +// TypeError 7006: (304-321): Cannot set option "value", since the constructor of contract B4 is not payable. diff --git a/test/libsolidity/syntaxTests/constructor/not_a_contract.sol b/test/libsolidity/syntaxTests/constructor/not_a_contract.sol index 9b05b46e3206..a9a121fe04d0 100644 --- a/test/libsolidity/syntaxTests/constructor/not_a_contract.sol +++ b/test/libsolidity/syntaxTests/constructor/not_a_contract.sol @@ -6,4 +6,4 @@ contract Test { } } // ---- -// TypeError: (147-152): Identifier is not a contract. +// TypeError 5540: (147-152): Identifier is not a contract. diff --git a/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol b/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol index 30cf3bce9cef..d33d92860acd 100644 --- a/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol @@ -6,5 +6,5 @@ contract B is A { } } // ---- -// Warning: (58-101): This declaration shadows an existing declaration. -// TypeError: (130-133): Member "f" not found or not visible after argument-dependent lookup in function () pure returns (uint8). +// Warning 2519: (58-101): This declaration shadows an existing declaration. +// TypeError 9582: (130-133): Member "f" not found or not visible after argument-dependent lookup in function () pure returns (uint8). diff --git a/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol b/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol index e6a03014efad..20920dea730f 100644 --- a/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol @@ -2,4 +2,4 @@ contract test { constructor() public returns (uint a) { } } // ---- -// TypeError: (46-54): Non-empty "returns" directive for constructor. +// TypeError 9712: (46-54): Non-empty "returns" directive for constructor. diff --git a/test/libsolidity/syntaxTests/constructor/two_constructors.sol b/test/libsolidity/syntaxTests/constructor/two_constructors.sol index 42c0de28f496..d44124d38bb4 100644 --- a/test/libsolidity/syntaxTests/constructor/two_constructors.sol +++ b/test/libsolidity/syntaxTests/constructor/two_constructors.sol @@ -3,4 +3,4 @@ contract test { constructor() public {} } // ---- -// DeclarationError: (47-70): More than one constructor defined. +// DeclarationError 7997: (47-70): More than one constructor defined. diff --git a/test/libsolidity/syntaxTests/constructor_this.sol b/test/libsolidity/syntaxTests/constructor_this.sol index 9d22a1618a35..7d18407dc1f1 100644 --- a/test/libsolidity/syntaxTests/constructor_this.sol +++ b/test/libsolidity/syntaxTests/constructor_this.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning: (172-176): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. -// Warning: (191-195): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (172-176): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (191-195): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/syntaxTests/controlFlow/leave_outside_function.sol b/test/libsolidity/syntaxTests/controlFlow/leave_outside_function.sol index 772a108e2151..81727b80b31c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/leave_outside_function.sol +++ b/test/libsolidity/syntaxTests/controlFlow/leave_outside_function.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// SyntaxError: (178-183): Keyword "leave" can only be used inside a function. +// SyntaxError 8149: (178-183): Keyword "leave" can only be used inside a function. diff --git a/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol index 63b434090bbe..9b155fd2d797 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localCalldataVariables/if_declaration_err.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (141-142): This variable is of calldata pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (141-142): This variable is of calldata pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol index ddb5faa9fa2b..516861a8cf01 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol @@ -31,8 +31,7 @@ contract C { } } // ---- -// TypeError: (189-190): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (340-341): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (491-492): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (642-643): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. - +// TypeError 3464: (189-190): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (340-341): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (491-492): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (642-643): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol index 1d4302755f79..13874595c3cb 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (188-189): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (188-189): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/reverting_function_declaration.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/reverting_function_declaration.sol index bba9daf34627..5b57385232b1 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/reverting_function_declaration.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/reverting_function_declaration.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// TypeError: (287-288): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (287-288): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol index 72884e74159e..c3aff356adc4 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol @@ -29,5 +29,5 @@ contract C { } } // ---- -// TypeError: (208-209): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (421-422): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (208-209): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (421-422): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_err.sol index 25654b1dda41..e939dbed220c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_err.sol @@ -55,12 +55,12 @@ contract C { } } // ---- -// TypeError: (184-185): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// Warning: (145-150): Unreachable code. -// Warning: (168-173): Unreachable code. -// TypeError: (411-412): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// Warning: (325-330): Unreachable code. -// TypeError: (635-636): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (862-863): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (1011-1012): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// Warning: (972-977): Unreachable code. +// TypeError 3464: (184-185): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (145-150): Unreachable code. +// Warning 5740: (168-173): Unreachable code. +// TypeError 3464: (411-412): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (325-330): Unreachable code. +// TypeError 3464: (635-636): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (862-863): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (1011-1012): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (972-977): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_fine.sol index 40ddc377773a..e46cfbf953bc 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/dowhile_declaration_fine.sol @@ -41,4 +41,4 @@ contract C { } } // ---- -// Warning: (606-611): Unreachable code. +// Warning 5740: (606-611): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/for_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/for_declaration_err.sol index e93d9798f215..50585d384311 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/for_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/for_declaration_err.sol @@ -16,5 +16,5 @@ contract C { } } // ---- -//TypeError: (143-144): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (261-262): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (143-144): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (261-262): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/if_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/if_declaration_err.sol index 7da6bef92e69..2787f3efbe53 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/if_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/if_declaration_err.sol @@ -18,5 +18,5 @@ contract C { } } // ---- -// TypeError: (138-139): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (330-331): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (138-139): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (330-331): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/short_circuit_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/short_circuit_declaration_err.sol index a6dd300cedad..28665925a8ea 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/short_circuit_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/short_circuit_declaration_err.sol @@ -19,6 +19,6 @@ contract C { } } // ---- -// TypeError: (137-138): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (235-236): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (398-399): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (137-138): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (235-236): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (398-399): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_assignment_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_assignment_err.sol index 2c47731aaceb..b5f79de12c5c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_assignment_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_assignment_err.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (145-146): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (145-146): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_declaration_err.sol index 3b4552f86fef..f9ee41a0a103 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/ternary_declaration_err.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// TypeError: (152-153): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (266-267): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (152-153): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (266-267): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/try_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/try_declaration_err.sol index ca43dc346fc6..6e6ec37222cc 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/try_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/try_declaration_err.sol @@ -36,7 +36,7 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// TypeError: (206-207): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (343-344): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (526-527): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (653-654): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (206-207): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (343-344): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (526-527): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (653-654): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/while_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/while_declaration_err.sol index cd6fee8dbfa8..b120554cc628 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/while_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/while_declaration_err.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (161-162): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (161-162): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol index 5add7bc720f5..050c422bf428 100644 --- a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol @@ -2,4 +2,4 @@ contract C { function f() internal pure returns (mapping(uint=>uint) storage r) { } } // ---- -// TypeError: (53-82): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (53-82): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol index 5ea1cd36f179..f8bb7d12ea3e 100644 --- a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol @@ -2,4 +2,4 @@ contract C { function f() internal pure returns (mapping(uint=>uint) storage) {} } // ---- -// TypeError: (53-80): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (53-80): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol index 909d4f333e23..f4446922876d 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol @@ -23,7 +23,7 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (228-239): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (369-380): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (510-521): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (228-239): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (369-380): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (510-521): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol index 2f79ee10f237..1bf0d25c39b6 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/reverting_function.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/reverting_function.sol index 4619584ef8d2..11d8edfb8b50 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/reverting_function.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/reverting_function.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol index 0644d4b8f48b..a0dfa5dd4b92 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol @@ -23,5 +23,5 @@ contract C { } } // ---- -// TypeError: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (256-267): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (256-267): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol index fff82c20d869..ce4d4b2621a3 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (142-195): "switch" statement with only a default case. +// Warning 9592: (142-195): "switch" statement with only a default case. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly_err.sol index 4d821ed2cdbb..0cb7fa70dad8 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly_err.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (87-96): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-96): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol index b59bed5c731d..97df2c5900d4 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol @@ -45,12 +45,12 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// Warning: (146-151): Unreachable code. -// Warning: (169-174): Unreachable code. -// TypeError: (223-234): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// Warning: (316-321): Unreachable code. -// TypeError: (440-451): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (654-665): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (871-882): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// Warning: (933-938): Unreachable code. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (146-151): Unreachable code. +// Warning 5740: (169-174): Unreachable code. +// TypeError 3464: (223-234): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (316-321): Unreachable code. +// TypeError 3464: (440-451): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (654-665): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (871-882): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// Warning 5740: (933-938): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol index 5a1136685d02..412974b6d8ae 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol @@ -29,4 +29,4 @@ contract C { } } // ---- -// Warning: (567-572): Unreachable code. +// Warning 5740: (567-572): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/for_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/for_err.sol index bf693cf89ca2..a5c741a9115e 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/for_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/for_err.sol @@ -12,5 +12,5 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (182-193): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (182-193): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/if_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/if_err.sol index 946a3f6086ab..a2649a2e3546 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/if_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/if_err.sol @@ -14,5 +14,5 @@ contract C { } } // ---- -// TypeError: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (186-197): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (186-197): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/modifier_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/modifier_err.sol index e56b7aceb6f5..bf896b86a2a6 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/modifier_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/modifier_err.sol @@ -18,5 +18,5 @@ contract C { } } // ---- -// TypeError: (249-258): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (367-376): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (249-258): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (367-376): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/short_circuit_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/short_circuit_err.sol index 5fc907184983..abad1da77723 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/short_circuit_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/short_circuit_err.sol @@ -13,6 +13,6 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (176-187): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (264-275): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (176-187): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (264-275): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/ternary_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/ternary_err.sol index 95f9623692b1..afa7881b970e 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/ternary_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/ternary_err.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (200-211): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (96-107): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (200-211): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/try_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/try_err.sol index 6f6a889c8768..6c06d70fd7b3 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/try_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/try_err.sol @@ -28,7 +28,7 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// TypeError: (113-124): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (240-251): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (367-378): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. -// TypeError: (631-632): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (113-124): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (240-251): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (367-378): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (631-632): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol index 1a910d99e3c5..eaf4cf810a2c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol @@ -8,8 +8,8 @@ abstract library T { function g() public returns(uint[] storage s); } // ---- -// TypeError: (146-268): Libraries cannot be abstract. -// TypeError: (48-92): Library functions must be implemented if declared. -// TypeError: (97-143): Library functions must be implemented if declared. -// TypeError: (171-215): Library functions must be implemented if declared. -// TypeError: (220-266): Library functions must be implemented if declared. +// TypeError 9571: (146-268): Libraries cannot be abstract. +// TypeError 9231: (48-92): Library functions must be implemented if declared. +// TypeError 9231: (97-143): Library functions must be implemented if declared. +// TypeError 9231: (171-215): Library functions must be implemented if declared. +// TypeError 9231: (220-266): Library functions must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/while_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/while_err.sol index aba70626b456..f558436fcf62 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/while_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/while_err.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (87-98): This variable is of storage pointer type and can be returned without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol index da7f1a900247..688f994c18fe 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (125-126): Unreachable code. +// Warning 5740: (125-126): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol index 89a13717e9e8..cb9f2d54c422 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (107-113): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (107-113): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_order_fail.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_order_fail.sol index f0d5bfe820f4..cb0838e4c395 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_order_fail.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_order_fail.sol @@ -5,4 +5,4 @@ contract C { function f() m1(b) m2(b = s) internal view returns (uint[] storage b) {} } // ---- -// TypeError: (129-130): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (129-130): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_post_access.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_post_access.sol index 82413011b42b..b109b4c91f42 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_post_access.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_post_access.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (120-121): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (120-121): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_pre_access.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_pre_access.sol index 31353e201259..41ce9384f25e 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_pre_access.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/modifier_pre_access.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (120-121): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (120-121): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/smoke.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/smoke.sol index 50db459ba818..f6062b9a16bd 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/smoke.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/smoke.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (94-95): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (94-95): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/struct.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/struct.sol index 38828e681af7..b11a0e96163a 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/struct.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/struct.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (109-110): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (109-110): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol index 9ebd032178ab..7dbb2403467b 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning: (112-135): Unreachable code. +// Warning 5740: (112-135): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/double_revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/double_revert.sol index 8a441a5b267d..1fc581964406 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/double_revert.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/double_revert.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// Warning: (100-112): Unreachable code. -// Warning: (222-230): Unreachable code. +// Warning 5740: (100-112): Unreachable code. +// Warning 5740: (222-230): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_break.sol index 466bf4fae504..14c75893c8e2 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_break.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_break.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning: (103-117): Unreachable code. -// Warning: (160-171): Unreachable code. +// Warning 5740: (103-117): Unreachable code. +// Warning 5740: (160-171): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_continue.sol index be09967f1a00..daf5f4818f5f 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_continue.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/for_continue.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (163-174): Unreachable code. +// Warning 5740: (163-174): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/return.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/return.sol index 9b13441b45f8..364191bb099b 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/return.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/return.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// Warning: (129-135): Unreachable code. -// Warning: (274-279): Unreachable code. +// Warning 5740: (129-135): Unreachable code. +// Warning 5740: (274-279): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/revert.sol index 66b6ae382d49..c7013ae35037 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/revert.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/assembly/revert.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// Warning: (129-135): Unreachable code. -// Warning: (274-279): Unreachable code. +// Warning 5740: (129-135): Unreachable code. +// Warning 5740: (274-279): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol index 363c53e1e1ae..bffcd43c6901 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (119-126): Unreachable code. +// Warning 5740: (119-126): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol index 9b7553474232..c2a7d6685c4a 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (85-93): Unreachable code. +// Warning 5740: (85-93): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol index a6457e4f95b1..19bbb97cc460 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (70-78): Unreachable code. +// Warning 5740: (70-78): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol index 496addb2f795..6f6a1714c53b 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning: (76-79): Unreachable code. -// Warning: (114-128): Unreachable code. +// Warning 5740: (76-79): Unreachable code. +// Warning 5740: (114-128): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol index 3513b17dee71..2fe91843691d 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (142-149): Unreachable code. +// Warning 5740: (142-149): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol index 9bb6a41cddaa..ad72077770f9 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (70-83): Unreachable code. +// Warning 5740: (70-83): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol index 4c80c5ca2d2c..bc0822c0c964 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (70-105): Unreachable code. +// Warning 5740: (70-105): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol index 2d1ddd4f1e3e..b950e2ab9d73 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning: (138-141): Unreachable code. +// Warning 5740: (138-141): Unreachable code. diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol index 55f98f67e665..7090bfbf234c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol +++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning: (100-107): Unreachable code. +// Warning 5740: (100-107): Unreachable code. diff --git a/test/libsolidity/syntaxTests/conversion/explicit_conversion_address_to_payable.sol b/test/libsolidity/syntaxTests/conversion/explicit_conversion_address_to_payable.sol index d44841fd76c7..103cb8f9d354 100644 --- a/test/libsolidity/syntaxTests/conversion/explicit_conversion_address_to_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/explicit_conversion_address_to_payable.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (169-171): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. +// TypeError 9553: (169-171): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. diff --git a/test/libsolidity/syntaxTests/conversion/explicit_conversion_from_storage_array_ref.sol b/test/libsolidity/syntaxTests/conversion/explicit_conversion_from_storage_array_ref.sol index 458adda684e5..819b8d916fae 100644 --- a/test/libsolidity/syntaxTests/conversion/explicit_conversion_from_storage_array_ref.sol +++ b/test/libsolidity/syntaxTests/conversion/explicit_conversion_from_storage_array_ref.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (55-63): Explicit type conversion not allowed from "int256[10] storage ref" to "int256[] storage pointer". -// TypeError: (67-73): Explicit type conversion not allowed from "int256[10] storage ref" to "int256". +// TypeError 9640: (55-63): Explicit type conversion not allowed from "int256[10] storage ref" to "int256[] storage pointer". +// TypeError 9640: (67-73): Explicit type conversion not allowed from "int256[10] storage ref" to "int256". diff --git a/test/libsolidity/syntaxTests/conversion/explicit_conversion_sender_to_payable.sol b/test/libsolidity/syntaxTests/conversion/explicit_conversion_sender_to_payable.sol index 141a125468f1..68a639750dd4 100644 --- a/test/libsolidity/syntaxTests/conversion/explicit_conversion_sender_to_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/explicit_conversion_sender_to_payable.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// Warning: (43-60): Unused local variable. -// Warning: (86-103): Unused local variable. +// Warning 2072: (43-60): Unused local variable. +// Warning 2072: (86-103): Unused local variable. diff --git a/test/libsolidity/syntaxTests/conversion/explicit_conversion_this_to_payable.sol b/test/libsolidity/syntaxTests/conversion/explicit_conversion_this_to_payable.sol index 7f5519cdff0c..ae98b7fabe5e 100644 --- a/test/libsolidity/syntaxTests/conversion/explicit_conversion_this_to_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/explicit_conversion_this_to_payable.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (63-76): Explicit type conversion not allowed from "contract C" to "address payable". +// TypeError 9640: (63-76): Explicit type conversion not allowed from "contract C" to "address payable". diff --git a/test/libsolidity/syntaxTests/conversion/function_cast_value_set.sol b/test/libsolidity/syntaxTests/conversion/function_cast_value_set.sol index 163724d35f22..93b90a8f9451 100644 --- a/test/libsolidity/syntaxTests/conversion/function_cast_value_set.sol +++ b/test/libsolidity/syntaxTests/conversion/function_cast_value_set.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (46-94): Type function () payable external is not implicitly convertible to expected type function () payable external. +// TypeError 9574: (46-94): Type function () payable external is not implicitly convertible to expected type function () payable external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol index 75f7a953c22c..74c754903f7b 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (105-144): Type function () external is not implicitly convertible to expected type function () payable external. +// TypeError 9574: (105-144): Type function () external is not implicitly convertible to expected type function () payable external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol index 8d1b08aa55d9..61344ac67759 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () pure external. +// TypeError 9574: (105-141): Type function () external is not implicitly convertible to expected type function () pure external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol index 535d6c77b023..c48f4cb76dc8 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () view external. +// TypeError 9574: (105-141): Type function () external is not implicitly convertible to expected type function () view external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol index 78bada5126de..b1f092b78586 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () pure external. +// TypeError 9574: (113-149): Type function () payable external is not implicitly convertible to expected type function () pure external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol b/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol index f12cb301bc61..aed9f8184e81 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () view external. +// TypeError 9574: (113-149): Type function () payable external is not implicitly convertible to expected type function () view external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol index cd4e9b4e6909..c490ac89c0f2 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (110-149): Type function () pure external is not implicitly convertible to expected type function () payable external. +// TypeError 9574: (110-149): Type function () pure external is not implicitly convertible to expected type function () payable external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol index 3bf4bac2a1e7..ce603d7f10e5 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (110-149): Type function () view external is not implicitly convertible to expected type function () payable external. +// TypeError 9574: (110-149): Type function () view external is not implicitly convertible to expected type function () payable external. diff --git a/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol index c567a2c8d5f0..deaba824daaa 100644 --- a/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol +++ b/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (110-146): Type function () view external is not implicitly convertible to expected type function () pure external. +// TypeError 9574: (110-146): Type function () view external is not implicitly convertible to expected type function () pure external. diff --git a/test/libsolidity/syntaxTests/conversion/not_allowed_conversion_from_super.sol b/test/libsolidity/syntaxTests/conversion/not_allowed_conversion_from_super.sol index dc6f00f43aeb..e2af196ee90f 100644 --- a/test/libsolidity/syntaxTests/conversion/not_allowed_conversion_from_super.sol +++ b/test/libsolidity/syntaxTests/conversion/not_allowed_conversion_from_super.sol @@ -12,4 +12,4 @@ contract B is S } } // ---- -// TypeError: (129-137): Explicit type conversion not allowed from "contract super B" to "contract S". +// TypeError 9640: (129-137): Explicit type conversion not allowed from "contract super B" to "contract S". diff --git a/test/libsolidity/syntaxTests/cycle_checker_function_type.sol b/test/libsolidity/syntaxTests/cycle_checker_function_type.sol index 1a8477eaef61..7e3e86be492a 100644 --- a/test/libsolidity/syntaxTests/cycle_checker_function_type.sol +++ b/test/libsolidity/syntaxTests/cycle_checker_function_type.sol @@ -3,4 +3,4 @@ contract C { function ( ) internal returns ( bytes [ ] storage , mapping ( bytes => mapping ( bytes => mapping ( uint => mapping ( bytes => mapping ( string => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( string => mapping ( string => mapping ( uint => mapping ( bytes => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( bytes => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( string => mapping ( uint => string ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) [ ] storage ) constant c = c ; } // ---- -// TypeError: (43-643): The value of the constant c has a cyclic dependency via c. +// TypeError 6161: (43-643): The value of the constant c has a cyclic dependency via c. diff --git a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol index 0ed969464138..4e5091e8c1cf 100644 --- a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol +++ b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol @@ -5,4 +5,4 @@ library L { } // ---- -// TypeError: (159-173): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. +// TypeError 6651: (159-173): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol index 5d956b2f586e..1a90a2bb699f 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function i() external pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Data location must be "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (52-58): Data location must be "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol index c831f96a2af4..9b9602feeb91 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol @@ -2,5 +2,5 @@ contract test { function f(bytes memory) external; } // ---- -// TypeError: (0-56): Contract "test" should be marked as abstract. -// TypeError: (20-54): Functions without implementation must be marked virtual. +// TypeError 3656: (0-56): Contract "test" should be marked as abstract. +// TypeError 5424: (20-54): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol index 9c4df92d82e7..3fbf7563ad0f 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) external; } // ---- -// TypeError: (31-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. +// TypeError 6651: (31-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol index bc14aa1febab..c4fffd12e629 100644 --- a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol @@ -2,4 +2,4 @@ contract test { function f(bytes4 memory) public; } // ---- -// TypeError: (31-44): Data location can only be specified for array, struct or mapping types, but "memory" was given. +// TypeError 6651: (31-44): Data location can only be specified for array, struct or mapping types, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol index edf6d04c5bcb..c3c70c737788 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -2,5 +2,5 @@ contract test { function f(bytes calldata) internal; } // ---- -// TypeError: (0-58): Contract "test" should be marked as abstract. -// TypeError: (20-56): Functions without implementation must be marked virtual. +// TypeError 3656: (0-58): Contract "test" should be marked as abstract. +// TypeError 5424: (20-56): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol index 7ea8f2a57406..64df444d6494 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g(uint[]) internal pure {} } // ---- -// TypeError: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol index 847b595feaa8..d8d6ab2a5dd7 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g() internal pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (52-58): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol index 36619c5a3866..557347d2c949 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol @@ -6,7 +6,7 @@ library L { function j(mapping(uint => uint)) external pure {} } // ---- -// TypeError: (52-59): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. -// TypeError: (93-99): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. -// TypeError: (133-134): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. -// TypeError: (168-189): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError 6651: (52-59): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError 6651: (93-99): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError 6651: (133-134): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. +// TypeError 6651: (168-189): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol index 4bbd34704ef3..3bb0a5a06c70 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol @@ -6,7 +6,7 @@ library L { function j() external pure returns (mapping(uint => uint)) {} } // ---- -// TypeError: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol index 4f2094baad26..dfacbe936b4b 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol @@ -8,9 +8,9 @@ library L { function i(uint[] calldata, uint[] storage) external pure returns (S storage x) {return x; } } // ---- -// TypeError: (197-198): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (203-204): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (359-360): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (365-366): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (460-461): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. -// TypeError: (557-558): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (197-198): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (203-204): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (359-360): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (365-366): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (460-461): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (557-558): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol index 670201444998..97c246203dd1 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol @@ -10,11 +10,11 @@ library L { function jp(mapping(uint => uint)) internal pure {} } // ---- -// TypeError: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (268-275): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (310-316): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (351-352): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (387-408): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (77-84): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (129-135): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (180-181): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (226-247): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (268-275): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (310-316): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (351-352): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (387-408): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol index d56607497426..277eafd5bde8 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol @@ -10,11 +10,11 @@ library L { function jp(mapping(uint => uint)) private pure {} } // ---- -// TypeError: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol index 3910c79ed02f..9f01d2cab402 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol @@ -9,11 +9,11 @@ library L { function ip(S) private pure {} function jp(mapping(uint => uint)) private pure {}} // ---- -// TypeError: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. -// TypeError: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. -// TypeError: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (76-83): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (127-133): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (177-178): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (222-243): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (264-271): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (305-311): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (345-346): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (380-401): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/memory_storage_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/memory_storage_data_location.sol index a441b5407746..e431350ed52e 100644 --- a/test/libsolidity/syntaxTests/dataLocations/memory_storage_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/memory_storage_data_location.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (93-94): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer. -// TypeError: (102-110): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer. +// TypeError 7407: (93-94): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer. +// TypeError 7407: (102-110): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol index 1a58b6020a3e..5af253dfcabc 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f(uint[]) private pure {} } // ---- -// TypeError: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (28-34): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol index cf38ba424dd0..5026360ebe0b 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f() private pure returns(uint[]) {} } // ---- -// TypeError: (51-57): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (51-57): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol index c1904542e854..f8705d51a4c8 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol @@ -2,5 +2,5 @@ contract test { function f(bytes calldata) public; } // ---- -// TypeError: (0-56): Contract "test" should be marked as abstract. -// TypeError: (20-54): Functions without implementation must be marked virtual. +// TypeError 3656: (0-56): Contract "test" should be marked as abstract. +// TypeError 5424: (20-54): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol index 4a73c2a76cdd..1fb8e09f25af 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) public; } // ---- -// TypeError: (31-44): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. +// TypeError 6651: (31-44): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol index 31a7318935db..e39a85fe16fc 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h(uint[]) public pure {} } // ---- -// TypeError: (28-34): Data location must be "memory" or "calldata" for parameter in function, but none was given. +// TypeError 6651: (28-34): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol index e1b86b092685..c34c786cfb3c 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h() public pure returns(uint[]) {} } // ---- -// TypeError: (50-56): Data location must be "memory" or "calldata" for return parameter in function, but none was given. +// TypeError 6651: (50-56): Data location must be "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol index 5f6daf68198c..8c7a2ecb96a6 100644 --- a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol @@ -7,7 +7,7 @@ contract test { } } // ---- -// TypeError: (48-63): Data location can only be specified for array, struct or mapping types, but "storage" was given. -// TypeError: (71-89): Data location can only be specified for array, struct or mapping types, but "storage" was given. -// TypeError: (97-111): Data location can only be specified for array, struct or mapping types, but "memory" was given. -// TypeError: (119-136): Data location can only be specified for array, struct or mapping types, but "memory" was given. +// TypeError 6651: (48-63): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError 6651: (71-89): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError 6651: (97-111): Data location can only be specified for array, struct or mapping types, but "memory" was given. +// TypeError 6651: (119-136): Data location can only be specified for array, struct or mapping types, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol index f115ac606bdc..994c0568a141 100644 --- a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol +++ b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol @@ -2,4 +2,4 @@ contract C { uint constant x = 0x01 wei; } // ---- -// TypeError: (32-40): Hexadecimal numbers cannot be used with unit denominations. You can use an expression of the form "0x1234 * 1 day" instead. +// TypeError 5145: (32-40): Hexadecimal numbers cannot be used with unit denominations. You can use an expression of the form "0x1234 * 1 day" instead. diff --git a/test/libsolidity/syntaxTests/denominations/deprecated_year.sol b/test/libsolidity/syntaxTests/denominations/deprecated_year.sol index 691c0cb05f68..61c519a7baed 100644 --- a/test/libsolidity/syntaxTests/denominations/deprecated_year.sol +++ b/test/libsolidity/syntaxTests/denominations/deprecated_year.sol @@ -2,4 +2,4 @@ contract C { uint constant a = 3 years; } // ---- -// TypeError: (32-39): Using "years" as a unit denomination is deprecated. +// TypeError 4820: (32-39): Using "years" as a unit denomination is deprecated. diff --git a/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol b/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol index 22331b51b05e..4098de0e2f4c 100644 --- a/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol +++ b/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol @@ -3,4 +3,4 @@ contract C { ufixed constant b = ufixed(4 ether / 3 hours); } // ---- -// TypeError: (32-49): Type rational_const 10000000000000000 / 27 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x62 or use an explicit conversion. +// TypeError 2326: (32-49): Type rational_const 10000000000000000 / 27 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x62 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/deprecated_functions.sol b/test/libsolidity/syntaxTests/deprecated_functions.sol index 4774de47f295..fed56d3053e7 100644 --- a/test/libsolidity/syntaxTests/deprecated_functions.sol +++ b/test/libsolidity/syntaxTests/deprecated_functions.sol @@ -8,5 +8,5 @@ contract test { } } // ---- -// TypeError: (58-62): "sha3" has been deprecated in favour of "keccak256". -// TypeError: (101-108): "suicide" has been deprecated in favour of "selfdestruct". +// TypeError 3557: (58-62): "sha3" has been deprecated in favour of "keccak256". +// TypeError 8050: (101-108): "suicide" has been deprecated in favour of "selfdestruct". diff --git a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol index fda4a17abb83..97650d4cad59 100644 --- a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol +++ b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol @@ -3,4 +3,4 @@ contract test { uint128 variable; } // ---- -// DeclarationError: (36-52): Identifier already declared. +// DeclarationError 2333: (36-52): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/double_variable_declaration.sol b/test/libsolidity/syntaxTests/double_variable_declaration.sol index 53c5c9be84e9..9deff2f5218a 100644 --- a/test/libsolidity/syntaxTests/double_variable_declaration.sol +++ b/test/libsolidity/syntaxTests/double_variable_declaration.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// Warning: (80-89): This declaration shadows an existing declaration. +// Warning 2519: (80-89): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/emit/emit_empty.sol b/test/libsolidity/syntaxTests/emit/emit_empty.sol index 819d88fea564..065de916ac11 100644 --- a/test/libsolidity/syntaxTests/emit/emit_empty.sol +++ b/test/libsolidity/syntaxTests/emit/emit_empty.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (45-46): Expected event name or path. +// ParserError 5620: (45-46): Expected event name or path. diff --git a/test/libsolidity/syntaxTests/emit/emit_non_event.sol b/test/libsolidity/syntaxTests/emit/emit_non_event.sol index 5f9053681f52..64021bb29a84 100644 --- a/test/libsolidity/syntaxTests/emit/emit_non_event.sol +++ b/test/libsolidity/syntaxTests/emit/emit_non_event.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (66-70): Expression has to be an event invocation. +// TypeError 9292: (66-70): Expression has to be an event invocation. diff --git a/test/libsolidity/syntaxTests/empty_struct.sol b/test/libsolidity/syntaxTests/empty_struct.sol index 0a52fb72967e..3473612caa03 100644 --- a/test/libsolidity/syntaxTests/empty_struct.sol +++ b/test/libsolidity/syntaxTests/empty_struct.sol @@ -2,4 +2,4 @@ contract test { struct A {} } // ---- -// SyntaxError: (17-28): Defining empty structs is disallowed. +// SyntaxError 5306: (17-28): Defining empty structs is disallowed. diff --git a/test/libsolidity/syntaxTests/enums/global_enum_contract_name_clash.sol b/test/libsolidity/syntaxTests/enums/global_enum_contract_name_clash.sol index be667496f0eb..e2226993f9f2 100644 --- a/test/libsolidity/syntaxTests/enums/global_enum_contract_name_clash.sol +++ b/test/libsolidity/syntaxTests/enums/global_enum_contract_name_clash.sol @@ -1,4 +1,4 @@ enum E { A } contract E {} // ---- -// DeclarationError: (13-26): Identifier already declared. +// DeclarationError 2333: (13-26): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/enums/global_enum_name_clash.sol b/test/libsolidity/syntaxTests/enums/global_enum_name_clash.sol index dd49c33adab2..507f92fff40a 100644 --- a/test/libsolidity/syntaxTests/enums/global_enum_name_clash.sol +++ b/test/libsolidity/syntaxTests/enums/global_enum_name_clash.sol @@ -1,4 +1,4 @@ enum E { A } enum E { A } // ---- -// DeclarationError: (13-25): Identifier already declared. +// DeclarationError 2333: (13-25): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/enums/global_enum_shadowing.sol b/test/libsolidity/syntaxTests/enums/global_enum_shadowing.sol index 240d7f6488f4..1b9bce95e417 100644 --- a/test/libsolidity/syntaxTests/enums/global_enum_shadowing.sol +++ b/test/libsolidity/syntaxTests/enums/global_enum_shadowing.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (30-42): This declaration shadows an existing declaration. +// Warning 2519: (30-42): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/events/event_nested_array.sol b/test/libsolidity/syntaxTests/events/event_nested_array.sol index ca92224e42bb..6d76a6dcd38c 100644 --- a/test/libsolidity/syntaxTests/events/event_nested_array.sol +++ b/test/libsolidity/syntaxTests/events/event_nested_array.sol @@ -2,4 +2,4 @@ contract c { event E(uint[][]); } // ---- -// TypeError: (25-33): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 3061: (25-33): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/events/event_nested_array_in_struct.sol b/test/libsolidity/syntaxTests/events/event_nested_array_in_struct.sol index 06739699d4c4..4e6f10d2add7 100644 --- a/test/libsolidity/syntaxTests/events/event_nested_array_in_struct.sol +++ b/test/libsolidity/syntaxTests/events/event_nested_array_in_struct.sol @@ -3,4 +3,4 @@ contract c { event E(S); } // ---- -// TypeError: (61-62): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 3061: (61-62): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/events/event_struct.sol b/test/libsolidity/syntaxTests/events/event_struct.sol index 99b4718c64e2..52a01c5e9d17 100644 --- a/test/libsolidity/syntaxTests/events/event_struct.sol +++ b/test/libsolidity/syntaxTests/events/event_struct.sol @@ -3,4 +3,4 @@ contract c { event E(S); } // ---- -// TypeError: (51-52): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 3061: (51-52): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/events/event_struct_indexed.sol b/test/libsolidity/syntaxTests/events/event_struct_indexed.sol index 169b74e85472..19676b5cc673 100644 --- a/test/libsolidity/syntaxTests/events/event_struct_indexed.sol +++ b/test/libsolidity/syntaxTests/events/event_struct_indexed.sol @@ -3,4 +3,4 @@ contract c { event E(S indexed); } // ---- -// TypeError: (51-60): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 3061: (51-60): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/fallback/arguments.sol b/test/libsolidity/syntaxTests/fallback/arguments.sol index 76e7be5f5961..806874feb6bd 100644 --- a/test/libsolidity/syntaxTests/fallback/arguments.sol +++ b/test/libsolidity/syntaxTests/fallback/arguments.sol @@ -2,4 +2,4 @@ contract C { fallback(uint256) external {} } // ---- -// TypeError: (25-34): Fallback function cannot take parameters. +// TypeError 3978: (25-34): Fallback function cannot take parameters. diff --git a/test/libsolidity/syntaxTests/fallback/default_visibility.sol b/test/libsolidity/syntaxTests/fallback/default_visibility.sol index d8fd069053bb..ee3fa6f6f38c 100644 --- a/test/libsolidity/syntaxTests/fallback/default_visibility.sol +++ b/test/libsolidity/syntaxTests/fallback/default_visibility.sol @@ -3,5 +3,5 @@ contract C { fallback() {} } // ---- -// SyntaxError: (90-103): No visibility specified. Did you intend to add "external"? -// TypeError: (90-103): Fallback function must be defined as "external". +// SyntaxError 4937: (90-103): No visibility specified. Did you intend to add "external"? +// TypeError 1159: (90-103): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/fallback/fallback_as_function_name.sol b/test/libsolidity/syntaxTests/fallback/fallback_as_function_name.sol index a1c78e29b8ff..cb31d46d79e1 100644 --- a/test/libsolidity/syntaxTests/fallback/fallback_as_function_name.sol +++ b/test/libsolidity/syntaxTests/fallback/fallback_as_function_name.sol @@ -2,4 +2,4 @@ contract C { function fallback() external pure {} } // ---- -// Warning: (26-34): This function is named "fallback" but is not the fallback function of the contract. If you intend this to be a fallback function, use "fallback(...) { ... }" without the "function" keyword to define it. +// Warning 3445: (26-34): This function is named "fallback" but is not the fallback function of the contract. If you intend this to be a fallback function, use "fallback(...) { ... }" without the "function" keyword to define it. diff --git a/test/libsolidity/syntaxTests/fallback/old_syntax.sol b/test/libsolidity/syntaxTests/fallback/old_syntax.sol index 88a45756c37d..31bbf00431ea 100644 --- a/test/libsolidity/syntaxTests/fallback/old_syntax.sol +++ b/test/libsolidity/syntaxTests/fallback/old_syntax.sol @@ -2,4 +2,4 @@ contract C { function() external {} } // ---- -// ParserError: (37-38): Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead. +// ParserError 2915: (37-38): Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead. diff --git a/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty.sol b/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty.sol index caa734ab5237..f4bc549674aa 100644 --- a/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty.sol +++ b/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty.sol @@ -3,4 +3,4 @@ contract C { function f() public pure { } } // ---- -// Warning: (0-83): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// Warning 3628: (0-83): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. diff --git a/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty_by_inheritance.sol b/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty_by_inheritance.sol index 2b96017ebd06..a2e39e536bff 100644 --- a/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty_by_inheritance.sol +++ b/test/libsolidity/syntaxTests/fallback/payable_fallback_without_receive_nonempty_by_inheritance.sol @@ -5,4 +5,4 @@ contract C is A { fallback() external payable { } } // ---- -// Warning: (49-104): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// Warning 3628: (49-104): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. diff --git a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol index 5b8d54591c06..fbfb892a4d3d 100644 --- a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol @@ -3,4 +3,4 @@ contract C { fallback() external pure { x = 2; } } // ---- -// TypeError: (29-64): Fallback function must be payable or non-payable, but is "pure". +// TypeError 4575: (29-64): Fallback function must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/fallback/return_value_number.sol b/test/libsolidity/syntaxTests/fallback/return_value_number.sol index b3d0594206af..c41b837a8cc2 100644 --- a/test/libsolidity/syntaxTests/fallback/return_value_number.sol +++ b/test/libsolidity/syntaxTests/fallback/return_value_number.sol @@ -2,4 +2,4 @@ contract C { fallback() external returns (bytes memory, bytes memory) {} } // ---- -// TypeError: (45-73): Fallback function can only have a single "bytes memory" return value. +// TypeError 5570: (45-73): Fallback function can only have a single "bytes memory" return value. diff --git a/test/libsolidity/syntaxTests/fallback/return_value_type.sol b/test/libsolidity/syntaxTests/fallback/return_value_type.sol index 7b2d149dc58f..a6557139ded7 100644 --- a/test/libsolidity/syntaxTests/fallback/return_value_type.sol +++ b/test/libsolidity/syntaxTests/fallback/return_value_type.sol @@ -2,4 +2,4 @@ contract C { fallback() external returns (uint256) {} } // ---- -// TypeError: (45-54): Fallback function can only have a single "bytes memory" return value. +// TypeError 5570: (45-54): Fallback function can only have a single "bytes memory" return value. diff --git a/test/libsolidity/syntaxTests/fallback/return_value_unsupported.sol b/test/libsolidity/syntaxTests/fallback/return_value_unsupported.sol index 8ce54591f5a9..3b90b5ad2568 100644 --- a/test/libsolidity/syntaxTests/fallback/return_value_unsupported.sol +++ b/test/libsolidity/syntaxTests/fallback/return_value_unsupported.sol @@ -2,4 +2,4 @@ contract C { fallback() external returns (bytes memory) {} } // ---- -// TypeError: (45-59): Return values for fallback functions are not yet implemented. +// TypeError 6151: (45-59): Return values for fallback functions are not yet implemented. diff --git a/test/libsolidity/syntaxTests/fallback/view_modifier.sol b/test/libsolidity/syntaxTests/fallback/view_modifier.sol index f458ee6ec3cf..f2e2febf546f 100644 --- a/test/libsolidity/syntaxTests/fallback/view_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/view_modifier.sol @@ -3,4 +3,4 @@ contract C { fallback() external view { x = 2; } } // ---- -// TypeError: (29-64): Fallback function must be payable or non-payable, but is "view". +// TypeError 4575: (29-64): Fallback function must be payable or non-payable, but is "view". diff --git a/test/libsolidity/syntaxTests/functionCalls/arbitrary_parameters_but_restricted_first_type.sol b/test/libsolidity/syntaxTests/functionCalls/arbitrary_parameters_but_restricted_first_type.sol index 94da5881d590..5d900e04e31d 100644 --- a/test/libsolidity/syntaxTests/functionCalls/arbitrary_parameters_but_restricted_first_type.sol +++ b/test/libsolidity/syntaxTests/functionCalls/arbitrary_parameters_but_restricted_first_type.sol @@ -7,7 +7,7 @@ contract C { } } // ---- -// TypeError: (52-76): Need at least 1 arguments for function call, but provided only 0. -// TypeError: (86-111): Need at least 1 arguments for function call, but provided only 0. -// TypeError: (144-151): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes4 requested. -// TypeError: (189-196): Invalid type for argument in function call. Invalid implicit conversion from uint256 to string memory requested. +// TypeError 9308: (52-76): Need at least 1 arguments for function call, but provided only 0. +// TypeError 9308: (86-111): Need at least 1 arguments for function call, but provided only 0. +// TypeError 9553: (144-151): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes4 requested. +// TypeError 9553: (189-196): Invalid type for argument in function call. Invalid implicit conversion from uint256 to string memory requested. diff --git a/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol b/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol index ef668f29f881..11021f7d7f44 100644 --- a/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol +++ b/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (148-154): Member "f" not unique after argument-dependent lookup in contract C. +// TypeError 6675: (148-154): Member "f" not unique after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol index 1af646ef0d94..3b162a7f220a 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol @@ -10,8 +10,8 @@ contract C { // ==== // EVMVersion: >=constantinople // ---- -// TypeError: (78-101): Duplicate option "gas". -// TypeError: (111-138): Duplicate option "value". -// TypeError: (148-189): Duplicate option "gas". -// TypeError: (148-189): Duplicate option "value". -// TypeError: (199-228): Duplicate option "salt". +// TypeError 9886: (78-101): Duplicate option "gas". +// TypeError 9886: (111-138): Duplicate option "value". +// TypeError 9886: (148-189): Duplicate option "gas". +// TypeError 9886: (148-189): Duplicate option "value". +// TypeError 9886: (199-228): Duplicate option "salt". diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol index 85bf6962fd8c..d719fdcd9bb7 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// TypeError: (56-98): Cannot set option "value" for delegatecall. -// Warning: (56-102): Return value of low-level calls not used. +// TypeError 6189: (56-98): Cannot set option "value" for delegatecall. +// Warning 9302: (56-102): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_internal_function.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_internal_function.sol index b0099607a637..af5706de3915 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_internal_function.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_internal_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (75-86): Function call options can only be set on external function calls or contract creations. +// TypeError 2193: (75-86): Function call options can only be set on external function calls or contract creations. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol index 181b325b05f4..4a96e088ac06 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol @@ -12,11 +12,11 @@ contract C { // ==== // EVMVersion: >=constantinople // ---- -// TypeError: (78-110): Option "gas" has already been set. -// TypeError: (120-154): Option "gas" has already been set. -// TypeError: (164-198): Option "value" has already been set. -// Warning: (208-222): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// TypeError: (208-242): Option "value" has already been set. -// TypeError: (252-293): Option "value" has already been set. -// TypeError: (252-293): Option "gas" has already been set. -// TypeError: (303-330): Option "salt" has already been set. +// TypeError 9886: (78-110): Option "gas" has already been set. +// TypeError 9886: (120-154): Option "gas" has already been set. +// TypeError 9886: (164-198): Option "value" has already been set. +// Warning 1621: (208-222): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError 9886: (208-242): Option "value" has already been set. +// TypeError 9886: (252-293): Option "value" has already been set. +// TypeError 9886: (252-293): Option "gas" has already been set. +// TypeError 9886: (303-330): Option "salt" has already been set. diff --git a/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol b/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol index 5ef2559be46e..feb4a9ed0684 100644 --- a/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol +++ b/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol @@ -5,4 +5,4 @@ contract C } } // ---- -// TypeError: (61-68): Type is not callable +// TypeError 5704: (61-68): Type is not callable diff --git a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions1.sol b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions1.sol index 17c467b295d2..1219bcc896fa 100644 --- a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions1.sol +++ b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (71-79): Expected callable expression before call options. +// TypeError 2622: (71-79): Expected callable expression before call options. diff --git a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions2.sol b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions2.sol index 8ac42d2be7c9..a4786f9d4216 100644 --- a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions2.sol +++ b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions2.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (73-93): Unknown call option "random". Valid options are "salt", "value" and "gas". +// TypeError 9318: (73-93): Unknown call option "random". Valid options are "salt", "value" and "gas". diff --git a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions3.sol b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions3.sol index fe5113c9164b..a7b236fa5cf7 100644 --- a/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions3.sol +++ b/test/libsolidity/syntaxTests/functionCalls/invalid_expressions_with_calloptions3.sol @@ -5,6 +5,6 @@ contract C { } } // ---- -// TypeError: (64-97): Unknown call option "slt". Valid options are "salt", "value" and "gas". -// TypeError: (64-97): Cannot set option "value" on a non-payable function type. -// TypeError: (64-97): Function call option "salt" can only be used with "new". +// TypeError 9318: (64-97): Unknown call option "slt". Valid options are "salt", "value" and "gas". +// TypeError 7006: (64-97): Cannot set option "value" on a non-payable function type. +// TypeError 2721: (64-97): Function call option "salt" can only be used with "new". diff --git a/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol b/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol index 089e1dbf072d..0f1c2af49475 100644 --- a/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol +++ b/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-92): Named arguments cannot be used for functions that take arbitrary parameters. +// TypeError 2627: (52-92): Named arguments cannot be used for functions that take arbitrary parameters. diff --git a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing1.sol b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing1.sol index 49ec2921a563..c858e7720540 100644 --- a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing1.sol +++ b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing1.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// TypeError: (241-242): No matching declaration found after argument-dependent lookup. +// TypeError 9322: (241-242): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing2.sol b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing2.sol index be08f7e426a0..aa49def1f289 100644 --- a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing2.sol +++ b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (209-210): No matching declaration found after argument-dependent lookup. +// TypeError 9322: (209-210): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing3.sol b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing3.sol index 1f315579e66e..fd9069eaec76 100644 --- a/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing3.sol +++ b/test/libsolidity/syntaxTests/functionCalls/named_arguments_overload_failing3.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (214-215): No matching declaration found after argument-dependent lookup. +// TypeError 9322: (214-215): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol index a9e873ef9a30..5fd802c0a09f 100644 --- a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol +++ b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol @@ -10,6 +10,6 @@ contract C { // ==== // EVMVersion: =constantinople // ---- -// TypeError: (64-98): Cannot set option "value", since the constructor of contract D is not payable. -// TypeError: (64-98): Function call option "gas" cannot be used with "new". -// TypeError: (102-123): Unknown call option "slt". Valid options are "salt", "value" and "gas". -// TypeError: (102-123): Cannot set option "value", since the constructor of contract D is not payable. -// TypeError: (127-139): Unknown call option "val". Valid options are "salt", "value" and "gas". -// TypeError: (143-172): Duplicate option "salt". -// TypeError: (176-199): Cannot set option "value", since the constructor of contract D is not payable. -// TypeError: (176-199): Cannot set option "value", since the constructor of contract D is not payable. -// TypeError: (203-220): Unknown call option "random". Valid options are "salt", "value" and "gas". -// TypeError: (224-242): Unknown call option "what". Valid options are "salt", "value" and "gas". -// TypeError: (246-259): Function call option "gas" cannot be used with "new". +// TypeError 7006: (64-98): Cannot set option "value", since the constructor of contract D is not payable. +// TypeError 9903: (64-98): Function call option "gas" cannot be used with "new". +// TypeError 9318: (102-123): Unknown call option "slt". Valid options are "salt", "value" and "gas". +// TypeError 7006: (102-123): Cannot set option "value", since the constructor of contract D is not payable. +// TypeError 9318: (127-139): Unknown call option "val". Valid options are "salt", "value" and "gas". +// TypeError 9886: (143-172): Duplicate option "salt". +// TypeError 7006: (176-199): Cannot set option "value", since the constructor of contract D is not payable. +// TypeError 7006: (176-199): Cannot set option "value", since the constructor of contract D is not payable. +// TypeError 9318: (203-220): Unknown call option "random". Valid options are "salt", "value" and "gas". +// TypeError 9318: (224-242): Unknown call option "what". Valid options are "salt", "value" and "gas". +// TypeError 9903: (246-259): Function call option "gas" cannot be used with "new". diff --git a/test/libsolidity/syntaxTests/functionCalls/this_not_callable.sol b/test/libsolidity/syntaxTests/functionCalls/this_not_callable.sol index dd32f2324004..52e6986bb0ac 100644 --- a/test/libsolidity/syntaxTests/functionCalls/this_not_callable.sol +++ b/test/libsolidity/syntaxTests/functionCalls/this_not_callable.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (72-78): Type is not callable +// TypeError 5704: (72-78): Type is not callable diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_constructor.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_constructor.sol index f289354f5668..13a5e8ee7123 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_constructor.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_constructor.sol @@ -4,4 +4,4 @@ contract C { function g() public { this.f.value(); } } // ---- -// TypeError: (155-167): Member "value" is only available for payable functions. +// TypeError 8820: (155-167): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol index 822d3eb28e5b..617028df5a2a 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (94-101): Member "value" is only available for payable functions. +// TypeError 8820: (94-101): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_options_on_non_payable_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_options_on_non_payable_function_type.sol index 30f36f219281..6e32f5f229c3 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_value_options_on_non_payable_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_value_options_on_non_payable_function_type.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (94-105): Cannot set option "value" on a non-payable function type. +// TypeError 7006: (94-105): Cannot set option "value" on a non-payable function type. diff --git a/test/libsolidity/syntaxTests/functionTypes/conversion_to_address.sol b/test/libsolidity/syntaxTests/functionTypes/conversion_to_address.sol index 703d6c89f201..369ff7d0116c 100644 --- a/test/libsolidity/syntaxTests/functionTypes/conversion_to_address.sol +++ b/test/libsolidity/syntaxTests/functionTypes/conversion_to_address.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (77-92): Explicit type conversion not allowed from "function () view external returns (address)" to "address". To obtain the address of the contract of the function, you can use the .address member of the function. +// TypeError 5030: (77-92): Explicit type conversion not allowed from "function () view external returns (address)" to "address". To obtain the address of the contract of the function, you can use the .address member of the function. diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol b/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol index 2711dae82342..55abe8267567 100644 --- a/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol +++ b/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (54-60): Expression has to be an lvalue. +// TypeError 4247: (54-60): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol b/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol index 60da19e405d6..546a0acd5fe2 100644 --- a/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol +++ b/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (54-55): Expression has to be an lvalue. +// TypeError 4247: (54-55): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol index 8b14d3dc59d8..5a4d446139d0 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol @@ -2,4 +2,4 @@ contract C { function() external returns (function () internal) x; } // ---- -// TypeError: (46-67): Internal type cannot be used for external function type. +// TypeError 2582: (46-67): Internal type cannot be used for external function type. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol index 3e264c8ccdaf..33248a62c02f 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol @@ -2,4 +2,4 @@ contract C { function(function () internal) external x; } // ---- -// TypeError: (26-47): Internal type cannot be used for external function type. +// TypeError 2582: (26-47): Internal type cannot be used for external function type. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address_payable.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address_payable.sol index 0cd7764f5b96..2fa634fced38 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address_payable.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address_payable.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (85-99): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. +// TypeError 6359: (85-99): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol index f42872238042..083388e6ab88 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (69-81): Explicit type conversion not allowed from "function () external returns (uint256)" to "uint256". +// TypeError 9640: (69-81): Explicit type conversion not allowed from "function () external returns (uint256)" to "uint256". diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor.sol index 51f0b10d1dd0..8c0d78cdc5c8 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor.sol @@ -3,5 +3,5 @@ contract C { constructor() public x; } // ---- -// SyntaxError: (83-106): Functions without implementation cannot have modifiers. -// DeclarationError: (104-105): Undeclared identifier. +// SyntaxError 2668: (83-106): Functions without implementation cannot have modifiers. +// DeclarationError 7576: (104-105): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol index 42697b73975a..e438a871df49 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (104-115): Expected primary expression. +// ParserError 6933: (104-115): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_internal_public_variable.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_internal_public_variable.sol index 4eb53227bc8b..d7ac99902fca 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_internal_public_variable.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_internal_public_variable.sol @@ -2,4 +2,4 @@ contract C { function(bytes memory) internal public a; } // ---- -// TypeError: (17-57): Internal or recursive type is not allowed for public state variables. +// TypeError 6744: (17-57): Internal or recursive type is not allowed for public state variables. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_return_parameters_with_names.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_return_parameters_with_names.sol index 1219153009d2..c96cbfff97bc 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_return_parameters_with_names.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_return_parameters_with_names.sol @@ -2,4 +2,4 @@ contract C { function(uint) returns (bool ret) f; } // ---- -// SyntaxError: (41-49): Return parameters in function types may not be named. +// SyntaxError 7304: (41-49): Return parameters in function types may not be named. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol index 586753b0bfaa..c12a42d63b13 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol @@ -7,4 +7,4 @@ library L function f(function(Nested memory) external) external pure {} } // ---- -// DeclarationError: (32-35): Identifier not found or not unique. +// DeclarationError 7920: (32-35): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_variable_external_internal.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_variable_external_internal.sol index f02404724541..cb2ee61c54ef 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_variable_external_internal.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_variable_external_internal.sol @@ -3,4 +3,4 @@ contract test { function(bytes memory) external internal a = fa; } // ---- -// TypeError: (106-108): Type function (bytes memory) is not implicitly convertible to expected type function (bytes memory) external. +// TypeError 7407: (106-108): Type function (bytes memory) is not implicitly convertible to expected type function (bytes memory) external. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_types_internal_visibility_error.sol b/test/libsolidity/syntaxTests/functionTypes/function_types_internal_visibility_error.sol index 36206d6344f5..8c2ca4c89f11 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_types_internal_visibility_error.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_types_internal_visibility_error.sol @@ -4,4 +4,4 @@ contract C { function(bytes memory) public a; } // ---- -// TypeError: (139-170): Invalid visibility, can only be "external" or "internal". +// TypeError 6012: (139-170): Invalid visibility, can only be "external" or "internal". diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_array_memory_as_external_parameter_in_library_external.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_array_memory_as_external_parameter_in_library_external.sol index 5ca4721b76af..00fdf76e32f2 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_array_memory_as_external_parameter_in_library_external.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_array_memory_as_external_parameter_in_library_external.sol @@ -3,4 +3,4 @@ library L { function f(function(uint) internal returns (uint)[] memory x) public { } } // ---- -// TypeError: (63-112): Internal type is not allowed for public or external functions. +// TypeError 4103: (63-112): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_array_storage_as_external_parameter_in_library_external.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_array_storage_as_external_parameter_in_library_external.sol index 9ae10f44d9d3..5942fc1163b6 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_array_storage_as_external_parameter_in_library_external.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_array_storage_as_external_parameter_in_library_external.sol @@ -3,4 +3,4 @@ library L { function g(function(uint) internal returns (uint)[] storage x) public { } } // ---- -// TypeError: (63-113): Internal type is not allowed for public or external functions. +// TypeError 4103: (63-113): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol index c3aaa30ccd82..2db4ed3a79e8 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (124-164): Internal type is not allowed for public or external functions. +// TypeError 4103: (124-164): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol index d464dc35e2a3..b8bd1141f5b6 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol @@ -3,4 +3,4 @@ library L { } } // ---- -// TypeError: (27-67): Internal type is not allowed for public or external functions. +// TypeError 4103: (27-67): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol index 5b36cc8b859e..1968e4cfacd7 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (129-169): Internal type is not allowed for public or external functions. +// TypeError 4103: (129-169): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_struct_as_external_parameter_in_library_external.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_struct_as_external_parameter_in_library_external.sol index 02d5cca91d1e..a384c8a66abe 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_struct_as_external_parameter_in_library_external.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_struct_as_external_parameter_in_library_external.sol @@ -6,4 +6,4 @@ library L { function f(S storage s) public { } } // ---- -// TypeError: (104-115): Internal type is not allowed for public or external functions. +// TypeError 4103: (104-115): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol index b75a0d43608e..18b9a7ea91f0 100644 --- a/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol +++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (72-82): Explicit type conversion not allowed from "function () returns (address)" to "address". +// TypeError 9640: (72-82): Explicit type conversion not allowed from "function () returns (address)" to "address". diff --git a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol index a7cb9d92a05c..e559ad081e40 100644 --- a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol @@ -2,4 +2,4 @@ contract C { function (uint) internal payable returns (uint) x; } // ---- -// TypeError: (17-66): Only external function types can be payable. +// TypeError 7415: (17-66): Only external function types can be payable. diff --git a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol index 5c6dc056176a..481ad3a171e2 100644 --- a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol +++ b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (17-66): Only external function types can be payable. +// TypeError 7415: (17-66): Only external function types can be payable. diff --git a/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol index 9d4f0a097fb4..06bce9d64f35 100644 --- a/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-86): Invalid visibility, can only be "external" or "internal". +// TypeError 6012: (47-86): Invalid visibility, can only be "external" or "internal". diff --git a/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol index 756766d3b0b4..f8df83da8325 100644 --- a/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-85): Invalid visibility, can only be "external" or "internal". +// TypeError 6012: (47-85): Invalid visibility, can only be "external" or "internal". diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol index 36d42e3499ec..99fddae180eb 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_gas_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol index 28a573c93ee4..739f6f37e7c3 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol +++ b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_constructor.sol @@ -8,4 +8,4 @@ contract D { } } // ---- -// Warning: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol index 854ea28fafaa..d24aaf9726b8 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/warn_deprecate_value_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol index 072c7eb712fd..6964146f10ba 100644 --- a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol +++ b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol @@ -2,4 +2,4 @@ contract C { function(uint a) f; } // ---- -// Warning: (26-32): Naming function type parameters is deprecated. +// Warning 6162: (26-32): Naming function type parameters is deprecated. diff --git a/test/libsolidity/syntaxTests/getter/nested_structs.sol b/test/libsolidity/syntaxTests/getter/nested_structs.sol index f33bf53e1013..457ddb87d36c 100644 --- a/test/libsolidity/syntaxTests/getter/nested_structs.sol +++ b/test/libsolidity/syntaxTests/getter/nested_structs.sol @@ -8,4 +8,4 @@ contract C { mapping(uint256 => X) public m; } // ---- -// TypeError: (88-118): The following types are only supported for getters in ABIEncoderV2: struct C.Y memory. Either remove "public" or use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 2763: (88-118): The following types are only supported for getters in ABIEncoderV2: struct C.Y memory. Either remove "public" or use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/getter/recursive_struct.sol b/test/libsolidity/syntaxTests/getter/recursive_struct.sol index d81cac60e57d..4723a162c670 100644 --- a/test/libsolidity/syntaxTests/getter/recursive_struct.sol +++ b/test/libsolidity/syntaxTests/getter/recursive_struct.sol @@ -5,4 +5,4 @@ contract C { mapping(uint256 => Y) public m; } // ---- -// TypeError: (53-83): Internal or recursive type is not allowed for public state variables. +// TypeError 6744: (53-83): Internal or recursive type is not allowed for public state variables. diff --git a/test/libsolidity/syntaxTests/globalFunctions/call_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/call_with_wrong_arg_count.sol index 92ec4eb7fb83..33a864429c72 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/call_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/call_with_wrong_arg_count.sol @@ -11,7 +11,7 @@ contract C { } } // ---- -// TypeError: (65-85): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. -// TypeError: (153-171): Invalid type for argument in function call. Invalid implicit conversion from bytes4 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. -// TypeError: (240-247): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. -// TypeError: (297-333): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 6138: (65-85): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. +// TypeError 8051: (153-171): Invalid type for argument in function call. Invalid implicit conversion from bytes4 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 8051: (240-247): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 8922: (297-333): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. diff --git a/test/libsolidity/syntaxTests/globalFunctions/callcode_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/callcode_with_wrong_arg_count.sol index 655d5f4c2180..8b94264057d3 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/callcode_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/callcode_with_wrong_arg_count.sol @@ -9,6 +9,6 @@ contract C { } } // ---- -// TypeError: (65-89): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. -// TypeError: (161-168): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. -// TypeError: (218-258): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 6138: (65-89): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. +// TypeError 8051: (161-168): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 8922: (218-258): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. diff --git a/test/libsolidity/syntaxTests/globalFunctions/delegatecall_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/delegatecall_with_wrong_arg_count.sol index fa524b99e59f..1e2b067a627f 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/delegatecall_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/delegatecall_with_wrong_arg_count.sol @@ -9,6 +9,6 @@ contract C { } } // ---- -// TypeError: (65-93): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. -// TypeError: (169-176): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. -// TypeError: (226-270): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 6138: (65-93): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata. +// TypeError 8051: (169-176): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. +// TypeError 8922: (226-270): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. If all your arguments are value types, you can use abi.encode(...) to properly generate it. diff --git a/test/libsolidity/syntaxTests/globalFunctions/keccak256_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/keccak256_with_wrong_arg_count.sol index 4857bc2e4506..8867cf78b952 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/keccak256_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/keccak256_with_wrong_arg_count.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (55-66): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (100-107): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (132-159): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (55-66): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (100-107): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (132-159): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. diff --git a/test/libsolidity/syntaxTests/globalFunctions/ripemd160_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/ripemd160_with_wrong_arg_count.sol index da41fccd3e31..62df6c4ef163 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/ripemd160_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/ripemd160_with_wrong_arg_count.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (55-66): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (100-107): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (132-159): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (55-66): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (100-107): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (132-159): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha256_with_wrong_arg_count.sol b/test/libsolidity/syntaxTests/globalFunctions/sha256_with_wrong_arg_count.sol index 2939e7fcb8ce..47dff279a252 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/sha256_with_wrong_arg_count.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/sha256_with_wrong_arg_count.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (55-63): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (94-101): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (126-150): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (55-63): Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (94-101): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 4323: (126-150): Wrong argument count for function call: 2 arguments given but expected 1. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol index 4e3b5fd058e8..23d64f1338f5 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol @@ -5,4 +5,4 @@ contract C } } // ---- -// TypeError: (60-64): "sha3" has been deprecated in favour of "keccak256". +// TypeError 3557: (60-64): "sha3" has been deprecated in favour of "keccak256". diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol index 909c2dc34628..65f5636aaa53 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (14-76): This declaration shadows a builtin symbol. +// Warning 2319: (14-76): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol index 19ee72d941dc..2313a6e18c9f 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// Warning: (58-67): This declaration shadows a builtin symbol. +// Warning 2319: (58-67): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol index f243e2f26b71..379c7dd7aaf4 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol @@ -5,4 +5,4 @@ contract C } } // ---- -// TypeError: (60-67): "suicide" has been deprecated in favour of "selfdestruct". +// TypeError 8050: (60-67): "suicide" has been deprecated in favour of "selfdestruct". diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol index 7350da39fa03..55416de5070e 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning: (14-79): This declaration shadows a builtin symbol. +// Warning 2319: (14-79): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol index 3549a5633ff3..c51810009c92 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// Warning: (58-70): This declaration shadows a builtin symbol. +// Warning 2319: (58-70): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_bitnot_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_bitnot_tuple.sol index 56877ecdc95b..608481c7658c 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_bitnot_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_bitnot_tuple.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// TypeError: (60-64): Tuple component cannot be empty. +// TypeError 8381: (60-64): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol index 1612006424e0..568fe27ffb3f 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// TypeError: (59-64): Unary operator -- cannot be applied to type tuple(,) +// TypeError 9767: (59-64): Unary operator -- cannot be applied to type tuple(,) diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol index 0cdcee5cc3c3..9727e53a516c 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol @@ -6,5 +6,5 @@ contract C } } // ---- -// TypeError: (68-69): Expression has to be an lvalue. -// TypeError: (59-70): Unary operator delete cannot be applied to type tuple(,int_const 0) +// TypeError 4247: (68-69): Expression has to be an lvalue. +// TypeError 9767: (59-70): Unary operator delete cannot be applied to type tuple(,int_const 0) diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol index fe5d5e5ce298..487c224be33b 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// TypeError: (61-66): Unary operator ++ cannot be applied to type tuple(,) +// TypeError 9767: (61-66): Unary operator ++ cannot be applied to type tuple(,) diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol index 6f40f1ed1cb8..2c568a4e720b 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol @@ -9,12 +9,12 @@ contract C } } // ---- -// SyntaxError: (59-66): Use of unary + is disallowed. -// TypeError: (59-66): Unary operator + cannot be applied to type tuple(int_const 0,int_const 0) -// TypeError: (51-66): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (84-91): Unary operator - cannot be applied to type tuple(int_const 0,int_const 0) -// TypeError: (76-91): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (111-118): Unary operator ~ cannot be applied to type tuple(int_const 0,int_const 0) -// TypeError: (101-118): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (138-145): Unary operator ! cannot be applied to type tuple(int_const 0,int_const 0) -// TypeError: (128-145): Different number of components on the left hand side (1) than on the right hand side (2). +// SyntaxError 9636: (59-66): Use of unary + is disallowed. +// TypeError 4907: (59-66): Unary operator + cannot be applied to type tuple(int_const 0,int_const 0) +// TypeError 7364: (51-66): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError 4907: (84-91): Unary operator - cannot be applied to type tuple(int_const 0,int_const 0) +// TypeError 7364: (76-91): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError 4907: (111-118): Unary operator ~ cannot be applied to type tuple(int_const 0,int_const 0) +// TypeError 7364: (101-118): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError 4907: (138-145): Unary operator ! cannot be applied to type tuple(int_const 0,int_const 0) +// TypeError 7364: (128-145): Different number of components on the left hand side (1) than on the right hand side (2). diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/identifier_collision_return_declare.sol b/test/libsolidity/syntaxTests/iceRegressionTests/identifier_collision_return_declare.sol index 9df2f3f0b79a..b2d10d205e11 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/identifier_collision_return_declare.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/identifier_collision_return_declare.sol @@ -2,4 +2,4 @@ contract C { function ( uint ) external returns ( a [ ] calldata ) public a = ( 1 / 2 ) ; } // ---- -// TypeError: (58-59): Name has to refer to a struct, enum or contract. +// TypeError 5172: (58-59): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol index 273a75a5b777..7cf12b8c411b 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol @@ -14,4 +14,4 @@ contract C { } } // ---- -// TypeError: (530-540): Type too large for memory. +// TypeError 1534: (530-540): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct_2.sol b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct_2.sol index ada721c54626..5d724cd023a9 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct_2.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct_2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (169-181): Type too large for memory. +// TypeError 1534: (169-181): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/large_struct_array.sol b/test/libsolidity/syntaxTests/iceRegressionTests/large_struct_array.sol index 0ba74d7f859b..0f6f49f637ad 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/large_struct_array.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/large_struct_array.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (226-234): Type too large for memory. +// TypeError 1534: (226-234): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol b/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol index a9a574132c42..dda35f8ce88d 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol @@ -4,4 +4,4 @@ } } // ---- -// TypeError: (91-136): Data location must be "storage" for variable, but "memory" was given. +// TypeError 6651: (91-136): Data location must be "storage" for variable, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol b/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol index fdb652b0677f..aa79246c41e9 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol @@ -10,4 +10,4 @@ contract Test { } } // ---- -// DeclarationError: (157-198): Identifier already declared. +// DeclarationError 2333: (157-198): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/immutable/as_function_param.sol b/test/libsolidity/syntaxTests/immutable/as_function_param.sol index 3636b0aef679..dd9ca0bc80b9 100644 --- a/test/libsolidity/syntaxTests/immutable/as_function_param.sol +++ b/test/libsolidity/syntaxTests/immutable/as_function_param.sol @@ -2,4 +2,4 @@ contract C { function f(uint immutable) public pure {} } // ---- -// DeclarationError: (28-42): The "immutable" keyword can only be used for state variables. +// DeclarationError 8297: (28-42): The "immutable" keyword can only be used for state variables. diff --git a/test/libsolidity/syntaxTests/immutable/assembly.sol b/test/libsolidity/syntaxTests/immutable/assembly.sol index 7b98b67c66df..a81611120197 100644 --- a/test/libsolidity/syntaxTests/immutable/assembly.sol +++ b/test/libsolidity/syntaxTests/immutable/assembly.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (118-119): Assembly access to immutable variables is not supported. +// TypeError 3773: (118-119): Assembly access to immutable variables is not supported. diff --git a/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol b/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol index 702f0307981d..ec9591d707eb 100644 --- a/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (93-100): Construction control flow ends without initializing all immutable state variables. +// TypeError 2658: (93-100): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol b/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol index b8557321b9ef..85c82cd44742 100644 --- a/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol +++ b/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (93-94): Immutable variables must be initialized unconditionally, not in an if statement. +// TypeError 4599: (93-94): Immutable variables must be initialized unconditionally, not in an if statement. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_indirect_initialization.sol b/test/libsolidity/syntaxTests/immutable/ctor_indirect_initialization.sol index 1423659c8912..47932f7295c3 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_indirect_initialization.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_indirect_initialization.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (126-127): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1581: (126-127): Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol index ad17635c4311..bbc01bb0e084 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol @@ -7,4 +7,4 @@ contract C { function f() public pure returns (uint) { return 3 + x; } } // ---- -// TypeError: (143-144): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (143-144): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol index 0b2207808434..66d8c2ead4a3 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (78-79): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (78-79): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol b/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol index 2c1c37c79b22..fd39a3c57638 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol @@ -9,4 +9,4 @@ contract C { function f(uint a) internal pure {} } // ---- -// TypeError: (59-60): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1581: (59-60): Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_modifier_initialization.sol b/test/libsolidity/syntaxTests/immutable/ctor_modifier_initialization.sol index b266665308bc..c5bfbae6d9f4 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_modifier_initialization.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_modifier_initialization.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (109-110): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1581: (109-110): Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol index a9a1b3a225e5..8df31542ab08 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol @@ -11,4 +11,4 @@ contract C { function f(uint a) internal pure {} } // ---- -// TypeError: (126-127): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (126-127): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/decrement.sol b/test/libsolidity/syntaxTests/immutable/decrement.sol index 54ac9f6158da..8b604926b531 100644 --- a/test/libsolidity/syntaxTests/immutable/decrement.sol +++ b/test/libsolidity/syntaxTests/immutable/decrement.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (74-75): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (74-75): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/delete.sol b/test/libsolidity/syntaxTests/immutable/delete.sol index def28fad2814..a21c0cadefbd 100644 --- a/test/libsolidity/syntaxTests/immutable/delete.sol +++ b/test/libsolidity/syntaxTests/immutable/delete.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (81-82): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (81-82): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/double_specifier.sol b/test/libsolidity/syntaxTests/immutable/double_specifier.sol index fec0f823b5a0..a292ee115015 100644 --- a/test/libsolidity/syntaxTests/immutable/double_specifier.sol +++ b/test/libsolidity/syntaxTests/immutable/double_specifier.sol @@ -3,5 +3,5 @@ contract C { uint immutable constant x; } // ---- -// ParserError: (32-41): Mutability already set to "immutable" -// ParserError: (64-72): Mutability already set to "immutable" +// ParserError 3109: (32-41): Mutability already set to "immutable" +// ParserError 3109: (64-72): Mutability already set to "immutable" diff --git a/test/libsolidity/syntaxTests/immutable/external_function_pointer.sol b/test/libsolidity/syntaxTests/immutable/external_function_pointer.sol index 7ab8393cf42f..bf73cc1de7c1 100644 --- a/test/libsolidity/syntaxTests/immutable/external_function_pointer.sol +++ b/test/libsolidity/syntaxTests/immutable/external_function_pointer.sol @@ -2,4 +2,4 @@ contract C { function() external immutable f; } // ---- -// TypeError: (17-48): Immutable variables of external function type are not yet supported. +// TypeError 3366: (17-48): Immutable variables of external function type are not yet supported. diff --git a/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol b/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol index 2a4365e69ffe..a50ca6dd377b 100644 --- a/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol @@ -4,4 +4,4 @@ contract C { function f() public pure returns (uint) { return 3 + x; } } // ---- -// TypeError: (99-100): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (99-100): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol b/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol index 04eaa621ddec..9600487338a4 100644 --- a/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol +++ b/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol @@ -10,5 +10,5 @@ contract C is B(C.f) { function f() internal returns(uint) { return x = 2; } } // ---- -// TypeError: (200-201): Immutable variables can only be initialized inline or assigned directly in the constructor. -// TypeError: (200-201): Immutable state variable already initialized. +// TypeError 1581: (200-201): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1574: (200-201): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol b/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol index 2ec62e93102b..f07d7ea42b69 100644 --- a/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol @@ -10,4 +10,4 @@ contract C is B(C.f) { function f() internal returns(uint) { return x + 2; } } // ---- -// TypeError: (200-201): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (200-201): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/increment.sol b/test/libsolidity/syntaxTests/immutable/increment.sol index 0068bf87d77d..8846e3d5b6fc 100644 --- a/test/libsolidity/syntaxTests/immutable/increment.sol +++ b/test/libsolidity/syntaxTests/immutable/increment.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (74-75): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (74-75): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol b/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol index 5f659bff6a08..11e56b2a820b 100644 --- a/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol +++ b/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol @@ -5,4 +5,4 @@ contract C { function f() internal returns(uint) { return x; } } // ---- -// TypeError: (107-108): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (107-108): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol index 0d98f8b40122..4ea84bcdd626 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol @@ -11,4 +11,4 @@ contract C is B { constructor() B(y = 3) public { } } // ---- -// TypeError: (155-156): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1581: (155-156): Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol index 16ed52f36bef..b75707c349a9 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol @@ -10,4 +10,4 @@ contract C is B(C.y = 3) { uint immutable y; } // ---- -// TypeError: (111-114): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1581: (111-114): Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol index ed352746f7f3..0c387a78f940 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol @@ -13,4 +13,4 @@ contract C is B(C.y) { } } // ---- -// TypeError: (111-114): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (111-114): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol index d56fb487ad44..bc6d5e703ac7 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol @@ -16,4 +16,4 @@ contract C is B { } } // ---- -// TypeError: (260-261): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (260-261): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_direct_call.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_direct_call.sol index 5dda6bfb00dd..98daf6f3ea97 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_direct_call.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_direct_call.sol @@ -16,4 +16,4 @@ contract C is B { } } // ---- -// TypeError: (109-110): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (109-110): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_super.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_super.sol index 278efe55ff45..45e819bc1b42 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_super.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions_super.sol @@ -16,4 +16,4 @@ contract C is B { } } // ---- -// TypeError: (114-115): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (114-115): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol index f1e60dbd822d..0d6bb36151c4 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol @@ -18,4 +18,4 @@ contract C is B { } } // ---- -// TypeError: (252-253): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (252-253): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol b/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol index 24a5239ed849..3789389e4520 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol @@ -8,5 +8,5 @@ contract C is B { } } // ---- -// TypeError: (95-96): Immutable variables must be initialized in the constructor of the contract they are defined in. -// TypeError: (95-96): Immutable state variable already initialized. +// TypeError 7484: (95-96): Immutable variables must be initialized in the constructor of the contract they are defined in. +// TypeError 1574: (95-96): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/loop_initialized.sol b/test/libsolidity/syntaxTests/immutable/loop_initialized.sol index 2827ab38972d..ca1f13250381 100644 --- a/test/libsolidity/syntaxTests/immutable/loop_initialized.sol +++ b/test/libsolidity/syntaxTests/immutable/loop_initialized.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (95-96): Immutable variables can only be initialized once, not in a while statement. +// TypeError 6672: (95-96): Immutable variables can only be initialized once, not in a while statement. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol index c71335b839ad..d7636a1b9829 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol @@ -26,4 +26,4 @@ contract C is A, B { } } // ---- -// TypeError: (496-497): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (496-497): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol index eaabbb71a261..7f8c4adad24f 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol @@ -26,4 +26,4 @@ contract C is A, B { } } // ---- -// TypeError: (500-501): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (500-501): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol b/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol index 8ff940fefe00..66bb10974934 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (85-86): Immutable state variable already initialized. +// TypeError 1574: (85-86): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/non-value_type.sol b/test/libsolidity/syntaxTests/immutable/non-value_type.sol index 67398ce20455..db3355bc3117 100644 --- a/test/libsolidity/syntaxTests/immutable/non-value_type.sol +++ b/test/libsolidity/syntaxTests/immutable/non-value_type.sol @@ -2,4 +2,4 @@ contract C { uint[] immutable x; } // ---- -// TypeError: (17-35): Immutable variables cannot have a non-value type. +// TypeError 6377: (17-35): Immutable variables cannot have a non-value type. diff --git a/test/libsolidity/syntaxTests/immutable/private_state_var.sol b/test/libsolidity/syntaxTests/immutable/private_state_var.sol index 2cfc22a85317..46c7a7b04e21 100644 --- a/test/libsolidity/syntaxTests/immutable/private_state_var.sol +++ b/test/libsolidity/syntaxTests/immutable/private_state_var.sol @@ -17,4 +17,4 @@ contract C is B { } // ---- -// TypeError: (209-210): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (209-210): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol b/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol index d35c68d8a863..2f4b98c3fe9d 100644 --- a/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol +++ b/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol @@ -3,4 +3,4 @@ contract C { uint y = x; } // ---- -// TypeError: (52-53): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. +// TypeError 7733: (52-53): Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it. diff --git a/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol b/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol index 0fd5461d4b3d..abe9d8d0a457 100644 --- a/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (70-77): Construction control flow ends without initializing all immutable state variables. +// TypeError 2658: (70-77): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/runtimeCode.sol b/test/libsolidity/syntaxTests/immutable/runtimeCode.sol index 7db3245dc398..16965317c3e0 100644 --- a/test/libsolidity/syntaxTests/immutable/runtimeCode.sol +++ b/test/libsolidity/syntaxTests/immutable/runtimeCode.sol @@ -8,4 +8,4 @@ contract Test { } } // ---- -// TypeError: (153-172): "runtimeCode" is not available for contracts containing immutable variables. +// TypeError 9274: (153-172): "runtimeCode" is not available for contracts containing immutable variables. diff --git a/test/libsolidity/syntaxTests/immutable/runtimeCodeInheritance.sol b/test/libsolidity/syntaxTests/immutable/runtimeCodeInheritance.sol index aec4acd2ef30..f7cf83775f25 100644 --- a/test/libsolidity/syntaxTests/immutable/runtimeCodeInheritance.sol +++ b/test/libsolidity/syntaxTests/immutable/runtimeCodeInheritance.sol @@ -10,4 +10,4 @@ contract Test { } } // ---- -// TypeError: (185-210): "runtimeCode" is not available for contracts containing immutable variables. +// TypeError 9274: (185-210): "runtimeCode" is not available for contracts containing immutable variables. diff --git a/test/libsolidity/syntaxTests/immutable/selector.sol b/test/libsolidity/syntaxTests/immutable/selector.sol index 4b880c8e8bcb..db9647b67806 100644 --- a/test/libsolidity/syntaxTests/immutable/selector.sol +++ b/test/libsolidity/syntaxTests/immutable/selector.sol @@ -8,5 +8,5 @@ contract C { function readX() external view returns(uint) { return x; } } // ---- -// Warning: (85-104): Statement has no effect. -// Warning: (85-89): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 6133: (85-104): Statement has no effect. +// Warning 5805: (85-89): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/syntaxTests/immutable/selector_function_name.sol b/test/libsolidity/syntaxTests/immutable/selector_function_name.sol index c84f724089e2..c5ffb6e9e772 100644 --- a/test/libsolidity/syntaxTests/immutable/selector_function_name.sol +++ b/test/libsolidity/syntaxTests/immutable/selector_function_name.sol @@ -9,5 +9,5 @@ contract C { function selector() external view returns(uint) { return x; } } // ---- -// Warning: (85-104): Statement has no effect. -// Warning: (114-124): Statement has no effect. +// Warning 6133: (85-104): Statement has no effect. +// Warning 6133: (114-124): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/immutable/uninitialized.sol b/test/libsolidity/syntaxTests/immutable/uninitialized.sol index 18c60ea9df3d..d1791fe0f843 100644 --- a/test/libsolidity/syntaxTests/immutable/uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/uninitialized.sol @@ -2,4 +2,4 @@ contract C { uint immutable x; } // ---- -// TypeError: (0-36): Construction control flow ends without initializing all immutable state variables. +// TypeError 2658: (0-36): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol b/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol index 69aa5448f542..305501369f8b 100644 --- a/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol +++ b/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol @@ -17,5 +17,5 @@ contract C is B { } // ---- -// TypeError: (0-209): Construction control flow ends without initializing all immutable state variables. -// TypeError: (211-375): Construction control flow ends without initializing all immutable state variables. +// TypeError 2658: (0-209): Construction control flow ends without initializing all immutable state variables. +// TypeError 2658: (211-375): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/writing_after_initialization.sol b/test/libsolidity/syntaxTests/immutable/writing_after_initialization.sol index e844de0800fc..05d366ead4bb 100644 --- a/test/libsolidity/syntaxTests/immutable/writing_after_initialization.sol +++ b/test/libsolidity/syntaxTests/immutable/writing_after_initialization.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (76-77): Immutable variables can only be initialized inline or assigned directly in the constructor. -// TypeError: (76-77): Immutable state variable already initialized. +// TypeError 1581: (76-77): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1574: (76-77): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/writing_after_initialization_modifier.sol b/test/libsolidity/syntaxTests/immutable/writing_after_initialization_modifier.sol index 592633379c84..cdfd47443bf3 100644 --- a/test/libsolidity/syntaxTests/immutable/writing_after_initialization_modifier.sol +++ b/test/libsolidity/syntaxTests/immutable/writing_after_initialization_modifier.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (111-112): Immutable variables can only be initialized inline or assigned directly in the constructor. -// TypeError: (111-112): Immutable state variable already initialized. +// TypeError 1581: (111-112): Immutable variables can only be initialized inline or assigned directly in the constructor. +// TypeError 1574: (111-112): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/imports/filename_with_period.sol b/test/libsolidity/syntaxTests/imports/filename_with_period.sol index 73c47087fe3c..6b27ca0325f4 100644 --- a/test/libsolidity/syntaxTests/imports/filename_with_period.sol +++ b/test/libsolidity/syntaxTests/imports/filename_with_period.sol @@ -3,4 +3,4 @@ contract B {} ==== Source: a/a.sol ==== import ".b.sol"; contract A is B {} // ---- -// ParserError: (a/a.sol:0-16): Source ".b.sol" not found: File not supplied initially. +// ParserError 6275: (a/a.sol:0-16): Source ".b.sol" not found: File not supplied initially. diff --git a/test/libsolidity/syntaxTests/imports/import_access_struct.sol b/test/libsolidity/syntaxTests/imports/import_access_struct.sol index 81552a7caed6..03dac4926a8a 100644 --- a/test/libsolidity/syntaxTests/imports/import_access_struct.sol +++ b/test/libsolidity/syntaxTests/imports/import_access_struct.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// Warning: (b:90-91): Statement has no effect. -// Warning: (b:101-104): Statement has no effect. +// Warning 6133: (b:90-91): Statement has no effect. +// Warning 6133: (b:101-104): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/imports/import_does_not_clutter_importee.sol b/test/libsolidity/syntaxTests/imports/import_does_not_clutter_importee.sol index 99f3f53e3a76..f1aaf75dfc2b 100644 --- a/test/libsolidity/syntaxTests/imports/import_does_not_clutter_importee.sol +++ b/test/libsolidity/syntaxTests/imports/import_does_not_clutter_importee.sol @@ -3,4 +3,4 @@ contract C { D d; } ==== Source: b ==== import "a"; contract D is C {} // ---- -// DeclarationError: (a:13-14): Identifier not found or not unique. +// DeclarationError 7920: (a:13-14): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_1.sol b/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_1.sol index 5cced4a1a252..214de78d15ba 100644 --- a/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_1.sol +++ b/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_1.sol @@ -16,4 +16,4 @@ contract B is A { } import "./B.sol"; contract C is B { } // ---- -// TypeError: (C.sol:18-37): Contract "C" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. +// TypeError 6594: (C.sol:18-37): Contract "C" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. diff --git a/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_2.sol b/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_2.sol index b8bddff6645c..07b9cdefe6c7 100644 --- a/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_2.sol +++ b/test/libsolidity/syntaxTests/imports/inheritance_abi_encoder_mismatch_2.sol @@ -14,4 +14,4 @@ contract B is A { } import "./B.sol"; contract C is B { } // ---- -// TypeError: (B.sol:18-37): Contract "B" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. +// TypeError 6594: (B.sol:18-37): Contract "B" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. diff --git a/test/libsolidity/syntaxTests/imports/library_name_clash.sol b/test/libsolidity/syntaxTests/imports/library_name_clash.sol index 19f3697d5ae6..00a9c155023e 100644 --- a/test/libsolidity/syntaxTests/imports/library_name_clash.sol +++ b/test/libsolidity/syntaxTests/imports/library_name_clash.sol @@ -5,4 +5,4 @@ library A {} ==== Source: c ==== import {A} from "./a"; import {A} from "./b"; // ---- -// DeclarationError: (c:31-32): Identifier already declared. +// DeclarationError 2333: (c:31-32): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_1.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_1.sol index a5b1acc60997..60a46eb1953e 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_1.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_1.sol @@ -3,4 +3,4 @@ contract A {} ==== Source: b ==== import "a"; contract A {} // ---- -// DeclarationError: (b:12-25): Identifier already declared. +// DeclarationError 2333: (b:12-25): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_2.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_2.sol index 96925f368f51..1043ae0742da 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_2.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_2.sol @@ -3,4 +3,4 @@ contract A {} ==== Source: b ==== import "a" as A; contract A {} // ---- -// DeclarationError: (b:17-30): Identifier already declared. +// DeclarationError 2333: (b:17-30): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_3.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_3.sol index 2ff01b5f86d6..23c27b327e9e 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_3.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_3.sol @@ -3,4 +3,4 @@ contract A {} ==== Source: b ==== import {A as b} from "a"; contract b {} // ---- -// DeclarationError: (b:26-39): Identifier already declared. +// DeclarationError 2333: (b:26-39): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_4.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_4.sol index abe59271ea5f..70dba3c645fa 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_4.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_4.sol @@ -3,4 +3,4 @@ contract A {} ==== Source: b ==== import {A} from "a"; contract A {} // ---- -// DeclarationError: (b:21-34): Identifier already declared. +// DeclarationError 2333: (b:21-34): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_1.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_1.sol index 83256e0ba82a..40e858377f12 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_1.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_1.sol @@ -4,4 +4,4 @@ contract A {} import "a"; struct A { uint256 a; } // ---- -// DeclarationError: (b:12-35): Identifier already declared. +// DeclarationError 2333: (b:12-35): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_2.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_2.sol index 20179bfc44c2..081261f9a57a 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_2.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_2.sol @@ -4,4 +4,4 @@ contract A {} import "a" as A; struct A { uint256 a; } // ---- -// DeclarationError: (b:17-40): Identifier already declared. +// DeclarationError 2333: (b:17-40): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_3.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_3.sol index 23958ad367e7..242cf4f71ab9 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_3.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_3.sol @@ -4,4 +4,4 @@ contract A {} import {A as b} from "a"; struct b { uint256 a; } // ---- -// DeclarationError: (b:26-49): Identifier already declared. +// DeclarationError 2333: (b:26-49): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_4.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_4.sol index 1c5258042494..f85d9e93de1f 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_4.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_contract_struct_4.sol @@ -4,4 +4,4 @@ contract A {} import {A} from "a"; struct A { uint256 a; } // ---- -// DeclarationError: (b:21-44): Identifier already declared. +// DeclarationError 2333: (b:21-44): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum.sol index f3e583dfff15..d0d994a99ae5 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum.sol @@ -4,4 +4,4 @@ enum E { A } import "a"; enum E { A } // ---- -// DeclarationError: (b:12-24): Identifier already declared. +// DeclarationError 2333: (b:12-24): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_contract.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_contract.sol index 31e56bab4522..4133b322a1e3 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_contract.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_contract.sol @@ -4,4 +4,4 @@ enum E { A } import "a"; contract E { } // ---- -// DeclarationError: (b:12-26): Identifier already declared. +// DeclarationError 2333: (b:12-26): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_struct.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_struct.sol index 3c204e3f05c2..3da456b8274e 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_struct.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_enum_struct.sol @@ -4,4 +4,4 @@ enum E { A } import "a"; struct E { uint256 a; } // ---- -// DeclarationError: (b:12-35): Identifier already declared. +// DeclarationError 2333: (b:12-35): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_1.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_1.sol index f754ce28f3e8..1257bd609c43 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_1.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_1.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import "a"; struct A { uint256 a; } // ---- -// DeclarationError: (b:12-35): Identifier already declared. +// DeclarationError 2333: (b:12-35): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_2.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_2.sol index 9b1de8e6b879..316c80ee7ea5 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_2.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_2.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import "a" as A; struct A { uint256 a; } // ---- -// DeclarationError: (b:17-40): Identifier already declared. +// DeclarationError 2333: (b:17-40): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_3.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_3.sol index 1a7d662747a6..dc3acc0961d2 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_3.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_3.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import {A as b} from "a"; struct b { uint256 a; } // ---- -// DeclarationError: (b:26-49): Identifier already declared. +// DeclarationError 2333: (b:26-49): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_4.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_4.sol index f146ca6547e1..632aa1ed4d1a 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_4.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_4.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import {A} from "a"; struct A { uint256 a; } // ---- -// DeclarationError: (b:21-44): Identifier already declared. +// DeclarationError 2333: (b:21-44): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_1.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_1.sol index 21c0efd70fb4..5b9089fa5d41 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_1.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_1.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import "a"; contract A {} // ---- -// DeclarationError: (b:12-25): Identifier already declared. +// DeclarationError 2333: (b:12-25): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_2.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_2.sol index c248d27430cb..d92579d47306 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_2.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_2.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import "a" as A; contract A {} // ---- -// DeclarationError: (b:17-30): Identifier already declared. +// DeclarationError 2333: (b:17-30): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_3.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_3.sol index aec99ced8261..c34cd3b9e94c 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_3.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_3.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import {A as b} from "a"; contract b {} // ---- -// DeclarationError: (b:26-39): Identifier already declared. +// DeclarationError 2333: (b:26-39): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_4.sol b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_4.sol index 292bd7529f5e..145eb219645f 100644 --- a/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_4.sol +++ b/test/libsolidity/syntaxTests/imports/name_clash_in_import_struct_contract_4.sol @@ -4,4 +4,4 @@ struct A { uint256 a; } import {A} from "a"; contract A {} // ---- -// DeclarationError: (b:21-34): Identifier already declared. +// DeclarationError 2333: (b:21-34): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_alias.sol b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_alias.sol index 65a606e0c48e..8608e2c9a469 100644 --- a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_alias.sol +++ b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_alias.sol @@ -3,4 +3,4 @@ contract C {} ==== Source: b ==== import {C as msg} from "B.sol"; // ---- -// Warning: (b:13-16): This declaration shadows a builtin symbol. +// Warning 2319: (b:13-16): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_imports.sol b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_imports.sol index 2121b13595f9..178f1144c3d8 100644 --- a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_imports.sol +++ b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_imports.sol @@ -5,4 +5,4 @@ import * as msg from "B.sol"; contract C { } // ---- -// Warning: (b:0-29): This declaration shadows a builtin symbol. +// Warning 2319: (b:0-29): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_multiple_imports.sol b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_multiple_imports.sol index 3d82041afaa6..30d94338f0c4 100644 --- a/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_multiple_imports.sol +++ b/test/libsolidity/syntaxTests/imports/shadowing_builtins_with_multiple_imports.sol @@ -5,7 +5,7 @@ import {msg, block} from "B.sol"; contract C { } // ---- -// Warning: (B.sol:0-15): This declaration shadows a builtin symbol. -// Warning: (B.sol:16-32): This declaration shadows a builtin symbol. -// Warning: (b:8-11): This declaration shadows a builtin symbol. -// Warning: (b:13-18): This declaration shadows a builtin symbol. +// Warning 2319: (B.sol:0-15): This declaration shadows a builtin symbol. +// Warning 2319: (B.sol:16-32): This declaration shadows a builtin symbol. +// Warning 2319: (b:8-11): This declaration shadows a builtin symbol. +// Warning 2319: (b:13-18): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/imports/shadowing_via_import.sol b/test/libsolidity/syntaxTests/imports/shadowing_via_import.sol index 19f3697d5ae6..00a9c155023e 100644 --- a/test/libsolidity/syntaxTests/imports/shadowing_via_import.sol +++ b/test/libsolidity/syntaxTests/imports/shadowing_via_import.sol @@ -5,4 +5,4 @@ library A {} ==== Source: c ==== import {A} from "./a"; import {A} from "./b"; // ---- -// DeclarationError: (c:31-32): Identifier already declared. +// DeclarationError 2333: (c:31-32): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/indexing/array_multidim_rational.sol b/test/libsolidity/syntaxTests/indexing/array_multidim_rational.sol index df9f8223b327..ace6dbddade7 100644 --- a/test/libsolidity/syntaxTests/indexing/array_multidim_rational.sol +++ b/test/libsolidity/syntaxTests/indexing/array_multidim_rational.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// TypeError: (67-72): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. -// TypeError: (74-79): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. -// TypeError: (81-90): Type rational_const 9485...(73 digits omitted)...5712 / 5 is not implicitly convertible to expected type uint256. -// TypeError: (65-91): Index expression cannot be represented as an unsigned integer. +// TypeError 7407: (67-72): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. +// TypeError 7407: (74-79): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. +// TypeError 7407: (81-90): Type rational_const 9485...(73 digits omitted)...5712 / 5 is not implicitly convertible to expected type uint256. +// TypeError 6318: (65-91): Index expression cannot be represented as an unsigned integer. diff --git a/test/libsolidity/syntaxTests/indexing/array_multim_overflow_index.sol b/test/libsolidity/syntaxTests/indexing/array_multim_overflow_index.sol index 9c98ad451f57..e7701e7ab054 100644 --- a/test/libsolidity/syntaxTests/indexing/array_multim_overflow_index.sol +++ b/test/libsolidity/syntaxTests/indexing/array_multim_overflow_index.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// TypeError: (67-72): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. -// TypeError: (74-79): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. -// TypeError: (81-90): Type int_const -189...(75 digits omitted)...1423 is not implicitly convertible to expected type uint256. -// TypeError: (65-91): Index expression cannot be represented as an unsigned integer. +// TypeError 7407: (67-72): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. +// TypeError 7407: (74-79): Type int_const 1897...(74 digits omitted)...1424 is not implicitly convertible to expected type uint256. +// TypeError 7407: (81-90): Type int_const -189...(75 digits omitted)...1423 is not implicitly convertible to expected type uint256. +// TypeError 6318: (65-91): Index expression cannot be represented as an unsigned integer. diff --git a/test/libsolidity/syntaxTests/indexing/array_negative_index.sol b/test/libsolidity/syntaxTests/indexing/array_negative_index.sol index 019d023b56c7..17ea84088bce 100644 --- a/test/libsolidity/syntaxTests/indexing/array_negative_index.sol +++ b/test/libsolidity/syntaxTests/indexing/array_negative_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (67-69): Type int_const -1 is not implicitly convertible to expected type uint256. +// TypeError 7407: (67-69): Type int_const -1 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol b/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol index 7c0ac9fe24c4..086cd42a4670 100644 --- a/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol +++ b/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (67-178): Type int_const 8888...(103 digits omitted)...8888 is not implicitly convertible to expected type uint256. +// TypeError 7407: (67-178): Type int_const 8888...(103 digits omitted)...8888 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol b/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol index b00798570ed3..17190ee381f1 100644 --- a/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol +++ b/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-70): Out of bounds array access. +// TypeError 3383: (65-70): Out of bounds array access. diff --git a/test/libsolidity/syntaxTests/indexing/array_without_index.sol b/test/libsolidity/syntaxTests/indexing/array_without_index.sol index 6b1c27781018..485746ecd26a 100644 --- a/test/libsolidity/syntaxTests/indexing/array_without_index.sol +++ b/test/libsolidity/syntaxTests/indexing/array_without_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (61-64): Index expression cannot be omitted. +// TypeError 9689: (61-64): Index expression cannot be omitted. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_negative_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_negative_index.sol index 12399317863c..aeb5fc873ae2 100644 --- a/test/libsolidity/syntaxTests/indexing/fixedbytes_negative_index.sol +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_negative_index.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// TypeError: (58-60): Type int_const -1 is not implicitly convertible to expected type uint256. -// TypeError: (56-61): Index expression cannot be represented as an unsigned integer. +// TypeError 7407: (58-60): Type int_const -1 is not implicitly convertible to expected type uint256. +// TypeError 6318: (56-61): Index expression cannot be represented as an unsigned integer. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_noninteger_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_noninteger_index.sol index adf7db61bf10..2b874eab2333 100644 --- a/test/libsolidity/syntaxTests/indexing/fixedbytes_noninteger_index.sol +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_noninteger_index.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// TypeError: (58-169): Type int_const 8888...(103 digits omitted)...8888 is not implicitly convertible to expected type uint256. -// TypeError: (56-170): Index expression cannot be represented as an unsigned integer. +// TypeError 7407: (58-169): Type int_const 8888...(103 digits omitted)...8888 is not implicitly convertible to expected type uint256. +// TypeError 6318: (56-170): Index expression cannot be represented as an unsigned integer. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol index 8264a8b2943f..fb06db9fb91c 100644 --- a/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (56-61): Out of bounds array access. +// TypeError 1859: (56-61): Out of bounds array access. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol index 979ac8a7f72c..948333cbee49 100644 --- a/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (56-59): Index expression cannot be omitted. +// TypeError 8830: (56-59): Index expression cannot be omitted. diff --git a/test/libsolidity/syntaxTests/indexing/function_type.sol b/test/libsolidity/syntaxTests/indexing/function_type.sol index 6c6c06a937a5..10edb7d96018 100644 --- a/test/libsolidity/syntaxTests/indexing/function_type.sol +++ b/test/libsolidity/syntaxTests/indexing/function_type.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) +// TypeError 2614: (41-42): Indexed expression has to be a type, mapping or array (is function ()) diff --git a/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol b/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol index bf511bc94d7b..9bcb9e1e6011 100644 --- a/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol +++ b/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) +// TypeError 2614: (41-42): Indexed expression has to be a type, mapping or array (is function ()) diff --git a/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol b/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol index 59010709dc94..93f81abbde02 100644 --- a/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol +++ b/test/libsolidity/syntaxTests/indexing/struct_array_noninteger_index.sol @@ -7,4 +7,4 @@ contract test { } // ---- -// TypeError: (101-241): Type int_const 7555...(132 digits omitted)...5555 is not implicitly convertible to expected type uint256. +// TypeError 7407: (101-241): Type int_const 7555...(132 digits omitted)...5555 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol index 692b1827600d..e1072e47daac 100644 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol @@ -4,4 +4,4 @@ contract Base { contract Derived is Base(2) { } contract Derived2 is Base(), Derived() { } // ---- -// TypeError: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol index 96be62f2d457..16c936b3efd0 100644 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol @@ -6,4 +6,4 @@ contract Derived is Base, Base1 { constructor(uint i) Base(i) public {} } // ---- -// DeclarationError: (138-145): Base constructor arguments given twice. +// DeclarationError 3364: (138-145): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol index 8f5ceef894e3..15d4e7142086 100644 --- a/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol +++ b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol @@ -1,4 +1,4 @@ contract A { constructor() public { } } contract B is A { constructor() A public { } } // ---- -// DeclarationError: (72-73): Modifier-style base constructor call without arguments. +// DeclarationError 1563: (72-73): Modifier-style base constructor call without arguments. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol index 76cc937b2086..48d626927d46 100644 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol @@ -2,4 +2,4 @@ contract A { constructor(uint) public { } } contract B is A(2) { constructor() public { } } contract C is B { constructor() A(3) public { } } // ---- -// DeclarationError: (125-129): Base constructor arguments given twice. +// DeclarationError 3364: (125-129): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol index 4c7a684fb021..8986854b13cb 100644 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol @@ -1,4 +1,4 @@ contract A { constructor(uint) public { } } contract B is A(2) { constructor() A(3) public { } } // ---- -// DeclarationError: (79-83): Base constructor arguments given twice. +// DeclarationError 3364: (79-83): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol index 2e77e0777c2b..217dd2175ca2 100644 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol @@ -3,5 +3,5 @@ contract A is C(2) {} contract B is C(2) {} contract D is A, B { constructor() C(3) public {} } // ---- -// DeclarationError: (122-126): Base constructor arguments given twice. -// DeclarationError: (122-126): Base constructor arguments given twice. +// DeclarationError 3364: (122-126): Base constructor arguments given twice. +// DeclarationError 3364: (122-126): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol index 0beb15522884..3d0e01eb57d7 100644 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol @@ -3,4 +3,4 @@ contract A is C(2) {} contract B is C(2) {} contract D is A, B {} // ---- -// DeclarationError: (87-108): Base constructor arguments given twice. +// DeclarationError 3364: (87-108): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol index 7142840e7687..e03ba8d63be5 100644 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol @@ -3,4 +3,4 @@ contract A is C { constructor() C(2) public {} } contract B is C { constructor() C(2) public {} } contract D is A, B { } // ---- -// DeclarationError: (141-163): Base constructor arguments given twice. +// DeclarationError 3364: (141-163): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_overrides_receive.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_overrides_receive.sol index 87c7efa63555..161c23c3ff21 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_overrides_receive.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_overrides_receive.sol @@ -5,4 +5,4 @@ contract D is C { fallback() override external {} } // ---- -// TypeError: (76-84): Function has override specified but does not override anything. +// TypeError 7792: (76-84): Function has override specified but does not override anything. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override.sol index c025e6b58257..5bf71099a4e0 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override.sol @@ -5,4 +5,4 @@ contract D is C { fallback() external {} } // ---- -// TypeError: (66-88): Overriding function is missing "override" specifier. +// TypeError 9456: (66-88): Overriding function is missing "override" specifier. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override_intermediate.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override_intermediate.sol index 42b219113989..8c03b57e0571 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override_intermediate.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/fallback_without_override_intermediate.sol @@ -7,4 +7,4 @@ contract E is D { fallback() external {} } // ---- -// TypeError: (86-108): Overriding function is missing "override" specifier. +// TypeError 9456: (86-108): Overriding function is missing "override" specifier. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_overrides_fallback.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_overrides_fallback.sol index 74d53c6b31f7..c7a52537130a 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_overrides_fallback.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_overrides_fallback.sol @@ -5,4 +5,4 @@ contract D is C { receive() override external payable {} } // ---- -// TypeError: (68-76): Function has override specified but does not override anything. +// TypeError 7792: (68-76): Function has override specified but does not override anything. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override.sol index 86edcf2f012a..c6809ae4211d 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override.sol @@ -5,4 +5,4 @@ contract D is C { receive() external payable {} } // ---- -// TypeError: (73-102): Overriding function is missing "override" specifier. +// TypeError 9456: (73-102): Overriding function is missing "override" specifier. diff --git a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override_intermediate.sol b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override_intermediate.sol index 6414e44cfa39..c4f0e27c8d45 100644 --- a/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override_intermediate.sol +++ b/test/libsolidity/syntaxTests/inheritance/fallback_receive/receive_without_override_intermediate.sol @@ -7,4 +7,4 @@ contract E is D { receive() external payable {} } // ---- -// TypeError: (93-122): Overriding function is missing "override" specifier. +// TypeError 9456: (93-122): Overriding function is missing "override" specifier. diff --git a/test/libsolidity/syntaxTests/inheritance/interface/contract_base.sol b/test/libsolidity/syntaxTests/inheritance/interface/contract_base.sol index 1afb921c5bec..f7f084d1335c 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/contract_base.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/contract_base.sol @@ -2,4 +2,4 @@ contract C {} interface I is C {} // ---- -// TypeError: (29-30): Interfaces can only inherit from other interfaces. +// TypeError 6536: (29-30): Interfaces can only inherit from other interfaces. diff --git a/test/libsolidity/syntaxTests/inheritance/interface/implementation/partial.sol b/test/libsolidity/syntaxTests/inheritance/interface/implementation/partial.sol index 378c3c41b492..ee5d1608d689 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/implementation/partial.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/implementation/partial.sol @@ -16,4 +16,4 @@ contract SubImpl is Sub { } // ---- -// TypeError: (234-407): Contract "SubImpl" should be marked as abstract. +// TypeError 3656: (234-407): Contract "SubImpl" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_a.sol b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_a.sol index 0528af074ae4..9fffe92074a5 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_a.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_a.sol @@ -5,4 +5,4 @@ interface Sub is ParentA, ParentB {} contract ListsA is Sub, ParentA {} // ---- -// TypeError: (80-114): Linearization of inheritance graph impossible +// TypeError 5005: (80-114): Linearization of inheritance graph impossible diff --git a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_b.sol b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_b.sol index cea97889cad2..329dfdf5a4f9 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_b.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_b.sol @@ -5,4 +5,4 @@ interface Sub is ParentA, ParentB {} contract ListsB is Sub, ParentB {} // ---- -// TypeError: (80-114): Linearization of inheritance graph impossible +// TypeError 5005: (80-114): Linearization of inheritance graph impossible diff --git a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_both.sol b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_both.sol index 8bf99bd9198c..0223af603ef8 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_both.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/linearization/invalid/lists_both.sol @@ -5,4 +5,4 @@ interface Sub is ParentA, ParentB {} contract ListsBoth is Sub, ParentA, ParentB {} // ---- -// TypeError: (80-126): Linearization of inheritance graph impossible +// TypeError 5005: (80-126): Linearization of inheritance graph impossible diff --git a/test/libsolidity/syntaxTests/inheritance/interface/multiple_parents.sol b/test/libsolidity/syntaxTests/inheritance/interface/multiple_parents.sol index f3dcf6f0e3d4..2ba34ad12c31 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/multiple_parents.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/multiple_parents.sol @@ -12,4 +12,4 @@ interface Sub is SuperA, SuperB { } // ---- -// TypeError: (236-271): Derived contract must override function "test". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (236-271): Derived contract must override function "test". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/interface/overrides_multiple.sol b/test/libsolidity/syntaxTests/inheritance/interface/overrides_multiple.sol index 36d76f3a8c0f..96f741471aa0 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/overrides_multiple.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/overrides_multiple.sol @@ -23,9 +23,9 @@ interface Sub is SuperA, SuperB { } // ---- -// TypeError: (572-616): Overriding function is missing "override" specifier. -// TypeError: (572-616): Overriding function is missing "override" specifier. -// TypeError: (572-616): Function needs to specify overridden contracts "SuperA" and "SuperB". -// TypeError: (647-655): Function needs to specify overridden contracts "SuperA" and "SuperB". -// TypeError: (705-721): Function needs to specify overridden contract "SuperB". -// TypeError: (771-787): Function needs to specify overridden contract "SuperA". +// TypeError 9456: (572-616): Overriding function is missing "override" specifier. +// TypeError 9456: (572-616): Overriding function is missing "override" specifier. +// TypeError 4327: (572-616): Function needs to specify overridden contracts "SuperA" and "SuperB". +// TypeError 4327: (647-655): Function needs to specify overridden contracts "SuperA" and "SuperB". +// TypeError 4327: (705-721): Function needs to specify overridden contract "SuperB". +// TypeError 4327: (771-787): Function needs to specify overridden contract "SuperA". diff --git a/test/libsolidity/syntaxTests/inheritance/interface/overrides_single.sol b/test/libsolidity/syntaxTests/inheritance/interface/overrides_single.sol index 1a68d980b85d..106fb89755f5 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/overrides_single.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/overrides_single.sol @@ -11,4 +11,4 @@ interface Sub is Super { } // ---- -// TypeError: (197-241): Overriding function is missing "override" specifier. +// TypeError 9456: (197-241): Overriding function is missing "override" specifier. diff --git a/test/libsolidity/syntaxTests/inheritance/interface_virtual_warning.sol b/test/libsolidity/syntaxTests/inheritance/interface_virtual_warning.sol index 761562822e63..703c47859e2f 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface_virtual_warning.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface_virtual_warning.sol @@ -2,4 +2,4 @@ interface I { function foo() virtual external; } // ---- -// Warning: (15-47): Interface functions are implicitly "virtual" +// Warning 5815: (15-47): Interface functions are implicitly "virtual" diff --git a/test/libsolidity/syntaxTests/inheritance/override/add_view.sol b/test/libsolidity/syntaxTests/inheritance/override/add_view.sol index 551ab86cca99..14c6297c3ed7 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/add_view.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/add_view.sol @@ -1,5 +1,5 @@ contract B { function f() virtual public {} } contract C is B { function f() public view {} } // ---- -// TypeError: (64-91): Overriding function is missing "override" specifier. -// TypeError: (64-91): Overriding function changes state mutability from "nonpayable" to "view". +// TypeError 9456: (64-91): Overriding function is missing "override" specifier. +// TypeError 6959: (64-91): Overriding function changes state mutability from "nonpayable" to "view". diff --git a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_implementation.sol b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_implementation.sol index bf6a07cf8a72..3179a9789b20 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_implementation.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_implementation.sol @@ -16,5 +16,5 @@ abstract contract B is I { contract C is A, B { } // ---- -// TypeError: (342-364): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. -// TypeError: (342-364): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (342-364): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (342-364): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_mention.sol b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_mention.sol index 63fbcbc83eda..04db16623fa9 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_mention.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_and_unique_mention.sol @@ -14,4 +14,4 @@ abstract contract B is I { contract C is A, B { } // ---- -// TypeError: (254-276): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (254-276): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_functions_overridden_in_intermediate_base_unimplemented.sol b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_functions_overridden_in_intermediate_base_unimplemented.sol index b30bc85b0fa4..905f45832913 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_functions_overridden_in_intermediate_base_unimplemented.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/ambiguous_base_functions_overridden_in_intermediate_base_unimplemented.sol @@ -10,6 +10,6 @@ contract C is A, B { contract X is C { } // ---- -// TypeError: (120-158): Overriding an implemented function with an unimplemented function is not allowed. -// TypeError: (120-158): Overriding an implemented function with an unimplemented function is not allowed. -// TypeError: (120-158): Functions without implementation must be marked virtual. +// TypeError 4593: (120-158): Overriding an implemented function with an unimplemented function is not allowed. +// TypeError 4593: (120-158): Overriding an implemented function with an unimplemented function is not allowed. +// TypeError 5424: (120-158): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol index ef4a41cc3990..32958ef7a58e 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol @@ -16,7 +16,7 @@ contract B is A { function i(uint[] memory) public override payable {} } // ---- -// DeclarationError: (300-353): Function with same name and arguments defined twice. -// DeclarationError: (358-419): Function with same name and arguments defined twice. -// DeclarationError: (424-485): Function with same name and arguments defined twice. -// DeclarationError: (490-546): Function with same name and arguments defined twice. +// DeclarationError 1686: (300-353): Function with same name and arguments defined twice. +// DeclarationError 1686: (358-419): Function with same name and arguments defined twice. +// DeclarationError 1686: (424-485): Function with same name and arguments defined twice. +// DeclarationError 1686: (490-546): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/inheritance/override/change_return_types_in_interface.sol b/test/libsolidity/syntaxTests/inheritance/override/change_return_types_in_interface.sol index 308f4eb0ffc3..8a477b70db95 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/change_return_types_in_interface.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/change_return_types_in_interface.sol @@ -7,5 +7,5 @@ contract B is I { function f() public pure returns (uint, uint) {} } // ---- -// TypeError: (182-230): Overriding function is missing "override" specifier. -// TypeError: (182-230): Overriding function return types differ. +// TypeError 9456: (182-230): Overriding function is missing "override" specifier. +// TypeError 4822: (182-230): Overriding function return types differ. diff --git a/test/libsolidity/syntaxTests/inheritance/override/common_base_and_unique_implementation.sol b/test/libsolidity/syntaxTests/inheritance/override/common_base_and_unique_implementation.sol index 4366817a11b0..0164d4dd12f0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/common_base_and_unique_implementation.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/common_base_and_unique_implementation.sol @@ -13,5 +13,5 @@ abstract contract B is I { contract C is A, B { } // ---- -// TypeError: (292-314): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. -// TypeError: (292-314): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (292-314): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (292-314): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/detect_double_override.sol b/test/libsolidity/syntaxTests/inheritance/override/detect_double_override.sol index 60138f48dbcb..9907090c60aa 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/detect_double_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/detect_double_override.sol @@ -3,5 +3,5 @@ contract X { function test() internal override override returns (uint256); } // ---- -// ParserError: (34-42): Override already specified. -// ParserError: (87-95): Override already specified. +// ParserError 9125: (34-42): Override already specified. +// ParserError 1827: (87-95): Override already specified. diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_empty_intermediate_public_state_variable_and_function.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_empty_intermediate_public_state_variable_and_function.sol index 76660c679855..ef48ab5fe42d 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_empty_intermediate_public_state_variable_and_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_empty_intermediate_public_state_variable_and_function.sol @@ -10,4 +10,4 @@ abstract contract B is I } abstract contract C is A, B {} // ---- -// TypeError: (128-158): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (128-158): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function.sol index 61289af0e607..90c747dc4db7 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function.sol @@ -11,4 +11,4 @@ abstract contract B is I } abstract contract C is A, B {} // ---- -// TypeError: (185-215): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (185-215): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function_implemented.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function_implemented.sol index 71a647acc36e..add03e5cbbee 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function_implemented.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function_implemented.sol @@ -11,4 +11,4 @@ abstract contract B is I } abstract contract C is A, B {} // ---- -// TypeError: (198-228): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (198-228): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol index 5cad35d27829..d59dade35cb4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol @@ -11,4 +11,4 @@ contract B is I } contract C is A, B {} // ---- -// TypeError: (219-240): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (219-240): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol index 94ef8be63962..390e763e86b9 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol @@ -10,4 +10,4 @@ contract B is I } contract C is A, B {} // ---- -// TypeError: (145-166): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (145-166): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/function_pointer.sol b/test/libsolidity/syntaxTests/inheritance/override/function_pointer.sol index 2399a9aafd6b..bae30a862369 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/function_pointer.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/function_pointer.sol @@ -4,4 +4,4 @@ contract C { function() external override virtual fp3; } // ---- -// ParserError: (34-41): Expected identifier but got 'virtual' +// ParserError 2314: (34-41): Expected identifier but got 'virtual' diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol index c94a16edc1ae..c7602dfee775 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol @@ -6,4 +6,4 @@ contract T { constructor() public { new Y(); } } // ---- -// TypeError: (98-131): Public state variables can only override functions with external visibility. +// TypeError 5225: (98-131): Public state variables can only override functions with external visibility. diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol index bd69c336aa8a..99798028df98 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol @@ -6,5 +6,5 @@ contract T { constructor() public { new Y(); } } // ---- -// TypeError: (97-130): Public state variables can only override functions with external visibility. -// TypeError: (22-72): "virtual" and "private" cannot be used together. +// TypeError 5225: (97-130): Public state variables can only override functions with external visibility. +// TypeError 3942: (22-72): "virtual" and "private" cannot be used together. diff --git a/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol b/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol index 186909dae2ad..e4b674035e1d 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol @@ -3,4 +3,4 @@ contract A { function f(uint[] memory) internal pure {} } // ---- -// DeclarationError: (17-61): Function with same name and arguments defined twice. +// DeclarationError 1686: (17-61): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/inheritance/override/internal_external_inheritance.sol b/test/libsolidity/syntaxTests/inheritance/override/internal_external_inheritance.sol index 0969c6d542d3..8a84fb5483f8 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/internal_external_inheritance.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/internal_external_inheritance.sol @@ -6,4 +6,4 @@ contract B { } contract C is A, B {} // ---- -// TypeError: (126-147): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (126-147): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/modifier_ambiguous_fail.sol b/test/libsolidity/syntaxTests/inheritance/override/modifier_ambiguous_fail.sol index f89f79557ca4..7332f0817c18 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/modifier_ambiguous_fail.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/modifier_ambiguous_fail.sol @@ -7,4 +7,4 @@ contract B { contract C is A, B { } // ---- -// TypeError: (94-116): Derived contract must override modifier "f". Two or more base classes define modifier with same name. +// TypeError 6480: (94-116): Derived contract must override modifier "f". Two or more base classes define modifier with same name. diff --git a/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature.sol b/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature.sol index 37636ce7667a..428f38e62bf0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature.sol @@ -7,4 +7,4 @@ contract B { contract C is A, B { } // ---- -// TypeError: (100-122): Derived contract must override modifier "f". Two or more base classes define modifier with same name. +// TypeError 6480: (100-122): Derived contract must override modifier "f". Two or more base classes define modifier with same name. diff --git a/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature_override.sol b/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature_override.sol index afc2b0239ae5..7791ea725048 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/modifier_inherited_different_signature_override.sol @@ -8,4 +8,4 @@ contract C is A, B { modifier f() virtual override(A, B) { _; } } // ---- -// TypeError: (125-167): Override changes modifier signature. +// TypeError 1078: (125-167): Override changes modifier signature. diff --git a/test/libsolidity/syntaxTests/inheritance/override/no_common_base_and_unique_implementation.sol b/test/libsolidity/syntaxTests/inheritance/override/no_common_base_and_unique_implementation.sol index a6e0fb897214..4da82307f67e 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/no_common_base_and_unique_implementation.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/no_common_base_and_unique_implementation.sol @@ -9,5 +9,5 @@ abstract contract B { contract C is A, B { } // ---- -// TypeError: (176-198): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. -// TypeError: (176-198): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (176-198): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (176-198): Derived contract must override function "g". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/nonintermediate_common_base_and_unique_implementation_modifier.sol b/test/libsolidity/syntaxTests/inheritance/override/nonintermediate_common_base_and_unique_implementation_modifier.sol index 0cbb756f497c..deda228fa0b5 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/nonintermediate_common_base_and_unique_implementation_modifier.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/nonintermediate_common_base_and_unique_implementation_modifier.sol @@ -16,4 +16,4 @@ contract B is IJ } contract C is A, B {} // ---- -// TypeError: (229-250): Derived contract must override modifier "f". Two or more base classes define modifier with same name. +// TypeError 6480: (229-250): Derived contract must override modifier "f". Two or more base classes define modifier with same name. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol b/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol index b5aa8acb688a..033649cd45c0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol @@ -9,4 +9,4 @@ abstract contract X is A, B { function test() internal override returns (uint256) {} } // ---- -// TypeError: (205-292): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (205-292): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_empty_list.sol b/test/libsolidity/syntaxTests/inheritance/override/override_empty_list.sol index 2db86a1afe13..59e489c226a1 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_empty_list.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_empty_list.sol @@ -7,4 +7,4 @@ contract X is A { function test() internal override() returns (uint256); } // ---- -// ParserError: (164-165): Expected identifier but got ')' +// ParserError 2314: (164-165): Expected identifier but got ')' diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_missing_virtual.sol b/test/libsolidity/syntaxTests/inheritance/override/override_missing_virtual.sol index 774d023f8dae..78c3281acc16 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_missing_virtual.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_missing_virtual.sol @@ -7,5 +7,5 @@ abstract contract X is A { function test2() external override(A) returns (uint256) {} } // ---- -// TypeError: (153-198): Overriding function is missing "override" specifier. -// TypeError: (76-122): Trying to override non-virtual function. Did you forget to add "virtual"? +// TypeError 9456: (153-198): Overriding function is missing "override" specifier. +// TypeError 4334: (76-122): Trying to override non-virtual function. Did you forget to add "virtual"? diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_modifier_no_override.sol b/test/libsolidity/syntaxTests/inheritance/override/override_modifier_no_override.sol index 49a084965b94..9badb5428634 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_modifier_no_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_modifier_no_override.sol @@ -4,4 +4,4 @@ abstract contract X is A { modifier f() override { _; } } // ---- -// TypeError: (65-73): Modifier has override specified but does not override anything. +// TypeError 7792: (65-73): Modifier has override specified but does not override anything. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol index fdf6c7e9b1b7..eb3148a06359 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol @@ -18,7 +18,7 @@ abstract contract X is A, B, C, D { function foo() internal override(A, C, B, B, B, D ,D) virtual returns (uint256); } // ---- -// TypeError: (548-549): Duplicate contract "D" found in override list of "test". -// TypeError: (621-622): Duplicate contract "B" found in override list of "foo". -// TypeError: (624-625): Duplicate contract "B" found in override list of "foo". -// TypeError: (630-631): Duplicate contract "D" found in override list of "foo". +// TypeError 4520: (548-549): Duplicate contract "D" found in override list of "test". +// TypeError 4520: (621-622): Duplicate contract "B" found in override list of "foo". +// TypeError 4520: (624-625): Duplicate contract "B" found in override list of "foo". +// TypeError 4520: (630-631): Duplicate contract "D" found in override list of "foo". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail1.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail1.sol index ebbf83e1644d..d95c2c9f41de 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail1.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail1.sol @@ -5,4 +5,4 @@ contract X { int public override(A,) testvar; } // ---- -// ParserError: (95-96): Expected identifier but got ')' +// ParserError 2314: (95-96): Expected identifier but got ')' diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail2.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail2.sol index 2c3319ac22a5..f2d370df6710 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail2.sol @@ -5,4 +5,4 @@ contract X { function test() internal override(,) returns (uint256); } // ---- -// ParserError: (107-108): Expected identifier but got ',' +// ParserError 2314: (107-108): Expected identifier but got ',' diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail3.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail3.sol index 79ab20d8ba70..ee510868aa8f 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail3.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail3.sol @@ -5,4 +5,4 @@ contract X { function foo() internal override(X, address) returns (uint256); } // ---- -// ParserError: (109-116): Expected identifier but got 'address' +// ParserError 2314: (109-116): Expected identifier but got 'address' diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail4.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail4.sol index d97fb27d6cf8..b63ead808aec 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail4.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_fail4.sol @@ -5,4 +5,4 @@ contract X { int public override() testvar; } // ---- -// ParserError: (93-94): Expected identifier but got ')' +// ParserError 2314: (93-94): Expected identifier but got ')' diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol index ec20bd729312..eb28808e5665 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol @@ -18,5 +18,5 @@ abstract contract X is A, B, C, D { function foo() internal override(A, C) virtual returns (uint256); } // ---- -// TypeError: (533-550): Invalid contract specified in override list: "C". -// TypeError: (603-617): Function needs to specify overridden contracts "B" and "D". +// TypeError 2353: (533-550): Invalid contract specified in override list: "C". +// TypeError 4327: (603-617): Function needs to specify overridden contracts "B" and "D". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual.sol index 803385b91b6e..4ad64b81e137 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual.sol @@ -11,4 +11,4 @@ contract C is A, B function foo() internal override(A, B) {} } // ---- -// TypeError: (65-91): Trying to override non-virtual function. Did you forget to add "virtual"? +// TypeError 4334: (65-91): Trying to override non-virtual function. Did you forget to add "virtual"? diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual2.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual2.sol index b9e030896a27..f2aa79c197e0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_no_virtual2.sol @@ -10,4 +10,4 @@ contract C is A, B { } // ---- -// TypeError: (94-116): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (94-116): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_unresolved.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_unresolved.sol index d4fbabda215c..98d0c04433fb 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_unresolved.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_unresolved.sol @@ -3,4 +3,4 @@ contract A { function foo() internal override(N, Z) returns (uint256); } // ---- -// DeclarationError: (68-69): Identifier not found or not unique. +// DeclarationError 7920: (68-69): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_public_vars.sol b/test/libsolidity/syntaxTests/inheritance/override/override_public_vars.sol index 440ce769f3ba..f330f20c2c87 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_public_vars.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_public_vars.sol @@ -5,5 +5,5 @@ abstract contract X is A { int public override testvar; } // ---- -// DeclarationError: (73-100): Identifier already declared. -// TypeError: (23-41): Cannot override public state variable. +// DeclarationError 9097: (73-100): Identifier already declared. +// TypeError 1452: (23-41): Cannot override public state variable. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol b/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol index 59213928c59c..a4a068297d2c 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol @@ -9,4 +9,4 @@ abstract contract X is A, B { function test() internal override virtual returns (uint256); } // ---- -// TypeError: (203-296): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (203-296): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol b/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol index 65f2cab29f36..2eacdf754a8a 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol @@ -20,5 +20,5 @@ abstract contract X is A, B, C, D { function foo() internal override(MyStruct, ENUM, A, B, C, D) virtual returns (uint256); } // ---- -// TypeError: (602-610): Expected contract but got struct X.MyStruct. -// TypeError: (612-616): Expected contract but got enum X.ENUM. +// TypeError 9301: (602-610): Expected contract but got struct X.MyStruct. +// TypeError 9301: (612-616): Expected contract but got enum X.ENUM. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_unimplemented_fail.sol b/test/libsolidity/syntaxTests/inheritance/override/override_unimplemented_fail.sol index 833743f75b19..f67be0ecea09 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_unimplemented_fail.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_unimplemented_fail.sol @@ -11,5 +11,5 @@ abstract contract D is B, A { function f() external virtual override(A, B); } // ---- -// TypeError: (154-199): Overriding an implemented function with an unimplemented function is not allowed. -// TypeError: (236-281): Overriding an implemented function with an unimplemented function is not allowed. +// TypeError 4593: (154-199): Overriding an implemented function with an unimplemented function is not allowed. +// TypeError 4593: (236-281): Overriding an implemented function with an unimplemented function is not allowed. diff --git a/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol index 400da4a8ea4a..74bc4a850cbd 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/private_state_variable.sol @@ -6,4 +6,4 @@ contract C is C1 { int override f; } // ---- -// TypeError: (96-110): Override can only be used with public state variables. +// TypeError 8022: (96-110): Override can only be used with public state variables. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_implements_parallel_interface.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_implements_parallel_interface.sol index 56346ada3647..dc2f7b16a685 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_implements_parallel_interface.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_implements_parallel_interface.sol @@ -17,5 +17,5 @@ abstract contract T is A { contract Y is X, T { } // ---- -// TypeError: (484-506): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. -// TypeError: (484-506): Derived contract must override function "goo". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (484-506): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (484-506): Derived contract must override function "goo". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_missing_override.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_missing_override.sol index 72ace500b0e1..a8e299339c9e 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_missing_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_missing_override.sol @@ -8,4 +8,4 @@ contract X is A, B { uint public override(A) foo; } // ---- -// TypeError: (154-165): Public state variable needs to specify overridden contract "B". +// TypeError 4327: (154-165): Public state variable needs to specify overridden contract "B". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol index 6cbe0eb1450e..059450fe62cf 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol @@ -5,5 +5,5 @@ contract X is A { uint public foo; } // ---- -// TypeError: (100-115): Overriding public state variable is missing "override" specifier. -// TypeError: (100-115): Public state variables can only override functions with external visibility. +// TypeError 9456: (100-115): Overriding public state variable is missing "override" specifier. +// TypeError 5225: (100-115): Public state variables can only override functions with external visibility. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_public_var.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_public_var.sol index e8033941f358..6e78bd7224e3 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_public_var.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_public_var.sol @@ -5,5 +5,5 @@ contract X is A { uint public override foo; } // ---- -// DeclarationError: (55-79): Identifier already declared. -// TypeError: (17-32): Cannot override public state variable. +// DeclarationError 9097: (55-79): Identifier already declared. +// TypeError 1452: (17-32): Cannot override public state variable. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_parallel_funciton.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_parallel_funciton.sol index 6fee1cf61083..3fdb7a0e3968 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_parallel_funciton.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_parallel_funciton.sol @@ -7,4 +7,4 @@ contract B { contract X is A, B { } // ---- -// TypeError: (96-118): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. +// TypeError 6480: (96-118): Derived contract must override function "foo". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_surplus_override.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_surplus_override.sol index a71aefaafb00..0e2e7cb46cda 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_surplus_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_surplus_override.sol @@ -6,4 +6,4 @@ contract X is A { uint public override(A, B) foo; } // ---- -// TypeError: (106-120): Invalid contract specified in override list: "B". +// TypeError 2353: (106-120): Invalid contract specified in override list: "B". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol index 6e5d174edcd7..f0a79beb2666 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol @@ -8,4 +8,4 @@ contract X is A, B { uint public override foo; } // ---- -// TypeError: (196-204): Public state variable needs to specify overridden contracts "A" and "B". +// TypeError 4327: (196-204): Public state variable needs to specify overridden contracts "A" and "B". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol index 9fe1fa82e7e3..719c917c7c03 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol @@ -8,6 +8,6 @@ contract X is A, B { uint public override foo; } // ---- -// DeclarationError: (136-160): Identifier already declared. -// TypeError: (14-29): Cannot override public state variable. -// TypeError: (148-156): Public state variable needs to specify overridden contracts "A" and "B". +// DeclarationError 9097: (136-160): Identifier already declared. +// TypeError 1452: (14-29): Cannot override public state variable. +// TypeError 4327: (148-156): Public state variable needs to specify overridden contracts "A" and "B". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol index 0fddb83a38a3..1ef6cf296602 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol @@ -7,4 +7,4 @@ contract X is A { uint public override foo; } // ---- -// TypeError: (225-249): Overriding public state variable return types differ. +// TypeError 4822: (225-249): Overriding public state variable return types differ. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple5.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple5.sol index de8e4688e8ad..16d5f1d52450 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple5.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple5.sol @@ -7,4 +7,4 @@ contract C is ERC20 { mapping(address => uint) public override balanceOf; } // ---- -// TypeError: (281-289): Public state variable has override specified but does not override anything. +// TypeError 7792: (281-289): Public state variable has override specified but does not override anything. diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol index d6a7fea26241..ffac63dc8303 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol @@ -11,4 +11,4 @@ contract X is B, C { uint public override foo; } // ---- -// TypeError: (305-313): Public state variable needs to specify overridden contracts "B" and "C". +// TypeError 4327: (305-313): Public state variable needs to specify overridden contracts "B" and "C". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol index 36c996380dbd..b0b4d22fc5cb 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol @@ -11,6 +11,6 @@ contract X is B, C { uint public override foo; } // ---- -// DeclarationError: (245-269): Identifier already declared. -// TypeError: (100-124): Cannot override public state variable. -// TypeError: (257-265): Public state variable needs to specify overridden contracts "B" and "C". +// DeclarationError 9097: (245-269): Identifier already declared. +// TypeError 1452: (100-124): Cannot override public state variable. +// TypeError 4327: (257-265): Public state variable needs to specify overridden contracts "B" and "C". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol index 99ef13944b37..f303b82cd4e4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol @@ -11,7 +11,7 @@ contract X is B, C { uint public override(A, C) foo; } // ---- -// DeclarationError: (245-275): Identifier already declared. -// TypeError: (100-124): Cannot override public state variable. -// TypeError: (257-271): Public state variable needs to specify overridden contract "B". -// TypeError: (257-271): Invalid contract specified in override list: "A". +// DeclarationError 9097: (245-275): Identifier already declared. +// TypeError 1452: (100-124): Cannot override public state variable. +// TypeError 4327: (257-271): Public state variable needs to specify overridden contract "B". +// TypeError 2353: (257-271): Invalid contract specified in override list: "A". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_wrong_override.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_wrong_override.sol index f6213ae474c5..d87c4bc46d24 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_wrong_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_wrong_override.sol @@ -2,4 +2,4 @@ contract X { uint public override foo; } // ---- -// TypeError: (26-34): Public state variable has override specified but does not override anything. +// TypeError 7792: (26-34): Public state variable has override specified but does not override anything. diff --git a/test/libsolidity/syntaxTests/inheritance/override/remove_view.sol b/test/libsolidity/syntaxTests/inheritance/override/remove_view.sol index 1b5cc16793c5..5d67854b1496 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/remove_view.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/remove_view.sol @@ -1,5 +1,5 @@ contract B { function f() virtual public view {} } contract C is B { function f() public {} } // ---- -// TypeError: (69-91): Overriding function is missing "override" specifier. -// TypeError: (69-91): Overriding function changes state mutability from "view" to "nonpayable". +// TypeError 9456: (69-91): Overriding function is missing "override" specifier. +// TypeError 6959: (69-91): Overriding function changes state mutability from "view" to "nonpayable". diff --git a/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol b/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol index 9739acd67cb4..ee89571a68f4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol @@ -5,6 +5,6 @@ contract C is A { function x() public returns (uint) {} } // ---- -// DeclarationError: (50-87): Identifier already declared. -// TypeError: (50-87): Overriding function is missing "override" specifier. -// TypeError: (14-27): Cannot override public state variable. +// DeclarationError 9097: (50-87): Identifier already declared. +// TypeError 9456: (50-87): Overriding function is missing "override" specifier. +// TypeError 1452: (14-27): Cannot override public state variable. diff --git a/test/libsolidity/syntaxTests/inheritance/override/triangle_impl.sol b/test/libsolidity/syntaxTests/inheritance/override/triangle_impl.sol index b6fb4a7e79d4..c8d4f05885e2 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/triangle_impl.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/triangle_impl.sol @@ -3,4 +3,4 @@ contract B is A { function f() public pure virtual override {} } contract C is A, B { } contract D is A, B { function f() public pure override(A, B) {} } // ---- -// TypeError: (116-138): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. +// TypeError 6480: (116-138): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. diff --git a/test/libsolidity/syntaxTests/inheritance/override/virtual_private.sol b/test/libsolidity/syntaxTests/inheritance/override/virtual_private.sol index 1d3b24478dde..4fa8167c1fc4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/virtual_private.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/virtual_private.sol @@ -5,4 +5,4 @@ abstract contract X is A { function test() private override returns (uint256) {} } // ---- -// TypeError: (23-73): "virtual" and "private" cannot be used together. +// TypeError 3942: (23-73): "virtual" and "private" cannot be used together. diff --git a/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol b/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol index 6f1932ffbe02..0f21a6b56130 100644 --- a/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol +++ b/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol @@ -3,4 +3,4 @@ contract D { constructor() X(5) public {} } // ---- -// TypeError: (45-49): Referenced declaration is neither modifier nor base class. +// TypeError 4659: (45-49): Referenced declaration is neither modifier nor base class. diff --git a/test/libsolidity/syntaxTests/inheritance/shadowing_base_state_vars.sol b/test/libsolidity/syntaxTests/inheritance/shadowing_base_state_vars.sol index 2e3a683b969f..141ecee08b3a 100644 --- a/test/libsolidity/syntaxTests/inheritance/shadowing_base_state_vars.sol +++ b/test/libsolidity/syntaxTests/inheritance/shadowing_base_state_vars.sol @@ -5,4 +5,4 @@ contract B is A { uint i; } // ---- -// DeclarationError: (43-49): Identifier already declared. +// DeclarationError 9097: (43-49): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/inheritance/super_on_external.sol b/test/libsolidity/syntaxTests/inheritance/super_on_external.sol index 60ee3cbbe81f..1030beab4e18 100644 --- a/test/libsolidity/syntaxTests/inheritance/super_on_external.sol +++ b/test/libsolidity/syntaxTests/inheritance/super_on_external.sol @@ -7,4 +7,4 @@ contract B is A { } } // ---- -// TypeError: (123-130): Member "f" not found or not visible after argument-dependent lookup in contract super B. +// TypeError 9582: (123-130): Member "f" not found or not visible after argument-dependent lookup in contract super B. diff --git a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol index 1ce48200160d..9bd33615d9f2 100644 --- a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol +++ b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol @@ -6,5 +6,5 @@ contract Derived2 is Base { constructor() Base(2) public { } } // ---- -// TypeError: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. -// TypeError: (130-137): Wrong argument count for modifier invocation: 1 arguments given but expected 2. +// TypeError 7927: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (130-137): Wrong argument count for modifier invocation: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/inheritance/unimplemented_without_virtual.sol b/test/libsolidity/syntaxTests/inheritance/unimplemented_without_virtual.sol index 7635e02978fa..92c2a81c7119 100644 --- a/test/libsolidity/syntaxTests/inheritance/unimplemented_without_virtual.sol +++ b/test/libsolidity/syntaxTests/inheritance/unimplemented_without_virtual.sol @@ -2,4 +2,4 @@ abstract contract C { function f() external; } // ---- -// TypeError: (23-45): Functions without implementation must be marked virtual. +// TypeError 5424: (23-45): Functions without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/inheritance/virtual/duplicate.sol b/test/libsolidity/syntaxTests/inheritance/virtual/duplicate.sol index 76a0d2b63ab6..63da78464912 100644 --- a/test/libsolidity/syntaxTests/inheritance/virtual/duplicate.sol +++ b/test/libsolidity/syntaxTests/inheritance/virtual/duplicate.sol @@ -4,5 +4,5 @@ contract C modifier modi() virtual virtual {_;} } // ---- -// ParserError: (44-51): Virtual already specified. -// ParserError: (80-87): Virtual already specified. +// ParserError 6879: (44-51): Virtual already specified. +// ParserError 2662: (80-87): Virtual already specified. diff --git a/test/libsolidity/syntaxTests/inheritance/wrong_type_base_arguments.sol b/test/libsolidity/syntaxTests/inheritance/wrong_type_base_arguments.sol index de5eb346f4e3..44bca7b3e91b 100644 --- a/test/libsolidity/syntaxTests/inheritance/wrong_type_base_arguments.sol +++ b/test/libsolidity/syntaxTests/inheritance/wrong_type_base_arguments.sol @@ -6,4 +6,4 @@ contract Derived2 is Base { constructor() Base(2) public { } } // ---- -// TypeError: (74-77): Invalid type for argument in constructor call. Invalid implicit conversion from int_const 300 to uint8 requested. Literal is too large to fit in uint8. +// TypeError 9827: (74-77): Invalid type for argument in constructor call. Invalid implicit conversion from int_const 300 to uint8 requested. Literal is too large to fit in uint8. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_contract.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_contract.sol index a87a3e6658e4..dd2eac18a908 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_contract.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_contract.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (72-73): Expected a library. +// TypeError 4977: (72-73): Expected a library. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype.sol index 625502f25899..da597ef4c8b4 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (72-73): Access to functions is not allowed in inline assembly. +// DeclarationError 2025: (72-73): Access to functions is not allowed in inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype2.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype2.sol index 2fc49b1dbab1..aef6dd3e9e71 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype2.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype2.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// DeclarationError: (112-113): Access to functions is not allowed in inline assembly. +// DeclarationError 2025: (112-113): Access to functions is not allowed in inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_super.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_super.sol index bd5562d52e8b..f6a151ebf105 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_super.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_super.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (72-77): Identifier not found. +// DeclarationError 8198: (72-77): Identifier not found. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol index b6b8f8e4a7cd..d9408585fcc0 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_location.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// DeclarationError: (87-96): Variable count does not match number of values (2 vs. 1) +// DeclarationError 8678: (87-96): Variable count does not match number of values (2 vs. 1) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_special.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_special.sol index 976bfcfbc6cb..c037764de3c4 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_special.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_special.sol @@ -11,9 +11,9 @@ contract C { } } // ---- -// DeclarationError: (58-63): Variable not found or variable not lvalue. -// DeclarationError: (75-79): Variable not found or variable not lvalue. -// DeclarationError: (91-94): Variable not found or variable not lvalue. -// DeclarationError: (106-111): Variable not found or variable not lvalue. -// TypeError: (123-124): Only local variables can be assigned to in inline assembly. -// TypeError: (136-137): Only local variables can be assigned to in inline assembly. +// DeclarationError 4634: (58-63): Variable not found or variable not lvalue. +// DeclarationError 4634: (75-79): Variable not found or variable not lvalue. +// DeclarationError 4634: (91-94): Variable not found or variable not lvalue. +// DeclarationError 4634: (106-111): Variable not found or variable not lvalue. +// TypeError 1990: (123-124): Only local variables can be assigned to in inline assembly. +// TypeError 1990: (136-137): Only local variables can be assigned to in inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/const_from_non_const.sol b/test/libsolidity/syntaxTests/inlineAssembly/const_from_non_const.sol index fbd5ab6ee0a4..709922dd35bc 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/const_from_non_const.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/const_from_non_const.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (52-54): Initial value for constant variable has to be compile-time constant. -// TypeError: (112-113): Only direct number constants and references to such constants are supported by inline assembly. +// TypeError 8349: (52-54): Initial value for constant variable has to be compile-time constant. +// TypeError 7615: (112-113): Only direct number constants and references to such constants are supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/const_from_this.sol b/test/libsolidity/syntaxTests/inlineAssembly/const_from_this.sol index 563d47851a9d..76a05592ebcb 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/const_from_this.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/const_from_this.sol @@ -7,6 +7,6 @@ contract C { } } // ---- -// TypeError: (33-37): Type contract C is not implicitly convertible to expected type bool. -// TypeError: (33-37): Initial value for constant variable has to be compile-time constant. -// TypeError: (95-96): Only direct number constants and references to such constants are supported by inline assembly. +// TypeError 7407: (33-37): Type contract C is not implicitly convertible to expected type bool. +// TypeError 8349: (33-37): Initial value for constant variable has to be compile-time constant. +// TypeError 7615: (95-96): Only direct number constants and references to such constants are supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/constant_access_non_initialized.sol b/test/libsolidity/syntaxTests/inlineAssembly/constant_access_non_initialized.sol index 7e6076c01694..cc439cf04baf 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/constant_access_non_initialized.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/constant_access_non_initialized.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (17-32): Uninitialized "constant" variable. -// TypeError: (106-107): Constant has no value. +// TypeError 4266: (17-32): Uninitialized "constant" variable. +// TypeError 3224: (106-107): Constant has no value. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/constant_array.sol b/test/libsolidity/syntaxTests/inlineAssembly/constant_array.sol index 0711c5368285..0787a6795c2d 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/constant_array.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/constant_array.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (115-116): Only direct number constants and references to such constants are supported by inline assembly. +// TypeError 7615: (115-116): Only direct number constants and references to such constants are supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/constant_bytes_ref.sol b/test/libsolidity/syntaxTests/inlineAssembly/constant_bytes_ref.sol index dba00a588b67..23974658cba2 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/constant_bytes_ref.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/constant_bytes_ref.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (168-169): Only direct number constants and references to such constants are supported by inline assembly. +// TypeError 7615: (168-169): Only direct number constants and references to such constants are supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_call_invalid_argument_count.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_call_invalid_argument_count.sol index 2d36beddda76..3c2fd7c03ed2 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/function_call_invalid_argument_count.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_call_invalid_argument_count.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// TypeError: (87-88): Function expects 1 arguments but got 0. -// TypeError: (108-109): Function expects 1 arguments but got 2. +// TypeError 7000: (87-88): Function expects 1 arguments but got 0. +// TypeError 7000: (108-109): Function expects 1 arguments but got 2. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_call_not_found.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_call_not_found.sol index 57534bd6a46b..e890c67b7068 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/function_call_not_found.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_call_not_found.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (63-64): Function not found. +// DeclarationError 4619: (63-64): Function not found. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_call_to_variable.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_call_to_variable.sol index c00718553554..f6f3573f6cfe 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/function_call_to_variable.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_call_to_variable.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (81-82): Attempt to call variable instead of function. +// TypeError 4202: (81-82): Attempt to call variable instead of function. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_without_call.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_without_call.sol index 073f3fbcbfe5..86d0a960576b 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/function_without_call.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_without_call.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// ParserError: (92-93): Call or assignment expected. +// ParserError 6913: (92-93): Call or assignment expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/immutables.sol b/test/libsolidity/syntaxTests/inlineAssembly/immutables.sol index 17b30b8d8871..6d0135cf0518 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/immutables.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/immutables.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// DeclarationError: (63-75): Function not found. -// DeclarationError: (92-105): Function not found. +// DeclarationError 4619: (63-75): Function not found. +// DeclarationError 4619: (92-105): Function not found. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/assign_to_instruction.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/assign_to_instruction.sol index f8734da31da5..b4603f54c4ae 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/assign_to_instruction.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/assign_to_instruction.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (67-70): Cannot use builtin function name "mod" as identifier name. +// ParserError 5568: (67-70): Cannot use builtin function name "mod" as identifier name. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/bare_instructions_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/bare_instructions_disallowed.sol index 4dd8b76dfb36..a55586af964c 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/bare_instructions_disallowed.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/bare_instructions_disallowed.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// ParserError: (95-98): Expected '(' but got identifier +// ParserError 2314: (95-98): Expected '(' but got identifier diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/calldata_variables.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/calldata_variables.sol index 952b9af6acae..a7d9da8df032 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/calldata_variables.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/calldata_variables.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (111-126): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. +// TypeError 2370: (111-126): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol index b8d7c021211a..295bc927d379 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/const_forward_reference.sol @@ -7,6 +7,6 @@ contract C { int constant c = 0 + 1; } // ---- -// SyntaxError: (15-83): No visibility specified. Did you intend to add "public"? -// TypeError: (71-72): Constant variables with non-literal values cannot be forward referenced from inline assembly. -// TypeError: (51-52): Constant variables cannot be assigned to. +// SyntaxError 4937: (15-83): No visibility specified. Did you intend to add "public"? +// TypeError 2249: (71-72): Constant variables with non-literal values cannot be forward referenced from inline assembly. +// TypeError 6252: (51-52): Constant variables cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_assignment.sol index 920b7e42df26..9df1f4d3c992 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_assignment.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (98-99): Constant variables cannot be assigned to. +// TypeError 6252: (98-99): Constant variables cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol index 0c0837295fd4..063199ab4022 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (112-120): The suffixes _offset and _slot can only be used on non-constant storage variables. +// TypeError 6617: (112-120): The suffixes _offset and _slot can only be used on non-constant storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_beginning.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_beginning.sol index 114c76afaffc..a2e938698cb6 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_beginning.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_beginning.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// ParserError: (101-102): Literal or identifier expected. +// ParserError 1856: (101-102): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_end.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_end.sol index a501405b4f8b..be95849c3680 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_end.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_end.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// ParserError: (103-104): Literal or identifier expected. +// ParserError 1856: (103-104): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_middle.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_middle.sol index ef9202ac4967..00bdac65e061 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_middle.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg_middle.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// ParserError: (96-97): Literal or identifier expected. +// ParserError 1856: (96-97): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol index 203c84871648..a6dba71efcb3 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (72-73): Expected identifier but got '(' +// ParserError 2314: (72-73): Expected identifier but got '(' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol index a446097e15bf..b894fc6b834a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (72-73): Literal or identifier expected. +// ParserError 1856: (72-73): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/jump_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/jump_disallowed.sol index f586543044c7..748e4d172941 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/jump_disallowed.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/jump_disallowed.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (75-79): Function not found. +// DeclarationError 4619: (75-79): Function not found. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/label_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/label_disallowed.sol index d3f34d0ec4f0..cfe0d1c3dd0b 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/label_disallowed.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/label_disallowed.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (80-81): Call or assignment expected. +// ParserError 6913: (80-81): Call or assignment expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/leave_items_on_tack.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/leave_items_on_tack.sol index 5b410d4b6379..dec7911c6da3 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/leave_items_on_tack.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/leave_items_on_tack.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (75-83): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them. +// TypeError 3083: (75-83): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/literals_on_stack_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/literals_on_stack_disallowed.sol index b2649cd8cd93..91348e801db2 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/literals_on_stack_disallowed.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/literals_on_stack_disallowed.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (85-86): Call or assignment expected. +// ParserError 6913: (85-86): Call or assignment expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions.sol index 877f57835f71..b7b07fb168a1 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// DeclarationError: (114-115): Cannot access local Solidity variables from inside an inline assembly function. +// DeclarationError 6578: (114-115): Cannot access local Solidity variables from inside an inline assembly function. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol index 65d614a3f5c1..d8df7e45d7ec 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol @@ -8,4 +8,4 @@ contract test { } } // ---- -// DeclarationError: (142-150): Cannot access local Solidity variables from inside an inline assembly function. +// DeclarationError 6578: (142-150): Cannot access local Solidity variables from inside an inline assembly function. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable.sol index 0c9128df9fb8..e3d822539d93 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (63-64): Variable not found or variable not lvalue. +// DeclarationError 4634: (63-64): Variable not found or variable not lvalue. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol index d8361268dfe3..901df4ad5f18 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// ParserError: (87-89): Literal or identifier expected. +// ParserError 1856: (87-89): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/multiple_assign_to_instruction.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/multiple_assign_to_instruction.sol index 30f7ff823389..cb5e5c560680 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/multiple_assign_to_instruction.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/multiple_assign_to_instruction.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// ParserError: (102-105): Cannot use builtin function name "sub" as identifier name. +// ParserError 5568: (102-105): Cannot use builtin function name "sub" as identifier name. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/nested_function_local_access.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/nested_function_local_access.sol index 3bb6223a88f1..6a2f9142275b 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/nested_function_local_access.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/nested_function_local_access.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// DeclarationError: (130-131): Cannot access local Solidity variables from inside an inline assembly function. +// DeclarationError 6578: (130-131): Cannot access local Solidity variables from inside an inline assembly function. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol index 3dfb458a1e90..fa1c97431983 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (89-90): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (89-90): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol index b9b92d479053..945295e779fd 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol @@ -10,4 +10,4 @@ contract test { } } // ---- -// TypeError: (80-81): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (80-81): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_negative_stack.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_negative_stack.sol index 73f4ed76ae3f..3f92beec2af8 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_negative_stack.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_negative_stack.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// ParserError: (85-86): Expected '(' but got '}' +// ParserError 2314: (85-86): Expected '(' but got '}' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_positive_stack.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_positive_stack.sol index 25aad5bcd96e..6942afe6bb0f 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_positive_stack.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_positive_stack.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// ParserError: (83-84): Call or assignment expected. +// ParserError 6913: (83-84): Call or assignment expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol index ca1e15a929fe..b41cd93dfaf7 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// TypeError: (75-76): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (75-76): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol index e27fb041b963..68de25206673 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol @@ -9,7 +9,7 @@ contract C { } } // ---- -// DeclarationError: (79-87): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError: (109-115): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError: (137-144): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError: (166-171): In variable declarations _slot and _offset can not be used as a suffix. +// DeclarationError 9155: (79-87): In variable declarations _slot and _offset can not be used as a suffix. +// DeclarationError 9155: (109-115): In variable declarations _slot and _offset can not be used as a suffix. +// DeclarationError 9155: (137-144): In variable declarations _slot and _offset can not be used as a suffix. +// DeclarationError 9155: (166-171): In variable declarations _slot and _offset can not be used as a suffix. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_assignment.sol index 582733bef5ff..9eba8e7b3698 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_assignment.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// ParserError: (71-72): Expected identifier but got '=' +// ParserError 2314: (71-72): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_multiple_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_multiple_assignment.sol index 478e14e8fa51..ca9f34fcae46 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_multiple_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/whitespace_in_multiple_assignment.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// ParserError: (109-110): Expected identifier but got '=' +// ParserError 2314: (109-110): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol b/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol index a29a2ab3564e..dc15b61f9fe9 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol @@ -13,7 +13,7 @@ contract C { // ==== // EVMVersion: =petersburg // ---- -// TypeError: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). -// DeclarationError: (95-110): Variable count does not match number of values (1 vs. 0) -// TypeError: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). -// DeclarationError: (209-228): Variable count does not match number of values (1 vs. 0) +// TypeError 7079: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// DeclarationError 8678: (95-110): Variable count does not match number of values (1 vs. 0) +// TypeError 7079: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// DeclarationError 8678: (209-228): Variable count does not match number of values (1 vs. 0) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/leave_invalid.sol b/test/libsolidity/syntaxTests/inlineAssembly/leave_invalid.sol index f2da48e1c25d..1b7c75105645 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/leave_invalid.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/leave_invalid.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// SyntaxError: (63-68): Keyword "leave" can only be used inside a function. +// SyntaxError 8149: (63-68): Keyword "leave" can only be used inside a function. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/overloaded_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/overloaded_reference.sol index d1bcc94693a6..64411c6dfc71 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/overloaded_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/overloaded_reference.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// DeclarationError: (155-156): Multiple matching identifiers. Resolving overloaded identifiers is not supported. +// DeclarationError 4718: (155-156): Multiple matching identifiers. Resolving overloaded identifiers is not supported. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol index 08b0238894e5..2bac970bb793 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release. +// Warning 2450: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/argument.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/argument.sol index 0f84c9587f3e..ce2ad9d33eeb 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/argument.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/argument.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (85-86): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (85-86): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/constant.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/constant.sol index 1249e9da5ef1..06a033727906 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/constant.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/constant.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// DeclarationError: (100-101): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (100-101): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/contract.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/contract.sol index abf0ca879136..e32e9ea9dc73 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/contract.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/contract.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (79-80): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (79-80): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/function.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/function.sol index 2d28623ffcc1..cd93d9896b2a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/function.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/function.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (79-80): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (79-80): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/local_variable.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/local_variable.sol index 1cb39eac4292..9f666add7235 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/local_variable.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/local_variable.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// DeclarationError: (95-96): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (95-96): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol index d6e73871e987..50a1b749cd31 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol @@ -14,5 +14,5 @@ contract B { } } // ---- -// DeclarationError: (b:105-106): This declaration shadows a declaration outside the inline assembly block. -// DeclarationError: (b:128-131): The prefix of this declaration conflicts with a declaration outside the inline assembly block. +// DeclarationError 3859: (b:105-106): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (b:128-131): The prefix of this declaration conflicts with a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol index 3ae885243916..7fba010f55ad 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// DeclarationError: (115-118): The prefix of this declaration conflicts with a declaration outside the inline assembly block. -// DeclarationError: (140-143): The prefix of this declaration conflicts with a declaration outside the inline assembly block. +// DeclarationError 3859: (115-118): The prefix of this declaration conflicts with a declaration outside the inline assembly block. +// DeclarationError 3859: (140-143): The prefix of this declaration conflicts with a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol index 089f379b9da5..649195c17326 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (118-119): You have to use the _slot or _offset suffix to access storage reference variables. +// TypeError 9068: (118-119): You have to use the _slot or _offset suffix to access storage reference variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol index 91362d719241..effe604601a0 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (138-146): Only _slot can be assigned to. +// TypeError 9739: (138-146): Only _slot can be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol index d37008774fdf..783306b5e215 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (84-90): State variables cannot be assigned to - you have to use "sstore()". -// TypeError: (108-116): State variables cannot be assigned to - you have to use "sstore()". +// TypeError 4713: (84-90): State variables cannot be assigned to - you have to use "sstore()". +// TypeError 4713: (108-116): State variables cannot be assigned to - you have to use "sstore()". diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol index 8666889b8d0f..479b34718934 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (84-91): In variable names _slot and _offset can only be used as a suffix. +// DeclarationError 4794: (84-91): In variable names _slot and _offset can only be used as a suffix. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol index 05935f19fbb1..b0f383d3ad15 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// DeclarationError: (84-89): In variable names _slot and _offset can only be used as a suffix. +// DeclarationError 4794: (84-89): In variable names _slot and _offset can only be used as a suffix. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol index 9165654fbe8e..8f680ec3cd66 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (84-90): The suffixes _offset and _slot can only be used on storage variables. +// TypeError 7944: (84-90): The suffixes _offset and _slot can only be used on storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol index ab60f5f715d6..552a717dd910 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (117-123): The suffixes _offset and _slot can only be used on storage variables. -// TypeError: (141-149): The suffixes _offset and _slot can only be used on storage variables. +// TypeError 3622: (117-123): The suffixes _offset and _slot can only be used on storage variables. +// TypeError 3622: (141-149): The suffixes _offset and _slot can only be used on storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul b/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul index 91362d719241..effe604601a0 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (138-146): Only _slot can be assigned to. +// TypeError 9739: (138-146): Only _slot can be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/two_stack_slots.sol b/test/libsolidity/syntaxTests/inlineAssembly/two_stack_slots.sol index c7084a0eef95..5b71b61f906a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/two_stack_slots.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/two_stack_slots.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (132-147): Only types that use one stack slot are supported. +// TypeError 9857: (132-147): Only types that use one stack slot are supported. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/use_msize_with_optimizer.sol b/test/libsolidity/syntaxTests/inlineAssembly/use_msize_with_optimizer.sol index 3110ca05e82c..a1c0818b5ef3 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/use_msize_with_optimizer.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/use_msize_with_optimizer.sol @@ -8,4 +8,4 @@ contract C { // ==== // optimize-yul: true // ---- -// SyntaxError: (52-101): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. +// SyntaxError 6553: (52-101): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. diff --git a/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol index e613758b552d..311f8430b68d 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// Warning: (47-69): Unused local variable. -// Warning: (17-135): Function state mutability can be restricted to pure +// Warning 2072: (47-69): Unused local variable. +// Warning 2018: (17-135): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol index 023404f724f5..bb938d872698 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol @@ -8,4 +8,4 @@ } } // ---- -// Warning: (25-229): Function state mutability can be restricted to pure +// Warning 2018: (25-229): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol index 025244d3cf7c..e177364b3480 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (17-198): Function state mutability can be restricted to pure +// Warning 2018: (17-198): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol index e7036bdf1990..06e38a60b3fd 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (17-121): Function state mutability can be restricted to pure +// Warning 2018: (17-121): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol index 4e92f6e11788..ce4f53aae69d 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (17-140): Function state mutability can be restricted to pure +// Warning 2018: (17-140): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol index 4d3e6aed8aa3..9f7c4d725902 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (17-88): Function state mutability can be restricted to pure +// Warning 2018: (17-88): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol index 6d36942da32a..17a79ecdbd82 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (17-112): Function state mutability can be restricted to pure +// Warning 2018: (17-112): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol index 7aef51a9149d..56a4d0e201bd 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol @@ -5,5 +5,5 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (50-67): Unused local variable. -// Warning: (20-119): Function state mutability can be restricted to pure +// Warning 2072: (50-67): Unused local variable. +// Warning 2018: (20-119): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol index 59a88130cb68..e0b1c6f6c9e3 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (66-69): Type mapping(int256 => int256) is only valid in storage. +// TypeError 1545: (66-69): Type mapping(int256 => int256) is only valid in storage. diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol index a46db5a60bc7..78aa35de7c03 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol @@ -5,5 +5,5 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (50-73): Unused local variable. -// Warning: (20-118): Function state mutability can be restricted to pure +// Warning 2072: (50-73): Unused local variable. +// Warning 2018: (20-118): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol index 03d7266a9c5f..1ba1fdb1d382 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (66-83): Unable to deduce common type for array elements. +// TypeError 6378: (66-83): Unable to deduce common type for array elements. diff --git a/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol index 5a39f550c75f..748134a9e48c 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (47-56): Inline array type cannot be declared as LValue. +// TypeError 3025: (47-56): Inline array type cannot be declared as LValue. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol index a6280344507f..d00f818a7ef1 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-52): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. +// TypeError 9656: (47-52): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol index a93e092423d2..0abd5ca25683 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-56): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. +// TypeError 9656: (47-56): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. diff --git a/test/libsolidity/syntaxTests/license/license_double.sol b/test/libsolidity/syntaxTests/license/license_double.sol index 47d7eae1ba11..0885ad150192 100644 --- a/test/libsolidity/syntaxTests/license/license_double.sol +++ b/test/libsolidity/syntaxTests/license/license_double.sol @@ -2,4 +2,4 @@ contract C {} // SPDX-License-Identifier: MIT // ---- -// ParserError: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information. +// ParserError 3716: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information. diff --git a/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol b/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol index b52b4c5120be..2b20cec4bf6d 100644 --- a/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol +++ b/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol @@ -2,4 +2,4 @@ contract C { uint constant a = 1 / 0; } // ---- -// TypeError: (35-40): Operator / not compatible with types int_const 1 and int_const 0 +// TypeError 2271: (35-40): Operator / not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol b/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol index 8cc3b6f2a1bf..f6b494d3d8ca 100644 --- a/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol +++ b/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol @@ -2,4 +2,4 @@ contract C { uint constant a = 1 / ((1+3)-4); } // ---- -// TypeError: (35-48): Operator / not compatible with types int_const 1 and int_const 0 +// TypeError 2271: (35-48): Operator / not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/exponent.sol b/test/libsolidity/syntaxTests/literalOperations/exponent.sol index cee6263b7886..c3469054c729 100644 --- a/test/libsolidity/syntaxTests/literalOperations/exponent.sol +++ b/test/libsolidity/syntaxTests/literalOperations/exponent.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (67-78): Operator ** not compatible with types int256 and int_const 1000...(1226 digits omitted)...0000. Exponent too large. -// TypeError: (88-98): Operator ** not compatible with types int256 and rational_const 1 / 2. Exponent is fractional. +// TypeError 2271: (67-78): Operator ** not compatible with types int256 and int_const 1000...(1226 digits omitted)...0000. Exponent too large. +// TypeError 2271: (88-98): Operator ** not compatible with types int256 and rational_const 1 / 2. Exponent is fractional. diff --git a/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol b/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol index 1bbbc3fc908d..a7d470b24b40 100644 --- a/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol +++ b/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol @@ -2,4 +2,4 @@ contract C { uint constant b3 = 1 % 0; } // ---- -// TypeError: (36-41): Operator % not compatible with types int_const 1 and int_const 0 +// TypeError 2271: (36-41): Operator % not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol b/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol index 4899cac37982..9aba4dd75f3a 100644 --- a/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol +++ b/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol @@ -2,4 +2,4 @@ contract C { uint constant b3 = 1 % (-4+((2)*2)); } // ---- -// TypeError: (36-52): Operator % not compatible with types int_const 1 and int_const 0 +// TypeError 2271: (36-52): Operator % not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literals/hex_string_duplicate_underscore.sol b/test/libsolidity/syntaxTests/literals/hex_string_duplicate_underscore.sol index 822cd826fbb9..4dc19ae1bded 100644 --- a/test/libsolidity/syntaxTests/literals/hex_string_duplicate_underscore.sol +++ b/test/libsolidity/syntaxTests/literals/hex_string_duplicate_underscore.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (52-60): Invalid use of number separator '_'. +// ParserError 8936: (52-60): Invalid use of number separator '_'. diff --git a/test/libsolidity/syntaxTests/literals/hex_string_leading_underscore.sol b/test/libsolidity/syntaxTests/literals/hex_string_leading_underscore.sol index 320b181b8910..d6d3d43eea35 100644 --- a/test/libsolidity/syntaxTests/literals/hex_string_leading_underscore.sol +++ b/test/libsolidity/syntaxTests/literals/hex_string_leading_underscore.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (52-57): Invalid use of number separator '_'. +// ParserError 8936: (52-57): Invalid use of number separator '_'. diff --git a/test/libsolidity/syntaxTests/literals/hex_string_misaligned_underscore.sol b/test/libsolidity/syntaxTests/literals/hex_string_misaligned_underscore.sol index d0b945530fa0..6e64ae2db57d 100644 --- a/test/libsolidity/syntaxTests/literals/hex_string_misaligned_underscore.sol +++ b/test/libsolidity/syntaxTests/literals/hex_string_misaligned_underscore.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (52-56): Expected even number of hex-nibbles. +// ParserError 8936: (52-56): Expected even number of hex-nibbles. diff --git a/test/libsolidity/syntaxTests/literals/hex_string_trailing_underscore.sol b/test/libsolidity/syntaxTests/literals/hex_string_trailing_underscore.sol index c098587ac6dc..a015846e2226 100644 --- a/test/libsolidity/syntaxTests/literals/hex_string_trailing_underscore.sol +++ b/test/libsolidity/syntaxTests/literals/hex_string_trailing_underscore.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (52-61): Invalid use of number separator '_'. +// ParserError 8936: (52-61): Invalid use of number separator '_'. diff --git a/test/libsolidity/syntaxTests/lvalues/calldata_index_access.sol b/test/libsolidity/syntaxTests/lvalues/calldata_index_access.sol index e58d86041f63..480f949485f7 100644 --- a/test/libsolidity/syntaxTests/lvalues/calldata_index_access.sol +++ b/test/libsolidity/syntaxTests/lvalues/calldata_index_access.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (74-78): Calldata arrays are read-only. +// TypeError 6182: (74-78): Calldata arrays are read-only. diff --git a/test/libsolidity/syntaxTests/lvalues/calldata_member_access.sol b/test/libsolidity/syntaxTests/lvalues/calldata_member_access.sol index 80bc5ad01529..42c3a3f97be0 100644 --- a/test/libsolidity/syntaxTests/lvalues/calldata_member_access.sol +++ b/test/libsolidity/syntaxTests/lvalues/calldata_member_access.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (128-131): Calldata structs are read-only. +// TypeError 4156: (128-131): Calldata structs are read-only. diff --git a/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol b/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol index 16a37911ac76..ed638781c275 100644 --- a/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol +++ b/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (96-97): External function arguments of reference type are read-only. +// TypeError 7128: (96-97): External function arguments of reference type are read-only. diff --git a/test/libsolidity/syntaxTests/lvalues/functions.sol b/test/libsolidity/syntaxTests/lvalues/functions.sol index 6aa73e0f2128..4a7e919acab9 100644 --- a/test/libsolidity/syntaxTests/lvalues/functions.sol +++ b/test/libsolidity/syntaxTests/lvalues/functions.sol @@ -11,5 +11,5 @@ contract C { } } // ---- -// TypeError: (83-84): Expression has to be an lvalue. -// TypeError: (166-172): Expression has to be an lvalue. +// TypeError 4247: (83-84): Expression has to be an lvalue. +// TypeError 4247: (166-172): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/lvalues/library_mapping.sol b/test/libsolidity/syntaxTests/lvalues/library_mapping.sol index 9aa4099c9d20..2a1fe1fd8b44 100644 --- a/test/libsolidity/syntaxTests/lvalues/library_mapping.sol +++ b/test/libsolidity/syntaxTests/lvalues/library_mapping.sol @@ -4,4 +4,4 @@ library L { } } // ---- -// TypeError: (108-109): Mappings cannot be assigned to. +// TypeError 9214: (108-109): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_send.sol b/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_send.sol index 56ad892864f8..809309d1d3be 100644 --- a/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_send.sol +++ b/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_send.sol @@ -5,4 +5,4 @@ contract C { } // ---- -// TypeError: (47-65): "send" and "transfer" are only available for objects of type "address payable", not "address". +// TypeError 9862: (47-65): "send" and "transfer" are only available for objects of type "address payable", not "address". diff --git a/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_transfer.sol b/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_transfer.sol index 21d792ee4c5a..54b7a12eb883 100644 --- a/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_transfer.sol +++ b/test/libsolidity/syntaxTests/memberLookup/contract_not_payable_transfer.sol @@ -5,4 +5,4 @@ contract C { } // ---- -// TypeError: (47-69): "send" and "transfer" are only available for objects of type "address payable", not "address". +// TypeError 9862: (47-69): "send" and "transfer" are only available for objects of type "address payable", not "address". diff --git a/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup.sol b/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup.sol index 119df5d3fdc2..041c7878f1de 100644 --- a/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup.sol +++ b/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup.sol @@ -4,4 +4,4 @@ contract C { function g() public { f(1, 2, 3); } } // ---- -// TypeError: (101-102): No matching declaration found after argument-dependent lookup. +// TypeError 9322: (101-102): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup_in_library.sol b/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup_in_library.sol index d8f2eadd128d..2feb329a2a97 100644 --- a/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup_in_library.sol +++ b/test/libsolidity/syntaxTests/memberLookup/failed_function_lookup_in_library.sol @@ -6,4 +6,4 @@ contract C { function g() public { L.f(1, 2, 3); } } // ---- -// TypeError: (115-118): Member "f" not found or not visible after argument-dependent lookup in type(library L). +// TypeError 9582: (115-118): Member "f" not found or not visible after argument-dependent lookup in type(library L). diff --git a/test/libsolidity/syntaxTests/memberLookup/member_not_unique.sol b/test/libsolidity/syntaxTests/memberLookup/member_not_unique.sol index 37ef32b01bbc..1bffefb21db2 100644 --- a/test/libsolidity/syntaxTests/memberLookup/member_not_unique.sol +++ b/test/libsolidity/syntaxTests/memberLookup/member_not_unique.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (282-287): Member "a" not unique after argument-dependent lookup in contract C. +// TypeError 6675: (282-287): Member "a" not unique after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/memberLookup/member_value_not_unique.sol b/test/libsolidity/syntaxTests/memberLookup/member_value_not_unique.sol index e1c69fe3ec25..0fe2e3281b03 100644 --- a/test/libsolidity/syntaxTests/memberLookup/member_value_not_unique.sol +++ b/test/libsolidity/syntaxTests/memberLookup/member_value_not_unique.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (290-299): Member "value" not unique after argument-dependent lookup in contract C - did you forget the "payable" modifier? +// TypeError 6675: (290-299): Member "value" not unique after argument-dependent lookup in contract C - did you forget the "payable" modifier? diff --git a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol index 64d62e08c32b..e9e1f7a06ebf 100644 --- a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol +++ b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (208-218): Member "b1" is not available in struct Test.S1 memory outside of storage. +// TypeError 4994: (208-218): Member "b1" is not available in struct Test.S1 memory outside of storage. diff --git a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol index bdafc754b0a1..594c881b7c5c 100644 --- a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol +++ b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol @@ -7,4 +7,4 @@ contract Test { } } // ---- -// TypeError: (118-121): Member "b" is not available in struct Test.S memory outside of storage. +// TypeError 4994: (118-121): Member "b" is not available in struct Test.S memory outside of storage. diff --git a/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_pure.sol b/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_pure.sol index 398c127dbbaf..bdd188981768 100644 --- a/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_pure.sol +++ b/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_pure.sol @@ -3,4 +3,4 @@ contract C { function f() costs(1 ether) public pure {} } // ---- -// TypeError: (101-115): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (101-115): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_view.sol b/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_view.sol index abfc1eb87a5f..29e47138cd99 100644 --- a/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_view.sol +++ b/test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_view.sol @@ -3,4 +3,4 @@ contract C { function f() costs(1 ether) public view {} } // ---- -// TypeError: (101-115): This modifier uses "msg.value" or "callvalue()" and thus the function has to be payable or internal. +// TypeError 4006: (101-115): This modifier uses "msg.value" or "callvalue()" and thus the function has to be payable or internal. diff --git a/test/libsolidity/syntaxTests/memberLookup/push_on_memory_types.sol b/test/libsolidity/syntaxTests/memberLookup/push_on_memory_types.sol index 310c073f5c28..f10fc44d02cb 100644 --- a/test/libsolidity/syntaxTests/memberLookup/push_on_memory_types.sol +++ b/test/libsolidity/syntaxTests/memberLookup/push_on_memory_types.sol @@ -5,4 +5,4 @@ contract Test { } } // ---- -// TypeError: (77-83): Member "push" is not available in uint256[] memory outside of storage. +// TypeError 4994: (77-83): Member "push" is not available in uint256[] memory outside of storage. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol index b48a63abf557..2f5c356c08d0 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol @@ -7,4 +7,4 @@ abstract contract Other { function f(uint) public returns (uint); } // ---- -// TypeError: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other). +// TypeError 9582: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol index 4ff08b3fc1c3..538a26e78941 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol @@ -7,4 +7,4 @@ abstract contract Other { function f(uint) public returns (uint); } // ---- -// TypeError: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other). +// TypeError 9582: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol index 33dbfd7c69f6..33a58c64804d 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol @@ -16,7 +16,7 @@ contract Test is Base { } } // ---- -// TypeError: (165-188): Circular reference for contract code access. -// TypeError: (271-293): Circular reference for contract code access. -// TypeError: (381-404): Circular reference for contract code access. -// TypeError: (491-513): Circular reference for contract code access. +// TypeError 4224: (165-188): Circular reference for contract code access. +// TypeError 4224: (271-293): Circular reference for contract code access. +// TypeError 4224: (381-404): Circular reference for contract code access. +// TypeError 4224: (491-513): Circular reference for contract code access. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol index d5723df667ce..e27b2cd3bc3a 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol @@ -9,4 +9,4 @@ contract B { } } // ---- -// TypeError: (133-152): Circular reference for contract code access. +// TypeError 4224: (133-152): Circular reference for contract code access. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol index 022e4d6f8813..c9cade179f55 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol @@ -6,5 +6,5 @@ contract Test { } contract C {} // ---- -// TypeError: (55-75): Expression has to be an lvalue. -// TypeError: (100-119): Expression has to be an lvalue. +// TypeError 4247: (55-75): Expression has to be an lvalue. +// TypeError 4247: (100-119): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/metaTypes/contract_min.sol b/test/libsolidity/syntaxTests/metaTypes/contract_min.sol index a922593b3905..d6c0789c149d 100644 --- a/test/libsolidity/syntaxTests/metaTypes/contract_min.sol +++ b/test/libsolidity/syntaxTests/metaTypes/contract_min.sol @@ -4,4 +4,4 @@ contract Min { } } // ---- -// TypeError: (50-63): Member "min" not found or not visible after argument-dependent lookup in type(contract Min). +// TypeError 9582: (50-63): Member "min" not found or not visible after argument-dependent lookup in type(contract Min). diff --git a/test/libsolidity/syntaxTests/metaTypes/int_name.sol b/test/libsolidity/syntaxTests/metaTypes/int_name.sol index b6c4f49a5780..d8f3acd03197 100644 --- a/test/libsolidity/syntaxTests/metaTypes/int_name.sol +++ b/test/libsolidity/syntaxTests/metaTypes/int_name.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (47-61): Member "name" not found or not visible after argument-dependent lookup in type(int256). +// TypeError 9582: (47-61): Member "name" not found or not visible after argument-dependent lookup in type(int256). diff --git a/test/libsolidity/syntaxTests/metaTypes/integer_err.sol b/test/libsolidity/syntaxTests/metaTypes/integer_err.sol index 5a0610638bf8..0b1fab2e5fa3 100644 --- a/test/libsolidity/syntaxTests/metaTypes/integer_err.sol +++ b/test/libsolidity/syntaxTests/metaTypes/integer_err.sol @@ -10,6 +10,6 @@ contract Test { } } // ---- -// TypeError: (59-89): Type int256 is not implicitly convertible to expected type uint8. -// TypeError: (99-127): Type int256 is not implicitly convertible to expected type uint256. -// TypeError: (142-169): Operator == not compatible with types int256 and int_const 1157...(70 digits omitted)...9935 +// TypeError 9574: (59-89): Type int256 is not implicitly convertible to expected type uint8. +// TypeError 9574: (99-127): Type int256 is not implicitly convertible to expected type uint256. +// TypeError 2271: (142-169): Operator == not compatible with types int256 and int_const 1157...(70 digits omitted)...9935 diff --git a/test/libsolidity/syntaxTests/metaTypes/integer_pure.sol b/test/libsolidity/syntaxTests/metaTypes/integer_pure.sol index 2eb115e0fd5f..ad78c2715870 100644 --- a/test/libsolidity/syntaxTests/metaTypes/integer_pure.sol +++ b/test/libsolidity/syntaxTests/metaTypes/integer_pure.sol @@ -12,5 +12,5 @@ contract test { } // ---- -// Warning: (21-112): Function state mutability can be restricted to pure -// Warning: (118-200): Function state mutability can be restricted to pure +// Warning 2018: (21-112): Function state mutability can be restricted to pure +// Warning 2018: (118-200): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol b/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol index 542aaf53ad50..3e2d577d54cf 100644 --- a/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol +++ b/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol @@ -4,4 +4,4 @@ contract Test { } } // ---- -// TypeError: (85-91): This function takes one argument, but 0 were provided. +// TypeError 8885: (85-91): This function takes one argument, but 0 were provided. diff --git a/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol index ec8d97842ccb..d0727833bd62 100644 --- a/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol +++ b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol @@ -13,5 +13,5 @@ contract D is C { constructor() public {} } // ---- -// Warning: (77-96): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. -// Warning: (118-137): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. +// Warning 6417: (77-96): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. +// Warning 6417: (118-137): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. diff --git a/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol b/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol index 61c2b779d8ed..38d4e9a58c47 100644 --- a/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol +++ b/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol @@ -4,4 +4,4 @@ contract Test { } } // ---- -// TypeError: (85-95): This function takes one argument, but 2 were provided. +// TypeError 8885: (85-95): This function takes one argument, but 2 were provided. diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol index 144ca1c38686..b8f44134e7fd 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol @@ -1,3 +1,3 @@ contract type { } // ---- -// ParserError: (9-13): Expected identifier but got 'type' +// ParserError 2314: (9-13): Expected identifier but got 'type' diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol index b7881f153771..a22b45efb45f 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol @@ -3,4 +3,4 @@ contract Test { } } // ---- -// ParserError: (29-33): Expected identifier but got 'type' +// ParserError 2314: (29-33): Expected identifier but got 'type' diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol index 001ba8405335..b1ba7e542956 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol @@ -3,4 +3,4 @@ contract Test { } } // ---- -// ParserError: (36-40): Expected ',' but got 'type' +// ParserError 2314: (36-40): Expected ',' but got 'type' diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol index fa827a33bfb3..213eef18c79c 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol @@ -2,4 +2,4 @@ contract Test { uint type; } // ---- -// ParserError: (25-29): Expected identifier but got 'type' +// ParserError 2314: (25-29): Expected identifier but got 'type' diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol index fa57698d461c..256b4b582217 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol @@ -4,4 +4,4 @@ contract Test { } } // ---- -// ParserError: (60-64): Expected ';' but got 'type' +// ParserError 2314: (60-64): Expected ';' but got 'type' diff --git a/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol b/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol index c0d2577e2468..bd434fc26609 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol @@ -4,4 +4,4 @@ contract Test { } } // ---- -// Warning: (78-88): Statement has no effect. +// Warning 6133: (78-88): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol b/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol index 903338a432dd..4c21e80547a8 100644 --- a/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol +++ b/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol @@ -4,5 +4,5 @@ contract Test { } } // ---- -// TypeError: (65-75): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract Test) provided. -// TypeError: (60-76): Invalid type for argument in the function call. A contract type or an integer type is required, but tuple() provided. +// TypeError 4259: (65-75): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract Test) provided. +// TypeError 4259: (60-76): Invalid type for argument in the function call. A contract type or an integer type is required, but tuple() provided. diff --git a/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol b/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol index 94f498922f96..050ae044c12c 100644 --- a/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol +++ b/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol @@ -6,4 +6,4 @@ contract Test { } } // ---- -// TypeError: (154-155): Invalid type for argument in the function call. A contract type or an integer type is required, but type(struct Test.S) provided. +// TypeError 4259: (154-155): Invalid type for argument in the function call. A contract type or an integer type is required, but type(struct Test.S) provided. diff --git a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol index c233cd69c66f..a78de87886ac 100644 --- a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol +++ b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol @@ -25,4 +25,4 @@ contract Voting is Ownable { } } // ---- -// Warning: (324-340): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (324-340): Unused function parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/missing_state_variable.sol b/test/libsolidity/syntaxTests/missing_state_variable.sol index 8b97220c5c77..5ba3429f3f31 100644 --- a/test/libsolidity/syntaxTests/missing_state_variable.sol +++ b/test/libsolidity/syntaxTests/missing_state_variable.sol @@ -4,4 +4,4 @@ contract Scope { } } // ---- -// TypeError: (101-115): Member "stateVar" not found or not visible after argument-dependent lookup in type(contract Scope). +// TypeError 9582: (101-115): Member "stateVar" not found or not visible after argument-dependent lookup in type(contract Scope). diff --git a/test/libsolidity/syntaxTests/modifiers/base_constructor_double_invocation.sol b/test/libsolidity/syntaxTests/modifiers/base_constructor_double_invocation.sol index 49d0d7bf42a8..67a1b6da2125 100644 --- a/test/libsolidity/syntaxTests/modifiers/base_constructor_double_invocation.sol +++ b/test/libsolidity/syntaxTests/modifiers/base_constructor_double_invocation.sol @@ -3,5 +3,5 @@ contract B is C { constructor() C(2) C(2) public {} } // ---- -// DeclarationError: (81-85): Base constructor arguments given twice. -// DeclarationError: (86-90): Base constructor already provided. +// DeclarationError 3364: (81-85): Base constructor arguments given twice. +// DeclarationError 1697: (86-90): Base constructor already provided. diff --git a/test/libsolidity/syntaxTests/modifiers/constructor_as_modifier.sol b/test/libsolidity/syntaxTests/modifiers/constructor_as_modifier.sol index a65e0e84c2a7..36a98fae3ea3 100644 --- a/test/libsolidity/syntaxTests/modifiers/constructor_as_modifier.sol +++ b/test/libsolidity/syntaxTests/modifiers/constructor_as_modifier.sol @@ -2,4 +2,4 @@ contract C { constructor() C() public {} } // ---- -// TypeError: (31-34): Referenced declaration is neither modifier nor base class. +// TypeError 4659: (31-34): Referenced declaration is neither modifier nor base class. diff --git a/test/libsolidity/syntaxTests/modifiers/constructor_call_invalid_arg_count.sol b/test/libsolidity/syntaxTests/modifiers/constructor_call_invalid_arg_count.sol index 4a2b5c4a5b17..4826ed4ef8fb 100644 --- a/test/libsolidity/syntaxTests/modifiers/constructor_call_invalid_arg_count.sol +++ b/test/libsolidity/syntaxTests/modifiers/constructor_call_invalid_arg_count.sol @@ -6,4 +6,4 @@ contract D is C { constructor() C(5) public {} } // ---- -// TypeError: (127-131): Wrong argument count for modifier invocation: 1 arguments given but expected 0. +// TypeError 2973: (127-131): Wrong argument count for modifier invocation: 1 arguments given but expected 0. diff --git a/test/libsolidity/syntaxTests/modifiers/empty_modifier_err.sol b/test/libsolidity/syntaxTests/modifiers/empty_modifier_err.sol index 77a29903f585..e9e03f30423b 100644 --- a/test/libsolidity/syntaxTests/modifiers/empty_modifier_err.sol +++ b/test/libsolidity/syntaxTests/modifiers/empty_modifier_err.sol @@ -5,6 +5,6 @@ contract C is B { } abstract contract D {modifier m;} // ---- -// TypeError: (0-32): Contract "A" should be marked as abstract. -// TypeError: (76-95): Contract "C" should be marked as abstract. -// TypeError: (118-129): Modifiers without implementation must be marked virtual. +// TypeError 3656: (0-32): Contract "A" should be marked as abstract. +// TypeError 3656: (76-95): Contract "C" should be marked as abstract. +// TypeError 8063: (118-129): Modifiers without implementation must be marked virtual. diff --git a/test/libsolidity/syntaxTests/modifiers/function_modifier_invocation_local_variables.sol b/test/libsolidity/syntaxTests/modifiers/function_modifier_invocation_local_variables.sol index 76bb6fc01eb6..2616ab9f841d 100644 --- a/test/libsolidity/syntaxTests/modifiers/function_modifier_invocation_local_variables.sol +++ b/test/libsolidity/syntaxTests/modifiers/function_modifier_invocation_local_variables.sol @@ -3,4 +3,4 @@ contract B { modifier mod(uint a) { if (a > 0) _; } } // ---- -// DeclarationError: (34-35): Undeclared identifier. +// DeclarationError 7576: (34-35): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/modifiers/function_overrides_modifier.sol b/test/libsolidity/syntaxTests/modifiers/function_overrides_modifier.sol index 922e25051bc8..4be6bc898453 100644 --- a/test/libsolidity/syntaxTests/modifiers/function_overrides_modifier.sol +++ b/test/libsolidity/syntaxTests/modifiers/function_overrides_modifier.sol @@ -1,5 +1,5 @@ contract A { function mod(uint a) public { } } contract B is A { modifier mod(uint a) { _; } } // ---- -// DeclarationError: (65-92): Identifier already declared. -// TypeError: (65-92): Override changes function or public state variable to modifier. +// DeclarationError 9097: (65-92): Identifier already declared. +// TypeError 5631: (65-92): Override changes function or public state variable to modifier. diff --git a/test/libsolidity/syntaxTests/modifiers/illegal_modifier_override.sol b/test/libsolidity/syntaxTests/modifiers/illegal_modifier_override.sol index 9abe7e07518b..81a2fe29bf3e 100644 --- a/test/libsolidity/syntaxTests/modifiers/illegal_modifier_override.sol +++ b/test/libsolidity/syntaxTests/modifiers/illegal_modifier_override.sol @@ -1,6 +1,6 @@ contract A { modifier mod(uint a) { _; } } contract B is A { modifier mod(uint8 a) { _; } } // ---- -// TypeError: (61-89): Override changes modifier signature. -// TypeError: (61-89): Overriding modifier is missing "override" specifier. -// TypeError: (13-40): Trying to override non-virtual modifier. Did you forget to add "virtual"? +// TypeError 1078: (61-89): Override changes modifier signature. +// TypeError 9456: (61-89): Overriding modifier is missing "override" specifier. +// TypeError 4334: (13-40): Trying to override non-virtual modifier. Did you forget to add "virtual"? diff --git a/test/libsolidity/syntaxTests/modifiers/invalid_function_modifier_type.sol b/test/libsolidity/syntaxTests/modifiers/invalid_function_modifier_type.sol index c1e3108bd78c..37cc50beb844 100644 --- a/test/libsolidity/syntaxTests/modifiers/invalid_function_modifier_type.sol +++ b/test/libsolidity/syntaxTests/modifiers/invalid_function_modifier_type.sol @@ -3,4 +3,4 @@ contract B { modifier mod1(uint a) { if (a > 0) _; } } // ---- -// TypeError: (35-39): Invalid type for argument in modifier invocation. Invalid implicit conversion from bool to uint256 requested. +// TypeError 4649: (35-39): Invalid type for argument in modifier invocation. Invalid implicit conversion from bool to uint256 requested. diff --git a/test/libsolidity/syntaxTests/modifiers/modifier_overrides_function.sol b/test/libsolidity/syntaxTests/modifiers/modifier_overrides_function.sol index 85ca6c20a6a2..a22344cab72d 100644 --- a/test/libsolidity/syntaxTests/modifiers/modifier_overrides_function.sol +++ b/test/libsolidity/syntaxTests/modifiers/modifier_overrides_function.sol @@ -1,5 +1,5 @@ contract A { modifier mod(uint a) { _; } } contract B is A { function mod(uint a) public { } } // ---- -// DeclarationError: (61-92): Identifier already declared. -// TypeError: (61-92): Override changes modifier to function. +// DeclarationError 9097: (61-92): Identifier already declared. +// TypeError 1469: (61-92): Override changes modifier to function. diff --git a/test/libsolidity/syntaxTests/modifiers/modifier_returns_value.sol b/test/libsolidity/syntaxTests/modifiers/modifier_returns_value.sol index d22e836c32de..fc658e62550e 100644 --- a/test/libsolidity/syntaxTests/modifiers/modifier_returns_value.sol +++ b/test/libsolidity/syntaxTests/modifiers/modifier_returns_value.sol @@ -3,4 +3,4 @@ contract A { modifier mod(uint a) { _; return 7; } } // ---- -// TypeError: (101-109): Return arguments not allowed. +// TypeError 7552: (101-109): Return arguments not allowed. diff --git a/test/libsolidity/syntaxTests/modifiers/modifier_without_underscore.sol b/test/libsolidity/syntaxTests/modifiers/modifier_without_underscore.sol index 6198d3c5581d..c1689c44d300 100644 --- a/test/libsolidity/syntaxTests/modifiers/modifier_without_underscore.sol +++ b/test/libsolidity/syntaxTests/modifiers/modifier_without_underscore.sol @@ -2,4 +2,4 @@ contract test { modifier m() {} } // ---- -// SyntaxError: (33-35): Modifier body does not contain '_'. +// SyntaxError 2883: (33-35): Modifier body does not contain '_'. diff --git a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol index a3ffd7c17557..16061fbafd4c 100644 --- a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol +++ b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol @@ -9,5 +9,5 @@ abstract contract C function bar() public only_owner virtual; } // ---- -// SyntaxError: (212-253): Functions without implementation cannot have modifiers. -// SyntaxError: (258-299): Functions without implementation cannot have modifiers. +// SyntaxError 2668: (212-253): Functions without implementation cannot have modifiers. +// SyntaxError 2668: (258-299): Functions without implementation cannot have modifiers. diff --git a/test/libsolidity/syntaxTests/modifiers/non-virtual_modifier_override.sol b/test/libsolidity/syntaxTests/modifiers/non-virtual_modifier_override.sol index 81d7ba901f11..1dcd26ad79bc 100644 --- a/test/libsolidity/syntaxTests/modifiers/non-virtual_modifier_override.sol +++ b/test/libsolidity/syntaxTests/modifiers/non-virtual_modifier_override.sol @@ -1,4 +1,4 @@ contract A { modifier mod(uint a) { _; } } contract B is A { modifier mod(uint a) override { _; } } // ---- -// TypeError: (13-40): Trying to override non-virtual modifier. Did you forget to add "virtual"? +// TypeError 4334: (13-40): Trying to override non-virtual modifier. Did you forget to add "virtual"? diff --git a/test/libsolidity/syntaxTests/modifiers/unimplemented_function_and_modifier.sol b/test/libsolidity/syntaxTests/modifiers/unimplemented_function_and_modifier.sol index aff392e8b8b8..bf823748c85b 100644 --- a/test/libsolidity/syntaxTests/modifiers/unimplemented_function_and_modifier.sol +++ b/test/libsolidity/syntaxTests/modifiers/unimplemented_function_and_modifier.sol @@ -26,6 +26,6 @@ contract E is A { modifier mod() override { _;} } // ---- -// TypeError: (137-254): Contract "B" should be marked as abstract. -// TypeError: (256-344): Contract "C" should be marked as abstract. -// TypeError: (346-466): Contract "D" should be marked as abstract. +// TypeError 3656: (137-254): Contract "B" should be marked as abstract. +// TypeError 3656: (256-344): Contract "C" should be marked as abstract. +// TypeError 3656: (346-466): Contract "D" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/modifiers/use_in_invalid_context.sol b/test/libsolidity/syntaxTests/modifiers/use_in_invalid_context.sol index 1dd797ee635c..897a23874186 100644 --- a/test/libsolidity/syntaxTests/modifiers/use_in_invalid_context.sol +++ b/test/libsolidity/syntaxTests/modifiers/use_in_invalid_context.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// TypeError: (77-80): Modifier can only be referenced in function headers. +// TypeError 3112: (77-80): Modifier can only be referenced in function headers. diff --git a/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol index 307b728d3aa7..ff1697e1e609 100644 --- a/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol +++ b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol @@ -265,260 +265,260 @@ contract C { } } // ---- -// DeclarationError: (41-42): Undeclared identifier. -// DeclarationError: (52-53): Undeclared identifier. -// DeclarationError: (63-64): Undeclared identifier. -// DeclarationError: (74-75): Undeclared identifier. -// DeclarationError: (85-86): Undeclared identifier. -// DeclarationError: (96-97): Undeclared identifier. -// DeclarationError: (107-108): Undeclared identifier. -// DeclarationError: (118-119): Undeclared identifier. -// DeclarationError: (129-130): Undeclared identifier. -// DeclarationError: (140-141): Undeclared identifier. -// DeclarationError: (151-152): Undeclared identifier. -// DeclarationError: (162-163): Undeclared identifier. -// DeclarationError: (173-174): Undeclared identifier. -// DeclarationError: (184-185): Undeclared identifier. -// DeclarationError: (195-196): Undeclared identifier. -// DeclarationError: (206-207): Undeclared identifier. -// DeclarationError: (217-218): Undeclared identifier. -// DeclarationError: (228-229): Undeclared identifier. -// DeclarationError: (239-240): Undeclared identifier. -// DeclarationError: (250-251): Undeclared identifier. -// DeclarationError: (261-262): Undeclared identifier. -// DeclarationError: (272-273): Undeclared identifier. -// DeclarationError: (283-284): Undeclared identifier. -// DeclarationError: (294-295): Undeclared identifier. -// DeclarationError: (305-306): Undeclared identifier. -// DeclarationError: (316-317): Undeclared identifier. -// DeclarationError: (327-328): Undeclared identifier. -// DeclarationError: (338-339): Undeclared identifier. -// DeclarationError: (349-350): Undeclared identifier. -// DeclarationError: (360-361): Undeclared identifier. -// DeclarationError: (371-372): Undeclared identifier. -// DeclarationError: (382-383): Undeclared identifier. -// DeclarationError: (393-394): Undeclared identifier. -// DeclarationError: (404-405): Undeclared identifier. -// DeclarationError: (415-416): Undeclared identifier. -// DeclarationError: (426-427): Undeclared identifier. -// DeclarationError: (437-438): Undeclared identifier. -// DeclarationError: (448-449): Undeclared identifier. -// DeclarationError: (459-460): Undeclared identifier. -// DeclarationError: (470-471): Undeclared identifier. -// DeclarationError: (481-482): Undeclared identifier. -// DeclarationError: (492-493): Undeclared identifier. -// DeclarationError: (503-504): Undeclared identifier. -// DeclarationError: (514-515): Undeclared identifier. -// DeclarationError: (525-526): Undeclared identifier. -// DeclarationError: (536-537): Undeclared identifier. -// DeclarationError: (547-548): Undeclared identifier. -// DeclarationError: (558-559): Undeclared identifier. -// DeclarationError: (569-570): Undeclared identifier. -// DeclarationError: (580-581): Undeclared identifier. -// DeclarationError: (591-592): Undeclared identifier. -// DeclarationError: (602-603): Undeclared identifier. -// DeclarationError: (613-614): Undeclared identifier. -// DeclarationError: (624-625): Undeclared identifier. -// DeclarationError: (635-636): Undeclared identifier. -// DeclarationError: (646-647): Undeclared identifier. -// DeclarationError: (657-658): Undeclared identifier. -// DeclarationError: (668-669): Undeclared identifier. -// DeclarationError: (679-680): Undeclared identifier. -// DeclarationError: (690-691): Undeclared identifier. -// DeclarationError: (701-702): Undeclared identifier. -// DeclarationError: (712-713): Undeclared identifier. -// DeclarationError: (723-724): Undeclared identifier. -// DeclarationError: (734-735): Undeclared identifier. -// DeclarationError: (745-746): Undeclared identifier. -// DeclarationError: (756-757): Undeclared identifier. -// DeclarationError: (767-768): Undeclared identifier. -// DeclarationError: (778-779): Undeclared identifier. -// DeclarationError: (789-790): Undeclared identifier. -// DeclarationError: (800-801): Undeclared identifier. -// DeclarationError: (811-812): Undeclared identifier. -// DeclarationError: (822-823): Undeclared identifier. -// DeclarationError: (833-834): Undeclared identifier. -// DeclarationError: (844-845): Undeclared identifier. -// DeclarationError: (855-856): Undeclared identifier. -// DeclarationError: (866-867): Undeclared identifier. -// DeclarationError: (877-878): Undeclared identifier. -// DeclarationError: (888-889): Undeclared identifier. -// DeclarationError: (899-900): Undeclared identifier. -// DeclarationError: (910-911): Undeclared identifier. -// DeclarationError: (921-922): Undeclared identifier. -// DeclarationError: (932-933): Undeclared identifier. -// DeclarationError: (943-944): Undeclared identifier. -// DeclarationError: (954-955): Undeclared identifier. -// DeclarationError: (965-966): Undeclared identifier. -// DeclarationError: (976-977): Undeclared identifier. -// DeclarationError: (987-988): Undeclared identifier. -// DeclarationError: (998-999): Undeclared identifier. -// DeclarationError: (1009-1010): Undeclared identifier. -// DeclarationError: (1020-1021): Undeclared identifier. -// DeclarationError: (1031-1032): Undeclared identifier. -// DeclarationError: (1042-1043): Undeclared identifier. -// DeclarationError: (1053-1054): Undeclared identifier. -// DeclarationError: (1064-1065): Undeclared identifier. -// DeclarationError: (1075-1076): Undeclared identifier. -// DeclarationError: (1086-1087): Undeclared identifier. -// DeclarationError: (1097-1098): Undeclared identifier. -// DeclarationError: (1108-1109): Undeclared identifier. -// DeclarationError: (1119-1120): Undeclared identifier. -// DeclarationError: (1130-1131): Undeclared identifier. -// DeclarationError: (1141-1142): Undeclared identifier. -// DeclarationError: (1152-1153): Undeclared identifier. -// DeclarationError: (1163-1164): Undeclared identifier. -// DeclarationError: (1174-1175): Undeclared identifier. -// DeclarationError: (1185-1186): Undeclared identifier. -// DeclarationError: (1196-1197): Undeclared identifier. -// DeclarationError: (1207-1208): Undeclared identifier. -// DeclarationError: (1218-1219): Undeclared identifier. -// DeclarationError: (1229-1230): Undeclared identifier. -// DeclarationError: (1240-1241): Undeclared identifier. -// DeclarationError: (1251-1252): Undeclared identifier. -// DeclarationError: (1262-1263): Undeclared identifier. -// DeclarationError: (1273-1274): Undeclared identifier. -// DeclarationError: (1284-1285): Undeclared identifier. -// DeclarationError: (1295-1296): Undeclared identifier. -// DeclarationError: (1306-1307): Undeclared identifier. -// DeclarationError: (1317-1318): Undeclared identifier. -// DeclarationError: (1328-1329): Undeclared identifier. -// DeclarationError: (1339-1340): Undeclared identifier. -// DeclarationError: (1350-1351): Undeclared identifier. -// DeclarationError: (1361-1362): Undeclared identifier. -// DeclarationError: (1372-1373): Undeclared identifier. -// DeclarationError: (1383-1384): Undeclared identifier. -// DeclarationError: (1394-1395): Undeclared identifier. -// DeclarationError: (1405-1406): Undeclared identifier. -// DeclarationError: (1416-1417): Undeclared identifier. -// DeclarationError: (1427-1428): Undeclared identifier. -// DeclarationError: (1438-1439): Undeclared identifier. -// DeclarationError: (1449-1450): Undeclared identifier. -// DeclarationError: (1460-1461): Undeclared identifier. -// DeclarationError: (1471-1472): Undeclared identifier. -// DeclarationError: (1482-1483): Undeclared identifier. -// DeclarationError: (1493-1494): Undeclared identifier. -// DeclarationError: (1504-1505): Undeclared identifier. -// DeclarationError: (1515-1516): Undeclared identifier. -// DeclarationError: (1526-1527): Undeclared identifier. -// DeclarationError: (1537-1538): Undeclared identifier. -// DeclarationError: (1548-1549): Undeclared identifier. -// DeclarationError: (1559-1560): Undeclared identifier. -// DeclarationError: (1570-1571): Undeclared identifier. -// DeclarationError: (1581-1582): Undeclared identifier. -// DeclarationError: (1592-1593): Undeclared identifier. -// DeclarationError: (1603-1604): Undeclared identifier. -// DeclarationError: (1614-1615): Undeclared identifier. -// DeclarationError: (1625-1626): Undeclared identifier. -// DeclarationError: (1636-1637): Undeclared identifier. -// DeclarationError: (1647-1648): Undeclared identifier. -// DeclarationError: (1658-1659): Undeclared identifier. -// DeclarationError: (1669-1670): Undeclared identifier. -// DeclarationError: (1680-1681): Undeclared identifier. -// DeclarationError: (1691-1692): Undeclared identifier. -// DeclarationError: (1702-1703): Undeclared identifier. -// DeclarationError: (1713-1714): Undeclared identifier. -// DeclarationError: (1724-1725): Undeclared identifier. -// DeclarationError: (1735-1736): Undeclared identifier. -// DeclarationError: (1746-1747): Undeclared identifier. -// DeclarationError: (1757-1758): Undeclared identifier. -// DeclarationError: (1768-1769): Undeclared identifier. -// DeclarationError: (1779-1780): Undeclared identifier. -// DeclarationError: (1790-1791): Undeclared identifier. -// DeclarationError: (1801-1802): Undeclared identifier. -// DeclarationError: (1812-1813): Undeclared identifier. -// DeclarationError: (1823-1824): Undeclared identifier. -// DeclarationError: (1834-1835): Undeclared identifier. -// DeclarationError: (1845-1846): Undeclared identifier. -// DeclarationError: (1856-1857): Undeclared identifier. -// DeclarationError: (1867-1868): Undeclared identifier. -// DeclarationError: (1878-1879): Undeclared identifier. -// DeclarationError: (1889-1890): Undeclared identifier. -// DeclarationError: (1900-1901): Undeclared identifier. -// DeclarationError: (1911-1912): Undeclared identifier. -// DeclarationError: (1922-1923): Undeclared identifier. -// DeclarationError: (1933-1934): Undeclared identifier. -// DeclarationError: (1944-1945): Undeclared identifier. -// DeclarationError: (1955-1956): Undeclared identifier. -// DeclarationError: (1966-1967): Undeclared identifier. -// DeclarationError: (1977-1978): Undeclared identifier. -// DeclarationError: (1988-1989): Undeclared identifier. -// DeclarationError: (1999-2000): Undeclared identifier. -// DeclarationError: (2010-2011): Undeclared identifier. -// DeclarationError: (2021-2022): Undeclared identifier. -// DeclarationError: (2032-2033): Undeclared identifier. -// DeclarationError: (2043-2044): Undeclared identifier. -// DeclarationError: (2054-2055): Undeclared identifier. -// DeclarationError: (2065-2066): Undeclared identifier. -// DeclarationError: (2076-2077): Undeclared identifier. -// DeclarationError: (2087-2088): Undeclared identifier. -// DeclarationError: (2098-2099): Undeclared identifier. -// DeclarationError: (2109-2110): Undeclared identifier. -// DeclarationError: (2120-2121): Undeclared identifier. -// DeclarationError: (2131-2132): Undeclared identifier. -// DeclarationError: (2142-2143): Undeclared identifier. -// DeclarationError: (2153-2154): Undeclared identifier. -// DeclarationError: (2164-2165): Undeclared identifier. -// DeclarationError: (2175-2176): Undeclared identifier. -// DeclarationError: (2186-2187): Undeclared identifier. -// DeclarationError: (2197-2198): Undeclared identifier. -// DeclarationError: (2208-2209): Undeclared identifier. -// DeclarationError: (2219-2220): Undeclared identifier. -// DeclarationError: (2230-2231): Undeclared identifier. -// DeclarationError: (2241-2242): Undeclared identifier. -// DeclarationError: (2252-2253): Undeclared identifier. -// DeclarationError: (2263-2264): Undeclared identifier. -// DeclarationError: (2274-2275): Undeclared identifier. -// DeclarationError: (2285-2286): Undeclared identifier. -// DeclarationError: (2296-2297): Undeclared identifier. -// DeclarationError: (2307-2308): Undeclared identifier. -// DeclarationError: (2318-2319): Undeclared identifier. -// DeclarationError: (2329-2330): Undeclared identifier. -// DeclarationError: (2340-2341): Undeclared identifier. -// DeclarationError: (2351-2352): Undeclared identifier. -// DeclarationError: (2362-2363): Undeclared identifier. -// DeclarationError: (2373-2374): Undeclared identifier. -// DeclarationError: (2384-2385): Undeclared identifier. -// DeclarationError: (2395-2396): Undeclared identifier. -// DeclarationError: (2406-2407): Undeclared identifier. -// DeclarationError: (2417-2418): Undeclared identifier. -// DeclarationError: (2428-2429): Undeclared identifier. -// DeclarationError: (2439-2440): Undeclared identifier. -// DeclarationError: (2450-2451): Undeclared identifier. -// DeclarationError: (2461-2462): Undeclared identifier. -// DeclarationError: (2472-2473): Undeclared identifier. -// DeclarationError: (2483-2484): Undeclared identifier. -// DeclarationError: (2494-2495): Undeclared identifier. -// DeclarationError: (2505-2506): Undeclared identifier. -// DeclarationError: (2516-2517): Undeclared identifier. -// DeclarationError: (2527-2528): Undeclared identifier. -// DeclarationError: (2538-2539): Undeclared identifier. -// DeclarationError: (2549-2550): Undeclared identifier. -// DeclarationError: (2560-2561): Undeclared identifier. -// DeclarationError: (2571-2572): Undeclared identifier. -// DeclarationError: (2582-2583): Undeclared identifier. -// DeclarationError: (2593-2594): Undeclared identifier. -// DeclarationError: (2604-2605): Undeclared identifier. -// DeclarationError: (2615-2616): Undeclared identifier. -// DeclarationError: (2626-2627): Undeclared identifier. -// DeclarationError: (2637-2638): Undeclared identifier. -// DeclarationError: (2648-2649): Undeclared identifier. -// DeclarationError: (2659-2660): Undeclared identifier. -// DeclarationError: (2670-2671): Undeclared identifier. -// DeclarationError: (2681-2682): Undeclared identifier. -// DeclarationError: (2692-2693): Undeclared identifier. -// DeclarationError: (2703-2704): Undeclared identifier. -// DeclarationError: (2714-2715): Undeclared identifier. -// DeclarationError: (2725-2726): Undeclared identifier. -// DeclarationError: (2736-2737): Undeclared identifier. -// DeclarationError: (2747-2748): Undeclared identifier. -// DeclarationError: (2758-2759): Undeclared identifier. -// DeclarationError: (2769-2770): Undeclared identifier. -// DeclarationError: (2780-2781): Undeclared identifier. -// DeclarationError: (2791-2792): Undeclared identifier. -// DeclarationError: (2802-2803): Undeclared identifier. -// DeclarationError: (2813-2814): Undeclared identifier. -// DeclarationError: (2824-2825): Undeclared identifier. -// DeclarationError: (2835-2836): Undeclared identifier. -// DeclarationError: (2846-2847): Undeclared identifier. -// Warning: There are more than 256 errors. Aborting. +// DeclarationError 7576: (41-42): Undeclared identifier. +// DeclarationError 7576: (52-53): Undeclared identifier. +// DeclarationError 7576: (63-64): Undeclared identifier. +// DeclarationError 7576: (74-75): Undeclared identifier. +// DeclarationError 7576: (85-86): Undeclared identifier. +// DeclarationError 7576: (96-97): Undeclared identifier. +// DeclarationError 7576: (107-108): Undeclared identifier. +// DeclarationError 7576: (118-119): Undeclared identifier. +// DeclarationError 7576: (129-130): Undeclared identifier. +// DeclarationError 7576: (140-141): Undeclared identifier. +// DeclarationError 7576: (151-152): Undeclared identifier. +// DeclarationError 7576: (162-163): Undeclared identifier. +// DeclarationError 7576: (173-174): Undeclared identifier. +// DeclarationError 7576: (184-185): Undeclared identifier. +// DeclarationError 7576: (195-196): Undeclared identifier. +// DeclarationError 7576: (206-207): Undeclared identifier. +// DeclarationError 7576: (217-218): Undeclared identifier. +// DeclarationError 7576: (228-229): Undeclared identifier. +// DeclarationError 7576: (239-240): Undeclared identifier. +// DeclarationError 7576: (250-251): Undeclared identifier. +// DeclarationError 7576: (261-262): Undeclared identifier. +// DeclarationError 7576: (272-273): Undeclared identifier. +// DeclarationError 7576: (283-284): Undeclared identifier. +// DeclarationError 7576: (294-295): Undeclared identifier. +// DeclarationError 7576: (305-306): Undeclared identifier. +// DeclarationError 7576: (316-317): Undeclared identifier. +// DeclarationError 7576: (327-328): Undeclared identifier. +// DeclarationError 7576: (338-339): Undeclared identifier. +// DeclarationError 7576: (349-350): Undeclared identifier. +// DeclarationError 7576: (360-361): Undeclared identifier. +// DeclarationError 7576: (371-372): Undeclared identifier. +// DeclarationError 7576: (382-383): Undeclared identifier. +// DeclarationError 7576: (393-394): Undeclared identifier. +// DeclarationError 7576: (404-405): Undeclared identifier. +// DeclarationError 7576: (415-416): Undeclared identifier. +// DeclarationError 7576: (426-427): Undeclared identifier. +// DeclarationError 7576: (437-438): Undeclared identifier. +// DeclarationError 7576: (448-449): Undeclared identifier. +// DeclarationError 7576: (459-460): Undeclared identifier. +// DeclarationError 7576: (470-471): Undeclared identifier. +// DeclarationError 7576: (481-482): Undeclared identifier. +// DeclarationError 7576: (492-493): Undeclared identifier. +// DeclarationError 7576: (503-504): Undeclared identifier. +// DeclarationError 7576: (514-515): Undeclared identifier. +// DeclarationError 7576: (525-526): Undeclared identifier. +// DeclarationError 7576: (536-537): Undeclared identifier. +// DeclarationError 7576: (547-548): Undeclared identifier. +// DeclarationError 7576: (558-559): Undeclared identifier. +// DeclarationError 7576: (569-570): Undeclared identifier. +// DeclarationError 7576: (580-581): Undeclared identifier. +// DeclarationError 7576: (591-592): Undeclared identifier. +// DeclarationError 7576: (602-603): Undeclared identifier. +// DeclarationError 7576: (613-614): Undeclared identifier. +// DeclarationError 7576: (624-625): Undeclared identifier. +// DeclarationError 7576: (635-636): Undeclared identifier. +// DeclarationError 7576: (646-647): Undeclared identifier. +// DeclarationError 7576: (657-658): Undeclared identifier. +// DeclarationError 7576: (668-669): Undeclared identifier. +// DeclarationError 7576: (679-680): Undeclared identifier. +// DeclarationError 7576: (690-691): Undeclared identifier. +// DeclarationError 7576: (701-702): Undeclared identifier. +// DeclarationError 7576: (712-713): Undeclared identifier. +// DeclarationError 7576: (723-724): Undeclared identifier. +// DeclarationError 7576: (734-735): Undeclared identifier. +// DeclarationError 7576: (745-746): Undeclared identifier. +// DeclarationError 7576: (756-757): Undeclared identifier. +// DeclarationError 7576: (767-768): Undeclared identifier. +// DeclarationError 7576: (778-779): Undeclared identifier. +// DeclarationError 7576: (789-790): Undeclared identifier. +// DeclarationError 7576: (800-801): Undeclared identifier. +// DeclarationError 7576: (811-812): Undeclared identifier. +// DeclarationError 7576: (822-823): Undeclared identifier. +// DeclarationError 7576: (833-834): Undeclared identifier. +// DeclarationError 7576: (844-845): Undeclared identifier. +// DeclarationError 7576: (855-856): Undeclared identifier. +// DeclarationError 7576: (866-867): Undeclared identifier. +// DeclarationError 7576: (877-878): Undeclared identifier. +// DeclarationError 7576: (888-889): Undeclared identifier. +// DeclarationError 7576: (899-900): Undeclared identifier. +// DeclarationError 7576: (910-911): Undeclared identifier. +// DeclarationError 7576: (921-922): Undeclared identifier. +// DeclarationError 7576: (932-933): Undeclared identifier. +// DeclarationError 7576: (943-944): Undeclared identifier. +// DeclarationError 7576: (954-955): Undeclared identifier. +// DeclarationError 7576: (965-966): Undeclared identifier. +// DeclarationError 7576: (976-977): Undeclared identifier. +// DeclarationError 7576: (987-988): Undeclared identifier. +// DeclarationError 7576: (998-999): Undeclared identifier. +// DeclarationError 7576: (1009-1010): Undeclared identifier. +// DeclarationError 7576: (1020-1021): Undeclared identifier. +// DeclarationError 7576: (1031-1032): Undeclared identifier. +// DeclarationError 7576: (1042-1043): Undeclared identifier. +// DeclarationError 7576: (1053-1054): Undeclared identifier. +// DeclarationError 7576: (1064-1065): Undeclared identifier. +// DeclarationError 7576: (1075-1076): Undeclared identifier. +// DeclarationError 7576: (1086-1087): Undeclared identifier. +// DeclarationError 7576: (1097-1098): Undeclared identifier. +// DeclarationError 7576: (1108-1109): Undeclared identifier. +// DeclarationError 7576: (1119-1120): Undeclared identifier. +// DeclarationError 7576: (1130-1131): Undeclared identifier. +// DeclarationError 7576: (1141-1142): Undeclared identifier. +// DeclarationError 7576: (1152-1153): Undeclared identifier. +// DeclarationError 7576: (1163-1164): Undeclared identifier. +// DeclarationError 7576: (1174-1175): Undeclared identifier. +// DeclarationError 7576: (1185-1186): Undeclared identifier. +// DeclarationError 7576: (1196-1197): Undeclared identifier. +// DeclarationError 7576: (1207-1208): Undeclared identifier. +// DeclarationError 7576: (1218-1219): Undeclared identifier. +// DeclarationError 7576: (1229-1230): Undeclared identifier. +// DeclarationError 7576: (1240-1241): Undeclared identifier. +// DeclarationError 7576: (1251-1252): Undeclared identifier. +// DeclarationError 7576: (1262-1263): Undeclared identifier. +// DeclarationError 7576: (1273-1274): Undeclared identifier. +// DeclarationError 7576: (1284-1285): Undeclared identifier. +// DeclarationError 7576: (1295-1296): Undeclared identifier. +// DeclarationError 7576: (1306-1307): Undeclared identifier. +// DeclarationError 7576: (1317-1318): Undeclared identifier. +// DeclarationError 7576: (1328-1329): Undeclared identifier. +// DeclarationError 7576: (1339-1340): Undeclared identifier. +// DeclarationError 7576: (1350-1351): Undeclared identifier. +// DeclarationError 7576: (1361-1362): Undeclared identifier. +// DeclarationError 7576: (1372-1373): Undeclared identifier. +// DeclarationError 7576: (1383-1384): Undeclared identifier. +// DeclarationError 7576: (1394-1395): Undeclared identifier. +// DeclarationError 7576: (1405-1406): Undeclared identifier. +// DeclarationError 7576: (1416-1417): Undeclared identifier. +// DeclarationError 7576: (1427-1428): Undeclared identifier. +// DeclarationError 7576: (1438-1439): Undeclared identifier. +// DeclarationError 7576: (1449-1450): Undeclared identifier. +// DeclarationError 7576: (1460-1461): Undeclared identifier. +// DeclarationError 7576: (1471-1472): Undeclared identifier. +// DeclarationError 7576: (1482-1483): Undeclared identifier. +// DeclarationError 7576: (1493-1494): Undeclared identifier. +// DeclarationError 7576: (1504-1505): Undeclared identifier. +// DeclarationError 7576: (1515-1516): Undeclared identifier. +// DeclarationError 7576: (1526-1527): Undeclared identifier. +// DeclarationError 7576: (1537-1538): Undeclared identifier. +// DeclarationError 7576: (1548-1549): Undeclared identifier. +// DeclarationError 7576: (1559-1560): Undeclared identifier. +// DeclarationError 7576: (1570-1571): Undeclared identifier. +// DeclarationError 7576: (1581-1582): Undeclared identifier. +// DeclarationError 7576: (1592-1593): Undeclared identifier. +// DeclarationError 7576: (1603-1604): Undeclared identifier. +// DeclarationError 7576: (1614-1615): Undeclared identifier. +// DeclarationError 7576: (1625-1626): Undeclared identifier. +// DeclarationError 7576: (1636-1637): Undeclared identifier. +// DeclarationError 7576: (1647-1648): Undeclared identifier. +// DeclarationError 7576: (1658-1659): Undeclared identifier. +// DeclarationError 7576: (1669-1670): Undeclared identifier. +// DeclarationError 7576: (1680-1681): Undeclared identifier. +// DeclarationError 7576: (1691-1692): Undeclared identifier. +// DeclarationError 7576: (1702-1703): Undeclared identifier. +// DeclarationError 7576: (1713-1714): Undeclared identifier. +// DeclarationError 7576: (1724-1725): Undeclared identifier. +// DeclarationError 7576: (1735-1736): Undeclared identifier. +// DeclarationError 7576: (1746-1747): Undeclared identifier. +// DeclarationError 7576: (1757-1758): Undeclared identifier. +// DeclarationError 7576: (1768-1769): Undeclared identifier. +// DeclarationError 7576: (1779-1780): Undeclared identifier. +// DeclarationError 7576: (1790-1791): Undeclared identifier. +// DeclarationError 7576: (1801-1802): Undeclared identifier. +// DeclarationError 7576: (1812-1813): Undeclared identifier. +// DeclarationError 7576: (1823-1824): Undeclared identifier. +// DeclarationError 7576: (1834-1835): Undeclared identifier. +// DeclarationError 7576: (1845-1846): Undeclared identifier. +// DeclarationError 7576: (1856-1857): Undeclared identifier. +// DeclarationError 7576: (1867-1868): Undeclared identifier. +// DeclarationError 7576: (1878-1879): Undeclared identifier. +// DeclarationError 7576: (1889-1890): Undeclared identifier. +// DeclarationError 7576: (1900-1901): Undeclared identifier. +// DeclarationError 7576: (1911-1912): Undeclared identifier. +// DeclarationError 7576: (1922-1923): Undeclared identifier. +// DeclarationError 7576: (1933-1934): Undeclared identifier. +// DeclarationError 7576: (1944-1945): Undeclared identifier. +// DeclarationError 7576: (1955-1956): Undeclared identifier. +// DeclarationError 7576: (1966-1967): Undeclared identifier. +// DeclarationError 7576: (1977-1978): Undeclared identifier. +// DeclarationError 7576: (1988-1989): Undeclared identifier. +// DeclarationError 7576: (1999-2000): Undeclared identifier. +// DeclarationError 7576: (2010-2011): Undeclared identifier. +// DeclarationError 7576: (2021-2022): Undeclared identifier. +// DeclarationError 7576: (2032-2033): Undeclared identifier. +// DeclarationError 7576: (2043-2044): Undeclared identifier. +// DeclarationError 7576: (2054-2055): Undeclared identifier. +// DeclarationError 7576: (2065-2066): Undeclared identifier. +// DeclarationError 7576: (2076-2077): Undeclared identifier. +// DeclarationError 7576: (2087-2088): Undeclared identifier. +// DeclarationError 7576: (2098-2099): Undeclared identifier. +// DeclarationError 7576: (2109-2110): Undeclared identifier. +// DeclarationError 7576: (2120-2121): Undeclared identifier. +// DeclarationError 7576: (2131-2132): Undeclared identifier. +// DeclarationError 7576: (2142-2143): Undeclared identifier. +// DeclarationError 7576: (2153-2154): Undeclared identifier. +// DeclarationError 7576: (2164-2165): Undeclared identifier. +// DeclarationError 7576: (2175-2176): Undeclared identifier. +// DeclarationError 7576: (2186-2187): Undeclared identifier. +// DeclarationError 7576: (2197-2198): Undeclared identifier. +// DeclarationError 7576: (2208-2209): Undeclared identifier. +// DeclarationError 7576: (2219-2220): Undeclared identifier. +// DeclarationError 7576: (2230-2231): Undeclared identifier. +// DeclarationError 7576: (2241-2242): Undeclared identifier. +// DeclarationError 7576: (2252-2253): Undeclared identifier. +// DeclarationError 7576: (2263-2264): Undeclared identifier. +// DeclarationError 7576: (2274-2275): Undeclared identifier. +// DeclarationError 7576: (2285-2286): Undeclared identifier. +// DeclarationError 7576: (2296-2297): Undeclared identifier. +// DeclarationError 7576: (2307-2308): Undeclared identifier. +// DeclarationError 7576: (2318-2319): Undeclared identifier. +// DeclarationError 7576: (2329-2330): Undeclared identifier. +// DeclarationError 7576: (2340-2341): Undeclared identifier. +// DeclarationError 7576: (2351-2352): Undeclared identifier. +// DeclarationError 7576: (2362-2363): Undeclared identifier. +// DeclarationError 7576: (2373-2374): Undeclared identifier. +// DeclarationError 7576: (2384-2385): Undeclared identifier. +// DeclarationError 7576: (2395-2396): Undeclared identifier. +// DeclarationError 7576: (2406-2407): Undeclared identifier. +// DeclarationError 7576: (2417-2418): Undeclared identifier. +// DeclarationError 7576: (2428-2429): Undeclared identifier. +// DeclarationError 7576: (2439-2440): Undeclared identifier. +// DeclarationError 7576: (2450-2451): Undeclared identifier. +// DeclarationError 7576: (2461-2462): Undeclared identifier. +// DeclarationError 7576: (2472-2473): Undeclared identifier. +// DeclarationError 7576: (2483-2484): Undeclared identifier. +// DeclarationError 7576: (2494-2495): Undeclared identifier. +// DeclarationError 7576: (2505-2506): Undeclared identifier. +// DeclarationError 7576: (2516-2517): Undeclared identifier. +// DeclarationError 7576: (2527-2528): Undeclared identifier. +// DeclarationError 7576: (2538-2539): Undeclared identifier. +// DeclarationError 7576: (2549-2550): Undeclared identifier. +// DeclarationError 7576: (2560-2561): Undeclared identifier. +// DeclarationError 7576: (2571-2572): Undeclared identifier. +// DeclarationError 7576: (2582-2583): Undeclared identifier. +// DeclarationError 7576: (2593-2594): Undeclared identifier. +// DeclarationError 7576: (2604-2605): Undeclared identifier. +// DeclarationError 7576: (2615-2616): Undeclared identifier. +// DeclarationError 7576: (2626-2627): Undeclared identifier. +// DeclarationError 7576: (2637-2638): Undeclared identifier. +// DeclarationError 7576: (2648-2649): Undeclared identifier. +// DeclarationError 7576: (2659-2660): Undeclared identifier. +// DeclarationError 7576: (2670-2671): Undeclared identifier. +// DeclarationError 7576: (2681-2682): Undeclared identifier. +// DeclarationError 7576: (2692-2693): Undeclared identifier. +// DeclarationError 7576: (2703-2704): Undeclared identifier. +// DeclarationError 7576: (2714-2715): Undeclared identifier. +// DeclarationError 7576: (2725-2726): Undeclared identifier. +// DeclarationError 7576: (2736-2737): Undeclared identifier. +// DeclarationError 7576: (2747-2748): Undeclared identifier. +// DeclarationError 7576: (2758-2759): Undeclared identifier. +// DeclarationError 7576: (2769-2770): Undeclared identifier. +// DeclarationError 7576: (2780-2781): Undeclared identifier. +// DeclarationError 7576: (2791-2792): Undeclared identifier. +// DeclarationError 7576: (2802-2803): Undeclared identifier. +// DeclarationError 7576: (2813-2814): Undeclared identifier. +// DeclarationError 7576: (2824-2825): Undeclared identifier. +// DeclarationError 7576: (2835-2836): Undeclared identifier. +// DeclarationError 7576: (2846-2847): Undeclared identifier. +// Warning 4013: There are more than 256 errors. Aborting. diff --git a/test/libsolidity/syntaxTests/more_than_256_importerrors.sol b/test/libsolidity/syntaxTests/more_than_256_importerrors.sol index ed6e085f622e..d4a4121194e2 100644 --- a/test/libsolidity/syntaxTests/more_than_256_importerrors.sol +++ b/test/libsolidity/syntaxTests/more_than_256_importerrors.sol @@ -262,260 +262,260 @@ contract C { } } // ---- -// ParserError: (0-15): Source "a.sol" not found: File not supplied initially. -// ParserError: (16-31): Source "a.sol" not found: File not supplied initially. -// ParserError: (32-47): Source "a.sol" not found: File not supplied initially. -// ParserError: (48-63): Source "a.sol" not found: File not supplied initially. -// ParserError: (64-79): Source "a.sol" not found: File not supplied initially. -// ParserError: (80-95): Source "a.sol" not found: File not supplied initially. -// ParserError: (96-111): Source "a.sol" not found: File not supplied initially. -// ParserError: (112-127): Source "a.sol" not found: File not supplied initially. -// ParserError: (128-143): Source "a.sol" not found: File not supplied initially. -// ParserError: (144-159): Source "a.sol" not found: File not supplied initially. -// ParserError: (160-175): Source "a.sol" not found: File not supplied initially. -// ParserError: (176-191): Source "a.sol" not found: File not supplied initially. -// ParserError: (192-207): Source "a.sol" not found: File not supplied initially. -// ParserError: (208-223): Source "a.sol" not found: File not supplied initially. -// ParserError: (224-239): Source "a.sol" not found: File not supplied initially. -// ParserError: (240-255): Source "a.sol" not found: File not supplied initially. -// ParserError: (256-271): Source "a.sol" not found: File not supplied initially. -// ParserError: (272-287): Source "a.sol" not found: File not supplied initially. -// ParserError: (288-303): Source "a.sol" not found: File not supplied initially. -// ParserError: (304-319): Source "a.sol" not found: File not supplied initially. -// ParserError: (320-335): Source "a.sol" not found: File not supplied initially. -// ParserError: (336-351): Source "a.sol" not found: File not supplied initially. -// ParserError: (352-367): Source "a.sol" not found: File not supplied initially. -// ParserError: (368-383): Source "a.sol" not found: File not supplied initially. -// ParserError: (384-399): Source "a.sol" not found: File not supplied initially. -// ParserError: (400-415): Source "a.sol" not found: File not supplied initially. -// ParserError: (416-431): Source "a.sol" not found: File not supplied initially. -// ParserError: (432-447): Source "a.sol" not found: File not supplied initially. -// ParserError: (448-463): Source "a.sol" not found: File not supplied initially. -// ParserError: (464-479): Source "a.sol" not found: File not supplied initially. -// ParserError: (480-495): Source "a.sol" not found: File not supplied initially. -// ParserError: (496-511): Source "a.sol" not found: File not supplied initially. -// ParserError: (512-527): Source "a.sol" not found: File not supplied initially. -// ParserError: (528-543): Source "a.sol" not found: File not supplied initially. -// ParserError: (544-559): Source "a.sol" not found: File not supplied initially. -// ParserError: (560-575): Source "a.sol" not found: File not supplied initially. -// ParserError: (576-591): Source "a.sol" not found: File not supplied initially. -// ParserError: (592-607): Source "a.sol" not found: File not supplied initially. -// ParserError: (608-623): Source "a.sol" not found: File not supplied initially. -// ParserError: (624-639): Source "a.sol" not found: File not supplied initially. -// ParserError: (640-655): Source "a.sol" not found: File not supplied initially. -// ParserError: (656-671): Source "a.sol" not found: File not supplied initially. -// ParserError: (672-687): Source "a.sol" not found: File not supplied initially. -// ParserError: (688-703): Source "a.sol" not found: File not supplied initially. -// ParserError: (704-719): Source "a.sol" not found: File not supplied initially. -// ParserError: (720-735): Source "a.sol" not found: File not supplied initially. -// ParserError: (736-751): Source "a.sol" not found: File not supplied initially. -// ParserError: (752-767): Source "a.sol" not found: File not supplied initially. -// ParserError: (768-783): Source "a.sol" not found: File not supplied initially. -// ParserError: (784-799): Source "a.sol" not found: File not supplied initially. -// ParserError: (800-815): Source "a.sol" not found: File not supplied initially. -// ParserError: (816-831): Source "a.sol" not found: File not supplied initially. -// ParserError: (832-847): Source "a.sol" not found: File not supplied initially. -// ParserError: (848-863): Source "a.sol" not found: File not supplied initially. -// ParserError: (864-879): Source "a.sol" not found: File not supplied initially. -// ParserError: (880-895): Source "a.sol" not found: File not supplied initially. -// ParserError: (896-911): Source "a.sol" not found: File not supplied initially. -// ParserError: (912-927): Source "a.sol" not found: File not supplied initially. -// ParserError: (928-943): Source "a.sol" not found: File not supplied initially. -// ParserError: (944-959): Source "a.sol" not found: File not supplied initially. -// ParserError: (960-975): Source "a.sol" not found: File not supplied initially. -// ParserError: (976-991): Source "a.sol" not found: File not supplied initially. -// ParserError: (992-1007): Source "a.sol" not found: File not supplied initially. -// ParserError: (1008-1023): Source "a.sol" not found: File not supplied initially. -// ParserError: (1024-1039): Source "a.sol" not found: File not supplied initially. -// ParserError: (1040-1055): Source "a.sol" not found: File not supplied initially. -// ParserError: (1056-1071): Source "a.sol" not found: File not supplied initially. -// ParserError: (1072-1087): Source "a.sol" not found: File not supplied initially. -// ParserError: (1088-1103): Source "a.sol" not found: File not supplied initially. -// ParserError: (1104-1119): Source "a.sol" not found: File not supplied initially. -// ParserError: (1120-1135): Source "a.sol" not found: File not supplied initially. -// ParserError: (1136-1151): Source "a.sol" not found: File not supplied initially. -// ParserError: (1152-1167): Source "a.sol" not found: File not supplied initially. -// ParserError: (1168-1183): Source "a.sol" not found: File not supplied initially. -// ParserError: (1184-1199): Source "a.sol" not found: File not supplied initially. -// ParserError: (1200-1215): Source "a.sol" not found: File not supplied initially. -// ParserError: (1216-1231): Source "a.sol" not found: File not supplied initially. -// ParserError: (1232-1247): Source "a.sol" not found: File not supplied initially. -// ParserError: (1248-1263): Source "a.sol" not found: File not supplied initially. -// ParserError: (1264-1279): Source "a.sol" not found: File not supplied initially. -// ParserError: (1280-1295): Source "a.sol" not found: File not supplied initially. -// ParserError: (1296-1311): Source "a.sol" not found: File not supplied initially. -// ParserError: (1312-1327): Source "a.sol" not found: File not supplied initially. -// ParserError: (1328-1343): Source "a.sol" not found: File not supplied initially. -// ParserError: (1344-1359): Source "a.sol" not found: File not supplied initially. -// ParserError: (1360-1375): Source "a.sol" not found: File not supplied initially. -// ParserError: (1376-1391): Source "a.sol" not found: File not supplied initially. -// ParserError: (1392-1407): Source "a.sol" not found: File not supplied initially. -// ParserError: (1408-1423): Source "a.sol" not found: File not supplied initially. -// ParserError: (1424-1439): Source "a.sol" not found: File not supplied initially. -// ParserError: (1440-1455): Source "a.sol" not found: File not supplied initially. -// ParserError: (1456-1471): Source "a.sol" not found: File not supplied initially. -// ParserError: (1472-1487): Source "a.sol" not found: File not supplied initially. -// ParserError: (1488-1503): Source "a.sol" not found: File not supplied initially. -// ParserError: (1504-1519): Source "a.sol" not found: File not supplied initially. -// ParserError: (1520-1535): Source "a.sol" not found: File not supplied initially. -// ParserError: (1536-1551): Source "a.sol" not found: File not supplied initially. -// ParserError: (1552-1567): Source "a.sol" not found: File not supplied initially. -// ParserError: (1568-1583): Source "a.sol" not found: File not supplied initially. -// ParserError: (1584-1599): Source "a.sol" not found: File not supplied initially. -// ParserError: (1600-1615): Source "a.sol" not found: File not supplied initially. -// ParserError: (1616-1631): Source "a.sol" not found: File not supplied initially. -// ParserError: (1632-1647): Source "a.sol" not found: File not supplied initially. -// ParserError: (1648-1663): Source "a.sol" not found: File not supplied initially. -// ParserError: (1664-1679): Source "a.sol" not found: File not supplied initially. -// ParserError: (1680-1695): Source "a.sol" not found: File not supplied initially. -// ParserError: (1696-1711): Source "a.sol" not found: File not supplied initially. -// ParserError: (1712-1727): Source "a.sol" not found: File not supplied initially. -// ParserError: (1728-1743): Source "a.sol" not found: File not supplied initially. -// ParserError: (1744-1759): Source "a.sol" not found: File not supplied initially. -// ParserError: (1760-1775): Source "a.sol" not found: File not supplied initially. -// ParserError: (1776-1791): Source "a.sol" not found: File not supplied initially. -// ParserError: (1792-1807): Source "a.sol" not found: File not supplied initially. -// ParserError: (1808-1823): Source "a.sol" not found: File not supplied initially. -// ParserError: (1824-1839): Source "a.sol" not found: File not supplied initially. -// ParserError: (1840-1855): Source "a.sol" not found: File not supplied initially. -// ParserError: (1856-1871): Source "a.sol" not found: File not supplied initially. -// ParserError: (1872-1887): Source "a.sol" not found: File not supplied initially. -// ParserError: (1888-1903): Source "a.sol" not found: File not supplied initially. -// ParserError: (1904-1919): Source "a.sol" not found: File not supplied initially. -// ParserError: (1920-1935): Source "a.sol" not found: File not supplied initially. -// ParserError: (1936-1951): Source "a.sol" not found: File not supplied initially. -// ParserError: (1952-1967): Source "a.sol" not found: File not supplied initially. -// ParserError: (1968-1983): Source "a.sol" not found: File not supplied initially. -// ParserError: (1984-1999): Source "a.sol" not found: File not supplied initially. -// ParserError: (2000-2015): Source "a.sol" not found: File not supplied initially. -// ParserError: (2016-2031): Source "a.sol" not found: File not supplied initially. -// ParserError: (2032-2047): Source "a.sol" not found: File not supplied initially. -// ParserError: (2048-2063): Source "a.sol" not found: File not supplied initially. -// ParserError: (2064-2079): Source "a.sol" not found: File not supplied initially. -// ParserError: (2080-2095): Source "a.sol" not found: File not supplied initially. -// ParserError: (2096-2111): Source "a.sol" not found: File not supplied initially. -// ParserError: (2112-2127): Source "a.sol" not found: File not supplied initially. -// ParserError: (2128-2143): Source "a.sol" not found: File not supplied initially. -// ParserError: (2144-2159): Source "a.sol" not found: File not supplied initially. -// ParserError: (2160-2175): Source "a.sol" not found: File not supplied initially. -// ParserError: (2176-2191): Source "a.sol" not found: File not supplied initially. -// ParserError: (2192-2207): Source "a.sol" not found: File not supplied initially. -// ParserError: (2208-2223): Source "a.sol" not found: File not supplied initially. -// ParserError: (2224-2239): Source "a.sol" not found: File not supplied initially. -// ParserError: (2240-2255): Source "a.sol" not found: File not supplied initially. -// ParserError: (2256-2271): Source "a.sol" not found: File not supplied initially. -// ParserError: (2272-2287): Source "a.sol" not found: File not supplied initially. -// ParserError: (2288-2303): Source "a.sol" not found: File not supplied initially. -// ParserError: (2304-2319): Source "a.sol" not found: File not supplied initially. -// ParserError: (2320-2335): Source "a.sol" not found: File not supplied initially. -// ParserError: (2336-2351): Source "a.sol" not found: File not supplied initially. -// ParserError: (2352-2367): Source "a.sol" not found: File not supplied initially. -// ParserError: (2368-2383): Source "a.sol" not found: File not supplied initially. -// ParserError: (2384-2399): Source "a.sol" not found: File not supplied initially. -// ParserError: (2400-2415): Source "a.sol" not found: File not supplied initially. -// ParserError: (2416-2431): Source "a.sol" not found: File not supplied initially. -// ParserError: (2432-2447): Source "a.sol" not found: File not supplied initially. -// ParserError: (2448-2463): Source "a.sol" not found: File not supplied initially. -// ParserError: (2464-2479): Source "a.sol" not found: File not supplied initially. -// ParserError: (2480-2495): Source "a.sol" not found: File not supplied initially. -// ParserError: (2496-2511): Source "a.sol" not found: File not supplied initially. -// ParserError: (2512-2527): Source "a.sol" not found: File not supplied initially. -// ParserError: (2528-2543): Source "a.sol" not found: File not supplied initially. -// ParserError: (2544-2559): Source "a.sol" not found: File not supplied initially. -// ParserError: (2560-2575): Source "a.sol" not found: File not supplied initially. -// ParserError: (2576-2591): Source "a.sol" not found: File not supplied initially. -// ParserError: (2592-2607): Source "a.sol" not found: File not supplied initially. -// ParserError: (2608-2623): Source "a.sol" not found: File not supplied initially. -// ParserError: (2624-2639): Source "a.sol" not found: File not supplied initially. -// ParserError: (2640-2655): Source "a.sol" not found: File not supplied initially. -// ParserError: (2656-2671): Source "a.sol" not found: File not supplied initially. -// ParserError: (2672-2687): Source "a.sol" not found: File not supplied initially. -// ParserError: (2688-2703): Source "a.sol" not found: File not supplied initially. -// ParserError: (2704-2719): Source "a.sol" not found: File not supplied initially. -// ParserError: (2720-2735): Source "a.sol" not found: File not supplied initially. -// ParserError: (2736-2751): Source "a.sol" not found: File not supplied initially. -// ParserError: (2752-2767): Source "a.sol" not found: File not supplied initially. -// ParserError: (2768-2783): Source "a.sol" not found: File not supplied initially. -// ParserError: (2784-2799): Source "a.sol" not found: File not supplied initially. -// ParserError: (2800-2815): Source "a.sol" not found: File not supplied initially. -// ParserError: (2816-2831): Source "a.sol" not found: File not supplied initially. -// ParserError: (2832-2847): Source "a.sol" not found: File not supplied initially. -// ParserError: (2848-2863): Source "a.sol" not found: File not supplied initially. -// ParserError: (2864-2879): Source "a.sol" not found: File not supplied initially. -// ParserError: (2880-2895): Source "a.sol" not found: File not supplied initially. -// ParserError: (2896-2911): Source "a.sol" not found: File not supplied initially. -// ParserError: (2912-2927): Source "a.sol" not found: File not supplied initially. -// ParserError: (2928-2943): Source "a.sol" not found: File not supplied initially. -// ParserError: (2944-2959): Source "a.sol" not found: File not supplied initially. -// ParserError: (2960-2975): Source "a.sol" not found: File not supplied initially. -// ParserError: (2976-2991): Source "a.sol" not found: File not supplied initially. -// ParserError: (2992-3007): Source "a.sol" not found: File not supplied initially. -// ParserError: (3008-3023): Source "a.sol" not found: File not supplied initially. -// ParserError: (3024-3039): Source "a.sol" not found: File not supplied initially. -// ParserError: (3040-3055): Source "a.sol" not found: File not supplied initially. -// ParserError: (3056-3071): Source "a.sol" not found: File not supplied initially. -// ParserError: (3072-3087): Source "a.sol" not found: File not supplied initially. -// ParserError: (3088-3103): Source "a.sol" not found: File not supplied initially. -// ParserError: (3104-3119): Source "a.sol" not found: File not supplied initially. -// ParserError: (3120-3135): Source "a.sol" not found: File not supplied initially. -// ParserError: (3136-3151): Source "a.sol" not found: File not supplied initially. -// ParserError: (3152-3167): Source "a.sol" not found: File not supplied initially. -// ParserError: (3168-3183): Source "a.sol" not found: File not supplied initially. -// ParserError: (3184-3199): Source "a.sol" not found: File not supplied initially. -// ParserError: (3200-3215): Source "a.sol" not found: File not supplied initially. -// ParserError: (3216-3231): Source "a.sol" not found: File not supplied initially. -// ParserError: (3232-3247): Source "a.sol" not found: File not supplied initially. -// ParserError: (3248-3263): Source "a.sol" not found: File not supplied initially. -// ParserError: (3264-3279): Source "a.sol" not found: File not supplied initially. -// ParserError: (3280-3295): Source "a.sol" not found: File not supplied initially. -// ParserError: (3296-3311): Source "a.sol" not found: File not supplied initially. -// ParserError: (3312-3327): Source "a.sol" not found: File not supplied initially. -// ParserError: (3328-3343): Source "a.sol" not found: File not supplied initially. -// ParserError: (3344-3359): Source "a.sol" not found: File not supplied initially. -// ParserError: (3360-3375): Source "a.sol" not found: File not supplied initially. -// ParserError: (3376-3391): Source "a.sol" not found: File not supplied initially. -// ParserError: (3392-3407): Source "a.sol" not found: File not supplied initially. -// ParserError: (3408-3423): Source "a.sol" not found: File not supplied initially. -// ParserError: (3424-3439): Source "a.sol" not found: File not supplied initially. -// ParserError: (3440-3455): Source "a.sol" not found: File not supplied initially. -// ParserError: (3456-3471): Source "a.sol" not found: File not supplied initially. -// ParserError: (3472-3487): Source "a.sol" not found: File not supplied initially. -// ParserError: (3488-3503): Source "a.sol" not found: File not supplied initially. -// ParserError: (3504-3519): Source "a.sol" not found: File not supplied initially. -// ParserError: (3520-3535): Source "a.sol" not found: File not supplied initially. -// ParserError: (3536-3551): Source "a.sol" not found: File not supplied initially. -// ParserError: (3552-3567): Source "a.sol" not found: File not supplied initially. -// ParserError: (3568-3583): Source "a.sol" not found: File not supplied initially. -// ParserError: (3584-3599): Source "a.sol" not found: File not supplied initially. -// ParserError: (3600-3615): Source "a.sol" not found: File not supplied initially. -// ParserError: (3616-3631): Source "a.sol" not found: File not supplied initially. -// ParserError: (3632-3647): Source "a.sol" not found: File not supplied initially. -// ParserError: (3648-3663): Source "a.sol" not found: File not supplied initially. -// ParserError: (3664-3679): Source "a.sol" not found: File not supplied initially. -// ParserError: (3680-3695): Source "a.sol" not found: File not supplied initially. -// ParserError: (3696-3711): Source "a.sol" not found: File not supplied initially. -// ParserError: (3712-3727): Source "a.sol" not found: File not supplied initially. -// ParserError: (3728-3743): Source "a.sol" not found: File not supplied initially. -// ParserError: (3744-3759): Source "a.sol" not found: File not supplied initially. -// ParserError: (3760-3775): Source "a.sol" not found: File not supplied initially. -// ParserError: (3776-3791): Source "a.sol" not found: File not supplied initially. -// ParserError: (3792-3807): Source "a.sol" not found: File not supplied initially. -// ParserError: (3808-3823): Source "a.sol" not found: File not supplied initially. -// ParserError: (3824-3839): Source "a.sol" not found: File not supplied initially. -// ParserError: (3840-3855): Source "a.sol" not found: File not supplied initially. -// ParserError: (3856-3871): Source "a.sol" not found: File not supplied initially. -// ParserError: (3872-3887): Source "a.sol" not found: File not supplied initially. -// ParserError: (3888-3903): Source "a.sol" not found: File not supplied initially. -// ParserError: (3904-3919): Source "a.sol" not found: File not supplied initially. -// ParserError: (3920-3935): Source "a.sol" not found: File not supplied initially. -// ParserError: (3936-3951): Source "a.sol" not found: File not supplied initially. -// ParserError: (3952-3967): Source "a.sol" not found: File not supplied initially. -// ParserError: (3968-3983): Source "a.sol" not found: File not supplied initially. -// ParserError: (3984-3999): Source "a.sol" not found: File not supplied initially. -// ParserError: (4000-4015): Source "a.sol" not found: File not supplied initially. -// ParserError: (4016-4031): Source "a.sol" not found: File not supplied initially. -// ParserError: (4032-4047): Source "a.sol" not found: File not supplied initially. -// ParserError: (4048-4063): Source "a.sol" not found: File not supplied initially. -// ParserError: (4064-4079): Source "a.sol" not found: File not supplied initially. -// ParserError: (4080-4095): Source "a.sol" not found: File not supplied initially. -// Warning: There are more than 256 errors. Aborting. +// ParserError 6275: (0-15): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (16-31): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (32-47): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (48-63): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (64-79): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (80-95): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (96-111): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (112-127): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (128-143): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (144-159): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (160-175): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (176-191): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (192-207): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (208-223): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (224-239): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (240-255): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (256-271): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (272-287): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (288-303): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (304-319): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (320-335): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (336-351): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (352-367): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (368-383): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (384-399): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (400-415): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (416-431): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (432-447): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (448-463): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (464-479): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (480-495): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (496-511): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (512-527): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (528-543): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (544-559): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (560-575): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (576-591): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (592-607): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (608-623): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (624-639): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (640-655): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (656-671): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (672-687): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (688-703): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (704-719): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (720-735): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (736-751): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (752-767): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (768-783): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (784-799): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (800-815): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (816-831): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (832-847): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (848-863): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (864-879): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (880-895): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (896-911): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (912-927): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (928-943): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (944-959): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (960-975): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (976-991): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (992-1007): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1008-1023): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1024-1039): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1040-1055): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1056-1071): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1072-1087): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1088-1103): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1104-1119): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1120-1135): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1136-1151): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1152-1167): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1168-1183): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1184-1199): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1200-1215): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1216-1231): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1232-1247): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1248-1263): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1264-1279): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1280-1295): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1296-1311): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1312-1327): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1328-1343): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1344-1359): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1360-1375): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1376-1391): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1392-1407): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1408-1423): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1424-1439): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1440-1455): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1456-1471): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1472-1487): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1488-1503): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1504-1519): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1520-1535): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1536-1551): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1552-1567): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1568-1583): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1584-1599): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1600-1615): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1616-1631): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1632-1647): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1648-1663): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1664-1679): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1680-1695): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1696-1711): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1712-1727): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1728-1743): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1744-1759): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1760-1775): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1776-1791): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1792-1807): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1808-1823): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1824-1839): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1840-1855): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1856-1871): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1872-1887): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1888-1903): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1904-1919): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1920-1935): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1936-1951): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1952-1967): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1968-1983): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (1984-1999): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2000-2015): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2016-2031): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2032-2047): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2048-2063): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2064-2079): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2080-2095): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2096-2111): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2112-2127): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2128-2143): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2144-2159): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2160-2175): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2176-2191): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2192-2207): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2208-2223): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2224-2239): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2240-2255): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2256-2271): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2272-2287): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2288-2303): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2304-2319): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2320-2335): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2336-2351): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2352-2367): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2368-2383): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2384-2399): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2400-2415): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2416-2431): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2432-2447): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2448-2463): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2464-2479): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2480-2495): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2496-2511): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2512-2527): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2528-2543): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2544-2559): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2560-2575): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2576-2591): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2592-2607): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2608-2623): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2624-2639): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2640-2655): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2656-2671): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2672-2687): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2688-2703): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2704-2719): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2720-2735): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2736-2751): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2752-2767): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2768-2783): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2784-2799): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2800-2815): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2816-2831): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2832-2847): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2848-2863): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2864-2879): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2880-2895): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2896-2911): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2912-2927): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2928-2943): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2944-2959): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2960-2975): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2976-2991): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (2992-3007): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3008-3023): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3024-3039): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3040-3055): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3056-3071): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3072-3087): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3088-3103): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3104-3119): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3120-3135): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3136-3151): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3152-3167): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3168-3183): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3184-3199): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3200-3215): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3216-3231): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3232-3247): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3248-3263): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3264-3279): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3280-3295): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3296-3311): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3312-3327): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3328-3343): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3344-3359): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3360-3375): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3376-3391): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3392-3407): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3408-3423): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3424-3439): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3440-3455): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3456-3471): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3472-3487): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3488-3503): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3504-3519): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3520-3535): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3536-3551): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3552-3567): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3568-3583): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3584-3599): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3600-3615): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3616-3631): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3632-3647): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3648-3663): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3664-3679): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3680-3695): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3696-3711): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3712-3727): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3728-3743): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3744-3759): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3760-3775): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3776-3791): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3792-3807): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3808-3823): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3824-3839): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3840-3855): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3856-3871): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3872-3887): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3888-3903): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3904-3919): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3920-3935): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3936-3951): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3952-3967): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3968-3983): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (3984-3999): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4000-4015): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4016-4031): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4032-4047): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4048-4063): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4064-4079): Source "a.sol" not found: File not supplied initially. +// ParserError 6275: (4080-4095): Source "a.sol" not found: File not supplied initially. +// Warning 4013: There are more than 256 errors. Aborting. diff --git a/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol index fe877396b071..b3b5691210e1 100644 --- a/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol +++ b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol @@ -265,260 +265,260 @@ contract C { } } // ---- -// SyntaxError: (41-49): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (55-63): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (69-77): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (83-91): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (97-105): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (111-119): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (125-133): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (139-147): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (153-161): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (167-175): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (181-189): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (195-203): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (209-217): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (223-231): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (237-245): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (251-259): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (265-273): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (279-287): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (293-301): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (307-315): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (321-329): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (335-343): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (349-357): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (363-371): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (377-385): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (391-399): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (405-413): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (419-427): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (433-441): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (447-455): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (461-469): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (475-483): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (489-497): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (503-511): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (517-525): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (531-539): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (545-553): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (559-567): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (573-581): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (587-595): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (601-609): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (615-623): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (629-637): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (643-651): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (657-665): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (671-679): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (685-693): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (699-707): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (713-721): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (727-735): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (741-749): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (755-763): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (769-777): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (783-791): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (797-805): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (811-819): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (825-833): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (839-847): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (853-861): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (867-875): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (881-889): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (895-903): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (909-917): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (923-931): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (937-945): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (951-959): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (965-973): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (979-987): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (993-1001): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1007-1015): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1021-1029): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1035-1043): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1049-1057): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1063-1071): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1077-1085): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1091-1099): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1105-1113): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1119-1127): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1133-1141): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1147-1155): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1161-1169): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1175-1183): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1189-1197): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1203-1211): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1217-1225): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1231-1239): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1245-1253): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1259-1267): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1273-1281): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1287-1295): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1301-1309): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1315-1323): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1329-1337): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1343-1351): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1357-1365): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1371-1379): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1385-1393): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1399-1407): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1413-1421): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1427-1435): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1441-1449): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1455-1463): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1469-1477): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1483-1491): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1497-1505): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1511-1519): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1525-1533): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1539-1547): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1553-1561): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1567-1575): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1581-1589): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1595-1603): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1609-1617): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1623-1631): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1637-1645): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1651-1659): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1665-1673): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1679-1687): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1693-1701): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1707-1715): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1721-1729): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1735-1743): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1749-1757): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1763-1771): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1777-1785): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1791-1799): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1805-1813): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1819-1827): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1833-1841): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1847-1855): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1861-1869): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1875-1883): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1889-1897): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1903-1911): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1917-1925): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1931-1939): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1945-1953): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1959-1967): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1973-1981): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (1987-1995): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2001-2009): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2015-2023): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2029-2037): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2043-2051): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2057-2065): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2071-2079): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2085-2093): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2099-2107): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2113-2121): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2127-2135): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2141-2149): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2155-2163): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2169-2177): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2183-2191): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2197-2205): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2211-2219): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2225-2233): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2239-2247): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2253-2261): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2267-2275): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2281-2289): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2295-2303): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2309-2317): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2323-2331): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2337-2345): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2351-2359): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2365-2373): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2379-2387): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2393-2401): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2407-2415): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2421-2429): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2435-2443): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2449-2457): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2463-2471): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2477-2485): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2491-2499): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2505-2513): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2519-2527): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2533-2541): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2547-2555): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2561-2569): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2575-2583): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2589-2597): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2603-2611): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2617-2625): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2631-2639): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2645-2653): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2659-2667): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2673-2681): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2687-2695): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2701-2709): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2715-2723): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2729-2737): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2743-2751): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2757-2765): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2771-2779): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2785-2793): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2799-2807): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2813-2821): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2827-2835): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2841-2849): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2855-2863): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2869-2877): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2883-2891): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2897-2905): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2911-2919): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2925-2933): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2939-2947): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2953-2961): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2967-2975): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2981-2989): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (2995-3003): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3009-3017): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3023-3031): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3037-3045): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3051-3059): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3065-3073): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3079-3087): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3093-3101): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3107-3115): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3121-3129): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3135-3143): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3149-3157): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3163-3171): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3177-3185): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3191-3199): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3205-3213): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3219-3227): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3233-3241): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3247-3255): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3261-3269): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3275-3283): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3289-3297): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3303-3311): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3317-3325): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3331-3339): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3345-3353): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3359-3367): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3373-3381): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3387-3395): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3401-3409): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3415-3423): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3429-3437): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3443-3451): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3457-3465): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3471-3479): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3485-3493): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3499-3507): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3513-3521): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3527-3535): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3541-3549): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3555-3563): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3569-3577): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3583-3591): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3597-3605): "continue" has to be in a "for" or "while" loop. -// SyntaxError: (3611-3619): "continue" has to be in a "for" or "while" loop. -// Warning: There are more than 256 errors. Aborting. +// SyntaxError 4123: (41-49): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (55-63): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (69-77): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (83-91): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (97-105): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (111-119): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (125-133): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (139-147): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (153-161): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (167-175): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (181-189): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (195-203): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (209-217): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (223-231): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (237-245): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (251-259): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (265-273): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (279-287): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (293-301): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (307-315): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (321-329): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (335-343): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (349-357): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (363-371): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (377-385): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (391-399): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (405-413): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (419-427): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (433-441): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (447-455): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (461-469): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (475-483): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (489-497): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (503-511): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (517-525): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (531-539): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (545-553): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (559-567): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (573-581): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (587-595): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (601-609): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (615-623): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (629-637): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (643-651): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (657-665): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (671-679): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (685-693): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (699-707): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (713-721): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (727-735): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (741-749): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (755-763): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (769-777): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (783-791): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (797-805): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (811-819): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (825-833): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (839-847): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (853-861): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (867-875): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (881-889): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (895-903): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (909-917): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (923-931): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (937-945): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (951-959): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (965-973): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (979-987): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (993-1001): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1007-1015): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1021-1029): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1035-1043): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1049-1057): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1063-1071): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1077-1085): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1091-1099): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1105-1113): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1119-1127): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1133-1141): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1147-1155): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1161-1169): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1175-1183): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1189-1197): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1203-1211): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1217-1225): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1231-1239): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1245-1253): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1259-1267): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1273-1281): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1287-1295): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1301-1309): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1315-1323): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1329-1337): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1343-1351): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1357-1365): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1371-1379): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1385-1393): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1399-1407): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1413-1421): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1427-1435): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1441-1449): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1455-1463): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1469-1477): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1483-1491): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1497-1505): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1511-1519): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1525-1533): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1539-1547): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1553-1561): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1567-1575): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1581-1589): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1595-1603): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1609-1617): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1623-1631): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1637-1645): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1651-1659): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1665-1673): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1679-1687): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1693-1701): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1707-1715): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1721-1729): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1735-1743): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1749-1757): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1763-1771): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1777-1785): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1791-1799): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1805-1813): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1819-1827): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1833-1841): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1847-1855): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1861-1869): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1875-1883): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1889-1897): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1903-1911): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1917-1925): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1931-1939): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1945-1953): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1959-1967): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1973-1981): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (1987-1995): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2001-2009): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2015-2023): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2029-2037): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2043-2051): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2057-2065): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2071-2079): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2085-2093): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2099-2107): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2113-2121): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2127-2135): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2141-2149): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2155-2163): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2169-2177): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2183-2191): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2197-2205): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2211-2219): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2225-2233): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2239-2247): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2253-2261): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2267-2275): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2281-2289): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2295-2303): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2309-2317): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2323-2331): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2337-2345): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2351-2359): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2365-2373): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2379-2387): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2393-2401): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2407-2415): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2421-2429): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2435-2443): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2449-2457): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2463-2471): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2477-2485): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2491-2499): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2505-2513): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2519-2527): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2533-2541): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2547-2555): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2561-2569): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2575-2583): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2589-2597): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2603-2611): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2617-2625): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2631-2639): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2645-2653): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2659-2667): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2673-2681): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2687-2695): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2701-2709): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2715-2723): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2729-2737): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2743-2751): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2757-2765): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2771-2779): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2785-2793): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2799-2807): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2813-2821): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2827-2835): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2841-2849): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2855-2863): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2869-2877): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2883-2891): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2897-2905): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2911-2919): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2925-2933): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2939-2947): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2953-2961): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2967-2975): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2981-2989): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (2995-3003): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3009-3017): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3023-3031): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3037-3045): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3051-3059): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3065-3073): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3079-3087): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3093-3101): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3107-3115): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3121-3129): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3135-3143): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3149-3157): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3163-3171): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3177-3185): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3191-3199): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3205-3213): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3219-3227): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3233-3241): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3247-3255): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3261-3269): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3275-3283): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3289-3297): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3303-3311): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3317-3325): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3331-3339): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3345-3353): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3359-3367): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3373-3381): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3387-3395): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3401-3409): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3415-3423): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3429-3437): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3443-3451): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3457-3465): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3471-3479): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3485-3493): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3499-3507): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3513-3521): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3527-3535): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3541-3549): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3555-3563): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3569-3577): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3583-3591): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3597-3605): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (3611-3619): "continue" has to be in a "for" or "while" loop. +// Warning 4013: There are more than 256 errors. Aborting. diff --git a/test/libsolidity/syntaxTests/multiSource/error_in_first.sol b/test/libsolidity/syntaxTests/multiSource/error_in_first.sol index abf0bce9b994..2c21da4022fc 100644 --- a/test/libsolidity/syntaxTests/multiSource/error_in_first.sol +++ b/test/libsolidity/syntaxTests/multiSource/error_in_first.sol @@ -7,4 +7,4 @@ contract B { function f() public { } } // ---- -// DeclarationError: (A:36-37): Undeclared identifier. +// DeclarationError 7576: (A:36-37): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/multiSource/import.sol b/test/libsolidity/syntaxTests/multiSource/import.sol index 4d9f6c6860c7..b351e7ccda26 100644 --- a/test/libsolidity/syntaxTests/multiSource/import.sol +++ b/test/libsolidity/syntaxTests/multiSource/import.sol @@ -8,5 +8,5 @@ contract B is A { function f(uint256 x) public view returns(uint256) { return x; } } // ---- -// Warning: (A:14-78): Function state mutability can be restricted to pure -// Warning: (B:31-95): Function state mutability can be restricted to pure +// Warning 2018: (A:14-78): Function state mutability can be restricted to pure +// Warning 2018: (B:31-95): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/multiSource/import_not_found.sol b/test/libsolidity/syntaxTests/multiSource/import_not_found.sol index dd0d2db28e3d..f3042eceaa4a 100644 --- a/test/libsolidity/syntaxTests/multiSource/import_not_found.sol +++ b/test/libsolidity/syntaxTests/multiSource/import_not_found.sol @@ -2,4 +2,4 @@ import "b"; contract C {} // ---- -// ParserError: (a:0-11): Source "b" not found: File not supplied initially. +// ParserError 6275: (a:0-11): Source "b" not found: File not supplied initially. diff --git a/test/libsolidity/syntaxTests/multiSource/no_import.sol b/test/libsolidity/syntaxTests/multiSource/no_import.sol index 37b14b871eb4..25b10ce11ac4 100644 --- a/test/libsolidity/syntaxTests/multiSource/no_import.sol +++ b/test/libsolidity/syntaxTests/multiSource/no_import.sol @@ -7,4 +7,4 @@ contract B is A { function f(uint256 x) public view returns(uint256) { return x; } } // ---- -// DeclarationError: (B:14-15): Identifier not found or not unique. +// DeclarationError 7920: (B:14-15): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/multiSource/one_source.sol b/test/libsolidity/syntaxTests/multiSource/one_source.sol index 0f0d129b5d72..11ee497208e1 100644 --- a/test/libsolidity/syntaxTests/multiSource/one_source.sol +++ b/test/libsolidity/syntaxTests/multiSource/one_source.sol @@ -4,4 +4,4 @@ contract A { function f() public pure { x = 42; } } // ---- -// TypeError: (SourceName:53-54): Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (SourceName:53-54): Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/multiSource/warning_in_both.sol b/test/libsolidity/syntaxTests/multiSource/warning_in_both.sol index 1522e42aab03..04ea5ca3ff84 100644 --- a/test/libsolidity/syntaxTests/multiSource/warning_in_both.sol +++ b/test/libsolidity/syntaxTests/multiSource/warning_in_both.sol @@ -7,5 +7,5 @@ contract B { function f(uint256 x) public view returns(uint256) { return x; } } // ---- -// Warning: (A:14-78): Function state mutability can be restricted to pure -// Warning: (B:14-78): Function state mutability can be restricted to pure +// Warning 2018: (A:14-78): Function state mutability can be restricted to pure +// Warning 2018: (B:14-78): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol index 3b05a54ca0ab..791e50784c58 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol @@ -15,11 +15,11 @@ contract C { } } // ---- -// TypeError: (47-61): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (71-87): Different number of components on the left hand side (1) than on the right hand side (3). -// TypeError: (97-115): Different number of components on the left hand side (1) than on the right hand side (4). -// TypeError: (157-197): Different number of components on the left hand side (4) than on the right hand side (1). -// TypeError: (207-238): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (248-270): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (312-358): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (368-407): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (47-61): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError 7364: (71-87): Different number of components on the left hand side (1) than on the right hand side (3). +// TypeError 7364: (97-115): Different number of components on the left hand side (1) than on the right hand side (4). +// TypeError 7364: (157-197): Different number of components on the left hand side (4) than on the right hand side (1). +// TypeError 7364: (207-238): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError 7364: (248-270): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (312-358): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError 7364: (368-407): Different number of components on the left hand side (3) than on the right hand side (4). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol index dead52486ec2..1cd676ef8f98 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol @@ -19,11 +19,11 @@ contract C { function four() public pure returns (uint, uint, uint, uint) {} } // ---- -// TypeError: (47-61): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (71-87): Different number of components on the left hand side (1) than on the right hand side (3). -// TypeError: (97-112): Different number of components on the left hand side (1) than on the right hand side (4). -// TypeError: (154-198): Different number of components on the left hand side (4) than on the right hand side (1). -// TypeError: (208-243): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (253-279): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (321-367): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (377-413): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (47-61): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError 7364: (71-87): Different number of components on the left hand side (1) than on the right hand side (3). +// TypeError 7364: (97-112): Different number of components on the left hand side (1) than on the right hand side (4). +// TypeError 7364: (154-198): Different number of components on the left hand side (4) than on the right hand side (1). +// TypeError 7364: (208-243): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError 7364: (253-279): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (321-367): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError 7364: (377-413): Different number of components on the left hand side (3) than on the right hand side (4). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol index b500823d3712..6942a99ea735 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol @@ -13,12 +13,12 @@ contract C { } } // ---- -// TypeError: (53-72): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (82-101): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (111-135): Different number of components on the left hand side (3) than on the right hand side (5). -// TypeError: (145-174): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (184-213): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (223-251): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (261-274): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (284-297): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (307-321): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError 7364: (53-72): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError 7364: (82-101): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError 7364: (111-135): Different number of components on the left hand side (3) than on the right hand side (5). +// TypeError 7364: (145-174): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (184-213): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (223-251): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError 7364: (261-274): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (284-297): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (307-321): Different number of components on the left hand side (3) than on the right hand side (1). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol index ee141495c6f0..26055d41fee8 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol @@ -19,13 +19,13 @@ abstract contract C { function five() public pure returns (uint, uint, uint, uint, uint) {} } // ---- -// TypeError: (62-81): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (91-110): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (120-139): Different number of components on the left hand side (3) than on the right hand side (5). -// TypeError: (149-175): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (185-211): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (221-249): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (259-276): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (286-303): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (313-331): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (341-368): Different number of components on the left hand side (4) than on the right hand side (5). +// TypeError 7364: (62-81): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError 7364: (91-110): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError 7364: (120-139): Different number of components on the left hand side (3) than on the right hand side (5). +// TypeError 7364: (149-175): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (185-211): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError 7364: (221-249): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError 7364: (259-276): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (286-303): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (313-331): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError 7364: (341-368): Different number of components on the left hand side (4) than on the right hand side (5). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol index 9618958e2562..05ae8b440bb0 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (52-74): Different number of components on the left hand side (2) than on the right hand side (0). -// TypeError: (84-98): Different number of components on the left hand side (1) than on the right hand side (0). -// TypeError: (108-120): Different number of components on the left hand side (1) than on the right hand side (0). +// TypeError 7364: (52-74): Different number of components on the left hand side (2) than on the right hand side (0). +// TypeError 7364: (84-98): Different number of components on the left hand side (1) than on the right hand side (0). +// TypeError 7364: (108-120): Different number of components on the left hand side (1) than on the right hand side (0). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol index 85094d001d39..a12649cfc676 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// TypeError: (85-118): Type string memory is not implicitly convertible to expected type uint256. -// TypeError: (85-118): Type uint256 is not implicitly convertible to expected type string memory. +// TypeError 9574: (85-118): Type string memory is not implicitly convertible to expected type uint256. +// TypeError 9574: (85-118): Type uint256 is not implicitly convertible to expected type string memory. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol index 1f9e52d13dcd..9b07ac8fb0e3 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// DeclarationError: (99-100): Undeclared identifier. +// DeclarationError 7576: (99-100): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol index 45b8858b97f1..8a37f42f522a 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// DeclarationError: (79-80): Undeclared identifier. "a" is not (or not yet) visible at this point. -// DeclarationError: (82-83): Undeclared identifier. "b" is not (or not yet) visible at this point. -// DeclarationError: (85-86): Undeclared identifier. "c" is not (or not yet) visible at this point. +// DeclarationError 7576: (79-80): Undeclared identifier. "a" is not (or not yet) visible at this point. +// DeclarationError 7576: (82-83): Undeclared identifier. "b" is not (or not yet) visible at this point. +// DeclarationError 7576: (85-86): Undeclared identifier. "c" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol index 00458908167e..eb313eadd5bb 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (160-168): Expression has to be an lvalue. +// TypeError 4247: (160-168): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol index 562c7c0b0eb0..b3b365fed6d0 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (59-63): Tuple component cannot be empty. +// TypeError 8381: (59-63): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/001_name_references.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/001_name_references.sol index ae4671381432..2bf964ff30ae 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/001_name_references.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/001_name_references.sol @@ -3,4 +3,4 @@ contract test { function f(uint256) public returns (uint out) { f(variable); test; out; } } // ---- -// Warning: (103-107): Statement has no effect. +// Warning 6133: (103-107): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/002_undeclared_name.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/002_undeclared_name.sol index afe9483f6ba6..10f733fd2912 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/002_undeclared_name.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/002_undeclared_name.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: (85-93): Undeclared identifier. +// DeclarationError 7576: (85-93): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/003_undeclared_name_is_not_fatal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/003_undeclared_name_is_not_fatal.sol index 0f2a15260056..a3590ba01be7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/003_undeclared_name_is_not_fatal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/003_undeclared_name_is_not_fatal.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// DeclarationError: (85-93): Undeclared identifier. -// DeclarationError: (106-114): Undeclared identifier. +// DeclarationError 7576: (85-93): Undeclared identifier. +// DeclarationError 7576: (106-114): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/010_type_conversion_for_comparison.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/010_type_conversion_for_comparison.sol index c0cd87d4689f..1e556408be50 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/010_type_conversion_for_comparison.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/010_type_conversion_for_comparison.sol @@ -2,5 +2,5 @@ contract test { function f() public { uint32(2) == int64(2); } } // ---- -// Warning: (42-63): Statement has no effect. -// Warning: (20-66): Function state mutability can be restricted to pure +// Warning 6133: (42-63): Statement has no effect. +// Warning 2018: (20-66): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/011_type_conversion_for_comparison_invalid.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/011_type_conversion_for_comparison_invalid.sol index 9cbce0d0660c..ea30647df0c0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/011_type_conversion_for_comparison_invalid.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/011_type_conversion_for_comparison_invalid.sol @@ -2,4 +2,4 @@ contract test { function f() public { int32(2) == uint64(2); } } // ---- -// TypeError: (42-63): Operator == not compatible with types int32 and uint64 +// TypeError 2271: (42-63): Operator == not compatible with types int32 and uint64 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol index 7f858a4d77fd..354b6ed0e517 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol @@ -2,5 +2,5 @@ contract test { function f() public { string memory x = "123456789012345678901234567890123"; } } // ---- -// Warning: (42-57): Unused local variable. -// Warning: (20-98): Function state mutability can be restricted to pure +// Warning 2072: (42-57): Unused local variable. +// Warning 2018: (20-98): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/014_balance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/014_balance.sol index e2c9a8bff3f1..8a8945ebb4d1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/014_balance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/014_balance.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// Warning: (52-61): Unused local variable. -// Warning: (20-89): Function state mutability can be restricted to view +// Warning 2072: (52-61): Unused local variable. +// Warning 2018: (20-89): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/015_balance_invalid.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/015_balance_invalid.sol index 18658fbee44a..dcd2be341d08 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/015_balance_invalid.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/015_balance_invalid.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (52-70): Expression has to be an lvalue. +// TypeError 4247: (52-70): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/019_comparison_bitop_precedence.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/019_comparison_bitop_precedence.sol index eab272dfad0d..c77536620ab3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/019_comparison_bitop_precedence.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/019_comparison_bitop_precedence.sol @@ -4,4 +4,4 @@ contract First { } } // ---- -// Warning: (21-117): Function state mutability can be restricted to pure +// Warning 2018: (21-117): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/020_comparison_of_function_types_lt_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/020_comparison_of_function_types_lt_1.sol index 1f288ff7230b..8eeaf36978aa 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/020_comparison_of_function_types_lt_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/020_comparison_of_function_types_lt_1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (73-88): Operator < not compatible with types function () external returns (bool) and function () external returns (bool) +// TypeError 2271: (73-88): Operator < not compatible with types function () external returns (bool) and function () external returns (bool) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/021_comparison_of_function_types_lt_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/021_comparison_of_function_types_lt_2.sol index a6422d38ed0c..6fa1c281a755 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/021_comparison_of_function_types_lt_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/021_comparison_of_function_types_lt_2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (73-78): Operator < not compatible with types function () returns (bool) and function () returns (bool) +// TypeError 2271: (73-78): Operator < not compatible with types function () returns (bool) and function () returns (bool) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/022_comparison_of_function_types_gt_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/022_comparison_of_function_types_gt_1.sol index ee8659124131..32fed1f6a449 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/022_comparison_of_function_types_gt_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/022_comparison_of_function_types_gt_1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (73-88): Operator > not compatible with types function () external returns (bool) and function () external returns (bool) +// TypeError 2271: (73-88): Operator > not compatible with types function () external returns (bool) and function () external returns (bool) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/023_comparison_of_function_types_gt_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/023_comparison_of_function_types_gt_2.sol index 590cc98bb85a..70a391ed9910 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/023_comparison_of_function_types_gt_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/023_comparison_of_function_types_gt_2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (73-78): Operator > not compatible with types function () returns (bool) and function () returns (bool) +// TypeError 2271: (73-78): Operator > not compatible with types function () returns (bool) and function () returns (bool) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/024_comparison_of_function_types_eq.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/024_comparison_of_function_types_eq.sol index 71dbec6b32e5..026f0343becb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/024_comparison_of_function_types_eq.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/024_comparison_of_function_types_eq.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// Warning: (17-86): Function state mutability can be restricted to pure -// Warning: (91-160): Function state mutability can be restricted to pure +// Warning 2018: (17-86): Function state mutability can be restricted to pure +// Warning 2018: (91-160): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol index b15666c0bd88..9f50403cbfdf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (147-153): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256) +// TypeError 2271: (147-153): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/029_create_abstract_contract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/029_create_abstract_contract.sol index 85c78bf30ead..029db714adfa 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/029_create_abstract_contract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/029_create_abstract_contract.sol @@ -4,4 +4,4 @@ contract derived { function foo() public { b = new base(); } } // ---- -// TypeError: (0-48): Contract "base" should be marked as abstract. +// TypeError 3656: (0-48): Contract "base" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol index acad919c5302..c9c1e5bf8855 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol @@ -2,4 +2,4 @@ abstract contract base { function foo() public virtual; } contract derived is base { function foo() public virtual override {} } contract wrong is derived { function foo() public virtual override; } // ---- -// TypeError: (157-196): Overriding an implemented function with an unimplemented function is not allowed. +// TypeError 4593: (157-196): Overriding an implemented function with an unimplemented function is not allowed. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/039_functions_with_identical_structs_in_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/039_functions_with_identical_structs_in_interface.sol index 1369d9523e6d..38fe146e894a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/039_functions_with_identical_structs_in_interface.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/039_functions_with_identical_structs_in_interface.sol @@ -7,4 +7,4 @@ contract C { function f(S2 memory) public pure {} } // ---- -// TypeError: (143-179): Function overload clash during conversion to external types for arguments. +// TypeError 9914: (143-179): Function overload clash during conversion to external types for arguments. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol index 3168f466b54e..77f8dd2474b7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol @@ -5,4 +5,4 @@ contract C { function f(S memory) public {} } // ---- -// TypeError: (103-111): Internal type is not allowed for public or external functions. +// TypeError 4103: (103-111): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol index 124464678bfa..0254a1928ea3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol @@ -5,4 +5,4 @@ contract C { function f(S memory) public {} } // ---- -// TypeError: (105-113): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 4103: (105-113): Only libraries are allowed to use the mapping type in public or external functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol index cb71576c87b7..c36e4ac0e9b9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol @@ -6,4 +6,4 @@ contract C { function f(S memory) public {} } // ---- -// TypeError: (132-140): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 4103: (132-140): Only libraries are allowed to use the mapping type in public or external functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/045_returning_multi_dimensional_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/045_returning_multi_dimensional_arrays.sol index 975d2f0064d9..bc92882a2de3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/045_returning_multi_dimensional_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/045_returning_multi_dimensional_arrays.sol @@ -2,4 +2,4 @@ contract C { function f() public pure returns (string[][] memory) {} } // ---- -// TypeError: (51-68): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 4957: (51-68): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/046_returning_multi_dimensional_static_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/046_returning_multi_dimensional_static_arrays.sol index 8df1f9e7b134..d0e6ec0b6dc0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/046_returning_multi_dimensional_static_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/046_returning_multi_dimensional_static_arrays.sol @@ -2,4 +2,4 @@ contract C { function f() public pure returns (uint[][2] memory) {} } // ---- -// TypeError: (51-67): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 4957: (51-67): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/048_returning_arrays_in_structs_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/048_returning_arrays_in_structs_arrays.sol index 4267c62e9c70..7670da2b0250 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/048_returning_arrays_in_structs_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/048_returning_arrays_in_structs_arrays.sol @@ -3,4 +3,4 @@ contract C { function f() public pure returns (S memory x) {} } // ---- -// TypeError: (80-90): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. +// TypeError 4957: (80-90): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/050_function_external_call_not_allowed_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/050_function_external_call_not_allowed_conversion.sol index 18d75948c498..e4e02269b13b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/050_function_external_call_not_allowed_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/050_function_external_call_not_allowed_conversion.sol @@ -7,4 +7,4 @@ contract Test { function g (C c) external {} } // ---- -// TypeError: (103-106): Invalid type for argument in function call. Invalid implicit conversion from address to contract C requested. +// TypeError 9553: (103-106): Invalid type for argument in function call. Invalid implicit conversion from address to contract C requested. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/052_function_internal_not_allowed_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/052_function_internal_not_allowed_conversion.sol index c16d35eb3eef..cc23fdf6e1a1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/052_function_internal_not_allowed_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/052_function_internal_not_allowed_conversion.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (136-137): Invalid type for argument in function call. Invalid implicit conversion from address to contract C requested. +// TypeError 9553: (136-137): Invalid type for argument in function call. Invalid implicit conversion from address to contract C requested. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/053_hash_collision_in_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/053_hash_collision_in_interface.sol index fe690e1692ca..1319a36bea2a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/053_hash_collision_in_interface.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/053_hash_collision_in_interface.sol @@ -3,4 +3,4 @@ contract test { function tgeo() public { } } // ---- -// TypeError: (0-78): Function signature hash collision for tgeo() +// TypeError 1860: (0-78): Function signature hash collision for tgeo() diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/056_cyclic_inheritance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/056_cyclic_inheritance.sol index 0e1ec4cb51d0..287aa93dc714 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/056_cyclic_inheritance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/056_cyclic_inheritance.sol @@ -1,4 +1,4 @@ contract A is B { } contract B is A { } // ---- -// TypeError: (14-15): Definition of base has to precede definition of derived contract +// TypeError 2449: (14-15): Definition of base has to precede definition of derived contract diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/059_illegal_override_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/059_illegal_override_visibility.sol index d1e110149afe..c7bcad6e3f23 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/059_illegal_override_visibility.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/059_illegal_override_visibility.sol @@ -1,5 +1,5 @@ contract B { function f() virtual internal {} } contract C is B { function f() public {} } // ---- -// TypeError: (66-88): Overriding function is missing "override" specifier. -// TypeError: (66-88): Overriding function visibility differs. +// TypeError 9456: (66-88): Overriding function is missing "override" specifier. +// TypeError 9098: (66-88): Overriding function visibility differs. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol index 8eb75497c81b..0eb051b7546b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol @@ -2,4 +2,4 @@ contract A { function f() public virtual { uint8 x = C(0).g(); } } contract B { function f() public virtual {} function g() public returns (uint8) {} } contract C is A, B { function f() public override (A, B) { A.f(); } } // ---- -// Warning: (43-50): Unused local variable. +// Warning 2072: (43-50): Unused local variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol index 062c4318f010..8952a48c40c4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol @@ -1,4 +1,4 @@ contract A { constructor(uint a) public { } } contract B is A { } // ---- -// TypeError: (46-65): Contract "B" should be marked as abstract. +// TypeError 3656: (46-65): Contract "B" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol index 062c4318f010..8952a48c40c4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol @@ -1,4 +1,4 @@ contract A { constructor(uint a) public { } } contract B is A { } // ---- -// TypeError: (46-65): Contract "B" should be marked as abstract. +// TypeError 3656: (46-65): Contract "B" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/063_implicit_derived_to_base_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/063_implicit_derived_to_base_conversion.sol index f4667996f452..627029634a09 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/063_implicit_derived_to_base_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/063_implicit_derived_to_base_conversion.sol @@ -3,5 +3,5 @@ contract B is A { function f() public { A a = B(1); } } // ---- -// Warning: (59-62): Unused local variable. -// Warning: (37-72): Function state mutability can be restricted to pure +// Warning 2072: (59-62): Unused local variable. +// Warning 2018: (37-72): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/064_implicit_base_to_derived_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/064_implicit_base_to_derived_conversion.sol index 0d23ea87da38..5876633c359c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/064_implicit_base_to_derived_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/064_implicit_base_to_derived_conversion.sol @@ -3,4 +3,4 @@ contract B is A { function f() public { B b = A(1); } } // ---- -// TypeError: (59-69): Type contract A is not implicitly convertible to expected type contract B. +// TypeError 9574: (59-69): Type contract A is not implicitly convertible to expected type contract B. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/065_super_excludes_current_contract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/065_super_excludes_current_contract.sol index 544df1a562c0..62d4d7b3440e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/065_super_excludes_current_contract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/065_super_excludes_current_contract.sol @@ -8,4 +8,4 @@ contract B is A { } } // ---- -// TypeError: (95-102): Member "f" not found or not visible after argument-dependent lookup in contract super B. +// TypeError 9582: (95-102): Member "f" not found or not visible after argument-dependent lookup in contract super B. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/067_function_clash_with_state_variable_accessor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/067_function_clash_with_state_variable_accessor.sol index a99682c0fe3b..67726f6d7a97 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/067_function_clash_with_state_variable_accessor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/067_function_clash_with_state_variable_accessor.sol @@ -6,4 +6,4 @@ contract test { function foo() public {} } // ---- -// DeclarationError: (90-114): Identifier already declared. +// DeclarationError 2333: (90-114): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/069_base_class_state_variable_accessor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/069_base_class_state_variable_accessor.sol index d36d0bf8b007..676c4b5408f9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/069_base_class_state_variable_accessor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/069_base_class_state_variable_accessor.sol @@ -6,4 +6,4 @@ contract Child is Parent { function foo() public returns (uint256) { return Parent.m_aMember; } } // ---- -// Warning: (158-226): Function state mutability can be restricted to view +// Warning 2018: (158-226): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/070_struct_accessor_one_array_only.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/070_struct_accessor_one_array_only.sol index 6741a7fa7608..71129da5f17d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/070_struct_accessor_one_array_only.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/070_struct_accessor_one_array_only.sol @@ -3,4 +3,4 @@ contract test { Data public data; } // ---- -// TypeError: (58-74): Internal or recursive type is not allowed for public state variables. +// TypeError 6744: (58-74): Internal or recursive type is not allowed for public state variables. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/071_base_class_state_variable_internal_member.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/071_base_class_state_variable_internal_member.sol index 01fda2431932..ea17c2e8b28b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/071_base_class_state_variable_internal_member.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/071_base_class_state_variable_internal_member.sol @@ -5,4 +5,4 @@ contract Child is Parent { function foo() public returns (uint256) { return Parent.m_aMember; } } // ---- -// Warning: (83-151): Function state mutability can be restricted to view +// Warning 2018: (83-151): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/072_state_variable_member_of_wrong_class1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/072_state_variable_member_of_wrong_class1.sol index dd73ac47bd3b..40d86ebf8d06 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/072_state_variable_member_of_wrong_class1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/072_state_variable_member_of_wrong_class1.sol @@ -8,4 +8,4 @@ contract Child is Parent2 { function foo() public returns (uint256) { return Parent2.m_aMember1; } } // ---- -// TypeError: (200-218): Member "m_aMember1" not found or not visible after argument-dependent lookup in type(contract Parent2). +// TypeError 9582: (200-218): Member "m_aMember1" not found or not visible after argument-dependent lookup in type(contract Parent2). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/073_state_variable_member_of_wrong_class2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/073_state_variable_member_of_wrong_class2.sol index f2de6e72e9ea..f56084bda778 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/073_state_variable_member_of_wrong_class2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/073_state_variable_member_of_wrong_class2.sol @@ -9,4 +9,4 @@ contract Child is Parent2 { uint256 public m_aMember3; } // ---- -// TypeError: (200-216): Member "m_aMember2" not found or not visible after argument-dependent lookup in type(contract Child). +// TypeError 9582: (200-216): Member "m_aMember2" not found or not visible after argument-dependent lookup in type(contract Child). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol index 42c350c4ccf0..8beac9f1aa10 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol @@ -3,4 +3,4 @@ contract C { fallback(uint a) external { x = 2; } } // ---- -// TypeError: (37-45): Fallback function cannot take parameters. +// TypeError 3978: (37-45): Fallback function cannot take parameters. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol index 0b4b49be5b4d..0f41231750fc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol @@ -2,4 +2,4 @@ library C { fallback() external {} } // ---- -// TypeError: (16-38): Libraries cannot have fallback functions. +// TypeError 5982: (16-38): Libraries cannot have fallback functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_receive_function_in_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_receive_function_in_library.sol index 64c150726cae..33cf221ea255 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_receive_function_in_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_receive_function_in_library.sol @@ -2,5 +2,5 @@ library C { receive() external payable {} } // ---- -// TypeError: (16-45): Library functions cannot be payable. -// TypeError: (16-45): Libraries cannot have receive ether functions. +// TypeError 7708: (16-45): Library functions cannot be payable. +// TypeError 4549: (16-45): Libraries cannot have receive ether functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol index 4f1da80fd5a8..3ec82b390488 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol @@ -2,4 +2,4 @@ contract C { fallback() external returns (uint) { } } // ---- -// TypeError: (45-51): Fallback function can only have a single "bytes memory" return value. +// TypeError 5570: (45-51): Fallback function can only have a single "bytes memory" return value. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol index b2025a4054c0..3dbf9b0bcdbc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol @@ -4,4 +4,4 @@ contract C { fallback() external { x = 3; } } // ---- -// DeclarationError: (64-94): Only one fallback function is allowed. +// DeclarationError 7301: (64-94): Only one fallback function is allowed. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/081_event_too_many_indexed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/081_event_too_many_indexed.sol index ee0af605ffa6..ccc8d71c1d33 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/081_event_too_many_indexed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/081_event_too_many_indexed.sol @@ -2,4 +2,4 @@ contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d); } // ---- -// TypeError: (17-91): More than 3 indexed arguments for event. +// TypeError 7249: (17-91): More than 3 indexed arguments for event. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/083_anonymous_event_too_many_indexed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/083_anonymous_event_too_many_indexed.sol index d439c5b96134..d1e254d6ad22 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/083_anonymous_event_too_many_indexed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/083_anonymous_event_too_many_indexed.sol @@ -2,4 +2,4 @@ contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; } // ---- -// TypeError: (17-117): More than 4 indexed arguments for anonymous event. +// TypeError 8598: (17-117): More than 4 indexed arguments for anonymous event. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol index af0280c5de78..c515e1b035f0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol @@ -3,4 +3,4 @@ contract test { event A(uint i); } // ---- -// DeclarationError: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol index 7d4b0ac93e43..e742c9dd29cb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol @@ -3,4 +3,4 @@ contract test { event A(uint i) anonymous; } // ---- -// DeclarationError: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol index e6aa3e5fb533..951abc8307ec 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol @@ -3,4 +3,4 @@ contract test { event A(uint indexed i); } // ---- -// DeclarationError: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/091_event_function_inheritance_clash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/091_event_function_inheritance_clash.sol index 5e0f58ea24f1..858e93d2d9e2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/091_event_function_inheritance_clash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/091_event_function_inheritance_clash.sol @@ -9,4 +9,4 @@ contract B { contract C is A, B { } // ---- -// DeclarationError: (99-111): Identifier already declared. +// DeclarationError 9097: (99-111): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/092_function_event_inheritance_clash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/092_function_event_inheritance_clash.sol index c567f9920bcb..6b08009b1a10 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/092_function_event_inheritance_clash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/092_function_event_inheritance_clash.sol @@ -9,4 +9,4 @@ contract A { contract C is B, A { } // ---- -// DeclarationError: (49-111): Identifier already declared. +// DeclarationError 9097: (49-111): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/093_function_event_in_contract_clash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/093_function_event_in_contract_clash.sol index 7b4fcde9f932..eba87f3b519a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/093_function_event_in_contract_clash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/093_function_event_in_contract_clash.sol @@ -5,4 +5,4 @@ contract A { } } // ---- -// DeclarationError: (34-96): Identifier already declared. +// DeclarationError 2333: (34-96): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/097_access_to_internal_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/097_access_to_internal_function.sol index 60d7b758ec30..13ba97f5a6aa 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/097_access_to_internal_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/097_access_to_internal_function.sol @@ -5,4 +5,4 @@ contract d { function g() public { c(0).f(); } } // ---- -// TypeError: (83-89): Member "f" not found or not visible after argument-dependent lookup in contract c. +// TypeError 9582: (83-89): Member "f" not found or not visible after argument-dependent lookup in contract c. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/098_access_to_default_state_variable_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/098_access_to_default_state_variable_visibility.sol index 8c9d0c0f85d7..5c14f2e66acb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/098_access_to_default_state_variable_visibility.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/098_access_to_default_state_variable_visibility.sol @@ -5,4 +5,4 @@ contract d { function g() public { c(0).a(); } } // ---- -// TypeError: (66-72): Member "a" not found or not visible after argument-dependent lookup in contract c. +// TypeError 9582: (66-72): Member "a" not found or not visible after argument-dependent lookup in contract c. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/099_access_to_internal_state_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/099_access_to_internal_state_variable.sol index 60aba574194f..b95949f7f79e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/099_access_to_internal_state_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/099_access_to_internal_state_variable.sol @@ -5,4 +5,4 @@ contract d { function g() public { c(0).a(); } } // ---- -// Warning: (51-84): Function state mutability can be restricted to view +// Warning 2018: (51-84): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/100_error_count_in_named_args.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/100_error_count_in_named_args.sol index a679c25a9b36..5e8c4f40fb62 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/100_error_count_in_named_args.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/100_error_count_in_named_args.sol @@ -7,5 +7,5 @@ contract test { } } // ---- -// Warning: (31-37): This declaration shadows an existing declaration. -// TypeError: (153-162): Wrong argument count for function call: 1 arguments given but expected 2. +// Warning 2519: (31-37): This declaration shadows an existing declaration. +// TypeError 6160: (153-162): Wrong argument count for function call: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/101_empty_in_named_args.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/101_empty_in_named_args.sol index 9da11d6fccd9..f00ae0227125 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/101_empty_in_named_args.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/101_empty_in_named_args.sol @@ -7,5 +7,5 @@ contract test { } } // ---- -// Warning: (31-37): This declaration shadows an existing declaration. -// TypeError: (153-158): Wrong argument count for function call: 0 arguments given but expected 2. +// Warning 2519: (31-37): This declaration shadows an existing declaration. +// TypeError 6160: (153-158): Wrong argument count for function call: 0 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol index 88402fa368f3..98587ac60082 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol @@ -7,5 +7,5 @@ contract test { } } // ---- -// Warning: (31-37): This declaration shadows an existing declaration. -// TypeError: (159-160): Duplicate named argument "a". +// Warning 2519: (31-37): This declaration shadows an existing declaration. +// TypeError 6995: (159-160): Duplicate named argument "a". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/103_invalid_parameter_names_in_named_args.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/103_invalid_parameter_names_in_named_args.sol index bed15186f5bb..b3b8c727ca8e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/103_invalid_parameter_names_in_named_args.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/103_invalid_parameter_names_in_named_args.sol @@ -7,5 +7,5 @@ contract test { } } // ---- -// Warning: (31-37): This declaration shadows an existing declaration. -// TypeError: (153-168): Named argument "c" does not match function declaration. +// Warning 2519: (31-37): This declaration shadows an existing declaration. +// TypeError 4974: (153-168): Named argument "c" does not match function declaration. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol index aab8a183ac3e..154b68496a72 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol @@ -2,4 +2,4 @@ contract test { function f(uint[] memory constant a) public { } } // ---- -// DeclarationError: (31-55): The "constant" keyword can only be used for state variables. +// DeclarationError 1788: (31-55): The "constant" keyword can only be used for state variables. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/107_empty_name_input_parameter_with_named_one.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/107_empty_name_input_parameter_with_named_one.sol index e0efa0a08172..7ec5b3b71a59 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/107_empty_name_input_parameter_with_named_one.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/107_empty_name_input_parameter_with_named_one.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (20-98): Function state mutability can be restricted to pure +// Warning 2018: (20-98): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/108_empty_name_return_parameter_with_named_one.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/108_empty_name_return_parameter_with_named_one.sol index 39ae787753cf..241d15f10808 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/108_empty_name_return_parameter_with_named_one.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/108_empty_name_return_parameter_with_named_one.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (77-85): Different number of arguments in return statement than in returns declaration. +// TypeError 8863: (77-85): Different number of arguments in return statement than in returns declaration. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol index dc4cab8af170..9ac069cf2488 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol @@ -5,4 +5,4 @@ contract c { uint256 a; } // ---- -// TypeError: (52-118): Type int_const 1157...(70 digits omitted)...0000 is not implicitly convertible to expected type uint256. +// TypeError 7407: (52-118): Type int_const 1157...(70 digits omitted)...0000 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/112_exp_operator_exponent_too_big.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/112_exp_operator_exponent_too_big.sol index 2a9e6204b4b4..49f9877e2583 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/112_exp_operator_exponent_too_big.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/112_exp_operator_exponent_too_big.sol @@ -2,4 +2,4 @@ contract test { function f() public returns (uint d) { return 2 ** 10000000000; } } // ---- -// TypeError: (66-82): Operator ** not compatible with types int_const 2 and int_const 10000000000 +// TypeError 2271: (66-82): Operator ** not compatible with types int_const 2 and int_const 10000000000 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol index 0d91fcab1119..cceba6f0b242 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/113_exp_warn_literal_base_1.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// Warning: (99-104): Result of exponentiation has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. +// Warning 9085: (99-104): Result of exponentiation has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol index c6a4052ecef3..6793c304c6f2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/116_shift_warn_literal_base_1.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// Warning: (99-106): Result of shift has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. +// Warning 9085: (99-106): Result of shift has type uint8 and thus might overflow. Silence this warning by converting the literal to the expected type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/125_enum_member_access_accross_contracts.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/125_enum_member_access_accross_contracts.sol index 3bed62d67b80..da6ea988903d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/125_enum_member_access_accross_contracts.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/125_enum_member_access_accross_contracts.sol @@ -7,4 +7,4 @@ contract Impl { } } // ---- -// Warning: (72-166): Function state mutability can be restricted to pure +// Warning 2018: (72-166): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol index e58ed1600a84..0c0137d9a6a4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol @@ -6,4 +6,4 @@ contract test { ActionChoices choices; } // ---- -// TypeError: (121-159): Member "RunAroundWavingYourHands" not found or not visible after argument-dependent lookup in type(enum test.ActionChoices). +// TypeError 9582: (121-159): Member "RunAroundWavingYourHands" not found or not visible after argument-dependent lookup in type(enum test.ActionChoices). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol index 68510a0a9410..d23cf82da333 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol @@ -6,4 +6,4 @@ contract test { ActionChoices choices; } // ---- -// DeclarationError: (121-124): Undeclared identifier. +// DeclarationError 7576: (121-124): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol index 01c5e93fc2e6..52296a9c68f4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol @@ -6,4 +6,4 @@ contract test { uint256 a; } // ---- -// TypeError: (115-139): Type enum test.ActionChoices is not implicitly convertible to expected type uint256. +// TypeError 7407: (115-139): Type enum test.ActionChoices is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol index 4e21b9aadc7e..fdfc4f6068e7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol @@ -6,4 +6,4 @@ contract test { uint64 b; } // ---- -// TypeError: (115-132): Type enum test.ActionChoices is not implicitly convertible to expected type uint64. +// TypeError 7407: (115-132): Type enum test.ActionChoices is not implicitly convertible to expected type uint64. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol index 5b9ba813a537..367a9fbdd7d1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// TypeError: (137-153): Explicit type conversion not allowed from "enum test.Paper" to "enum test.Ground". +// TypeError 9640: (137-153): Explicit type conversion not allowed from "enum test.Paper" to "enum test.Ground". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/133_enum_duplicate_values.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/133_enum_duplicate_values.sol index 996a9b787eeb..bcd1ad52bd06 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/133_enum_duplicate_values.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/133_enum_duplicate_values.sol @@ -2,4 +2,4 @@ enum ActionChoices { GoLeft, GoRight, GoLeft, Sit } } // ---- -// DeclarationError: (66-72): Identifier already declared. +// DeclarationError 2333: (66-72): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/134_enum_name_resolution_under_current_contract_name.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/134_enum_name_resolution_under_current_contract_name.sol index 4a16eee11b2e..8b0bfae43a8b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/134_enum_name_resolution_under_current_contract_name.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/134_enum_name_resolution_under_current_contract_name.sol @@ -9,4 +9,4 @@ contract A { } } // ---- -// Warning: (69-111): Function state mutability can be restricted to pure +// Warning 2018: (69-111): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/135_private_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/135_private_visibility.sol index faafc6313ced..160ceaec721f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/135_private_visibility.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/135_private_visibility.sol @@ -5,4 +5,4 @@ contract derived is base { function g() public { f(); } } // ---- -// DeclarationError: (99-100): Undeclared identifier. +// DeclarationError 7576: (99-100): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/136_private_visibility_via_explicit_base_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/136_private_visibility_via_explicit_base_access.sol index 2f94ef92b6f4..64fd5fdf1eac 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/136_private_visibility_via_explicit_base_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/136_private_visibility_via_explicit_base_access.sol @@ -5,4 +5,4 @@ contract derived is base { function g() public { base.f(); } } // ---- -// TypeError: (99-105): Member "f" not found or not visible after argument-dependent lookup in type(contract base). +// TypeError 9582: (99-105): Member "f" not found or not visible after argument-dependent lookup in type(contract base). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/137_external_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/137_external_visibility.sol index 214ad60ace4e..d8090e1e05b1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/137_external_visibility.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/137_external_visibility.sol @@ -3,4 +3,4 @@ contract c { function g() public { f(); } } // ---- -// DeclarationError: (68-69): Undeclared identifier. "f" is not (or not yet) visible at this point. +// DeclarationError 7576: (68-69): Undeclared identifier. "f" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/138_similar_name_suggestions_expected.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/138_similar_name_suggestions_expected.sol index ef6e933a7d6e..5c0508f1fbaa 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/138_similar_name_suggestions_expected.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/138_similar_name_suggestions_expected.sol @@ -3,4 +3,4 @@ contract c { function g() public { fun(); } } // ---- -// DeclarationError: (69-72): Undeclared identifier. Did you mean "func"? +// DeclarationError 7576: (69-72): Undeclared identifier. Did you mean "func"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/139_no_name_suggestion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/139_no_name_suggestion.sol index 40827dcad5fa..c3619934e954 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/139_no_name_suggestion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/139_no_name_suggestion.sol @@ -2,4 +2,4 @@ contract c { function g() public { fun(); } } // ---- -// DeclarationError: (39-42): Undeclared identifier. +// DeclarationError 7576: (39-42): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/140_multiple_similar_suggestions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/140_multiple_similar_suggestions.sol index 34b4604d44b4..aa7bc7b5dc70 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/140_multiple_similar_suggestions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/140_multiple_similar_suggestions.sol @@ -8,4 +8,4 @@ contract c { } } // ---- -// DeclarationError: (151-155): Undeclared identifier. Did you mean "var1", "var2", "var3", "var4" or "var5"? +// DeclarationError 7576: (151-155): Undeclared identifier. Did you mean "var1", "var2", "var3", "var4" or "var5"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/141_multiple_scopes_suggestions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/141_multiple_scopes_suggestions.sol index f9471146582b..e71f3bd1709e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/141_multiple_scopes_suggestions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/141_multiple_scopes_suggestions.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// DeclarationError: (101-105): Undeclared identifier. Did you mean "log8", "log9", "log0", "log1", "log2", "log3" or "log4"? +// DeclarationError 7576: (101-105): Undeclared identifier. Did you mean "log8", "log9", "log0", "log1", "log2", "log3" or "log4"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/142_inheritence_suggestions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/142_inheritence_suggestions.sol index 4231e1bddbba..a7533abbec6b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/142_inheritence_suggestions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/142_inheritence_suggestions.sol @@ -5,4 +5,4 @@ contract c is a { } } // ---- -// DeclarationError: (105-108): Undeclared identifier. Did you mean "func"? +// DeclarationError 7576: (105-108): Undeclared identifier. Did you mean "func"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/143_no_spurious_identifier_suggestions_with_submatch.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/143_no_spurious_identifier_suggestions_with_submatch.sol index db9f07c68090..4a97864cda34 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/143_no_spurious_identifier_suggestions_with_submatch.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/143_no_spurious_identifier_suggestions_with_submatch.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// DeclarationError: (78-83): Undeclared identifier. +// DeclarationError 7576: (78-83): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/144_no_spurious_identifier_suggestions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/144_no_spurious_identifier_suggestions.sol index 2316cb3d34be..f2e4406655f6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/144_no_spurious_identifier_suggestions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/144_no_spurious_identifier_suggestions.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// DeclarationError: (78-79): Undeclared identifier. +// DeclarationError 7576: (78-79): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/145_external_base_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/145_external_base_visibility.sol index e1d4368e12a5..3892fd8ad895 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/145_external_base_visibility.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/145_external_base_visibility.sol @@ -5,4 +5,4 @@ contract derived is base { function g() public { base.f(); } } // ---- -// TypeError: (100-108): Cannot call function via contract type name. +// TypeError 3419: (100-108): Cannot call function via contract type name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/148_external_argument_delete.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/148_external_argument_delete.sol index 3955023ea9ef..98a80765c890 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/148_external_argument_delete.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/148_external_argument_delete.sol @@ -2,4 +2,4 @@ contract c { function f(uint a) external { delete a; } } // ---- -// Warning: (17-58): Function state mutability can be restricted to pure +// Warning 2018: (17-58): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol index 1c1513e89911..284f85341d73 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol @@ -5,4 +5,4 @@ contract Bike is Vehicle { function f(bytes calldata) override external returns (uint256 r) {r = 42;} } // ---- -// Warning: (23-95): Function state mutability can be restricted to pure +// Warning 2018: (23-95): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol index 2d653805ba1b..779c4a0029f1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol @@ -2,5 +2,5 @@ contract c { function f(uint a) public { uint8[a] x; } } // ---- -// TypeError: (51-52): Invalid array length, expected integer literal or constant expression. -// TypeError: (45-55): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 5462: (51-52): Invalid array length, expected integer literal or constant expression. +// TypeError 6651: (45-55): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol index 3d21f42a7b74..627f188fdb2e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol @@ -2,5 +2,5 @@ contract c { function f(uint a) public { uint8[-1] x; } } // ---- -// TypeError: (51-53): Array with negative length specified. -// TypeError: (45-56): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 3658: (51-53): Array with negative length specified. +// TypeError 6651: (45-56): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/152_array_copy_with_different_types1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/152_array_copy_with_different_types1.sol index a0e71847ff2f..1a5036d050a1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/152_array_copy_with_different_types1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/152_array_copy_with_different_types1.sol @@ -4,4 +4,4 @@ contract c { function f() public { b = a; } } // ---- -// TypeError: (70-71): Type bytes storage ref is not implicitly convertible to expected type uint256[] storage ref. +// TypeError 7407: (70-71): Type bytes storage ref is not implicitly convertible to expected type uint256[] storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/153_array_copy_with_different_types2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/153_array_copy_with_different_types2.sol index 8d1cb1ef4ef9..7e4cc6f40436 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/153_array_copy_with_different_types2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/153_array_copy_with_different_types2.sol @@ -4,4 +4,4 @@ contract c { function f() public { b = a; } } // ---- -// TypeError: (74-75): Type uint32[] storage ref is not implicitly convertible to expected type uint8[] storage ref. +// TypeError 7407: (74-75): Type uint32[] storage ref is not implicitly convertible to expected type uint8[] storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/156_array_copy_with_different_types_dynamic_static.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/156_array_copy_with_different_types_dynamic_static.sol index 90aa53a0da64..ee26931cfed3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/156_array_copy_with_different_types_dynamic_static.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/156_array_copy_with_different_types_dynamic_static.sol @@ -4,4 +4,4 @@ contract c { function f() public { b = a; } } // ---- -// TypeError: (73-74): Type uint256[] storage ref is not implicitly convertible to expected type uint256[80] storage ref. +// TypeError 7407: (73-74): Type uint256[] storage ref is not implicitly convertible to expected type uint256[80] storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/157_array_of_undeclared_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/157_array_of_undeclared_type.sol index 1409db5e18d5..09c7654d1cd5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/157_array_of_undeclared_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/157_array_of_undeclared_type.sol @@ -2,4 +2,4 @@ contract c { a[] public foo; } // ---- -// DeclarationError: (17-18): Identifier not found or not unique. +// DeclarationError 7920: (17-18): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/158_storage_variable_initialization_with_incorrect_type_int.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/158_storage_variable_initialization_with_incorrect_type_int.sol index b1ef153e8514..f2c36a00a9d5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/158_storage_variable_initialization_with_incorrect_type_int.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/158_storage_variable_initialization_with_incorrect_type_int.sol @@ -2,4 +2,4 @@ contract c { uint8 a = 1000; } // ---- -// TypeError: (27-31): Type int_const 1000 is not implicitly convertible to expected type uint8. +// TypeError 7407: (27-31): Type int_const 1000 is not implicitly convertible to expected type uint8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/159_storage_variable_initialization_with_incorrect_type_string.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/159_storage_variable_initialization_with_incorrect_type_string.sol index 75736d9887b8..d907273f4b8d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/159_storage_variable_initialization_with_incorrect_type_string.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/159_storage_variable_initialization_with_incorrect_type_string.sol @@ -2,4 +2,4 @@ contract c { uint a = "abc"; } // ---- -// TypeError: (26-31): Type literal_string "abc" is not implicitly convertible to expected type uint256. +// TypeError 7407: (26-31): Type literal_string "abc" is not implicitly convertible to expected type 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 9977c839c392..ced9fac34d70 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 @@ -3,5 +3,5 @@ contract c { function f() public { byte a = arr[0];} } // ---- -// Warning: (54-60): Unused local variable. -// Warning: (32-71): Function state mutability can be restricted to view +// Warning 2072: (54-60): Unused local variable. +// Warning 2018: (32-71): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/164_assigning_value_to_const_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/164_assigning_value_to_const_variable.sol index 4e543e70d4ab..cd71f3287bbd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/164_assigning_value_to_const_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/164_assigning_value_to_const_variable.sol @@ -3,4 +3,4 @@ contract Foo { uint constant x = 56; } // ---- -// TypeError: (48-49): Cannot assign to a constant variable. +// TypeError 6520: (48-49): Cannot assign to a constant variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/165_assigning_state_to_const_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/165_assigning_state_to_const_variable.sol index 0de15dfb1c22..247b08bcf6c2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/165_assigning_state_to_const_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/165_assigning_state_to_const_variable.sol @@ -2,4 +2,4 @@ contract C { address constant x = msg.sender; } // ---- -// TypeError: (38-48): Initial value for constant variable has to be compile-time constant. +// TypeError 8349: (38-48): Initial value for constant variable has to be compile-time constant. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/167_constant_string_literal_disallows_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/167_constant_string_literal_disallows_assignment.sol index 3f19ea3b201f..4926c394aa3c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/167_constant_string_literal_disallows_assignment.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/167_constant_string_literal_disallows_assignment.sol @@ -7,4 +7,4 @@ contract Test { } } // ---- -// TypeError: (261-265): Index access for string is not possible. +// TypeError 9961: (261-265): Index access for string is not possible. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/171_assignment_to_const_array_vars.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/171_assignment_to_const_array_vars.sol index b9e9aa7aeb76..81b9eab8a717 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/171_assignment_to_const_array_vars.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/171_assignment_to_const_array_vars.sol @@ -2,4 +2,4 @@ contract C { uint[3] constant x = [uint(1), 2, 3]; } // ---- -// TypeError: (17-53): Constants of non-value type not yet implemented. +// TypeError 9259: (17-53): Constants of non-value type not yet implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/173_constant_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/173_constant_struct.sol index 07bf0439cb85..d32dd2768fb7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/173_constant_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/173_constant_struct.sol @@ -3,4 +3,4 @@ contract C { S constant x = S(5, new uint[](4)); } // ---- -// TypeError: (52-86): Constants of non-value type not yet implemented. +// TypeError 9259: (52-86): Constants of non-value type not yet implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/175_uninitialized_const_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/175_uninitialized_const_variable.sol index 13496d8b9ca0..6fba36420290 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/175_uninitialized_const_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/175_uninitialized_const_variable.sol @@ -2,4 +2,4 @@ contract Foo { uint constant y; } // ---- -// TypeError: (19-34): Uninitialized "constant" variable. +// TypeError 4266: (19-34): Uninitialized "constant" variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/176_overloaded_function_cannot_resolve.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/176_overloaded_function_cannot_resolve.sol index bcf259480674..1d10d3e78938 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/176_overloaded_function_cannot_resolve.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/176_overloaded_function_cannot_resolve.sol @@ -4,4 +4,4 @@ contract test { function g() public returns (uint) { return f(3, 5); } } // ---- -// TypeError: (176-177): No matching declaration found after argument-dependent lookup. +// TypeError 9322: (176-177): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/177_ambiguous_overloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/177_ambiguous_overloaded_function.sol index 759e02f216bd..52cdf1737289 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/177_ambiguous_overloaded_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/177_ambiguous_overloaded_function.sol @@ -5,4 +5,4 @@ contract test { function g() public returns (uint) { return f(1); } } // ---- -// TypeError: (271-272): No unique declaration found after argument-dependent lookup. +// TypeError 4487: (271-272): No unique declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol index 07fc1c439a97..ec9415dbbd84 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol @@ -3,4 +3,4 @@ contract test { function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); } } // ---- -// Warning: (20-78): Function state mutability can be restricted to pure +// Warning 2018: (20-78): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol index 9ed864f14918..ab57704b5cea 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol @@ -4,4 +4,4 @@ contract test { function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); } } // ---- -// TypeError: (208-209): No matching declaration found after variable lookup. +// TypeError 2144: (208-209): No matching declaration found after variable lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/180_external_types_clash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/180_external_types_clash.sol index 91ddcd9bc610..c4d650a2b8e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/180_external_types_clash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/180_external_types_clash.sol @@ -6,4 +6,4 @@ contract test is base { function f(uint8 a) public { } } // ---- -// TypeError: (37-61): Function overload clash during conversion to external types for arguments. +// TypeError 9914: (37-61): Function overload clash during conversion to external types for arguments. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/181_override_changes_return_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/181_override_changes_return_types.sol index 10b850ee0390..9a051bd51ef6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/181_override_changes_return_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/181_override_changes_return_types.sol @@ -5,4 +5,4 @@ contract test is base { function f(uint a) public override returns (uint8) { } } // ---- -// TypeError: (103-157): Overriding function return types differ. +// TypeError 4822: (103-157): Overriding function return types differ. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol index 6f0c7df79c6f..062f2eb2407f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol @@ -3,4 +3,4 @@ contract C { function test(uint a) external {} } // ---- -// DeclarationError: (17-66): Function with same name and arguments defined twice. +// DeclarationError 1686: (17-66): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol index 5440b4255ecb..3cf3361f3bdb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol @@ -2,4 +2,4 @@ contract C { string s = "\xa0\x00"; } // ---- -// TypeError: (28-38): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref. +// TypeError 7407: (28-38): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol index 0f67460fb1f7..b9a8c5279f96 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol @@ -2,4 +2,4 @@ contract C { string s = string("\xa0\x00"); } // ---- -// TypeError: (28-46): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 0)" to "string memory". +// TypeError 9640: (28-46): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 0)" to "string memory". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol index 9d51e06b32dc..e71f53b7f651 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol @@ -3,4 +3,4 @@ contract C { function f() public { bytes1 a = s[2]; } } // ---- -// TypeError: (64-68): Index access for string is not possible. +// TypeError 9961: (64-68): Index access for string is not possible. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol index 845b915667df..041b3fd6c09a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol @@ -3,4 +3,4 @@ contract C { function f() public { uint a = s.length; } } // ---- -// TypeError: (62-70): Member "length" not found or not visible after argument-dependent lookup in string storage ref. +// TypeError 9582: (62-70): Member "length" not found or not visible after argument-dependent lookup in string storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/190_negative_integers_to_signed_out_of_bound.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/190_negative_integers_to_signed_out_of_bound.sol index 2e8503af4eaa..f56a4fcd451a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/190_negative_integers_to_signed_out_of_bound.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/190_negative_integers_to_signed_out_of_bound.sol @@ -2,4 +2,4 @@ contract test { int8 public i = -129; } // ---- -// TypeError: (36-40): Type int_const -129 is not implicitly convertible to expected type int8. +// TypeError 7407: (36-40): Type int_const -129 is not implicitly convertible to expected type int8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/192_positive_integers_to_signed_out_of_bound.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/192_positive_integers_to_signed_out_of_bound.sol index d56045c2f607..f62c51cdfaed 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/192_positive_integers_to_signed_out_of_bound.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/192_positive_integers_to_signed_out_of_bound.sol @@ -2,4 +2,4 @@ contract test { int8 public j = 128; } // ---- -// TypeError: (36-39): Type int_const 128 is not implicitly convertible to expected type int8. +// TypeError 7407: (36-39): Type int_const 128 is not implicitly convertible to expected type int8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/194_negative_integers_to_unsigned.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/194_negative_integers_to_unsigned.sol index 3702f09babe0..0d04e87ea9b7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/194_negative_integers_to_unsigned.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/194_negative_integers_to_unsigned.sol @@ -2,4 +2,4 @@ contract test { uint8 public x = -1; } // ---- -// TypeError: (37-39): Type int_const -1 is not implicitly convertible to expected type uint8. +// TypeError 7407: (37-39): Type int_const -1 is not implicitly convertible to expected type uint8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/195_positive_integers_to_unsigned_out_of_bound.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/195_positive_integers_to_unsigned_out_of_bound.sol index 812162296df0..0b5942cfb058 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/195_positive_integers_to_unsigned_out_of_bound.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/195_positive_integers_to_unsigned_out_of_bound.sol @@ -2,4 +2,4 @@ contract test { uint8 public x = 700; } // ---- -// TypeError: (37-40): Type int_const 700 is not implicitly convertible to expected type uint8. +// TypeError 7407: (37-40): Type int_const 700 is not implicitly convertible to expected type uint8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol index 2a51e9a6d2d1..5b19505f0968 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol @@ -1,3 +1,3 @@ contract test { fallback() external { uint x = 1; uint y = 2; x || y; } } // ---- -// TypeError: (62-68): Operator || not compatible with types uint256 and uint256 +// TypeError 2271: (62-68): Operator || not compatible with types uint256 and uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol index 6ea90e77fd25..8981af1b1326 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol @@ -1,3 +1,3 @@ contract test { fallback() external { uint x = 1; uint y = 2; x && y; } } // ---- -// TypeError: (62-68): Operator && not compatible with types uint256 and uint256 +// TypeError 2271: (62-68): Operator && not compatible with types uint256 and uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol index ab5f5576c2f2..3c8fd4fc29ec 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol @@ -1,3 +1,3 @@ contract test { fallback() external { uint x = 1; !x; } } // ---- -// TypeError: (50-52): Unary operator ! cannot be applied to type uint256 +// TypeError 4907: (50-52): Unary operator ! cannot be applied to type uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol index ebdc122c60b9..cabe9aa13c26 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol @@ -1,3 +1,3 @@ contract test { fallback() external { uint x = 3; int y = -4; x ** y; } } // ---- -// TypeError: (62-68): Operator ** not compatible with types uint256 and int256. Exponentiation power is not allowed to be a signed integer type. +// TypeError 2271: (62-68): Operator ** not compatible with types uint256 and int256. Exponentiation power is not allowed to be a signed integer type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol index 73580e599f9e..17508ed8d870 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol @@ -3,6 +3,6 @@ contract test { function h() public { uint8 x = 3; int16 y = 4; x ** y; } } // ---- -// TypeError: (64-70): Operator ** not compatible with types int256 and int256. Exponentiation power is not allowed to be a signed integer type. -// TypeError: (126-132): Operator ** not compatible with types uint8 and int16. Exponentiation power is not allowed to be a signed integer type. -// Warning: (126-132): The result type of the exponentiation operation is equal to the type of the first operand (uint8) ignoring the (larger) type of the second operand (int16) which might be unexpected. Silence this warning by either converting the first or the second operand to the type of the other. +// TypeError 2271: (64-70): Operator ** not compatible with types int256 and int256. Exponentiation power is not allowed to be a signed integer type. +// TypeError 2271: (126-132): Operator ** not compatible with types uint8 and int16. Exponentiation power is not allowed to be a signed integer type. +// Warning 3149: (126-132): The result type of the exponentiation operation is equal to the type of the first operand (uint8) ignoring the (larger) type of the second operand (int16) which might be unexpected. Silence this warning by either converting the first or the second operand to the type of the other. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol index 3864b2d1b4a5..b1f63003f22c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol @@ -1,3 +1,3 @@ contract test { bytes a; bytes b; fallback() external { a == b; } } // ---- -// TypeError: (56-62): Operator == not compatible with types bytes storage ref and bytes storage ref +// TypeError 2271: (56-62): Operator == not compatible with types bytes storage ref and bytes storage ref diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol index f867d6f3c375..cdb7aeb01a96 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (79-85): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref +// TypeError 2271: (79-85): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol index c56a57c496e9..f0e0f8b39268 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol @@ -2,4 +2,4 @@ contract C { function f(uint[] storage a) external {} } // ---- -// TypeError: (28-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. +// TypeError 6651: (28-44): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol index cd2d2f2fcaab..b60ba189646c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-77): Data location must be "storage" for variable, but "memory" was given. +// TypeError 6651: (47-77): Data location must be "storage" for variable, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol index cf303772061c..3d89796c4c72 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (128-129): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer. +// TypeError 7407: (128-129): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/209_storage_assign_to_different_local_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/209_storage_assign_to_different_local_variable.sol index aabdcd8808f4..aa6d55916676 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/209_storage_assign_to_different_local_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/209_storage_assign_to_different_local_variable.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// TypeError: (163-164): Type uint8[] storage pointer is not implicitly convertible to expected type uint256[] storage pointer. +// TypeError 7407: (163-164): Type uint8[] storage pointer is not implicitly convertible to expected type uint256[] storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/210_uninitialized_mapping_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/210_uninitialized_mapping_variable.sol index 0547ace1dd01..bfa56208cb23 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/210_uninitialized_mapping_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/210_uninitialized_mapping_variable.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (47-78): Uninitialized mapping. Mappings cannot be created dynamically, you have to assign them from a state variable. +// TypeError 4182: (47-78): Uninitialized mapping. Mappings cannot be created dynamically, you have to assign them from a state variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol index c43dbad6d0b8..16ac9ac1caad 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (95-96): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (95-96): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol index 7a6fb1c7ceb2..b1b43c6317e8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer +// TypeError 9767: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/215_function_argument_mem_to_storage.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/215_function_argument_mem_to_storage.sol index 984b81b1471d..140ae88884e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/215_function_argument_mem_to_storage.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/215_function_argument_mem_to_storage.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (113-114): Invalid type for argument in function call. Invalid implicit conversion from uint256[] memory to uint256[] storage pointer requested. +// TypeError 9553: (113-114): Invalid type for argument in function call. Invalid implicit conversion from uint256[] memory to uint256[] storage pointer requested. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/217_mem_array_assignment_changes_base_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/217_mem_array_assignment_changes_base_type.sol index 3755b9352bf9..e9a1b9b48dbf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/217_mem_array_assignment_changes_base_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/217_mem_array_assignment_changes_base_type.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (256-275): Type uint8[] memory is not implicitly convertible to expected type uint256[] memory. +// TypeError 9574: (256-275): Type uint8[] memory is not implicitly convertible to expected type uint256[] memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/219_memory_arrays_not_resizeable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/219_memory_arrays_not_resizeable.sol index dbba54aba5db..c4ab822d3666 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/219_memory_arrays_not_resizeable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/219_memory_arrays_not_resizeable.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (72-80): Member "length" is read-only and cannot be used to resize arrays. +// TypeError 7567: (72-80): Member "length" is read-only and cannot be used to resize arrays. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/220_struct_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/220_struct_constructor.sol index 50585c110dd3..16c8b3cb5b09 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/220_struct_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/220_struct_constructor.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// Warning: (80-90): Unused local variable. -// Warning: (50-110): Function state mutability can be restricted to pure +// Warning 2072: (80-90): Unused local variable. +// Warning 2018: (50-110): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/221_struct_constructor_nested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/221_struct_constructor_nested.sol index 0022268251f7..9f6a1158614f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/221_struct_constructor_nested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/221_struct_constructor_nested.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// Warning: (153-163): Unused local variable. -// Warning: (96-190): Function state mutability can be restricted to pure +// Warning 2072: (153-163): Unused local variable. +// Warning 2018: (96-190): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/222_struct_named_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/222_struct_named_constructor.sol index 8ab8ee460e7f..a854664e3b7e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/222_struct_named_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/222_struct_named_constructor.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// Warning: (80-90): Unused local variable. -// Warning: (50-118): Function state mutability can be restricted to pure +// Warning 2072: (80-90): Unused local variable. +// Warning 2018: (50-118): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/223_literal_strings.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/223_literal_strings.sol index 1dadcc4d6717..ec2fe3d692bb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/223_literal_strings.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/223_literal_strings.sol @@ -6,4 +6,4 @@ contract Foo { } } // ---- -// Warning: (19-238): Function state mutability can be restricted to pure +// Warning 2018: (19-238): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/225_inheriting_from_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/225_inheriting_from_library.sol index eff7bf866cb3..ed555b3c4280 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/225_inheriting_from_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/225_inheriting_from_library.sol @@ -1,4 +1,4 @@ library Lib {} contract Test is Lib {} // ---- -// TypeError: (32-35): Libraries cannot be inherited from. +// TypeError 2571: (32-35): Libraries cannot be inherited from. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/226_inheriting_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/226_inheriting_library.sol index 2d601c1cc41c..964c22ad854f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/226_inheriting_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/226_inheriting_library.sol @@ -1,4 +1,4 @@ contract Test {} library Lib is Test {} // ---- -// TypeError: (17-39): Library is not allowed to inherit. +// TypeError 9469: (17-39): Library is not allowed to inherit. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/227_library_having_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/227_library_having_variables.sol index 804ef3d38ff7..b59e0d68b75f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/227_library_having_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/227_library_having_variables.sol @@ -1,3 +1,3 @@ library Lib { uint x; } // ---- -// TypeError: (14-20): Library cannot have non-constant state variables +// TypeError 9957: (14-20): Library cannot have non-constant state variables diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/229_call_to_library_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/229_call_to_library_function.sol index 4846bb0f62b8..8b389282aad7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/229_call_to_library_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/229_call_to_library_function.sol @@ -8,4 +8,4 @@ contract Test { } } // ---- -// TypeError: (53-100): Library functions must be implemented if declared. +// TypeError 9231: (53-100): Library functions must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol index 8624b0b05a58..25f742496fa2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol @@ -2,4 +2,4 @@ contract Test { function f() public { Test x = new Test(); } } // ---- -// TypeError: (51-59): Circular reference for contract creation (cannot create instance of derived or same contract). +// TypeError 4579: (51-59): Circular reference for contract creation (cannot create instance of derived or same contract). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/231_array_out_of_bound_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/231_array_out_of_bound_access.sol index 7230a0a638f5..d2ce419ba2ea 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/231_array_out_of_bound_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/231_array_out_of_bound_access.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (90-102): Out of bounds array access. +// TypeError 3383: (90-102): Out of bounds array access. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol index be57144ee39f..077d09cbdf28 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol @@ -2,4 +2,4 @@ contract C { function f() public { string storage x = "abc"; } } // ---- -// TypeError: (39-63): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. +// TypeError 9574: (39-63): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol index 68e3b2c44861..a092c643d437 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (105-106): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. +// TypeError 3464: (105-106): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/235_abi_encode_with_large_integer_constant.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/235_abi_encode_with_large_integer_constant.sol index fd9717f1a858..545b8cf27e6c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/235_abi_encode_with_large_integer_constant.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/235_abi_encode_with_large_integer_constant.sol @@ -2,4 +2,4 @@ contract C { function f() pure public { abi.encode(2**500); } } // ---- -// TypeError: (55-61): Invalid rational number (too large or division by zero). +// TypeError 8009: (55-61): Invalid rational number (too large or division by zero). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/236_cyclic_binary_dependency.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/236_cyclic_binary_dependency.sol index c287507d79e2..c39812aa6283 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/236_cyclic_binary_dependency.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/236_cyclic_binary_dependency.sol @@ -2,4 +2,4 @@ contract A { function f() public { new B(); } } contract B { function f() public { new C(); } } contract C { function f() public { new A(); } } // ---- -// TypeError: (131-136): Circular reference for contract creation (cannot create instance of derived or same contract). +// TypeError 4579: (131-136): Circular reference for contract creation (cannot create instance of derived or same contract). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/237_cyclic_binary_dependency_via_inheritance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/237_cyclic_binary_dependency_via_inheritance.sol index 00ee536ec356..9851f1a74d07 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/237_cyclic_binary_dependency_via_inheritance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/237_cyclic_binary_dependency_via_inheritance.sol @@ -2,4 +2,4 @@ contract A is B { } contract B { function f() public { new C(); } } contract C { function f() public { new A(); } } // ---- -// TypeError: (14-15): Definition of base has to precede definition of derived contract +// TypeError 2449: (14-15): Definition of base has to precede definition of derived contract diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/245_tuples_empty_components.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/245_tuples_empty_components.sol index 7815edea4c2e..02bc66fa6946 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/245_tuples_empty_components.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/245_tuples_empty_components.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-53): Tuple component cannot be empty. +// TypeError 8381: (47-53): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/252_using_for_not_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/252_using_for_not_library.sol index 4693b27f3ceb..83839f368777 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/252_using_for_not_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/252_using_for_not_library.sol @@ -3,4 +3,4 @@ contract C { using D for uint; } // ---- -// TypeError: (38-39): Library name expected. +// TypeError 4357: (38-39): Library name expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/253_using_for_function_exists.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/253_using_for_function_exists.sol index 9e570805f8fd..cd86a70ddc02 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/253_using_for_function_exists.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/253_using_for_function_exists.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// Warning: (12-79): Function state mutability can be restricted to pure -// Warning: (121-172): Function state mutability can be restricted to pure +// Warning 2018: (12-79): Function state mutability can be restricted to pure +// Warning 2018: (121-172): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/254_using_for_function_on_int.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/254_using_for_function_on_int.sol index a8e23d0faa43..838118017fcb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/254_using_for_function_on_int.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/254_using_for_function_on_int.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (12-79): Function state mutability can be restricted to pure +// Warning 2018: (12-79): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/258_using_for_mismatch.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/258_using_for_mismatch.sol index c60ee651ee54..87b7f3452845 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/258_using_for_mismatch.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/258_using_for_mismatch.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (177-185): Member "double" not found or not visible after argument-dependent lookup in uint256. +// TypeError 9582: (177-185): Member "double" not found or not visible after argument-dependent lookup in uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/259_using_for_not_used.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/259_using_for_not_used.sol index b11cefbabb9c..abda74579bb0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/259_using_for_not_used.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/259_using_for_not_used.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (305-313): Member "double" not found or not visible after argument-dependent lookup in uint16. +// TypeError 9582: (305-313): Member "double" not found or not visible after argument-dependent lookup in uint16. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/261_using_for_arbitrary_mismatch.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/261_using_for_arbitrary_mismatch.sol index b2b553507149..99aef98a88e8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/261_using_for_arbitrary_mismatch.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/261_using_for_arbitrary_mismatch.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (227-235): Member "double" not found or not visible after argument-dependent lookup in uint256. +// TypeError 9582: (227-235): Member "double" not found or not visible after argument-dependent lookup in uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol index c3cc5232d611..699a0b551ff6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256). -// TypeError: (298-302): Wrong argument count for function call: 1 arguments given but expected 2. +// TypeError 9574: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256). +// TypeError 6160: (298-302): Wrong argument count for function call: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol index 71f43992b374..d808ce24937a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (122-301): Function state mutability can be restricted to pure +// Warning 2018: (122-301): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol index e45e09de8cc5..1102f6ecd983 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (94-117): Type cannot live outside storage. +// TypeError 1164: (94-117): Type cannot live outside storage. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol index c4b2c692e8ac..b7ab47d6e111 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (65-73): Contract or array type expected. +// TypeError 8807: (65-73): Contract or array type expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol index bdf033a309a7..f5e15e220a27 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning: (102-115): Unused local variable. -// Warning: (72-169): Function state mutability can be restricted to pure +// Warning 2072: (102-115): Unused local variable. +// Warning 2018: (72-169): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/279_break_not_in_loop.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/279_break_not_in_loop.sol index 6b88da4439b0..76385a1d0547 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/279_break_not_in_loop.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/279_break_not_in_loop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (69-74): "break" has to be in a "for" or "while" loop. +// SyntaxError 6102: (69-74): "break" has to be in a "for" or "while" loop. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/280_continue_not_in_loop.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/280_continue_not_in_loop.sol index b0e8cda9171e..8da1f34c51e7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/280_continue_not_in_loop.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/280_continue_not_in_loop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (69-77): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (69-77): "continue" has to be in a "for" or "while" loop. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/281_continue_not_in_loop_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/281_continue_not_in_loop_2.sol index 845faf86718e..289e882a623d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/281_continue_not_in_loop_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/281_continue_not_in_loop_2.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// SyntaxError: (88-96): "continue" has to be in a "for" or "while" loop. +// SyntaxError 4123: (88-96): "continue" has to be in a "for" or "while" loop. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol index e4e75e3f294e..78097742df4e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-62): True expression's type bool doesn't match false expression's type uint8. +// TypeError 1080: (47-62): True expression's type bool doesn't match false expression's type uint8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/283_left_value_in_conditional_expression_not_supported_yet.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/283_left_value_in_conditional_expression_not_supported_yet.sol index ef8f99300d5c..2acc4e1f4e67 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/283_left_value_in_conditional_expression_not_supported_yet.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/283_left_value_in_conditional_expression_not_supported_yet.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (80-92): Conditional expression as left value is not supported yet. -// TypeError: (80-92): Expression has to be an lvalue. +// TypeError 2212: (80-92): Conditional expression as left value is not supported yet. +// TypeError 4247: (80-92): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol index 049d9e21e77e..509e559d2f8f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// TypeError: (165-177): True expression's type struct C.s1 memory doesn't match false expression's type struct C.s2 memory. +// TypeError 1080: (165-177): True expression's type struct C.s1 memory doesn't match false expression's type struct C.s2 memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol index 963fb7da6bbc..9846bd656f48 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (106-118): True expression's type function (bool) doesn't match false expression's type function (). +// TypeError 1080: (106-118): True expression's type function (bool) doesn't match false expression's type function (). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol index 8c312624353f..dd1303336402 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError: (139-151): True expression's type enum C.small doesn't match false expression's type enum C.big. +// TypeError 1080: (139-151): True expression's type enum C.small doesn't match false expression's type enum C.big. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol index 8139f3ed9447..b20c872d941f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (121-143): True expression's type mapping(uint8 => uint8) doesn't match false expression's type mapping(uint32 => uint8). +// TypeError 1080: (121-143): True expression's type mapping(uint8 => uint8) doesn't match false expression's type mapping(uint32 => uint8). 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 a92c07f3835d..b3d8aea81020 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol @@ -84,6 +84,6 @@ contract C { } } // ---- -// Warning: (1005-1019): This declaration shadows an existing declaration. -// Warning: (257-642): Function state mutability can be restricted to pure -// Warning: (647-1227): Function state mutability can be restricted to pure +// Warning 2519: (1005-1019): 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 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/289_uint7_and_uintM_as_identifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/289_uint7_and_uintM_as_identifier.sol index 58e84090e0a5..ce35d7ffebdc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/289_uint7_and_uintM_as_identifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/289_uint7_and_uintM_as_identifier.sol @@ -9,4 +9,4 @@ string uintM = "Hello 4 you"; } } // ---- -// Warning: (50-197): Function state mutability can be restricted to pure +// Warning 2018: (50-197): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_1.sol index 0d0a0797ea22..8954a77fe500 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_1.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (50-55): Identifier not found or not unique. +// DeclarationError 7920: (50-55): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_2.sol index b9590a8c8527..2c441c696e4e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_2.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (50-54): Identifier not found or not unique. +// DeclarationError 7920: (50-54): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_3.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_3.sol index 85d4c25bff88..4deb9db9e337 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_3.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_3.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (50-56): Identifier not found or not unique. +// DeclarationError 7920: (50-56): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/291_modifier_is_not_a_valid_typename.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/291_modifier_is_not_a_valid_typename.sol index 2f3143d52501..0c7b80e03a51 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/291_modifier_is_not_a_valid_typename.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/291_modifier_is_not_a_valid_typename.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// TypeError: (77-80): Name has to refer to a struct, enum or contract. +// TypeError 5172: (77-80): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/292_modifier_is_not_a_valid_typename_is_not_fatal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/292_modifier_is_not_a_valid_typename_is_not_fatal.sol index 9187c19d9977..589772a9daf1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/292_modifier_is_not_a_valid_typename_is_not_fatal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/292_modifier_is_not_a_valid_typename_is_not_fatal.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (77-80): Name has to refer to a struct, enum or contract. +// TypeError 5172: (77-80): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/293_function_is_not_a_valid_typename.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/293_function_is_not_a_valid_typename.sol index 390eccd977f5..c1cb83e4705f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/293_function_is_not_a_valid_typename.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/293_function_is_not_a_valid_typename.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (85-88): Name has to refer to a struct, enum or contract. +// TypeError 5172: (85-88): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/294_long_uint_variable_fails.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/294_long_uint_variable_fails.sol index 1e6083205f25..4bb9542a287d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/294_long_uint_variable_fails.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/294_long_uint_variable_fails.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (50-80): Identifier not found or not unique. +// DeclarationError 7920: (50-80): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/295_bytes10abc_is_identifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/295_bytes10abc_is_identifier.sol index 8b65fc652901..33ab20b93625 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/295_bytes10abc_is_identifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/295_bytes10abc_is_identifier.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// Warning: (50-68): Unused local variable. -// Warning: (20-83): Function state mutability can be restricted to pure +// Warning 2072: (50-68): Unused local variable. +// Warning 2018: (20-83): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/296_int10abc_is_identifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/296_int10abc_is_identifier.sol index 2678cfb98504..5550d43b515c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/296_int10abc_is_identifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/296_int10abc_is_identifier.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// Warning: (20-130): Function state mutability can be restricted to pure +// Warning 2018: (20-130): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/297_library_functions_do_not_have_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/297_library_functions_do_not_have_value.sol index 6e6546c99473..5819fb61b308 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/297_library_functions_do_not_have_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/297_library_functions_do_not_have_value.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// TypeError: (87-96): Member "value" is not allowed in delegated calls due to "msg.value" persisting. +// TypeError 8477: (87-96): Member "value" is not allowed in delegated calls due to "msg.value" persisting. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol index ea9e5d0ff164..73b2bf8ab8ec 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol @@ -2,4 +2,4 @@ contract test { fixed0x7 a = .3; } // ---- -// DeclarationError: (20-28): Identifier not found or not unique. +// DeclarationError 7920: (20-28): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/299_invalid_fixed_types_long_invalid_identifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/299_invalid_fixed_types_long_invalid_identifier.sol index 9ce2b1067217..f4502dd69c4f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/299_invalid_fixed_types_long_invalid_identifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/299_invalid_fixed_types_long_invalid_identifier.sol @@ -2,4 +2,4 @@ contract test { fixed99999999999999999999999999999999999999x7 b = 9.5; } // ---- -// DeclarationError: (20-65): Identifier not found or not unique. +// DeclarationError 7920: (20-65): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol index 7c511d2fdff1..57b4aad20790 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol @@ -2,4 +2,4 @@ contract test { fixed7x8 c = 3.12345678; } // ---- -// DeclarationError: (20-28): Identifier not found or not unique. +// DeclarationError 7920: (20-28): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/301_library_instances_cannot_be_used.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/301_library_instances_cannot_be_used.sol index 3eebc792648a..563d14d2ca8b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/301_library_instances_cannot_be_used.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/301_library_instances_cannot_be_used.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// TypeError: (87-90): The type of a variable cannot be a library. -// TypeError: (100-103): Member "l" not found or not visible after argument-dependent lookup in library L. +// TypeError 1273: (87-90): The type of a variable cannot be a library. +// TypeError 9582: (100-103): Member "l" not found or not visible after argument-dependent lookup in library L. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/302_invalid_fixed_type_long.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/302_invalid_fixed_type_long.sol index 126796314890..a337fda9e5a3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/302_invalid_fixed_type_long.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/302_invalid_fixed_type_long.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (50-108): Identifier not found or not unique. +// DeclarationError 7920: (50-108): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol index 6ef5da3bbad2..ba1eb806910d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol @@ -9,4 +9,4 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (20-147): Function state mutability can be restricted to pure +// Warning 2018: (20-147): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol index e046df6bad05..81ad7dbe8ac5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol @@ -7,4 +7,4 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (20-104): Function state mutability can be restricted to pure +// Warning 2018: (20-104): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol index f971dc2998b7..b7642e16a199 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol @@ -7,4 +7,4 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (20-108): Function state mutability can be restricted to pure +// Warning 2018: (20-108): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/306_invalid_int_implicit_conversion_from_fixed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/306_invalid_int_implicit_conversion_from_fixed.sol index c0a56314a032..f4d8479454ef 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/306_invalid_int_implicit_conversion_from_fixed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/306_invalid_int_implicit_conversion_from_fixed.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// TypeError: (73-82): Type fixed128x18 is not implicitly convertible to expected type int256. +// TypeError 9574: (73-82): Type fixed128x18 is not implicitly convertible to expected type int256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol index f635a214d38b..8b401c1ae90a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// SyntaxError: (70-75): Use of unary + is disallowed. +// SyntaxError 9636: (70-75): Use of unary + is disallowed. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol index 295cf4ea4542..148e7e672354 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol @@ -10,5 +10,5 @@ contract test { } } // ---- -// TypeError: (153-250): Type rational_const 9208...(70 digits omitted)...7637 / 1000...(71 digits omitted)...0000 is not implicitly convertible to expected type ufixed256x77, but it can be explicitly converted. -// TypeError: (470-566): Type rational_const -933...(70 digits omitted)...0123 / 1000...(70 digits omitted)...0000 is not implicitly convertible to expected type fixed256x76, but it can be explicitly converted. +// TypeError 5107: (153-250): Type rational_const 9208...(70 digits omitted)...7637 / 1000...(71 digits omitted)...0000 is not implicitly convertible to expected type ufixed256x77, but it can be explicitly converted. +// TypeError 5107: (470-566): Type rational_const -933...(70 digits omitted)...0123 / 1000...(70 digits omitted)...0000 is not implicitly convertible to expected type fixed256x76, but it can be explicitly converted. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol index be6395792b90..1d1e62cf3614 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol @@ -6,4 +6,4 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (20-104): Function state mutability can be restricted to pure +// Warning 2018: (20-104): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/315_fixed_type_invalid_implicit_conversion_size.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/315_fixed_type_invalid_implicit_conversion_size.sol index f045731ac92e..3a492356381f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/315_fixed_type_invalid_implicit_conversion_size.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/315_fixed_type_invalid_implicit_conversion_size.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// TypeError: (75-92): Type ufixed128x18 is not implicitly convertible to expected type ufixed248x8. Too many fractional digits. +// TypeError 9574: (75-92): Type ufixed128x18 is not implicitly convertible to expected type ufixed248x8. Too many fractional digits. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/316_fixed_type_invalid_implicit_conversion_lost_data.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/316_fixed_type_invalid_implicit_conversion_lost_data.sol index 76c0284ed7c3..169363c13e97 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/316_fixed_type_invalid_implicit_conversion_lost_data.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/316_fixed_type_invalid_implicit_conversion_lost_data.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-69): Type rational_const 1 / 3 is not implicitly convertible to expected type ufixed256x1. Try converting to type ufixed256x77 or use an explicit conversion. +// TypeError 4486: (50-69): Type rational_const 1 / 3 is not implicitly convertible to expected type ufixed256x1. Try converting to type ufixed256x77 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol index 46750a5335f9..4899b3d786f7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol @@ -7,4 +7,4 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (20-182): Function state mutability can be restricted to pure +// Warning 2018: (20-182): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol index 5b131e0f6f94..88aad0b8bcd3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// TypeError: (55-58): Array with fractional length specified. -// TypeError: (50-61): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 3208: (55-58): Array with fractional length specified. +// TypeError 6651: (50-61): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol index b11db892d94e..321c43008c97 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/319_invalid_array_declaration_with_signed_fixed_type.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// TypeError: (55-65): Invalid array length, expected integer literal or constant expression. -// TypeError: (50-68): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 5462: (55-65): Invalid array length, expected integer literal or constant expression. +// TypeError 6651: (50-68): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol index a3b8ad1f6aa5..779b6a66e457 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/320_invalid_array_declaration_with_unsigned_fixed_type.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// TypeError: (55-66): Invalid array length, expected integer literal or constant expression. -// TypeError: (50-69): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 5462: (55-66): Invalid array length, expected integer literal or constant expression. +// TypeError 6651: (50-69): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/321_rational_to_bytes_implicit_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/321_rational_to_bytes_implicit_conversion.sol index d209eb76af2b..294ab1877f8b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/321_rational_to_bytes_implicit_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/321_rational_to_bytes_implicit_conversion.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-65): Type rational_const 16 / 5 is not implicitly convertible to expected type bytes32. Try converting to type ufixed8x1 or use an explicit conversion. +// TypeError 4486: (50-65): Type rational_const 16 / 5 is not implicitly convertible to expected type bytes32. Try converting to type ufixed8x1 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/322_fixed_to_bytes_implicit_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/322_fixed_to_bytes_implicit_conversion.sol index 867364812309..fa401dd42d96 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/322_fixed_to_bytes_implicit_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/322_fixed_to_bytes_implicit_conversion.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// TypeError: (74-87): Type fixed128x18 is not implicitly convertible to expected type bytes32. +// TypeError 9574: (74-87): Type fixed128x18 is not implicitly convertible to expected type bytes32. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/327_rational_index_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/327_rational_index_access.sol index 46e5852122fa..635d20392140 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/327_rational_index_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/327_rational_index_access.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// TypeError: (77-79): Type rational_const 1 / 2 is not implicitly convertible to expected type uint256. Try converting to type ufixed8x1 or use an explicit conversion. +// TypeError 2326: (77-79): Type rational_const 1 / 2 is not implicitly convertible to expected type uint256. Try converting to type ufixed8x1 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol index 8582cc0891e1..4dbcb3f206c0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol @@ -12,5 +12,5 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (238-252): This declaration shadows an existing declaration. -// Warning: (20-339): Function state mutability can be restricted to pure +// Warning 2519: (238-252): This declaration shadows an existing declaration. +// Warning 2018: (20-339): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/329_rational_as_exponent_value_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/329_rational_as_exponent_value_signed.sol index b835e309325a..8aa826009141 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/329_rational_as_exponent_value_signed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/329_rational_as_exponent_value_signed.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (60-69): Operator ** not compatible with types int_const 2 and rational_const -11 / 5 +// TypeError 2271: (60-69): Operator ** not compatible with types int_const 2 and rational_const -11 / 5 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/330_rational_as_exponent_value_unsigned.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/330_rational_as_exponent_value_unsigned.sol index 04ddf0fd8deb..29b6f088d428 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/330_rational_as_exponent_value_unsigned.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/330_rational_as_exponent_value_unsigned.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-69): Operator ** not compatible with types int_const 3 and rational_const 5 / 2 +// TypeError 2271: (61-69): Operator ** not compatible with types int_const 3 and rational_const 5 / 2 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/331_rational_as_exponent_half.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/331_rational_as_exponent_half.sol index 4e0894c557cd..95a8120bab78 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/331_rational_as_exponent_half.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/331_rational_as_exponent_half.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-60): Operator ** not compatible with types int_const 2 and rational_const 1 / 2 +// TypeError 2271: (50-60): Operator ** not compatible with types int_const 2 and rational_const 1 / 2 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/332_rational_as_exponent_value_neg_quarter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/332_rational_as_exponent_value_neg_quarter.sol index bc127bf51fce..15d1f18d6b0e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/332_rational_as_exponent_value_neg_quarter.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/332_rational_as_exponent_value_neg_quarter.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-62): Operator ** not compatible with types int_const 42 and rational_const -1 / 4 +// TypeError 2271: (50-62): Operator ** not compatible with types int_const 42 and rational_const -1 / 4 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol index 0fd5f331fb9a..2ba80faab5dd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18 +// TypeError 2271: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol index 03d10f7c029a..36cee8557aed 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18 +// TypeError 2271: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol index 44a6ab5e02cd..a084756e6a56 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-61): Unary operator ~ cannot be applied to type fixed128x18 +// TypeError 4907: (50-61): Unary operator ~ cannot be applied to type fixed128x18 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/339_rational_bitor_binary_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/339_rational_bitor_binary_operation.sol index 29871b04cfdc..5d5cd6a9b2e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/339_rational_bitor_binary_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/339_rational_bitor_binary_operation.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-64): Operator | not compatible with types fixed128x18 and int_const 3 +// TypeError 2271: (50-64): Operator | not compatible with types fixed128x18 and int_const 3 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/340_rational_bitxor_binary_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/340_rational_bitxor_binary_operation.sol index 1fa7f38f8d6a..ee96badae69d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/340_rational_bitxor_binary_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/340_rational_bitxor_binary_operation.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-65): Operator ^ not compatible with types fixed128x18 and int_const 3 +// TypeError 2271: (50-65): Operator ^ not compatible with types fixed128x18 and int_const 3 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/341_rational_bitand_binary_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/341_rational_bitand_binary_operation.sol index 5a433a614838..da836f31a7a5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/341_rational_bitand_binary_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/341_rational_bitand_binary_operation.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-65): Operator & not compatible with types fixed128x18 and int_const 3 +// TypeError 2271: (50-65): Operator & not compatible with types fixed128x18 and int_const 3 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/342_missing_bool_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/342_missing_bool_conversion.sol index 5546a099a4a7..6308f849fb4b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/342_missing_bool_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/342_missing_bool_conversion.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (20-75): Function state mutability can be restricted to pure +// Warning 2018: (20-75): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol index 3b7c273bd74a..ad7b34fd76ec 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol @@ -5,5 +5,5 @@ contract test { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (50-58): Unused local variable. -// Warning: (20-89): Function state mutability can be restricted to pure +// Warning 2072: (50-58): Unused local variable. +// Warning 2018: (20-89): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/344_one_divided_by_three_integer_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/344_one_divided_by_three_integer_conversion.sol index ffc168eb1e10..8a4213299a4c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/344_one_divided_by_three_integer_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/344_one_divided_by_three_integer_conversion.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (50-62): Type rational_const 1 / 3 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x77 or use an explicit conversion. +// TypeError 4486: (50-62): Type rational_const 1 / 3 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x77 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/346_unused_return_value_send.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/346_unused_return_value_send.sol index 929e54b2050e..b5a716d65e84 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/346_unused_return_value_send.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/346_unused_return_value_send.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (50-71): Failure condition of 'send' ignored. Consider using 'transfer' instead. +// Warning 5878: (50-71): Failure condition of 'send' ignored. Consider using 'transfer' instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/347_unused_return_value_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/347_unused_return_value_call.sol index 994a5bdf6f31..9eee174cc6d3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/347_unused_return_value_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/347_unused_return_value_call.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (50-75): Return value of low-level calls not used. +// Warning 9302: (50-75): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol index dffa55fdfff9..13beb232afef 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol @@ -5,6 +5,6 @@ contract test { } } // ---- -// Warning: (50-74): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (50-84): Return value of low-level calls not used. -// Warning: (94-129): Return value of low-level calls not used. +// Warning 1621: (50-74): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 9302: (50-84): Return value of low-level calls not used. +// Warning 9302: (94-129): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/350_unused_return_value_delegatecall.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/350_unused_return_value_delegatecall.sol index 701b6e7db6cd..def88fbdca05 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/350_unused_return_value_delegatecall.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/350_unused_return_value_delegatecall.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (50-83): Return value of low-level calls not used. +// Warning 9302: (50-83): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/351_callcode_deprecated.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/351_callcode_deprecated.sol index 554f2e11ed65..dbf81c237346 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/351_callcode_deprecated.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/351_callcode_deprecated.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (55-77): "callcode" has been deprecated in favour of "delegatecall". +// TypeError 2256: (55-77): "callcode" has been deprecated in favour of "delegatecall". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/354_payable_in_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/354_payable_in_library.sol index 410842cbc0e5..119bae11173f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/354_payable_in_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/354_payable_in_library.sol @@ -2,4 +2,4 @@ library test { function f() payable public {} } // ---- -// TypeError: (19-49): Library functions cannot be payable. +// TypeError 7708: (19-49): Library functions cannot be payable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol index f6ccf6b66f79..2bf491b5d8df 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol @@ -2,4 +2,4 @@ contract test { function f() payable internal {} } // ---- -// TypeError: (20-52): Internal functions cannot be payable. +// TypeError 5587: (20-52): Internal functions cannot be payable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol index 7b00ea6c396e..fcc0dba35402 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol @@ -2,4 +2,4 @@ contract test { function f() payable private {} } // ---- -// TypeError: (20-51): Internal functions cannot be payable. +// TypeError 5587: (20-51): Internal functions cannot be payable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/358_illegal_override_payable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/358_illegal_override_payable.sol index 28aa94ad291a..60b0a90edcb3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/358_illegal_override_payable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/358_illegal_override_payable.sol @@ -1,5 +1,5 @@ contract B { function f() payable virtual public {} } contract C is B { function f() public {} } // ---- -// TypeError: (72-94): Overriding function is missing "override" specifier. -// TypeError: (72-94): Overriding function changes state mutability from "payable" to "nonpayable". +// TypeError 9456: (72-94): Overriding function is missing "override" specifier. +// TypeError 6959: (72-94): Overriding function changes state mutability from "payable" to "nonpayable". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/359_illegal_override_payable_nonpayable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/359_illegal_override_payable_nonpayable.sol index 829efbcdeaf3..c2a5857b76d4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/359_illegal_override_payable_nonpayable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/359_illegal_override_payable_nonpayable.sol @@ -1,5 +1,5 @@ contract B { function f() virtual public {} } contract C is B { function f() payable public {} } // ---- -// TypeError: (64-94): Overriding function is missing "override" specifier. -// TypeError: (64-94): Overriding function changes state mutability from "nonpayable" to "payable". +// TypeError 9456: (64-94): Overriding function is missing "override" specifier. +// TypeError 6959: (64-94): Overriding function changes state mutability from "nonpayable" to "payable". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/360_function_variable_mixin.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/360_function_variable_mixin.sol index 583e0d46ea3d..2107aafd88d3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/360_function_variable_mixin.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/360_function_variable_mixin.sol @@ -9,4 +9,4 @@ contract attr_func is attribute, func { function checkOk() public returns (bool) { return ok(); } } // ---- -// DeclarationError: (121-173): Identifier already declared. +// DeclarationError 9097: (121-173): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol index a3c5a5f3085e..19068fab96b1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/361_calling_payable.sol @@ -7,5 +7,5 @@ contract test { function i() public { r.pay.value(10)(); } } // ---- -// Warning: (160-186): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (303-314): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (160-186): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (303-314): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/362_calling_nonpayable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/362_calling_nonpayable.sol index 6f5706446796..20f0c65668c2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/362_calling_nonpayable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/362_calling_nonpayable.sol @@ -4,5 +4,5 @@ contract test { function g() public { (new receiver()).nopay.value(10)(); } } // ---- -// TypeError: (91-124): Cannot set option "value" on a non-payable function type. -// TypeError: (156-184): Member "value" is only available for payable functions. +// TypeError 7006: (91-124): Cannot set option "value" on a non-payable function type. +// TypeError 8820: (156-184): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol index 944bda0d9ecf..f6760317f85e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol @@ -8,4 +8,4 @@ contract D { } } // ---- -// TypeError: (106-119): Constructor for contract C must be payable for member "value" to be available. +// TypeError 8827: (106-119): Constructor for contract C must be payable for member "value" to be available. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol index cc2839cd2992..8fe564bba71c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol @@ -3,4 +3,4 @@ contract test { constructor(uint k) public { S[k]; } } // ---- -// TypeError: (76-77): Integer constant expected. +// TypeError 3940: (76-77): Integer constant expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/367_using_directive_for_missing_selftype.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/367_using_directive_for_missing_selftype.sol index 3d9bc3fc3614..1a2c2969bb62 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/367_using_directive_for_missing_selftype.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/367_using_directive_for_missing_selftype.sol @@ -11,4 +11,4 @@ contract A { } } // ---- -// TypeError: (137-140): Member "b" not found or not visible after argument-dependent lookup in bytes memory. +// TypeError 9582: (137-140): Member "b" not found or not visible after argument-dependent lookup in bytes memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/368_shift_constant_left_negative_rvalue.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/368_shift_constant_left_negative_rvalue.sol index 9c941a68df01..fcd56bc0d2ac 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/368_shift_constant_left_negative_rvalue.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/368_shift_constant_left_negative_rvalue.sol @@ -2,4 +2,4 @@ contract C { uint public a = 0x42 << -8; } // ---- -// TypeError: (33-43): Operator << not compatible with types int_const 66 and int_const -8 +// TypeError 2271: (33-43): Operator << not compatible with types int_const 66 and int_const -8 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/369_shift_constant_right_negative_rvalue.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/369_shift_constant_right_negative_rvalue.sol index 55f385c67f0c..344dce513eb5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/369_shift_constant_right_negative_rvalue.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/369_shift_constant_right_negative_rvalue.sol @@ -2,4 +2,4 @@ contract C { uint public a = 0x42 >> -8; } // ---- -// TypeError: (33-43): Operator >> not compatible with types int_const 66 and int_const -8 +// TypeError 2271: (33-43): Operator >> not compatible with types int_const 66 and int_const -8 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/370_shift_constant_left_excessive_rvalue.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/370_shift_constant_left_excessive_rvalue.sol index e23c7a84a6f0..1809a677b75e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/370_shift_constant_left_excessive_rvalue.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/370_shift_constant_left_excessive_rvalue.sol @@ -2,4 +2,4 @@ contract C { uint public a = 0x42 << 0x100000000; } // ---- -// TypeError: (33-52): Operator << not compatible with types int_const 66 and int_const 4294967296 +// TypeError 2271: (33-52): Operator << not compatible with types int_const 66 and int_const 4294967296 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/371_shift_constant_right_excessive_rvalue.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/371_shift_constant_right_excessive_rvalue.sol index 5533644f3afb..858f547ddb55 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/371_shift_constant_right_excessive_rvalue.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/371_shift_constant_right_excessive_rvalue.sol @@ -2,4 +2,4 @@ contract C { uint public a = 0x42 >> 0x100000000; } // ---- -// TypeError: (33-52): Operator >> not compatible with types int_const 66 and int_const 4294967296 +// TypeError 2271: (33-52): Operator >> not compatible with types int_const 66 and int_const 4294967296 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/372_shift_constant_right_fractional.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/372_shift_constant_right_fractional.sol index 38d9b051ca1c..d377c315a2b2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/372_shift_constant_right_fractional.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/372_shift_constant_right_fractional.sol @@ -2,4 +2,4 @@ contract C { uint public a = 0x42 >> (1 / 2); } // ---- -// TypeError: (33-48): Operator >> not compatible with types int_const 66 and rational_const 1 / 2 +// TypeError 2271: (33-48): Operator >> not compatible with types int_const 66 and rational_const 1 / 2 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol index d1f91a2371ea..df0aec30df42 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol @@ -6,5 +6,5 @@ } } // ---- -// TypeError: (89-187): Invalid rational number. -// TypeError: (205-303): Invalid rational number. +// TypeError 3757: (89-187): Invalid rational number. +// TypeError 3390: (205-303): Invalid rational number. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/397_warns_msg_value_in_non_payable_public_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/397_warns_msg_value_in_non_payable_public_function.sol index 6797857af896..008b9fc1bb9a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/397_warns_msg_value_in_non_payable_public_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/397_warns_msg_value_in_non_payable_public_function.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-61): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error. +// TypeError 5887: (52-61): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/402_assignment_to_constant.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/402_assignment_to_constant.sol index 7433bdeab338..84b9d5454b64 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/402_assignment_to_constant.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/402_assignment_to_constant.sol @@ -3,4 +3,4 @@ contract c { function f() public { a = 2; } } // ---- -// TypeError: (64-65): Cannot assign to a constant variable. +// TypeError 6520: (64-65): Cannot assign to a constant variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol index fe4691c2203a..dd405ab728d1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/406_invalid_address_checksum.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals +// SyntaxError 9429: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol index 6f4ac730d8c0..2a1a402c71a2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/407_invalid_address_no_checksum.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals +// SyntaxError 9429: (64-106): This looks like an address but has an invalid checksum. Correct checksummed address: "0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E". If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol index da5dc3803ecd..49e115ee9e80 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/408_invalid_address_length_short.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (64-105): This looks like an address but is not exactly 40 hex digits. It is 39 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals +// SyntaxError 9429: (64-105): This looks like an address but is not exactly 40 hex digits. It is 39 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol index 749612c9cba0..17eeb3b91088 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/409_invalid_address_length_long.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// SyntaxError: (64-107): This looks like an address but is not exactly 40 hex digits. It is 41 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals +// SyntaxError 9429: (64-107): This looks like an address but is not exactly 40 hex digits. It is 41 hex digits. If this is not used as an address, please prepend '00'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/410_string_literal_not_convertible_to_address_as_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/410_string_literal_not_convertible_to_address_as_assignment.sol index 13bd1a8fb5bf..2a62d956b45c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/410_string_literal_not_convertible_to_address_as_assignment.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/410_string_literal_not_convertible_to_address_as_assignment.sol @@ -3,4 +3,4 @@ contract AddrString { address public test = "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"; } // ---- -// TypeError: (116-160): Type literal_string "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" is not implicitly convertible to expected type address. +// TypeError 7407: (116-160): Type literal_string "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" is not implicitly convertible to expected type address. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/411_string_literal_not_convertible_to_address_as_return_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/411_string_literal_not_convertible_to_address_as_return_value.sol index d6b7b987e5cd..338dea1db9a3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/411_string_literal_not_convertible_to_address_as_return_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/411_string_literal_not_convertible_to_address_as_return_value.sol @@ -5,4 +5,4 @@ contract AddrString { } } // ---- -// TypeError: (149-193): Return argument type literal_string "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" is not implicitly convertible to expected type (type of first return variable) address. +// TypeError 6359: (149-193): Return argument type literal_string "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" is not implicitly convertible to expected type (type of first return variable) address. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol index d052dab5d13e..44cc9a3b0d4b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// DeclarationError: (150-179): Identifier already declared. -// DeclarationError: (114-120): Identifier not found or not unique. +// DeclarationError 2333: (150-179): Identifier already declared. +// DeclarationError 7920: (114-120): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/416_interface_function_bodies.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/416_interface_function_bodies.sol index fee2525ef708..71748031a545 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/416_interface_function_bodies.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/416_interface_function_bodies.sol @@ -3,4 +3,4 @@ interface I { } } // ---- -// TypeError: (18-52): Functions in interfaces cannot have an implementation. +// TypeError 4726: (18-52): Functions in interfaces cannot have an implementation. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/420_interface_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/420_interface_variables.sol index a4292c41ccde..adb8ee69fb47 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/420_interface_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/420_interface_variables.sol @@ -2,4 +2,4 @@ interface I { uint a; } // ---- -// TypeError: (18-24): Variables cannot be declared in interfaces. +// TypeError 8274: (18-24): Variables cannot be declared in interfaces. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/426_throw_is_deprecated.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/426_throw_is_deprecated.sol index 24f36c5b6f00..1f36e4d7d8d2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/426_throw_is_deprecated.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/426_throw_is_deprecated.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// SyntaxError: (52-57): "throw" is deprecated in favour of "revert()", "require()" and "assert()". +// SyntaxError 4538: (52-57): "throw" is deprecated in favour of "revert()", "require()" and "assert()". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/428_bare_revert.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/428_bare_revert.sol index 8e7817ff4b03..9cd58e3da7c8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/428_bare_revert.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/428_bare_revert.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (81-87): No matching declaration found after variable lookup. +// TypeError 2144: (81-87): No matching declaration found after variable lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/430_bare_selfdestruct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/430_bare_selfdestruct.sol index 9adc3d39d562..b770b60447fd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/430_bare_selfdestruct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/430_bare_selfdestruct.sol @@ -2,4 +2,4 @@ contract C { function f() pure public { selfdestruct; } } // ---- -// Warning: (44-56): Statement has no effect. +// Warning 6133: (44-56): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/431_bare_assert.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/431_bare_assert.sol index 38cea0576686..5e007aa22520 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/431_bare_assert.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/431_bare_assert.sol @@ -2,4 +2,4 @@ contract C { function f() pure public { assert; } } // ---- -// Warning: (44-50): Statement has no effect. +// Warning 6133: (44-50): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/432_bare_require.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/432_bare_require.sol index 62fe8baf3283..a67f5180fc29 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/432_bare_require.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/432_bare_require.sol @@ -3,4 +3,4 @@ contract C { function f() pure public { require; } } // ---- -// TypeError: (101-108): No matching declaration found after variable lookup. +// TypeError 2144: (101-108): No matching declaration found after variable lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/433_pure_statement_in_for_loop.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/433_pure_statement_in_for_loop.sol index 8cb090bb1449..5e4084885ba0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/433_pure_statement_in_for_loop.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/433_pure_statement_in_for_loop.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (77-81): Statement has no effect. +// Warning 6133: (77-81): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol index 188d00e0f9f5..69f659ef40f2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (97-115): Type is not callable +// TypeError 5704: (97-115): Type is not callable diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol index 6a77c3785540..54caa2b38ea6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (104-107): Data location must be "storage", "memory" or "calldata" for variable, but none was given. -// TypeError: (123-131): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 6651: (104-107): Data location must be "storage", "memory" or "calldata" for variable, but none was given. +// TypeError 6651: (123-131): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol index fe846aa0affe..937874b61fd6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol @@ -2,4 +2,4 @@ contract C { function f(uint storage a) public { } } // ---- -// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError 6651: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol index e74db3756a68..48ed1e63be65 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError 6651: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/475_implicit_conversion_disallowed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/475_implicit_conversion_disallowed.sol index 232e701df3dd..aeb91eedb5fd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/475_implicit_conversion_disallowed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/475_implicit_conversion_disallowed.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (95-98): Return argument type uint32 is not implicitly convertible to expected type (type of first return variable) bytes4. +// TypeError 6359: (95-98): Return argument type uint32 is not implicitly convertible to expected type (type of first return variable) bytes4. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol index 80bb632c956a..b319bd56cf7d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-56): Type too large for calldata. +// TypeError 1534: (28-56): Type too large for calldata. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/477_too_large_arrays_for_calldata_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/477_too_large_arrays_for_calldata_internal.sol index 5159f57ea216..0447f5e01018 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/477_too_large_arrays_for_calldata_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/477_too_large_arrays_for_calldata_internal.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-54): Type too large for memory. +// TypeError 1534: (28-54): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/478_too_large_arrays_for_calldata_public.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/478_too_large_arrays_for_calldata_public.sol index de42bad1e958..bf65519d1ee9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/478_too_large_arrays_for_calldata_public.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/478_too_large_arrays_for_calldata_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-54): Type too large for memory. +// TypeError 1534: (28-54): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/480_explicit_literal_to_storage_string_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/480_explicit_literal_to_storage_string_assignment.sol index ee56204a8b0f..25485451bce0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/480_explicit_literal_to_storage_string_assignment.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/480_explicit_literal_to_storage_string_assignment.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-76): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. +// TypeError 9574: (52-76): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol index ee56204a8b0f..25485451bce0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-76): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. +// TypeError 9574: (52-76): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/482_explicit_literal_to_unspecified_string.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/482_explicit_literal_to_unspecified_string.sol index c44fab55af0d..70eaebb285a7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/482_explicit_literal_to_unspecified_string.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/482_explicit_literal_to_unspecified_string.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-65): Statement has no effect. +// Warning 6133: (52-65): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/484_function_types_selector_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/484_function_types_selector_1.sol index 41ef95c5f2d1..46f6479fbc9c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/484_function_types_selector_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/484_function_types_selector_1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (76-86): Member "selector" not found or not visible after argument-dependent lookup in function () view returns (bytes4). +// TypeError 9582: (76-86): Member "selector" not found or not visible after argument-dependent lookup in function () view returns (bytes4). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/485_function_types_selector_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/485_function_types_selector_2.sol index d02b098d6afc..fae30bbec69f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/485_function_types_selector_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/485_function_types_selector_2.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (115-125): Member "selector" not found or not visible after argument-dependent lookup in function () pure. +// TypeError 9582: (115-125): Member "selector" not found or not visible after argument-dependent lookup in function () pure. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/486_function_types_selector_3.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/486_function_types_selector_3.sol index d39fcc288cc5..66cb6d6fd2eb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/486_function_types_selector_3.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/486_function_types_selector_3.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (99-109): Member "selector" not found or not visible after argument-dependent lookup in function (). +// TypeError 9582: (99-109): Member "selector" not found or not visible after argument-dependent lookup in function (). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/491_using_this_in_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/491_using_this_in_constructor.sol index 7921a1fac20f..5f4b2a6c3f09 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/491_using_this_in_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/491_using_this_in_constructor.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (48-52): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (48-52): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/492_do_not_crash_on_not_lvalue.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/492_do_not_crash_on_not_lvalue.sol index 2de7f4904db2..392d02e9f1b1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/492_do_not_crash_on_not_lvalue.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/492_do_not_crash_on_not_lvalue.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (153-157): Type is not callable +// TypeError 5704: (153-157): Type is not callable diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/493_builtin_keccak256_reject_gas.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/493_builtin_keccak256_reject_gas.sol index e411390613fd..75a6ff5a9c7f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/493_builtin_keccak256_reject_gas.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/493_builtin_keccak256_reject_gas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32). +// TypeError 9582: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/494_builtin_sha256_reject_gas.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/494_builtin_sha256_reject_gas.sol index 20031ea9a18a..a418ef207a09 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/494_builtin_sha256_reject_gas.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/494_builtin_sha256_reject_gas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-57): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32). +// TypeError 9582: (47-57): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/495_builtin_ripemd160_reject_gas.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/495_builtin_ripemd160_reject_gas.sol index 3d37e98863e8..17b0fc490ad4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/495_builtin_ripemd160_reject_gas.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/495_builtin_ripemd160_reject_gas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes20). +// TypeError 9582: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes20). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/496_builtin_ecrecover_reject_gas.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/496_builtin_ecrecover_reject_gas.sol index 82b6c89dbdbd..007cb316a574 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/496_builtin_ecrecover_reject_gas.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/496_builtin_ecrecover_reject_gas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes32,uint8,bytes32,bytes32) pure returns (address). +// TypeError 9582: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes32,uint8,bytes32,bytes32) pure returns (address). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/498_msg_gas_deprecated.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/498_msg_gas_deprecated.sol index 5efecd224d12..afd3f2d91a5f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/498_msg_gas_deprecated.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/498_msg_gas_deprecated.sol @@ -2,4 +2,4 @@ contract C { function f() public view returns (uint256 val) { return msg.gas; } } // ---- -// TypeError: (73-80): "msg.gas" has been deprecated in favor of "gasleft()" +// TypeError 1400: (73-80): "msg.gas" has been deprecated in favor of "gasleft()" diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/500_gasleft_shadowing_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/500_gasleft_shadowing_1.sol index 66b88c49f417..d3ea58c32f92 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/500_gasleft_shadowing_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/500_gasleft_shadowing_1.sol @@ -3,4 +3,4 @@ contract C { function f() public pure returns (bytes32 val) { return gasleft(); } } // ---- -// Warning: (17-87): This declaration shadows a builtin symbol. +// Warning 2319: (17-87): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/501_gasleft_shadowing_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/501_gasleft_shadowing_2.sol index 2679c89d8b16..ea6149313230 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/501_gasleft_shadowing_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/501_gasleft_shadowing_2.sol @@ -3,4 +3,4 @@ contract C { function f() public { gasleft = 42; } } // ---- -// Warning: (17-29): This declaration shadows a builtin symbol. +// Warning 2319: (17-29): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/502_builtin_keccak256_reject_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/502_builtin_keccak256_reject_value.sol index 0b214822eedd..7763535ef0fa 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/502_builtin_keccak256_reject_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/502_builtin_keccak256_reject_value.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-62): Member "value" is only available for payable functions. +// TypeError 8820: (47-62): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/503_builtin_sha256_reject_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/503_builtin_sha256_reject_value.sol index 5d8e0aecd515..aaccfad42175 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/503_builtin_sha256_reject_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/503_builtin_sha256_reject_value.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-59): Member "value" is only available for payable functions. +// TypeError 8820: (47-59): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/504_builtin_ripemd160_reject_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/504_builtin_ripemd160_reject_value.sol index d03e55b1b8ff..57c5c0456ea0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/504_builtin_ripemd160_reject_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/504_builtin_ripemd160_reject_value.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-62): Member "value" is only available for payable functions. +// TypeError 8820: (47-62): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/505_builtin_ecrecover_reject_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/505_builtin_ecrecover_reject_value.sol index 2a31934f3e74..88713331e3fd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/505_builtin_ecrecover_reject_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/505_builtin_ecrecover_reject_value.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (47-62): Member "value" is only available for payable functions. +// TypeError 8820: (47-62): Member "value" is only available for payable functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol index 3f8ee99646e5..5b8f306a930c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol @@ -2,4 +2,4 @@ contract C { uint[2**64] x; } // ---- -// Warning: (17-30): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-30): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol index 917dcec146d2..366f35339e6a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol @@ -2,4 +2,4 @@ contract C { uint[200][200][2**30][][2**30] x; } // ---- -// Warning: (17-49): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-49): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol index 656201f4d269..02b7276d693b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol @@ -3,4 +3,4 @@ contract C { S[2**20] x; } // ---- -// Warning: (64-74): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (64-74): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol index 046a27f71373..e639b58e999f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol @@ -2,4 +2,4 @@ contract C { mapping(uint => uint[2**100]) x; } // ---- -// Warning: (17-48): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-48): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/511_library_function_without_implementation_public.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/511_library_function_without_implementation_public.sol index ab30c5999b4e..f77845b477e3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/511_library_function_without_implementation_public.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/511_library_function_without_implementation_public.sol @@ -4,4 +4,4 @@ library L { function f() public; } // ---- -// TypeError: (112-132): Library functions must be implemented if declared. +// TypeError 9231: (112-132): Library functions must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/512_library_function_without_implementation_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/512_library_function_without_implementation_internal.sol index 812cf6137556..46025690a76e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/512_library_function_without_implementation_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/512_library_function_without_implementation_internal.sol @@ -2,4 +2,4 @@ library L { function f() internal; } // ---- -// TypeError: (16-38): Library functions must be implemented if declared. +// TypeError 9231: (16-38): Library functions must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/513_library_function_without_implementation_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/513_library_function_without_implementation_private.sol index 3fe6eb0ddfee..ad7683d65d10 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/513_library_function_without_implementation_private.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/513_library_function_without_implementation_private.sol @@ -2,4 +2,4 @@ library L { function f() private; } // ---- -// TypeError: (16-37): Library functions must be implemented if declared. +// TypeError 9231: (16-37): Library functions must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/514_using_for_with_non_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/514_using_for_with_non_library.sol index 7e9612d00717..ba141ce97003 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/514_using_for_with_non_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/514_using_for_with_non_library.sol @@ -7,4 +7,4 @@ library L { } } // ---- -// TypeError: (120-121): Library name expected. +// TypeError 4357: (120-121): Library name expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/515_experimental_pragma_empty.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/515_experimental_pragma_empty.sol index 66afb7a28016..d45e7e6afe4b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/515_experimental_pragma_empty.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/515_experimental_pragma_empty.sol @@ -1,3 +1,3 @@ pragma experimental; // ---- -// SyntaxError: (0-20): Experimental feature name is missing. +// SyntaxError 9679: (0-20): Experimental feature name is missing. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/516_experimental_pragma_unknown_number_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/516_experimental_pragma_unknown_number_literal.sol index 445c6f547c16..f8e8267a0d78 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/516_experimental_pragma_unknown_number_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/516_experimental_pragma_unknown_number_literal.sol @@ -1,3 +1,3 @@ pragma experimental 123; // ---- -// SyntaxError: (0-24): Unsupported experimental feature name. +// SyntaxError 8491: (0-24): Unsupported experimental feature name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/517_experimental_pragma_unknown_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/517_experimental_pragma_unknown_string_literal.sol index 48d8b968923d..76be60ce8a67 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/517_experimental_pragma_unknown_string_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/517_experimental_pragma_unknown_string_literal.sol @@ -1,3 +1,3 @@ pragma experimental unsupportedName; // ---- -// SyntaxError: (0-36): Unsupported experimental feature name. +// SyntaxError 8491: (0-36): Unsupported experimental feature name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/518_experimental_pragma_unknown_quoted_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/518_experimental_pragma_unknown_quoted_string_literal.sol index 6405f0627710..a08a0489b208 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/518_experimental_pragma_unknown_quoted_string_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/518_experimental_pragma_unknown_quoted_string_literal.sol @@ -1,3 +1,3 @@ pragma experimental "unsupportedName"; // ---- -// SyntaxError: (0-38): Unsupported experimental feature name. +// SyntaxError 8491: (0-38): Unsupported experimental feature name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/519_experimental_pragma_empy_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/519_experimental_pragma_empy_string_literal.sol index 1a1fde9c41e7..963ef5884b21 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/519_experimental_pragma_empy_string_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/519_experimental_pragma_empy_string_literal.sol @@ -1,3 +1,3 @@ pragma experimental ""; // ---- -// SyntaxError: (0-23): Empty experimental feature name is invalid. +// SyntaxError 3250: (0-23): Empty experimental feature name is invalid. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/520_experimental_pragma_multiple_same_line.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/520_experimental_pragma_multiple_same_line.sol index 2eb2bf2a95a5..f88c0e0d8476 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/520_experimental_pragma_multiple_same_line.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/520_experimental_pragma_multiple_same_line.sol @@ -1,3 +1,3 @@ pragma experimental unsupportedName unsupportedName; // ---- -// SyntaxError: (0-52): Stray arguments. +// SyntaxError 6022: (0-52): Stray arguments. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/521_experimental_pragma_test_warning.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/521_experimental_pragma_test_warning.sol index 5f6962f4ae2a..31f46fbb8f4c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/521_experimental_pragma_test_warning.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/521_experimental_pragma_test_warning.sol @@ -1,3 +1,3 @@ pragma experimental __test; // ---- -// Warning: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning 2264: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/522_experimental_pragma_duplicate.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/522_experimental_pragma_duplicate.sol index ba772a21a094..042b5464ce96 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/522_experimental_pragma_duplicate.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/522_experimental_pragma_duplicate.sol @@ -1,5 +1,5 @@ pragma experimental __test; pragma experimental __test; // ---- -// Warning: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. -// SyntaxError: (28-55): Duplicate experimental feature name. +// Warning 2264: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. +// SyntaxError 1231: (28-55): Duplicate experimental feature name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/523_reject_interface_creation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/523_reject_interface_creation.sol index 35bba5b314ce..54ca8f6945d7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/523_reject_interface_creation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/523_reject_interface_creation.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (62-67): Cannot instantiate an interface. +// TypeError 2971: (62-67): Cannot instantiate an interface. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol index ad08eca62de8..f1ffa651f36b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol @@ -1,4 +1,4 @@ interface I {} contract C is I(2) {} // ---- -// TypeError: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol index 8802d5106870..1589d58c93b4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol @@ -2,4 +2,4 @@ contract C { fallback () internal { } } // ---- -// TypeError: (17-41): Fallback function must be defined as "external". +// TypeError 1159: (17-41): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol index 3abbaca84483..3d3020bfad34 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol @@ -2,4 +2,4 @@ contract C { fallback () private { } } // ---- -// TypeError: (17-40): Fallback function must be defined as "external". +// TypeError 1159: (17-40): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol index 3c6facf17ac5..ce8f3e018a27 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol @@ -2,4 +2,4 @@ contract C { fallback () public { } } // ---- -// TypeError: (17-39): Fallback function must be defined as "external". +// TypeError 1159: (17-39): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/530_tuple_invalid_literal_too_large_for_uint.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/530_tuple_invalid_literal_too_large_for_uint.sol index bbfe22066d4c..0c92397cf8f9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/530_tuple_invalid_literal_too_large_for_uint.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/530_tuple_invalid_literal_too_large_for_uint.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (76-83): Type int_const 1000...(104 digits omitted)...0000 is not implicitly convertible to expected type tuple(uint256,). +// TypeError 7407: (76-83): Type int_const 1000...(104 digits omitted)...0000 is not implicitly convertible to expected type tuple(uint256,). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/531_tuple_invalid_literal_too_large_unassigned.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/531_tuple_invalid_literal_too_large_unassigned.sol index 6b9cbf79baf5..0739c9e839cc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/531_tuple_invalid_literal_too_large_unassigned.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/531_tuple_invalid_literal_too_large_unassigned.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (80-85): Invalid rational number. +// TypeError 3390: (80-85): Invalid rational number. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/532_tuple_invalid_literal_too_large_for_uint_multi.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/532_tuple_invalid_literal_too_large_for_uint_multi.sol index a26f9c041fff..53979ab5f85e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/532_tuple_invalid_literal_too_large_for_uint_multi.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/532_tuple_invalid_literal_too_large_for_uint_multi.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (77-82): Invalid rational number. +// TypeError 3390: (77-82): Invalid rational number. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/533_tuple_invalid_literal_too_large_exp.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/533_tuple_invalid_literal_too_large_exp.sol index 9384ec531f4f..2010aac6809e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/533_tuple_invalid_literal_too_large_exp.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/533_tuple_invalid_literal_too_large_exp.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (53-59): Invalid rational number. +// TypeError 3390: (53-59): Invalid rational number. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/534_tuple_invalid_literal_too_large_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/534_tuple_invalid_literal_too_large_expression.sol index 3c322444e2a1..ab239f2a4f1f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/534_tuple_invalid_literal_too_large_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/534_tuple_invalid_literal_too_large_expression.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-74): Statement has no effect. +// Warning 6133: (52-74): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol index a0ac32ba2bd9..7afc3fed8936 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol @@ -17,4 +17,4 @@ contract D { } } // ---- -// Warning: (17-134): Function state mutability can be restricted to view +// Warning 2018: (17-134): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/536_array_length_invalid_expression_negative_bool.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/536_array_length_invalid_expression_negative_bool.sol index c92861eb4e69..14fc21ac173f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/536_array_length_invalid_expression_negative_bool.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/536_array_length_invalid_expression_negative_bool.sol @@ -2,4 +2,4 @@ contract C { uint[-true] ids; } // ---- -// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/537_array_length_invalid_expression_int_divides_bool.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/537_array_length_invalid_expression_int_divides_bool.sol index 92e3c3cfb614..5cb91b94229e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/537_array_length_invalid_expression_int_divides_bool.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/537_array_length_invalid_expression_int_divides_bool.sol @@ -2,4 +2,4 @@ contract C { uint[true/1] ids; } // ---- -// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/538_array_length_invalid_expression_bool_divides_int.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/538_array_length_invalid_expression_bool_divides_int.sol index 26add45cad1b..dbedaaa3b766 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/538_array_length_invalid_expression_bool_divides_int.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/538_array_length_invalid_expression_bool_divides_int.sol @@ -2,4 +2,4 @@ contract C { uint[1/true] ids; } // ---- -// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/539_array_length_invalid_expression_scientific_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/539_array_length_invalid_expression_scientific_literal.sol index a0d58f4a970b..dc588eb4b8f8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/539_array_length_invalid_expression_scientific_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/539_array_length_invalid_expression_scientific_literal.sol @@ -2,4 +2,4 @@ contract C { uint[1.111111E1111111111111] ids; } // ---- -// TypeError: (22-44): Invalid array length, expected integer literal or constant expression. +// TypeError 5462: (22-44): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/540_array_length_invalid_expression_division_by_zero.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/540_array_length_invalid_expression_division_by_zero.sol index 38a80867d665..4e8b76d711b3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/540_array_length_invalid_expression_division_by_zero.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/540_array_length_invalid_expression_division_by_zero.sol @@ -2,4 +2,4 @@ contract C { uint[3/0] ids; } // ---- -// TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0 +// TypeError 6020: (22-25): Operator / not compatible with types int_const 3 and int_const 0 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol index 39edaa2dbb38..38c3c80ca2f6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-64): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(this).balance" to access this address member. +// TypeError 3125: (52-64): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(this).balance" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol index a44cc6d2c37a..7eb41976e514 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-65): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(this).transfer" to access this address member. +// TypeError 3125: (52-65): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(this).transfer" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol index e9e26a000f9c..a889c26c3e12 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-61): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(this).send" to access this address member. +// TypeError 3125: (52-61): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(this).send" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol index 16da757897e1..94a1aa3b111d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-61): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(this).call" to access this address member. +// TypeError 3125: (52-61): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(this).call" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol index 9292f9c07b01..e2e59e5661d8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-65): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(this).callcode" to access this address member. +// TypeError 3125: (52-65): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(this).callcode" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol index 20354991fb9f..f12d3cf97d55 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-69): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(this).delegatecall" to access this address member. +// TypeError 3125: (52-69): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(this).delegatecall" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol index 8a4734e67a5a..91e7404b03b6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-74): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(c).balance" to access this address member. +// TypeError 3125: (65-74): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(c).balance" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol index e617f540408f..192a898926b7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-75): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(c).transfer" to access this address member. +// TypeError 3125: (65-75): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(c).transfer" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol index 54965d4b2fd4..ba614226af70 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-71): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(c).send" to access this address member. +// TypeError 3125: (65-71): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(c).send" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol index 940f383c5af4..7d2eb2af8c5d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-71): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(c).call" to access this address member. +// TypeError 3125: (65-71): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(c).call" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol index 9d4725bd04d3..971af8632cd2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-75): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(c).callcode" to access this address member. +// TypeError 3125: (65-75): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(c).callcode" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol index 9941ce1f9ad9..ff933142f0fb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (65-79): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(c).delegatecall" to access this address member. +// TypeError 3125: (65-79): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(c).delegatecall" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol index e9a566714c44..6b79c77d2b7d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (62-65): Event invocations have to be prefixed by "emit". +// TypeError 3132: (62-65): Event invocations have to be prefixed by "emit". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/569_block_blockhash_deprecated.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/569_block_blockhash_deprecated.sol index b8f5d6a81aee..69c53894d9f5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/569_block_blockhash_deprecated.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/569_block_blockhash_deprecated.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (77-92): "block.blockhash()" has been deprecated in favor of "blockhash()" +// TypeError 8113: (77-92): "block.blockhash()" has been deprecated in favor of "blockhash()" diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/570_function_type_undeclared_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/570_function_type_undeclared_type.sol index 962f4fe4f4b4..a9509ce407e9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/570_function_type_undeclared_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/570_function_type_undeclared_type.sol @@ -2,4 +2,4 @@ contract C { function a(function(Nested)) external pure {} } // ---- -// DeclarationError: (37-43): Identifier not found or not unique. +// DeclarationError 7920: (37-43): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/571_function_type_undeclared_type_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/571_function_type_undeclared_type_external.sol index 735af9e9d1bc..90bd436651e8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/571_function_type_undeclared_type_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/571_function_type_undeclared_type_external.sol @@ -2,4 +2,4 @@ contract C { function a(function(Nested) external) external pure {} } // ---- -// DeclarationError: (37-43): Identifier not found or not unique. +// DeclarationError 7920: (37-43): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/572_function_type_undeclared_type_multi_nested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/572_function_type_undeclared_type_multi_nested.sol index ffb467cde99c..8b08c29e7a40 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/572_function_type_undeclared_type_multi_nested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/572_function_type_undeclared_type_multi_nested.sol @@ -2,4 +2,4 @@ contract C { function a(function(function(function(Nested)))) external pure {} } // ---- -// DeclarationError: (55-61): Identifier not found or not unique. +// DeclarationError 7920: (55-61): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol index c6719d8c3f28..d83ee1d8182e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (146-236): Undeclared identifier. +// DeclarationError 7576: (146-236): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol index 61fb2d8230fe..cb44e4dba489 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (137-216): Undeclared identifier. Did you mean "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"? \ No newline at end of file +// DeclarationError 7576: (137-216): Undeclared identifier. Did you mean "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/575_member_member_getter_call_without_parentheses.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/575_member_member_getter_call_without_parentheses.sol index 61f431036dd4..f7a5f3242a3c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/575_member_member_getter_call_without_parentheses.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/575_member_member_getter_call_without_parentheses.sol @@ -16,4 +16,4 @@ contract D{ } } // ---- -// TypeError: (170-175): Member "a" not found or not visible after argument-dependent lookup in function () view external returns (contract B). Did you intend to call the function? +// TypeError 6005: (170-175): Member "a" not found or not visible after argument-dependent lookup in function () view external returns (contract B). Did you intend to call the function? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/576_member_getter_call_without_parentheses.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/576_member_getter_call_without_parentheses.sol index bdc5fdc7ec4d..e96d0189b20d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/576_member_getter_call_without_parentheses.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/576_member_getter_call_without_parentheses.sol @@ -14,4 +14,4 @@ contract C{ } // ---- -// TypeError: (140-145): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? +// TypeError 6005: (140-145): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/577_member_getter_call_without_parentheses_missing_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/577_member_getter_call_without_parentheses_missing_function.sol index d204d9268b35..11814b81f952 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/577_member_getter_call_without_parentheses_missing_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/577_member_getter_call_without_parentheses_missing_function.sol @@ -12,4 +12,4 @@ contract C{ } // ---- -// TypeError: (104-109): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? +// TypeError 6005: (104-109): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/578_private_member_getter_call_without_parentheses.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/578_private_member_getter_call_without_parentheses.sol index e71da37229d4..fceadad8dc48 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/578_private_member_getter_call_without_parentheses.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/578_private_member_getter_call_without_parentheses.sol @@ -14,4 +14,4 @@ contract C{ } // ---- -// TypeError: (141-144): Member "a" not found or not visible after argument-dependent lookup in contract B. +// TypeError 9582: (141-144): Member "a" not found or not visible after argument-dependent lookup in contract B. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/579_member_getter_call_without_parentheses_private_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/579_member_getter_call_without_parentheses_private_function.sol index 189322380f76..3286934371f9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/579_member_getter_call_without_parentheses_private_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/579_member_getter_call_without_parentheses_private_function.sol @@ -14,4 +14,4 @@ contract C{ } // ---- -// TypeError: (141-146): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? +// TypeError 6005: (141-146): Member "f" not found or not visible after argument-dependent lookup in function () view external returns (contract A). Did you intend to call the function? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol index 8d2d071b8517..832cf3ae8ce9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol @@ -9,6 +9,6 @@ contract c { uint256 ab; } // ---- -// DeclarationError: (56-58): Undeclared identifier. Did you mean "ab"? -// DeclarationError: (72-74): Undeclared identifier. -// DeclarationError: (88-89): Undeclared identifier. +// DeclarationError 7576: (56-58): Undeclared identifier. Did you mean "ab"? +// DeclarationError 7576: (72-74): Undeclared identifier. +// DeclarationError 7576: (88-89): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol index 69f5a7e2e373..6070ff353835 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol @@ -8,5 +8,5 @@ contract c { uint256 abc; } // ---- -// DeclarationError: (56-59): Undeclared identifier. Did you mean "abc" or "abi"? -// DeclarationError: (73-76): Undeclared identifier. +// DeclarationError 7576: (56-59): Undeclared identifier. Did you mean "abc" or "abi"? +// DeclarationError 7576: (73-76): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol index 547ea3088ab1..e8deef5192d9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol @@ -9,9 +9,9 @@ contract c { uint256 abc; } // ---- -// DeclarationError: (52-53): Undeclared identifier. -// DeclarationError: (56-60): Undeclared identifier. Did you mean "long"? -// DeclarationError: (70-71): Undeclared identifier. -// DeclarationError: (74-78): Undeclared identifier. Did you mean "long", "log0", "log1", "log2", "log3" or "log4"? -// DeclarationError: (88-89): Undeclared identifier. -// DeclarationError: (92-96): Undeclared identifier. Did you mean "long"? +// DeclarationError 7576: (52-53): Undeclared identifier. +// DeclarationError 7576: (56-60): Undeclared identifier. Did you mean "long"? +// DeclarationError 7576: (70-71): Undeclared identifier. +// DeclarationError 7576: (74-78): Undeclared identifier. Did you mean "long", "log0", "log1", "log2", "log3" or "log4"? +// DeclarationError 7576: (88-89): Undeclared identifier. +// DeclarationError 7576: (92-96): Undeclared identifier. Did you mean "long"? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol index 6be591f6d0a3..a2864ed8ef36 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol @@ -2,4 +2,4 @@ contract C { function f() pure public { abi.encodePacked(0/1); } } // ---- -// TypeError: (61-64): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. \ No newline at end of file +// TypeError 7279: (61-64): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol index c95eeb358da0..0d5fadcc808c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol @@ -2,4 +2,4 @@ contract C { function f() pure public { abi.decode("", (0)); } } // ---- -// TypeError: (60-61): Argument has to be a type name. +// TypeError 1039: (60-61): Argument has to be a type name. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol index f2ad3f5635fb..a2ec34ecfc34 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (98-99): Decoding type struct C.s memory not supported. +// TypeError 9611: (98-99): Decoding type struct C.s memory not supported. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol index c076017a87af..b15dbc8dfda6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol @@ -2,6 +2,6 @@ contract c { event e(uint indexed a, mapping(uint => uint) indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; } // ---- -// TypeError: (41-72): Type is required to live outside storage. -// TypeError: (41-72): Internal or recursive type is not allowed as event parameter type. -// TypeError: (17-132): More than 4 indexed arguments for anonymous event. +// TypeError 3448: (41-72): Type is required to live outside storage. +// TypeError 3417: (41-72): Internal or recursive type is not allowed as event parameter type. +// TypeError 8598: (17-132): More than 4 indexed arguments for anonymous event. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/588_interface_function_modifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/588_interface_function_modifier.sol index b94334d38770..e506828d02c3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/588_interface_function_modifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/588_interface_function_modifier.sol @@ -3,4 +3,4 @@ interface I { modifier m() { _; } } // ---- -// SyntaxError: (16-60): Functions in interfaces cannot have modifiers. +// SyntaxError 5842: (16-60): Functions in interfaces cannot have modifiers. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/incomp_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/incomp_types.sol index 7f2139bf75d1..7b58b870f009 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/incomp_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/incomp_types.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (72-83): Operator += not compatible with types uint256 and tuple(int_const 1,int_const 1) +// TypeError 7366: (72-83): Operator += not compatible with types uint256 and tuple(int_const 1,int_const 1) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple.sol index bcdbde02ce5e..7171a9abae7c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (72-88): Compound assignment is not allowed for tuple types. +// TypeError 4289: (72-88): Compound assignment is not allowed for tuple types. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple_invalid_inline_array_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple_invalid_inline_array_type.sol index 17892ec05da4..8d2d38d226ba 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple_invalid_inline_array_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/compoundAssignment/tuple_invalid_inline_array_type.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (78-85): Invalid mobile type. +// TypeError 9563: (78-85): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/constant_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/constant_mapping.sol index 61c0cc178d07..e232ba25e12f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/constant_mapping.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/constant_mapping.sol @@ -4,5 +4,5 @@ contract C { mapping(uint => uint) constant x; } // ---- -// TypeError: (148-180): Constants of non-value type not yet implemented. -// TypeError: (148-180): Uninitialized "constant" variable. +// TypeError 9259: (148-180): Constants of non-value type not yet implemented. +// TypeError 4266: (148-180): Uninitialized "constant" variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_memory_array.sol index 078255e300b4..16bcbf4479fc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_memory_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (74-86): Wrong argument count for function call: 0 arguments given but expected 1. +// TypeError 6160: (74-86): Wrong argument count for function call: 0 arguments given but expected 1. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct.sol index 35671e6f12d4..3ff9d9ed1155 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (94-103): Wrong argument count for struct constructor: 1 arguments given but expected 2. +// TypeError 9755: (94-103): Wrong argument count for struct constructor: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol index 1e954ab6c392..08714f500a91 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (117-126): Wrong argument count for struct constructor: 1 arguments given but expected 2. Members that have to be skipped in memory: c +// TypeError 9755: (117-126): Wrong argument count for struct constructor: 1 arguments given but expected 2. Members that have to be skipped in memory: c diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/explicit_conversions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/explicit_conversions.sol index c81b60351621..aac750153049 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/explicit_conversions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/explicit_conversions.sol @@ -5,5 +5,5 @@ contract test { } } // ---- -// TypeError: (50-60): Exactly one argument expected for explicit type conversion. -// TypeError: (70-83): Type conversion cannot allow named arguments. +// TypeError 2558: (50-60): Exactly one argument expected for explicit type conversion. +// TypeError 5153: (70-83): Type conversion cannot allow named arguments. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol index 4cb3f62924c2..8cb32f72d63b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/conditional_expression.sol @@ -8,9 +8,9 @@ contract C { } } // ---- -// TypeError: (92-98): Invalid mobile type in true expression. -// TypeError: (85-103): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. -// TypeError: (128-134): Invalid mobile type in false expression. -// TypeError: (116-134): Invalid type for argument in function call. Invalid implicit conversion from uint8 to bytes1 requested. -// TypeError: (155-161): Invalid mobile type in true expression. -// TypeError: (164-170): Invalid mobile type in false expression. +// 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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/constructor_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/constructor_call.sol index b1416ddec5fa..4ef5f74652ee 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/constructor_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidTypes/constructor_call.sol @@ -9,4 +9,4 @@ contract A { } } // ---- -// TypeError: (115-121): Invalid type for argument in function call. Invalid implicit conversion from int_const 1234 to bytes32 requested. +// TypeError 9553: (115-121): Invalid type for argument in function call. Invalid implicit conversion from int_const 1234 to bytes32 requested. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol index ea867c10b256..68b588ad8054 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/no_effect_statements.sol @@ -9,8 +9,8 @@ contract test { } } // ---- -// Warning: (93-94): Statement has no effect. -// Warning: (98-104): Statement has no effect. -// Warning: (108-112): Statement has no effect. -// Warning: (116-120): Statement has no effect. -// Warning: (124-131): Statement has no effect. +// 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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/events.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/events.sol index e5b635df2c0f..a09ab31b91db 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/events.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/events.sol @@ -2,4 +2,4 @@ contract C { event keccak256(); } // ---- -// Warning: (17-35): This declaration shadows a builtin symbol. +// Warning 2319: (17-35): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/functions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/functions.sol index 33ccb3562527..be1a70364a6b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/functions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/functions.sol @@ -2,4 +2,4 @@ contract C { function keccak256() pure public {} } // ---- -// Warning: (17-52): This declaration shadows a builtin symbol. +// Warning 2319: (17-52): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/global_scope.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/global_scope.sol index 0946dc57af17..76fb2ff83195 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/global_scope.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/global_scope.sol @@ -1,4 +1,4 @@ contract msg { } // ---- -// Warning: (0-16): This declaration shadows a builtin symbol. +// Warning 2319: (0-16): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/parameters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/parameters.sol index 454929d1cd28..40a76dd793bf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/parameters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/parameters.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (28-40): This declaration shadows a builtin symbol. +// Warning 2319: (28-40): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/return_parameters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/return_parameters.sol index 7931053fc1c6..e7367038528a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/return_parameters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/return_parameters.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (51-63): This declaration shadows a builtin symbol. +// Warning 2319: (51-63): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/storage_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/storage_variables.sol index d5635887b9ab..cde3d01bf4ae 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/storage_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/storage_variables.sol @@ -2,4 +2,4 @@ contract C { uint msg; } // ---- -// Warning: (17-25): This declaration shadows a builtin symbol. +// Warning 2319: (17-25): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol index 4fa8a1ff438a..646cd6e19da4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// Warning: (52-62): This declaration shadows a builtin symbol. -// Warning: (76-85): This declaration shadows a builtin symbol. -// Warning: (52-62): Unused local variable. -// Warning: (76-85): Unused local variable. +// Warning 2319: (52-62): This declaration shadows a builtin symbol. +// Warning 2319: (76-85): This declaration shadows a builtin symbol. +// Warning 2072: (52-62): Unused local variable. +// Warning 2072: (76-85): Unused local variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/variables.sol index 1d6f098e7fa2..d13cfe9886f7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/variables.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (52-60): This declaration shadows a builtin symbol. +// Warning 2319: (52-60): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/library_instances.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/library_instances.sol index c28bec419bb0..15de57c41305 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/library_instances.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/library_instances.sol @@ -9,6 +9,6 @@ contract Y { } } // ---- -// TypeError: (29-34): The type of a variable cannot be a library. -// TypeError: (50-57): The type of a variable cannot be a library. -// TypeError: (77-82): The type of a variable cannot be a library. +// TypeError 1273: (29-34): The type of a variable cannot be a library. +// TypeError 1273: (50-57): The type of a variable cannot be a library. +// TypeError 1273: (77-82): The type of a variable cannot be a library. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return.sol index d0e871390323..a008470ecb66 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return.sol @@ -2,4 +2,4 @@ contract test { function f() public returns (bool r) { return 1 >= 2; } } // ---- -// Warning: (20-75): Function state mutability can be restricted to pure +// Warning 2018: (20-75): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_tuple_not_convertible.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_tuple_not_convertible.sol index cd6f71f28f68..a6160b322f44 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_tuple_not_convertible.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_tuple_not_convertible.sol @@ -2,4 +2,4 @@ contract test { function f() public returns (uint256 r, uint8) { return ((12, "")); } } // ---- -// TypeError: (76-86): Return argument type tuple(int_const 12,literal_string "") is not implicitly convertible to expected type tuple(uint256,uint8). +// TypeError 5992: (76-86): Return argument type tuple(int_const 12,literal_string "") is not implicitly convertible to expected type tuple(uint256,uint8). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_number.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_number.sol index 13c70ad9e3be..8ad9de4705cf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_number.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_number.sol @@ -2,4 +2,4 @@ contract test { function f() public returns (bool r1, bool r2) { return 1 >= 2; } } // ---- -// TypeError: (69-82): Different number of arguments in return statement than in returns declaration. +// TypeError 8863: (69-82): Different number of arguments in return statement than in returns declaration. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_type.sol index a7459ae8e32a..f3d27491e441 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/typeChecking/return_wrong_type.sol @@ -2,4 +2,4 @@ contract test { function f() public returns (uint256 r) { return 1 >= 2; } } // ---- -// TypeError: (69-75): Return argument type bool is not implicitly convertible to expected type (type of first return variable) uint256. +// TypeError 6359: (69-75): Return argument type bool is not implicitly convertible to expected type (type of first return variable) uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local.sol index 7d7f5728ae08..b36061080807 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-58): Unused local variable. +// Warning 2072: (52-58): Unused local variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local_assignment.sol index b3d2837495ca..943de5dd0e00 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local_assignment.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/warnUnused/local_assignment.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-58): Unused local variable. +// Warning 2072: (52-58): Unused local variable. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol index 78aaf920c5f9..3fb4527b4ec2 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol @@ -4,4 +4,4 @@ contract C { uint private state; } // ---- -// Warning: (17-56): Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0. +// Warning 8532: (17-56): Documentation tag @title and @author is only allowed on contract definitions. It will be disallowed in 0.7.0. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol index cc8a31f3a618..8a0b9bb38e49 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol @@ -3,4 +3,4 @@ contract C { function vote(uint id) public {} } // ---- -// DocstringParsingError: No description given for param id +// DocstringParsingError 9942: No description given for param id diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol index 2e25844075da..e014104da844 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol @@ -3,4 +3,4 @@ abstract contract C { function vote(uint id) public {} } // ---- -// DocstringParsingError: End of tag @param not found +// DocstringParsingError 9222: End of tag @param not found diff --git a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol index 2b079ee7f811..2eb51cddaa14 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol @@ -3,4 +3,4 @@ contract test { uint private state; } // ---- -// DocstringParsingError: (18-47): Documentation tag "@return" is only allowed on public state-variables. +// DocstringParsingError 9440: (18-47): Documentation tag "@return" is only allowed on public state-variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol index 780501230966..2a9572d728e0 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol @@ -4,4 +4,4 @@ contract C { uint private state; } // ---- -// Warning: (17-74): Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly. +// Warning 7816: (17-74): Documentation tag on non-public state variables will be disallowed in 0.7.0. You will need to use the @dev tag explicitly. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol b/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol index e57d6f7e454a..438bb7b8045a 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_state_variable_too_many_return_tags.sol @@ -6,4 +6,4 @@ contract test { uint public state; } // ---- -// DocstringParsingError: (18-137): Documentation tag "@return" is only allowed once on state-variables. +// DocstringParsingError 5256: (18-137): Documentation tag "@return" is only allowed once on state-variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_too_many_return_tags.sol b/test/libsolidity/syntaxTests/natspec/docstring_too_many_return_tags.sol index 7197a4edb719..111316035cfd 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_too_many_return_tags.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_too_many_return_tags.sol @@ -5,4 +5,4 @@ abstract contract C { function vote(uint id) public virtual returns (uint value); } // ---- -// DocstringParsingError: (26-121): Documentation tag "@return value2 Some value 2" exceeds the number of return parameters. +// DocstringParsingError 2604: (26-121): Documentation tag "@return value2 Some value 2" exceeds the number of return parameters. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol index 726eba852618..1b8142f17d6a 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning: (290-295): Only state variables can have a docstring. This will be disallowed in 0.7.0. +// Warning 2837: (290-295): Only state variables can have a docstring. This will be disallowed in 0.7.0. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_named_return_param_mismatch.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_named_return_param_mismatch.sol index c2f29c0387ba..6e9ef2e93b9e 100644 --- a/test/libsolidity/syntaxTests/natspec/invalid/docstring_named_return_param_mismatch.sol +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_named_return_param_mismatch.sol @@ -4,4 +4,4 @@ abstract contract C { function vote(uint id) public virtual returns (uint value); } // ---- -// DocstringParsingError: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter. +// DocstringParsingError 5856: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_parameter.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_parameter.sol index 3e6dc0885c3e..9ea5533470dd 100644 --- a/test/libsolidity/syntaxTests/natspec/invalid/docstring_parameter.sol +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_parameter.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// DocstringParsingError: (17-101): Documented parameter "" not found in the parameter list of the function. -// DocstringParsingError: (17-101): Documented parameter "_" not found in the parameter list of the function. +// DocstringParsingError 3881: (17-101): Documented parameter "" not found in the parameter list of the function. +// DocstringParsingError 3881: (17-101): Documented parameter "_" not found in the parameter list of the function. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_return_size_mismatch.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_return_size_mismatch.sol index 6e95d788d0e8..e060a5436b9b 100644 --- a/test/libsolidity/syntaxTests/natspec/invalid/docstring_return_size_mismatch.sol +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_return_size_mismatch.sol @@ -7,5 +7,5 @@ abstract contract C { function unvote(uint id) public virtual returns (uint value); } // ---- -// DocstringParsingError: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter. -// DocstringParsingError: (159-188): Documentation tag "@return No value returned" does not contain the name of its return parameter. +// DocstringParsingError 5856: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter. +// DocstringParsingError 5856: (159-188): Documentation tag "@return No value returned" does not contain the name of its return parameter. diff --git a/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol b/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol index d98f4ae3ddf1..6426da1e50e5 100644 --- a/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol +++ b/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol @@ -2,4 +2,4 @@ contract C { address constant payable b = address(0); } // ---- -// ParserError: (34-41): Expected identifier but got 'payable' +// ParserError 2314: (34-41): Expected identifier but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol b/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol index 4d4a5676f039..90968ebc69a4 100644 --- a/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol +++ b/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol @@ -14,13 +14,13 @@ contract C { function j() public pure returns (address pure) {} } // ---- -// TypeError: (14-26): Address types can only be payable or non-payable. -// TypeError: (33-45): Address types can only be payable or non-payable. -// TypeError: (52-64): Address types can only be payable or non-payable. -// TypeError: (89-101): Address types can only be payable or non-payable. -// TypeError: (138-150): Address types can only be payable or non-payable. -// TypeError: (156-168): Address types can only be payable or non-payable. -// TypeError: (195-207): Address types can only be payable or non-payable. -// TypeError: (236-248): Address types can only be payable or non-payable. -// TypeError: (300-312): Address types can only be payable or non-payable. -// TypeError: (352-364): Address types can only be payable or non-payable. +// TypeError 2311: (14-26): Address types can only be payable or non-payable. +// TypeError 2311: (33-45): Address types can only be payable or non-payable. +// TypeError 2311: (52-64): Address types can only be payable or non-payable. +// TypeError 2311: (89-101): Address types can only be payable or non-payable. +// TypeError 2311: (138-150): Address types can only be payable or non-payable. +// TypeError 2311: (156-168): Address types can only be payable or non-payable. +// TypeError 2311: (195-207): Address types can only be payable or non-payable. +// TypeError 2311: (236-248): Address types can only be payable or non-payable. +// TypeError 2311: (300-312): Address types can only be payable or non-payable. +// TypeError 2311: (352-364): Address types can only be payable or non-payable. diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol b/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol index bf073a52a865..7e7841565501 100644 --- a/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol +++ b/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (80-87): Expected ';' but got 'payable' +// ParserError 2314: (80-87): Expected ';' but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol b/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol index 394b39c09734..b09f1ed13fb0 100644 --- a/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol +++ b/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (67-68): Expected identifier but got ';' +// ParserError 2314: (67-68): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol b/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol index 0acf5e4be0c7..8f27f2922fa2 100644 --- a/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol +++ b/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol @@ -2,4 +2,4 @@ contract C { address public payable a; } // ---- -// ParserError: (32-39): Expected identifier but got 'payable' +// ParserError 2314: (32-39): Expected identifier but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/array_range_conversion.sol b/test/libsolidity/syntaxTests/parsing/array_range_conversion.sol index 65595f17ba2f..785d8e73281a 100644 --- a/test/libsolidity/syntaxTests/parsing/array_range_conversion.sol +++ b/test/libsolidity/syntaxTests/parsing/array_range_conversion.sol @@ -7,8 +7,8 @@ contract C { } } // ---- -// TypeError: (77-85): Types cannot be sliced. -// TypeError: (77-88): Explicit type conversion not allowed from "uint256[] memory" to "uint256". -// TypeError: (98-107): Types cannot be sliced. -// TypeError: (98-110): Explicit type conversion not allowed from "uint256[] memory" to "uint256". -// TypeError: (120-130): Types cannot be sliced. +// TypeError 1760: (77-85): Types cannot be sliced. +// TypeError 9640: (77-88): Explicit type conversion not allowed from "uint256[] memory" to "uint256". +// TypeError 1760: (98-107): Types cannot be sliced. +// TypeError 9640: (98-110): Explicit type conversion not allowed from "uint256[] memory" to "uint256". +// TypeError 1760: (120-130): Types cannot be sliced. diff --git a/test/libsolidity/syntaxTests/parsing/array_range_nested_invalid.sol b/test/libsolidity/syntaxTests/parsing/array_range_nested_invalid.sol index bc53d3fafaa2..c224818b4dd3 100644 --- a/test/libsolidity/syntaxTests/parsing/array_range_nested_invalid.sol +++ b/test/libsolidity/syntaxTests/parsing/array_range_nested_invalid.sol @@ -8,7 +8,7 @@ contract C { } } // ---- -// TypeError: (110-116): Index range access is not supported for arrays with dynamically encoded base types. -// TypeError: (126-130): Index range access is not supported for arrays with dynamically encoded base types. -// TypeError: (140-145): Index range access is not supported for arrays with dynamically encoded base types. -// TypeError: (155-160): Index range access is not supported for arrays with dynamically encoded base types. +// TypeError 2148: (110-116): Index range access is not supported for arrays with dynamically encoded base types. +// TypeError 2148: (126-130): Index range access is not supported for arrays with dynamically encoded base types. +// TypeError 2148: (140-145): Index range access is not supported for arrays with dynamically encoded base types. +// TypeError 2148: (155-160): Index range access is not supported for arrays with dynamically encoded base types. diff --git a/test/libsolidity/syntaxTests/parsing/array_type_range.sol b/test/libsolidity/syntaxTests/parsing/array_type_range.sol index 6f98e7efd6c0..0e4a155b2c57 100644 --- a/test/libsolidity/syntaxTests/parsing/array_type_range.sol +++ b/test/libsolidity/syntaxTests/parsing/array_type_range.sol @@ -8,7 +8,7 @@ contract C { } // ---- -// ParserError: (52-62): Expected array length expression. -// ParserError: (81-92): Expected array length expression. -// ParserError: (111-119): Expected array length expression. -// ParserError: (138-147): Expected array length expression. +// ParserError 5464: (52-62): Expected array length expression. +// ParserError 5464: (81-92): Expected array length expression. +// ParserError 5464: (111-119): Expected array length expression. +// ParserError 5464: (138-147): Expected array length expression. diff --git a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol index 9035caa25703..44fcd2d3a881 100644 --- a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol +++ b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol @@ -2,4 +2,4 @@ contract c { function f() public { c[10] storage a = 7; uint8[10 * 2] storage x; } } // ---- -// TypeError: (39-58): Type int_const 7 is not implicitly convertible to expected type contract c[10] storage pointer. +// TypeError 9574: (39-58): Type int_const 7 is not implicitly convertible to expected type contract c[10] storage pointer. diff --git a/test/libsolidity/syntaxTests/parsing/assembly_invalid_type.sol b/test/libsolidity/syntaxTests/parsing/assembly_invalid_type.sol index c2d39279f161..eb40db05e943 100644 --- a/test/libsolidity/syntaxTests/parsing/assembly_invalid_type.sol +++ b/test/libsolidity/syntaxTests/parsing/assembly_invalid_type.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (55-64): Only "evmasm" supported. +// ParserError 4531: (55-64): Only "evmasm" supported. diff --git a/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol b/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol index 0e348f5b740f..d7c1299ffbc5 100644 --- a/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol +++ b/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol @@ -4,5 +4,5 @@ contract A { } } // ---- -// Warning: (47-53): Unused local variable. -// Warning: (17-100): Function state mutability can be restricted to pure +// Warning 2072: (47-53): Unused local variable. +// Warning 2018: (17-100): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol b/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol index 40aaa9170b7e..e63a4fba0a2f 100644 --- a/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol +++ b/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol @@ -5,6 +5,6 @@ contract A { } } // ---- -// Warning: (47-53): Unused local variable. -// Warning: (78-84): Unused local variable. -// Warning: (17-107): Function state mutability can be restricted to pure +// Warning 2072: (47-53): Unused local variable. +// Warning 2072: (78-84): Unused local variable. +// Warning 2018: (17-107): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol b/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol index 705fbadf3923..1aa092298eec 100644 --- a/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol +++ b/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol @@ -5,6 +5,6 @@ contract A { } } // ---- -// Warning: (47-53): Unused local variable. -// Warning: (79-85): Unused local variable. -// Warning: (17-110): Function state mutability can be restricted to pure +// Warning 2072: (47-53): Unused local variable. +// Warning 2072: (79-85): Unused local variable. +// Warning 2018: (17-110): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol b/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol index bbabf957851b..d475d8efc30a 100644 --- a/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol @@ -7,6 +7,6 @@ contract A { } } // ---- -// Warning: (87-93): Unused local variable. -// Warning: (121-127): Unused local variable. -// Warning: (17-150): Function state mutability can be restricted to pure +// Warning 2072: (87-93): Unused local variable. +// Warning 2072: (121-127): Unused local variable. +// Warning 2018: (17-150): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol index 26d126ceac65..a8dbd391d2be 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -2,4 +2,4 @@ contract Foo { uint constant = 4; } // ---- -// ParserError: (30-31): Expected identifier but got '=' +// ParserError 2314: (30-31): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol index 8fddc9888255..6f007633d9b2 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (43-51): The state mutability modifier "constant" was removed in version 0.5.0. Use "view" or "pure" instead. +// ParserError 7698: (43-51): The state mutability modifier "constant" was removed in version 0.5.0. Use "view" or "pure" instead. diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol index 2cbf29e0d3af..230176df7c0c 100644 --- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol @@ -7,8 +7,8 @@ contract A { } // ---- // UnimplementedFeatureError: Not yet implemented - FixedPointType. -// Warning: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (93-104): Unused local variable. -// Warning: (114-121): Unused local variable. -// Warning: (41-128): Function state mutability can be restricted to pure +// Warning 5667: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2072: (93-104): Unused local variable. +// Warning 2072: (114-121): Unused local variable. +// Warning 2018: (41-128): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol index b0d938a016da..a9675f3f1984 100644 --- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol @@ -2,4 +2,4 @@ contract A { fixed40x40 pi = 3.14; } // ---- -// TypeError: (33-37): Type rational_const 157 / 50 is not implicitly convertible to expected type fixed40x40. Try converting to type ufixed16x2 or use an explicit conversion. +// TypeError 2326: (33-37): Type rational_const 157 / 50 is not implicitly convertible to expected type fixed40x40. Try converting to type ufixed16x2 or use an explicit conversion. 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 41b2762b66ab..8993d87ec267 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 @@ -14,16 +14,16 @@ contract C { ufixed80x80 payable m; } // ---- -// ParserError: (22-29): State mutability can only be specified for address types. -// ParserError: (44-51): State mutability can only be specified for address types. -// ParserError: (63-70): State mutability can only be specified for address types. -// ParserError: (85-92): State mutability can only be specified for address types. -// ParserError: (105-112): State mutability can only be specified for address types. -// ParserError: (128-135): State mutability can only be specified for address types. -// ParserError: (148-155): State mutability can only be specified for address types. -// ParserError: (169-176): State mutability can only be specified for address types. -// ParserError: (192-199): State mutability can only be specified for address types. -// ParserError: (213-220): State mutability can only be specified for address types. -// ParserError: (239-246): State mutability can only be specified for address types. -// ParserError: (261-268): State mutability can only be specified for address types. -// ParserError: (288-295): State mutability can only be specified for address types. +// ParserError 9106: (22-29): State mutability can only be specified for address types. +// ParserError 9106: (44-51): State mutability can only be specified for address types. +// ParserError 9106: (63-70): State mutability can only be specified for address types. +// 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. 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 9cb0fb4f3edf..cc39855d43cc 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol @@ -14,16 +14,16 @@ contract C { function m(ufixed80x80 payable) public pure {} } // ---- -// ParserError: (33-40): State mutability can only be specified for address types. -// ParserError: (79-86): State mutability can only be specified for address types. -// ParserError: (122-129): State mutability can only be specified for address types. -// ParserError: (168-175): State mutability can only be specified for address types. -// ParserError: (212-219): State mutability can only be specified for address types. -// ParserError: (259-266): State mutability can only be specified for address types. -// ParserError: (303-310): State mutability can only be specified for address types. -// ParserError: (348-355): State mutability can only be specified for address types. -// ParserError: (395-402): State mutability can only be specified for address types. -// ParserError: (440-447): State mutability can only be specified for address types. -// ParserError: (490-497): State mutability can only be specified for address types. -// ParserError: (536-543): State mutability can only be specified for address types. -// ParserError: (587-594): State mutability can only be specified for address types. +// ParserError 9106: (33-40): State mutability can only be specified for address types. +// ParserError 9106: (79-86): State mutability can only be specified for address types. +// ParserError 9106: (122-129): State mutability can only be specified for address types. +// 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. 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 3d47f1c779be..b36f9e6d50d5 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol @@ -16,16 +16,16 @@ contract C { } } // ---- -// ParserError: (57-64): State mutability can only be specified for address types. -// ParserError: (83-90): State mutability can only be specified for address types. -// ParserError: (106-113): State mutability can only be specified for address types. -// ParserError: (132-139): State mutability can only be specified for address types. -// ParserError: (156-163): State mutability can only be specified for address types. -// ParserError: (183-190): State mutability can only be specified for address types. -// ParserError: (207-214): State mutability can only be specified for address types. -// ParserError: (232-239): State mutability can only be specified for address types. -// ParserError: (259-266): State mutability can only be specified for address types. -// ParserError: (284-291): State mutability can only be specified for address types. -// ParserError: (314-321): State mutability can only be specified for address types. -// ParserError: (340-347): State mutability can only be specified for address types. -// ParserError: (371-378): State mutability can only be specified for address types. +// ParserError 9106: (57-64): State mutability can only be specified for address types. +// ParserError 9106: (83-90): State mutability can only be specified for address types. +// ParserError 9106: (106-113): State mutability can only be specified for address types. +// 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. 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 fc7a3c25aacd..5006936ef4c6 100644 --- a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol +++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol @@ -14,16 +14,16 @@ contract C { function m() public pure returns (ufixed80x80 payable) {} } // ---- -// ParserError: (56-63): State mutability can only be specified for address types. -// ParserError: (113-120): State mutability can only be specified for address types. -// ParserError: (167-174): State mutability can only be specified for address types. -// ParserError: (224-231): State mutability can only be specified for address types. -// ParserError: (279-286): State mutability can only be specified for address types. -// ParserError: (337-344): State mutability can only be specified for address types. -// ParserError: (392-399): State mutability can only be specified for address types. -// ParserError: (448-455): State mutability can only be specified for address types. -// ParserError: (506-513): State mutability can only be specified for address types. -// ParserError: (562-569): State mutability can only be specified for address types. -// ParserError: (623-630): State mutability can only be specified for address types. -// ParserError: (680-687): State mutability can only be specified for address types. -// ParserError: (742-749): State mutability can only be specified for address types. +// ParserError 9106: (56-63): State mutability can only be specified for address types. +// ParserError 9106: (113-120): State mutability can only be specified for address types. +// ParserError 9106: (167-174): State mutability can only be specified for address types. +// 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. diff --git a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol index c2a1aaeb7fc6..5b423564e583 100644 --- a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol +++ b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (20-147): Function state mutability can be restricted to pure +// Warning 2018: (20-147): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol index b838b4af1763..3e1f733faae9 100644 --- a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol +++ b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (49-50): Expected '(' but got ';' +// ParserError 2314: (49-50): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/empty_enum.sol b/test/libsolidity/syntaxTests/parsing/empty_enum.sol index 483f6a917685..36c05fd4b768 100644 --- a/test/libsolidity/syntaxTests/parsing/empty_enum.sol +++ b/test/libsolidity/syntaxTests/parsing/empty_enum.sol @@ -2,4 +2,4 @@ contract c { enum foo { } } // ---- -// ParserError: (25-26): enum with no members is not allowed. +// ParserError 3147: (25-26): enum with no members is not allowed. diff --git a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol index b38c7dc9bf80..2e294fde9246 100644 --- a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol +++ b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol @@ -2,4 +2,4 @@ contract c { event e; } // ---- -// ParserError: (21-22): Expected '(' but got ';' +// ParserError 2314: (21-22): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/exp_expression.sol b/test/libsolidity/syntaxTests/parsing/exp_expression.sol index 6b307ea07c70..17e3deadb5a6 100644 --- a/test/libsolidity/syntaxTests/parsing/exp_expression.sol +++ b/test/libsolidity/syntaxTests/parsing/exp_expression.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// Warning: (61-70): Unused local variable. -// Warning: (20-86): Function state mutability can be restricted to pure +// Warning 2072: (61-70): Unused local variable. +// Warning 2018: (20-86): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol index 2a02d19a7c33..8935d4c5a001 100644 --- a/test/libsolidity/syntaxTests/parsing/external_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -2,4 +2,4 @@ contract c { uint external x; } // ---- -// ParserError: (19-27): Expected identifier but got 'external' +// ParserError 2314: (19-27): Expected identifier but got 'external' diff --git a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol index 0d5734aabe58..e85f9a54cd1f 100644 --- a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol +++ b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol @@ -2,4 +2,4 @@ contract A { fixed40x40 pi = 3.14.15; } // ---- -// ParserError: (34-37): Expected ';' but got 'Number' +// ParserError 2314: (34-37): Expected ';' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol index 9fafd706bb7e..53cfe1a4f36b 100644 --- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol +++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol @@ -7,8 +7,8 @@ contract test { } } // ---- -// Warning: (103-106): Unreachable code. -// Warning: (144-152): Unreachable code. -// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (122-131): Unused local variable. -// Warning: (20-169): Function state mutability can be restricted to pure +// Warning 5740: (103-106): Unreachable code. +// Warning 5740: (144-152): Unreachable code. +// Warning 5667: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2072: (122-131): Unused local variable. +// Warning 2018: (20-169): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol index c36f9c5815e4..6c0e4b0e39ed 100644 --- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol +++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol @@ -7,7 +7,7 @@ contract test { } } // ---- -// Warning: (144-152): Unreachable code. -// Warning: (37-46): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (122-131): Unused local variable. -// Warning: (24-177): Function state mutability can be restricted to pure +// Warning 5740: (144-152): Unreachable code. +// Warning 5667: (37-46): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2072: (122-131): Unused local variable. +// Warning 2018: (24-177): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol b/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol index c6af519cdd3c..83869238257a 100644 --- a/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol +++ b/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (20-136): Function state mutability can be restricted to pure +// Warning 5667: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2018: (20-136): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol index c81f611b506b..220c120cd8a5 100644 --- a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol +++ b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol @@ -6,8 +6,8 @@ contract test { } } // ---- -// Warning: (89-92): Unreachable code. -// Warning: (130-138): Unreachable code. -// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (108-117): Unused local variable. -// Warning: (20-155): Function state mutability can be restricted to pure +// Warning 5740: (89-92): Unreachable code. +// Warning 5740: (130-138): Unreachable code. +// Warning 5667: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2072: (108-117): Unused local variable. +// Warning 2018: (20-155): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol index 90a931a87913..35e9997c92f2 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol @@ -2,4 +2,4 @@ contract test { function (uint, uint) modifier1() returns (uint) f1; } // ---- -// ParserError: (48-49): Expected ';' but got '(' +// ParserError 2314: (48-49): Expected ';' but got '(' diff --git a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol index 000c20116a95..725a777abd0b 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol @@ -5,5 +5,5 @@ contract test { } } // ---- -// Warning: (108-156): Unused local variable. -// Warning: (78-167): Function state mutability can be restricted to pure +// Warning 2072: (108-156): Unused local variable. +// Warning 2018: (78-167): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/function_type_in_struct.sol b/test/libsolidity/syntaxTests/parsing/function_type_in_struct.sol index c7703b47c5c1..5bd6c8dcfab0 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_in_struct.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_in_struct.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// Warning: (49-55): Naming function type parameters is deprecated. -// Warning: (57-63): Naming function type parameters is deprecated. +// Warning 6162: (49-55): Naming function type parameters is deprecated. +// Warning 6162: (57-63): Naming function type parameters is deprecated. diff --git a/test/libsolidity/syntaxTests/parsing/if_statement.sol b/test/libsolidity/syntaxTests/parsing/if_statement.sol index b3269785dd6d..b649203107ba 100644 --- a/test/libsolidity/syntaxTests/parsing/if_statement.sol +++ b/test/libsolidity/syntaxTests/parsing/if_statement.sol @@ -4,5 +4,5 @@ contract test { } } // ---- -// Warning: (109-115): Unused local variable. -// Warning: (20-128): Function state mutability can be restricted to pure +// Warning 2072: (109-115): Unused local variable. +// Warning 2018: (20-128): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/import_complex.sol b/test/libsolidity/syntaxTests/parsing/import_complex.sol index 8bbb0a88379d..12d9e73bcbed 100644 --- a/test/libsolidity/syntaxTests/parsing/import_complex.sol +++ b/test/libsolidity/syntaxTests/parsing/import_complex.sol @@ -1,3 +1,3 @@ import {hello, world} from "hello"; // ---- -// ParserError: (0-35): Source "hello" not found: File not supplied initially. +// ParserError 6275: (0-35): Source "hello" not found: File not supplied initially. diff --git a/test/libsolidity/syntaxTests/parsing/import_complex_invalid_from.sol b/test/libsolidity/syntaxTests/parsing/import_complex_invalid_from.sol index c466760656cd..6709260b0666 100644 --- a/test/libsolidity/syntaxTests/parsing/import_complex_invalid_from.sol +++ b/test/libsolidity/syntaxTests/parsing/import_complex_invalid_from.sol @@ -1,3 +1,3 @@ import {hello, world} from function; // ---- -// ParserError: (27-35): Expected import path. +// ParserError 6845: (27-35): Expected import path. diff --git a/test/libsolidity/syntaxTests/parsing/import_complex_without_from.sol b/test/libsolidity/syntaxTests/parsing/import_complex_without_from.sol index 961acb22bbcc..34d5433db84c 100644 --- a/test/libsolidity/syntaxTests/parsing/import_complex_without_from.sol +++ b/test/libsolidity/syntaxTests/parsing/import_complex_without_from.sol @@ -1,3 +1,3 @@ import {hello, world}; // ---- -// ParserError: (21-22): Expected "from". +// ParserError 8208: (21-22): Expected "from". diff --git a/test/libsolidity/syntaxTests/parsing/import_empty.sol b/test/libsolidity/syntaxTests/parsing/import_empty.sol index 1853f6ec33a3..74931d4dd00b 100644 --- a/test/libsolidity/syntaxTests/parsing/import_empty.sol +++ b/test/libsolidity/syntaxTests/parsing/import_empty.sol @@ -1,3 +1,3 @@ import ""; // ---- -// ParserError: (9-10): Import path cannot be empty. +// ParserError 6326: (9-10): Import path cannot be empty. diff --git a/test/libsolidity/syntaxTests/parsing/import_invalid_token.sol b/test/libsolidity/syntaxTests/parsing/import_invalid_token.sol index df837e28395c..24150e76d061 100644 --- a/test/libsolidity/syntaxTests/parsing/import_invalid_token.sol +++ b/test/libsolidity/syntaxTests/parsing/import_invalid_token.sol @@ -1,3 +1,3 @@ import function; // ---- -// ParserError: (7-15): Expected string literal (path), "*" or alias list. +// ParserError 9478: (7-15): Expected string literal (path), "*" or alias list. diff --git a/test/libsolidity/syntaxTests/parsing/import_simple.sol b/test/libsolidity/syntaxTests/parsing/import_simple.sol index 5d61a8bbf08e..e4ee0ce1b0dc 100644 --- a/test/libsolidity/syntaxTests/parsing/import_simple.sol +++ b/test/libsolidity/syntaxTests/parsing/import_simple.sol @@ -1,3 +1,3 @@ import "hello"; // ---- -// ParserError: (0-15): Source "hello" not found: File not supplied initially. +// ParserError 6275: (0-15): Source "hello" not found: File not supplied initially. diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol index 9460751c8fe8..05496b9b2621 100644 --- a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// ParserError: (62-63): Expected expression (inline array elements cannot be omitted). +// ParserError 4799: (62-63): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol index 5b78232de7ce..1837fe650f7b 100644 --- a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// ParserError: (75-76): Expected expression (inline array elements cannot be omitted). +// ParserError 4799: (75-76): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol index 352b5f8fedaa..fa079ae4b042 100644 --- a/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol +++ b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// ParserError: (44-47): Identifier-start is not allowed at end of a number. +// ParserError 8936: (44-47): Identifier-start is not allowed at end of a number. diff --git a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_decimal_fail.sol b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_decimal_fail.sol index 8978996dcc35..6cbeb217c771 100644 --- a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_decimal_fail.sol +++ b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_decimal_fail.sol @@ -7,7 +7,7 @@ contract C { } } // ---- -// SyntaxError: (56-61): Invalid use of underscores in number literal. No trailing underscores allowed. -// SyntaxError: (77-83): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. -// SyntaxError: (99-105): Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed. -// SyntaxError: (121-127): Invalid use of underscores in number literal. No underscore in front of exponent allowed. +// SyntaxError 2090: (56-61): Invalid use of underscores in number literal. No trailing underscores allowed. +// SyntaxError 2990: (77-83): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. +// SyntaxError 6415: (99-105): Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed. +// SyntaxError 6165: (121-127): Invalid use of underscores in number literal. No underscore in front of exponent allowed. diff --git a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed_fail.sol b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed_fail.sol index 3b91895d542b..49bf042cdabe 100644 --- a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed_fail.sol +++ b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed_fail.sol @@ -9,9 +9,9 @@ contract C { } } // ---- -// SyntaxError: (57-64): Invalid use of underscores in number literal. No trailing underscores allowed. -// SyntaxError: (81-91): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. -// SyntaxError: (108-112): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed. -// SyntaxError: (129-133): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed. -// SyntaxError: (150-157): Invalid use of underscores in number literal. No underscore in front of exponent allowed. -// SyntaxError: (174-177): Invalid use of underscores in number literal. No trailing underscores allowed. +// SyntaxError 2090: (57-64): Invalid use of underscores in number literal. No trailing underscores allowed. +// SyntaxError 2990: (81-91): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. +// SyntaxError 1023: (108-112): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed. +// SyntaxError 3891: (129-133): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed. +// SyntaxError 6165: (150-157): Invalid use of underscores in number literal. No underscore in front of exponent allowed. +// SyntaxError 2090: (174-177): Invalid use of underscores in number literal. No trailing underscores allowed. diff --git a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_hex_fail.sol b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_hex_fail.sol index a8a488c149a0..5a2e2f5c1f7e 100644 --- a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_hex_fail.sol +++ b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_hex_fail.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// SyntaxError: (56-79): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. +// SyntaxError 2990: (56-79): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed. diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol index 64116b8825e6..395bacc3e2b0 100644 --- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol +++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol @@ -12,4 +12,4 @@ contract c { uint256 d; } // ---- -// Warning: (170-179): This declaration shadows an existing declaration. +// Warning 2519: (170-179): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol index 505fe0b5fc95..6a4427361d17 100644 --- a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol @@ -6,4 +6,4 @@ contract Foo { } } // ---- -// ParserError: (67-75): Expected ';' but got 'constant' +// ParserError 2314: (67-75): Expected ';' but got 'constant' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals_multi.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals_multi.sol index d53208ef2e9d..f660c0953ec4 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals_multi.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals_multi.sol @@ -7,6 +7,6 @@ contract Foo { } } // ---- -// ParserError: (85-91): Location already specified. -// ParserError: (123-130): Location already specified. -// ParserError: (131-139): Location already specified. +// ParserError 3548: (85-91): Location already specified. +// ParserError 3548: (123-130): Location already specified. +// ParserError 3548: (131-139): Location already specified. diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol index b9b1f97cd853..a441c37b7b0f 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol @@ -2,4 +2,4 @@ contract Foo { function f(uint[] storage constant x, uint[] memory y) internal { } } // ---- -// DeclarationError: (30-55): The "constant" keyword can only be used for state variables. +// DeclarationError 1788: (30-55): The "constant" keyword can only be used for state variables. diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params_multi.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params_multi.sol index c6155c09015a..25d1e02d3c0b 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params_multi.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params_multi.sol @@ -2,5 +2,5 @@ contract Foo { function f(uint[] storage memory constant x, uint[] memory calldata y) internal { } } // ---- -// ParserError: (45-51): Location already specified. -// ParserError: (78-86): Location already specified. +// ParserError 3548: (45-51): Location already specified. +// ParserError 3548: (78-86): Location already specified. diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol index 40eaf8389e04..53d7c2771de1 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory x; } // ---- -// ParserError: (23-29): Expected identifier but got 'memory' +// ParserError 2314: (23-29): Expected identifier but got 'memory' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables_multi.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables_multi.sol index e34df2b22452..134397fec670 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables_multi.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables_multi.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory storage calldata x; } // ---- -// ParserError: (23-29): Expected identifier but got 'memory' +// ParserError 2314: (23-29): Expected identifier but got 'memory' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol index 2b8f08c5e50b..35d145a3b86a 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var memory x; } } // ---- -// ParserError: (35-41): Location specifier needs explicit type name. +// ParserError 7439: (35-41): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol index 811b4219168f..fd00ac497960 100644 --- a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol @@ -2,4 +2,4 @@ contract c { enum foo { WARNING,} } // ---- -// ParserError: (33-34): Expected identifier after ',' +// ParserError 1612: (33-34): Expected identifier after ',' diff --git a/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol b/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol index 7e6f98d7c199..e83761a0985d 100644 --- a/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol +++ b/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol @@ -2,4 +2,4 @@ contract C { mapping(address payable => uint) m; } // ---- -// ParserError: (33-40): Expected '=>' but got 'payable' +// ParserError 2314: (33-40): Expected '=>' but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_1.sol b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_1.sol index ea2d282cc244..b27befba1f77 100644 --- a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_1.sol +++ b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_1.sol @@ -2,4 +2,4 @@ contract c { mapping(uint[] => uint) data; } // ---- -// ParserError: (26-27): Expected '=>' but got '[' +// ParserError 2314: (26-27): Expected '=>' but got '[' diff --git a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_2.sol b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_2.sol index e15e1aea98c8..71063e34ea42 100644 --- a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_2.sol +++ b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_2.sol @@ -5,4 +5,4 @@ contract c { mapping(S => uint) data; } // ---- -// TypeError: (47-48): Only elementary types, contract types or enums are allowed as mapping keys. +// TypeError 7804: (47-48): Only elementary types, contract types or enums are allowed as mapping keys. diff --git a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_3.sol b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_3.sol index b17cf4139f40..34f0e82b363e 100644 --- a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_3.sol +++ b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_3.sol @@ -5,4 +5,4 @@ contract c { mapping(S => uint) data; } // ---- -// TypeError: (49-50): Only elementary types, contract types or enums are allowed as mapping keys. +// TypeError 7804: (49-50): Only elementary types, contract types or enums are allowed as mapping keys. diff --git a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_4.sol b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_4.sol index f4dcb00ade25..551d41b38b42 100644 --- a/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_4.sol +++ b/test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_4.sol @@ -2,4 +2,4 @@ contract c { mapping(string[] => uint) data; } // ---- -// ParserError: (28-29): Expected '=>' but got '[' +// ParserError 2314: (28-29): Expected '=>' but got '[' diff --git a/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol index f7c3fb310ae4..a54df516f30f 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({a: , b: , c: }); } } // ---- -// ParserError: (146-147): Expected primary expression. +// ParserError 6933: (146-147): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol index d7c2f2be20dc..799144cfb4c3 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({: 1, : 2, : 3}); } } // ---- -// ParserError: (143-144): Expected identifier but got ':' +// ParserError 2314: (143-144): Expected identifier but got ':' diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index 51b7bd24d484..cd4025405e3b 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: (28-29): Expected identifier but got ';' +// ParserError 2314: (28-29): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol index a9fa33e63bea..6b3a1de56251 100644 --- a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol +++ b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol @@ -2,4 +2,4 @@ contract c { modifier mod { if (msg.sender == 0) _ } } // ---- -// ParserError: (52-53): Expected ';' but got '}' +// ParserError 2314: (52-53): Expected ';' but got '}' diff --git a/test/libsolidity/syntaxTests/parsing/multiple_event_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/multiple_event_arg_trailing_comma.sol index bfbe7e5cb8c7..a1d4872bee96 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_event_arg_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_event_arg_trailing_comma.sol @@ -3,4 +3,4 @@ contract test { function(uint a) {} } // ---- -// ParserError: (45-46): Unexpected trailing comma in parameter list. +// ParserError 7591: (45-46): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol index ae65b33cae93..ae73c79542b1 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function(uint a, uint b,) {} } // ---- -// ParserError: (40-41): Unexpected trailing comma in parameter list. +// ParserError 7591: (40-41): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/multiple_modifier_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/multiple_modifier_arg_trailing_comma.sol index eb206fb7c2a4..7f6dcbd9380e 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_modifier_arg_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_modifier_arg_trailing_comma.sol @@ -3,4 +3,4 @@ contract test { function(uint a) {} } // ---- -// ParserError: (51-52): Unexpected trailing comma in parameter list. +// ParserError 7591: (51-52): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/multiple_return_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/multiple_return_param_trailing_comma.sol index 2dd8f1964307..001993f21cb4 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_return_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_return_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function() returns (uint a, uint b,) {} } // ---- -// ParserError: (54-55): Unexpected trailing comma in parameter list. +// ParserError 7591: (54-55): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol index a05bf4524c9b..e92302f37fb2 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol @@ -23,11 +23,11 @@ contract c8 { function f() view constant {} } // ---- -// ParserError: (39-46): State mutability already specified as "payable". -// ParserError: (88-92): State mutability already specified as "view". -// ParserError: (134-138): State mutability already specified as "pure". -// ParserError: (180-184): State mutability already specified as "pure". -// ParserError: (229-233): State mutability already specified as "payable". -// ParserError: (275-282): State mutability already specified as "pure". -// ParserError: (324-332): State mutability already specified as "pure". -// ParserError: (374-382): State mutability already specified as "view". +// ParserError 9680: (39-46): State mutability already specified as "payable". +// ParserError 9680: (88-92): State mutability already specified as "view". +// ParserError 9680: (134-138): State mutability already specified as "pure". +// ParserError 9680: (180-184): State mutability already specified as "pure". +// ParserError 9680: (229-233): State mutability already specified as "payable". +// ParserError 9680: (275-282): State mutability already specified as "pure". +// ParserError 9680: (324-332): State mutability already specified as "pure". +// ParserError 9680: (374-382): State mutability already specified as "view". diff --git a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol index d469bc75cf52..5d3e6acaa5cd 100644 --- a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol +++ b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (35-38): Expected explicit type name. +// ParserError 7059: (35-38): Expected explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol index fe050d1b819a..a3359f8bb239 100644 --- a/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol +++ b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol @@ -3,5 +3,5 @@ contract test { function fun(uint a, uint b) public returns(uint r) { return a + b; } } // ---- -// Warning: (17-74): Function state mutability can be restricted to pure -// Warning: (76-145): Function state mutability can be restricted to pure +// Warning 2018: (17-74): Function state mutability can be restricted to pure +// Warning 2018: (76-145): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol index 0bc857841575..4df1b18df81e 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -2,4 +2,4 @@ contract test { uint payable x; } // ---- -// ParserError: (22-29): State mutability can only be specified for address types. +// ParserError 9106: (22-29): State mutability can only be specified for address types. diff --git a/test/libsolidity/syntaxTests/parsing/payable_without_arguments.sol b/test/libsolidity/syntaxTests/parsing/payable_without_arguments.sol index b9486f596c8c..0e9dd7c3c070 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_without_arguments.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_without_arguments.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (70-71): Expected '(' but got ';' +// ParserError 2314: (70-71): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol index a50855c0d83e..67db5ee35ccb 100644 --- a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol +++ b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// Warning: (17-105): Function state mutability can be restricted to pure +// Warning 2018: (17-105): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/pragma_illegal.sol b/test/libsolidity/syntaxTests/parsing/pragma_illegal.sol index 3395f6be83b4..f9c714080fdf 100644 --- a/test/libsolidity/syntaxTests/parsing/pragma_illegal.sol +++ b/test/libsolidity/syntaxTests/parsing/pragma_illegal.sol @@ -1,4 +1,4 @@ pragma ``; // ---- -// ParserError: (7-8): Token incompatible with Solidity parser as part of pragma directive. -// ParserError: (8-9): Token incompatible with Solidity parser as part of pragma directive. +// ParserError 6281: (7-8): Token incompatible with Solidity parser as part of pragma directive. +// ParserError 6281: (8-9): Token incompatible with Solidity parser as part of pragma directive. diff --git a/test/libsolidity/syntaxTests/parsing/return_var.sol b/test/libsolidity/syntaxTests/parsing/return_var.sol index b9ce8f959bb0..87c706d5837a 100644 --- a/test/libsolidity/syntaxTests/parsing/return_var.sol +++ b/test/libsolidity/syntaxTests/parsing/return_var.sol @@ -9,17 +9,17 @@ contract C { function f() public pure returns (var storage x, var storage y) {} } // ---- -// ParserError: (38-41): Expected explicit type name. -// ParserError: (71-74): Expected explicit type name. -// ParserError: (106-109): Expected explicit type name. -// ParserError: (157-160): Expected explicit type name. -// ParserError: (192-195): Expected explicit type name. -// ParserError: (199-202): Expected explicit type name. -// ParserError: (247-250): Expected explicit type name. -// ParserError: (251-258): Location specifier needs explicit type name. -// ParserError: (301-304): Expected explicit type name. -// ParserError: (305-312): Location specifier needs explicit type name. -// ParserError: (357-360): Expected explicit type name. -// ParserError: (361-368): Location specifier needs explicit type name. -// ParserError: (372-375): Expected explicit type name. -// ParserError: (376-383): Location specifier needs explicit type name. +// ParserError 7059: (38-41): Expected explicit type name. +// ParserError 7059: (71-74): Expected explicit type name. +// ParserError 7059: (106-109): Expected explicit type name. +// ParserError 7059: (157-160): Expected explicit type name. +// ParserError 7059: (192-195): Expected explicit type name. +// ParserError 7059: (199-202): Expected explicit type name. +// ParserError 7059: (247-250): Expected explicit type name. +// ParserError 7439: (251-258): Location specifier needs explicit type name. +// ParserError 7059: (301-304): Expected explicit type name. +// ParserError 7439: (305-312): Location specifier needs explicit type name. +// ParserError 7059: (357-360): Expected explicit type name. +// ParserError 7439: (361-368): Location specifier needs explicit type name. +// ParserError 7059: (372-375): Expected explicit type name. +// ParserError 7439: (376-383): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol index 50638dc7c7b1..8169b78c3e43 100644 --- a/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol @@ -3,4 +3,4 @@ contract test { function(uint a) {} } // ---- -// ParserError: (34-35): Unexpected trailing comma in parameter list. +// ParserError 7591: (34-35): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol index fe52b3b2cbb8..20bfc5cb9495 100644 --- a/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function(uint a,) {} } // ---- -// ParserError: (32-33): Unexpected trailing comma in parameter list. +// ParserError 7591: (32-33): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol index 2f60405ff454..f88cf1ae8317 100644 --- a/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol @@ -3,4 +3,4 @@ contract test { function(uint a) {} } // ---- -// ParserError: (40-41): Unexpected trailing comma in parameter list. +// ParserError 7591: (40-41): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol index 99f918191bfd..d199981a41de 100644 --- a/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function() returns (uint a,) {} } // ---- -// ParserError: (43-44): Unexpected trailing comma in parameter list. +// ParserError 7591: (43-44): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol index 8fc3dab833fa..f791509c9037 100644 --- a/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({a: 1, b: 2, c: 3, }); } } // ---- -// ParserError: (159-160): Unexpected trailing comma. +// ParserError 2074: (159-160): Unexpected trailing comma. diff --git a/test/libsolidity/syntaxTests/parsing/trailing_dot1.sol b/test/libsolidity/syntaxTests/parsing/trailing_dot1.sol index d91c385a63e7..fd7b833597c5 100644 --- a/test/libsolidity/syntaxTests/parsing/trailing_dot1.sol +++ b/test/libsolidity/syntaxTests/parsing/trailing_dot1.sol @@ -4,4 +4,4 @@ contract test { uint256 c = 4.e-2; } // ---- -// TypeError: (70-73): Member "e" not found or not visible after argument-dependent lookup in int_const 4. +// TypeError 9582: (70-73): Member "e" not found or not visible after argument-dependent lookup in int_const 4. diff --git a/test/libsolidity/syntaxTests/parsing/trailing_dot2.sol b/test/libsolidity/syntaxTests/parsing/trailing_dot2.sol index 38a7ab2d6d74..7e4d6cb37dfe 100644 --- a/test/libsolidity/syntaxTests/parsing/trailing_dot2.sol +++ b/test/libsolidity/syntaxTests/parsing/trailing_dot2.sol @@ -4,4 +4,4 @@ contract test { uint256 c = 2 + 2.; } // ---- -// ParserError: (76-77): Expected identifier but got ';' +// ParserError 2314: (76-77): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/trailing_dot3.sol b/test/libsolidity/syntaxTests/parsing/trailing_dot3.sol index 6a126cb3aab4..de2ea55eae8d 100644 --- a/test/libsolidity/syntaxTests/parsing/trailing_dot3.sol +++ b/test/libsolidity/syntaxTests/parsing/trailing_dot3.sol @@ -1,4 +1,4 @@ contract test { uint a = 2. // ---- -// ParserError: (29-29): Expected identifier but got end of source +// ParserError 2314: (29-29): Expected identifier but got end of source diff --git a/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol b/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol index dba3e7acc9f4..4d2919211d8b 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (76-77): Expected '=' but got ';' +// ParserError 2314: (76-77): Expected '=' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol index fcbb875c5f9c..4ed1afe9307f 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (42-43): Expected ',' but got 'Number' +// ParserError 2314: (42-43): Expected ',' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol b/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol index 957740d06a6e..ccd0fb7b9fdf 100644 --- a/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol +++ b/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol @@ -6,4 +6,4 @@ contract test { function fun(uint a) public returns(uint r) { return a; } } // ---- -// DeclarationError: (189-246): Function with same name and arguments defined twice. +// DeclarationError 1686: (189-246): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol index f2542d9070d5..4d1afd7af29a 100644 --- a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol +++ b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol @@ -5,5 +5,5 @@ contract test { } } // ---- -// SyntaxError: (70-72): Use of unary + is disallowed. -// TypeError: (70-72): Unary operator + cannot be applied to type uint256 +// SyntaxError 9636: (70-72): Use of unary + is disallowed. +// TypeError 4907: (70-72): Unary operator + cannot be applied to type uint256 diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index e08f55117e1a..132d234c442a 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError: (34-35): Expected identifier but got '[' +// ParserError 2314: (34-35): Expected identifier but got '[' diff --git a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol index 2e5a9c58643c..85d78441d7d8 100644 --- a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol +++ b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol @@ -9,17 +9,17 @@ contract C { function f(var storage x, var storage y) public pure {} } // ---- -// ParserError: (28-31): Expected explicit type name. -// ParserError: (63-66): Expected explicit type name. -// ParserError: (100-103): Expected explicit type name. -// ParserError: (107-110): Expected explicit type name. -// ParserError: (152-155): Expected explicit type name. -// ParserError: (189-192): Expected explicit type name. -// ParserError: (234-237): Expected explicit type name. -// ParserError: (238-245): Location specifier needs explicit type name. -// ParserError: (277-280): Expected explicit type name. -// ParserError: (281-288): Location specifier needs explicit type name. -// ParserError: (322-325): Expected explicit type name. -// ParserError: (326-333): Location specifier needs explicit type name. -// ParserError: (337-340): Expected explicit type name. -// ParserError: (341-348): Location specifier needs explicit type name. +// ParserError 7059: (28-31): Expected explicit type name. +// ParserError 7059: (63-66): Expected explicit type name. +// ParserError 7059: (100-103): Expected explicit type name. +// ParserError 7059: (107-110): Expected explicit type name. +// ParserError 7059: (152-155): Expected explicit type name. +// ParserError 7059: (189-192): Expected explicit type name. +// ParserError 7059: (234-237): Expected explicit type name. +// ParserError 7439: (238-245): Location specifier needs explicit type name. +// ParserError 7059: (277-280): Expected explicit type name. +// ParserError 7439: (281-288): Location specifier needs explicit type name. +// ParserError 7059: (322-325): Expected explicit type name. +// ParserError 7439: (326-333): Location specifier needs explicit type name. +// ParserError 7059: (337-340): Expected explicit type name. +// ParserError 7439: (341-348): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/var_storage_var.sol b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol index 6e4ccfa57947..5cbbd4599473 100644 --- a/test/libsolidity/syntaxTests/parsing/var_storage_var.sol +++ b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol @@ -2,4 +2,4 @@ contract C { var a; } // ---- -// ParserError: (17-20): Function, variable, struct or modifier declaration expected. +// ParserError 9182: (17-20): Function, variable, struct or modifier declaration expected. diff --git a/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol index f9ccfb5805a9..bd5165b89f7e 100644 --- a/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol +++ b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// ParserError: (44-47): Expected elementary type name or identifier for mapping key type +// ParserError 1005: (44-47): Expected elementary type name or identifier for mapping key type diff --git a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol index 240713880f33..3ecadd381ea9 100644 --- a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol @@ -8,4 +8,4 @@ contract c { function f_internal() internal {} } // ---- -// Warning: (58-71): This declaration shadows an existing declaration. +// Warning 2519: (58-71): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/parsing/while_loop.sol b/test/libsolidity/syntaxTests/parsing/while_loop.sol index cdac929f8d41..2f1477f83c74 100644 --- a/test/libsolidity/syntaxTests/parsing/while_loop.sol +++ b/test/libsolidity/syntaxTests/parsing/while_loop.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// Warning: (105-113): Unreachable code. +// Warning 5740: (105-113): Unreachable code. diff --git a/test/libsolidity/syntaxTests/pragma/invalid_pragma.sol b/test/libsolidity/syntaxTests/pragma/invalid_pragma.sol index cb2585bafef0..950492dd6a7a 100644 --- a/test/libsolidity/syntaxTests/pragma/invalid_pragma.sol +++ b/test/libsolidity/syntaxTests/pragma/invalid_pragma.sol @@ -1,3 +1,3 @@ pragma 0; // ---- -// SyntaxError: (0-9): Invalid pragma "0" +// SyntaxError 5226: (0-9): Invalid pragma "0" diff --git a/test/libsolidity/syntaxTests/pragma/unknown_pragma.sol b/test/libsolidity/syntaxTests/pragma/unknown_pragma.sol index 3a48edddf6ba..8c263965e61a 100644 --- a/test/libsolidity/syntaxTests/pragma/unknown_pragma.sol +++ b/test/libsolidity/syntaxTests/pragma/unknown_pragma.sol @@ -1,3 +1,3 @@ pragma thisdoesntexist; // ---- -// SyntaxError: (0-23): Unknown pragma "thisdoesntexist" +// SyntaxError 4936: (0-23): Unknown pragma "thisdoesntexist" diff --git a/test/libsolidity/syntaxTests/receiveEther/arguments.sol b/test/libsolidity/syntaxTests/receiveEther/arguments.sol index 07d92bba6b54..702314c0175a 100644 --- a/test/libsolidity/syntaxTests/receiveEther/arguments.sol +++ b/test/libsolidity/syntaxTests/receiveEther/arguments.sol @@ -2,4 +2,4 @@ contract C { receive(uint256) external payable {} } // ---- -// TypeError: (24-33): Receive ether function cannot take parameters. +// TypeError 6857: (24-33): Receive ether function cannot take parameters. diff --git a/test/libsolidity/syntaxTests/receiveEther/default_visibility.sol b/test/libsolidity/syntaxTests/receiveEther/default_visibility.sol index ec644a4535e1..598d13f95955 100644 --- a/test/libsolidity/syntaxTests/receiveEther/default_visibility.sol +++ b/test/libsolidity/syntaxTests/receiveEther/default_visibility.sol @@ -3,6 +3,6 @@ contract C { receive() {} } // ---- -// SyntaxError: (95-107): No visibility specified. Did you intend to add "external"? -// TypeError: (95-107): Receive ether function must be payable, but is "nonpayable". -// TypeError: (95-107): Receive ether function must be defined as "external". +// SyntaxError 4937: (95-107): No visibility specified. Did you intend to add "external"? +// TypeError 7793: (95-107): Receive ether function must be payable, but is "nonpayable". +// TypeError 4095: (95-107): Receive ether function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/receiveEther/old_syntax.sol b/test/libsolidity/syntaxTests/receiveEther/old_syntax.sol index ef50608d4116..b3c000234908 100644 --- a/test/libsolidity/syntaxTests/receiveEther/old_syntax.sol +++ b/test/libsolidity/syntaxTests/receiveEther/old_syntax.sol @@ -2,4 +2,4 @@ contract C { function() external payable {} } // ---- -// ParserError: (45-46): Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead. +// ParserError 2915: (45-46): Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead. diff --git a/test/libsolidity/syntaxTests/receiveEther/pure_modifier.sol b/test/libsolidity/syntaxTests/receiveEther/pure_modifier.sol index 4cdaa2e18292..ea1693c496f6 100644 --- a/test/libsolidity/syntaxTests/receiveEther/pure_modifier.sol +++ b/test/libsolidity/syntaxTests/receiveEther/pure_modifier.sol @@ -3,4 +3,4 @@ contract C { receive() external pure { x = 2; } } // ---- -// TypeError: (29-63): Receive ether function must be payable, but is "pure". +// TypeError 7793: (29-63): Receive ether function must be payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/receiveEther/receive_as_function_name.sol b/test/libsolidity/syntaxTests/receiveEther/receive_as_function_name.sol index 09f6315d1867..03372b73b558 100644 --- a/test/libsolidity/syntaxTests/receiveEther/receive_as_function_name.sol +++ b/test/libsolidity/syntaxTests/receiveEther/receive_as_function_name.sol @@ -2,4 +2,4 @@ contract C { function receive() external pure {} } // ---- -// Warning: (26-33): This function is named "receive" but is not the receive function of the contract. If you intend this to be a receive function, use "receive(...) { ... }" without the "function" keyword to define it. +// Warning 3445: (26-33): This function is named "receive" but is not the receive function of the contract. If you intend this to be a receive function, use "receive(...) { ... }" without the "function" keyword to define it. diff --git a/test/libsolidity/syntaxTests/receiveEther/return_value.sol b/test/libsolidity/syntaxTests/receiveEther/return_value.sol index 0a3cd8b133f7..f8371c7abe68 100644 --- a/test/libsolidity/syntaxTests/receiveEther/return_value.sol +++ b/test/libsolidity/syntaxTests/receiveEther/return_value.sol @@ -2,5 +2,5 @@ contract C { receive() external returns (uint256) {} } // ---- -// TypeError: (17-56): Receive ether function must be payable, but is "nonpayable". -// TypeError: (44-53): Receive ether function cannot return values. +// TypeError 7793: (17-56): Receive ether function must be payable, but is "nonpayable". +// TypeError 6899: (44-53): Receive ether function cannot return values. diff --git a/test/libsolidity/syntaxTests/receiveEther/view_modifier.sol b/test/libsolidity/syntaxTests/receiveEther/view_modifier.sol index 5f5b6a117e2f..0a088d1a1ab5 100644 --- a/test/libsolidity/syntaxTests/receiveEther/view_modifier.sol +++ b/test/libsolidity/syntaxTests/receiveEther/view_modifier.sol @@ -3,4 +3,4 @@ contract C { receive() external view { x = 2; } } // ---- -// TypeError: (29-63): Receive ether function must be payable, but is "view". +// TypeError 7793: (29-63): Receive ether function must be payable, but is "view". diff --git a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number.sol b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number.sol index 9741fdfba15a..34ceafa74829 100644 --- a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number.sol +++ b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// TypeError: (71-78): Return arguments required. -// TypeError: (143-156): Different number of arguments in return statement than in returns declaration. +// TypeError 6777: (71-78): Return arguments required. +// TypeError 5132: (143-156): Different number of arguments in return statement than in returns declaration. diff --git a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number_named.sol b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number_named.sol index 53f2d994fc57..d7d44778d928 100644 --- a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number_named.sol +++ b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_number_named.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// TypeError: (73-80): Return arguments required. -// TypeError: (147-160): Different number of arguments in return statement than in returns declaration. +// TypeError 6777: (73-80): Return arguments required. +// TypeError 5132: (147-160): Different number of arguments in return statement than in returns declaration. diff --git a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol index 0a9b993ee265..6cc56dc0000f 100644 --- a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol +++ b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol @@ -6,4 +6,4 @@ contract C } } // ---- -// TypeError: (78-86): Return argument type literal_string "string" is not implicitly convertible to expected type (type of first return variable) uint256. +// TypeError 6359: (78-86): Return argument type literal_string "string" is not implicitly convertible to expected type (type of first return variable) uint256. diff --git a/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number.sol b/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number.sol index 4ea61c6855e3..918ff29bfaaf 100644 --- a/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number.sol +++ b/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number.sol @@ -14,6 +14,6 @@ contract C } } // ---- -// TypeError: (77-85): Different number of arguments in return statement than in returns declaration. -// TypeError: (157-173): Different number of arguments in return statement than in returns declaration. -// TypeError: (245-252): Return arguments required. +// TypeError 8863: (77-85): Different number of arguments in return statement than in returns declaration. +// TypeError 5132: (157-173): Different number of arguments in return statement than in returns declaration. +// TypeError 6777: (245-252): Return arguments required. diff --git a/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number_named.sol b/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number_named.sol index 860497195fbb..9fce879ae0c4 100644 --- a/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number_named.sol +++ b/test/libsolidity/syntaxTests/returnExpressions/tuple_return_mismatching_number_named.sol @@ -14,6 +14,6 @@ contract C } } // ---- -// TypeError: (81-89): Different number of arguments in return statement than in returns declaration. -// TypeError: (165-181): Different number of arguments in return statement than in returns declaration. -// TypeError: (257-264): Return arguments required. +// TypeError 8863: (81-89): Different number of arguments in return statement than in returns declaration. +// TypeError 5132: (165-181): Different number of arguments in return statement than in returns declaration. +// TypeError 6777: (257-264): Return arguments required. diff --git a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol index dfd67aaaf3d2..324788e2c949 100644 --- a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol +++ b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol @@ -3,4 +3,4 @@ contract test { function fun() public { } } // ---- -// DeclarationError: (20-45): Function with same name and arguments defined twice. +// DeclarationError 1686: (20-45): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol index 36bae6a8bdd2..b29b5ae04415 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol @@ -5,5 +5,5 @@ contract test { } } // ---- -// Warning: (57-63): Unused local variable. -// Warning: (77-83): Unused local variable. +// Warning 2072: (57-63): Unused local variable. +// Warning 2072: (77-83): Unused local variable. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol index 0c03ec3e894e..2e997016375b 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol @@ -5,5 +5,5 @@ contract test { } } // ---- -// Warning: (57-63): Unused local variable. -// Warning: (75-81): Unused local variable. +// Warning 2072: (57-63): Unused local variable. +// Warning 2072: (75-81): Unused local variable. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol index 45c5ff2dc45d..47c3d1302564 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// Warning: (73-79): This declaration shadows an existing declaration. -// DeclarationError: (91-97): Identifier already declared. +// Warning 2519: (73-79): This declaration shadows an existing declaration. +// DeclarationError 2333: (91-97): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol index 72c31f73c90b..1113c4de8001 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: (71-77): Identifier already declared. +// DeclarationError 2333: (71-77): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol b/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol index d717981b9a23..4b558ec68d9c 100644 --- a/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol +++ b/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol @@ -3,4 +3,4 @@ contract C { uint public f = 0; } // ---- -// DeclarationError: (53-70): Identifier already declared. +// DeclarationError 2333: (53-70): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol index 67ada4a432fc..1e70c9181789 100644 --- a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol +++ b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol @@ -3,4 +3,4 @@ contract test { function f() pure public { uint32 variable; variable = 2; } } // ---- -// Warning: (69-84): This declaration shadows an existing declaration. +// Warning 2519: (69-84): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol b/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol index e414f611762c..f0500ede0b2c 100644 --- a/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol +++ b/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol @@ -9,8 +9,8 @@ contract test { } } // ---- -// DeclarationError: (71-77): Identifier already declared. -// DeclarationError: (87-93): Identifier already declared. -// DeclarationError: (103-109): Identifier already declared. -// DeclarationError: (119-125): Identifier already declared. -// DeclarationError: (135-141): Identifier already declared. +// DeclarationError 2333: (71-77): Identifier already declared. +// DeclarationError 2333: (87-93): Identifier already declared. +// DeclarationError 2333: (103-109): Identifier already declared. +// DeclarationError 2333: (119-125): Identifier already declared. +// DeclarationError 2333: (135-141): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/scoping.sol b/test/libsolidity/syntaxTests/scoping/scoping.sol index dae5a42d5e4d..bfd1c0b09908 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// DeclarationError: (93-94): Undeclared identifier. +// DeclarationError 7576: (93-94): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol index 8522a0e306ce..cdc3c7655716 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. +// DeclarationError 7576: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_activation_old.sol b/test/libsolidity/syntaxTests/scoping/scoping_activation_old.sol index 8522a0e306ce..cdc3c7655716 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_activation_old.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_activation_old.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. +// DeclarationError 7576: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol index 81e34562cad0..29bf0ae84981 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// DeclarationError: (124-125): Undeclared identifier. +// DeclarationError 7576: (124-125): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol index 28b885259077..102d7bf0150c 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// DeclarationError: (63-64): Undeclared identifier. +// DeclarationError 7576: (63-64): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_old.sol b/test/libsolidity/syntaxTests/scoping/scoping_old.sol index 70e5ee0cb91c..6ac3162a6102 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_old.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_old.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. +// DeclarationError 7576: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_self_use.sol b/test/libsolidity/syntaxTests/scoping/scoping_self_use.sol index a5087c57fccd..be77c646552a 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_self_use.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_self_use.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// DeclarationError: (64-65): Undeclared identifier. "a" is not (or not yet) visible at this point. +// DeclarationError 7576: (64-65): Undeclared identifier. "a" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol index 0c732f7fc0cb..52ca438c92a1 100644 --- a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol +++ b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol @@ -3,4 +3,4 @@ contract C { function f(uint) public pure {} } // ---- -// DeclarationError: (40-71): Identifier already declared. +// DeclarationError 2333: (40-71): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol index fb9180c69da4..049fca27416e 100644 --- a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol +++ b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol @@ -10,5 +10,5 @@ contract SomeContract { } } // ---- -// DeclarationError: (106-145): Identifier already declared. -// TypeError: (185-195): Type is not callable +// DeclarationError 2333: (106-145): Identifier already declared. +// TypeError 5704: (185-195): Type is not callable diff --git a/test/libsolidity/syntaxTests/smoke_test.sol b/test/libsolidity/syntaxTests/smoke_test.sol index 6abaff183c3a..986cf95861ff 100644 --- a/test/libsolidity/syntaxTests/smoke_test.sol +++ b/test/libsolidity/syntaxTests/smoke_test.sol @@ -3,4 +3,4 @@ contract test { function fun(uint256 arg1) public { uint256 y; y = arg1; } } // ---- -// Warning: (42-100): Function state mutability can be restricted to pure +// Warning 2018: (42-100): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_encodePacked_structs_v2.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_encodePacked_structs_v2.sol index 263b829ffa80..044ce6031f1c 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abi_encodePacked_structs_v2.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abi_encodePacked_structs_v2.sol @@ -11,5 +11,5 @@ contract C { } } // ---- -// TypeError: (191-192): Type not supported in packed mode. -// TypeError: (194-195): Type not supported in packed mode. +// TypeError 9578: (191-192): Type not supported in packed mode. +// TypeError 9578: (194-195): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol index 45c9d9e01fd7..e502f1e13e6d 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol @@ -11,7 +11,7 @@ contract C { } } // ---- -// TypeError: (131-132): This type cannot be encoded. -// TypeError: (134-135): This type cannot be encoded. -// TypeError: (200-201): Type not supported in packed mode. -// TypeError: (203-204): Type not supported in packed mode. +// TypeError 2056: (131-132): This type cannot be encoded. +// TypeError 2056: (134-135): This type cannot be encoded. +// TypeError 9578: (200-201): Type not supported in packed mode. +// TypeError 9578: (203-204): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol index 9f31b8859721..7f1bc61807ef 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol @@ -17,6 +17,6 @@ contract C { } } // ---- -// TypeError: (193-195): Type not supported in packed mode. -// TypeError: (323-324): Type not supported in packed mode. -// TypeError: (326-327): Type not supported in packed mode. +// TypeError 9578: (193-195): Type not supported in packed mode. +// TypeError 9578: (323-324): Type not supported in packed mode. +// TypeError 9578: (326-327): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_functions_member_access.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_functions_member_access.sol index c1f6537940da..47dedc3754d4 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abi_functions_member_access.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abi_functions_member_access.sol @@ -8,8 +8,8 @@ contract C { } } // ---- -// Warning: (52-62): Statement has no effect. -// Warning: (72-88): Statement has no effect. -// Warning: (98-120): Statement has no effect. -// Warning: (130-153): Statement has no effect. -// Warning: (163-173): Statement has no effect. +// Warning 6133: (52-62): Statement has no effect. +// Warning 6133: (72-88): Statement has no effect. +// Warning 6133: (98-120): Statement has no effect. +// Warning 6133: (130-153): Statement has no effect. +// Warning 6133: (163-173): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_calldata.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_calldata.sol index 28d2f2e75c0b..7c0e35a21ace 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_calldata.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_calldata.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (121-129): Expected ',' but got 'calldata' +// ParserError 2314: (121-129): Expected ',' but got 'calldata' diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_empty.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_empty.sol index 9972f01de50a..73d46b5aa31b 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_empty.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_empty.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-73): Statement has no effect. +// Warning 6133: (52-73): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_count.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_count.sol index f903e1ed47b5..e18088989931 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_count.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_count.sol @@ -6,7 +6,7 @@ contract C { } } // ---- -// TypeError: (46-58): This function takes two arguments, but 0 were provided. -// TypeError: (64-84): This function takes two arguments, but 1 were provided. -// TypeError: (90-122): This function takes two arguments, but 3 were provided. -// TypeError: (111-115): The second argument to "abi.decode" has to be a tuple of types. +// TypeError 5782: (46-58): This function takes two arguments, but 0 were provided. +// TypeError 5782: (64-84): This function takes two arguments, but 1 were provided. +// TypeError 5782: (90-122): This function takes two arguments, but 3 were provided. +// TypeError 6444: (111-115): The second argument to "abi.decode" has to be a tuple of types. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol index ed1f07402502..4c0795d94095 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// TypeError: (57-61): The first argument to "abi.decode" must be implicitly convertible to bytes memory or bytes calldata, but is of type type(uint256). -// TypeError: (63-67): The second argument to "abi.decode" has to be a tuple of types. +// TypeError 1956: (57-61): The first argument to "abi.decode" must be implicitly convertible to bytes memory or bytes calldata, but is of type type(uint256). +// TypeError 6444: (63-67): The second argument to "abi.decode" has to be a tuple of types. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_memory.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_memory.sol index e4667e34d223..4e8cb93f60d0 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_memory.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_memory.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (71-77): Expected ',' but got 'memory' +// ParserError 2314: (71-77): Expected ',' but got 'memory' diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_nontuple.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_nontuple.sol index d813c7122bec..973ad3dbb121 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_nontuple.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_nontuple.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (64-68): The second argument to "abi.decode" has to be a tuple of types. -// TypeError: (93-97): The second argument to "abi.decode" has to be a tuple of types. -// TypeError: (122-125): The second argument to "abi.decode" has to be a tuple of types. +// TypeError 6444: (64-68): The second argument to "abi.decode" has to be a tuple of types. +// TypeError 6444: (93-97): The second argument to "abi.decode" has to be a tuple of types. +// TypeError 6444: (122-125): The second argument to "abi.decode" has to be a tuple of types. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_storage.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_storage.sol index d9910b64c5ed..e2f93848316e 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_storage.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_storage.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (109-116): Expected ',' but got 'storage' +// ParserError 2314: (109-116): Expected ',' but got 'storage' diff --git a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol index 6bbef79eff9f..a120331d3df9 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (116-117): Type not supported in packed mode. +// TypeError 9578: (116-117): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_dynamic_string_array_v2.sol b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_dynamic_string_array_v2.sol index aa7af3c4b7c3..342e76bf526a 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_dynamic_string_array_v2.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_dynamic_string_array_v2.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (112-113): Type not supported in packed mode. -// TypeError: (178-179): Type not supported in packed mode. +// TypeError 9578: (112-113): Type not supported in packed mode. +// TypeError 9578: (178-179): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol b/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol index 5ad8c4e5faac..071859e53fb7 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol @@ -6,6 +6,6 @@ contract C { } } // ---- -// TypeError: (60-76): This type cannot be encoded. -// TypeError: (92-106): This type cannot be encoded. -// TypeError: (122-146): This type cannot be encoded. +// TypeError 2056: (60-76): This type cannot be encoded. +// TypeError 2056: (92-106): This type cannot be encoded. +// TypeError 2056: (122-146): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/single_non_bytes_arg.sol b/test/libsolidity/syntaxTests/specialFunctions/single_non_bytes_arg.sol index c17d08497783..c30bd99dc38b 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/single_non_bytes_arg.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/single_non_bytes_arg.sol @@ -7,6 +7,6 @@ contract C { function g(bytes32) pure internal {} } // ---- -// TypeError: (64-71): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (92-99): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. -// TypeError: (123-130): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (64-71): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (92-99): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. +// TypeError 7556: (123-130): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol index eac453939ba2..6ecb4e4ff869 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// TypeError: (91-100): This type cannot be encoded. -// TypeError: (102-103): This type cannot be encoded. -// TypeError: (105-119): This type cannot be encoded. -// TypeError: (121-130): This type cannot be encoded. +// TypeError 2056: (91-100): This type cannot be encoded. +// TypeError 2056: (102-103): This type cannot be encoded. +// TypeError 2056: (105-119): This type cannot be encoded. +// TypeError 2056: (121-130): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol index 6e0b6db40460..214ed8a54eb7 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol @@ -6,8 +6,8 @@ contract C { } } // ---- -// TypeError: (94-120): This type cannot be encoded. -// TypeError: (122-127): This type cannot be encoded. -// TypeError: (184-188): This type cannot be encoded. -// TypeError: (190-192): This type cannot be encoded. -// TypeError: (194-200): This type cannot be encoded. +// TypeError 2056: (94-120): This type cannot be encoded. +// TypeError 2056: (122-127): This type cannot be encoded. +// TypeError 2056: (184-188): This type cannot be encoded. +// TypeError 2056: (190-192): This type cannot be encoded. +// TypeError 2056: (194-200): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol index 9fcc30396db5..02777da1e791 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (156-157): Type not supported in packed mode. -// TypeError: (159-160): Type not supported in packed mode. +// TypeError 9578: (156-157): Type not supported in packed mode. +// TypeError 9578: (159-160): Type not supported in packed mode. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol index b50d44499a1e..c427565d30e5 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol @@ -10,8 +10,8 @@ contract C { } } // ---- -// TypeError: (174-175): This type cannot be encoded. -// TypeError: (177-178): This type cannot be encoded. -// TypeError: (185-186): This type cannot be encoded. -// TypeError: (188-192): This type cannot be encoded. -// TypeError: (194-200): This type cannot be encoded. +// TypeError 2056: (174-175): This type cannot be encoded. +// TypeError 2056: (177-178): This type cannot be encoded. +// TypeError 2056: (185-186): This type cannot be encoded. +// TypeError 2056: (188-192): This type cannot be encoded. +// TypeError 2056: (194-200): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/string/string_multipart_hex_valid_parts.sol b/test/libsolidity/syntaxTests/string/string_multipart_hex_valid_parts.sol index e7b5befe13f5..54cccbcc5c80 100644 --- a/test/libsolidity/syntaxTests/string/string_multipart_hex_valid_parts.sol +++ b/test/libsolidity/syntaxTests/string/string_multipart_hex_valid_parts.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// ParserError: (108-112): Expected even number of hex-nibbles. +// ParserError 5428: (108-112): Expected even number of hex-nibbles. diff --git a/test/libsolidity/syntaxTests/string/string_multipart_newline_without_hex_prefix.sol b/test/libsolidity/syntaxTests/string/string_multipart_newline_without_hex_prefix.sol index 613b86da674e..cf46d536e97a 100644 --- a/test/libsolidity/syntaxTests/string/string_multipart_newline_without_hex_prefix.sol +++ b/test/libsolidity/syntaxTests/string/string_multipart_newline_without_hex_prefix.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// ParserError: (118-124): Expected ';' but got 'StringLiteral' \ No newline at end of file +// ParserError 2314: (118-124): Expected ';' but got 'StringLiteral' diff --git a/test/libsolidity/syntaxTests/string/string_multipart_only_hex.sol b/test/libsolidity/syntaxTests/string/string_multipart_only_hex.sol index d748104f20cf..ff54daa1e243 100644 --- a/test/libsolidity/syntaxTests/string/string_multipart_only_hex.sol +++ b/test/libsolidity/syntaxTests/string/string_multipart_only_hex.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// ParserError: (116-120): Expected ';' but got 'StringLiteral' +// ParserError 2314: (116-120): Expected ';' but got 'StringLiteral' diff --git a/test/libsolidity/syntaxTests/string/string_multipart_only_regular.sol b/test/libsolidity/syntaxTests/string/string_multipart_only_regular.sol index b420601f5f81..6d0c29e0e2a8 100644 --- a/test/libsolidity/syntaxTests/string/string_multipart_only_regular.sol +++ b/test/libsolidity/syntaxTests/string/string_multipart_only_regular.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// ParserError: (112-119): Expected ';' but got 'HexStringLiteral' +// ParserError 2314: (112-119): Expected ';' but got 'HexStringLiteral' diff --git a/test/libsolidity/syntaxTests/string/string_new_line.sol b/test/libsolidity/syntaxTests/string/string_new_line.sol index 4cbc71a5bd83..b7d28c52607a 100644 --- a/test/libsolidity/syntaxTests/string/string_new_line.sol +++ b/test/libsolidity/syntaxTests/string/string_new_line.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// ParserError: (100-112): Expected string end-quote. +// ParserError 8936: (100-112): Expected string end-quote. diff --git a/test/libsolidity/syntaxTests/string/string_terminated_by_backslash.sol b/test/libsolidity/syntaxTests/string/string_terminated_by_backslash.sol index fba53a0391d8..715630feae79 100644 --- a/test/libsolidity/syntaxTests/string/string_terminated_by_backslash.sol +++ b/test/libsolidity/syntaxTests/string/string_terminated_by_backslash.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// ParserError: (100-109): Expected string end-quote. +// ParserError 8936: (100-109): Expected string end-quote. diff --git a/test/libsolidity/syntaxTests/string/string_unterminated.sol b/test/libsolidity/syntaxTests/string/string_unterminated.sol index e893f4b179e9..9142fdea43c1 100644 --- a/test/libsolidity/syntaxTests/string/string_unterminated.sol +++ b/test/libsolidity/syntaxTests/string/string_unterminated.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// ParserError: (100-112): Expected string end-quote. +// ParserError 8936: (100-112): Expected string end-quote. diff --git a/test/libsolidity/syntaxTests/string/string_unterminated_no_new_line.sol b/test/libsolidity/syntaxTests/string/string_unterminated_no_new_line.sol index b100396b705c..85a822b92b21 100644 --- a/test/libsolidity/syntaxTests/string/string_unterminated_no_new_line.sol +++ b/test/libsolidity/syntaxTests/string/string_unterminated_no_new_line.sol @@ -1,4 +1,4 @@ contract test { function f() pure public { "abc\ // ---- -// ParserError: (47-53): Expected string end-quote. +// ParserError 8936: (47-53): Expected string end-quote. diff --git a/test/libsolidity/syntaxTests/structs/address_member_access.sol b/test/libsolidity/syntaxTests/structs/address_member_access.sol index cf5170bf460b..5d8c219dd320 100644 --- a/test/libsolidity/syntaxTests/structs/address_member_access.sol +++ b/test/libsolidity/syntaxTests/structs/address_member_access.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (129-138): Member "address" not found or not visible after argument-dependent lookup in struct C.S memory. +// TypeError 9582: (129-138): Member "address" not found or not visible after argument-dependent lookup in struct C.S memory. diff --git a/test/libsolidity/syntaxTests/structs/address_member_declaration.sol b/test/libsolidity/syntaxTests/structs/address_member_declaration.sol index 2e654187b67c..575c0fe73df0 100644 --- a/test/libsolidity/syntaxTests/structs/address_member_declaration.sol +++ b/test/libsolidity/syntaxTests/structs/address_member_declaration.sol @@ -2,4 +2,4 @@ contract C { struct S { uint address; } } // ---- -// ParserError: (33-40): Expected identifier but got 'address' +// ParserError 2314: (33-40): Expected identifier but got 'address' diff --git a/test/libsolidity/syntaxTests/structs/calldata_array_assign.sol b/test/libsolidity/syntaxTests/structs/calldata_array_assign.sol index f081f863806a..adfa389aeba3 100644 --- a/test/libsolidity/syntaxTests/structs/calldata_array_assign.sol +++ b/test/libsolidity/syntaxTests/structs/calldata_array_assign.sol @@ -6,4 +6,4 @@ contract Test { } } // ---- -// TypeError: (144-147): Calldata structs are read-only. +// TypeError 4156: (144-147): Calldata structs are read-only. diff --git a/test/libsolidity/syntaxTests/structs/calldata_assign.sol b/test/libsolidity/syntaxTests/structs/calldata_assign.sol index 6d6695e67c4f..d8d9210087af 100644 --- a/test/libsolidity/syntaxTests/structs/calldata_assign.sol +++ b/test/libsolidity/syntaxTests/structs/calldata_assign.sol @@ -4,4 +4,4 @@ contract Test { function f(S calldata s) external { s.a = 4; } } // ---- -// TypeError: (114-117): Calldata structs are read-only. +// TypeError 4156: (114-117): Calldata structs are read-only. diff --git a/test/libsolidity/syntaxTests/structs/contract_global_struct_name_clash.sol b/test/libsolidity/syntaxTests/structs/contract_global_struct_name_clash.sol index d8476f116ce9..7f178ed9844b 100644 --- a/test/libsolidity/syntaxTests/structs/contract_global_struct_name_clash.sol +++ b/test/libsolidity/syntaxTests/structs/contract_global_struct_name_clash.sol @@ -1,4 +1,4 @@ contract S {} struct S { uint256 a; } // ---- -// DeclarationError: (14-37): Identifier already declared. +// DeclarationError 2333: (14-37): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/structs/global_struct_contract_name_clash.sol b/test/libsolidity/syntaxTests/structs/global_struct_contract_name_clash.sol index 84ff22872e95..bf13b2db763b 100644 --- a/test/libsolidity/syntaxTests/structs/global_struct_contract_name_clash.sol +++ b/test/libsolidity/syntaxTests/structs/global_struct_contract_name_clash.sol @@ -1,4 +1,4 @@ struct S { uint256 a; } contract S {} // ---- -// DeclarationError: (24-37): Identifier already declared. +// DeclarationError 2333: (24-37): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/structs/global_struct_shadowing.sol b/test/libsolidity/syntaxTests/structs/global_struct_shadowing.sol index 1a3e58443b62..53615fb42747 100644 --- a/test/libsolidity/syntaxTests/structs/global_struct_shadowing.sol +++ b/test/libsolidity/syntaxTests/structs/global_struct_shadowing.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (38-61): This declaration shadows an existing declaration. +// Warning 2519: (38-61): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/structs/global_structs_name_clash.sol b/test/libsolidity/syntaxTests/structs/global_structs_name_clash.sol index ce17f4c817b5..1590f7ad1a4a 100644 --- a/test/libsolidity/syntaxTests/structs/global_structs_name_clash.sol +++ b/test/libsolidity/syntaxTests/structs/global_structs_name_clash.sol @@ -1,4 +1,4 @@ struct S { uint256 a; } struct S { uint256 a; } // ---- -// DeclarationError: (24-47): Identifier already declared. +// DeclarationError 2333: (24-47): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/structs/member_type_eq_name.sol b/test/libsolidity/syntaxTests/structs/member_type_eq_name.sol index 4aa5ad742d78..525185edd7f7 100644 --- a/test/libsolidity/syntaxTests/structs/member_type_eq_name.sol +++ b/test/libsolidity/syntaxTests/structs/member_type_eq_name.sol @@ -3,4 +3,4 @@ contract C { function f(function(S memory) external) public {} } // ---- -// TypeError: (25-26): Name has to refer to a struct, enum or contract. +// TypeError 5172: (25-26): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/structs/member_type_func.sol b/test/libsolidity/syntaxTests/structs/member_type_func.sol index 1a47c1996006..1200fa7af21f 100644 --- a/test/libsolidity/syntaxTests/structs/member_type_func.sol +++ b/test/libsolidity/syntaxTests/structs/member_type_func.sol @@ -4,4 +4,4 @@ contract C { function g(function(S memory) external) public {} } // ---- -// TypeError: (50-51): Name has to refer to a struct, enum or contract. +// TypeError 5172: (50-51): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol b/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol index 2e4d89767950..d6b2aed6a4f2 100644 --- a/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol +++ b/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol @@ -5,7 +5,7 @@ contract Test { function g(S calldata s) external { S memory m; s = m; } } // ---- -// TypeError: (114-115): External function arguments of reference type are read-only. -// TypeError: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. -// TypeError: (178-179): External function arguments of reference type are read-only. -// TypeError: (182-183): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. +// TypeError 7128: (114-115): External function arguments of reference type are read-only. +// TypeError 7407: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. +// TypeError 7128: (178-179): External function arguments of reference type are read-only. +// TypeError 7407: (182-183): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. diff --git a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol index 4bce69bca8f6..7f4c0e014491 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol @@ -7,4 +7,4 @@ contract Test { function f(MyStructName memory s) public {} } // ---- -// TypeError: (112-133): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (112-133): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_memory_library_function_parameter.sol b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_memory_library_function_parameter.sol index 67c98057511c..e32cceef30c1 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_memory_library_function_parameter.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_memory_library_function_parameter.sol @@ -10,4 +10,4 @@ library Test { } } // ---- -// TypeError: (146-168): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions. +// TypeError 4103: (146-168): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_forward_reference.sol b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_forward_reference.sol index 573f227444a4..e799573c9840 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_forward_reference.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_forward_reference.sol @@ -7,4 +7,4 @@ contract Data { struct S { S[] x; } } // ---- -// TypeError: (63-78): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (63-78): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_with_internal_function_as_library_function_parameter.sol b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_with_internal_function_as_library_function_parameter.sol index f9418bea5888..22f026ee8872 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_with_internal_function_as_library_function_parameter.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_with_internal_function_as_library_function_parameter.sol @@ -8,4 +8,4 @@ library Test { function f(MyStructName storage s) public {} } // ---- -// TypeError: (142-164): Internal type is not allowed for public or external functions. +// TypeError 4103: (142-164): Internal type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol index 22885e95686f..680c8b8a9337 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (91-99): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (91-99): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol index 2ead307d623d..085d333d33d4 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (94-102): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (94-102): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol index c47df25bf060..4e32d57ec814 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (119-129): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (119-129): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol index bcffe3838346..b3fd38c5406e 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol @@ -5,4 +5,4 @@ contract Test { } } // ---- -// TypeError: (20-93): Recursive struct definition. +// TypeError 2046: (20-93): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol index 126dda4fcfba..ef222ace4f4e 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol @@ -5,4 +5,4 @@ contract Test { } } // ---- -// TypeError: (20-96): Recursive struct definition. +// TypeError 2046: (20-96): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol index 64dab8d006d9..5dab5e64e037 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (20-118): Recursive struct definition. +// TypeError 2046: (20-118): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol index 6d35a5d3de51..f7fbcdc30cfd 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol @@ -15,4 +15,4 @@ contract Test { } } // ---- -// TypeError: (20-121): Recursive struct definition. +// TypeError 2046: (20-121): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol index 2c0b90ec7059..452facc15d13 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (20-121): Recursive struct definition. +// TypeError 2046: (20-121): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol index 3178e569212b..54fcdafb7bfd 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (20-118): Recursive struct definition. +// TypeError 2046: (20-118): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol index e34cf9bc5064..ec9116a43413 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (20-121): Recursive struct definition. +// TypeError 2046: (20-121): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol index ed659b6ebaa3..143171b4ef94 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: (20-124): Recursive struct definition. +// TypeError 2046: (20-124): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/struct_var_member.sol b/test/libsolidity/syntaxTests/structs/struct_var_member.sol index 04a274bcb232..8d42459ae8c3 100644 --- a/test/libsolidity/syntaxTests/structs/struct_var_member.sol +++ b/test/libsolidity/syntaxTests/structs/struct_var_member.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (27-30): Expected explicit type name. +// ParserError 7059: (27-30): Expected explicit type name. diff --git a/test/libsolidity/syntaxTests/tight_packing_literals.sol b/test/libsolidity/syntaxTests/tight_packing_literals.sol index 0fc1fc08745a..45211452fd8a 100644 --- a/test/libsolidity/syntaxTests/tight_packing_literals.sol +++ b/test/libsolidity/syntaxTests/tight_packing_literals.sol @@ -5,4 +5,4 @@ contract C { } // ---- -// TypeError: (99-100): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError 7279: (99-100): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/tryCatch/almost_call_options.sol b/test/libsolidity/syntaxTests/tryCatch/almost_call_options.sol index 8d25d2fb486e..91da9e312377 100644 --- a/test/libsolidity/syntaxTests/tryCatch/almost_call_options.sol +++ b/test/libsolidity/syntaxTests/tryCatch/almost_call_options.sol @@ -11,4 +11,4 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// Warning: (122-134): Unused local variable. +// Warning 2072: (122-134): Unused local variable. diff --git a/test/libsolidity/syntaxTests/tryCatch/empty_catch.sol b/test/libsolidity/syntaxTests/tryCatch/empty_catch.sol index ee887fe1ad8c..d1ae8c52df11 100644 --- a/test/libsolidity/syntaxTests/tryCatch/empty_catch.sol +++ b/test/libsolidity/syntaxTests/tryCatch/empty_catch.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// ParserError: (101-102): Expected type name +// ParserError 3546: (101-102): Expected type name diff --git a/test/libsolidity/syntaxTests/tryCatch/empty_returns.sol b/test/libsolidity/syntaxTests/tryCatch/empty_returns.sol index ba1ba2202149..aea3d6bcdd15 100644 --- a/test/libsolidity/syntaxTests/tryCatch/empty_returns.sol +++ b/test/libsolidity/syntaxTests/tryCatch/empty_returns.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// ParserError: (69-70): Expected type name +// ParserError 3546: (69-70): Expected type name diff --git a/test/libsolidity/syntaxTests/tryCatch/error_with_wrong_type.sol b/test/libsolidity/syntaxTests/tryCatch/error_with_wrong_type.sol index 05878ba5baf7..d7c1de93a037 100644 --- a/test/libsolidity/syntaxTests/tryCatch/error_with_wrong_type.sol +++ b/test/libsolidity/syntaxTests/tryCatch/error_with_wrong_type.sol @@ -9,4 +9,4 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// TypeError: (94-123): Expected `catch Error(string memory ...) { ... }`. +// TypeError 2943: (94-123): Expected `catch Error(string memory ...) { ... }`. diff --git a/test/libsolidity/syntaxTests/tryCatch/invalid_error_name.sol b/test/libsolidity/syntaxTests/tryCatch/invalid_error_name.sol index 164da567daa7..0cf78c5e7d0c 100644 --- a/test/libsolidity/syntaxTests/tryCatch/invalid_error_name.sol +++ b/test/libsolidity/syntaxTests/tryCatch/invalid_error_name.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (93-119): Invalid catch clause name. Expected either `catch (...)` or `catch Error(...)`. -// TypeError: (120-143): Invalid catch clause name. Expected either `catch (...)` or `catch Error(...)`. +// TypeError 3542: (93-119): Invalid catch clause name. Expected either `catch (...)` or `catch Error(...)`. +// TypeError 3542: (120-143): Invalid catch clause name. Expected either `catch (...)` or `catch Error(...)`. diff --git a/test/libsolidity/syntaxTests/tryCatch/invalid_returns.sol b/test/libsolidity/syntaxTests/tryCatch/invalid_returns.sol index e1d22f05f611..b68ab1cb149f 100644 --- a/test/libsolidity/syntaxTests/tryCatch/invalid_returns.sol +++ b/test/libsolidity/syntaxTests/tryCatch/invalid_returns.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (157-161): Invalid type, expected uint8 but got uint256. -// TypeError: (163-168): Invalid type, expected uint256 but got int256. +// TypeError 6509: (157-161): Invalid type, expected uint8 but got uint256. +// TypeError 6509: (163-168): Invalid type, expected uint256 but got int256. diff --git a/test/libsolidity/syntaxTests/tryCatch/low_level_pre-byzantium.sol b/test/libsolidity/syntaxTests/tryCatch/low_level_pre-byzantium.sol index 3dd16df11765..0f99b5593d2a 100644 --- a/test/libsolidity/syntaxTests/tryCatch/low_level_pre-byzantium.sol +++ b/test/libsolidity/syntaxTests/tryCatch/low_level_pre-byzantium.sol @@ -10,4 +10,4 @@ contract C { // ==== // EVMVersion: =byzantium // ---- -// TypeError: (94-118): Expected `catch (bytes memory ...) { ... }` or `catch { ... }`. +// TypeError 6231: (94-118): Expected `catch (bytes memory ...) { ... }` or `catch { ... }`. diff --git a/test/libsolidity/syntaxTests/tryCatch/no_catch.sol b/test/libsolidity/syntaxTests/tryCatch/no_catch.sol index 28938d3ddb13..b6f0e9187ee5 100644 --- a/test/libsolidity/syntaxTests/tryCatch/no_catch.sol +++ b/test/libsolidity/syntaxTests/tryCatch/no_catch.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (97-98): Expected reserved keyword 'catch' but got '}' +// ParserError 2314: (97-98): Expected reserved keyword 'catch' but got '}' diff --git a/test/libsolidity/syntaxTests/tryCatch/no_external_call.sol b/test/libsolidity/syntaxTests/tryCatch/no_external_call.sol index 1ae24a80234c..724ed81e838b 100644 --- a/test/libsolidity/syntaxTests/tryCatch/no_external_call.sol +++ b/test/libsolidity/syntaxTests/tryCatch/no_external_call.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (72-75): Try can only be used with external function calls and contract creation calls. +// TypeError 2536: (72-75): Try can only be used with external function calls and contract creation calls. diff --git a/test/libsolidity/syntaxTests/tryCatch/structured_pre_byzantium.sol b/test/libsolidity/syntaxTests/tryCatch/structured_pre_byzantium.sol index 34c7e501123a..e2878386cdf3 100644 --- a/test/libsolidity/syntaxTests/tryCatch/structured_pre_byzantium.sol +++ b/test/libsolidity/syntaxTests/tryCatch/structured_pre_byzantium.sol @@ -10,4 +10,4 @@ contract C { // ==== // EVMVersion: =byzantium // ---- -// TypeError: (150-205): This try statement already has an "Error" catch clause. +// TypeError 1036: (150-205): This try statement already has an "Error" catch clause. diff --git a/test/libsolidity/syntaxTests/tryCatch/two_low_level_catch_clauses.sol b/test/libsolidity/syntaxTests/tryCatch/two_low_level_catch_clauses.sol index 108160aae7df..b9c0a0bfc89f 100644 --- a/test/libsolidity/syntaxTests/tryCatch/two_low_level_catch_clauses.sol +++ b/test/libsolidity/syntaxTests/tryCatch/two_low_level_catch_clauses.sol @@ -11,4 +11,4 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// TypeError: (112-161): This try statement already has a low-level catch clause. +// TypeError 5320: (112-161): This try statement already has a low-level catch clause. diff --git a/test/libsolidity/syntaxTests/tupleAssignments/double_storage_crash.sol b/test/libsolidity/syntaxTests/tupleAssignments/double_storage_crash.sol index 0e19136f4aea..a251b3a9b337 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/double_storage_crash.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/double_storage_crash.sol @@ -7,4 +7,4 @@ contract CrashContract { } } // ---- -// TypeError: (170-177): Type is not callable +// TypeError 5704: (170-177): Type is not callable diff --git a/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol b/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol index a771f630ace5..fac7ec57a2bc 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol @@ -16,14 +16,14 @@ contract C { } } // ---- -// TypeError: (41-43): Empty tuple on the left hand side. -// TypeError: (47-48): Type int_const 2 is not implicitly convertible to expected type tuple(). -// TypeError: (86-88): Empty tuple on the left hand side. -// TypeError: (173-175): Empty tuple on the left hand side. -// TypeError: (178-182): Type tuple(uint256,uint256) is not implicitly convertible to expected type tuple(). -// TypeError: (166-182): Different number of arguments in return statement than in returns declaration. -// TypeError: (229-231): Empty tuple on the left hand side. -// TypeError: (401-404): Empty tuple on the left hand side. -// TypeError: (399-466): Compound assignment is not allowed for tuple types. -// TypeError: (410-466): Type bytes32 is not implicitly convertible to expected type tuple(). -// TypeError: (389-396): No matching declaration found after argument-dependent lookup. +// TypeError 5547: (41-43): Empty tuple on the left hand side. +// TypeError 7407: (47-48): Type int_const 2 is not implicitly convertible to expected type tuple(). +// TypeError 5547: (86-88): Empty tuple on the left hand side. +// TypeError 5547: (173-175): Empty tuple on the left hand side. +// TypeError 7407: (178-182): Type tuple(uint256,uint256) is not implicitly convertible to expected type tuple(). +// TypeError 5132: (166-182): Different number of arguments in return statement than in returns declaration. +// TypeError 5547: (229-231): Empty tuple on the left hand side. +// TypeError 5547: (401-404): Empty tuple on the left hand side. +// TypeError 4289: (399-466): Compound assignment is not allowed for tuple types. +// TypeError 7407: (410-466): Type bytes32 is not implicitly convertible to expected type tuple(). +// TypeError 9322: (389-396): No matching declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/tupleAssignments/err_fill_assignment.sol b/test/libsolidity/syntaxTests/tupleAssignments/err_fill_assignment.sol index 32b381bbcf3f..14b9818574f4 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/err_fill_assignment.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/err_fill_assignment.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (103-106): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). -// TypeError: (117-120): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). +// TypeError 7407: (103-106): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). +// TypeError 7407: (117-120): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). diff --git a/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol b/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol index 32b381bbcf3f..14b9818574f4 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (103-106): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). -// TypeError: (117-120): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). +// TypeError 7407: (103-106): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). +// TypeError 7407: (117-120): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). diff --git a/test/libsolidity/syntaxTests/tupleAssignments/tuple_in_tuple_long.sol b/test/libsolidity/syntaxTests/tupleAssignments/tuple_in_tuple_long.sol index f5d8fb1ba05d..1c3a62c13fa7 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/tuple_in_tuple_long.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/tuple_in_tuple_long.sol @@ -4,8 +4,8 @@ contract C { } } // ---- -// TypeError: (53-54): Expression has to be an lvalue. -// TypeError: (67-68): Type int_const 4 is not implicitly convertible to expected type tuple(tuple(tuple(tuple(tuple(,int_const 2),),),),). -// TypeError: (44-68): Tuple component cannot be empty. -// TypeError: (43-69): Tuple component cannot be empty. -// TypeError: (42-70): Tuple component cannot be empty. +// TypeError 4247: (53-54): Expression has to be an lvalue. +// TypeError 7407: (67-68): Type int_const 4 is not implicitly convertible to expected type tuple(tuple(tuple(tuple(tuple(,int_const 2),),),),). +// TypeError 6473: (44-68): Tuple component cannot be empty. +// TypeError 6473: (43-69): Tuple component cannot be empty. +// TypeError 6473: (42-70): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/tupleAssignments/warn_multiple_storage_storage_copies.sol b/test/libsolidity/syntaxTests/tupleAssignments/warn_multiple_storage_storage_copies.sol index e4c3e694bb08..102bbea686a2 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/warn_multiple_storage_storage_copies.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/warn_multiple_storage_storage_copies.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (79-94): This assignment performs two copies to storage. Since storage copies do not first copy to a temporary location, one of them might be overwritten before the second is executed and thus may have unexpected effects. It is safer to perform the copies separately or assign to storage pointers first. +// Warning 7238: (79-94): This assignment performs two copies to storage. Since storage copies do not first copy to a temporary location, one of them might be overwritten before the second is executed and thus may have unexpected effects. It is safer to perform the copies separately or assign to storage pointers first. diff --git a/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol b/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol index f721f4a93c56..dfeab70228dd 100644 --- a/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol +++ b/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol @@ -9,7 +9,7 @@ contract C { } } // ---- -// TypeError: (85-108): Operator + not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. -// TypeError: (122-145): Operator - not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. -// TypeError: (159-182): Operator * not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. -// TypeError: (196-219): Operator / not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. +// TypeError 2271: (85-108): Operator + not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. +// TypeError 2271: (122-145): Operator - not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. +// TypeError 2271: (159-182): Operator * not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. +// TypeError 2271: (196-219): Operator / not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them. diff --git a/test/libsolidity/syntaxTests/types/address/address_constant_assignment.sol b/test/libsolidity/syntaxTests/types/address/address_constant_assignment.sol index da17ae33bbe0..d843c5990a81 100644 --- a/test/libsolidity/syntaxTests/types/address/address_constant_assignment.sol +++ b/test/libsolidity/syntaxTests/types/address/address_constant_assignment.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (129-130): Cannot assign to a constant variable. -// TypeError: (153-154): Cannot assign to a constant variable. +// TypeError 6520: (129-130): Cannot assign to a constant variable. +// TypeError 6520: (153-154): Cannot assign to a constant variable. diff --git a/test/libsolidity/syntaxTests/types/address/address_in_struct_fail.sol b/test/libsolidity/syntaxTests/types/address/address_in_struct_fail.sol index 9a5b2abb6d96..6d4a01d96669 100644 --- a/test/libsolidity/syntaxTests/types/address/address_in_struct_fail.sol +++ b/test/libsolidity/syntaxTests/types/address/address_in_struct_fail.sol @@ -8,4 +8,4 @@ contract A { } } // ---- -// TypeError: (110-123): Type address is not implicitly convertible to expected type address payable. +// TypeError 7407: (110-123): Type address is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/address_members_in_contract.sol b/test/libsolidity/syntaxTests/types/address/address_members_in_contract.sol index eafc82687a85..338d9ef97e50 100644 --- a/test/libsolidity/syntaxTests/types/address/address_members_in_contract.sol +++ b/test/libsolidity/syntaxTests/types/address/address_members_in_contract.sol @@ -3,4 +3,4 @@ contract C { function g() public returns (uint) { return f().balance(); } } // ---- -// TypeError: (114-125): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(...).balance" to access this address member. +// TypeError 3125: (114-125): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(...).balance" to access this address member. diff --git a/test/libsolidity/syntaxTests/types/address/address_nonpayable_selfdestruct.sol b/test/libsolidity/syntaxTests/types/address/address_nonpayable_selfdestruct.sol index cc680ff3ea96..812258711576 100644 --- a/test/libsolidity/syntaxTests/types/address/address_nonpayable_selfdestruct.sol +++ b/test/libsolidity/syntaxTests/types/address/address_nonpayable_selfdestruct.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (69-70): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. +// TypeError 9553: (69-70): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_external_overload.sol b/test/libsolidity/syntaxTests/types/address/address_payable_external_overload.sol index 875532c47c21..d478f75a279d 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_external_overload.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_external_overload.sol @@ -4,4 +4,4 @@ contract C { } // ---- -// TypeError: (58-102): Function overload clash during conversion to external types for arguments. +// TypeError 9914: (58-102): Function overload clash during conversion to external types for arguments. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_internal_overload_payable.sol b/test/libsolidity/syntaxTests/types/address/address_payable_internal_overload_payable.sol index 84142a31b36b..e5eab5f5041b 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_internal_overload_payable.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_internal_overload_payable.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (184-185): No unique declaration found after argument-dependent lookup. +// TypeError 4487: (184-185): No unique declaration found after argument-dependent lookup. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_memory_array_conversion.sol b/test/libsolidity/syntaxTests/types/address/address_payable_memory_array_conversion.sol index ec58170bb261..cf58555da972 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_memory_array_conversion.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_memory_array_conversion.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (166-167): Type address[] memory is not implicitly convertible to expected type address payable[] memory. -// TypeError: (181-182): Type address payable[] memory is not implicitly convertible to expected type address[] memory. +// TypeError 7407: (166-167): Type address[] memory is not implicitly convertible to expected type address payable[] memory. +// TypeError 7407: (181-182): Type address payable[] memory is not implicitly convertible to expected type address[] memory. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_public_overload.sol b/test/libsolidity/syntaxTests/types/address/address_payable_public_overload.sol index 839abc26534b..cae9b324fbae 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_public_overload.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_public_overload.sol @@ -4,4 +4,4 @@ contract C { } // ---- -// TypeError: (56-98): Function overload clash during conversion to external types for arguments. +// TypeError 9914: (56-98): Function overload clash during conversion to external types for arguments. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion.sol b/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion.sol index 40f85cccea50..49d92cafe556 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (172-173): Type address payable[] storage pointer is not implicitly convertible to expected type address[] storage pointer. +// TypeError 7407: (172-173): Type address payable[] storage pointer is not implicitly convertible to expected type address[] storage pointer. diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion_fail.sol b/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion_fail.sol index 3c3eb859d03b..7793040a9851 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion_fail.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_storage_array_conversion_fail.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (172-173): Type address[] storage pointer is not implicitly convertible to expected type address payable[] storage pointer. +// TypeError 7407: (172-173): Type address[] storage pointer is not implicitly convertible to expected type address payable[] storage pointer. diff --git a/test/libsolidity/syntaxTests/types/address/address_to_contract_implicitly.sol b/test/libsolidity/syntaxTests/types/address/address_to_contract_implicitly.sol index c9e5ddf6a389..90fb3e85fbb6 100644 --- a/test/libsolidity/syntaxTests/types/address/address_to_contract_implicitly.sol +++ b/test/libsolidity/syntaxTests/types/address/address_to_contract_implicitly.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (46-62): Type address payable is not implicitly convertible to expected type contract C. +// TypeError 9574: (46-62): Type address payable is not implicitly convertible to expected type contract C. diff --git a/test/libsolidity/syntaxTests/types/address/address_to_contract_payable_fallback.sol b/test/libsolidity/syntaxTests/types/address/address_to_contract_payable_fallback.sol index 714162060920..69cb233427a5 100644 --- a/test/libsolidity/syntaxTests/types/address/address_to_contract_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/types/address/address_to_contract_payable_fallback.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (0-120): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// Warning 3628: (0-120): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. diff --git a/test/libsolidity/syntaxTests/types/address/address_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/address_to_payable_address.sol index 1aab9b51c565..e82371efd12a 100644 --- a/test/libsolidity/syntaxTests/types/address/address_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/address_to_payable_address.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (80-101): Type address is not implicitly convertible to expected type address payable. -// TypeError: (115-116): Type address is not implicitly convertible to expected type address payable. +// TypeError 9574: (80-101): Type address is not implicitly convertible to expected type address payable. +// TypeError 7407: (115-116): Type address is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/address_to_payable_address_double.sol b/test/libsolidity/syntaxTests/types/address/address_to_payable_address_double.sol index 1e755033d296..48645fb36934 100644 --- a/test/libsolidity/syntaxTests/types/address/address_to_payable_address_double.sol +++ b/test/libsolidity/syntaxTests/types/address/address_to_payable_address_double.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (94-113): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. +// TypeError 6359: (94-113): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. diff --git a/test/libsolidity/syntaxTests/types/address/address_tuple_fail.sol b/test/libsolidity/syntaxTests/types/address/address_tuple_fail.sol index 17e9e7c1ff15..e9d1f6375cbb 100644 --- a/test/libsolidity/syntaxTests/types/address/address_tuple_fail.sol +++ b/test/libsolidity/syntaxTests/types/address/address_tuple_fail.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (169-174): Type tuple(address,address payable) is not implicitly convertible to expected type tuple(address payable,address). +// TypeError 7407: (169-174): Type tuple(address,address payable) is not implicitly convertible to expected type tuple(address payable,address). diff --git a/test/libsolidity/syntaxTests/types/address/bytes_long_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/bytes_long_to_payable_address.sol index ef87ac558e30..c185cab80568 100644 --- a/test/libsolidity/syntaxTests/types/address/bytes_long_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/bytes_long_to_payable_address.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// TypeError: (94-104): Explicit type conversion not allowed from "bytes32" to "address". -// TypeError: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. +// TypeError 9640: (94-104): Explicit type conversion not allowed from "bytes32" to "address". +// TypeError 6359: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. diff --git a/test/libsolidity/syntaxTests/types/address/bytes_short_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/bytes_short_to_payable_address.sol index 2aa602516187..f7f1f42cb4d1 100644 --- a/test/libsolidity/syntaxTests/types/address/bytes_short_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/bytes_short_to_payable_address.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// TypeError: (94-104): Explicit type conversion not allowed from "bytes10" to "address". -// TypeError: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. +// TypeError 9640: (94-104): Explicit type conversion not allowed from "bytes10" to "address". +// TypeError 6359: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. diff --git a/test/libsolidity/syntaxTests/types/address/contract_no_fallback_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/contract_no_fallback_to_payable_address.sol index 777bce002417..1b7744a5c1d3 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_no_fallback_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_no_fallback_to_payable_address.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (46-79): Type address is not implicitly convertible to expected type address payable. +// TypeError 9574: (46-79): Type address is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/contract_non_payable_fallback_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/contract_non_payable_fallback_to_payable_address.sol index 49953801ee7f..adc9f37cb41d 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_non_payable_fallback_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_non_payable_fallback_to_payable_address.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (46-79): Type address is not implicitly convertible to expected type address payable. +// TypeError 9574: (46-79): Type address is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address.sol b/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address.sol index cd4706fd3a62..66da362217bf 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning: (0-129): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// Warning 3628: (0-129): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. diff --git a/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address_implicitly.sol b/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address_implicitly.sol index d8943d01ebbf..e22db0c3a9ca 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address_implicitly.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address_implicitly.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// Warning: (0-120): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. -// TypeError: (46-70): Type contract C is not implicitly convertible to expected type address payable. +// Warning 3628: (0-120): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// TypeError 9574: (46-70): Type contract C is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/contract_receive_to_payable_address_implicitly.sol b/test/libsolidity/syntaxTests/types/address/contract_receive_to_payable_address_implicitly.sol index 31c7e31f695b..23caa8847e84 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_receive_to_payable_address_implicitly.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_receive_to_payable_address_implicitly.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (46-70): Type contract C is not implicitly convertible to expected type address payable. +// TypeError 9574: (46-70): Type contract C is not implicitly convertible to expected type address payable. diff --git a/test/libsolidity/syntaxTests/types/address/contract_to_address_implicitly.sol b/test/libsolidity/syntaxTests/types/address/contract_to_address_implicitly.sol index 8be9daacbc15..b689f7a2aec2 100644 --- a/test/libsolidity/syntaxTests/types/address/contract_to_address_implicitly.sol +++ b/test/libsolidity/syntaxTests/types/address/contract_to_address_implicitly.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (46-62): Type contract C is not implicitly convertible to expected type address. +// TypeError 9574: (46-62): Type contract C is not implicitly convertible to expected type address. diff --git a/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_payable_fallback.sol b/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_payable_fallback.sol index 24d038086e7b..b0e54a4c8b73 100644 --- a/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_payable_fallback.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// Warning: (0-139): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. -// TypeError: (92-96): Explicit type conversion not allowed from non-payable "address" to "contract C", which has a payable fallback function. +// Warning 3628: (0-139): This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function. +// TypeError 7398: (92-96): Explicit type conversion not allowed from non-payable "address" to "contract C", which has a payable fallback function. diff --git a/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_receive.sol b/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_receive.sol index d803b20f07dd..0f11d6bea40f 100644 --- a/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_receive.sol +++ b/test/libsolidity/syntaxTests/types/address/nonpayable_address_to_contract_receive.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (92-96): Explicit type conversion not allowed from non-payable "address" to "contract C", which has a payable fallback function. +// TypeError 7398: (92-96): Explicit type conversion not allowed from non-payable "address" to "contract C", which has a payable fallback function. diff --git a/test/libsolidity/syntaxTests/types/array_index_too_large.sol b/test/libsolidity/syntaxTests/types/array_index_too_large.sol index 06b5071f21b9..646004800838 100644 --- a/test/libsolidity/syntaxTests/types/array_index_too_large.sol +++ b/test/libsolidity/syntaxTests/types/array_index_too_large.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (140-218): Type int_const 1234...(70 digits omitted)...5678 is not implicitly convertible to expected type uint256. \ No newline at end of file +// TypeError 7407: (140-218): Type int_const 1234...(70 digits omitted)...5678 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/types/bool_ops.sol b/test/libsolidity/syntaxTests/types/bool_ops.sol index 91033906436f..7aac8729bde1 100644 --- a/test/libsolidity/syntaxTests/types/bool_ops.sol +++ b/test/libsolidity/syntaxTests/types/bool_ops.sol @@ -32,22 +32,22 @@ contract C { } } // ---- -// TypeError: (231-236): Operator > not compatible with types bool and bool -// TypeError: (250-255): Operator < not compatible with types bool and bool -// TypeError: (269-275): Operator >= not compatible with types bool and bool -// TypeError: (289-295): Operator <= not compatible with types bool and bool -// TypeError: (309-314): Operator & not compatible with types bool and bool -// TypeError: (328-333): Operator | not compatible with types bool and bool -// TypeError: (347-352): Operator ^ not compatible with types bool and bool -// TypeError: (366-368): Unary operator ~ cannot be applied to type bool -// TypeError: (382-384): Unary operator ~ cannot be applied to type bool -// TypeError: (398-403): Operator + not compatible with types bool and bool -// TypeError: (417-422): Operator - not compatible with types bool and bool -// TypeError: (436-438): Unary operator - cannot be applied to type bool -// TypeError: (452-454): Unary operator - cannot be applied to type bool -// TypeError: (468-473): Operator * not compatible with types bool and bool -// TypeError: (487-492): Operator / not compatible with types bool and bool -// TypeError: (506-512): Operator ** not compatible with types bool and bool -// TypeError: (526-531): Operator % not compatible with types bool and bool -// TypeError: (545-551): Operator << not compatible with types bool and bool -// TypeError: (565-571): Operator >> not compatible with types bool and bool +// TypeError 2271: (231-236): Operator > not compatible with types bool and bool +// TypeError 2271: (250-255): Operator < not compatible with types bool and bool +// TypeError 2271: (269-275): Operator >= not compatible with types bool and bool +// TypeError 2271: (289-295): Operator <= not compatible with types bool and bool +// TypeError 2271: (309-314): Operator & not compatible with types bool and bool +// TypeError 2271: (328-333): Operator | not compatible with types bool and bool +// TypeError 2271: (347-352): Operator ^ not compatible with types bool and bool +// TypeError 4907: (366-368): Unary operator ~ cannot be applied to type bool +// TypeError 4907: (382-384): Unary operator ~ cannot be applied to type bool +// TypeError 2271: (398-403): Operator + not compatible with types bool and bool +// TypeError 2271: (417-422): Operator - not compatible with types bool and bool +// TypeError 4907: (436-438): Unary operator - cannot be applied to type bool +// TypeError 4907: (452-454): Unary operator - cannot be applied to type bool +// TypeError 2271: (468-473): Operator * not compatible with types bool and bool +// TypeError 2271: (487-492): Operator / not compatible with types bool and bool +// TypeError 2271: (506-512): Operator ** not compatible with types bool and bool +// TypeError 2271: (526-531): Operator % not compatible with types bool and bool +// TypeError 2271: (545-551): Operator << not compatible with types bool and bool +// TypeError 2271: (565-571): Operator >> not compatible with types bool and bool diff --git a/test/libsolidity/syntaxTests/types/bytes0.sol b/test/libsolidity/syntaxTests/types/bytes0.sol index 7c6d5974c4e8..13a6c54de937 100644 --- a/test/libsolidity/syntaxTests/types/bytes0.sol +++ b/test/libsolidity/syntaxTests/types/bytes0.sol @@ -2,4 +2,4 @@ contract C { bytes0 b0 = 1; } // ---- -// DeclarationError: (15-21): Identifier not found or not unique. +// DeclarationError 7920: (15-21): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/types/bytes1_to_uint256.sol b/test/libsolidity/syntaxTests/types/bytes1_to_uint256.sol index 58828a6271da..2d0a7d326c4e 100644 --- a/test/libsolidity/syntaxTests/types/bytes1_to_uint256.sol +++ b/test/libsolidity/syntaxTests/types/bytes1_to_uint256.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (76-95): Explicit type conversion not allowed from "bytes1" to "uint256". +// TypeError 9640: (76-95): Explicit type conversion not allowed from "bytes1" to "uint256". diff --git a/test/libsolidity/syntaxTests/types/bytes256.sol b/test/libsolidity/syntaxTests/types/bytes256.sol index 22b5408db180..4f477c4c7bfd 100644 --- a/test/libsolidity/syntaxTests/types/bytes256.sol +++ b/test/libsolidity/syntaxTests/types/bytes256.sol @@ -2,4 +2,4 @@ contract C { bytes256 b256 = 1; } // ---- -// DeclarationError: (15-23): Identifier not found or not unique. +// DeclarationError 7920: (15-23): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/types/bytes32_to_uint32.sol b/test/libsolidity/syntaxTests/types/bytes32_to_uint32.sol index 77e813abbd39..1370e0093a1d 100644 --- a/test/libsolidity/syntaxTests/types/bytes32_to_uint32.sol +++ b/test/libsolidity/syntaxTests/types/bytes32_to_uint32.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (75-94): Explicit type conversion not allowed from "bytes32" to "uint32". +// TypeError 9640: (75-94): Explicit type conversion not allowed from "bytes32" to "uint32". diff --git a/test/libsolidity/syntaxTests/types/bytes33.sol b/test/libsolidity/syntaxTests/types/bytes33.sol index 7edf13d33af7..2ec7f530ac93 100644 --- a/test/libsolidity/syntaxTests/types/bytes33.sol +++ b/test/libsolidity/syntaxTests/types/bytes33.sol @@ -2,4 +2,4 @@ contract C { bytes33 b33 = 1; } // ---- -// DeclarationError: (15-22): Identifier not found or not unique. +// DeclarationError 7920: (15-22): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/types/bytesXX_index_assign.sol b/test/libsolidity/syntaxTests/types/bytesXX_index_assign.sol index 8c55a80380e2..d8de853a7cb4 100644 --- a/test/libsolidity/syntaxTests/types/bytesXX_index_assign.sol +++ b/test/libsolidity/syntaxTests/types/bytesXX_index_assign.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (71-75): Single bytes in fixed bytes arrays cannot be modified. +// TypeError 4360: (71-75): Single bytes in fixed bytes arrays cannot be modified. diff --git a/test/libsolidity/syntaxTests/types/bytes_to_contract.sol b/test/libsolidity/syntaxTests/types/bytes_to_contract.sol index 820dbf9bd986..61492eaa98ce 100644 --- a/test/libsolidity/syntaxTests/types/bytes_to_contract.sol +++ b/test/libsolidity/syntaxTests/types/bytes_to_contract.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (64-91): Explicit type conversion not allowed from "bytes20" to "contract C". +// TypeError 9640: (64-91): Explicit type conversion not allowed from "bytes20" to "contract C". diff --git a/test/libsolidity/syntaxTests/types/constant_of_invalid_function_type.sol b/test/libsolidity/syntaxTests/types/constant_of_invalid_function_type.sol index 8c24520dff24..a371cb13b3ab 100644 --- a/test/libsolidity/syntaxTests/types/constant_of_invalid_function_type.sol +++ b/test/libsolidity/syntaxTests/types/constant_of_invalid_function_type.sol @@ -4,4 +4,4 @@ contract C { } // ---- -// TypeError: (77-78): Name has to refer to a struct, enum or contract. +// TypeError 5172: (77-78): Name has to refer to a struct, enum or contract. diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_base_name_to_var.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_base_name_to_var.sol index d26c51603754..b3bff7849919 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_base_name_to_var.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_base_name_to_var.sol @@ -10,5 +10,5 @@ contract B is A { } } // ---- -// TypeError: (133-160): Type function A.f() is not implicitly convertible to expected type function () external. -// TypeError: (170-202): Type function A.g() pure is not implicitly convertible to expected type function () pure external. +// TypeError 9574: (133-160): Type function A.f() is not implicitly convertible to expected type function () external. +// TypeError 9574: (170-202): Type function A.g() pure is not implicitly convertible to expected type function () pure external. diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_contract_name_to_var.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_contract_name_to_var.sol index 546779548c74..655493d08f22 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_contract_name_to_var.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/assign_function_via_contract_name_to_var.sol @@ -10,5 +10,5 @@ contract B { } } // ---- -// TypeError: (128-155): Type function A.f() is not implicitly convertible to expected type function () external. -// TypeError: (165-197): Type function A.g() pure is not implicitly convertible to expected type function () pure external. +// TypeError 9574: (128-155): Type function A.f() is not implicitly convertible to expected type function () external. +// TypeError 9574: (165-197): Type function A.g() pure is not implicitly convertible to expected type function () pure external. diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/base_contract_invalid.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/base_contract_invalid.sol index 35c926eb3d82..893b79101680 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/base_contract_invalid.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/base_contract_invalid.sol @@ -9,5 +9,5 @@ contract C is B { } } // ---- -// TypeError: (125-130): Cannot call function via contract type name. -// TypeError: (140-152): Member "selector" not found or not visible after argument-dependent lookup in function (). +// TypeError 3419: (125-130): Cannot call function via contract type name. +// TypeError 9582: (140-152): Member "selector" not found or not visible after argument-dependent lookup in function (). diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/call_function_via_contract_name.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/call_function_via_contract_name.sol index 419080cbb9ae..7680eac5c1a3 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/call_function_via_contract_name.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/call_function_via_contract_name.sol @@ -12,6 +12,6 @@ contract B { } } // ---- -// TypeError: (160-165): Cannot call function via contract type name. -// TypeError: (175-180): Cannot call function via contract type name. -// TypeError: (190-195): Cannot call function via contract type name. +// TypeError 3419: (160-165): Cannot call function via contract type name. +// TypeError 3419: (175-180): Cannot call function via contract type name. +// TypeError 3419: (190-195): Cannot call function via contract type name. diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/call_unimplemented_base.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/call_unimplemented_base.sol index a785de63cc7d..f351bc547c63 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/call_unimplemented_base.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/call_unimplemented_base.sol @@ -7,4 +7,4 @@ contract C is B { } } // ---- -// TypeError: (118-123): Cannot call unimplemented base function. +// TypeError 7501: (118-123): Cannot call unimplemented base function. diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_internal.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_internal.sol index 0c2247fdb1f1..ef785b036fb6 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_internal.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_internal.sol @@ -8,4 +8,4 @@ contract B { } } // ---- -// TypeError: (94-97): Member "f" not found or not visible after argument-dependent lookup in type(contract A). +// TypeError 9582: (94-97): Member "f" not found or not visible after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_overloaded.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_overloaded.sol index 23bed07d0b30..672af71fdae5 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_overloaded.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_overloaded.sol @@ -9,4 +9,4 @@ contract B { } } // ---- -// TypeError: (130-133): Member "f" not unique after argument-dependent lookup in type(contract A). +// TypeError 6675: (130-133): Member "f" not unique after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_private.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_private.sol index eec0f69ba8b1..229d20d2e829 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_private.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/function_via_contract_name_private.sol @@ -8,4 +8,4 @@ contract B { } } // ---- -// TypeError: (93-96): Member "f" not found or not visible after argument-dependent lookup in type(contract A). +// TypeError 9582: (93-96): Member "f" not found or not visible after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier.sol index 496b16524e49..fab24ba808c2 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier.sol @@ -7,4 +7,4 @@ contract B { } } // ---- -// TypeError: (88-93): Member "mod" not found or not visible after argument-dependent lookup in type(contract A). +// TypeError 9582: (88-93): Member "mod" not found or not visible after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier_base.sol b/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier_base.sol index 85c0daec2a26..42e8445c6b99 100644 --- a/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier_base.sol +++ b/test/libsolidity/syntaxTests/types/contractTypeType/members/modifier_base.sol @@ -7,4 +7,4 @@ contract B is A { } } // ---- -// TypeError: (93-98): Member "mod" not found or not visible after argument-dependent lookup in type(contract A). +// TypeError 9582: (93-98): Member "mod" not found or not visible after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/contract_to_derived.sol b/test/libsolidity/syntaxTests/types/contract_to_derived.sol index ac8df5d1fe6c..e45f86c42503 100644 --- a/test/libsolidity/syntaxTests/types/contract_to_derived.sol +++ b/test/libsolidity/syntaxTests/types/contract_to_derived.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (85-95): Explicit type conversion not allowed from "contract B" to "contract A". +// TypeError 9640: (85-95): Explicit type conversion not allowed from "contract B" to "contract A". diff --git a/test/libsolidity/syntaxTests/types/contract_to_unrelated_contract.sol b/test/libsolidity/syntaxTests/types/contract_to_unrelated_contract.sol index b0a4875f32eb..cbc48df52b8d 100644 --- a/test/libsolidity/syntaxTests/types/contract_to_unrelated_contract.sol +++ b/test/libsolidity/syntaxTests/types/contract_to_unrelated_contract.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (80-90): Explicit type conversion not allowed from "contract A" to "contract B". +// TypeError 9640: (80-90): Explicit type conversion not allowed from "contract A" to "contract B". diff --git a/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_consts_exhausted.sol b/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_consts_exhausted.sol index c66697461fad..3bbc722c2310 100644 --- a/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_consts_exhausted.sol +++ b/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_consts_exhausted.sol @@ -259,4 +259,4 @@ contract Main { A constant JX = A(0x00); } // ---- -// DeclarationError: (6105-6123): Variable definition exhausting cyclic dependency validator. +// DeclarationError 7380: (6105-6123): Variable definition exhausting cyclic dependency validator. diff --git a/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_struct_exhausted.sol b/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_struct_exhausted.sol index 027db9754292..2dab25f1ff6a 100644 --- a/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_struct_exhausted.sol +++ b/test/libsolidity/syntaxTests/types/cyclic_dependency_check_on_struct_exhausted.sol @@ -257,4 +257,4 @@ contract Main { struct JW { int i; } } // ---- -// DeclarationError: (6091-6111): Struct definition exhausts cyclic dependency validator. +// DeclarationError 5651: (6091-6111): Struct definition exhausts cyclic dependency validator. diff --git a/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_explicit.sol b/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_explicit.sol index ff285a0791f8..920c8991be5d 100644 --- a/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_explicit.sol +++ b/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_explicit.sol @@ -12,12 +12,12 @@ contract C { } } // ---- -// TypeError: (60-69): Explicit type conversion not allowed from "int_const 1" to "bytes1". -// TypeError: (88-97): Explicit type conversion not allowed from "int_const 1" to "bytes2". -// TypeError: (116-127): Explicit type conversion not allowed from "int_const 256" to "bytes2". -// TypeError: (146-155): Explicit type conversion not allowed from "int_const 1" to "bytes3". -// TypeError: (174-187): Explicit type conversion not allowed from "int_const 65536" to "bytes3". -// TypeError: (206-215): Explicit type conversion not allowed from "int_const 1" to "bytes4". -// TypeError: (234-250): Explicit type conversion not allowed from "int_const 16777216" to "bytes4". -// TypeError: (270-280): Explicit type conversion not allowed from "int_const 1" to "bytes16". -// TypeError: (300-310): Explicit type conversion not allowed from "int_const 1" to "bytes32". +// TypeError 9640: (60-69): Explicit type conversion not allowed from "int_const 1" to "bytes1". +// TypeError 9640: (88-97): Explicit type conversion not allowed from "int_const 1" to "bytes2". +// TypeError 9640: (116-127): Explicit type conversion not allowed from "int_const 256" to "bytes2". +// TypeError 9640: (146-155): Explicit type conversion not allowed from "int_const 1" to "bytes3". +// TypeError 9640: (174-187): Explicit type conversion not allowed from "int_const 65536" to "bytes3". +// TypeError 9640: (206-215): Explicit type conversion not allowed from "int_const 1" to "bytes4". +// TypeError 9640: (234-250): Explicit type conversion not allowed from "int_const 16777216" to "bytes4". +// TypeError 9640: (270-280): Explicit type conversion not allowed from "int_const 1" to "bytes16". +// TypeError 9640: (300-310): Explicit type conversion not allowed from "int_const 1" to "bytes32". diff --git a/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_implicit.sol b/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_implicit.sol index e472c43b2f4b..9f7002a8d39b 100644 --- a/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_implicit.sol +++ b/test/libsolidity/syntaxTests/types/decimal_literal_to_bytesXX_implicit.sol @@ -12,12 +12,12 @@ contract C { } } // ---- -// TypeError: (48-61): Type int_const 1 is not implicitly convertible to expected type bytes1. -// TypeError: (68-81): Type int_const 1 is not implicitly convertible to expected type bytes2. -// TypeError: (88-103): Type int_const 256 is not implicitly convertible to expected type bytes2. -// TypeError: (110-123): Type int_const 1 is not implicitly convertible to expected type bytes3. -// TypeError: (130-147): Type int_const 65536 is not implicitly convertible to expected type bytes3. -// TypeError: (154-167): Type int_const 1 is not implicitly convertible to expected type bytes4. -// TypeError: (174-194): Type int_const 16777216 is not implicitly convertible to expected type bytes4. -// TypeError: (201-215): Type int_const 1 is not implicitly convertible to expected type bytes16. -// TypeError: (222-236): Type int_const 1 is not implicitly convertible to expected type bytes32. +// TypeError 9574: (48-61): Type int_const 1 is not implicitly convertible to expected type bytes1. +// TypeError 9574: (68-81): Type int_const 1 is not implicitly convertible to expected type bytes2. +// TypeError 9574: (88-103): Type int_const 256 is not implicitly convertible to expected type bytes2. +// TypeError 9574: (110-123): Type int_const 1 is not implicitly convertible to expected type bytes3. +// TypeError 9574: (130-147): Type int_const 65536 is not implicitly convertible to expected type bytes3. +// TypeError 9574: (154-167): Type int_const 1 is not implicitly convertible to expected type bytes4. +// TypeError 9574: (174-194): Type int_const 16777216 is not implicitly convertible to expected type bytes4. +// TypeError 9574: (201-215): Type int_const 1 is not implicitly convertible to expected type bytes16. +// TypeError 9574: (222-236): Type int_const 1 is not implicitly convertible to expected type bytes32. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_event.sol b/test/libsolidity/syntaxTests/types/empty_tuple_event.sol index 898ee8bacf08..a83e6ec1ee59 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_event.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_event.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (71-75): Expected primary expression. +// ParserError 6933: (71-75): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_function.sol b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol index a898f84ad96f..f60fe87a1c6b 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_function.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (138-141): Tuple component cannot be empty. -// TypeError: (157-160): Tuple component cannot be empty. +// TypeError 6473: (138-141): Tuple component cannot be empty. +// TypeError 6473: (157-160): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol index 63b039cd89c5..9d2ed7b24039 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol @@ -7,6 +7,6 @@ contract C { } } // ---- -// TypeError: (122-125): Tuple component cannot be empty. -// TypeError: (127-130): Tuple component cannot be empty. -// TypeError: (121-131): Type tuple(tuple(),tuple()) is not implicitly convertible to expected type tuple(uint256,uint256). +// TypeError 6473: (122-125): Tuple component cannot be empty. +// TypeError 6473: (127-130): Tuple component cannot be empty. +// TypeError 7407: (121-131): Type tuple(tuple(),tuple()) is not implicitly convertible to expected type tuple(uint256,uint256). diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_array.sol b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_array.sol index 9bc21561bfe7..538460c68b2a 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_array.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_array.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (122-125): Array component cannot be empty. +// TypeError 5604: (122-125): Array component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_fractional.sol index 16c76d9ac151..2202e7a82e56 100644 --- a/test/libsolidity/syntaxTests/types/encoding_fractional.sol +++ b/test/libsolidity/syntaxTests/types/encoding_fractional.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (92-95): Fractional numbers cannot yet be encoded. +// TypeError 6090: (92-95): Fractional numbers cannot yet be encoded. diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol index c3393b0a016f..406a56bef4e0 100644 --- a/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol +++ b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (126-129): Fractional numbers cannot yet be encoded. +// TypeError 6090: (126-129): Fractional numbers cannot yet be encoded. diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol index 71080cb02ad2..f3e2863f06d2 100644 --- a/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol +++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol @@ -4,5 +4,5 @@ contract C { } } // ---- -// TypeError: (98-101): Fractional numbers cannot yet be encoded. -// TypeError: (103-104): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError 6090: (98-101): Fractional numbers cannot yet be encoded. +// TypeError 7279: (103-104): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol index b6943aea6709..0448121e8847 100644 --- a/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol +++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// TypeError: (132-135): Fractional numbers cannot yet be encoded. -// TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError 6090: (132-135): Fractional numbers cannot yet be encoded. +// TypeError 7279: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/types/function_call_fail.sol b/test/libsolidity/syntaxTests/types/function_call_fail.sol index 5ce778a6dcfd..7e2d0b2302ff 100644 --- a/test/libsolidity/syntaxTests/types/function_call_fail.sol +++ b/test/libsolidity/syntaxTests/types/function_call_fail.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (59-63): Type is not callable +// TypeError 5704: (59-63): Type is not callable diff --git a/test/libsolidity/syntaxTests/types/function_call_fail2.sol b/test/libsolidity/syntaxTests/types/function_call_fail2.sol index 389ffce96079..97b7519191ce 100644 --- a/test/libsolidity/syntaxTests/types/function_call_fail2.sol +++ b/test/libsolidity/syntaxTests/types/function_call_fail2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (74-78): Expression has to be an lvalue. +// TypeError 4247: (74-78): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/types/function_types/function_definition_expression.sol b/test/libsolidity/syntaxTests/types/function_types/function_definition_expression.sol index 8afe07f573ad..b514e1ce1e7e 100644 --- a/test/libsolidity/syntaxTests/types/function_types/function_definition_expression.sol +++ b/test/libsolidity/syntaxTests/types/function_types/function_definition_expression.sol @@ -8,4 +8,4 @@ contract Apple { } } // ---- -// Warning: (141-156): Statement has no effect. +// Warning 6133: (141-156): Statement has no effect. diff --git a/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol b/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol index c722ed814ef9..9fb1a432d074 100644 --- a/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol +++ b/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol @@ -33,10 +33,10 @@ abstract contract Test } } // ---- -// TypeError: (1229-1322): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (uint256) pure returns (uint256). -// TypeError: (1330-1436): Type function (uint256) pure returns (string storage pointer) is not implicitly convertible to expected type function (uint256) pure returns (string memory). -// TypeError: (1444-1542): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (uint256). -// TypeError: (1550-1657): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (string memory). -// TypeError: (1666-1777): Type function (uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256). -// TypeError: (1785-1904): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,uint256) pure returns (string memory). -// TypeError: (1912-2036): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,string memory) pure returns (string memory). +// TypeError 9574: (1229-1322): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (uint256) pure returns (uint256). +// TypeError 9574: (1330-1436): Type function (uint256) pure returns (string storage pointer) is not implicitly convertible to expected type function (uint256) pure returns (string memory). +// TypeError 9574: (1444-1542): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (uint256). +// TypeError 9574: (1550-1657): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (string memory). +// TypeError 9574: (1666-1777): Type function (uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256). +// TypeError 9574: (1785-1904): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,uint256) pure returns (string memory). +// TypeError 9574: (1912-2036): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,string memory) pure returns (string memory). diff --git a/test/libsolidity/syntaxTests/types/function_types/function_state_mutability_fail.sol b/test/libsolidity/syntaxTests/types/function_types/function_state_mutability_fail.sol index 818d78406442..b393ed1197cf 100644 --- a/test/libsolidity/syntaxTests/types/function_types/function_state_mutability_fail.sol +++ b/test/libsolidity/syntaxTests/types/function_types/function_state_mutability_fail.sol @@ -38,14 +38,14 @@ contract Test } } // ---- -// TypeError: (1580-1596): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view returns (uint256) to function (uint256) pure returns (uint256) requested. -// TypeError: (1653-1672): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) pure returns (uint256) requested. -// TypeError: (1733-1752): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) view returns (uint256) requested. -// TypeError: (1813-1834): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view external returns (uint256) to function (uint256) pure external returns (uint256) requested. -// TypeError: (1891-1915): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) payable external returns (uint256) to function (uint256) pure external returns (uint256) requested. -// TypeError: (1975-1999): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) pure external returns (uint256) requested. -// TypeError: (2060-2084): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) payable external returns (uint256) to function (uint256) view external returns (uint256) requested. -// TypeError: (2144-2168): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) view external returns (uint256) requested. -// TypeError: (2232-2253): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) pure external returns (uint256) to function (uint256) payable external returns (uint256) requested. -// TypeError: (2316-2337): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view external returns (uint256) to function (uint256) payable external returns (uint256) requested. -// TypeError: (2400-2424): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) payable external returns (uint256) requested. +// TypeError 9553: (1580-1596): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view returns (uint256) to function (uint256) pure returns (uint256) requested. +// TypeError 9553: (1653-1672): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) pure returns (uint256) requested. +// TypeError 9553: (1733-1752): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) view returns (uint256) requested. +// TypeError 9553: (1813-1834): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view external returns (uint256) to function (uint256) pure external returns (uint256) requested. +// TypeError 9553: (1891-1915): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) payable external returns (uint256) to function (uint256) pure external returns (uint256) requested. +// TypeError 9553: (1975-1999): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) pure external returns (uint256) requested. +// TypeError 9553: (2060-2084): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) payable external returns (uint256) to function (uint256) view external returns (uint256) requested. +// TypeError 9553: (2144-2168): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) view external returns (uint256) requested. +// TypeError 9553: (2232-2253): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) pure external returns (uint256) to function (uint256) payable external returns (uint256) requested. +// TypeError 9553: (2316-2337): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) view external returns (uint256) to function (uint256) payable external returns (uint256) requested. +// TypeError 9553: (2400-2424): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) external returns (uint256) to function (uint256) payable external returns (uint256) requested. diff --git a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_contract_name.sol b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_contract_name.sol index 79d74893bcf5..bccc6fb76632 100644 --- a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_contract_name.sol +++ b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_contract_name.sol @@ -6,4 +6,4 @@ contract C { bytes4 constant s4 = A.f.selector; } // ---- -// TypeError: (88-91): Member "f" not found or not visible after argument-dependent lookup in type(contract A). +// TypeError 9582: (88-91): Member "f" not found or not visible after argument-dependent lookup in type(contract A). diff --git a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_not_pure.sol b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_not_pure.sol index 2bd5a2a31b07..90ff1488fd96 100644 --- a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_not_pure.sol +++ b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_not_pure.sol @@ -12,6 +12,6 @@ contract C is B { bytes4 constant s3 = this.h.selector; } // ---- -// TypeError: (176-186): Initial value for constant variable has to be compile-time constant. -// TypeError: (213-225): Initial value for constant variable has to be compile-time constant. -// TypeError: (252-267): Initial value for constant variable has to be compile-time constant. +// TypeError 8349: (176-186): Initial value for constant variable has to be compile-time constant. +// TypeError 8349: (213-225): Initial value for constant variable has to be compile-time constant. +// TypeError 8349: (252-267): Initial value for constant variable has to be compile-time constant. diff --git a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_super.sol b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_super.sol index c6d658d1dc95..36d3b013a270 100644 --- a/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_super.sol +++ b/test/libsolidity/syntaxTests/types/function_types/selector/state_variable_selector_super.sol @@ -6,4 +6,4 @@ contract C is B { bytes4 constant s4 = super.g.selector; } // ---- -// TypeError: (93-100): Member "g" not found or not visible after argument-dependent lookup in contract super C. +// TypeError 9582: (93-100): Member "g" not found or not visible after argument-dependent lookup in contract super C. diff --git a/test/libsolidity/syntaxTests/types/global_struct_recursive.sol b/test/libsolidity/syntaxTests/types/global_struct_recursive.sol index dc4becaae5f6..a3f6976d8aaa 100644 --- a/test/libsolidity/syntaxTests/types/global_struct_recursive.sol +++ b/test/libsolidity/syntaxTests/types/global_struct_recursive.sol @@ -5,4 +5,4 @@ contract C { // whatever } // ---- -// TypeError: (0-19): Recursive struct definition. +// TypeError 2046: (0-19): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_explicit.sol b/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_explicit.sol index e1e9850df76a..7e10fff50bba 100644 --- a/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_explicit.sol +++ b/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_explicit.sol @@ -16,16 +16,16 @@ contract C { } } // ---- -// TypeError: (60-71): Explicit type conversion not allowed from "int_const 1" to "bytes1". -// TypeError: (90-103): Explicit type conversion not allowed from "int_const 256" to "bytes1". -// TypeError: (122-134): Explicit type conversion not allowed from "int_const 255" to "bytes2". -// TypeError: (153-166): Explicit type conversion not allowed from "int_const 256" to "bytes2". -// TypeError: (185-200): Explicit type conversion not allowed from "int_const 65536" to "bytes2". -// TypeError: (219-233): Explicit type conversion not allowed from "int_const 65535" to "bytes3". -// TypeError: (252-267): Explicit type conversion not allowed from "int_const 65536" to "bytes3". -// TypeError: (286-303): Explicit type conversion not allowed from "int_const 16777216" to "bytes3". -// TypeError: (322-338): Explicit type conversion not allowed from "int_const 16777215" to "bytes4". -// TypeError: (358-375): Explicit type conversion not allowed from "int_const 16777216" to "bytes4". -// TypeError: (395-414): Explicit type conversion not allowed from "int_const 4294967296" to "bytes4". -// TypeError: (435-447): Explicit type conversion not allowed from "int_const 1" to "bytes16". -// TypeError: (468-480): Explicit type conversion not allowed from "int_const 1" to "bytes32". +// TypeError 9640: (60-71): Explicit type conversion not allowed from "int_const 1" to "bytes1". +// TypeError 9640: (90-103): Explicit type conversion not allowed from "int_const 256" to "bytes1". +// TypeError 9640: (122-134): Explicit type conversion not allowed from "int_const 255" to "bytes2". +// TypeError 9640: (153-166): Explicit type conversion not allowed from "int_const 256" to "bytes2". +// TypeError 9640: (185-200): Explicit type conversion not allowed from "int_const 65536" to "bytes2". +// TypeError 9640: (219-233): Explicit type conversion not allowed from "int_const 65535" to "bytes3". +// TypeError 9640: (252-267): Explicit type conversion not allowed from "int_const 65536" to "bytes3". +// TypeError 9640: (286-303): Explicit type conversion not allowed from "int_const 16777216" to "bytes3". +// TypeError 9640: (322-338): Explicit type conversion not allowed from "int_const 16777215" to "bytes4". +// TypeError 9640: (358-375): Explicit type conversion not allowed from "int_const 16777216" to "bytes4". +// TypeError 9640: (395-414): Explicit type conversion not allowed from "int_const 4294967296" to "bytes4". +// TypeError 9640: (435-447): Explicit type conversion not allowed from "int_const 1" to "bytes16". +// TypeError 9640: (468-480): Explicit type conversion not allowed from "int_const 1" to "bytes32". diff --git a/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_implicit.sol b/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_implicit.sol index 44ed9318405a..6df3337f693d 100644 --- a/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_implicit.sol +++ b/test/libsolidity/syntaxTests/types/hex_literal_to_bytesXX_different_size_implicit.sol @@ -16,16 +16,16 @@ contract C { } } // ---- -// TypeError: (48-63): Type int_const 1 is not implicitly convertible to expected type bytes1. -// TypeError: (70-87): Type int_const 256 is not implicitly convertible to expected type bytes1. -// TypeError: (94-110): Type int_const 255 is not implicitly convertible to expected type bytes2. -// TypeError: (117-134): Type int_const 256 is not implicitly convertible to expected type bytes2. -// TypeError: (141-160): Type int_const 65536 is not implicitly convertible to expected type bytes2. -// TypeError: (167-185): Type int_const 65535 is not implicitly convertible to expected type bytes3. -// TypeError: (192-211): Type int_const 65536 is not implicitly convertible to expected type bytes3. -// TypeError: (218-239): Type int_const 16777216 is not implicitly convertible to expected type bytes3. -// TypeError: (246-266): Type int_const 16777215 is not implicitly convertible to expected type bytes4. -// TypeError: (273-295): Type int_const 16777216 is not implicitly convertible to expected type bytes4. -// TypeError: (302-326): Type int_const 4294967296 is not implicitly convertible to expected type bytes4. -// TypeError: (333-350): Type int_const 1 is not implicitly convertible to expected type bytes16. -// TypeError: (357-374): Type int_const 1 is not implicitly convertible to expected type bytes32. +// TypeError 9574: (48-63): Type int_const 1 is not implicitly convertible to expected type bytes1. +// TypeError 9574: (70-87): Type int_const 256 is not implicitly convertible to expected type bytes1. +// TypeError 9574: (94-110): Type int_const 255 is not implicitly convertible to expected type bytes2. +// TypeError 9574: (117-134): Type int_const 256 is not implicitly convertible to expected type bytes2. +// TypeError 9574: (141-160): Type int_const 65536 is not implicitly convertible to expected type bytes2. +// TypeError 9574: (167-185): Type int_const 65535 is not implicitly convertible to expected type bytes3. +// TypeError 9574: (192-211): Type int_const 65536 is not implicitly convertible to expected type bytes3. +// TypeError 9574: (218-239): Type int_const 16777216 is not implicitly convertible to expected type bytes3. +// TypeError 9574: (246-266): Type int_const 16777215 is not implicitly convertible to expected type bytes4. +// TypeError 9574: (273-295): Type int_const 16777216 is not implicitly convertible to expected type bytes4. +// TypeError 9574: (302-326): Type int_const 4294967296 is not implicitly convertible to expected type bytes4. +// TypeError 9574: (333-350): Type int_const 1 is not implicitly convertible to expected type bytes16. +// TypeError 9574: (357-374): Type int_const 1 is not implicitly convertible to expected type bytes32. diff --git a/test/libsolidity/syntaxTests/types/library_function_selector_internal.sol b/test/libsolidity/syntaxTests/types/library_function_selector_internal.sol index 8f155867e623..96ed0585472d 100644 --- a/test/libsolidity/syntaxTests/types/library_function_selector_internal.sol +++ b/test/libsolidity/syntaxTests/types/library_function_selector_internal.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (126-138): Member "selector" not found or not visible after argument-dependent lookup in function (uint256). +// TypeError 9582: (126-138): Member "selector" not found or not visible after argument-dependent lookup in function (uint256). diff --git a/test/libsolidity/syntaxTests/types/library_function_selector_private_inside.sol b/test/libsolidity/syntaxTests/types/library_function_selector_private_inside.sol index 825953196c3c..36d43f0fa4c5 100644 --- a/test/libsolidity/syntaxTests/types/library_function_selector_private_inside.sol +++ b/test/libsolidity/syntaxTests/types/library_function_selector_private_inside.sol @@ -5,4 +5,4 @@ library L { } } // ---- -// TypeError: (113-123): Member "selector" not found or not visible after argument-dependent lookup in function (uint256). +// TypeError 9582: (113-123): Member "selector" not found or not visible after argument-dependent lookup in function (uint256). diff --git a/test/libsolidity/syntaxTests/types/library_function_selector_private_outside.sol b/test/libsolidity/syntaxTests/types/library_function_selector_private_outside.sol index b5785f88f21a..000cfec1593c 100644 --- a/test/libsolidity/syntaxTests/types/library_function_selector_private_outside.sol +++ b/test/libsolidity/syntaxTests/types/library_function_selector_private_outside.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError: (125-128): Member "f" not found or not visible after argument-dependent lookup in type(library L). +// TypeError 9582: (125-128): Member "f" not found or not visible after argument-dependent lookup in type(library L). diff --git a/test/libsolidity/syntaxTests/types/library_to_address_payable.sol b/test/libsolidity/syntaxTests/types/library_to_address_payable.sol index 36a7a8968470..50950b27e14b 100644 --- a/test/libsolidity/syntaxTests/types/library_to_address_payable.sol +++ b/test/libsolidity/syntaxTests/types/library_to_address_payable.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (99-109): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. +// TypeError 6359: (99-109): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable. diff --git a/test/libsolidity/syntaxTests/types/mapping/access_index_omitted.sol b/test/libsolidity/syntaxTests/types/mapping/access_index_omitted.sol index c08404cad269..5f2d4330d59b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/access_index_omitted.sol +++ b/test/libsolidity/syntaxTests/types/mapping/access_index_omitted.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (76-79): Index expression cannot be omitted. +// TypeError 1267: (76-79): Index expression cannot be omitted. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol index 515b43741305..4b391e72bdd9 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-57): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. +// TypeError 6651: (28-57): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol index bdd3ee602454..ce7635e3112f 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-57): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. +// TypeError 6651: (28-57): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol index 993938a81419..91900619e4a3 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-59): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. +// TypeError 6651: (28-59): Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol index 1ddf12e901d4..4316457b0c53 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-59): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. +// TypeError 6651: (28-59): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol index 1d8f8c301947..b353a521a214 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol @@ -7,4 +7,4 @@ contract D { } } // ---- -// TypeError: (160-161): Mappings cannot be assigned to. +// TypeError 9214: (160-161): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol index 1ec86d4cfd44..3c756e945ef9 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol @@ -21,7 +21,7 @@ contract G { mapping (uint => uint) b = x; } // ---- -// TypeError: (17-67): Mappings cannot be assigned to. -// TypeError: (120-148): Mappings cannot be assigned to. -// TypeError: (263-264): Mappings cannot be assigned to. -// TypeError: (312-340): Mappings cannot be assigned to. +// TypeError 6280: (17-67): Mappings cannot be assigned to. +// TypeError 6280: (120-148): Mappings cannot be assigned to. +// TypeError 9214: (263-264): Mappings cannot be assigned to. +// TypeError 6280: (312-340): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol index 1323afe6ff60..d78f319dd6c4 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol @@ -8,7 +8,7 @@ contract test { } } // ---- -// TypeError: (126-129): Mappings cannot be assigned to. -// TypeError: (144-147): Mappings cannot be assigned to. -// TypeError: (163-166): Mappings cannot be assigned to. -// TypeError: (168-171): Mappings cannot be assigned to. +// TypeError 9214: (126-129): Mappings cannot be assigned to. +// TypeError 9214: (144-147): Mappings cannot be assigned to. +// TypeError 9214: (163-166): Mappings cannot be assigned to. +// TypeError 9214: (168-171): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol index b89241ed8365..b1ef76ee0a47 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol @@ -11,7 +11,7 @@ contract test { } } // ---- -// TypeError: (172-180): Mappings cannot be assigned to. -// TypeError: (195-203): Mappings cannot be assigned to. -// TypeError: (219-227): Mappings cannot be assigned to. -// TypeError: (229-237): Mappings cannot be assigned to. +// TypeError 9214: (172-180): Mappings cannot be assigned to. +// TypeError 9214: (195-203): Mappings cannot be assigned to. +// TypeError 9214: (219-227): Mappings cannot be assigned to. +// TypeError 9214: (229-237): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol index aa85a8858233..ec68c8e52077 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_type_mismatch.sol @@ -5,4 +5,4 @@ contract D { } } // ---- -// TypeError: (84-119): Type mapping(uint256 => uint256) is not implicitly convertible to expected type mapping(uint256 => int256). +// TypeError 9574: (84-119): Type mapping(uint256 => uint256) is not implicitly convertible to expected type mapping(uint256 => int256). diff --git a/test/libsolidity/syntaxTests/types/mapping/contract_mapping_invalid.sol b/test/libsolidity/syntaxTests/types/mapping/contract_mapping_invalid.sol index ffe100facd5c..10e127f4ec5b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/contract_mapping_invalid.sol +++ b/test/libsolidity/syntaxTests/types/mapping/contract_mapping_invalid.sol @@ -8,6 +8,6 @@ contract C { } } // ---- -// TypeError: (189-190): Type contract J is not implicitly convertible to expected type contract I. -// TypeError: (195-196): Type contract I is not implicitly convertible to expected type contract J. -// TypeError: (201-202): Type address is not implicitly convertible to expected type contract I. +// TypeError 7407: (189-190): Type contract J is not implicitly convertible to expected type contract I. +// TypeError 7407: (195-196): Type contract I is not implicitly convertible to expected type contract J. +// TypeError 7407: (201-202): Type address is not implicitly convertible to expected type contract I. diff --git a/test/libsolidity/syntaxTests/types/mapping/enum_mapping_invalid.sol b/test/libsolidity/syntaxTests/types/mapping/enum_mapping_invalid.sol index 02eb516e6956..9b0815bf0dd1 100644 --- a/test/libsolidity/syntaxTests/types/mapping/enum_mapping_invalid.sol +++ b/test/libsolidity/syntaxTests/types/mapping/enum_mapping_invalid.sol @@ -6,5 +6,5 @@ contract C { } } // ---- -// TypeError: (146-147): Type uint256 is not implicitly convertible to expected type enum E. -// TypeError: (152-153): Type uint8 is not implicitly convertible to expected type enum E. +// TypeError 7407: (146-147): Type uint256 is not implicitly convertible to expected type enum E. +// TypeError 7407: (152-153): Type uint8 is not implicitly convertible to expected type enum E. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol index 529c63bcf64c..368aaaf0c48d 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (37-64): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. +// TypeError 6651: (37-64): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol index c18aff714c38..7e00f15e73b4 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (57-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. +// TypeError 6651: (57-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol index da5a911b5df4..1826ea2b95fe 100644 --- a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol @@ -3,4 +3,4 @@ library L { } } // ---- -// TypeError: (27-58): Type is required to live outside storage. +// TypeError 3312: (27-58): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol index adb62203c7e2..644bc5129d5b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol @@ -3,4 +3,4 @@ library L { } } // ---- -// TypeError: (27-58): Type is required to live outside storage. +// TypeError 3312: (27-58): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_mapping.sol b/test/libsolidity/syntaxTests/types/mapping/library_mapping.sol index b2512b47b3ca..3c26c7795538 100644 --- a/test/libsolidity/syntaxTests/types/mapping/library_mapping.sol +++ b/test/libsolidity/syntaxTests/types/mapping/library_mapping.sol @@ -1,4 +1,4 @@ library L {} contract C { mapping(L => bool) i; } // ---- -// TypeError: (34-35): Library types cannot be used as mapping keys. +// TypeError 1665: (34-35): Library types cannot be used as mapping keys. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol index ffe757474271..07b7553ca256 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol @@ -2,5 +2,5 @@ contract c { function f1(mapping(uint => uint)[] calldata) pure external {} } // ---- -// TypeError: (29-61): Type is required to live outside storage. -// TypeError: (29-61): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 3312: (29-61): Type is required to live outside storage. +// TypeError 4103: (29-61): Only libraries are allowed to use the mapping type in public or external functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol index 2f7d7e2ed36b..976dacee908d 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (53-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. +// TypeError 6651: (53-84): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol index d48c8b2a8aef..c6e94c542479 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. +// TypeError 6651: (51-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol index deff7c14d27d..3652aebe2b3d 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-113): Data location must be "storage" for variable, but "calldata" was given. +// TypeError 6651: (81-113): Data location must be "storage" for variable, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol index e5253f000e4e..490d987ad268 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-104): Data location must be "storage" for variable, but none was given. +// TypeError 6651: (81-104): Data location must be "storage" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol index d4a7b4599ec0..db2b3235b66f 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol @@ -2,5 +2,5 @@ contract c { function f1(mapping(uint => uint) calldata) pure external returns (mapping(uint => uint) memory) {} } // ---- -// TypeError: (29-59): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. -// TypeError: (84-112): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 3442: (29-59): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 3442: (84-112): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol index 58c105e860d4..92f2e0ed4d62 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol @@ -3,4 +3,4 @@ contract c { function f5(mapping(uint => uint) memory) pure internal {} } // ---- -// TypeError: (93-121): Mapping types can only have a data location of "storage". +// TypeError 5380: (93-121): Mapping types can only have a data location of "storage". diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol index 04932d48a072..5547e071d9e7 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol @@ -2,4 +2,4 @@ contract c { function f3(mapping(uint => uint) memory) view public {} } // ---- -// TypeError: (29-57): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 3442: (29-57): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol index 600ae669307d..1b04b63fd1b6 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-111): Data location must be "storage" for variable, but "memory" was given. +// TypeError 6651: (81-111): Data location must be "storage" for variable, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol index 243bbf72f16e..e09e52ae3890 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (53-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. +// TypeError 6651: (53-82): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol index e488a34e13b1..df3f1c993a36 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-80): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. +// TypeError 6651: (51-80): Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol index cf0c674293e6..e3e4d2cc3a66 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-79): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 3442: (51-79): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. diff --git a/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol b/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol index 62a58f8389a2..18e086a2e1d0 100644 --- a/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol +++ b/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (60-70): Tuple component cannot be empty. +// TypeError 8381: (60-70): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol index 45ede998ac8c..912d8df14ca5 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol @@ -2,4 +2,4 @@ contract c { uint[2**253] data; } // ---- -// Warning: (17-34): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-34): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/types/rational_number_bitshift_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_bitshift_limit.sol index 94981aa0c4d6..a397993b9963 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_bitshift_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_bitshift_limit.sol @@ -7,7 +7,7 @@ contract c { } } // ---- -// TypeError: (71-80): Type int_const 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. -// TypeError: (133-142): Operator << not compatible with types int_const 1 and int_const 4096 -// TypeError: (169-182): Operator << not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2 -// TypeError: (169-182): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 7407: (71-80): Type int_const 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. +// TypeError 2271: (133-142): Operator << not compatible with types int_const 1 and int_const 4096 +// TypeError 2271: (169-182): Operator << not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2 +// TypeError 7407: (169-182): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. diff --git a/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol index 31226781df96..388e9d398b06 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol @@ -5,5 +5,5 @@ contract c { } } // ---- -// TypeError: (71-92): Operator / not compatible with types rational_const 1 / 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits. -// TypeError: (71-92): Type rational_const 1 / 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. Try converting to type ufixed8x80 or use an explicit conversion. +// TypeError 2271: (71-92): Operator / not compatible with types rational_const 1 / 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits. +// TypeError 2326: (71-92): Type rational_const 1 / 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. Try converting to type ufixed8x80 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol index 80b23eff3384..a989c4583a23 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol @@ -19,29 +19,29 @@ contract c { } } // ---- -// TypeError: (71-102): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. -// TypeError: (71-102): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256. -// TypeError: (116-148): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. -// TypeError: (116-153): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. -// TypeError: (116-153): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256. -// TypeError: (167-203): Operator ** not compatible with types int_const 4 and int_const -179...(302 digits omitted)...7216 -// TypeError: (217-228): Operator ** not compatible with types int_const 2 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (242-254): Operator ** not compatible with types int_const -2 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (268-280): Operator ** not compatible with types int_const 2 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (294-307): Operator ** not compatible with types int_const -2 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (321-332): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits. -// TypeError: (321-332): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (346-358): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits. -// TypeError: (346-358): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (372-384): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits. -// TypeError: (372-384): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (398-411): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits. -// TypeError: (398-411): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (425-441): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (425-441): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (455-472): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (455-472): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (486-503): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (486-503): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (517-535): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (517-535): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (71-102): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (71-102): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256. +// TypeError 2271: (116-148): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. +// TypeError 2271: (116-153): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (116-153): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256. +// TypeError 2271: (167-203): Operator ** not compatible with types int_const 4 and int_const -179...(302 digits omitted)...7216 +// TypeError 2271: (217-228): Operator ** not compatible with types int_const 2 and int_const 1000...(1226 digits omitted)...0000 +// TypeError 2271: (242-254): Operator ** not compatible with types int_const -2 and int_const 1000...(1226 digits omitted)...0000 +// TypeError 2271: (268-280): Operator ** not compatible with types int_const 2 and int_const -100...(1227 digits omitted)...0000 +// TypeError 2271: (294-307): Operator ** not compatible with types int_const -2 and int_const -100...(1227 digits omitted)...0000 +// TypeError 2271: (321-332): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (321-332): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (346-358): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (346-358): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (372-384): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (372-384): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (398-411): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (398-411): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (425-441): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 +// TypeError 7407: (425-441): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (455-472): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 +// TypeError 7407: (455-472): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (486-503): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 +// TypeError 7407: (486-503): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError 2271: (517-535): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 +// TypeError 7407: (517-535): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. diff --git a/test/libsolidity/syntaxTests/types/rational_number_huge_fail.sol b/test/libsolidity/syntaxTests/types/rational_number_huge_fail.sol index 08e506562223..1e3239ddf5cf 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_huge_fail.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_huge_fail.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (142-209): Type int_const 1852...(71 digits omitted)...7281 is not implicitly convertible to expected type uint256. +// TypeError 7407: (142-209): Type int_const 1852...(71 digits omitted)...7281 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_1.sol b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_1.sol index 233857a32e24..7ef2ff829f68 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_1.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_1.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (128-134): Invalid literal value. +// TypeError 2826: (128-134): Invalid literal value. diff --git a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_2.sol b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_2.sol index 1667392484e9..ece44f322cd4 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_2.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_2.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (179-218): Invalid literal value. +// TypeError 2826: (179-218): Invalid literal value. diff --git a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_3.sol b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_3.sol index 5a6961718850..29514d528316 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_literal_limit_3.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_literal_limit_3.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (181-221): Invalid literal value. +// TypeError 2826: (181-221): Invalid literal value. diff --git a/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol index d725b43af93b..c2d94da36518 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol @@ -5,5 +5,5 @@ contract c { } } // ---- -// TypeError: (71-90): Operator * not compatible with types int_const 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits. -// TypeError: (71-90): Type int_const 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. +// TypeError 2271: (71-90): Operator * not compatible with types int_const 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits. +// TypeError 7407: (71-90): Type int_const 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. diff --git a/test/libsolidity/syntaxTests/types/rational_number_signed_to_unsigned.sol b/test/libsolidity/syntaxTests/types/rational_number_signed_to_unsigned.sol index 735968952ffc..21989d5d84d5 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_signed_to_unsigned.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_signed_to_unsigned.sol @@ -4,4 +4,4 @@ contract c { } } // ---- -// TypeError: (52-63): Type int_const -1 is not implicitly convertible to expected type uint256. Cannot implicitly convert signed literal to unsigned type. +// TypeError 9574: (52-63): Type int_const -1 is not implicitly convertible to expected type uint256. Cannot implicitly convert signed literal to unsigned type. diff --git a/test/libsolidity/syntaxTests/types/rational_number_too_large.sol b/test/libsolidity/syntaxTests/types/rational_number_too_large.sol index eb221501035f..f331ac0b5e1a 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_too_large.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_too_large.sol @@ -4,4 +4,4 @@ contract c { } } // ---- -// TypeError: (52-65): Type int_const 256 is not implicitly convertible to expected type uint8. Literal is too large to fit in uint8. +// TypeError 9574: (52-65): Type int_const 256 is not implicitly convertible to expected type uint8. Literal is too large to fit in uint8. diff --git a/test/libsolidity/syntaxTests/types/struct_mapping_recursion.sol b/test/libsolidity/syntaxTests/types/struct_mapping_recursion.sol index 4786e009d72c..5dc39266f1ae 100644 --- a/test/libsolidity/syntaxTests/types/struct_mapping_recursion.sol +++ b/test/libsolidity/syntaxTests/types/struct_mapping_recursion.sol @@ -6,4 +6,4 @@ contract C { function g (S calldata) external view {} } // ---- -// TypeError: (56-57): Only elementary types, contract types or enums are allowed as mapping keys. +// TypeError 7804: (56-57): Only elementary types, contract types or enums are allowed as mapping keys. diff --git a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol index f86ffcdd86a1..fa0ceac110f5 100644 --- a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol +++ b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol @@ -2,4 +2,4 @@ contract C { fixed8x80 a = -1e-100; } // ---- -// TypeError: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x80, but it can be explicitly converted. +// TypeError 4426: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x80, but it can be explicitly converted. diff --git a/test/libsolidity/syntaxTests/types/uint256_to_bytes1.sol b/test/libsolidity/syntaxTests/types/uint256_to_bytes1.sol index f70c89edca7f..b9709b9aed21 100644 --- a/test/libsolidity/syntaxTests/types/uint256_to_bytes1.sol +++ b/test/libsolidity/syntaxTests/types/uint256_to_bytes1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (75-93): Explicit type conversion not allowed from "uint256" to "bytes1". +// TypeError 9640: (75-93): Explicit type conversion not allowed from "uint256" to "bytes1". diff --git a/test/libsolidity/syntaxTests/types/uint32_to_bytes32.sol b/test/libsolidity/syntaxTests/types/uint32_to_bytes32.sol index 4153c5c3565b..6b6550b9fc10 100644 --- a/test/libsolidity/syntaxTests/types/uint32_to_bytes32.sol +++ b/test/libsolidity/syntaxTests/types/uint32_to_bytes32.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (76-94): Explicit type conversion not allowed from "uint32" to "bytes32". +// TypeError 9640: (76-94): Explicit type conversion not allowed from "uint32" to "bytes32". diff --git a/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol index 36b3df9fee64..5c67ae5e8c07 100644 --- a/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol +++ b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol @@ -11,6 +11,6 @@ contract C { } // ---- -// SyntaxError: (223-235): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError: (245-257): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError: (267-280): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// SyntaxError 3299: (223-235): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// SyntaxError 3299: (245-257): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// SyntaxError 3299: (267-280): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. diff --git a/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol b/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol index 08e0005c287d..8561b1cba330 100644 --- a/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol +++ b/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol @@ -12,4 +12,4 @@ contract n } } // ---- -// TypeError: (69-84): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (69-84): Different number of components on the left hand side (2) than on the right hand side (1). diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol index 51b949defea4..0106fd92c8c8 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol @@ -5,5 +5,5 @@ contract C { } } // ---- -// SyntaxError: (52-58): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError: (68-75): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// SyntaxError 3299: (52-58): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// SyntaxError 3299: (68-75): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol index 20a004ff93c2..09572cb08b44 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (52-57): Use of the "var" keyword is disallowed. +// TypeError 6983: (52-57): Use of the "var" keyword is disallowed. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol index de2abc9ae762..179d63533750 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError: (52-62): Use of the "var" keyword is disallowed. +// TypeError 4626: (52-62): Use of the "var" keyword is disallowed. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol index 26ee824e43f4..8166f5284d7c 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (52-63): Use of the "var" keyword is disallowed. +// TypeError 4626: (52-63): Use of the "var" keyword is disallowed. diff --git a/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol b/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol index a7c006411a51..893d49637d74 100644 --- a/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol +++ b/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (62-136): Invalid rational int_const 3100...(204 digits omitted)...9237 (absolute value too large or division by zero). +// TypeError 6963: (62-136): Invalid rational int_const 3100...(204 digits omitted)...9237 (absolute value too large or division by zero). diff --git a/test/libsolidity/syntaxTests/types/var_type_suggest.sol b/test/libsolidity/syntaxTests/types/var_type_suggest.sol index 392d7bc83f73..65d91cd1e159 100644 --- a/test/libsolidity/syntaxTests/types/var_type_suggest.sol +++ b/test/libsolidity/syntaxTests/types/var_type_suggest.sol @@ -20,11 +20,11 @@ contract C { } } // ---- -// SyntaxError: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...´ instead. -// SyntaxError: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead. -// SyntaxError: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead. -// SyntaxError: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead. -// SyntaxError: (317-350): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax. -// SyntaxError: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead. -// SyntaxError: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead. -// TypeError: (421-438): Different number of components on the left hand side (2) than on the right hand side (1). +// SyntaxError 1719: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...´ instead. +// SyntaxError 1719: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead. +// SyntaxError 1719: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead. +// SyntaxError 1719: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead. +// SyntaxError 3478: (317-350): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax. +// SyntaxError 1719: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead. +// SyntaxError 1719: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead. +// TypeError 7364: (421-438): Different number of components on the left hand side (2) than on the right hand side (1). diff --git a/test/libsolidity/syntaxTests/unicode_escape_literals.sol b/test/libsolidity/syntaxTests/unicode_escape_literals.sol index 4415d493b27a..d78e6aa09750 100644 --- a/test/libsolidity/syntaxTests/unicode_escape_literals.sol +++ b/test/libsolidity/syntaxTests/unicode_escape_literals.sol @@ -28,4 +28,4 @@ contract test { } // ---- -// ParserError: (678-681): Invalid escape sequence. +// ParserError 8936: (678-681): Invalid escape sequence. diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function.sol b/test/libsolidity/syntaxTests/unimplemented_super_function.sol index 6a11c9ca70f0..5da68a0eaa35 100644 --- a/test/libsolidity/syntaxTests/unimplemented_super_function.sol +++ b/test/libsolidity/syntaxTests/unimplemented_super_function.sol @@ -5,4 +5,4 @@ contract b is a { function f() public override { super.f(); } } // ---- -// TypeError: (110-117): Member "f" not found or not visible after argument-dependent lookup in contract super b. +// TypeError 9582: (110-117): Member "f" not found or not visible after argument-dependent lookup in contract super b. diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol index 1dcc339eb76b..f3213e72fb83 100644 --- a/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol +++ b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol @@ -9,4 +9,4 @@ contract c is a,b { function f() public override(a, b) { super.f(); } } // ---- -// TypeError: (118-125): Member "f" not found or not visible after argument-dependent lookup in contract super b. +// TypeError 9582: (118-125): Member "f" not found or not visible after argument-dependent lookup in contract super b. diff --git a/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot.sol b/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot.sol index a678f00423d2..1dbd11c145b8 100644 --- a/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot.sol +++ b/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot.sol @@ -1,4 +1,4 @@ contract c { function f() pure public { 1. // ---- -// ParserError: (47-47): Expected identifier but got end of source \ No newline at end of file +// ParserError 2314: (47-47): Expected identifier but got end of source diff --git a/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot_x.sol b/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot_x.sol index 3cc59374c759..12c20b150680 100644 --- a/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot_x.sol +++ b/test/libsolidity/syntaxTests/unterminatedBlocks/one_dot_x.sol @@ -2,4 +2,4 @@ contract test { function f() pure public { 1.x; } } // ---- -// TypeError: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 1. \ No newline at end of file +// TypeError 9582: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 1. diff --git a/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot.sol b/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot.sol index 6ba2b4c22f4f..22404b7e8a6b 100644 --- a/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot.sol +++ b/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot.sol @@ -1,4 +1,4 @@ contract c { function f() pure public { 0. // ---- -// ParserError: (47-47): Expected identifier but got end of source \ No newline at end of file +// ParserError 2314: (47-47): Expected identifier but got end of source diff --git a/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot_x.sol b/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot_x.sol index 8648bce2426e..de53fcc5d20b 100644 --- a/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot_x.sol +++ b/test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot_x.sol @@ -2,4 +2,4 @@ contract test { function f() pure public { 0.x; } } // ---- -// TypeError: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 0. \ No newline at end of file +// TypeError 9582: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 0. diff --git a/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol b/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol index d829cfc7d6c6..0376c3e13e31 100644 --- a/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol +++ b/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol @@ -12,7 +12,7 @@ contract test { // ==== // EVMVersion: >=byzantium // ---- -// Warning: (49-55): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (89-95): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. -// Warning: (122-143): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. -// Warning: (165-183): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (49-55): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (89-95): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (122-143): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (165-183): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/do_while.sol b/test/libsolidity/syntaxTests/variableDeclaration/do_while.sol index 8fc48b334fc3..3692b12f7208 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/do_while.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/do_while.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// SyntaxError: (81-87): Variable declarations can only be used inside blocks. +// SyntaxError 9079: (81-87): Variable declarations can only be used inside blocks. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/else.sol b/test/libsolidity/syntaxTests/variableDeclaration/else.sol index 914e0c0c0efc..ca9d94462060 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/else.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/else.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// SyntaxError: (109-115): Variable declarations can only be used inside blocks. +// SyntaxError 9079: (109-115): Variable declarations can only be used inside blocks. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/for.sol b/test/libsolidity/syntaxTests/variableDeclaration/for.sol index bc137f935175..75fe0eb55423 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/for.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/for.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// SyntaxError: (107-113): Variable declarations can only be used inside blocks. +// SyntaxError 9079: (107-113): Variable declarations can only be used inside blocks. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/if.sol b/test/libsolidity/syntaxTests/variableDeclaration/if.sol index 75ab20266790..6f65ae1a91f3 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/if.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/if.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// SyntaxError: (89-95): Variable declarations can only be used inside blocks. +// SyntaxError 9079: (89-95): Variable declarations can only be used inside blocks. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/while.sol b/test/libsolidity/syntaxTests/variableDeclaration/while.sol index 2997d80c82b0..e4664b3db0df 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/while.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/while.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// SyntaxError: (92-98): Variable declarations can only be used inside blocks. +// SyntaxError 9079: (92-98): Variable declarations can only be used inside blocks. diff --git a/test/libsolidity/syntaxTests/viewPure/view_pure_abi_encode_arguments.sol b/test/libsolidity/syntaxTests/viewPure/view_pure_abi_encode_arguments.sol index cc845d513999..e855006c8255 100644 --- a/test/libsolidity/syntaxTests/viewPure/view_pure_abi_encode_arguments.sol +++ b/test/libsolidity/syntaxTests/viewPure/view_pure_abi_encode_arguments.sol @@ -33,4 +33,4 @@ contract C { } } // ---- -// Warning: (1100-1184): Function state mutability can be restricted to pure +// Warning 2018: (1100-1184): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_function.sol b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_function.sol index f894f292245d..1b5a7ae503dc 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_function.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_function.sol @@ -8,4 +8,4 @@ contract B is A { } } // ---- -// TypeError: (100-105): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (100-105): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_struct.sol b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_struct.sol index 09a9f636b9e9..612fbb745b45 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_struct.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_member_struct.sol @@ -15,7 +15,7 @@ contract B is A { } } // ---- -// TypeError: (107-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (166-171): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (244-247): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (244-249): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (107-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (166-171): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (244-247): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (244-249): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_members.sol b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_members.sol index 477cee74aa26..e9dccaecdb2b 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_members.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/access_to_base_members.sol @@ -11,5 +11,5 @@ contract B is A { } } // ---- -// TypeError: (107-110): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (157-160): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (107-110): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (157-160): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_array_push_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_array_push_view.sol index c9fe1fe8eea7..3b7c19f5eef7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_array_push_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_array_push_view.sol @@ -5,4 +5,4 @@ contract A { } } // ---- -// TypeError: (88-96): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (88-96): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_base_member_array.sol b/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_base_member_array.sol index 9562c06892ac..365e07bc7d40 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_base_member_array.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/array/access_to_base_member_array.sol @@ -11,7 +11,7 @@ contract B is A { } } // ---- -// TypeError: (109-112): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (109-119): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (188-191): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (188-194): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (109-112): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (109-119): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (188-191): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (188-194): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol index 4a651d211418..858bcac446b2 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol @@ -17,5 +17,5 @@ contract C { } } // ---- -// Warning: (17-288): Function state mutability can be restricted to pure -// Warning: (293-559): Function state mutability can be restricted to pure +// Warning 2018: (17-288): Function state mutability can be restricted to pure +// Warning 2018: (293-559): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_view_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_view_fail.sol index 1cc7c8d4f35d..ffd412375da7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_view_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_view_fail.sol @@ -20,8 +20,8 @@ contract C { } } // ---- -// TypeError: (52-77): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (132-153): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (201-228): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (293-323): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (414-436): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (52-77): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (132-153): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (201-228): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (293-323): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (414-436): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/call_internal_functions_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/call_internal_functions_fail.sol index e21037bd9336..a47de539e73f 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/call_internal_functions_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/call_internal_functions_fail.sol @@ -6,5 +6,5 @@ contract C { function i() public { x = 2; } } // ---- -// TypeError: (56-59): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (130-133): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (56-59): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (130-133): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function.sol b/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function.sol index fbd2fc44a35e..1339e465a483 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning: (17-108): Function state mutability can be restricted to view +// Warning 2018: (17-108): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function_internal.sol b/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function_internal.sol index 300c1c278862..6a2b0dfd2155 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function_internal.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/callvalue_nonpayable_assembly_function_internal.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning: (17-121): Function state mutability can be restricted to view +// Warning 2018: (17-121): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/viewPureChecker/constant_restrict_warning.sol b/test/libsolidity/syntaxTests/viewPureChecker/constant_restrict_warning.sol index a4b4a353608c..89993cd931d4 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/constant_restrict_warning.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/constant_restrict_warning.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning: (42-107): Function state mutability can be restricted to pure -// Warning: (112-172): Function state mutability can be restricted to pure +// Warning 2018: (42-107): Function state mutability can be restricted to pure +// Warning 2018: (112-172): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/viewPureChecker/creation_view_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/creation_view_fail.sol index 08e45ea1ef71..643ba8b266e6 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/creation_view_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/creation_view_fail.sol @@ -3,4 +3,4 @@ contract C { function f() public view { new D(); } } // ---- -// TypeError: (58-65): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (58-65): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/function_types_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/function_types_fail.sol index d00f65c9b434..47027331fc27 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/function_types_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/function_types_fail.sol @@ -13,6 +13,6 @@ contract C { } } // ---- -// TypeError: (92-103): Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (193-202): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (289-300): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (92-103): Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (193-202): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (289-300): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol index 77dab9af27c1..a4b8af9f2041 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol @@ -18,9 +18,9 @@ contract C { } } // ---- -// Warning: (91-103): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (132-142): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (169-185): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (218-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (304-316): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (345-355): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (91-103): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (132-142): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (169-185): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (218-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (304-316): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (345-355): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol index 4a0da038ed83..c26f0dd7840a 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol @@ -16,12 +16,12 @@ contract C { } } // ---- -// Warning: (90-100): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (226-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (351-361): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// TypeError: (90-108): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (125-144): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (226-244): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (261-280): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (351-367): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (404-421): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// Warning 1621: (90-100): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (226-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (351-361): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// TypeError 8961: (90-108): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (125-144): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (226-244): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (261-280): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (351-367): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (404-421): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/immutable.sol b/test/libsolidity/syntaxTests/viewPureChecker/immutable.sol index 9028c7ccc8bc..2ef5d10235b6 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/immutable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/immutable.sol @@ -5,4 +5,4 @@ contract B { } } // ---- -// TypeError: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol index 0ff1ac241fc6..774dd44e5fd7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol @@ -11,5 +11,5 @@ contract C { } } // ---- -// TypeError: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (184-187): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (184-187): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol index 513850f77215..3c592844a1d9 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol @@ -8,5 +8,5 @@ contract C is D { function g() nonpayablem(0) view public {} } // ---- -// TypeError: (154-162): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (195-209): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 2527: (154-162): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (195-209): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier.sol b/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier.sol index 160b20a743ef..9803a04b8fd2 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier.sol @@ -3,4 +3,4 @@ contract C { function f() m(1 ether, msg.value) public pure {} } // ---- -// TypeError: (118-127): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (118-127): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier_view.sol index 8c0df6e9aa47..ad1ee3d4e0bf 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/msg_value_modifier_view.sol @@ -3,4 +3,4 @@ contract C { function f() m(1 ether, msg.value) public view {} } // ---- -// TypeError: (118-127): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error. +// TypeError 5887: (118-127): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/overriding_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/overriding_fail.sol index c8470d979e5f..6ddd708abff7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/overriding_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/overriding_fail.sol @@ -11,6 +11,6 @@ contract C2 is D { function g() public override {} } // ---- -// TypeError: (134-165): Overriding function changes state mutability from "view" to "nonpayable". -// TypeError: (170-214): Overriding function changes state mutability from "pure" to "view". -// TypeError: (240-271): Overriding function changes state mutability from "pure" to "nonpayable". +// TypeError 6959: (134-165): Overriding function changes state mutability from "view" to "nonpayable". +// TypeError 6959: (170-214): Overriding function changes state mutability from "pure" to "view". +// TypeError 6959: (240-271): Overriding function changes state mutability from "pure" to "nonpayable". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/read_storage_pure_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/read_storage_pure_fail.sol index 785656b915bc..849ac0a6291f 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/read_storage_pure_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/read_storage_pure_fail.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (86-87): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (86-87): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/returning_structs_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/returning_structs_fail.sol index e04d082544c7..6acb874d16c7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/returning_structs_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/returning_structs_fail.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (115-116): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". -// TypeError: (163-168): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (115-116): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (163-168): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/selector_complex.sol b/test/libsolidity/syntaxTests/viewPureChecker/selector_complex.sol index 311dec4a4944..c071ebadf78c 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/selector_complex.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/selector_complex.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (228-232): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (228-232): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol index 2b4821c53aa9..10ce2b99eb0a 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol @@ -11,5 +11,5 @@ contract C { // ==== // EVMVersion: >=byzantium // ---- -// Warning: (207-223): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. -// Warning: (276-286): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (207-223): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// Warning 1621: (276-286): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/suggest_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/suggest_view.sol index c045dfc4c15b..b504fdab4bb4 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/suggest_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/suggest_view.sol @@ -3,4 +3,4 @@ contract C { function g() public returns (uint) { return x; } } // ---- -// Warning: (29-77): Function state mutability can be restricted to view +// Warning 2018: (29-77): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol index 6b82f2fab2b8..1f1c48fcfd89 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol @@ -14,12 +14,12 @@ contract C { } } // ---- -// Warning: (90-102): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (230-242): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// Warning: (359-371): Using ".value(...)" is deprecated. Use "{value: ...}" instead. -// TypeError: (90-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (127-148): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (230-250): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (267-288): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (359-377): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (381-400): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// Warning 1621: (90-102): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (230-242): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// Warning 1621: (359-371): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError 8961: (90-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (127-148): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (230-250): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (267-288): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (359-377): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (381-400): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/write_storage_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/write_storage_fail.sol index 3fed4d29760c..d6828aac6800 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/write_storage_fail.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/write_storage_fail.sol @@ -3,4 +3,4 @@ contract C { function f() view public { x = 2; } } // ---- -// TypeError: (56-57): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (56-57): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol index 4fc7900febc7..75efcc964743 100644 --- a/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol +++ b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol @@ -2,4 +2,4 @@ contract C { function f() pure { } } // ---- -// SyntaxError: (17-38): No visibility specified. Did you intend to add "public"? +// SyntaxError 4937: (17-38): No visibility specified. Did you intend to add "public"? diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol index b7e96e5ec922..7800b28a876e 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol @@ -2,5 +2,5 @@ interface I { function f(); } // ---- -// SyntaxError: (15-28): No visibility specified. Did you intend to add "external"? -// TypeError: (15-28): Functions in interfaces must be declared external. +// SyntaxError 4937: (15-28): No visibility specified. Did you intend to add "external"? +// TypeError 1560: (15-28): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol index 06c1547a94d1..c666cb65f1f4 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol @@ -2,4 +2,4 @@ interface I { function f() internal; } // ---- -// TypeError: (15-37): Functions in interfaces must be declared external. +// TypeError 1560: (15-37): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol index 98198c3d1e22..0cfebdb4a815 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol @@ -2,4 +2,4 @@ interface I { function f() private; } // ---- -// TypeError: (15-36): Functions in interfaces must be declared external. +// TypeError 1560: (15-36): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol index a8cea199b35e..bf93473e3564 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol @@ -2,4 +2,4 @@ interface I { function f() public; } // ---- -// TypeError: (15-35): Functions in interfaces must be declared external. +// TypeError 1560: (15-35): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol index c0adb47c881a..04626df0f73a 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol @@ -7,6 +7,6 @@ abstract contract C { function g() {} } // ---- -// SyntaxError: (158-171): No visibility specified. Did you intend to add "external"? -// SyntaxError: (200-215): No visibility specified. Did you intend to add "public"? -// TypeError: (158-171): Functions in interfaces must be declared external. +// SyntaxError 4937: (158-171): No visibility specified. Did you intend to add "external"? +// SyntaxError 4937: (200-215): No visibility specified. Did you intend to add "public"? +// TypeError 1560: (158-171): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/library_self_delegatecall.sol b/test/libsolidity/syntaxTests/visibility/library_self_delegatecall.sol index 0f0254206ce2..bc10e1fdb7cc 100644 --- a/test/libsolidity/syntaxTests/visibility/library_self_delegatecall.sol +++ b/test/libsolidity/syntaxTests/visibility/library_self_delegatecall.sol @@ -10,4 +10,4 @@ library L2 { function g(uint) public pure returns (uint) { return 2; } } // ---- -// TypeError: (88-93): Libraries cannot call their own functions externally. +// TypeError 6700: (88-93): Libraries cannot call their own functions externally. diff --git a/test/libyul/yulSyntaxTests/assignment_fail.yul b/test/libyul/yulSyntaxTests/assignment_fail.yul index 59c18bfd3d39..1bcf3fbb3fc6 100644 --- a/test/libyul/yulSyntaxTests/assignment_fail.yul +++ b/test/libyul/yulSyntaxTests/assignment_fail.yul @@ -8,5 +8,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (51-52): Assigning a value of type "u256" to a variable of type "bool". -// TypeError: (62-63): Assigning a value of type "bool" to a variable of type "u256". +// TypeError 9547: (51-52): Assigning a value of type "u256" to a variable of type "bool". +// TypeError 9547: (62-63): Assigning a value of type "bool" to a variable of type "u256". diff --git a/test/libyul/yulSyntaxTests/for_loop_condition_fail.yul b/test/libyul/yulSyntaxTests/for_loop_condition_fail.yul index 903f5471a4fb..98a52bf2474e 100644 --- a/test/libyul/yulSyntaxTests/for_loop_condition_fail.yul +++ b/test/libyul/yulSyntaxTests/for_loop_condition_fail.yul @@ -5,4 +5,4 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (23-24): Expected a value of boolean type "bool" but got "u256" +// TypeError 1733: (23-24): Expected a value of boolean type "bool" but got "u256" diff --git a/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul b/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul index cbe266f9ffe8..ec7a162dc15a 100644 --- a/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul +++ b/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul @@ -5,4 +5,4 @@ // ==== // dialect: ewasm // ---- -// TypeError: (23-24): Expected a value of boolean type "i32" but got "i64" +// TypeError 1733: (23-24): Expected a value of boolean type "i32" but got "i64" diff --git a/test/libyul/yulSyntaxTests/invalid_type.yul b/test/libyul/yulSyntaxTests/invalid_type.yul index ec16ebf01427..99ed4c43b440 100644 --- a/test/libyul/yulSyntaxTests/invalid_type.yul +++ b/test/libyul/yulSyntaxTests/invalid_type.yul @@ -4,4 +4,4 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (10-24): "invalidType" is not a valid type (user defined types are not yet supported). +// TypeError 5473: (10-24): "invalidType" is not a valid type (user defined types are not yet supported). diff --git a/test/libyul/yulSyntaxTests/invalid_type2.yul b/test/libyul/yulSyntaxTests/invalid_type2.yul index 04593e666bf0..25320b055142 100644 --- a/test/libyul/yulSyntaxTests/invalid_type2.yul +++ b/test/libyul/yulSyntaxTests/invalid_type2.yul @@ -4,5 +4,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (15-28): "invalidType" is not a valid type (user defined types are not yet supported). -// TypeError: (10-11): Assigning value of type "invalidType" to variable of type "u256. +// TypeError 5473: (15-28): "invalidType" is not a valid type (user defined types are not yet supported). +// TypeError 3947: (10-11): Assigning value of type "invalidType" to variable of type "u256. diff --git a/test/libyul/yulSyntaxTests/invalid_type3.yul b/test/libyul/yulSyntaxTests/invalid_type3.yul index cf92ce7b89a4..1ce7092fe82d 100644 --- a/test/libyul/yulSyntaxTests/invalid_type3.yul +++ b/test/libyul/yulSyntaxTests/invalid_type3.yul @@ -4,5 +4,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (17-31): "invalidType" is not a valid type (user defined types are not yet supported). -// TypeError: (36-50): "invalidType" is not a valid type (user defined types are not yet supported). +// TypeError 5473: (17-31): "invalidType" is not a valid type (user defined types are not yet supported). +// TypeError 5473: (36-50): "invalidType" is not a valid type (user defined types are not yet supported). diff --git a/test/libyul/yulSyntaxTests/invalid_type4.yul b/test/libyul/yulSyntaxTests/invalid_type4.yul index faf217a88a57..0c588a831350 100644 --- a/test/libyul/yulSyntaxTests/invalid_type4.yul +++ b/test/libyul/yulSyntaxTests/invalid_type4.yul @@ -5,5 +5,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (24-38): Expected a value of type "u256" but got "invalidType" -// TypeError: (24-38): "invalidType" is not a valid type (user defined types are not yet supported). +// TypeError 3781: (24-38): Expected a value of type "u256" but got "invalidType" +// TypeError 5473: (24-38): "invalidType" is not a valid type (user defined types are not yet supported). diff --git a/test/libyul/yulSyntaxTests/pc.yul b/test/libyul/yulSyntaxTests/pc.yul index 04804f150f3c..15fa55a4854e 100644 --- a/test/libyul/yulSyntaxTests/pc.yul +++ b/test/libyul/yulSyntaxTests/pc.yul @@ -4,4 +4,4 @@ // ==== // dialect: evmTyped // ---- -// Warning: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release. +// Warning 2450: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release. diff --git a/test/libyul/yulSyntaxTests/type_check_cases_fail.yul b/test/libyul/yulSyntaxTests/type_check_cases_fail.yul index c799bec4b288..1b3f779d1795 100644 --- a/test/libyul/yulSyntaxTests/type_check_cases_fail.yul +++ b/test/libyul/yulSyntaxTests/type_check_cases_fail.yul @@ -6,5 +6,5 @@ // ==== // dialect: ewasm // ---- -// TypeError: (28-33): Expected a value of type "i32" but got "i64" -// TypeError: (46-51): Expected a value of type "i32" but got "i64" +// TypeError 3781: (28-33): Expected a value of type "i32" but got "i64" +// TypeError 3781: (46-51): Expected a value of type "i32" but got "i64" diff --git a/test/libyul/yulSyntaxTests/type_check_cases_fail_evmtyped.yul b/test/libyul/yulSyntaxTests/type_check_cases_fail_evmtyped.yul index c1db211f015c..458372fe9540 100644 --- a/test/libyul/yulSyntaxTests/type_check_cases_fail_evmtyped.yul +++ b/test/libyul/yulSyntaxTests/type_check_cases_fail_evmtyped.yul @@ -6,5 +6,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (24-33): Expected a value of type "u256" but got "bool" -// TypeError: (46-55): Expected a value of type "u256" but got "bool" +// TypeError 3781: (24-33): Expected a value of type "u256" but got "bool" +// TypeError 3781: (46-55): Expected a value of type "u256" but got "bool" diff --git a/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul b/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul index a79d50e342df..c8711338ff6a 100644 --- a/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul +++ b/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul @@ -5,4 +5,4 @@ // ==== // dialect: ewasm // ---- -// TypeError: (23-24): Expected a value of boolean type "i32" but got "i64" +// TypeError 1733: (23-24): Expected a value of boolean type "i32" but got "i64" diff --git a/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul b/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul index 324f937d4374..e81474613dd4 100644 --- a/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul +++ b/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul @@ -8,5 +8,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError: (126-127): Assigning value of type "bool" to variable of type "u256. -// TypeError: (129-136): Assigning value of type "u256" to variable of type "bool. +// TypeError 3947: (126-127): Assigning value of type "bool" to variable of type "u256. +// TypeError 3947: (129-136): Assigning value of type "u256" to variable of type "bool. From 1d2ae7d82aaa134ecd5627742a9e3652a6b43641 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Mon, 22 Jun 2020 16:53:03 +0200 Subject: [PATCH 267/479] Added error codes to SyntaxTest expectations (changed code) --- liblangutil/Exceptions.h | 6 +++++- test/CommonSyntaxTest.cpp | 17 ++++++++++++----- test/CommonSyntaxTest.h | 2 ++ test/libsolidity/SMTCheckerJSONTest.cpp | 1 + test/libsolidity/SyntaxTest.cpp | 2 ++ test/libyul/SyntaxTest.cpp | 1 + 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 3fbf7711acac..083a5e3cdf80 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -64,7 +64,11 @@ struct InvalidAstError: virtual util::Exception {}; * To create a new ID, one can add 0000_error and then run "python ./scripts/fix_error_ids.py" * from the root of the repo. */ -struct ErrorId { unsigned long long error = 0; }; +struct ErrorId +{ + unsigned long long error = 0; + bool operator==(ErrorId const& _rhs) const { return error == _rhs.error; } +}; constexpr ErrorId operator"" _error(unsigned long long _error) { return ErrorId{ _error }; } class Error: virtual public util::Exception diff --git a/test/CommonSyntaxTest.cpp b/test/CommonSyntaxTest.cpp index cafcc58f7816..98a74cb86921 100644 --- a/test/CommonSyntaxTest.cpp +++ b/test/CommonSyntaxTest.cpp @@ -165,8 +165,10 @@ void CommonSyntaxTest::printErrorList( { { AnsiColorized scope(_stream, _formatted, {BOLD, (error.type == "Warning") ? YELLOW : RED}); - _stream << _linePrefix; - _stream << error.type << ": "; + _stream << _linePrefix << error.type; + if (error.errorId.has_value()) + _stream << ' ' << error.errorId->error; + _stream << ": "; } if (!error.sourceName.empty() || error.locationStart >= 0 || error.locationEnd >= 0) { @@ -206,13 +208,17 @@ vector CommonSyntaxTest::parseExpectations(istream& _stream) if (it == line.end()) continue; auto typeBegin = it; - while (it != line.end() && *it != ':') + while (it != line.end() && isalpha(*it)) ++it; string errorType(typeBegin, it); - // skip colon - if (it != line.end()) it++; + skipWhitespace(it, line.end()); + + optional errorId; + if (it != line.end() && isdigit(*it)) + errorId = ErrorId{static_cast(parseUnsignedInteger(it, line.end()))}; + expect(it, line.end(), ':'); skipWhitespace(it, line.end()); int locationStart = -1; @@ -242,6 +248,7 @@ vector CommonSyntaxTest::parseExpectations(istream& _stream) string errorMessage(it, line.end()); expectations.emplace_back(SyntaxTestError{ move(errorType), + move(errorId), move(errorMessage), move(sourceName), locationStart, diff --git a/test/CommonSyntaxTest.h b/test/CommonSyntaxTest.h index e761e1487e82..df165ea1a3fc 100644 --- a/test/CommonSyntaxTest.h +++ b/test/CommonSyntaxTest.h @@ -33,6 +33,7 @@ namespace solidity::test struct SyntaxTestError { std::string type; + std::optional errorId; std::string message; std::string sourceName; int locationStart = -1; @@ -40,6 +41,7 @@ struct SyntaxTestError bool operator==(SyntaxTestError const& _rhs) const { return type == _rhs.type && + errorId == _rhs.errorId && message == _rhs.message && sourceName == _rhs.sourceName && locationStart == _rhs.locationStart && diff --git a/test/libsolidity/SMTCheckerJSONTest.cpp b/test/libsolidity/SMTCheckerJSONTest.cpp index 396ecb280b27..e1b977cf5ecc 100644 --- a/test/libsolidity/SMTCheckerJSONTest.cpp +++ b/test/libsolidity/SMTCheckerJSONTest.cpp @@ -127,6 +127,7 @@ TestCase::TestResult SMTCheckerJSONTest::run(ostream& _stream, string const& _li end -= preamble.size(); m_errorList.emplace_back(SyntaxTestError{ error["type"].asString(), + error["errorId"].isNull() ? nullopt : optional(langutil::ErrorId{error["errorId"].asUInt()}), error["message"].asString(), sourceName, static_cast(start), diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 47411748e941..48a293b65446 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -79,6 +79,7 @@ void SyntaxTest::parseAndAnalyze() { m_errorList.emplace_back(SyntaxTestError{ "UnimplementedFeatureError", + nullopt, errorMessage(_e), "", -1, @@ -106,6 +107,7 @@ void SyntaxTest::filterObtainedErrors() } m_errorList.emplace_back(SyntaxTestError{ currentError->typeName(), + currentError->errorId(), errorMessage(*currentError), sourceName, locationStart, diff --git a/test/libyul/SyntaxTest.cpp b/test/libyul/SyntaxTest.cpp index 05accb695057..944ceaf33bb7 100644 --- a/test/libyul/SyntaxTest.cpp +++ b/test/libyul/SyntaxTest.cpp @@ -66,6 +66,7 @@ void SyntaxTest::parseAndAnalyze() m_errorList.emplace_back(SyntaxTestError{ error->typeName(), + error->errorId(), errorMessage(*error), name, locationStart, From 98e5923e3aa5d4606de0ddc71916993478c5f9ae Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Jun 2020 18:10:18 +0200 Subject: [PATCH 268/479] Do now disallow assigning to external parameters. --- Changelog.md | 1 + libsolidity/ast/AST.cpp | 7 +------ .../syntaxTests/lvalues/external_reference_argument.sol | 1 - .../libsolidity/syntaxTests/structs/memory_to_calldata.sol | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 843d47ba5233..91a7fc43fa28 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Compiler Features: Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. + * Type Checker: Do not disallow assigning to calldata variables. * Yul: Fix source location of variable multi-assignment. diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3492bfc458ee..f3f79f451284 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -492,12 +492,7 @@ DeclarationAnnotation& Declaration::annotation() const bool VariableDeclaration::isLValue() const { // Constant declared variables are Read-Only - if (isConstant()) - return false; - // External function arguments of reference type are Read-Only - if (isExternalCallableParameter() && dynamic_cast(type())) - return false; - return true; + return !isConstant(); } bool VariableDeclaration::isLocalVariable() const diff --git a/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol b/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol index ed638781c275..67378653ba3f 100644 --- a/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol +++ b/test/libsolidity/syntaxTests/lvalues/external_reference_argument.sol @@ -4,4 +4,3 @@ contract C { } } // ---- -// TypeError 7128: (96-97): External function arguments of reference type are read-only. diff --git a/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol b/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol index d6b2aed6a4f2..19747e9a538a 100644 --- a/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol +++ b/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol @@ -5,7 +5,5 @@ contract Test { function g(S calldata s) external { S memory m; s = m; } } // ---- -// TypeError 7128: (114-115): External function arguments of reference type are read-only. // TypeError 7407: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. -// TypeError 7128: (178-179): External function arguments of reference type are read-only. // TypeError 7407: (182-183): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. From d67734df6f7ddadb7b602c7d0b9a4247750dc1cb Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Jun 2020 18:43:57 +0200 Subject: [PATCH 269/479] Fix error IDs. --- .../smtCheckerTests/special/many.sol | 18 +++++++++--------- .../types/function_type_members.sol | 2 +- .../functionCalls/calloptions_repeated.sol | 12 ++++++------ ...call_value_on_non_payable_function_type.sol | 2 +- .../error_deprecate_gas_function.sol | 2 +- .../error_deprecate_value_constructor.sol | 2 +- .../error_deprecate_value_function.sol | 2 +- .../globalFunctions/now_deprecate.sol | 2 +- .../globalFunctions/now_override.sol | 2 +- .../inheritance/virtual/library_err.sol | 2 +- .../syntaxTests/inlineAssembly/pc.sol | 2 +- .../missing_functions_duplicate_bug.sol | 2 +- .../333_fixed_point_casting_exponents_15.sol | 2 +- .../334_fixed_point_casting_exponents_neg.sol | 2 +- .../348_unused_return_value_call_value.sol | 2 +- .../363_non_payable_constructor.sol | 2 +- .../docstring_author_title_state_variable.sol | 4 ++-- ...g_non_public_state_variable_with_return.sol | 2 +- .../docstring_private_state_variable.sol | 2 +- .../syntaxTests/natspec/docstring_variable.sol | 2 +- .../syntaxTests/shifts/shift_singed_rvalue.sol | 4 ++-- .../syntaxTests/signed_rational_modulus.sol | 2 +- .../gas_with_call_nonpayable.sol | 4 ++-- .../value_with_call_nonpayable.sol | 4 ++-- test/libyul/yulSyntaxTests/pc.yul | 2 +- 25 files changed, 42 insertions(+), 42 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol index 535615a6cf85..9e40708f01ab 100644 --- a/test/libsolidity/smtCheckerTests/special/many.sol +++ b/test/libsolidity/smtCheckerTests/special/many.sol @@ -15,12 +15,12 @@ contract C } } // ---- -// Warning: (79-115): Assertion violation happens here -// Warning: (119-161): Assertion violation happens here -// Warning: (165-204): Assertion violation happens here -// Warning: (208-240): Assertion violation happens here -// Warning: (244-275): Assertion violation happens here -// Warning: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning: (304-332): Assertion violation happens here -// Warning: (336-364): Assertion violation happens here -// Warning: (368-391): Assertion violation happens here +// Warning 4661: (79-115): Assertion violation happens here +// Warning 4661: (119-161): Assertion violation happens here +// Warning 4661: (165-204): Assertion violation happens here +// Warning 4661: (208-240): Assertion violation happens here +// Warning 4661: (244-275): Assertion violation happens here +// Warning 2661: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (304-332): Assertion violation happens here +// Warning 4661: (336-364): Assertion violation happens here +// Warning 4661: (368-391): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/function_type_members.sol b/test/libsolidity/smtCheckerTests/types/function_type_members.sol index 4b116503c91f..7b9a0f44da0c 100644 --- a/test/libsolidity/smtCheckerTests/types/function_type_members.sol +++ b/test/libsolidity/smtCheckerTests/types/function_type_members.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// Warning: (108-118): Assertion checker does not yet support this expression. +// Warning 7650: (108-118): Assertion checker does not yet support this expression. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol index 460c2c51cca6..8185304d1521 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol @@ -11,9 +11,9 @@ contract C { // ==== // EVMVersion: >=constantinople // ---- -// TypeError: (78-110): Option "gas" has already been set. -// TypeError: (120-154): Option "gas" has already been set. -// TypeError: (164-198): Option "value" has already been set. -// TypeError: (208-249): Option "value" has already been set. -// TypeError: (208-249): Option "gas" has already been set. -// TypeError: (259-286): Option "salt" has already been set. +// TypeError 9886: (78-110): Option "gas" has already been set. +// TypeError 9886: (120-154): Option "gas" has already been set. +// TypeError 9886: (164-198): Option "value" has already been set. +// TypeError 9886: (208-249): Option "value" has already been set. +// TypeError 9886: (208-249): Option "gas" has already been set. +// TypeError 9886: (259-286): Option "salt" has already been set. diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol index 05ef696fb398..ea88bac312a5 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (94-105): Cannot set option "value" on a non-payable function type. +// TypeError 7006: (94-105): Cannot set option "value" on a non-payable function type. diff --git a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol index 6b49c2463ebf..1141d532df74 100644 --- a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_gas_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. +// TypeError 1621: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol index 49a8a1a60e78..f74d61f39c70 100644 --- a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor.sol @@ -8,4 +8,4 @@ contract D { } } // ---- -// TypeError: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError 1621: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol index bc856e70af27..44c4fd905dd7 100644 --- a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_function.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. +// TypeError 1621: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead. diff --git a/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol b/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol index 5864b224ee7b..d6d9b8e9f7d0 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/now_deprecate.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (38-41): "now" has been deprecated. Use "block.timestamp" instead. +// TypeError 7359: (38-41): "now" has been deprecated. Use "block.timestamp" instead. diff --git a/test/libsolidity/syntaxTests/globalFunctions/now_override.sol b/test/libsolidity/syntaxTests/globalFunctions/now_override.sol index c3db19f45b1c..08d648f7814a 100644 --- a/test/libsolidity/syntaxTests/globalFunctions/now_override.sol +++ b/test/libsolidity/syntaxTests/globalFunctions/now_override.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (43-51): This declaration shadows a builtin symbol. +// Warning 2319: (43-51): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol b/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol index 627be82ffbd6..7c2e1bbce9c4 100644 --- a/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol +++ b/test/libsolidity/syntaxTests/inheritance/virtual/library_err.sol @@ -2,4 +2,4 @@ library L { function f() internal pure virtual returns (uint) { return 0; } } // ---- -// TypeError: (16-79): Library functions cannot be "virtual". +// TypeError 7801: (16-79): Library functions cannot be "virtual". diff --git a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol index a3d4c31b158c..816bb1c0d5f4 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/pc.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// SyntaxError: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. +// SyntaxError 2450: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. diff --git a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol index afc2b82d4326..56c3eee40228 100644 --- a/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol +++ b/test/libsolidity/syntaxTests/missing_functions_duplicate_bug.sol @@ -23,4 +23,4 @@ contract Voting is Ownable { } } // ---- -// Warning: (299-315): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 5667: (299-315): Unused function parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol index 91454ff24ec0..f988745ea48d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18. Exponent is fractional. +// TypeError 2271: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18. Exponent is fractional. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol index 57dc845f401c..68e80e6352f2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18. Exponent is fractional. +// TypeError 2271: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18. Exponent is fractional. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol index 15da6802ff00..e837a6e66d88 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/348_unused_return_value_call_value.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// Warning: (50-85): Return value of low-level calls not used. +// Warning 9302: (50-85): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol index 850e9d69095c..e3101fc8d5c7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol @@ -8,4 +8,4 @@ contract D { } } // ---- -// TypeError: (106-123): Cannot set option "value", since the constructor of contract C is not payable. +// TypeError 7006: (106-123): Cannot set option "value", since the constructor of contract C is not payable. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol index d7e52608c375..e861d31ce75e 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_title_state_variable.sol @@ -4,5 +4,5 @@ contract C { uint private state; } // ---- -// DocstringParsingError: (17-56): Documentation tag @author not valid for non-public state variables. -// DocstringParsingError: (17-56): Documentation tag @title not valid for non-public state variables. +// DocstringParsingError 6546: (17-56): Documentation tag @author not valid for non-public state variables. +// DocstringParsingError 6546: (17-56): Documentation tag @title not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol index d8f70ebd87db..da2d75fe87db 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_non_public_state_variable_with_return.sol @@ -3,4 +3,4 @@ contract test { uint private state; } // ---- -// DocstringParsingError: (18-47): Documentation tag @return not valid for non-public state variables. +// DocstringParsingError 6546: (18-47): Documentation tag @return not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol index dbc5c9a0b77c..5486694425be 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_private_state_variable.sol @@ -4,4 +4,4 @@ contract C { uint private state; } // ---- -// DocstringParsingError: (17-74): Documentation tag @notice not valid for non-public state variables. +// DocstringParsingError 6546: (17-74): Documentation tag @notice not valid for non-public state variables. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol index f1becfb5eb6c..a126ca940f5f 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_variable.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_variable.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// ParserError: (290-295): Only state variables can have a docstring. +// ParserError 2837: (290-295): Only state variables can have a docstring. diff --git a/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol b/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol index 73b49f3df354..adca80cc4a73 100644 --- a/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol +++ b/test/libsolidity/syntaxTests/shifts/shift_singed_rvalue.sol @@ -7,5 +7,5 @@ contract C { } } // ---- -// TypeError: (89-95): Operator >> not compatible with types int256 and int256 -// TypeError: (179-193): Operator >> not compatible with types int256 and int256 +// TypeError 2271: (89-95): Operator >> not compatible with types int256 and int256 +// TypeError 2271: (179-193): Operator >> not compatible with types int256 and int256 diff --git a/test/libsolidity/syntaxTests/signed_rational_modulus.sol b/test/libsolidity/syntaxTests/signed_rational_modulus.sol index f7f5cf138ffa..999086ae12c1 100644 --- a/test/libsolidity/syntaxTests/signed_rational_modulus.sol +++ b/test/libsolidity/syntaxTests/signed_rational_modulus.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError: (117-123): Operator % not compatible with types rational_const 1 / 2 and fixed128x18. Fractional literals not supported. +// TypeError 2271: (117-123): Operator % not compatible with types rational_const 1 / 2 and fixed128x18. Fractional literals not supported. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol index d302ad454d26..be8a5aeb89aa 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (90-109): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (180-197): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (90-109): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (180-197): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol index 3b39c95eae29..af95cbe49ee9 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// TypeError: (90-111): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. -// TypeError: (182-201): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (90-111): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. +// TypeError 8961: (182-201): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable. diff --git a/test/libyul/yulSyntaxTests/pc.yul b/test/libyul/yulSyntaxTests/pc.yul index e818e926bc9a..e43d7a141b1c 100644 --- a/test/libyul/yulSyntaxTests/pc.yul +++ b/test/libyul/yulSyntaxTests/pc.yul @@ -4,4 +4,4 @@ // ==== // dialect: evmTyped // ---- -// SyntaxError: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. +// SyntaxError 2450: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly. From 25ebff3a38e1b82c939a0f8fa4e940f335c9b2ba Mon Sep 17 00:00:00 2001 From: a3d4 Date: Wed, 17 Jun 2020 04:58:15 +0200 Subject: [PATCH 270/479] Fix pragma solidity version in antlr grammar --- docs/Solidity.g4 | 17 +---------------- .../syntaxTests/pragma/version_check.sol | 7 +++++++ 2 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 test/libsolidity/syntaxTests/pragma/version_check.sol diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index fdc80822bddd..65fee05fa7f6 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -11,23 +11,11 @@ sourceUnit : (pragmaDirective | importDirective | structDefinition | enumDefinition | contractDefinition)* EOF ; pragmaDirective - : 'pragma' pragmaName pragmaValue ';' ; + : 'pragma' pragmaName ( ~';' )* ';' ; pragmaName : identifier ; -pragmaValue - : version | expression ; - -version - : versionConstraint versionConstraint? ; - -versionConstraint - : versionOperator? VersionLiteral ; - -versionOperator - : '^' | '~' | '>=' | '>' | '<' | '<=' | '=' ; - importDirective : 'import' StringLiteralFragment ('as' identifier)? ';' | 'import' ('*' | identifier) ('as' identifier)? 'from' StringLiteralFragment ';' @@ -473,9 +461,6 @@ fragment SingleQuotedStringCharacter : ~['\r\n\\] | ('\\' .) ; -VersionLiteral - : [0-9]+ ( '.' [0-9]+ ('.' [0-9]+)? )? ; - WS : [ \t\r\n\u000C]+ -> skip ; diff --git a/test/libsolidity/syntaxTests/pragma/version_check.sol b/test/libsolidity/syntaxTests/pragma/version_check.sol new file mode 100644 index 000000000000..45b98d9eed07 --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/version_check.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity < 142857; +pragma solidity >= 0.0; +pragma solidity >= 0.0.0; + +contract C { +} From 86be0fbc2fa242bc56302984675b3bec4b18fc07 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 16 Jun 2020 21:23:26 -0500 Subject: [PATCH 271/479] [ewasm] Fix infinite loops. --- Changelog.md | 1 + libyul/backends/wasm/WasmCodeTransform.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 91a7fc43fa28..9328f282401f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. * Type Checker: Do not disallow assigning to calldata variables. + * Wasm backend: Fix code generation for for-loops with pre statements. * Yul: Fix source location of variable multi-assignment. diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index d2bceaa90bbb..5171db1b1331 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -257,9 +257,10 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) YulString eqz_instruction = YulString(conditionType.str() + ".eqz"); yulAssert(WasmDialect::instance().builtin(eqz_instruction), ""); + std::vector statements = visit(_for.pre.statements); + wasm::Loop loop; loop.labelName = newLabel(); - loop.statements = visit(_for.pre.statements); loop.statements.emplace_back(wasm::BranchIf{wasm::Label{breakLabel}, make_unique( wasm::BuiltinCall{eqz_instruction.str(), make_vector( visitReturnByValue(*_for.condition) @@ -269,7 +270,8 @@ wasm::Expression WasmCodeTransform::operator()(ForLoop const& _for) loop.statements += visit(_for.post.statements); loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}}); - return { wasm::Block{breakLabel, make_vector(move(loop))} }; + statements += make_vector(move(loop)); + return wasm::Block{breakLabel, move(statements)}; } wasm::Expression WasmCodeTransform::operator()(Break const&) From 0397266351e90531fe67f69d69253265d55d321a Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Thu, 18 Jun 2020 12:31:55 +0200 Subject: [PATCH 272/479] Implement multi source semantic tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chriseth Co-authored-by: Kamil Śliwak --- test/CommonSyntaxTest.cpp | 15 +++--- test/ExecutionFramework.h | 19 ++++--- test/TestCaseReader.cpp | 11 ++-- test/TestCaseReader.h | 22 +++++--- test/libsolidity/ABIEncoderTests.cpp | 2 +- test/libsolidity/SemanticTest.cpp | 53 +++++++++++++++---- test/libsolidity/SemanticTest.h | 3 +- test/libsolidity/SolidityEndToEndTest.cpp | 4 +- .../SolidityExecutionFramework.cpp | 43 +++++++++++---- test/libsolidity/SolidityExecutionFramework.h | 21 +++++--- .../semanticTests/multiSource/import.sol | 12 +++++ test/tools/isoltest.cpp | 4 -- 12 files changed, 146 insertions(+), 63 deletions(-) create mode 100644 test/libsolidity/semanticTests/multiSource/import.sol diff --git a/test/CommonSyntaxTest.cpp b/test/CommonSyntaxTest.cpp index 98a74cb86921..ff99d6e24a62 100644 --- a/test/CommonSyntaxTest.cpp +++ b/test/CommonSyntaxTest.cpp @@ -58,10 +58,10 @@ int parseUnsignedInteger(string::iterator& _it, string::iterator _end) CommonSyntaxTest::CommonSyntaxTest(string const& _filename, langutil::EVMVersion _evmVersion): EVMVersionRestrictedTestCase(_filename), + m_sources(m_reader.sources().sources), + m_expectations(parseExpectations(m_reader.stream())), m_evmVersion(_evmVersion) { - m_sources = m_reader.sources(); - m_expectations = parseExpectations(m_reader.stream()); } TestCase::TestResult CommonSyntaxTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) @@ -94,12 +94,10 @@ void CommonSyntaxTest::printSource(ostream& _stream, string const& _linePrefix, if (m_sources.empty()) return; - bool outputSourceNames = true; - if (m_sources.size() == 1 && m_sources.begin()->first.empty()) - outputSourceNames = false; + bool outputSourceNames = (m_sources.size() != 1 || !m_sources.begin()->first.empty()); - if (_formatted) - for (auto const& [name, source]: m_sources) + for (auto const& [name, source]: m_sources) + if (_formatted) { if (source.empty()) continue; @@ -139,8 +137,7 @@ void CommonSyntaxTest::printSource(ostream& _stream, string const& _linePrefix, } _stream << formatting::RESET; } - else - for (auto const& [name, source]: m_sources) + else { if (outputSourceNames) _stream << _linePrefix << "==== Source: " + name << " ====" << endl; diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index e55a12aa6528..72a07ce3e24b 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -61,22 +61,28 @@ class ExecutionFramework virtual ~ExecutionFramework() = default; virtual bytes const& compileAndRunWithoutCheck( - std::string const& _sourceCode, + std::map const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "", - bytes const& _arguments = bytes(), - std::map const& _libraryAddresses = std::map() + bytes const& _arguments = {}, + std::map const& _libraryAddresses = {} ) = 0; bytes const& compileAndRun( std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "", - bytes const& _arguments = bytes(), - std::map const& _libraryAddresses = std::map() + bytes const& _arguments = {}, + std::map const& _libraryAddresses = {} ) { - compileAndRunWithoutCheck(_sourceCode, _value, _contractName, _arguments, _libraryAddresses); + compileAndRunWithoutCheck( + {{"", _sourceCode}}, + _value, + _contractName, + _arguments, + _libraryAddresses + ); BOOST_REQUIRE(m_transactionSuccessful); BOOST_REQUIRE(!m_output.empty()); return m_output; @@ -293,4 +299,3 @@ class ExecutionFramework } // end namespaces - diff --git a/test/TestCaseReader.cpp b/test/TestCaseReader.cpp index 0f49a640181b..2f90678ed56e 100644 --- a/test/TestCaseReader.cpp +++ b/test/TestCaseReader.cpp @@ -37,11 +37,11 @@ TestCaseReader::TestCaseReader(string const& _filename): m_unreadSettings = m_settings; } -string const& TestCaseReader::source() +string const& TestCaseReader::source() const { - if (m_sources.size() != 1) + if (m_sources.sources.size() != 1) BOOST_THROW_EXCEPTION(runtime_error("Expected single source definition, but got multiple sources.")); - return m_sources.begin()->second; + return m_sources.sources.at(m_sources.mainSourceFile); } string TestCaseReader::simpleExpectations() @@ -93,7 +93,7 @@ void TestCaseReader::ensureAllSettingsRead() const ); } -pair, size_t> TestCaseReader::parseSourcesAndSettingsWithLineNumber(istream& _stream) +pair TestCaseReader::parseSourcesAndSettingsWithLineNumber(istream& _stream) { map sources; string currentSourceName; @@ -145,8 +145,9 @@ pair, size_t> TestCaseReader::parseSourcesAndSettingsWithLin else throw runtime_error(string("Expected \"//\" or \"// ---\" to terminate settings and source.")); } + // Register the last source as the main one sources[currentSourceName] = currentSource; - return { sources, lineNumber }; + return {{move(sources), move(currentSourceName)}, lineNumber}; } string TestCaseReader::parseSimpleExpectations(istream& _file) diff --git a/test/TestCaseReader.h b/test/TestCaseReader.h index 5ab2268261d0..9f94f898d642 100644 --- a/test/TestCaseReader.h +++ b/test/TestCaseReader.h @@ -23,6 +23,16 @@ namespace solidity::frontend::test { + +/** + * A map for registering source names that also contains the main source name in a test case. + */ +struct SourceMap +{ + std::map sources; + std::string mainSourceFile; +}; + /** * A reader for test case data file, which parses source, settings and (optionally) simple expectations. */ @@ -32,10 +42,10 @@ class TestCaseReader TestCaseReader() = default; explicit TestCaseReader(std::string const& _filename); - std::map const& sources() { return m_sources; } - std::string const& source(); - std::size_t lineNumber() { return m_lineNumber; } - std::map const& settings() { return m_settings; } + SourceMap const& sources() const { return m_sources; } + std::string const& source() const; + std::size_t lineNumber() const { return m_lineNumber; } + std::map const& settings() const { return m_settings; } std::ifstream& stream() { return m_file; } std::string simpleExpectations(); @@ -47,11 +57,11 @@ class TestCaseReader void ensureAllSettingsRead() const; private: - std::pair, std::size_t> parseSourcesAndSettingsWithLineNumber(std::istream& _file); + std::pair parseSourcesAndSettingsWithLineNumber(std::istream& _file); static std::string parseSimpleExpectations(std::istream& _file); std::ifstream m_file; - std::map m_sources; + SourceMap m_sources; std::size_t m_lineNumber = 0; std::map m_settings; std::map m_unreadSettings; ///< tracks which settings are left unread diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index 2e50fe743549..777f991a340c 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -777,7 +777,7 @@ BOOST_AUTO_TEST_CASE(struct_in_constructor_data_short) NEW_ENCODER( BOOST_CHECK( - compileAndRunWithoutCheck(sourceCode, 0, "C", encodeArgs(0x20, 0x60, 0x03, 0x80, 0x00)).empty() + compileAndRunWithoutCheck({{"", sourceCode}}, 0, "C", encodeArgs(0x20, 0x60, 0x03, 0x80, 0x00)).empty() ); ) } diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 39744fa59a26..e3b40f1e4695 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -42,11 +42,10 @@ namespace fs = boost::filesystem; SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVersion, bool enforceViaYul): SolidityExecutionFramework(_evmVersion), EVMVersionRestrictedTestCase(_filename), + m_sources(m_reader.sources()), + m_lineOffset(m_reader.lineNumber()), m_enforceViaYul(enforceViaYul) { - m_source = m_reader.source(); - m_lineOffset = m_reader.lineNumber(); - string choice = m_reader.stringSetting("compileViaYul", "false"); if (choice == "also") { @@ -239,12 +238,48 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref return TestResult::Success; } -void SemanticTest::printSource(ostream& _stream, string const& _linePrefix, bool) const +void SemanticTest::printSource(ostream& _stream, string const& _linePrefix, bool _formatted) const { - stringstream stream(m_source); - string line; - while (getline(stream, line)) - _stream << _linePrefix << line << endl; + if (m_sources.sources.empty()) + return; + + bool outputNames = (m_sources.sources.size() != 1 || !m_sources.sources.begin()->first.empty()); + + for (auto const& [name, source]: m_sources.sources) + if (_formatted) + { + if (source.empty()) + continue; + + if (outputNames) + _stream << _linePrefix << formatting::CYAN << "==== Source: " << name << " ====" << formatting::RESET << endl; + vector sourceFormatting(source.length(), formatting::RESET); + + _stream << _linePrefix << sourceFormatting.front() << source.front(); + for (size_t i = 1; i < source.length(); i++) + { + if (sourceFormatting[i] != sourceFormatting[i - 1]) + _stream << sourceFormatting[i]; + if (source[i] != '\n') + _stream << source[i]; + else + { + _stream << formatting::RESET << endl; + if (i + 1 < source.length()) + _stream << _linePrefix << sourceFormatting[i]; + } + } + _stream << formatting::RESET; + } + else + { + if (outputNames) + _stream << _linePrefix << "==== Source: " + name << " ====" << endl; + stringstream stream(source); + string line; + while (getline(stream, line)) + _stream << _linePrefix << line << endl; + } } void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) const @@ -276,6 +311,6 @@ void SemanticTest::parseExpectations(istream& _stream) bool SemanticTest::deploy(string const& _contractName, u256 const& _value, bytes const& _arguments, map const& _libraries) { - auto output = compileAndRunWithoutCheck(m_source, _value, _contractName, _arguments, _libraries); + auto output = compileAndRunWithoutCheck(m_sources.sources, _value, _contractName, _arguments, _libraries); return !output.empty() && m_transactionSuccessful; } diff --git a/test/libsolidity/SemanticTest.h b/test/libsolidity/SemanticTest.h index 870d61d568e2..646e7e00ba32 100644 --- a/test/libsolidity/SemanticTest.h +++ b/test/libsolidity/SemanticTest.h @@ -58,9 +58,8 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict /// Compiles and deploys currently held source. /// Returns true if deployment was successful, false otherwise. bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map const& _libraries = {}); - private: - std::string m_source; + SourceMap m_sources; std::size_t m_lineOffset; std::vector m_tests; bool m_runWithYul = false; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 83e7ef95da2c..d449cd27e321 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1746,7 +1746,7 @@ BOOST_AUTO_TEST_CASE(internal_constructor) constructor() internal {} } )"; - BOOST_CHECK(compileAndRunWithoutCheck(sourceCode, 0, "C").empty()); + BOOST_CHECK(compileAndRunWithoutCheck({{"", sourceCode}}, 0, "C").empty()); } BOOST_AUTO_TEST_CASE(default_fallback_throws) @@ -3641,7 +3641,7 @@ BOOST_AUTO_TEST_CASE(evm_exceptions_in_constructor_out_of_baund) } } )"; - ABI_CHECK(compileAndRunWithoutCheck(sourceCode, 0, "A"), encodeArgs()); + ABI_CHECK(compileAndRunWithoutCheck({{"", sourceCode}}, 0, "A"), encodeArgs()); BOOST_CHECK(!m_transactionSuccessful); } diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 5e4ebe088b22..29b3b8b4390d 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -31,22 +31,18 @@ using namespace solidity::frontend; using namespace solidity::frontend::test; using namespace std; -bytes SolidityExecutionFramework::compileContract( - string const& _sourceCode, +bytes SolidityExecutionFramework::multiSourceCompileContract( + map const& _sourceCode, string const& _contractName, map const& _libraryAddresses ) { - // Silence compiler version warning - std::string sourceCode = "pragma solidity >=0.0;\n"; - if ( - solidity::test::CommonOptions::get().useABIEncoderV2 && - _sourceCode.find("pragma experimental ABIEncoderV2;") == std::string::npos - ) - sourceCode += "pragma experimental ABIEncoderV2;\n"; - sourceCode += _sourceCode; + map sourcesWithPreamble = _sourceCode; + for (auto& entry: sourcesWithPreamble) + entry.second = addPreamble(entry.second); + m_compiler.reset(); - m_compiler.setSources({{"", sourceCode}}); + m_compiler.setSources(sourcesWithPreamble); m_compiler.setLibraries(_libraryAddresses); m_compiler.setRevertStringBehaviour(m_revertStrings); m_compiler.setEVMVersion(m_evmVersion); @@ -85,3 +81,28 @@ bytes SolidityExecutionFramework::compileContract( cout << "metadata: " << m_compiler.metadata(contractName) << endl; return obj.bytecode; } + +bytes SolidityExecutionFramework::compileContract( + string const& _sourceCode, + string const& _contractName, + map const& _libraryAddresses +) +{ + return multiSourceCompileContract( + {{"", _sourceCode}}, + _contractName, + _libraryAddresses + ); +} + +string SolidityExecutionFramework::addPreamble(string const& _sourceCode) +{ + // Silence compiler version warning + string preamble = "pragma solidity >=0.0;\n"; + if ( + solidity::test::CommonOptions::get().useABIEncoderV2 && + _sourceCode.find("pragma experimental ABIEncoderV2;") == string::npos + ) + preamble += "pragma experimental ABIEncoderV2;\n"; + return preamble + _sourceCode; +} diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 2410195fabb3..5be310c87760 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -47,14 +47,14 @@ class SolidityExecutionFramework: public solidity::test::ExecutionFramework {} bytes const& compileAndRunWithoutCheck( - std::string const& _sourceCode, + std::map const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "", - bytes const& _arguments = bytes(), - std::map const& _libraryAddresses = std::map() + bytes const& _arguments = {}, + std::map const& _libraryAddresses = {} ) override { - bytes bytecode = compileContract(_sourceCode, _contractName, _libraryAddresses); + bytes bytecode = multiSourceCompileContract(_sourceCode, _contractName, _libraryAddresses); sendMessage(bytecode + _arguments, true, _value); return m_output; } @@ -62,16 +62,23 @@ class SolidityExecutionFramework: public solidity::test::ExecutionFramework bytes compileContract( std::string const& _sourceCode, std::string const& _contractName = "", - std::map const& _libraryAddresses = std::map() + std::map const& _libraryAddresses = {} + ); + + bytes multiSourceCompileContract( + std::map const& _sources, + std::string const& _contractName = "", + std::map const& _libraryAddresses = {} ); + /// Returns @param _sourceCode prefixed with the version pragma and the ABIEncoderV2 pragma, + /// the latter only if it is required. + static std::string addPreamble(std::string const& _sourceCode); protected: solidity::frontend::CompilerStack m_compiler; bool m_compileViaYul = false; bool m_showMetadata = false; RevertStrings m_revertStrings = RevertStrings::Default; - }; } // end namespaces - diff --git a/test/libsolidity/semanticTests/multiSource/import.sol b/test/libsolidity/semanticTests/multiSource/import.sol new file mode 100644 index 000000000000..2a0f43d53978 --- /dev/null +++ b/test/libsolidity/semanticTests/multiSource/import.sol @@ -0,0 +1,12 @@ +==== Source: A ==== +contract A { + function g(uint256 x) public view returns(uint256) { return x + 1; } +} +==== Source: B ==== +import "A"; +contract B is A { + function f(uint256 x) public view returns(uint256) { return x; } +} +// ---- +// f(uint256): 1337 -> 1337 +// g(uint256): 1337 -> 1338 diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 846a544151f3..07802edf12f9 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -21,17 +21,13 @@ #include #include #include -#include #include #include -#include #include #include -#include #include -#include #include #include #include From 1b09b4f9507264bb2a2605484a873bfabfee1bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 19 Jun 2020 13:39:01 +0200 Subject: [PATCH 273/479] Allow Yul literals longer than 32-bytes when used as literal arguments for builtins --- docs/yul.rst | 4 ++++ libyul/AsmAnalysis.cpp | 17 +++++++++++++++-- libyul/AsmAnalysis.h | 1 + .../syntaxTests/immutable/long_name.sol | 4 ++++ ...le_long_name_does_not_end_up_in_bytecode.yul | 17 +++++++++++++++++ .../yulSyntaxTests/byte_of_string_literal.yul | 6 ++++++ test/libyul/yulSyntaxTests/loadimmutable.yul | 6 ++++++ ...h_literal_argument_into_literal_argument.yul | 7 +++++++ test/libyul/yulSyntaxTests/setimmutable.yul | 6 ++++++ .../yulSyntaxTests/string_literal_too_long.yul | 7 +++++++ .../string_literal_too_long_byte.yul | 7 +++++++ .../string_literal_too_long_immutable.yul | 9 +++++++++ 12 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/syntaxTests/immutable/long_name.sol create mode 100644 test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul create mode 100644 test/libyul/yulSyntaxTests/byte_of_string_literal.yul create mode 100644 test/libyul/yulSyntaxTests/loadimmutable.yul create mode 100644 test/libyul/yulSyntaxTests/passing_builtin_with_literal_argument_into_literal_argument.yul create mode 100644 test/libyul/yulSyntaxTests/setimmutable.yul create mode 100644 test/libyul/yulSyntaxTests/string_literal_too_long.yul create mode 100644 test/libyul/yulSyntaxTests/string_literal_too_long_byte.yul create mode 100644 test/libyul/yulSyntaxTests/string_literal_too_long_immutable.yul diff --git a/docs/yul.rst b/docs/yul.rst index b928bf85e0ec..473496e16540 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -180,7 +180,11 @@ appropriate ``PUSHi`` instruction. In the following example, ``3`` and ``2`` are added resulting in 5 and then the bitwise ``and`` with the string "abc" is computed. The final value is assigned to a local variable called ``x``. + Strings are stored left-aligned and cannot be longer than 32 bytes. +The limit does not apply to string literals passed to builtin functions that require +literal arguments (e.g. ``setimmutable`` or ``loadimmutable``). Those strings never end up in the +generated bytecode. .. code-block:: yul diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index eeb80263ee90..3c639f3d1154 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -301,10 +301,15 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) for (size_t i = _funCall.arguments.size(); i > 0; i--) { Expression const& arg = _funCall.arguments[i - 1]; + bool isLiteralArgument = needsLiteralArguments && (*needsLiteralArguments)[i - 1]; + bool isStringLiteral = holds_alternative(arg) && get(arg).kind == LiteralKind::String; - argTypes.emplace_back(expectExpression(arg)); + if (isLiteralArgument && isStringLiteral) + argTypes.emplace_back(expectUnlimitedStringLiteral(get(arg))); + else + argTypes.emplace_back(expectExpression(arg)); - if (needsLiteralArguments && (*needsLiteralArguments)[i - 1]) + if (isLiteralArgument) { if (!holds_alternative(arg)) m_errorReporter.typeError( @@ -433,6 +438,14 @@ YulString AsmAnalyzer::expectExpression(Expression const& _expr) return types.empty() ? m_dialect.defaultType : types.front(); } +YulString AsmAnalyzer::expectUnlimitedStringLiteral(Literal const& _literal) +{ + yulAssert(_literal.kind == LiteralKind::String, ""); + yulAssert(m_dialect.validTypeForLiteral(LiteralKind::String, _literal.value, _literal.type), ""); + + return {_literal.type}; +} + void AsmAnalyzer::expectBoolExpression(Expression const& _expr) { YulString type = expectExpression(_expr); diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 3804476ae2be..29bfca2fd30c 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -97,6 +97,7 @@ class AsmAnalyzer /// Visits the expression, expects that it evaluates to exactly one value and /// returns the type. Reports errors on errors and returns the default type. YulString expectExpression(Expression const& _expr); + YulString expectUnlimitedStringLiteral(Literal const& _literal); /// Vists the expression and expects it to return a single boolean value. /// Reports an error otherwise. void expectBoolExpression(Expression const& _expr); diff --git a/test/libsolidity/syntaxTests/immutable/long_name.sol b/test/libsolidity/syntaxTests/immutable/long_name.sol new file mode 100644 index 000000000000..914cc2ead4f0 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/long_name.sol @@ -0,0 +1,4 @@ +contract C { + uint immutable long___name___that___definitely___exceeds___the___thirty___two___byte___limit = 0; +} +// ---- diff --git a/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul b/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul new file mode 100644 index 000000000000..b7058289b519 --- /dev/null +++ b/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul @@ -0,0 +1,17 @@ +object "a" { + code { + setimmutable( + "long___name___that___definitely___exceeds___the___thirty___two___byte___limit", + 0x1234567890123456789012345678901234567890 + ) + } +} +// ---- +// Assembly: +// /* "source":152:194 */ +// 0x1234567890123456789012345678901234567890 +// /* "source":32:204 */ +// assignImmutable("0x85a5b1db611c82c46f5fa18e39ae218397536256c451e5de155a86de843a9ad6") +// Bytecode: 73123456789012345678901234567890123456789050 +// Opcodes: PUSH20 0x1234567890123456789012345678901234567890 POP +// SourceMappings: 152:42:0:-:0;32:172 diff --git a/test/libyul/yulSyntaxTests/byte_of_string_literal.yul b/test/libyul/yulSyntaxTests/byte_of_string_literal.yul new file mode 100644 index 000000000000..9ed41172abe9 --- /dev/null +++ b/test/libyul/yulSyntaxTests/byte_of_string_literal.yul @@ -0,0 +1,6 @@ +{ + let x := byte(31, "11112222333344445555666677778888") +} +// ==== +// dialect: evm +// ---- diff --git a/test/libyul/yulSyntaxTests/loadimmutable.yul b/test/libyul/yulSyntaxTests/loadimmutable.yul new file mode 100644 index 000000000000..6aea058b5d57 --- /dev/null +++ b/test/libyul/yulSyntaxTests/loadimmutable.yul @@ -0,0 +1,6 @@ +{ + let addr := loadimmutable("address") +} +// ==== +// dialect: evm +// ---- diff --git a/test/libyul/yulSyntaxTests/passing_builtin_with_literal_argument_into_literal_argument.yul b/test/libyul/yulSyntaxTests/passing_builtin_with_literal_argument_into_literal_argument.yul new file mode 100644 index 000000000000..4884fc265031 --- /dev/null +++ b/test/libyul/yulSyntaxTests/passing_builtin_with_literal_argument_into_literal_argument.yul @@ -0,0 +1,7 @@ +{ + setimmutable(loadimmutable("abc"), "abc") +} +// ==== +// dialect: evm +// ---- +// TypeError 9114: (6-18): Function expects direct literals as arguments. diff --git a/test/libyul/yulSyntaxTests/setimmutable.yul b/test/libyul/yulSyntaxTests/setimmutable.yul new file mode 100644 index 000000000000..3c37c90ff201 --- /dev/null +++ b/test/libyul/yulSyntaxTests/setimmutable.yul @@ -0,0 +1,6 @@ +{ + setimmutable("address", 0x1234567890123456789012345678901234567890) +} +// ==== +// dialect: evm +// ---- diff --git a/test/libyul/yulSyntaxTests/string_literal_too_long.yul b/test/libyul/yulSyntaxTests/string_literal_too_long.yul new file mode 100644 index 000000000000..2ae5be44a658 --- /dev/null +++ b/test/libyul/yulSyntaxTests/string_literal_too_long.yul @@ -0,0 +1,7 @@ +{ + let name := "long___name___that___definitely___exceeds___the___thirty___two___byte___limit" +} +// ==== +// dialect: evm +// ---- +// TypeError 3069: (18-97): String literal too long (77 > 32) diff --git a/test/libyul/yulSyntaxTests/string_literal_too_long_byte.yul b/test/libyul/yulSyntaxTests/string_literal_too_long_byte.yul new file mode 100644 index 000000000000..0ae6d3beb876 --- /dev/null +++ b/test/libyul/yulSyntaxTests/string_literal_too_long_byte.yul @@ -0,0 +1,7 @@ +{ + let x := byte(40, "long___value__that___definitely___exceeds___the___thirty___two___byte___limit") +} +// ==== +// dialect: evm +// ---- +// TypeError 3069: (24-103): String literal too long (77 > 32) diff --git a/test/libyul/yulSyntaxTests/string_literal_too_long_immutable.yul b/test/libyul/yulSyntaxTests/string_literal_too_long_immutable.yul new file mode 100644 index 000000000000..37ce835df403 --- /dev/null +++ b/test/libyul/yulSyntaxTests/string_literal_too_long_immutable.yul @@ -0,0 +1,9 @@ +{ + setimmutable( + "long___name___that___definitely___exceeds___the___thirty___two___byte___limit", + 0x1234567890123456789012345678901234567890 + ) +} +// ==== +// dialect: evm +// ---- From a331d4449d9be3d6c81a2fa5d20678df663d45b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 19 Jun 2020 13:32:40 +0200 Subject: [PATCH 274/479] Add linkersymbol() builtin to Yul EVM dialect --- docs/yul.rst | 24 +++++++++++ libyul/AsmAnalysis.cpp | 2 +- libyul/backends/evm/EVMDialect.cpp | 11 +++++ test/libyul/objectCompiler/linkersymbol.yul | 42 +++++++++++++++++++ .../yulSyntaxTests/linkersymbol_evm.yul | 6 +++ .../yulSyntaxTests/linkersymbol_evmtyped.yul | 6 +++ .../yulSyntaxTests/linkersymbol_ewasm.yul | 7 ++++ .../linkersymbol_non_literal_args.yul | 8 ++++ .../string_literal_too_long_linkersymbol.yul | 6 +++ 9 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 test/libyul/objectCompiler/linkersymbol.yul create mode 100644 test/libyul/yulSyntaxTests/linkersymbol_evm.yul create mode 100644 test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul create mode 100644 test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul create mode 100644 test/libyul/yulSyntaxTests/linkersymbol_non_literal_args.yul create mode 100644 test/libyul/yulSyntaxTests/string_literal_too_long_linkersymbol.yul diff --git a/docs/yul.rst b/docs/yul.rst index 473496e16540..832153625193 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -927,6 +927,30 @@ will store ``value`` at all points in memory that contain a call to ``loadimmutable("name")``. +linkersymbol +^^^^^^^^^^^^ + +The function ``linkersymbol("fq_library_name")`` is a placeholder for an address literal to be +substituted by the linker. Its first and only argument must be a string literal and represents the +fully qualified library name used with the ``--libraries`` option. + +For example this code + +.. code-block:: yul + + let a := linkersymbol("file.sol:Math") + +is equivalent to + +.. code-block:: yul + + let a := 0x1234567890123456789012345678901234567890 + +when the linker is invoked with ``--libraries "file.sol:Math:0x1234567890123456789012345678901234567890`` +option. + +See :ref:`Using the Commandline Compiler ` for details about the Solidity linker. + .. _yul-object: diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 3c639f3d1154..6cf006638ed1 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -544,7 +544,7 @@ void AsmAnalyzer::expectType(YulString _expectedType, YulString _givenType, Sour bool AsmAnalyzer::warnOnInstructions(std::string const& _instructionIdentifier, langutil::SourceLocation const& _location) { auto const builtin = EVMDialect::strictAssemblyForEVM(EVMVersion{}).builtin(YulString(_instructionIdentifier)); - if (builtin) + if (builtin && builtin->instruction.has_value()) return warnOnInstructions(builtin->instruction.value(), _location); else return false; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 6875df234b2c..b6a46043e8f3 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -124,6 +124,17 @@ map createBuiltins(langutil::EVMVersion _evmVe ) builtins.emplace(createEVMFunction(instr.first, instr.second)); + builtins.emplace(createFunction("linkersymbol", 1, 1, SideEffects{}, {true}, []( + FunctionCall const& _call, + AbstractAssembly& _assembly, + BuiltinContext&, + function + ) { + yulAssert(_call.arguments.size() == 1, ""); + Expression const& arg = _call.arguments.front(); + _assembly.appendLinkerSymbol(std::get(arg).value.str()); + })); + if (_objectAccess) { builtins.emplace(createFunction("datasize", 1, 1, SideEffects{}, {true}, []( diff --git a/test/libyul/objectCompiler/linkersymbol.yul b/test/libyul/objectCompiler/linkersymbol.yul new file mode 100644 index 000000000000..65bf004ef7ac --- /dev/null +++ b/test/libyul/objectCompiler/linkersymbol.yul @@ -0,0 +1,42 @@ +object "a" { + code { + let addr := linkersymbol("contract/test.sol:L") + mstore(128, shl(227, 0x18530aaf)) + let success := call(gas(), addr, 0, 128, 4, 128, 0) + } +} +// ---- +// Assembly: +// linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612") +// /* "source":109:119 */ +// 0x18530aaf +// /* "source":104:107 */ +// 0xe3 +// /* "source":100:120 */ +// shl +// /* "source":95:98 */ +// 0x80 +// /* "source":88:121 */ +// mstore +// /* "source":179:180 */ +// 0x00 +// /* "source":174:177 */ +// 0x80 +// /* "source":171:172 */ +// 0x04 +// /* "source":166:169 */ +// 0x80 +// /* "source":163:164 */ +// 0x00 +// /* "source":157:161 */ +// dup6 +// /* "source":150:155 */ +// gas +// /* "source":145:181 */ +// call +// /* "source":22:187 */ +// pop +// pop +// Bytecode: 7300000000000000000000000000000000000000006318530aaf60e31b60805260006080600460806000855af15050 +// Opcodes: PUSH20 0x0 PUSH4 0x18530AAF PUSH1 0xE3 SHL PUSH1 0x80 MSTORE PUSH1 0x0 PUSH1 0x80 PUSH1 0x4 PUSH1 0x80 PUSH1 0x0 DUP6 GAS CALL POP POP +// SourceMappings: :::-:0;109:10:0;104:3;100:20;95:3;88:33;179:1;174:3;171:1;166:3;163:1;157:4;150:5;145:36;22:165; diff --git a/test/libyul/yulSyntaxTests/linkersymbol_evm.yul b/test/libyul/yulSyntaxTests/linkersymbol_evm.yul new file mode 100644 index 000000000000..2bec7e49c455 --- /dev/null +++ b/test/libyul/yulSyntaxTests/linkersymbol_evm.yul @@ -0,0 +1,6 @@ +{ + let addr := linkersymbol("contract/library.sol:L") +} +// ==== +// dialect: evm +// ---- diff --git a/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul b/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul new file mode 100644 index 000000000000..1cadcee0c0fb --- /dev/null +++ b/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul @@ -0,0 +1,6 @@ +{ + let addr:u256 := linkersymbol("contract/library.sol:L") +} +// ==== +// dialect: evmTyped +// ---- diff --git a/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul b/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul new file mode 100644 index 000000000000..2b01045ce9ff --- /dev/null +++ b/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul @@ -0,0 +1,7 @@ +{ + linkersymbol("contract/library.sol:L") +} +// ==== +// dialect: ewasm +// ---- +// DeclarationError 4619: (6-18): Function not found. diff --git a/test/libyul/yulSyntaxTests/linkersymbol_non_literal_args.yul b/test/libyul/yulSyntaxTests/linkersymbol_non_literal_args.yul new file mode 100644 index 000000000000..e8b860a01e63 --- /dev/null +++ b/test/libyul/yulSyntaxTests/linkersymbol_non_literal_args.yul @@ -0,0 +1,8 @@ +{ + let library_name := "contract/library.sol:L" + let addr := linkersymbol(library_name) +} +// ==== +// dialect: evm +// ---- +// TypeError 9114: (67-79): Function expects direct literals as arguments. diff --git a/test/libyul/yulSyntaxTests/string_literal_too_long_linkersymbol.yul b/test/libyul/yulSyntaxTests/string_literal_too_long_linkersymbol.yul new file mode 100644 index 000000000000..cf8ef95e16ef --- /dev/null +++ b/test/libyul/yulSyntaxTests/string_literal_too_long_linkersymbol.yul @@ -0,0 +1,6 @@ +{ + let addr := linkersymbol("contract/long___name___that___definitely___exceeds___the___thirty___two___byte___limit.sol:L") +} +// ==== +// dialect: evm +// ---- From 02328f3bbbe851701e03413ec0ca852155a142a4 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Thu, 18 Jun 2020 17:09:24 +0200 Subject: [PATCH 275/479] Add unit denomination ``gwei`` --- Changelog.md | 1 + docs/Solidity.g4 | 6 ++++-- docs/units-and-global-variables.rst | 3 ++- liblangutil/Token.h | 1 + libsolidity/ast/AST.h | 1 + libsolidity/ast/ASTJsonImporter.cpp | 2 ++ libsolidity/ast/Types.cpp | 3 +++ libsolidity/parsing/Parser.cpp | 9 +++++++-- test/ExecutionFramework.h | 1 + test/libsolidity/SolidityExpressionCompiler.cpp | 15 +++++++++++++++ test/libsolidity/SolidityScanner.cpp | 3 ++- test/libsolidity/semanticTests/literals/gwei.sol | 10 ++++++++++ .../syntaxTests/denominations/denominations.sol | 1 + .../syntaxTests/denominations/gwei.sol | 3 +++ ...eral_constants_with_ether_subdenominations.sol | 7 ++++--- test/tools/ossfuzz/config/solidity.dict | 1 + 16 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 test/libsolidity/semanticTests/literals/gwei.sol create mode 100644 test/libsolidity/syntaxTests/denominations/gwei.sol diff --git a/Changelog.md b/Changelog.md index 9328f282401f..052b10158785 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ ### 0.6.11 (unreleased) Language Features: + * General: Add unit denomination ``gwei`` Compiler Features: diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index 65fee05fa7f6..af351731b28f 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -359,10 +359,10 @@ subAssembly : 'assembly' identifier assemblyBlock ; numberLiteral - : (DecimalNumber | HexNumber) NumberUnit? ; + : (DecimalNumber | HexNumber) (NumberUnit | Gwei)?; identifier - : ('from' | 'calldata' | 'address' | Identifier) ; + : (Gwei | 'from' | 'calldata' | 'address' | Identifier) ; BooleanLiteral : 'true' | 'false' ; @@ -385,6 +385,8 @@ NumberUnit : 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' ; +Gwei: 'gwei' ; + HexLiteralFragment : 'hex' (('"' HexDigits? '"') | ('\'' HexDigits? '\'')) ; diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index d936ef2464a1..213390be4b7d 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -7,11 +7,12 @@ Units and Globally Available Variables Ether Units =========== -A literal number can take a suffix of ``wei``, ``finney``, ``szabo`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei. +A literal number can take a suffix of ``wei``, ``gwei``, ``finney``, ``szabo`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei. :: assert(1 wei == 1); + assert(1 gwei == 1e9); assert(1 szabo == 1e12); assert(1 finney == 1e15); assert(1 ether == 1e18); diff --git a/liblangutil/Token.h b/liblangutil/Token.h index d9d4471cb372..916f71c75c9c 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -232,6 +232,7 @@ namespace solidity::langutil \ /* Identifiers (not keywords or future reserved words). */ \ T(Identifier, nullptr, 0) \ + T(SubGwei, "gwei", 0) \ \ /* Keywords reserved for future use. */ \ K(After, "after", 0) \ diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index c6c560988a0c..88c3e1beb094 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -2084,6 +2084,7 @@ class Literal: public PrimaryExpression { None = static_cast(Token::Illegal), Wei = static_cast(Token::SubWei), + Gwei = static_cast(Token::SubGwei), Szabo = static_cast(Token::SubSzabo), Finney = static_cast(Token::SubFinney), Ether = static_cast(Token::SubEther), diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 65f9fa718e88..ccf9af5a74df 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -1001,6 +1001,8 @@ Literal::SubDenomination ASTJsonImporter::subdenomination(Json::Value const& _no if (subDenStr == "wei") return Literal::SubDenomination::Wei; + else if (subDenStr == "gwei") + return Literal::SubDenomination::Gwei; else if (subDenStr == "szabo") return Literal::SubDenomination::Szabo; else if (subDenStr == "finney") diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 5ea018107388..992f0343d953 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -889,6 +889,9 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal case Literal::SubDenomination::Wei: case Literal::SubDenomination::Second: break; + case Literal::SubDenomination::Gwei: + value *= bigint("1000000000"); + break; case Literal::SubDenomination::Szabo: value *= bigint("1000000000000"); break; diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index c429ba78634f..4b63cbc58073 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1825,11 +1825,16 @@ ASTPointer Parser::parsePrimaryExpression() expression = nodeFactory.createNode(token, getLiteralAndAdvance()); break; case Token::Number: - if (TokenTraits::isEtherSubdenomination(m_scanner->peekNextToken())) + if ( + (m_scanner->peekNextToken() == Token::Identifier && m_scanner->peekLiteral() == "gwei") || + TokenTraits::isEtherSubdenomination(m_scanner->peekNextToken()) + ) { ASTPointer literal = getLiteralAndAdvance(); nodeFactory.markEndPosition(); - Literal::SubDenomination subdenomination = static_cast(m_scanner->currentToken()); + Token actualToken = m_scanner->currentToken() == Token::Identifier ? Token::SubGwei : m_scanner->currentToken(); + + Literal::SubDenomination subdenomination = static_cast(actualToken); m_scanner->next(); expression = nodeFactory.createNode(token, literal, subdenomination); } diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index 72a07ce3e24b..6fea5310a7b8 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -48,6 +48,7 @@ using Address = util::h160; // The various denominations; here for ease of use where needed within code. static const u256 wei = 1; static const u256 shannon = u256("1000000000"); +static const u256 gwei = shannon; static const u256 szabo = shannon * 1000; static const u256 finney = szabo * 1000; static const u256 ether = finney * 1000; diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 4d1e9e23a13e..10083b8274ae 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -221,6 +221,21 @@ BOOST_AUTO_TEST_CASE(int_with_wei_ether_subdenomination) BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); } +BOOST_AUTO_TEST_CASE(int_with_gwei_ether_subdenomination) +{ + char const* sourceCode = R"( + contract test { + function test () { + uint x = 1 gwei; + } + } + )"; + bytes code = compileFirstExpression(sourceCode); + + bytes expectation({uint8_t(Instruction::PUSH4), 0x3b, 0x9a, 0xca, 0x00}); + BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); +} + BOOST_AUTO_TEST_CASE(int_with_szabo_ether_subdenomination) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index dc628674ac40..b02a910a59f3 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -428,8 +428,9 @@ BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence) BOOST_AUTO_TEST_CASE(ether_subdenominations) { - Scanner scanner(CharStream("wei szabo finney ether", "")); + Scanner scanner(CharStream("wei gwei szabo finney ether", "")); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubWei); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::SubSzabo); BOOST_CHECK_EQUAL(scanner.next(), Token::SubFinney); BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); diff --git a/test/libsolidity/semanticTests/literals/gwei.sol b/test/libsolidity/semanticTests/literals/gwei.sol new file mode 100644 index 000000000000..7762021dce5e --- /dev/null +++ b/test/libsolidity/semanticTests/literals/gwei.sol @@ -0,0 +1,10 @@ +contract C { + uint constant gwei = 1 gwei; + + function f() public view returns(uint) { return gwei; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1000000000 + diff --git a/test/libsolidity/syntaxTests/denominations/denominations.sol b/test/libsolidity/syntaxTests/denominations/denominations.sol index 43049a14488a..a34c03de0d78 100644 --- a/test/libsolidity/syntaxTests/denominations/denominations.sol +++ b/test/libsolidity/syntaxTests/denominations/denominations.sol @@ -2,5 +2,6 @@ contract C { uint constant a = 1 wei + 2 szabo + 3 finney + 4 ether; uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks; uint constant c = 2 szabo / 1 seconds + 3 finney * 3 hours; + uint constant d = 2 gwei / 1 seconds + 3 finney * 3 hours; } // ---- diff --git a/test/libsolidity/syntaxTests/denominations/gwei.sol b/test/libsolidity/syntaxTests/denominations/gwei.sol new file mode 100644 index 000000000000..5bc5edb3d991 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/gwei.sol @@ -0,0 +1,3 @@ +contract C { + uint constant gwei = 1 gwei; +} diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol index 395bacc3e2b0..51ce8b4d5d90 100644 --- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol +++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol @@ -1,15 +1,16 @@ -contract c { +contract C { function f() public { a = 1 wei; b = 2 szabo; c = 3 finney; - b = 4 ether; + d = 4 ether; + e = 5 gwei; } uint256 a; uint256 b; uint256 c; uint256 d; + uint256 e; } // ---- -// Warning 2519: (170-179): This declaration shadows an existing declaration. diff --git a/test/tools/ossfuzz/config/solidity.dict b/test/tools/ossfuzz/config/solidity.dict index 8190e7c55105..f788d49c2774 100644 --- a/test/tools/ossfuzz/config/solidity.dict +++ b/test/tools/ossfuzz/config/solidity.dict @@ -8,6 +8,7 @@ " ether " " finney " " gasleft() " +" gwei " " hours " " minutes " " msg.data " From d315f03590cdd22f0a4c2aaa8bcb2fc4e1e28f4f Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 25 Jun 2020 19:20:01 +0200 Subject: [PATCH 276/479] Set nodejs version to 10. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43bd5b9b9450..7ce595754735 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,12 +104,12 @@ matrix: sudo: required compiler: gcc node_js: - - "8" + - "10" services: - docker before_install: - - nvm install 8 - - nvm use 8 + - nvm install 10 + - nvm use 10 - docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 env: - SOLC_EMSCRIPTEN=On From 4146ff9fcf91d2851922875cf7f83470d85be0bd Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Mon, 25 May 2020 12:13:57 +0530 Subject: [PATCH 277/479] NatSpec for events --- Changelog.md | 2 +- docs/natspec-format.rst | 6 ++-- libsolidity/interface/Natspec.cpp | 18 ++++++++++ test/libsolidity/SolidityNatspecJSON.cpp | 46 ++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9328f282401f..4733eb6270b7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,7 +6,7 @@ Language Features: Compiler Features: * NatSpec: Add fields "kind" and "version" to the JSON output. * Commandline Interface: Prevent some incompatible commandline options from being used together. - + * NatSpec: Support NatSpec comments on events. Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index a0596869a834..d8f8478417ca 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -85,9 +85,9 @@ Tag =========== =============================================================================== ============================= ``@title`` A title that should describe the contract/interface contract, interface ``@author`` The name of the author contract, interface, function -``@notice`` Explain to an end user what this does contract, interface, function, public state variable -``@dev`` Explain to a developer any extra details contract, interface, function, state variable -``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function +``@notice`` Explain to an end user what this does contract, interface, function, public state variable, event +``@dev`` Explain to a developer any extra details contract, interface, function, state variable, event +``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function, event ``@return`` Documents the return variables of a contract's function function, public state variable =========== =============================================================================== ============================= diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 9fadd41219d3..459536e9a0f9 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -36,6 +36,7 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) { Json::Value doc; Json::Value methods(Json::objectValue); + Json::Value events(Json::objectValue); doc["version"] = Json::Value(c_natspecVersion); doc["kind"] = Json::Value("user"); @@ -80,7 +81,17 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) } } } + + for (auto const& event: _contractDef.events()) + { + string value = extractDoc(event->annotation().docTags, "notice"); + if (!value.empty()) + events[event->functionType(true)->externalSignature()]["notice"] = value; + } + doc["methods"] = methods; + if (!events.empty()) + doc["events"] = events; return doc; } @@ -141,9 +152,16 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef) stateVariables[varDecl->name()]["return"] = extractDoc(varDecl->annotation().docTags, "return"); } + Json::Value events(Json::objectValue); + for (auto const& event: _contractDef.events()) + if (auto devDoc = devDocumentation(event->annotation().docTags); !devDoc.empty()) + events[event->functionType(true)->externalSignature()] = devDoc; + doc["methods"] = methods; if (!stateVariables.empty()) doc["stateVariables"] = stateVariables; + if (!events.empty()) + doc["events"] = events; return doc; } diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 6b69904d3ead..16b7c8b7ee5a 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -355,6 +355,52 @@ BOOST_AUTO_TEST_CASE(private_state_variable) checkNatspec(sourceCode, "test", userDoc, true); } +BOOST_AUTO_TEST_CASE(event) +{ + char const* sourceCode = R"( + contract ERC20 { + /// @notice This event is emitted when a transfer occurs. + /// @param from The source account. + /// @param to The destination account. + /// @param amount The amount. + /// @dev A test case! + event Transfer(address indexed from, address indexed to, uint amount); + } + )"; + + char const* devDoc = R"ABCDEF( + { + "events": + { + "Transfer(address,address,uint256)": + { + "details": "A test case!", + "params": + { + "amount": "The amount.", "from": "The source account.", "to": "The destination account." + } + } + }, + "methods": {} + } + )ABCDEF"; + checkNatspec(sourceCode, "ERC20", devDoc, false); + + char const* userDoc = R"ABCDEF( + { + "events": + { + "Transfer(address,address,uint256)": + { + "notice": "This event is emitted when a transfer occurs." + } + }, + "methods": {} + } + )ABCDEF"; + checkNatspec(sourceCode, "ERC20", userDoc, true); +} + BOOST_AUTO_TEST_CASE(dev_desc_after_nl) { char const* sourceCode = R"( From 66a3d351202fd01244b502182d9ac51a8ea0294d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 26 Jun 2020 14:21:43 +0200 Subject: [PATCH 278/479] Modify Travis config not to push empscripten builds to solc-bin --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7ce595754735..ef7832777448 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,8 @@ env: - ENCRYPTION_LABEL="6d4541b72666" - SOLC_BUILD_TYPE=RelWithDebInfo - SOLC_EMSCRIPTEN=Off + # FIXME: Pushing solcjson.js to solc-bin disabled until we fix the cause of #9261 + - SOLC_PUBLISH_EMSCRIPTEN=Off - SOLC_INSTALL_DEPS_TRAVIS=On - SOLC_RELEASE=On - SOLC_TESTS=On @@ -213,7 +215,7 @@ deploy: # scripts because TravisCI doesn't provide much in the way of conditional logic. - provider: script - script: test $SOLC_EMSCRIPTEN != On || (scripts/release_emscripten.sh) + script: test $SOLC_PUBLISH_EMSCRIPTEN != On || $SOLC_EMSCRIPTEN != On || (scripts/release_emscripten.sh) skip_cleanup: true on: branch: From 3f3f8adcb81d627024b22ebd1eb18e914c457a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 29 Jun 2020 15:11:33 +0200 Subject: [PATCH 279/479] CommandLineInterface: In error message about options disallowed in assembly mode only include the names of actually used options --- solc/CommandLineInterface.cpp | 10 ++++++++-- .../strict_asm_invalid_option_optimize_yul/args | 1 + .../strict_asm_invalid_option_optimize_yul/err | 1 + .../strict_asm_invalid_option_optimize_yul/exit | 1 + .../strict_asm_invalid_option_optimize_yul/input.yul | 3 +++ .../strict_asm_invalid_option_output_dir/err | 2 +- 6 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args create mode 100644 test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err create mode 100644 test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit create mode 100644 test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index bbf0eeb532e7..3bd374676e52 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #ifdef _WIN32 // windows @@ -1200,9 +1201,14 @@ bool CommandLineInterface::processInput() }; if (countEnabledOptions(nonAssemblyModeOptions) >= 1) { + auto optionEnabled = [&](string const& name){ return m_args.count(name) > 0; }; + auto enabledOptions = boost::copy_range>(nonAssemblyModeOptions | boost::adaptors::filtered(optionEnabled)); + serr() << "The following options are invalid in assembly mode: "; - serr() << joinOptionNames(nonAssemblyModeOptions) << ". "; - serr() << "Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl; + serr() << joinOptionNames(enabledOptions) << "."; + if (m_args.count(g_strOptimizeYul) || m_args.count(g_strNoOptimizeYul)) + serr() << " Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl; + serr() << endl; return false; } diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args new file mode 100644 index 000000000000..827d998294b2 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args @@ -0,0 +1 @@ +--strict-assembly --optimize-yul diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err new file mode 100644 index 000000000000..a6378a665ec1 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err @@ -0,0 +1 @@ +The following options are invalid in assembly mode: --optimize-yul. Optimization is disabled by default and can be enabled with --optimize. diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul new file mode 100644 index 000000000000..f21cd2b7e038 --- /dev/null +++ b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul @@ -0,0 +1,3 @@ +{ + sstore(0, 1) +} diff --git a/test/cmdlineTests/strict_asm_invalid_option_output_dir/err b/test/cmdlineTests/strict_asm_invalid_option_output_dir/err index a9b56e9c7ac3..738a37b29571 100644 --- a/test/cmdlineTests/strict_asm_invalid_option_output_dir/err +++ b/test/cmdlineTests/strict_asm_invalid_option_output_dir/err @@ -1 +1 @@ -The following options are invalid in assembly mode: --output-dir, --gas, --combined-json, --optimize-yul, --no-optimize-yul. Optimization is disabled by default and can be enabled with --optimize. +The following options are invalid in assembly mode: --output-dir. From fe3389153113679fa934e7fbb0335f562a10433b Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 29 Jun 2020 13:25:42 +0200 Subject: [PATCH 280/479] Natspec: Add warning when using `@author` with functions --- docs/natspec-format.rst | 8 +------- libsolidity/analysis/DocStringAnalyser.cpp | 7 +++++++ .../syntaxTests/natspec/docstring_author_function.sol | 6 ++++++ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 test/libsolidity/syntaxTests/natspec/docstring_author_function.sol diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index d8f8478417ca..ca677697573c 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -42,10 +42,6 @@ The following example shows a contract and a function using all available tags. .. note:: - NatSpec currently does NOT apply to public state variables (see - `solidity#3418 `__), - even if they are declared public and therefore do affect the ABI. - The Solidity compiler only interprets tags if they are external or public. You are welcome to use similar comments for your internal and private functions, but those will not be parsed. @@ -60,7 +56,6 @@ The following example shows a contract and a function using all available tags. /// @notice You can use this contract for only the most basic simulation /// @dev All function calls are currently implemented without side effects contract Tree { - /// @author Mary A. Botanist /// @notice Calculate tree age in years, rounded up, for live trees /// @dev The Alexandr N. Tetearing algorithm could increase precision /// @param rings The number of rings from dendrochronological sample @@ -84,7 +79,7 @@ in the same way as if it were tagged with ``@notice``. Tag Context =========== =============================================================================== ============================= ``@title`` A title that should describe the contract/interface contract, interface -``@author`` The name of the author contract, interface, function +``@author`` The name of the author contract, interface ``@notice`` Explain to an end user what this does contract, interface, function, public state variable, event ``@dev`` Explain to a developer any extra details contract, interface, function, state variable, event ``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function, event @@ -193,7 +188,6 @@ file should also be produced and should look like this: { "age(uint256)" : { - "author" : "Mary A. Botanist", "details" : "The Alexandr N. Tetearing algorithm could increase precision", "params" : { diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 7d8a8a43f864..86c59a2c0d7b 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -142,6 +142,13 @@ void DocStringAnalyser::handleCallable( static set const validTags = set{"author", "dev", "notice", "return", "param"}; parseDocStrings(_node, _annotation, validTags, "functions"); checkParameters(_callable, _node, _annotation); + + if (_node.documentation() && _annotation.docTags.count("author") > 0) + m_errorReporter.warning( + 9843_error, _node.documentation()->location(), + "Documentation tag @author is only allowed on contract definitions. " + "It will be disallowed in 0.7.0." + ); } void DocStringAnalyser::parseDocStrings( diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol new file mode 100644 index 000000000000..7b6ca862bfdc --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol @@ -0,0 +1,6 @@ +contract C { + /// @author author + function iHaveAuthor() public pure {} +} +// ---- +// Warning 9843: (17-35): Documentation tag @author is only allowed on contract definitions. It will be disallowed in 0.7.0. From d41eaeba5686828b85279057f3a7da8be0f9a8f9 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Wed, 3 Jun 2020 16:08:35 +0530 Subject: [PATCH 281/479] Added containsNestedMapping() --- .../analysis/DeclarationTypeChecker.cpp | 12 +- libsolidity/analysis/TypeChecker.cpp | 103 +++++++++--------- libsolidity/ast/ASTAnnotations.h | 3 + libsolidity/ast/Types.cpp | 83 ++++++++++---- libsolidity/ast/Types.h | 28 ++--- libsolidity/codegen/ABIFunctions.cpp | 5 +- libsolidity/codegen/CompilerUtils.cpp | 3 +- libsolidity/codegen/LValue.cpp | 4 +- 8 files changed, 136 insertions(+), 105 deletions(-) diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index 07e8f606675f..f8dbc1d2dd95 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -112,18 +112,16 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct) for (ASTPointer const& member: _struct.members()) { Type const* memberType = member->annotation().type; - while (auto arrayType = dynamic_cast(memberType)) - { - if (arrayType->isDynamicallySized()) - break; - memberType = arrayType->baseType(); - } + + if (auto arrayType = dynamic_cast(memberType)) + memberType = arrayType->finalBaseType(true); + if (auto structType = dynamic_cast(memberType)) if (_cycleDetector.run(structType->structDefinition())) return; } }; - if (util::CycleDetector(visitor).run(_struct) != nullptr) + if (util::CycleDetector(visitor).run(_struct)) m_errorReporter.fatalTypeError(2046_error, _struct.location(), "Recursive struct definition."); return false; diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index b408531774c5..afc454cb404a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -339,31 +339,21 @@ bool TypeChecker::visit(FunctionDefinition const& _function) m_errorReporter.typeError(5587_error, _function.location(), "Internal functions cannot be payable."); } auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& var) { - if (type(var)->category() == Type::Category::Mapping) - { - if (var.referenceLocation() != VariableDeclaration::Location::Storage) - { - if (!_function.libraryFunction() && _function.isPublic()) - m_errorReporter.typeError(3442_error, var.location(), "Mapping types can only have a data location of \"storage\" and thus only be parameters or return variables for internal or library functions."); - else - m_errorReporter.typeError(5380_error, var.location(), "Mapping types can only have a data location of \"storage\"." ); - } - else - solAssert(_function.libraryFunction() || !_function.isPublic(), "Mapping types for parameters or return variables can only be used in internal or library functions."); - } - else + if (type(var)->containsNestedMapping()) + if (var.referenceLocation() == VariableDeclaration::Location::Storage) + solAssert( + _function.libraryFunction() || !_function.isPublic(), + "Mapping types for parameters or return variables " + "can only be used in internal or library functions." + ); + if (_function.isPublic()) { - if (!type(var)->canLiveOutsideStorage() && _function.isPublic()) - m_errorReporter.typeError(3312_error, var.location(), "Type is required to live outside storage."); - if (_function.isPublic()) - { - auto iType = type(var)->interfaceType(_function.libraryFunction()); + auto iType = type(var)->interfaceType(_function.libraryFunction()); - if (!iType) - { - solAssert(!iType.message().empty(), "Expected detailed error message!"); - m_errorReporter.fatalTypeError(4103_error, var.location(), iType.message()); - } + if (!iType) + { + solAssert(!iType.message().empty(), "Expected detailed error message!"); + m_errorReporter.typeError(4103_error, var.location(), iType.message()); } } if ( @@ -457,9 +447,13 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) m_errorReporter.typeError(1273_error, _variable.location(), "The type of a variable cannot be a library."); if (_variable.value()) { - if (_variable.isStateVariable() && dynamic_cast(varType)) + if (_variable.isStateVariable() && varType->containsNestedMapping()) { - m_errorReporter.typeError(6280_error, _variable.location(), "Mappings cannot be assigned to."); + m_errorReporter.typeError( + 6280_error, + _variable.location(), + "Types in storage containing (nested) mappings cannot be assigned to." + ); _variable.value()->accept(*this); } else @@ -499,9 +493,16 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (!_variable.isStateVariable()) { - if (varType->dataStoredIn(DataLocation::Memory) || varType->dataStoredIn(DataLocation::CallData)) - if (!varType->canLiveOutsideStorage()) - m_errorReporter.typeError(4061_error, _variable.location(), "Type " + varType->toString() + " is only valid in storage."); + if ( + _variable.referenceLocation() == VariableDeclaration::Location::CallData || + _variable.referenceLocation() == VariableDeclaration::Location::Memory + ) + if (varType->containsNestedMapping()) + m_errorReporter.fatalTypeError( + 4061_error, + _variable.location(), + "Type " + varType->toString(true) + " is only valid in storage because it contains a (nested) mapping." + ); } else if (_variable.visibility() >= Visibility::Public) { @@ -612,8 +613,12 @@ bool TypeChecker::visit(EventDefinition const& _eventDef) { if (var->isIndexed()) numIndexed++; - if (!type(*var)->canLiveOutsideStorage()) - m_errorReporter.typeError(3448_error, var->location(), "Type is required to live outside storage."); + if (type(*var)->containsNestedMapping()) + m_errorReporter.typeError( + 3448_error, + var->location(), + "Type containing a (nested) mapping is not allowed as event parameter type." + ); if (!type(*var)->interfaceType(false)) m_errorReporter.typeError(3417_error, var->location(), "Internal or recursive type is not allowed as event parameter type."); if ( @@ -1386,7 +1391,7 @@ void TypeChecker::checkExpressionAssignment(Type const& _type, Expression const& checkExpressionAssignment(*types[i], *tupleExpression->components()[i]); } } - else if (_type.category() == Type::Category::Mapping) + else if (_type.nameable() && _type.containsNestedMapping()) { bool isLocalOrReturn = false; if (auto const* identifier = dynamic_cast(&_expression)) @@ -1394,7 +1399,7 @@ void TypeChecker::checkExpressionAssignment(Type const& _type, Expression const& if (variableDeclaration->isLocalOrReturn()) isLocalOrReturn = true; if (!isLocalOrReturn) - m_errorReporter.typeError(9214_error, _expression.location(), "Mappings cannot be assigned to."); + m_errorReporter.typeError(9214_error, _expression.location(), "Types in storage containing (nested) mappings cannot be assigned to."); } } @@ -1530,8 +1535,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple) _tuple.location(), "Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element." ); - else if (!inlineArrayType->canLiveOutsideStorage()) - m_errorReporter.fatalTypeError(1545_error, _tuple.location(), "Type " + inlineArrayType->toString() + " is only valid in storage."); + else if (inlineArrayType->containsNestedMapping()) + m_errorReporter.fatalTypeError( + 1545_error, + _tuple.location(), + "Type " + inlineArrayType->toString(true) + " is only valid in storage." + ); _tuple.annotation().type = TypeProvider::array(DataLocation::Memory, inlineArrayType, types.size()); } @@ -2032,24 +2041,8 @@ void TypeChecker::typeCheckFunctionGeneralChecks( toString(parameterTypes.size()) + "."; - // Extend error message in case we try to construct a struct with mapping member. if (isStructConstructorCall) - { - /// For error message: Struct members that were removed during conversion to memory. - TypePointer const expressionType = type(_functionCall.expression()); - auto const& t = dynamic_cast(*expressionType); - auto const& structType = dynamic_cast(*t.actualType()); - set membersRemovedForStructConstructor = structType.membersMissingInMemory(); - - if (!membersRemovedForStructConstructor.empty()) - { - msg += " Members that have to be skipped in memory:"; - for (auto const& member: membersRemovedForStructConstructor) - msg += " " + member; - } - return { isVariadic ? 1123_error : 9755_error, msg }; - } else if ( _functionType->kind() == FunctionType::Kind::BareCall || _functionType->kind() == FunctionType::Kind::BareCallCode || @@ -2269,6 +2262,12 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) if (actualType->category() == Type::Category::Struct) { + if (actualType->containsNestedMapping()) + m_errorReporter.fatalTypeError( + 9515_error, + _functionCall.location(), + "Struct containing a (nested) mapping cannot be constructed." + ); functionType = dynamic_cast(*actualType).constructorType(); funcCallAnno.kind = FunctionCallKind::StructConstructorCall; funcCallAnno.isPure = argumentsArePure; @@ -2518,11 +2517,11 @@ void TypeChecker::endVisit(NewExpression const& _newExpression) } else if (type->category() == Type::Category::Array) { - if (!type->canLiveOutsideStorage()) + if (type->containsNestedMapping()) m_errorReporter.fatalTypeError( 1164_error, _newExpression.typeName().location(), - "Type cannot live outside storage." + "Array containing a (nested) mapping cannot be constructed in memory." ); if (!type->isDynamicallySized()) m_errorReporter.typeError( diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 507559ca6ceb..6347092afed6 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -136,6 +136,9 @@ struct StructDeclarationAnnotation: TypeDeclarationAnnotation /// recursion immediately raises an error. /// Will be filled in by the DeclarationTypeChecker. std::optional recursive; + /// Whether the struct contains a mapping type, either directly or, indirectly inside another + /// struct or an array. + std::optional containsNestedMapping; }; struct ContractDefinitionAnnotation: TypeDeclarationAnnotation, StructurallyDocumentedAnnotation diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 3592a1490412..6f0554539bb8 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1985,6 +1985,20 @@ TypeResult ArrayType::interfaceType(bool _inLibrary) const return result; } +Type const* ArrayType::finalBaseType(bool _breakIfDynamicArrayType) const +{ + Type const* finalBaseType = this; + + while (auto arrayType = dynamic_cast(finalBaseType)) + { + if (_breakIfDynamicArrayType && arrayType->isDynamicallySized()) + break; + finalBaseType = arrayType->baseType(); + } + + return finalBaseType; +} + u256 ArrayType::memoryDataSize() const { solAssert(!isDynamicallySized(), ""); @@ -2213,7 +2227,7 @@ unsigned StructType::calldataEncodedSize(bool) const unsigned size = 0; for (auto const& member: members(nullptr)) { - solAssert(member.type->canLiveOutsideStorage(), ""); + solAssert(!member.type->containsNestedMapping(), ""); // Struct members are always padded. size += member.type->calldataEncodedSize(); } @@ -2228,7 +2242,7 @@ unsigned StructType::calldataEncodedTailSize() const unsigned size = 0; for (auto const& member: members(nullptr)) { - solAssert(member.type->canLiveOutsideStorage(), ""); + solAssert(!member.type->containsNestedMapping(), ""); // Struct members are always padded. size += member.type->calldataHeadSize(); } @@ -2240,7 +2254,7 @@ unsigned StructType::calldataOffsetOfMember(std::string const& _member) const unsigned offset = 0; for (auto const& member: members(nullptr)) { - solAssert(member.type->canLiveOutsideStorage(), ""); + solAssert(!member.type->containsNestedMapping(), ""); if (member.name == _member) return offset; // Struct members are always padded. @@ -2277,6 +2291,42 @@ u256 StructType::storageSize() const return max(1, members(nullptr).storageSize()); } +bool StructType::containsNestedMapping() const +{ + if (!m_struct.annotation().containsNestedMapping.has_value()) + { + bool hasNestedMapping = false; + + util::BreadthFirstSearch breadthFirstSearch{{&m_struct}}; + + breadthFirstSearch.run( + [&](StructDefinition const* _struct, auto&& _addChild) + { + for (auto const& member: _struct->members()) + { + TypePointer memberType = member->annotation().type; + solAssert(memberType, ""); + + if (auto arrayType = dynamic_cast(memberType)) + memberType = arrayType->finalBaseType(false); + + if (dynamic_cast(memberType)) + { + hasNestedMapping = true; + breadthFirstSearch.abort(); + } + else if (auto structType = dynamic_cast(memberType)) + _addChild(&structType->structDefinition()); + } + + }); + + m_struct.annotation().containsNestedMapping = hasNestedMapping; + } + + return m_struct.annotation().containsNestedMapping.value(); +} + string StructType::toString(bool _short) const { string ret = "struct " + m_struct.annotation().canonicalName; @@ -2292,10 +2342,7 @@ MemberList::MemberMap StructType::nativeMembers(ASTNode const*) const { TypePointer type = variable->annotation().type; solAssert(type, ""); - // If we are not in storage, skip all members that cannot live outside of storage, - // ex. mappings and array of mappings - if (location() != DataLocation::Storage && !type->canLiveOutsideStorage()) - continue; + solAssert(!(location() != DataLocation::Storage && type->containsNestedMapping()), ""); members.emplace_back( variable->name(), copyForLocationIfReference(type), @@ -2457,10 +2504,9 @@ FunctionTypePointer StructType::constructorType() const { TypePointers paramTypes; strings paramNames; + solAssert(!containsNestedMapping(), ""); for (auto const& member: members(nullptr)) { - if (!member.type->canLiveOutsideStorage()) - continue; paramNames.push_back(member.name); paramTypes.push_back(TypeProvider::withLocationIfReference(DataLocation::Memory, member.type)); } @@ -2494,20 +2540,12 @@ u256 StructType::memoryOffsetOfMember(string const& _name) const TypePointers StructType::memoryMemberTypes() const { + solAssert(!containsNestedMapping(), ""); TypePointers types; for (ASTPointer const& variable: m_struct.members()) - if (variable->annotation().type->canLiveOutsideStorage()) - types.push_back(TypeProvider::withLocationIfReference(DataLocation::Memory, variable->annotation().type)); - return types; -} + types.push_back(TypeProvider::withLocationIfReference(DataLocation::Memory, variable->annotation().type)); -set StructType::membersMissingInMemory() const -{ - set missing; - for (ASTPointer const& variable: m_struct.members()) - if (!variable->annotation().type->canLiveOutsideStorage()) - missing.insert(variable->name()); - return missing; + return types; } vector> StructType::makeStackItems() const @@ -3654,7 +3692,10 @@ TypeResult MappingType::interfaceType(bool _inLibrary) const } } else - return TypeResult::err("Only libraries are allowed to use the mapping type in public or external functions."); + return TypeResult::err( + "Types containing (nested) mappings can only be parameters or " + "return variables of internal or library functions." + ); return this; } diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index b902a1c77de1..fa374d08f043 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -259,7 +259,11 @@ class Type /// Returns true if the type can be stored in storage. virtual bool canBeStored() const { return true; } /// Returns false if the type cannot live outside the storage, i.e. if it includes some mapping. - virtual bool canLiveOutsideStorage() const { return true; } + virtual bool containsNestedMapping() const + { + solAssert(nameable(), "Called for a non nameable type."); + return false; + } /// Returns true if the type can be stored as a value (as opposed to a reference) on the stack, /// i.e. it behaves differently in lvalue context and in value context. virtual bool isValueType() const { return false; } @@ -549,7 +553,6 @@ class RationalNumberType: public Type bool operator==(Type const& _other) const override; bool canBeStored() const override { return false; } - bool canLiveOutsideStorage() const override { return false; } std::string toString(bool _short) const override; u256 literalValue(Literal const* _literal) const override; @@ -610,7 +613,6 @@ class StringLiteralType: public Type bool operator==(Type const& _other) const override; bool canBeStored() const override { return false; } - bool canLiveOutsideStorage() const override { return false; } std::string toString(bool) const override; TypePointer mobileType() const override; @@ -781,8 +783,9 @@ class ArrayType: public ReferenceType bool isDynamicallySized() const override { return m_hasDynamicLength; } bool isDynamicallyEncoded() const override; u256 storageSize() const override; - bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); } + bool containsNestedMapping() const override { return m_baseType->containsNestedMapping(); } bool nameable() const override { return true; } + std::string toString(bool _short) const override; std::string canonicalName() const override; std::string signatureInExternalFunction(bool _structsByName) const override; @@ -798,6 +801,7 @@ class ArrayType: public ReferenceType /// @returns true if this is a string bool isString() const { return m_arrayKind == ArrayKind::String; } Type const* baseType() const { solAssert(!!m_baseType, ""); return m_baseType; } + Type const* finalBaseType(bool breakIfDynamicArrayType) const; u256 const& length() const { return m_length; } u256 memoryDataSize() const override; @@ -842,7 +846,6 @@ class ArraySliceType: public ReferenceType unsigned calldataEncodedTailSize() const override { return 32; } bool isDynamicallySized() const override { return true; } bool isDynamicallyEncoded() const override { return true; } - bool canLiveOutsideStorage() const override { return m_arrayType.canLiveOutsideStorage(); } std::string toString(bool _short) const override; TypePointer mobileType() const override; @@ -883,7 +886,6 @@ class ContractType: public Type } unsigned storageBytes() const override { solAssert(!isSuper(), ""); return 20; } bool leftAligned() const override { solAssert(!isSuper(), ""); return false; } - bool canLiveOutsideStorage() const override { return !isSuper(); } bool isValueType() const override { return !isSuper(); } bool nameable() const override { return !isSuper(); } std::string toString(bool _short) const override; @@ -945,7 +947,7 @@ class StructType: public ReferenceType bool isDynamicallyEncoded() const override; u256 memoryDataSize() const override; u256 storageSize() const override; - bool canLiveOutsideStorage() const override { return true; } + bool containsNestedMapping() const override; bool nameable() const override { return true; } std::string toString(bool _short) const override; @@ -975,8 +977,6 @@ class StructType: public ReferenceType /// @returns the vector of types of members available in memory. TypePointers memoryMemberTypes() const; - /// @returns the set of all members that are removed in the memory version (typically mappings). - std::set membersMissingInMemory() const; void clearCache() const override; @@ -1007,7 +1007,6 @@ class EnumType: public Type } unsigned storageBytes() const override; bool leftAligned() const override { return false; } - bool canLiveOutsideStorage() const override { return true; } std::string toString(bool _short) const override; std::string canonicalName() const override; bool isValueType() const override { return true; } @@ -1047,7 +1046,6 @@ class TupleType: public Type std::string toString(bool) const override; bool canBeStored() const override { return false; } u256 storageSize() const override; - bool canLiveOutsideStorage() const override { return false; } bool hasSimpleZeroValueInMemory() const override { return false; } TypePointer mobileType() const override; /// Converts components to their temporary types and performs some wildcard matching. @@ -1218,7 +1216,6 @@ class FunctionType: public Type unsigned storageBytes() const override; bool isValueType() const override { return true; } bool nameable() const override; - bool canLiveOutsideStorage() const override { return m_kind == Kind::Internal || m_kind == Kind::External; } bool hasSimpleZeroValueInMemory() const override { return false; } MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; TypePointer encodingType() const override; @@ -1351,7 +1348,7 @@ class MappingType: public Type bool operator==(Type const& _other) const override; std::string toString(bool _short) const override; std::string canonicalName() const override; - bool canLiveOutsideStorage() const override { return false; } + bool containsNestedMapping() const override { return true; } TypeResult binaryOperatorResult(Token, Type const*) const override { return nullptr; } Type const* encodingType() const override; TypeResult interfaceType(bool _inLibrary) const override; @@ -1386,7 +1383,6 @@ class TypeType: public Type bool operator==(Type const& _other) const override; bool canBeStored() const override { return false; } u256 storageSize() const override; - bool canLiveOutsideStorage() const override { return false; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; } MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; @@ -1412,7 +1408,6 @@ class ModifierType: public Type TypeResult binaryOperatorResult(Token, Type const*) const override { return nullptr; } bool canBeStored() const override { return false; } u256 storageSize() const override; - bool canLiveOutsideStorage() const override { return false; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } std::string richIdentifier() const override; bool operator==(Type const& _other) const override; @@ -1439,7 +1434,6 @@ class ModuleType: public Type std::string richIdentifier() const override; bool operator==(Type const& _other) const override; bool canBeStored() const override { return false; } - bool canLiveOutsideStorage() const override { return true; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } MemberList::MemberMap nativeMembers(ASTNode const*) const override; @@ -1479,7 +1473,6 @@ class MagicType: public Type std::string richIdentifier() const override; bool operator==(Type const& _other) const override; bool canBeStored() const override { return false; } - bool canLiveOutsideStorage() const override { return true; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } MemberList::MemberMap nativeMembers(ASTNode const*) const override; @@ -1512,7 +1505,6 @@ class InaccessibleDynamicType: public Type TypeResult binaryOperatorResult(Token, Type const*) const override { return nullptr; } unsigned calldataEncodedSize(bool) const override { return 32; } bool canBeStored() const override { return false; } - bool canLiveOutsideStorage() const override { return false; } bool isValueType() const override { return true; } bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } std::string toString(bool) const override { return "inaccessible dynamic type"; } diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 9f244fdb15dd..1e0eb1b8815a 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -860,8 +860,7 @@ string ABIFunctions::abiEncodingFunctionStruct( for (auto const& member: _to.members(nullptr)) { solAssert(member.type, ""); - if (!member.type->canLiveOutsideStorage()) - continue; + solAssert(!member.type->containsNestedMapping(), ""); TypePointer memberTypeTo = member.type->fullEncodingType(_options.encodeAsLibraryTypes, true, false); solUnimplementedAssert(memberTypeTo, "Encoding type \"" + member.type->toString() + "\" not yet implemented."); auto memberTypeFrom = _from.memberType(member.name); @@ -1340,7 +1339,7 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr for (auto const& member: _type.members(nullptr)) { solAssert(member.type, ""); - solAssert(member.type->canLiveOutsideStorage(), ""); + solAssert(!member.type->containsNestedMapping(), ""); auto decodingType = member.type->decodingType(); solAssert(decodingType, ""); bool dynamic = decodingType->isDynamicallyEncoded(); diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index c3e81d13a860..48712f5e9df9 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1069,8 +1069,7 @@ void CompilerUtils::convertType( // stack: for (auto const& member: typeOnStack->members(nullptr)) { - if (!member.type->canLiveOutsideStorage()) - continue; + solAssert(!member.type->containsNestedMapping(), ""); pair const& offsets = typeOnStack->storageOffsetsOfMember(member.name); _context << offsets.first << Instruction::DUP3 << Instruction::ADD; _context << u256(offsets.second); diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 3a04d6f92529..b0714ac755b0 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -355,13 +355,13 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc structType.structDefinition() == sourceType.structDefinition(), "Struct assignment with conversion." ); + solAssert(!structType.containsNestedMapping(), ""); solAssert(sourceType.location() != DataLocation::CallData, "Structs in calldata not supported."); for (auto const& member: structType.members(nullptr)) { // assign each member that can live outside of storage TypePointer const& memberType = member.type; - if (!memberType->canLiveOutsideStorage()) - continue; + solAssert(memberType->nameable(), ""); TypePointer sourceMemberType = sourceType.memberType(member.name); if (sourceType.location() == DataLocation::Storage) { From eeadb5a6b570aca2f8dd5f0d5592a740c020d1f2 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Sun, 7 Jun 2020 21:30:52 +0530 Subject: [PATCH 282/479] Tests, Docs and Changelog --- Changelog.md | 2 + docs/types/mapping-types.rst | 1 + docs/types/reference-types.rst | 11 ++-- test/libsolidity/SolidityEndToEndTest.cpp | 11 ++-- .../conversion/assignment_ignore_mapping.sol | 50 ------------------- .../structs/memory_structs_with_mappings.sol | 24 --------- .../semanticTests/structs/struct_copy.sol | 1 - .../syntaxTests/array/function_mapping.sol | 8 +++ .../array/function_mapping_library.sol | 6 +++ .../large_array_in_memory_struct.sol | 3 +- .../recursive_struct_memory.sol | 1 + .../syntaxTests/lvalues/library_mapping.sol | 2 +- ...tructs_with_mapping_array_struct_array.sol | 2 +- .../memory_structs_with_mappings.sol | 3 +- .../017_assignment_to_struct.sol | 1 + ...ts_of_non_external_types_in_interface.sol} | 0 ...s_of_non_external_types_in_interface_2.sol | 9 ++++ ...s_of_non_external_types_in_interface_2.sol | 3 +- ...non_external_types_in_interface_nested.sol | 10 ++++ ...non_external_types_in_interface_nested.sol | 3 +- .../264_mapping_in_memory_array.sol | 2 +- .../587_event_param_type_outside_storage.sol | 2 +- .../creating_struct_members_skipped.sol | 2 +- .../calldata_struct_mapping_function.sol | 15 ++++++ ..._struct_as_contract_function_parameter.sol | 4 +- .../recursion/return_recursive_structs.sol | 4 +- .../recursion/return_recursive_structs2.sol | 4 +- .../recursion/return_recursive_structs3.sol | 4 +- .../types/mapping/assignment_local_err.sol | 2 +- .../types/mapping/assignment_map.sol | 18 +++++-- .../mapping/assignment_state_variable.sol | 8 +-- .../types/mapping/assignment_struct.sol | 8 +-- .../mapping/function_type_argument_array.sol | 6 +++ .../mapping/library_argument_storage.sol | 13 +++++ .../library_array_argument_external.sol | 1 - .../mapping/library_array_argument_public.sol | 1 - .../types/mapping/library_nested_mapping.sol | 7 +++ .../types/mapping/library_nested_storage.sol | 6 +++ ..._data_location_function_param_external.sol | 4 +- ..._data_location_function_param_external.sol | 4 +- ..._data_location_function_param_internal.sol | 2 +- ...ng_data_location_function_param_public.sol | 3 +- .../mapping/mapping_function_calldata.sol | 12 +++++ .../mapping/mapping_return_public_memory.sol | 3 +- .../mapping_struct_data_location_memory.sol | 8 +++ ..._struct_recusrive_data_location_memory.sol | 10 ++++ .../types/mapping/memory_struct_recursive.sol | 20 ++++++++ .../mapping/memory_structs_with_mappings.sol | 15 ++++++ 48 files changed, 215 insertions(+), 124 deletions(-) delete mode 100644 test/libsolidity/semanticTests/structs/conversion/assignment_ignore_mapping.sol delete mode 100644 test/libsolidity/semanticTests/structs/memory_structs_with_mappings.sol create mode 100644 test/libsolidity/syntaxTests/array/function_mapping.sol create mode 100644 test/libsolidity/syntaxTests/array/function_mapping_library.sol rename test/libsolidity/syntaxTests/nameAndTypeResolution/{041_functions_with_stucts_of_non_external_types_in_interface.sol => 041_functions_with_structs_of_non_external_types_in_interface.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_structs_of_non_external_types_in_interface_2.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_structs_of_non_external_types_in_interface_nested.sol create mode 100644 test/libsolidity/syntaxTests/structs/calldata_struct_mapping_function.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/function_type_argument_array.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_nested_mapping.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_nested_storage.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_function_calldata.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_struct_data_location_memory.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_struct_recusrive_data_location_memory.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/memory_struct_recursive.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/memory_structs_with_mappings.sol diff --git a/Changelog.md b/Changelog.md index 46cef7a774e5..1371af1f8b48 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,8 @@ Breaking changes: * Parser: NatSpec comments on variables are only allowed for public state variables. * Type Checker: Disallow shifts by signed types. * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. + * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. + * Type Checker: Disallow assignments to state variables that contain nested mappings. Language Features: * Yul: Disallow EVM instruction `pc()`. diff --git a/docs/types/mapping-types.rst b/docs/types/mapping-types.rst index 333848619742..ed27d0508306 100644 --- a/docs/types/mapping-types.rst +++ b/docs/types/mapping-types.rst @@ -26,6 +26,7 @@ are allowed for state variables, as storage reference types in functions, or as parameters for library functions. They cannot be used as parameters or return parameters of contract functions that are publicly visible. +These restrictions are also true for arrays and structs that contain mappings. You can mark state variables of mapping type as ``public`` and Solidity creates a :ref:`getter ` for you. The ``_KeyType`` becomes a parameter for the getter. diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 49eed437f982..e26ee0405236 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -488,12 +488,11 @@ shown in the following example: function newCampaign(address payable beneficiary, uint goal) public returns (uint campaignID) { campaignID = numCampaigns++; // campaignID is return variable - // Creates new struct in memory and copies it to storage. - // We leave out the mapping type, because it is not valid in memory. - // If structs are copied (even from storage to storage), - // types that are not valid outside of storage (ex. mappings and array of mappings) - // are always omitted, because they cannot be enumerated. - campaigns[campaignID] = Campaign(beneficiary, goal, 0, 0); + // We cannot use "campaigns[campaignID] = Campaign(beneficiary, goal, 0, 0)" + // because the RHS creates a memory-struct "Campaign" that contains a mapping. + Campaign storage c = campaigns[campaignID]; + c.beneficiary = beneficiary; + c.fundingGoal = goal; } function contribute(uint campaignID) public payable { diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 65becac37e10..2d3e4f762e32 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -3465,12 +3465,12 @@ BOOST_AUTO_TEST_CASE(array_copy_calldata_storage) ABI_CHECK(callContractFunction("retrieve()"), encodeArgs(9, 28, 9, 28, 4, 3, 32)); } -BOOST_AUTO_TEST_CASE(array_copy_including_mapping) +BOOST_AUTO_TEST_CASE(array_copy_including_array) { char const* sourceCode = R"( contract c { - mapping(uint=>uint)[90][] large; - mapping(uint=>uint)[3][] small; + uint[3][90][] large; + uint[3][3][] small; function test() public returns (uint r) { for (uint i = 0; i < 7; i++) { large.push(); @@ -3505,9 +3505,8 @@ BOOST_AUTO_TEST_CASE(array_copy_including_mapping) } )"; compileAndRun(sourceCode); - ABI_CHECK(callContractFunction("test()"), encodeArgs(0x02000200)); - // storage is not empty because we cannot delete the mappings - BOOST_CHECK(!storageEmpty(m_contractAddress)); + ABI_CHECK(callContractFunction("test()"), encodeArgs(0x02000202)); + BOOST_CHECK(storageEmpty(m_contractAddress)); ABI_CHECK(callContractFunction("clear()"), encodeArgs(0, 0)); BOOST_CHECK(storageEmpty(m_contractAddress)); } diff --git a/test/libsolidity/semanticTests/structs/conversion/assignment_ignore_mapping.sol b/test/libsolidity/semanticTests/structs/conversion/assignment_ignore_mapping.sol deleted file mode 100644 index dd3bceb28b4a..000000000000 --- a/test/libsolidity/semanticTests/structs/conversion/assignment_ignore_mapping.sol +++ /dev/null @@ -1,50 +0,0 @@ -contract Test { - struct A { - mapping(uint=>uint) m; - } - struct B { - mapping(uint=>uint) m; - uint x; - } - struct C { - mapping(uint=>uint)[] ma; - } - struct D { - A[] a; - } - A storageA; - B storageB; - C storageC; - D storageD; - constructor() public { - storageA.m[1] = 2; - storageB.m[3] = 4; - storageB.x = 5; - for (uint i = 0; i < 6; i++) - storageC.ma.push(); - for (uint i = 0; i < 7; i++) - storageD.a.push(); - } - function run() public returns (uint, uint, uint, uint, uint, uint) { - A memory memoryA = A(); - B memory memoryB = B(42); - C memory memoryC = C(); - D memory memoryD1 = D(new A[](999)); - D memory memoryD2 = storageD; - storageA = memoryA; - storageB = memoryB; - storageC = memoryC; - // the following line does not compile because unimplemented - // storageD = memoryD1; - return ( - storageA.m[1], - storageB.x, - memoryB.x, - storageC.ma.length, - memoryD1.a.length, - memoryD2.a.length - ); - } -} -// ---- -// run() -> 2, 42, 42, 6, 999, 7 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_with_mappings.sol b/test/libsolidity/semanticTests/structs/memory_structs_with_mappings.sol deleted file mode 100644 index 3aaa354f88f1..000000000000 --- a/test/libsolidity/semanticTests/structs/memory_structs_with_mappings.sol +++ /dev/null @@ -1,24 +0,0 @@ -contract Test { - struct S { - uint8 a; - mapping(uint256 => uint256) b; - uint8 c; - } - S s; - - function f() public returns (uint256) { - S memory x; - if (x.a != 0 || x.c != 0) return 1; - x.a = 4; - x.c = 5; - s = x; - if (s.a != 4 || s.c != 5) return 2; - x = S(2, 3); - if (x.a != 2 || x.c != 3) return 3; - x = s; - if (s.a != 4 || s.c != 5) return 4; - } -} - -// ---- -// f() -> 0 diff --git a/test/libsolidity/semanticTests/structs/struct_copy.sol b/test/libsolidity/semanticTests/structs/struct_copy.sol index f6c35f7da4e2..2849c16bcbf3 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy.sol @@ -5,7 +5,6 @@ contract c { } struct Struct { uint256 a; - mapping(uint256 => Struct) b; Nested nested; uint256 c; } diff --git a/test/libsolidity/syntaxTests/array/function_mapping.sol b/test/libsolidity/syntaxTests/array/function_mapping.sol new file mode 100644 index 000000000000..934c7ebd818b --- /dev/null +++ b/test/libsolidity/syntaxTests/array/function_mapping.sol @@ -0,0 +1,8 @@ +pragma experimental ABIEncoderV2; + +contract Test { + function f(mapping(uint => uint)[] memory x) public pure {} +} +// ---- +// TypeError 4103: (66-98): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (66-98): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/array/function_mapping_library.sol b/test/libsolidity/syntaxTests/array/function_mapping_library.sol new file mode 100644 index 000000000000..fb709292a836 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/function_mapping_library.sol @@ -0,0 +1,6 @@ +pragma experimental ABIEncoderV2; +library L { + function f(mapping(uint => uint)[2] memory a) external pure returns (mapping(uint => uint)[2] memory) {} +} +// ---- +// TypeError 4061: (61-94): Type mapping(uint256 => uint256)[2] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol index 7cf12b8c411b..84be465fa6fd 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/large_array_in_memory_struct.sol @@ -5,7 +5,6 @@ contract C { struct S { uint256 [ ] [ 0.425781 ether ] s1 ; uint [ 2 ** 0xFF ] [ 2 ** 0x42 ] s2 ; X s3 ; - mapping ( uint => address payable ) c ; uint [ 9 hours ** 16 ] d ; string s ; } @@ -14,4 +13,4 @@ contract C { } } // ---- -// TypeError 1534: (530-540): Type too large for memory. +// TypeError 1534: (474-484): Type too large for memory. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol b/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol index aa79246c41e9..892cfdd8d326 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/recursive_struct_memory.sol @@ -11,3 +11,4 @@ contract Test { } // ---- // DeclarationError 2333: (157-198): Identifier already declared. +// TypeError 4061: (268-300): Type struct Test.RecursiveStruct[1] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/lvalues/library_mapping.sol b/test/libsolidity/syntaxTests/lvalues/library_mapping.sol index 2a1fe1fd8b44..2c774f55c208 100644 --- a/test/libsolidity/syntaxTests/lvalues/library_mapping.sol +++ b/test/libsolidity/syntaxTests/lvalues/library_mapping.sol @@ -4,4 +4,4 @@ library L { } } // ---- -// TypeError 9214: (108-109): Mappings cannot be assigned to. +// TypeError 9214: (108-109): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol index e9e1f7a06ebf..164d32ff017a 100644 --- a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol +++ b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mapping_array_struct_array.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError 4994: (208-218): Member "b1" is not available in struct Test.S1 memory outside of storage. +// TypeError 4061: (161-172): Type struct Test.S2 is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol index 594c881b7c5c..fd510ed17d6c 100644 --- a/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol +++ b/test/libsolidity/syntaxTests/memberLookup/memory_structs_with_mappings.sol @@ -3,8 +3,7 @@ contract Test { S s; function f() public { S memory x; - x.b[1]; } } // ---- -// TypeError 4994: (118-121): Member "b" is not available in struct Test.S memory outside of storage. +// TypeError 4061: (104-114): Type struct Test.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol index 6fbd09aea48c..a1fed99674e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol @@ -9,3 +9,4 @@ contract test { } } // ---- +// TypeError 9214: (152-156): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_structs_of_non_external_types_in_interface.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_stucts_of_non_external_types_in_interface.sol rename to test/libsolidity/syntaxTests/nameAndTypeResolution/041_functions_with_structs_of_non_external_types_in_interface.sol diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_structs_of_non_external_types_in_interface_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_structs_of_non_external_types_in_interface_2.sol new file mode 100644 index 000000000000..541dd0a043b1 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_structs_of_non_external_types_in_interface_2.sol @@ -0,0 +1,9 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { mapping(uint => uint) a; } + function f(S memory) public {} +} +// ---- +// TypeError 4103: (105-113): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (105-113): Type struct C.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol index 0254a1928ea3..541dd0a043b1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/042_functions_with_stucts_of_non_external_types_in_interface_2.sol @@ -5,4 +5,5 @@ contract C { function f(S memory) public {} } // ---- -// TypeError 4103: (105-113): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 4103: (105-113): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (105-113): Type struct C.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_structs_of_non_external_types_in_interface_nested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_structs_of_non_external_types_in_interface_nested.sol new file mode 100644 index 000000000000..d2c96d4bc8d0 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_structs_of_non_external_types_in_interface_nested.sol @@ -0,0 +1,10 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct T { mapping(uint => uint) a; } + struct S { T[][2] b; } + function f(S memory) public {} +} +// ---- +// TypeError 4103: (132-140): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (132-140): Type struct C.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol index c36e4ac0e9b9..d2c96d4bc8d0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/043_functions_with_stucts_of_non_external_types_in_interface_nested.sol @@ -6,4 +6,5 @@ contract C { function f(S memory) public {} } // ---- -// TypeError 4103: (132-140): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 4103: (132-140): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (132-140): Type struct C.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol index 1102f6ecd983..d561bd29ee1e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 1164: (94-117): Type cannot live outside storage. +// TypeError 1164: (94-117): Array containing a (nested) mapping cannot be constructed in memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol index b15dbc8dfda6..483bfab21ba8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol @@ -2,6 +2,6 @@ contract c { event e(uint indexed a, mapping(uint => uint) indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; } // ---- -// TypeError 3448: (41-72): Type is required to live outside storage. +// TypeError 3448: (41-72): Type containing a (nested) mapping is not allowed as event parameter type. // TypeError 3417: (41-72): Internal or recursive type is not allowed as event parameter type. // TypeError 8598: (17-132): More than 4 indexed arguments for anonymous event. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol index 08714f500a91..74764ed30dcc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError 9755: (117-126): Wrong argument count for struct constructor: 1 arguments given but expected 2. Members that have to be skipped in memory: c +// TypeError 9515: (117-126): Struct containing a (nested) mapping cannot be constructed. diff --git a/test/libsolidity/syntaxTests/structs/calldata_struct_mapping_function.sol b/test/libsolidity/syntaxTests/structs/calldata_struct_mapping_function.sol new file mode 100644 index 000000000000..398c52701189 --- /dev/null +++ b/test/libsolidity/syntaxTests/structs/calldata_struct_mapping_function.sol @@ -0,0 +1,15 @@ +pragma experimental ABIEncoderV2; + +contract test { + struct S { + T t; + } + struct T { + mapping (uint => uint) k; + } + function f(S calldata b) external { + } +} +// ---- +// TypeError 4103: (155-167): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (155-167): Type struct test.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol index 7f4c0e014491..f0a3de4012d7 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/recursive_struct_as_contract_function_parameter.sol @@ -1,3 +1,5 @@ +pragma experimental ABIEncoderV2; + contract Test { struct MyStructName { address addr; @@ -7,4 +9,4 @@ contract Test { function f(MyStructName memory s) public {} } // ---- -// TypeError 4103: (112-133): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (147-168): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol index 680c8b8a9337..15fca7d711e6 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol @@ -1,7 +1,9 @@ +pragma experimental ABIEncoderV2; + contract C { struct S { uint a; S[] sub; } function f() public pure returns (uint, S memory) { } } // ---- -// TypeError 4103: (91-99): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (126-134): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol index 085d333d33d4..a5b1507d34ea 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol @@ -1,7 +1,9 @@ +pragma experimental ABIEncoderV2; + contract C { struct S { uint a; S[2][] sub; } function f() public pure returns (uint, S memory) { } } // ---- -// TypeError 4103: (94-102): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (129-137): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol index 4e32d57ec814..fa9eebb9b225 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol @@ -1,3 +1,5 @@ +pragma experimental ABIEncoderV2; + contract C { struct S { uint a; S[][][] sub; } struct T { S s; } @@ -5,4 +7,4 @@ contract C { } } // ---- -// TypeError 4103: (119-129): Recursive type not allowed for public or external contract functions. +// TypeError 4103: (154-164): Recursive type not allowed for public or external contract functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol index b353a521a214..1d75c53b9992 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_local_err.sol @@ -7,4 +7,4 @@ contract D { } } // ---- -// TypeError 9214: (160-161): Mappings cannot be assigned to. +// TypeError 9214: (160-161): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol index 3c756e945ef9..fda9abf3dfa7 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_map.sol @@ -20,8 +20,18 @@ contract G { uint x = 1; mapping (uint => uint) b = x; } + +contract H { + struct S {mapping (uint => uint) a;} + + S x; + S y = x; + S z = z; +} // ---- -// TypeError 6280: (17-67): Mappings cannot be assigned to. -// TypeError 6280: (120-148): Mappings cannot be assigned to. -// TypeError 9214: (263-264): Mappings cannot be assigned to. -// TypeError 6280: (312-340): Mappings cannot be assigned to. +// TypeError 6280: (17-67): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 6280: (120-148): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (263-264): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 6280: (312-340): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 6280: (407-414): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 6280: (417-424): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol index d78f319dd6c4..bcf0c7e7be8e 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_state_variable.sol @@ -8,7 +8,7 @@ contract test { } } // ---- -// TypeError 9214: (126-129): Mappings cannot be assigned to. -// TypeError 9214: (144-147): Mappings cannot be assigned to. -// TypeError 9214: (163-166): Mappings cannot be assigned to. -// TypeError 9214: (168-171): Mappings cannot be assigned to. +// TypeError 9214: (126-129): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (144-147): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (163-166): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (168-171): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol b/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol index b1ef76ee0a47..c1051f25a7fe 100644 --- a/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol +++ b/test/libsolidity/syntaxTests/types/mapping/assignment_struct.sol @@ -11,7 +11,7 @@ contract test { } } // ---- -// TypeError 9214: (172-180): Mappings cannot be assigned to. -// TypeError 9214: (195-203): Mappings cannot be assigned to. -// TypeError 9214: (219-227): Mappings cannot be assigned to. -// TypeError 9214: (229-237): Mappings cannot be assigned to. +// TypeError 9214: (172-180): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (195-203): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (219-227): Types in storage containing (nested) mappings cannot be assigned to. +// TypeError 9214: (229-237): Types in storage containing (nested) mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_array.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_array.sol new file mode 100644 index 000000000000..e7587ad0cfc7 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_array.sol @@ -0,0 +1,6 @@ +contract test { + function f(mapping(uint => uint)[2] memory b) internal { + } +} +// ---- +// TypeError 4061: (31-64): Type mapping(uint256 => uint256)[2] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol b/test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol new file mode 100644 index 000000000000..edf86e397229 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol @@ -0,0 +1,13 @@ +library Set { + struct Data { mapping(uint => bool) flags; } + + function insert(Data storage self, uint value) + public + returns (bool) + { + if (self.flags[value]) + return false; // already there + self.flags[value] = true; + return true; + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol index 1826ea2b95fe..ca875546e9b1 100644 --- a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol @@ -3,4 +3,3 @@ library L { } } // ---- -// TypeError 3312: (27-58): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol index 644bc5129d5b..03ca40145aa1 100644 --- a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol @@ -3,4 +3,3 @@ library L { } } // ---- -// TypeError 3312: (27-58): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_nested_mapping.sol b/test/libsolidity/syntaxTests/types/mapping/library_nested_mapping.sol new file mode 100644 index 000000000000..31bf3cb1fcb4 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_nested_mapping.sol @@ -0,0 +1,7 @@ +pragma experimental ABIEncoderV2; +library L { + struct S { mapping(uint => uint) m; } + function f(S memory a) external pure returns (S memory) {} +} +// ---- +// TypeError 4061: (103-113): Type struct L.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_nested_storage.sol b/test/libsolidity/syntaxTests/types/mapping/library_nested_storage.sol new file mode 100644 index 000000000000..11b09ce25ee8 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_nested_storage.sol @@ -0,0 +1,6 @@ +library Test { + struct Nested { mapping(uint => uint)[2][] a; uint y; } + struct X { Nested n; } + function f(X storage x) external {} +} +// ---- diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol index 07b7553ca256..72c2a12a8518 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_data_location_function_param_external.sol @@ -2,5 +2,5 @@ contract c { function f1(mapping(uint => uint)[] calldata) pure external {} } // ---- -// TypeError 3312: (29-61): Type is required to live outside storage. -// TypeError 4103: (29-61): Only libraries are allowed to use the mapping type in public or external functions. +// TypeError 4103: (29-61): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (29-61): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol index db2b3235b66f..3bc5d7a29cc6 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_external.sol @@ -2,5 +2,5 @@ contract c { function f1(mapping(uint => uint) calldata) pure external returns (mapping(uint => uint) memory) {} } // ---- -// TypeError 3442: (29-59): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. -// TypeError 3442: (84-112): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 4103: (29-59): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (29-59): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol index 92f2e0ed4d62..95ca53279be2 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol @@ -3,4 +3,4 @@ contract c { function f5(mapping(uint => uint) memory) pure internal {} } // ---- -// TypeError 5380: (93-121): Mapping types can only have a data location of "storage". +// TypeError 4061: (93-121): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol index 5547e071d9e7..f8a66667506b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_public.sol @@ -2,4 +2,5 @@ contract c { function f3(mapping(uint => uint) memory) view public {} } // ---- -// TypeError 3442: (29-57): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 4103: (29-57): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (29-57): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_function_calldata.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_function_calldata.sol new file mode 100644 index 000000000000..f2360b2d1b31 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_function_calldata.sol @@ -0,0 +1,12 @@ +pragma experimental ABIEncoderV2; + +contract test { + struct S { + mapping (uint => uint) s; + } + function f(S calldata b) external { + } +} +// ---- +// TypeError 4103: (121-133): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (121-133): Type struct test.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol index e3e4d2cc3a66..4d06bad5a410 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol @@ -3,4 +3,5 @@ contract C { } } // ---- -// TypeError 3442: (51-79): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions. +// TypeError 4103: (51-79): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (51-79): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_struct_data_location_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_struct_data_location_memory.sol new file mode 100644 index 000000000000..648e2f74edd1 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_struct_data_location_memory.sol @@ -0,0 +1,8 @@ +pragma experimental ABIEncoderV2; +contract C { + struct S { mapping(uint => uint) a; } + function f(S memory) public {} +} +// ---- +// TypeError 4103: (104-112): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (104-112): Type struct C.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_struct_recusrive_data_location_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_struct_recusrive_data_location_memory.sol new file mode 100644 index 000000000000..350129dff2e4 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_struct_recusrive_data_location_memory.sol @@ -0,0 +1,10 @@ +pragma experimental ABIEncoderV2; +contract C { + struct S { mapping(uint => uint) a; } + struct T { S s; } + struct U { T t; } + function f(U memory) public {} +} +// ---- +// TypeError 4103: (148-156): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. +// TypeError 4061: (148-156): Type struct C.U is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/memory_struct_recursive.sol b/test/libsolidity/syntaxTests/types/mapping/memory_struct_recursive.sol new file mode 100644 index 000000000000..c6f8f48f3c10 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/memory_struct_recursive.sol @@ -0,0 +1,20 @@ +contract Test { + struct S { + T[] t; + } + + struct T { + U[] u; + } + + struct U { + S[] s; + mapping (uint => S) map; + } + + function f() public { + S memory s; + } +} +// ---- +// TypeError 4061: (143-153): Type struct Test.S is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/memory_structs_with_mappings.sol b/test/libsolidity/syntaxTests/types/mapping/memory_structs_with_mappings.sol new file mode 100644 index 000000000000..f583b43142b6 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/memory_structs_with_mappings.sol @@ -0,0 +1,15 @@ +contract Test { + struct S { + uint8 a; + mapping(uint256 => uint256) b; + uint8 c; + } + S s; + + function f() public returns (uint256) { + S memory x; + } +} + +// ---- +// TypeError 4061: (172-182): Type struct Test.S is only valid in storage because it contains a (nested) mapping. From c50f0ae00eb4c8e5a6bab337c38ea36ed3a41be4 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 29 Jun 2020 14:16:07 +0200 Subject: [PATCH 283/479] NatSpec: Implement default inheritance. --- Changelog.md | 1 + docs/natspec-format.rst | 8 +- libsolidity/analysis/DocStringAnalyser.cpp | 37 +++ libsolidity/interface/CompilerStack.cpp | 10 +- test/libsolidity/SolidityNatspecJSON.cpp | 259 ++++++++++++++++++++- 5 files changed, 306 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4733eb6270b7..3a85b2d3c9f2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Language Features: Compiler Features: * NatSpec: Add fields "kind" and "version" to the JSON output. + * NatSpec: Inherit tags from unique base if derived function does not provide any. * Commandline Interface: Prevent some incompatible commandline options from being used together. * NatSpec: Support NatSpec comments on events. diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index ca677697573c..ec774014bb6b 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -122,9 +122,11 @@ documentation and you may read more at Inheritance Notes ----------------- -Currently it is undefined whether a contract with a function having no -NatSpec will inherit the NatSpec of a parent contract/interface for that -same function. +Functions without NatSpec will automatically inherit the documentation of their +base function. Exceptions to this are: + + * When the parameter names are different. + * When there is more than one base function. .. _header-output: diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 86c59a2c0d7b..92989ddac413 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -32,6 +32,33 @@ using namespace solidity; using namespace solidity::langutil; using namespace solidity::frontend; +namespace +{ + +void copyMissingTags(StructurallyDocumentedAnnotation& _target, set const& _baseFunctions) +{ + if (_baseFunctions.size() != 1) + return; + + auto& sourceDoc = dynamic_cast((*_baseFunctions.begin())->annotation()); + + set existingTags; + + for (auto const& iterator: _target.docTags) + existingTags.insert(iterator.first); + + for (auto const& [tag, content]: sourceDoc.docTags) + if (tag != "inheritdoc" && !existingTags.count(tag)) + _target.docTags.emplace(tag, content); +} + +bool parameterNamesEqual(CallableDeclaration const& _a, CallableDeclaration const& _b) +{ + return boost::range::equal(_a.parameters(), _b.parameters(), [](auto const& pa, auto const& pb) { return pa->name() == pb->name(); }); +} + +} + bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit) { auto errorWatcher = m_errorReporter.errorWatcher(); @@ -79,6 +106,9 @@ bool DocStringAnalyser::visit(VariableDeclaration const& _variable) "Documentation tag @title and @author is only allowed on contract definitions. " "It will be disallowed in 0.7.0." ); + + if (_variable.annotation().docTags.empty()) + copyMissingTags(_variable.annotation(), _variable.annotation().baseFunctions); } return false; } @@ -143,6 +173,13 @@ void DocStringAnalyser::handleCallable( parseDocStrings(_node, _annotation, validTags, "functions"); checkParameters(_callable, _node, _annotation); + if ( + _annotation.docTags.empty() && + _callable.annotation().baseFunctions.size() == 1 && + parameterNamesEqual(_callable, **_callable.annotation().baseFunctions.begin()) + ) + copyMissingTags(_annotation, _callable.annotation().baseFunctions); + if (_node.documentation() && _annotation.docTags.count("author") > 0) m_errorReporter.warning( 9843_error, _node.documentation()->location(), diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index eef773095d49..164938c60e27 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -307,11 +307,6 @@ bool CompilerStack::analyze() if (source->ast && !syntaxChecker.checkSyntax(*source->ast)) noErrors = false; - DocStringAnalyser docStringAnalyser(m_errorReporter); - for (Source const* source: m_sourceOrder) - if (source->ast && !docStringAnalyser.analyseDocStrings(*source->ast)) - noErrors = false; - m_globalContext = make_shared(); // We need to keep the same resolver during the whole process. NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter); @@ -367,6 +362,11 @@ bool CompilerStack::analyze() if (!contractLevelChecker.check(*contract)) noErrors = false; + DocStringAnalyser docStringAnalyser(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (source->ast && !docStringAnalyser.analyseDocStrings(*source->ast)) + noErrors = false; + // New we run full type checks that go down to the expression level. This // cannot be done earlier, because we need cross-contract types and information // about whether a contract is abstract for the `new` expression. diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 16b7c8b7ee5a..8edf470f406c 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -1260,6 +1260,263 @@ BOOST_AUTO_TEST_CASE(slash3_slash4) checkNatspec(sourceCode, "test", natspec, true); } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_CASE(dev_default_inherit_variable) +{ + char const *sourceCode = R"( + contract C { + /// @notice Hello world + /// @dev test + function x() virtual external returns (uint) { + return 1; + } + } + + contract D is C { + uint public override x; + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "x()": + { + "details": "test" + } + } + })ABCDEF"; + char const *natspec1 = R"ABCDEF({ + "methods" : {}, + "stateVariables" : + { + "x" : + { + "details" : "test" + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "C", natspec, false); + checkNatspec(sourceCode, "D", natspec1, false); } + +BOOST_AUTO_TEST_CASE(user_default_inherit_variable) +{ + char const *sourceCode = R"( + contract C { + /// @notice Hello world + /// @dev test + function x() virtual external returns (uint) { + return 1; + } + } + + contract D is C { + uint public override x; + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "x()": + { + "notice": "Hello world" + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "C", natspec, true); + checkNatspec(sourceCode, "D", natspec, true); +} + +BOOST_AUTO_TEST_CASE(dev_default_inherit) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// Second line. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract Middle is ERC20 { + function transfer(address to, uint amount) virtual override external returns (bool) + { + return false; + } + } + + contract Token is Middle { + function transfer(address to, uint amount) override external returns (bool) + { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "Middle", natspec, false); + checkNatspec(sourceCode, "Token", natspec, false); +} + +BOOST_AUTO_TEST_CASE(user_default_inherit) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// Second line. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract Middle is ERC20 { + function transfer(address to, uint amount) virtual override external returns (bool) + { + return false; + } + } + + contract Token is Middle { + function transfer(address to, uint amount) override external returns (bool) + { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``. Second line." + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "Middle", natspec, true); + checkNatspec(sourceCode, "Token", natspec, true); +} + +BOOST_AUTO_TEST_CASE(dev_inherit_parameter_mismatch) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract Middle is ERC20 { + function transfer(address to, uint amount) override virtual external returns (bool) { + return false; + } + } + + contract Token is Middle { + function transfer(address too, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": { } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "Middle", natspec, false); + checkNatspec(sourceCode, "Token", natspec2, false); +} + +BOOST_AUTO_TEST_CASE(user_inherit_parameter_mismatch) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract Middle is ERC20 { + function transfer(address to, uint amount) override virtual external returns (bool) { + return false; + } + } + + contract Token is Middle { + function transfer(address too, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``." + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": { } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "Middle", natspec, true); + checkNatspec(sourceCode, "Token", natspec2, true); +} + +} + +BOOST_AUTO_TEST_SUITE_END() From d0ea1f97fdbc62fa119965096623849910097bb7 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 30 Jun 2020 13:34:38 +0200 Subject: [PATCH 284/479] Yul interpreter: Return selfbalance constant for the expression balance(address()) and balance constant otherwise. --- test/libyul/yulInterpreterTests/self_balance.yul | 16 ++++++++++++++++ .../yulInterpreter/EVMInstructionInterpreter.cpp | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/libyul/yulInterpreterTests/self_balance.yul diff --git a/test/libyul/yulInterpreterTests/self_balance.yul b/test/libyul/yulInterpreterTests/self_balance.yul new file mode 100644 index 000000000000..99b1f960c271 --- /dev/null +++ b/test/libyul/yulInterpreterTests/self_balance.yul @@ -0,0 +1,16 @@ +{ + mstore(0, balance(address())) + mstore(0x20, selfbalance()) + mstore(0x40, balance(div(mul(address(), 2), 2))) + mstore(0x60, balance(add(address(), 1))) +} +// ==== +// EVMVersion: >=istanbul +// ---- +// Trace: +// Memory dump: +// 0: 0000000000000000000000000000000000000000000000000000000022223333 +// 20: 0000000000000000000000000000000000000000000000000000000022223333 +// 40: 0000000000000000000000000000000000000000000000000000000022223333 +// 60: 0000000000000000000000000000000000000000000000000000000022222222 +// Storage dump: diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 9c46ea856dce..c17fa33e86b5 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -182,7 +182,10 @@ u256 EVMInstructionInterpreter::eval( case Instruction::ADDRESS: return m_state.address; case Instruction::BALANCE: - return m_state.balance; + if (arg[0] == m_state.address) + return m_state.selfbalance; + else + return m_state.balance; case Instruction::SELFBALANCE: return m_state.selfbalance; case Instruction::ORIGIN: From d7899a31afd8e1132ce362c522e8a47c17fd3832 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 30 Jun 2020 18:59:54 +0200 Subject: [PATCH 285/479] Fix merge conflict resolution. --- libsolidity/analysis/DocStringAnalyser.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index ec6ec84ec132..f47e11b697e9 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -92,21 +92,7 @@ bool DocStringAnalyser::visit(VariableDeclaration const& _variable) if (_variable.isPublic()) parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); else - { parseDocStrings(_variable, _variable.annotation(), validNonPublicTags, "non-public state variables"); - if (_variable.annotation().docTags.count("notice") > 0) - m_errorReporter.warning( - 7816_error, _variable.documentation()->location(), - "Documentation tag on non-public state variables will be disallowed in 0.7.0. " - "You will need to use the @dev tag explicitly." - ); - } - if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) - m_errorReporter.warning( - 8532_error, _variable.documentation()->location(), - "Documentation tag @title and @author is only allowed on contract definitions. " - "It will be disallowed in 0.7.0." - ); if (_variable.annotation().docTags.empty()) copyMissingTags(_variable.annotation(), _variable.annotation().baseFunctions); From b82590322c7cdabc048f102021a247a1b2a777ec Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 30 Jun 2020 13:26:50 +0200 Subject: [PATCH 286/479] yul proto fuzzer: Remove assertion that no errors/warnings while parsing yul code --- test/tools/ossfuzz/yulProtoFuzzer.cpp | 14 +++++++------- test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/tools/ossfuzz/yulProtoFuzzer.cpp b/test/tools/ossfuzz/yulProtoFuzzer.cpp index b834ddc92a7b..b78f6fc5c8bf 100644 --- a/test/tools/ossfuzz/yulProtoFuzzer.cpp +++ b/test/tools/ossfuzz/yulProtoFuzzer.cpp @@ -59,13 +59,13 @@ DEFINE_PROTO_FUZZER(Program const& _input) ); // Parse protobuf mutated YUL code - if (!stack.parseAndAnalyze("source", yul_source)) - return; - - yulAssert(stack.errors().empty(), "Parsed successfully but had errors."); - - if (!stack.parserResult()->code || !stack.parserResult()->analysisInfo) - return; + if ( + !stack.parseAndAnalyze("source", yul_source) || + !stack.parserResult()->code || + !stack.parserResult()->analysisInfo || + !Error::containsOnlyWarnings(stack.errors()) + ) + yulAssert(false, "Proto fuzzer generated malformed program"); // Optimize stack.optimize(); diff --git a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp index 9dbc518bef57..fd0f2e0a52c4 100644 --- a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp @@ -77,8 +77,12 @@ DEFINE_PROTO_FUZZER(Program const& _input) ); // Parse protobuf mutated YUL code - if (!stack.parseAndAnalyze("source", yul_source) || !stack.parserResult()->code || - !stack.parserResult()->analysisInfo) + if ( + !stack.parseAndAnalyze("source", yul_source) || + !stack.parserResult()->code || + !stack.parserResult()->analysisInfo || + !Error::containsOnlyWarnings(stack.errors()) + ) { printErrors(std::cout, stack.errors()); yulAssert(false, "Proto fuzzer generated malformed program"); From acd42a08c1b1fe0f69dbcd9c97ac75cc0b1b352b Mon Sep 17 00:00:00 2001 From: a3d4 Date: Wed, 1 Jul 2020 04:42:37 +0200 Subject: [PATCH 287/479] Add a missing DocStringParser error to tests. --- libsolidity/parsing/DocStringParser.cpp | 25 +++++-------------- libsolidity/parsing/DocStringParser.h | 1 - .../natspec/docstring_empty_tag.sol | 2 +- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index 33cdbd937bbd..9f6f13f945d7 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -94,19 +94,12 @@ void DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor { // we found a tag auto tagNameEndPos = firstWhitespaceOrNewline(tagPos, end); - if (tagNameEndPos == end) - { - m_errorReporter->docstringParsingError( - 9222_error, - "End of tag " + string(tagPos, tagNameEndPos) + " not found" - ); - break; - } - - currPos = parseDocTag(tagNameEndPos + 1, end, string(tagPos + 1, tagNameEndPos)); + auto tagName = string(tagPos + 1, tagNameEndPos); + auto tagDataPos = (tagNameEndPos != end) ? tagNameEndPos + 1 : tagNameEndPos; + currPos = parseDocTag(tagDataPos, end, tagName); } else if (!!m_lastTag) // continuation of the previous tag - currPos = appendDocTag(currPos, end); + currPos = parseDocTagLine(currPos, end, true); else if (currPos != end) { // if it begins without a tag then consider it as @notice @@ -127,7 +120,7 @@ DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, boo { solAssert(!!m_lastTag, ""); auto nlPos = find(_pos, _end, '\n'); - if (_appending && _pos < _end && *_pos != ' ' && *_pos != '\t') + if (_appending && _pos != _end && *_pos != ' ' && *_pos != '\t') m_lastTag->content += " "; else if (!_appending) _pos = skipWhitespace(_pos, _end); @@ -179,13 +172,7 @@ DocStringParser::iter DocStringParser::parseDocTag(iter _pos, iter _end, string } } else - return appendDocTag(_pos, _end); -} - -DocStringParser::iter DocStringParser::appendDocTag(iter _pos, iter _end) -{ - solAssert(!!m_lastTag, ""); - return parseDocTagLine(_pos, _end, true); + return parseDocTagLine(_pos, _end, true); } void DocStringParser::newTag(string const& _tagName) diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index eaf18503b900..d5ebd2383814 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -50,7 +50,6 @@ class DocStringParser iter parseDocTagParam(iter _pos, iter _end); iter appendDocTagParam(iter _pos, iter _end); void parseDocString(std::string const& _string); - iter appendDocTag(iter _pos, iter _end); /// Parses the doc tag named @a _tag, adds it to m_docTags and returns the position /// after the tag. iter parseDocTag(iter _pos, iter _end, std::string const& _tag); diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol index e014104da844..5ab6b826022b 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol @@ -3,4 +3,4 @@ abstract contract C { function vote(uint id) public {} } // ---- -// DocstringParsingError 9222: End of tag @param not found +// DocstringParsingError 3335: No param name given From 1a0391bceb81137b46b15b8c7f81004b6e99240e Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 1 Jul 2020 09:46:06 +0200 Subject: [PATCH 288/479] Fuzzer: Add a specialized StackTooDeepError Exception that is caught in the fuzzing harness --- liblangutil/Exceptions.h | 1 + libsolidity/codegen/ArrayUtils.cpp | 3 ++- libsolidity/codegen/CompilerContext.cpp | 2 +- libsolidity/codegen/CompilerUtils.cpp | 29 +++++++++++++++++----- libsolidity/codegen/ContractCompiler.cpp | 6 ++--- libsolidity/codegen/ExpressionCompiler.cpp | 4 +-- libsolidity/codegen/LValue.cpp | 4 +-- libyul/backends/evm/AsmCodeGen.cpp | 3 ++- test/libsolidity/StandardCompiler.cpp | 2 +- test/tools/fuzzer_common.cpp | 3 +++ 10 files changed, 40 insertions(+), 17 deletions(-) diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 083a5e3cdf80..fef09cbfa45e 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -38,6 +38,7 @@ class Error; using ErrorList = std::vector>; struct CompilerError: virtual util::Exception {}; +struct StackTooDeepError: virtual CompilerError {}; struct InternalCompilerError: virtual util::Exception {}; struct FatalError: virtual util::Exception {}; struct UnimplementedFeatureError: virtual util::Exception {}; diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index 9f12f648f8c6..eebe03e53849 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -226,8 +226,9 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons else solUnimplemented("Copying of type " + _sourceType.toString(false) + " to storage not yet supported."); // stack: target_ref target_data_end source_data_pos target_data_pos source_data_end [target_byte_offset] [source_byte_offset] ... - solAssert( + assertThrow( 2 + byteOffsetSize + sourceBaseType->sizeOnStack() <= 16, + StackTooDeepError, "Stack too deep, try removing local variables." ); // fetch target storage reference diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 3af9a7c94d2b..4a9b1918d356 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -404,7 +404,7 @@ void CompilerContext::appendInlineAssembly( stackDiff -= 1; if (stackDiff < 1 || stackDiff > 16) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_identifier.location) << util::errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.") ); diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index c3e81d13a860..b3fc9da2efa2 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -455,7 +455,11 @@ void CompilerUtils::encodeToMemory( // leave end_of_mem as dyn head pointer m_context << Instruction::DUP1 << u256(32) << Instruction::ADD; dynPointers++; - solAssert((argSize + dynPointers) < 16, "Stack too deep, try using fewer variables."); + assertThrow( + (argSize + dynPointers) < 16, + StackTooDeepError, + "Stack too deep, try using fewer variables." + ); } else { @@ -507,8 +511,9 @@ void CompilerUtils::encodeToMemory( if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace) { // copy tail pointer (=mem_end - mem_start) to memory - solAssert( + assertThrow( (2 + dynPointers) <= 16, + StackTooDeepError, "Stack too deep(" + to_string(2 + dynPointers) + "), try using fewer variables." ); m_context << dupInstruction(2 + dynPointers) << Instruction::DUP2; @@ -1290,7 +1295,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) // move variable starting from its top end in the stack if (stackPosition - size + 1 > 16) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_variable.location()) << util::errinfo_comment("Stack too deep, try removing local variables.") ); @@ -1300,7 +1305,11 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize) { - solAssert(_stackDepth <= 16, "Stack too deep, try removing local variables."); + assertThrow( + _stackDepth <= 16, + StackTooDeepError, + "Stack too deep, try removing local variables." + ); for (unsigned i = 0; i < _itemSize; ++i) m_context << dupInstruction(_stackDepth); } @@ -1322,14 +1331,22 @@ void CompilerUtils::moveIntoStack(unsigned _stackDepth, unsigned _itemSize) void CompilerUtils::rotateStackUp(unsigned _items) { - solAssert(_items - 1 <= 16, "Stack too deep, try removing local variables."); + assertThrow( + _items - 1 <= 16, + StackTooDeepError, + "Stack too deep, try removing local variables." + ); for (unsigned i = 1; i < _items; ++i) m_context << swapInstruction(_items - i); } void CompilerUtils::rotateStackDown(unsigned _items) { - solAssert(_items - 1 <= 16, "Stack too deep, try removing local variables."); + assertThrow( + _items - 1 <= 16, + StackTooDeepError, + "Stack too deep, try removing local variables." + ); for (unsigned i = 1; i < _items; ++i) m_context << swapInstruction(i); } diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 6f8603a51230..3d1b41e41ff7 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -634,7 +634,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) if (stackLayout.size() > 17) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_function.location()) << errinfo_comment("Stack too deep, try removing local variables.") ); @@ -798,7 +798,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) solAssert(variable->type()->sizeOnStack() == 1, ""); if (stackDiff < 1 || stackDiff > 16) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_inlineAssembly.location()) << errinfo_comment("Stack too deep, try removing local variables.") ); @@ -831,7 +831,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) unsigned stackDiff = static_cast(_assembly.stackHeight()) - m_context.baseStackOffsetOfVariable(*variable) - 1; if (stackDiff > 16 || stackDiff < 1) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_inlineAssembly.location()) << errinfo_comment("Stack too deep(" + to_string(stackDiff) + "), try removing local variables.") ); diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index cbacd0a7e901..ffa8ced4c426 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -226,7 +226,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& solAssert(retSizeOnStack == utils().sizeOnStack(returnTypes), ""); if (retSizeOnStack > 15) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_varDecl.location()) << errinfo_comment("Stack too deep.") ); @@ -308,7 +308,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) { if (itemSize + lvalueSize > 16) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_assignment.location()) << errinfo_comment("Stack too deep, try removing local variables.") ); diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 3a04d6f92529..798428098a1c 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -47,7 +47,7 @@ void StackVariable::retrieveValue(SourceLocation const& _location, bool) const unsigned stackPos = m_context.baseToCurrentStackOffset(m_baseStackOffset); if (stackPos + 1 > 16) //@todo correct this by fetching earlier or moving to memory BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_location) << errinfo_comment("Stack too deep, try removing local variables.") ); @@ -61,7 +61,7 @@ void StackVariable::storeValue(Type const&, SourceLocation const& _location, boo unsigned stackDiff = m_context.baseToCurrentStackOffset(m_baseStackOffset) - m_size + 1; if (stackDiff > 16) BOOST_THROW_EXCEPTION( - CompilerError() << + StackTooDeepError() << errinfo_sourceLocation(_location) << errinfo_comment("Stack too deep, try removing local variables.") ); diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 6775214e8011..5827f6524844 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -218,8 +218,9 @@ void CodeGenerator::assemble( } catch (StackTooDeepError const& _e) { - yulAssert( + assertThrow( false, + langutil::StackTooDeepError, "Stack too deep when compiling inline assembly" + (_e.comment() ? ": " + *_e.comment() : ".") ); diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index e4f77b581f2d..0b2098097616 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -1242,7 +1242,7 @@ BOOST_AUTO_TEST_CASE(use_stack_optimization) BOOST_CHECK(result["errors"][0]["severity"] == "error"); BOOST_REQUIRE(result["errors"][0]["message"].isString()); BOOST_CHECK(result["errors"][0]["message"].asString().find("Stack too deep when compiling inline assembly") != std::string::npos); - BOOST_CHECK(result["errors"][0]["type"] == "YulException"); + BOOST_CHECK(result["errors"][0]["type"] == "CompilerError"); } BOOST_AUTO_TEST_CASE(standard_output_selection_wildcard) diff --git a/test/tools/fuzzer_common.cpp b/test/tools/fuzzer_common.cpp index fa167c437bc6..ac2e13775f34 100644 --- a/test/tools/fuzzer_common.cpp +++ b/test/tools/fuzzer_common.cpp @@ -96,6 +96,9 @@ void FuzzerUtil::testCompiler(string const& _input, bool _optimize) catch (UnimplementedFeatureError const&) { } + catch (StackTooDeepError const&) + { + } } void FuzzerUtil::runCompiler(string const& _input, bool _quiet) From e0b1d8b9bd149cd7c8634caacf4f896dae082411 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 29 Jun 2020 19:32:32 +0200 Subject: [PATCH 289/479] Make DataFlowAnalyzer aware of storage / memory slot after sload / mload. --- Changelog.md | 1 + libyul/optimiser/DataFlowAnalyzer.cpp | 37 +++++++++++++++++++ libyul/optimiser/DataFlowAnalyzer.h | 9 +++++ .../loadResolver/double_mload.yul | 13 +++++++ .../double_mload_with_other_reassignment.yul | 16 ++++++++ .../double_mload_with_reassignment.yul | 16 ++++++++ .../merge_mload_with_known_distance.yul | 19 ++++++++++ .../loadResolver/merge_mload_with_rewrite.yul | 22 +++++++++++ .../merge_mload_without_rewrite.yul | 19 ++++++++++ .../loadResolver/mload_self.yul | 15 ++++++++ .../loadResolver/multi_sload_loop.yul | 30 +++++++++++++++ 11 files changed, 197 insertions(+) create mode 100644 test/libyul/yulOptimizerTests/loadResolver/double_mload.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/double_mload_with_other_reassignment.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/double_mload_with_reassignment.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_rewrite.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/merge_mload_without_rewrite.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/mload_self.yul create mode 100644 test/libyul/yulOptimizerTests/loadResolver/multi_sload_loop.yul diff --git a/Changelog.md b/Changelog.md index 9e9353c4eb5b..4a590a5f3143 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ Compiler Features: * NatSpec: Inherit tags from unique base if derived function does not provide any. * Commandline Interface: Prevent some incompatible commandline options from being used together. * NatSpec: Support NatSpec comments on events. + * Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``. Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. diff --git a/libyul/optimiser/DataFlowAnalyzer.cpp b/libyul/optimiser/DataFlowAnalyzer.cpp index d78d7870de8e..6755500b3a09 100644 --- a/libyul/optimiser/DataFlowAnalyzer.cpp +++ b/libyul/optimiser/DataFlowAnalyzer.cpp @@ -253,6 +253,21 @@ void DataFlowAnalyzer::handleAssignment(set const& _variables, Expres // assignment to slot contents denoted by "name" m_memory.eraseValue(name); } + + if (_value && _variables.size() == 1) + { + YulString variable = *_variables.begin(); + if (!movableChecker.referencedVariables().count(variable)) + { + // This might erase additional knowledge about the slot. + // On the other hand, if we knew the value in the slot + // already, then the sload() / mload() would have been replaced by a variable anyway. + if (auto key = isSimpleLoad(evmasm::Instruction::MLOAD, *_value)) + m_memory.set(*key, variable); + else if (auto key = isSimpleLoad(evmasm::Instruction::SLOAD, *_value)) + m_storage.set(*key, variable); + } + } } void DataFlowAnalyzer::pushScope(bool _functionScope) @@ -401,3 +416,25 @@ std::optional> DataFlowAnalyzer::isSimpleStore( return {}; } +std::optional DataFlowAnalyzer::isSimpleLoad( + evmasm::Instruction _load, + Expression const& _expression +) const +{ + yulAssert( + _load == evmasm::Instruction::MLOAD || + _load == evmasm::Instruction::SLOAD, + "" + ); + if (holds_alternative(_expression)) + { + FunctionCall const& funCall = std::get(_expression); + if (EVMDialect const* dialect = dynamic_cast(&m_dialect)) + if (auto const* builtin = dialect->builtin(funCall.functionName.name)) + if (builtin->instruction == _load) + if (holds_alternative(funCall.arguments.at(0))) + return std::get(funCall.arguments.at(0)).name; + } + return {}; +} + diff --git a/libyul/optimiser/DataFlowAnalyzer.h b/libyul/optimiser/DataFlowAnalyzer.h index d17ad4632a89..d3cb8d28048f 100644 --- a/libyul/optimiser/DataFlowAnalyzer.h +++ b/libyul/optimiser/DataFlowAnalyzer.h @@ -142,11 +142,20 @@ class DataFlowAnalyzer: public ASTModifier /// Returns true iff the variable is in scope. bool inScope(YulString _variableName) const; + /// Checks if the statement is sstore(a, b) / mstore(a, b) + /// where a and b are variables and returns these variables in that case. std::optional> isSimpleStore( evmasm::Instruction _store, ExpressionStatement const& _statement ) const; + /// Checks if the expression is sload(a) / mload(a) + /// where a is a variable and returns the variable in that case. + std::optional isSimpleLoad( + evmasm::Instruction _load, + Expression const& _expression + ) const; + Dialect const& m_dialect; /// Side-effects of user-defined functions. Worst-case side-effects are assumed /// if this is not provided or the function is not found. diff --git a/test/libyul/yulOptimizerTests/loadResolver/double_mload.yul b/test/libyul/yulOptimizerTests/loadResolver/double_mload.yul new file mode 100644 index 000000000000..b75f9c07b92e --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/double_mload.yul @@ -0,0 +1,13 @@ +{ + let x := calldataload(0) + let a := mload(x) + let b := mload(x) + sstore(a, b) +} +// ---- +// step: loadResolver +// +// { +// let a := mload(calldataload(0)) +// sstore(a, a) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_other_reassignment.yul b/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_other_reassignment.yul new file mode 100644 index 000000000000..19d21742317a --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_other_reassignment.yul @@ -0,0 +1,16 @@ +{ + let x := calldataload(0) + let a := mload(x) + x := 7 + let b := mload(x) + sstore(a, b) +} +// ---- +// step: loadResolver +// +// { +// let x := calldataload(0) +// let a := mload(x) +// x := 7 +// sstore(a, mload(x)) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_reassignment.yul b/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_reassignment.yul new file mode 100644 index 000000000000..b5c2f1126545 --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/double_mload_with_reassignment.yul @@ -0,0 +1,16 @@ +{ + let x := calldataload(0) + let a := mload(x) + a := 7 + let b := mload(x) + sstore(a, b) +} +// ---- +// step: loadResolver +// +// { +// let x := calldataload(0) +// let a := mload(x) +// a := 7 +// sstore(a, mload(x)) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul new file mode 100644 index 000000000000..cde3ec0e6b5e --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul @@ -0,0 +1,19 @@ +{ + let x := mload(calldataload(0)) + if calldataload(1) { + mstore(add(calldataload(0), 0x20), 1) + } + let t := mload(add(calldataload(0), 0x20)) + let q := mload(calldataload(0)) + sstore(t, q) +} +// ---- +// step: loadResolver +// +// { +// let _2 := calldataload(0) +// let x := mload(_2) +// let _3 := 1 +// if calldataload(_3) { mstore(add(_2, 0x20), _3) } +// sstore(mload(add(_2, 0x20)), x) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_rewrite.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_rewrite.yul new file mode 100644 index 000000000000..5c09b9b430a3 --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_rewrite.yul @@ -0,0 +1,22 @@ +{ + let b := mload(2) + if calldataload(1) { + mstore(2, 7) + // Re-writing the old value, should allow to eliminate the load below. + mstore(2, b) + } + sstore(0, mload(2)) +} +// ---- +// step: loadResolver +// +// { +// let _1 := 2 +// let b := mload(_1) +// if calldataload(1) +// { +// mstore(_1, 7) +// mstore(_1, b) +// } +// sstore(0, b) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_mload_without_rewrite.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_without_rewrite.yul new file mode 100644 index 000000000000..f6d0bdc7d1de --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_without_rewrite.yul @@ -0,0 +1,19 @@ +{ + let b := mload(2) + sstore(0, b) + if calldataload(1) { + mstore(2, 7) + } + sstore(0, mload(2)) +} +// ---- +// step: loadResolver +// +// { +// let _1 := 2 +// let b := mload(_1) +// let _2 := 0 +// sstore(_2, b) +// if calldataload(1) { mstore(_1, 7) } +// sstore(_2, mload(_1)) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/mload_self.yul b/test/libyul/yulOptimizerTests/loadResolver/mload_self.yul new file mode 100644 index 000000000000..e299bcbb9fef --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/mload_self.yul @@ -0,0 +1,15 @@ +{ + let x := calldataload(0) + x := mload(x) + let y := mload(x) + sstore(0, y) +} +// ---- +// step: loadResolver +// +// { +// let _1 := 0 +// let x := calldataload(_1) +// x := mload(x) +// sstore(_1, mload(x)) +// } diff --git a/test/libyul/yulOptimizerTests/loadResolver/multi_sload_loop.yul b/test/libyul/yulOptimizerTests/loadResolver/multi_sload_loop.yul new file mode 100644 index 000000000000..9aecad529061 --- /dev/null +++ b/test/libyul/yulOptimizerTests/loadResolver/multi_sload_loop.yul @@ -0,0 +1,30 @@ +{ + let x := calldataload(0) + let len := sload(x) + let sum + for { let i := 0} lt(i, sload(x)) { i := add(i, 1) } { + let p := add(x, add(i, 1)) + if gt(p, sload(x)) { revert(0, 0) } + sum := add(sum, sload(p)) + } + mstore(0, sum) + return(0, 0x20) +} +// ---- +// step: loadResolver +// +// { +// let _1 := 0 +// let x := calldataload(_1) +// let len := sload(x) +// let sum +// let i := _1 +// for { } lt(i, len) { i := add(i, 1) } +// { +// let p := add(add(x, i), 1) +// if gt(p, len) { revert(_1, _1) } +// sum := add(sum, sload(p)) +// } +// mstore(_1, sum) +// return(_1, 0x20) +// } From 5160f89c1bae4978e9de0a5711b90747fb1a1a95 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 14 May 2020 20:09:52 +0200 Subject: [PATCH 290/479] [SMTChecker] Support to external calls to unknown code --- Changelog.md | 2 + libsolidity/formal/CHC.cpp | 146 +++++++++++++++--- libsolidity/formal/CHC.h | 17 +- .../external_calls/external.sol | 20 +++ .../external_calls/external_hash.sol | 29 ++++ .../external_hash_known_code_pure.sol | 29 ++++ .../external_hash_known_code_state.sol | 38 +++++ ...ernal_hash_known_code_state_reentrancy.sol | 32 ++++ ...h_known_code_state_reentrancy_indirect.sol | 47 ++++++ ...ash_known_code_state_reentrancy_unsafe.sol | 39 +++++ .../external_hash_known_code_state_unsafe.sol | 43 ++++++ .../external_calls/external_inc.sol | 22 +++ .../external_calls/external_inc1_inc2.sol | 28 ++++ .../external_calls/external_safe.sol | 18 +++ .../external_calls/external_single_inc.sol | 26 ++++ .../smtCheckerTests/external_calls/mutex.sol | 28 ++++ .../external_calls/mutex_f_no_guard.sol | 30 ++++ .../functions/functions_external_1.sol | 1 - .../functions/functions_external_3.sol | 1 - .../functions/functions_external_4.sol | 1 - .../loops/for_1_false_positive.sol | 2 + .../types/address_staticcall.sol | 3 - 22 files changed, 569 insertions(+), 33 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_inc.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_safe.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/mutex.sol create mode 100644 test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol diff --git a/Changelog.md b/Changelog.md index 4a590a5f3143..02da20254caa 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,8 @@ Compiler Features: * Commandline Interface: Prevent some incompatible commandline options from being used together. * NatSpec: Support NatSpec comments on events. * Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``. + * SMTChecker: Support to external calls to unknown code and to known view/pure functions. + Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 791a4f41d2b8..2609e356e36b 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -197,8 +197,11 @@ void CHC::endVisit(ContractDefinition const& _contract) bool CHC::visit(FunctionDefinition const& _function) { - if (!shouldVisit(_function)) + if (!_function.isImplemented()) + { + connectBlocks(genesis(), summary(_function)); return false; + } // This is the case for base constructor inlining. if (m_currentFunction) @@ -243,7 +246,7 @@ bool CHC::visit(FunctionDefinition const& _function) void CHC::endVisit(FunctionDefinition const& _function) { - if (!shouldVisit(_function)) + if (!_function.isImplemented()) return; // This is the case for base constructor inlining. @@ -474,11 +477,14 @@ void CHC::endVisit(FunctionCall const& _funCall) internalFunctionCall(_funCall); break; case FunctionType::Kind::External: + case FunctionType::Kind::BareStaticCall: + externalFunctionCall(_funCall); + SMTEncoder::endVisit(_funCall); + break; case FunctionType::Kind::DelegateCall: case FunctionType::Kind::BareCall: case FunctionType::Kind::BareCallCode: case FunctionType::Kind::BareDelegateCall: - case FunctionType::Kind::BareStaticCall: case FunctionType::Kind::Creation: case FunctionType::Kind::KECCAK256: case FunctionType::Kind::ECRecover: @@ -574,6 +580,33 @@ void CHC::internalFunctionCall(FunctionCall const& _funCall) m_context.addAssertion(m_error.currentValue() == previousError); } +void CHC::externalFunctionCall(FunctionCall const& _funCall) +{ + solAssert(m_currentContract, ""); + + FunctionType const& funType = dynamic_cast(*_funCall.expression().annotation().type); + auto kind = funType.kind(); + solAssert(kind == FunctionType::Kind::External || kind == FunctionType::Kind::BareStaticCall, ""); + + auto const* function = functionCallToDefinition(_funCall); + if (!function) + return; + + auto preCallState = currentStateVariables(); + bool noStateChanges = kind == FunctionType::Kind::BareStaticCall || + function->stateMutability() == StateMutability::Pure || + function->stateMutability() == StateMutability::View; + if (!noStateChanges) + for (auto const* var: m_stateVariables) + m_context.variable(*var)->increaseIndex(); + + auto nondet = (*m_nondetInterfaces.at(m_currentContract))(preCallState + currentStateVariables()); + m_context.addAssertion(nondet); + m_context.addAssertion(predicate(_funCall)); + + m_context.addAssertion(m_error.currentValue() == 0); +} + void CHC::unknownFunctionCall(FunctionCall const&) { /// Function calls are not handled at the moment, @@ -651,11 +684,6 @@ void CHC::clearIndices(ContractDefinition const* _contract, FunctionDefinition c } } -bool CHC::shouldVisit(FunctionDefinition const& _function) const -{ - return _function.isImplemented(); -} - void CHC::setCurrentBlock( smt::SymbolicFunctionVariable const& _block, vector const* _arguments @@ -709,17 +737,30 @@ smtutil::SortPointer CHC::constructorSort() } smtutil::SortPointer CHC::interfaceSort() +{ + solAssert(m_currentContract, ""); + return interfaceSort(*m_currentContract); +} + +smtutil::SortPointer CHC::nondetInterfaceSort() +{ + solAssert(m_currentContract, ""); + return nondetInterfaceSort(*m_currentContract); +} + +smtutil::SortPointer CHC::interfaceSort(ContractDefinition const& _contract) { return make_shared( - m_stateSorts, + stateSorts(_contract), smtutil::SortProvider::boolSort ); } -smtutil::SortPointer CHC::interfaceSort(ContractDefinition const& _contract) +smtutil::SortPointer CHC::nondetInterfaceSort(ContractDefinition const& _contract) { + auto sorts = stateSorts(_contract); return make_shared( - stateSorts(_contract), + sorts + sorts, smtutil::SortProvider::boolSort ); } @@ -802,11 +843,47 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source) { string suffix = base->name() + "_" + to_string(base->id()); m_interfaces[base] = createSymbolicBlock(interfaceSort(*base), "interface_" + suffix); + m_nondetInterfaces[base] = createSymbolicBlock(nondetInterfaceSort(*base), "nondet_interface_" + suffix); + for (auto const* var: stateVariablesIncludingInheritedAndPrivate(*base)) if (!m_context.knownVariable(*var)) createVariable(*var); + + /// Base nondeterministic interface that allows + /// 0 steps to be taken, used as base for the inductive + /// rule for each function. + auto const& iface = *m_nondetInterfaces.at(base); + auto state0 = stateVariablesAtIndex(0, *base); + addRule(iface(state0 + state0), "base_nondet"); + for (auto const* function: base->definedFunctions()) + { + for (auto var: function->parameters()) + createVariable(*var); + for (auto var: function->returnParameters()) + createVariable(*var); + for (auto const* var: function->localVariables()) + createVariable(*var); + m_summaries[contract].emplace(function, createSummaryBlock(*function, *contract)); + + if (!base->isLibrary() && !base->isInterface() && !function->isConstructor()) + { + auto state1 = stateVariablesAtIndex(1, *base); + auto state2 = stateVariablesAtIndex(2, *base); + + auto nondetPre = iface(state0 + state1); + auto nondetPost = iface(state0 + state2); + + vector args{m_error.currentValue()}; + args += state1 + + applyMap(function->parameters(), [this](auto _var) { return valueAtIndex(*_var, 0); }) + + state2 + + applyMap(function->returnParameters(), [this](auto _var) { return valueAtIndex(*_var, 1); }); + + connectBlocks(nondetPre, nondetPost, (*m_summaries.at(base).at(function))(args)); + } + } } } @@ -842,15 +919,21 @@ smtutil::Expression CHC::summary(ContractDefinition const&) ); } -smtutil::Expression CHC::summary(FunctionDefinition const& _function) +smtutil::Expression CHC::summary(FunctionDefinition const& _function, ContractDefinition const& _contract) { vector args{m_error.currentValue()}; auto contract = _function.annotation().contract; - args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : initialStateVariables(); + args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : initialStateVariables(_contract); args += applyMap(_function.parameters(), [this](auto _var) { return valueAtIndex(*_var, 0); }); - args += contract->isLibrary() ? stateVariablesAtIndex(1, *contract) : currentStateVariables(); + args += contract->isLibrary() ? stateVariablesAtIndex(1, *contract) : currentStateVariables(_contract); args += applyMap(_function.returnParameters(), [this](auto _var) { return currentValue(*_var); }); - return (*m_summaries.at(m_currentContract).at(&_function))(args); + return (*m_summaries.at(&_contract).at(&_function))(args); +} + +smtutil::Expression CHC::summary(FunctionDefinition const& _function) +{ + solAssert(m_currentContract, ""); + return summary(_function, *m_currentContract); } unique_ptr CHC::createBlock(ASTNode const* _node, string const& _prefix) @@ -893,13 +976,18 @@ vector CHC::initialStateVariables() return stateVariablesAtIndex(0); } -vector CHC::stateVariablesAtIndex(unsigned _index) +vector CHC::initialStateVariables(ContractDefinition const& _contract) +{ + return stateVariablesAtIndex(0, _contract); +} + +vector CHC::stateVariablesAtIndex(int _index) { solAssert(m_currentContract, ""); - return applyMap(m_stateVariables, [&](auto _var) { return valueAtIndex(*_var, _index); }); + return stateVariablesAtIndex(_index, *m_currentContract); } -vector CHC::stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract) +vector CHC::stateVariablesAtIndex(int _index, ContractDefinition const& _contract) { return applyMap( stateVariablesIncludingInheritedAndPrivate(_contract), @@ -910,7 +998,12 @@ vector CHC::stateVariablesAtIndex(unsigned _index, Contract vector CHC::currentStateVariables() { solAssert(m_currentContract, ""); - return applyMap(m_stateVariables, [this](auto _var) { return currentValue(*_var); }); + return currentStateVariables(*m_currentContract); +} + +vector CHC::currentStateVariables(ContractDefinition const& _contract) +{ + return applyMap(stateVariablesIncludingInheritedAndPrivate(_contract), [this](auto _var) { return currentValue(*_var); }); } vector CHC::currentFunctionVariables() @@ -978,12 +1071,17 @@ smtutil::Expression CHC::predicate(FunctionCall const& _funCall) m_error.increaseIndex(); vector args{m_error.currentValue()}; auto const* contract = function->annotation().contract; + FunctionType const& funType = dynamic_cast(*_funCall.expression().annotation().type); + bool otherContract = contract->isLibrary() || + funType.kind() == FunctionType::Kind::External || + funType.kind() == FunctionType::Kind::BareStaticCall; - args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : currentStateVariables(); + args += otherContract ? stateVariablesAtIndex(0, *contract) : currentStateVariables(); args += symbolicArguments(_funCall); - for (auto const& var: m_stateVariables) - m_context.variable(*var)->increaseIndex(); - args += contract->isLibrary() ? stateVariablesAtIndex(1, *contract) : currentStateVariables(); + if (!otherContract) + for (auto const& var: m_stateVariables) + m_context.variable(*var)->increaseIndex(); + args += otherContract ? stateVariablesAtIndex(1, *contract) : currentStateVariables(); auto const& returnParams = function->returnParameters(); for (auto param: returnParams) @@ -993,7 +1091,7 @@ smtutil::Expression CHC::predicate(FunctionCall const& _funCall) createVariable(*param); args += applyMap(function->returnParameters(), [this](auto _var) { return currentValue(*_var); }); - if (contract->isLibrary()) + if (otherContract) return (*m_summaries.at(contract).at(function))(args); solAssert(m_currentContract, ""); diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index b52ce6667382..dcba90606c91 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -77,6 +77,7 @@ class CHC: public SMTEncoder void visitAssert(FunctionCall const& _funCall); void internalFunctionCall(FunctionCall const& _funCall); + void externalFunctionCall(FunctionCall const& _funCall); void unknownFunctionCall(FunctionCall const& _funCall); void makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) override; //@} @@ -95,7 +96,6 @@ class CHC: public SMTEncoder void resetContractAnalysis(); void eraseKnowledge(); void clearIndices(ContractDefinition const* _contract, FunctionDefinition const* _function = nullptr) override; - bool shouldVisit(FunctionDefinition const& _function) const; void setCurrentBlock(smt::SymbolicFunctionVariable const& _block, std::vector const* _arguments = nullptr); std::set transactionAssertions(ASTNode const* _txRoot); static std::vector stateVariablesIncludingInheritedAndPrivate(ContractDefinition const& _contract); @@ -106,7 +106,9 @@ class CHC: public SMTEncoder static std::vector stateSorts(ContractDefinition const& _contract); smtutil::SortPointer constructorSort(); smtutil::SortPointer interfaceSort(); + smtutil::SortPointer nondetInterfaceSort(); static smtutil::SortPointer interfaceSort(ContractDefinition const& _const); + static smtutil::SortPointer nondetInterfaceSort(ContractDefinition const& _const); smtutil::SortPointer arity0FunctionSort(); smtutil::SortPointer sort(FunctionDefinition const& _function); smtutil::SortPointer sort(ASTNode const* _block); @@ -149,10 +151,12 @@ class CHC: public SMTEncoder /// @returns the symbolic values of the state variables at the beginning /// of the current transaction. std::vector initialStateVariables(); - std::vector stateVariablesAtIndex(unsigned _index); - std::vector stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract); + std::vector initialStateVariables(ContractDefinition const& _contract); + std::vector stateVariablesAtIndex(int _index); + std::vector stateVariablesAtIndex(int _index, ContractDefinition const& _contract); /// @returns the current symbolic values of the current state variables. std::vector currentStateVariables(); + std::vector currentStateVariables(ContractDefinition const& _contract); /// @returns the current symbolic values of the current function's /// input and output parameters. @@ -173,6 +177,7 @@ class CHC: public SMTEncoder smtutil::Expression summary(ContractDefinition const& _contract); /// @returns a predicate that defines a function summary. smtutil::Expression summary(FunctionDefinition const& _function); + smtutil::Expression summary(FunctionDefinition const& _function, ContractDefinition const& _contract); //@} /// Solver related. @@ -212,6 +217,12 @@ class CHC: public SMTEncoder /// Single entry block for all functions. std::map> m_interfaces; + /// Nondeterministic interfaces. + /// These are used when the analyzed contract makes external calls to unknown code, + /// which means that the analyzed contract can potentially be called + /// nondeterministically. + std::map> m_nondetInterfaces; + /// Artificial Error predicate. /// Single error block for all assertions. std::unique_ptr m_errorPredicate; diff --git a/test/libsolidity/smtCheckerTests/external_calls/external.sol b/test/libsolidity/smtCheckerTests/external_calls/external.sol new file mode 100644 index 000000000000..9fbde057a7e5 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external.sol @@ -0,0 +1,20 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + D d; + function f() public { + if (x < 10) + ++x; + } + function g() public { + d.d(); + assert(x < 10); + } +} +// ---- +// Warning 4661: (200-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol new file mode 100644 index 000000000000..c0e9a7965d91 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol @@ -0,0 +1,29 @@ +pragma experimental SMTChecker; + +abstract contract Crypto { + function hash(bytes32) external pure virtual returns (bytes32); +} + +contract C { + address owner; + bytes32 sig_1; + bytes32 sig_2; + Crypto d; + + constructor() public { + owner = msg.sender; + } + + function f1(bytes32 _msg) public { + address prevOwner = owner; + sig_1 = d.hash(_msg); + sig_2 = d.hash(_msg); + assert(prevOwner == owner); + } + + function inv() public view { + assert(sig_1 == sig_2); + } +} +// ---- +// Warning 4661: (430-452): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol new file mode 100644 index 000000000000..cd08791e093c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol @@ -0,0 +1,29 @@ +pragma experimental SMTChecker; + +contract Crypto { + function hash(bytes32) external pure returns (bytes32) { + return bytes32(0); + } +} + +contract C { + address owner; + bytes32 sig_1; + bytes32 sig_2; + Crypto d; + + constructor() public { + owner = msg.sender; + } + + function f1(bytes32 _msg) public { + address prevOwner = owner; + sig_1 = d.hash(_msg); + sig_2 = d.hash(_msg); + assert(prevOwner == owner); + } + + function inv() public view { + assert(sig_1 == sig_2); + } +} diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol new file mode 100644 index 000000000000..3f6244e1e3fe --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol @@ -0,0 +1,38 @@ +pragma experimental SMTChecker; + +contract State { + uint x; + function f() public returns (uint) { + if (x == 0) x = 1; + else if (x == 1) x = 2; + else if (x == 2) x = 0; + return x; + } +} + +contract C { + address owner; + uint y; + uint z; + State s; + + constructor() public { + owner = msg.sender; + } + + function f() public { + address prevOwner = owner; + y = s.f(); + z = s.f(); + assert(prevOwner == owner); + } + + function inv() public view { + // This is safe but external calls do not yet support the state + // of the called contract. + assert(owner == address(0) || y != z); + } +} +// ---- +// Warning 5084: (551-561): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (535-572): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol new file mode 100644 index 000000000000..2439fc864c90 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol @@ -0,0 +1,32 @@ +pragma experimental SMTChecker; + +contract State { + uint x; + C c; + function f() public view returns (uint) { + return c.g(); + } +} + +contract C { + address owner; + uint y; + State s; + + constructor() public { + owner = msg.sender; + } + + function f() public view { + address prevOwner = owner; + uint z = s.f(); + assert(z == y); + assert(prevOwner == owner); + } + + function g() public view returns (uint) { + return y; + } +} +// ---- +// Warning 4661: (306-320): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol new file mode 100644 index 000000000000..9a8f9ed8e50c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol @@ -0,0 +1,47 @@ +pragma experimental SMTChecker; + +contract Other { + C c; + function h() public { + c.setOwner(address(0)); + } +} + +contract State { + uint x; + Other o; + C c; + function f() public returns (uint) { + o.h(); + return c.g(); + } +} + +contract C { + address owner; + uint y; + State s; + + constructor() public { + owner = msg.sender; + } + + function setOwner(address _owner) public { + owner = _owner; + } + + function f() public { + address prevOwner = owner; + uint z = s.f(); + assert(z == y); + assert(prevOwner == owner); + } + + function g() public view returns (uint) { + return y; + } +} +// ---- +// Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (459-473): Assertion violation happens here +// Warning 4661: (477-503): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol new file mode 100644 index 000000000000..c60b6b05da79 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol @@ -0,0 +1,39 @@ +pragma experimental SMTChecker; + +contract State { + uint x; + C c; + function f() public returns (uint) { + c.setOwner(address(0)); + return c.g(); + } +} + +contract C { + address owner; + uint y; + State s; + + constructor() public { + owner = msg.sender; + } + + function setOwner(address _owner) public { + owner = _owner; + } + + function f() public { + address prevOwner = owner; + uint z = s.f(); + assert(z == y); + assert(prevOwner == owner); + } + + function g() public view returns (uint) { + return y; + } +} +// ---- +// Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (388-402): Assertion violation happens here +// Warning 4661: (406-432): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol new file mode 100644 index 000000000000..336d75b97224 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol @@ -0,0 +1,43 @@ +pragma experimental SMTChecker; + +contract State { + uint x; + function f() public returns (uint) { + if (x == 0) x = 1; + else if (x == 1) x = 2; + else if (x == 2) x = 0; + return x; + } +} + +contract C { + address owner; + uint y; + uint z; + State s; + + constructor() public { + owner = msg.sender; + } + + function setOwner(address _owner) public { + owner = _owner; + } + + function f() public { + address prevOwner = owner; + y = s.f(); + z = s.f(); + assert(prevOwner == owner); + } + + function inv() public view { + // This is safe but external calls do not yet support the state + // of the called contract. + assert(owner == address(0) || y != z); + } +} +// ---- +// Warning 4661: (442-468): Assertion violation happens here +// Warning 5084: (617-627): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (601-638): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol b/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol new file mode 100644 index 000000000000..d4d2489b05cc --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol @@ -0,0 +1,22 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + D d; + + function inc() public { + ++x; + } + + function f() public { + d.d(); + assert(x < 10); + } +} +// ---- +// Warning 2661: (146-149): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (189-203): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol b/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol new file mode 100644 index 000000000000..2787b41588c9 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol @@ -0,0 +1,28 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + uint y; + D d; + + function inc2() public { + if (y == 1) + x = 1; + } + function inc1() public { + if (x == 0) + y = 1; + } + + function f() public { + uint oldX = x; + d.d(); + assert(oldX == x); + } +} +// ---- +// Warning 4661: (286-303): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_safe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_safe.sol new file mode 100644 index 000000000000..6a2b664910d6 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_safe.sol @@ -0,0 +1,18 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + D d; + function f() public { + if (x < 10) + ++x; + } + function g() public { + d.d(); + assert(x < 11); + } +} diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol b/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol new file mode 100644 index 000000000000..247c45f32f7d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol @@ -0,0 +1,26 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + uint y; + D d; + + function inc() public { + if (y == 1) + x = 1; + if (x == 0) + y = 1; + } + + function f() public { + uint oldX = x; + d.d(); + assert(oldX == x); + } +} +// ---- +// Warning 4661: (256-273): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/mutex.sol b/test/libsolidity/smtCheckerTests/external_calls/mutex.sol new file mode 100644 index 000000000000..1173da3f8847 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/mutex.sol @@ -0,0 +1,28 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + D d; + + bool lock; + modifier mutex { + require(!lock); + lock = true; + _; + lock = false; + } + + function set(uint _x) mutex public { + x = _x; + } + + function f() mutex public { + uint y = x; + d.d(); + assert(y == x); + } +} diff --git a/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol b/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol new file mode 100644 index 000000000000..08f3c7b76ee2 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol @@ -0,0 +1,30 @@ +pragma experimental SMTChecker; + +abstract contract D { + function d() external virtual; +} + +contract C { + uint x; + D d; + + bool lock; + modifier mutex { + require(!lock); + lock = true; + _; + lock = false; + } + + function set(uint _x) mutex public { + x = _x; + } + + function f() public { + uint y = x; + d.d(); + assert(y == x); + } +} +// ---- +// Warning 4661: (307-321): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol index cce33f8a6174..beb95617f6e1 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol @@ -17,4 +17,3 @@ contract C } } // ---- -// Warning 4661: (257-271): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol index 15f1f6001185..589d171652b2 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol @@ -18,4 +18,3 @@ contract C } } // ---- -// Warning 4661: (355-379): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol index 02813f1d7adf..f650ce824dd9 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol @@ -16,4 +16,3 @@ contract D } } // ---- -// Warning 4661: (191-206): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol index b05b47f53529..ee6933d17e64 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol @@ -14,4 +14,6 @@ contract C } } // ---- +// Warning 1218: (296-309): Error trying to invoke SMT solver. // Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (296-309): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol index e4644ed8afce..55e0b7427242 100644 --- a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol +++ b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol @@ -20,6 +20,3 @@ contract C // ---- // Warning 2072: (224-240): Unused local variable. // Warning 4661: (266-281): Assertion violation happens here -// Warning 4661: (285-299): Assertion violation happens here -// Warning 4661: (303-322): Assertion violation happens here -// Warning 4661: (326-350): Assertion violation happens here From 56e7d433840df883a3a2fdeb6bee093b9a9213df Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 1 Jul 2020 12:41:30 +0200 Subject: [PATCH 291/479] Rename var --- libsolidity/formal/CHC.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 2609e356e36b..7c6bbdaee46f 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -593,10 +593,10 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall) return; auto preCallState = currentStateVariables(); - bool noStateChanges = kind == FunctionType::Kind::BareStaticCall || + bool usesStaticCall = kind == FunctionType::Kind::BareStaticCall || function->stateMutability() == StateMutability::Pure || function->stateMutability() == StateMutability::View; - if (!noStateChanges) + if (!usesStaticCall) for (auto const* var: m_stateVariables) m_context.variable(*var)->increaseIndex(); From 5517e817d555c8d2abd80d2b6b867c41ef34036d Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 1 Jul 2020 18:19:56 +0200 Subject: [PATCH 292/479] Do not trust code of external functions --- Changelog.md | 2 +- libsolidity/formal/CHC.cpp | 4 +++- .../external_calls/external_hash_known_code_pure.sol | 2 ++ .../smtCheckerTests/functions/functions_external_4.sol | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 02da20254caa..18c42792268b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,7 +10,7 @@ Compiler Features: * Commandline Interface: Prevent some incompatible commandline options from being used together. * NatSpec: Support NatSpec comments on events. * Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``. - * SMTChecker: Support to external calls to unknown code and to known view/pure functions. + * SMTChecker: Support external calls to unknown code. Bugfixes: diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 7c6bbdaee46f..20a945f12f8f 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -592,6 +592,9 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall) if (!function) return; + for (auto var: function->returnParameters()) + m_context.variable(*var)->increaseIndex(); + auto preCallState = currentStateVariables(); bool usesStaticCall = kind == FunctionType::Kind::BareStaticCall || function->stateMutability() == StateMutability::Pure || @@ -602,7 +605,6 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall) auto nondet = (*m_nondetInterfaces.at(m_currentContract))(preCallState + currentStateVariables()); m_context.addAssertion(nondet); - m_context.addAssertion(predicate(_funCall)); m_context.addAssertion(m_error.currentValue() == 0); } diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol index cd08791e093c..8aef1f312d14 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol @@ -27,3 +27,5 @@ contract C { assert(sig_1 == sig_2); } } +// ---- +// Warning 4661: (438-460): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol index f650ce824dd9..02813f1d7adf 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol @@ -16,3 +16,4 @@ contract D } } // ---- +// Warning 4661: (191-206): Assertion violation happens here From 919572d6ecf85b0883c2f281ee660d5dd0b56773 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sun, 28 Jun 2020 01:46:42 +0200 Subject: [PATCH 293/479] Add --examine-coverage to fix_error_ids.py --- .circleci/config.yml | 2 +- liblangutil/Exceptions.h | 2 +- scripts/{fix_error_ids.py => error_codes.py} | 114 +++++++++++++++---- 3 files changed, 97 insertions(+), 21 deletions(-) rename scripts/{fix_error_ids.py => error_codes.py} (56%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4bebea97f794..5157f06615f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -323,7 +323,7 @@ jobs: - checkout - run: name: Check for error codes - command: ./scripts/fix_error_ids.py --check-only + command: ./scripts/error_codes.py --check chk_pylint: docker: diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 083a5e3cdf80..bd786fc3f1e3 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -61,7 +61,7 @@ struct InvalidAstError: virtual util::Exception {}; * They are passed as the first parameter of error reporting functions. * Suffix _error helps to find them in the sources. * The struct ErrorId prevents incidental calls like typeError(3141) instead of typeError(3141_error). - * To create a new ID, one can add 0000_error and then run "python ./scripts/fix_error_ids.py" + * To create a new ID, one can add 0000_error and then run "python ./scripts/error_codes.py --fix" * from the root of the repo. */ struct ErrorId diff --git a/scripts/fix_error_ids.py b/scripts/error_codes.py similarity index 56% rename from scripts/fix_error_ids.py rename to scripts/error_codes.py index d9a2011151e4..7be125c6ec23 100755 --- a/scripts/fix_error_ids.py +++ b/scripts/error_codes.py @@ -7,7 +7,7 @@ from os import path ENCODING = "utf-8" -PATTERN = r"\b\d+_error\b" +SOURCE_FILE_PATTERN = r"\b\d+_error\b" def read_file(file_name): @@ -36,9 +36,9 @@ def in_comment(source, pos): return slash_star_pos > star_slash_pos -def find_ids_in_file(file_name, ids): +def find_ids_in_source_file(file_name, ids): source = read_file(file_name) - for m in re.finditer(PATTERN, source): + for m in re.finditer(SOURCE_FILE_PATTERN, source): if in_comment(source, m.start()): continue underscore_pos = m.group(0).index("_") @@ -52,7 +52,7 @@ def find_ids_in_file(file_name, ids): def get_used_ids(file_names): used_ids = {} for file_name in file_names: - find_ids_in_file(file_name, used_ids) + find_ids_in_source_file(file_name, used_ids) return used_ids @@ -71,7 +71,7 @@ def fix_ids_in_file(file_name, available_ids, used_ids): k = 0 destination = [] - for m in re.finditer(PATTERN, source): + for m in re.finditer(SOURCE_FILE_PATTERN, source): destination.extend(source[k:m.start()]) underscore_pos = m.group(0).index("_") @@ -102,38 +102,105 @@ def fix_ids(used_ids, file_names): fix_ids_in_file(file_name, available_ids, used_ids) -def find_source_files(top_dir): - """Builds the list of .h and .cpp files in top_dir directory""" +def find_files(top_dir, sub_dirs, extensions): + """Builds a list of files with given extensions in specified subdirectories""" source_file_names = [] - dirs = ['libevmasm', 'liblangutil', 'libsolc', 'libsolidity', 'libsolutil', 'libyul', 'solc'] - - for dir in dirs: + for dir in sub_dirs: for root, _, file_names in os.walk(os.path.join(top_dir, dir), onerror=lambda e: exit(f"Walk error: {e}")): for file_name in file_names: _, ext = path.splitext(file_name) - if ext in [".h", ".cpp"]: + if ext in extensions: source_file_names.append(path.join(root, file_name)) return source_file_names +def find_ids_in_test_file(file_name): + source = read_file(file_name) + pattern = r"^// (.*Error|Warning) \d\d\d\d:" + return {m.group(0)[-5:-1] for m in re.finditer(pattern, source, flags=re.MULTILINE)} + + +def find_ids_in_test_files(file_names): + used_ids = set() + for file_name in file_names: + used_ids |= find_ids_in_test_file(file_name) + return used_ids + + +def print_ids(ids): + for k, id in enumerate(sorted(ids)): + if k % 10 > 0: + print(" ", end="") + elif k > 0: + print() + print(id, end="") + + +def examine_id_coverage(top_dir, used_ids): + test_sub_dirs = [ + path.join("test", "libsolidity", "errorRecoveryTests"), + path.join("test", "libsolidity", "smtCheckerTests"), + path.join("test", "libsolidity", "syntaxTests") + ] + test_file_names = find_files( + top_dir, + test_sub_dirs, + [".sol"] + ) + covered_ids = find_ids_in_test_files(test_file_names) + + print(f"IDs in source files: {len(used_ids)}") + print(f"IDs in test files : {len(covered_ids)} ({len(covered_ids) - len(used_ids)})") + print() + + unused_covered_ids = covered_ids - used_ids + if len(unused_covered_ids) != 0: + print("Error. The following error codes found in tests, but not in sources:") + print_ids(unused_covered_ids) + return 1 + + used_uncovered_ids = used_ids - covered_ids + if len(used_uncovered_ids) != 0: + print("The following error codes found in sources, but not in tests:") + print_ids(used_uncovered_ids) + print("\n\nPlease make sure to add appropriate tests.") + return 1 + + return 0 + + def main(argv): - check_only = False + # pylint: disable=too-many-branches, too-many-locals + + check = False + fix = False noconfirm = False - opts, args = getopt.getopt(argv, "", ["check-only", "noconfirm"]) + examine_coverage = False + opts, args = getopt.getopt(argv, "", ["check", "fix", "noconfirm", "examine-coverage"]) for opt, arg in opts: - if opt == '--check-only': - check_only = True + if opt == '--check': + check = True + elif opt == "--fix": + fix = True elif opt == '--noconfirm': noconfirm = True + elif opt == '--examine-coverage': + examine_coverage = True - random.seed() - cwd = os.getcwd() + if not check and not fix and not examine_coverage: + print("usage: python error_codes.py --check | --fix [--noconfirm] | --examine-coverage") + exit(1) - source_file_names = find_source_files(cwd) + cwd = os.getcwd() + source_file_names = find_files( + cwd, + ["libevmasm", "liblangutil", "libsolc", "libsolidity", "libsolutil", "libyul", "solc"], + [".h", ".cpp"] + ) used_ids = get_used_ids(source_file_names) ok = True @@ -148,13 +215,21 @@ def main(argv): print(f"ID {id} appears {used_ids[id]} times") ok = False + if examine_coverage: + if not ok: + print("Incorrect IDs has to be fixed before applying --examine-coverage") + res = examine_id_coverage(cwd, used_ids.keys()) + exit(res) + if ok: print("No incorrect IDs found") exit(0) - if check_only: + if check: exit(1) + assert fix, "Unexpected state, should not come here without --fix" + if not noconfirm: answer = input( "\nDo you want to fix incorrect IDs?\n" @@ -166,6 +241,7 @@ def main(argv): if answer not in "yY": exit(1) + random.seed() fix_ids(used_ids, source_file_names) print("Fixing completed") exit(2) From c2e1273ff4a83bcdbf62c836504ecf505a77e95a Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 11 Jun 2020 15:52:36 +0200 Subject: [PATCH 294/479] Fixed recursive check in structureSizeEstimate --- libsolidity/analysis/StaticAnalyzer.cpp | 19 ++++++++----------- .../large_storage_array_fine.sol} | 0 .../large_storage_array_mapping.sol | 4 ++++ .../large_storage_array_simple.sol} | 0 .../large_storage_arrays_combined.sol | 4 ++++ .../large_storage_arrays_struct.sol} | 0 .../largeTypes/large_storage_structs.sol | 18 ++++++++++++++++++ .../508_large_storage_arrays_combined.sol | 5 ----- .../510_large_storage_array_mapping.sol | 5 ----- 9 files changed, 34 insertions(+), 21 deletions(-) rename test/libsolidity/syntaxTests/{nameAndTypeResolution/506_large_storage_array_fine.sol => largeTypes/large_storage_array_fine.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol rename test/libsolidity/syntaxTests/{nameAndTypeResolution/507_large_storage_array_simple.sol => largeTypes/large_storage_array_simple.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_combined.sol rename test/libsolidity/syntaxTests/{nameAndTypeResolution/509_large_storage_arrays_struct.sol => largeTypes/large_storage_arrays_struct.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol delete mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol delete mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index 3cbfa4db4c8d..5524b3a6889f 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -346,24 +346,21 @@ bigint StaticAnalyzer::structureSizeEstimate(Type const& _type, set(_type); - return structureSizeEstimate(*t.baseType(), _structsSeen) * (t.isDynamicallySized() ? 1 : t.length()); + if (!t.isDynamicallySized()) + return structureSizeEstimate(*t.baseType(), _structsSeen) * t.length(); + break; } case Type::Category::Struct: { auto const& t = dynamic_cast(_type); + solAssert(!_structsSeen.count(&t.structDefinition()), "Recursive struct."); bigint size = 1; - if (!_structsSeen.count(&t.structDefinition())) - { - _structsSeen.insert(&t.structDefinition()); - for (auto const& m: t.members(nullptr)) - size += structureSizeEstimate(*m.type, _structsSeen); - } + _structsSeen.insert(&t.structDefinition()); + for (auto const& m: t.members(nullptr)) + size += structureSizeEstimate(*m.type, _structsSeen); + _structsSeen.erase(&t.structDefinition()); return size; } - case Type::Category::Mapping: - { - return structureSizeEstimate(*dynamic_cast(_type).valueType(), _structsSeen); - } default: break; } diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/506_large_storage_array_fine.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_fine.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/506_large_storage_array_fine.sol rename to test/libsolidity/syntaxTests/largeTypes/large_storage_array_fine.sol diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol new file mode 100644 index 000000000000..34132bfbe7ca --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol @@ -0,0 +1,4 @@ +contract C { + mapping(uint => uint[2**100]) x; +} +// ---- diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/507_large_storage_array_simple.sol rename to test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_combined.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_combined.sol new file mode 100644 index 000000000000..eee56ce0f7e0 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_combined.sol @@ -0,0 +1,4 @@ +contract C { + uint[200][200][2**30][][2**30] x; +} +// ---- diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/509_large_storage_arrays_struct.sol rename to test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol new file mode 100644 index 000000000000..e7057e7a617f --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol @@ -0,0 +1,18 @@ +contract C { + struct P0 { uint256[2**63] x; } + struct S0 { + P0[2**62] y; + P0 x; + } + S0 s0; + + struct P1 { uint256[2**63] x; } + struct S1 { + P1 x; + P1[2**62] y; + } + S1 s1; +} +// ---- +// Warning 3408: (110-115): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (215-220): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol deleted file mode 100644 index 366f35339e6a..000000000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/508_large_storage_arrays_combined.sol +++ /dev/null @@ -1,5 +0,0 @@ -contract C { - uint[200][200][2**30][][2**30] x; -} -// ---- -// Warning 3408: (17-49): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol deleted file mode 100644 index e639b58e999f..000000000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/510_large_storage_array_mapping.sol +++ /dev/null @@ -1,5 +0,0 @@ -contract C { - mapping(uint => uint[2**100]) x; -} -// ---- -// Warning 3408: (17-48): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. From 40322fa70326ba55928bb4f1757507e421823d5a Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Thu, 2 Jul 2020 16:44:31 +0530 Subject: [PATCH 295/479] Added jumpdest to yul doc. --- docs/yul.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/yul.rst b/docs/yul.rst index 2e8bc4a104d7..1b6ad61be411 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -30,7 +30,7 @@ The design of Yul tries to achieve several goals: In order to achieve the first and second goal, Yul provides high-level constructs like ``for`` loops, ``if`` and ``switch`` statements and function calls. These should be sufficient for adequately representing the control flow for assembly programs. -Therefore, no explicit statements for ``SWAP``, ``DUP``, ``JUMP`` and ``JUMPI`` +Therefore, no explicit statements for ``SWAP``, ``DUP``, ``JUMPDEST``, ``JUMP`` and ``JUMPI`` are provided, because the first two obfuscate the data flow and the last two obfuscate control flow. Furthermore, functional statements of the form ``mul(add(x, y), 7)`` are preferred over pure opcode statements like From 356b9a7904759c0763d566b5c8ba7a72707da64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 2 Jul 2020 14:14:36 +0200 Subject: [PATCH 296/479] Restrict `linkersymbol` builtin to object dialect of Yul --- libyul/backends/evm/EVMDialect.cpp | 21 +++++++++---------- .../inlineAssembly/linkersymbol_builtin.sol | 10 +++++++++ .../inlineAssembly/linkersymbol_function.sol | 10 +++++++++ 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_builtin.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index b6a46043e8f3..342c0e6edcb0 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -124,19 +124,18 @@ map createBuiltins(langutil::EVMVersion _evmVe ) builtins.emplace(createEVMFunction(instr.first, instr.second)); - builtins.emplace(createFunction("linkersymbol", 1, 1, SideEffects{}, {true}, []( - FunctionCall const& _call, - AbstractAssembly& _assembly, - BuiltinContext&, - function - ) { - yulAssert(_call.arguments.size() == 1, ""); - Expression const& arg = _call.arguments.front(); - _assembly.appendLinkerSymbol(std::get(arg).value.str()); - })); - if (_objectAccess) { + builtins.emplace(createFunction("linkersymbol", 1, 1, SideEffects{}, {true}, []( + FunctionCall const& _call, + AbstractAssembly& _assembly, + BuiltinContext&, + function + ) { + yulAssert(_call.arguments.size() == 1, ""); + Expression const& arg = _call.arguments.front(); + _assembly.appendLinkerSymbol(std::get(arg).value.str()); + })); builtins.emplace(createFunction("datasize", 1, 1, SideEffects{}, {true}, []( FunctionCall const& _call, AbstractAssembly& _assembly, diff --git a/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_builtin.sol b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_builtin.sol new file mode 100644 index 000000000000..9f761f187e35 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_builtin.sol @@ -0,0 +1,10 @@ +contract C { + function f() public pure { + assembly { + pop(linkersymbol("contract/library.sol:L")) + } + } +} +// ---- +// DeclarationError 4619: (67-79): Function not found. +// TypeError 3950: (67-105): Expected expression to evaluate to one value, but got 0 values instead. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol new file mode 100644 index 000000000000..9d1d6c4f376c --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol @@ -0,0 +1,10 @@ +contract C { + function f() public pure { + assembly { + function linkersymbol(a) {} + + linkersymbol("contract/library.sol:L") + } + } +} +// ---- From c18c6e93191b55e8c34ccce289d2ba9337d9062f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 2 Jul 2020 14:15:18 +0200 Subject: [PATCH 297/479] Add missing changelog entries for `linkersymbol` and for long string literals in builtin parameters --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index 18c42792268b..837c0f1b9bcc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,8 @@ Language Features: * General: Add unit denomination ``gwei`` + * Yul: Support ``linkersymbol`` builtin in standalone assembly mode. + * Yul: Support using string literals exceeding 32 bytes as literal arguments for builtins. Compiler Features: From f97fa9b5201a852e133947a2a515e62b4beddd2c Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 27 May 2020 17:13:19 +0200 Subject: [PATCH 298/479] [SMTChecker] Add current input variables to the function summary --- libsolidity/formal/CHC.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 20a945f12f8f..c3e9d6cb4763 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -821,7 +821,12 @@ smtutil::SortPointer CHC::summarySort(FunctionDefinition const& _function, Contr auto inputSorts = applyMap(_function.parameters(), smtSort); auto outputSorts = applyMap(_function.returnParameters(), smtSort); return make_shared( - vector{smtutil::SortProvider::uintSort} + sorts + inputSorts + sorts + outputSorts, + vector{smtutil::SortProvider::uintSort} + + sorts + + inputSorts + + sorts + + inputSorts + + outputSorts, smtutil::SortProvider::boolSort ); } @@ -881,6 +886,7 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source) args += state1 + applyMap(function->parameters(), [this](auto _var) { return valueAtIndex(*_var, 0); }) + state2 + + applyMap(function->parameters(), [this](auto _var) { return valueAtIndex(*_var, 1); }) + applyMap(function->returnParameters(), [this](auto _var) { return valueAtIndex(*_var, 1); }); connectBlocks(nondetPre, nondetPost, (*m_summaries.at(base).at(function))(args)); @@ -928,6 +934,7 @@ smtutil::Expression CHC::summary(FunctionDefinition const& _function, ContractDe args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : initialStateVariables(_contract); args += applyMap(_function.parameters(), [this](auto _var) { return valueAtIndex(*_var, 0); }); args += contract->isLibrary() ? stateVariablesAtIndex(1, *contract) : currentStateVariables(_contract); + args += applyMap(_function.parameters(), [this](auto _var) { return currentValue(*_var); }); args += applyMap(_function.returnParameters(), [this](auto _var) { return currentValue(*_var); }); return (*m_summaries.at(&_contract).at(&_function))(args); } @@ -1085,13 +1092,14 @@ smtutil::Expression CHC::predicate(FunctionCall const& _funCall) m_context.variable(*var)->increaseIndex(); args += otherContract ? stateVariablesAtIndex(1, *contract) : currentStateVariables(); - auto const& returnParams = function->returnParameters(); - for (auto param: returnParams) - if (m_context.knownVariable(*param)) - m_context.variable(*param)->increaseIndex(); + for (auto var: function->parameters() + function->returnParameters()) + { + if (m_context.knownVariable(*var)) + m_context.variable(*var)->increaseIndex(); else - createVariable(*param); - args += applyMap(function->returnParameters(), [this](auto _var) { return currentValue(*_var); }); + createVariable(*var); + args.push_back(currentValue(*var)); + } if (otherContract) return (*m_summaries.at(contract).at(function))(args); From 50373ac1b0194dd19c2cc25901095ad7b490cba1 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 24 Jun 2020 18:14:29 +0200 Subject: [PATCH 299/479] Yul: Implement memory struct allocation --- libsolidity/codegen/YulUtilFunctions.cpp | 24 ++++++++-- libsolidity/codegen/YulUtilFunctions.h | 7 ++- .../codegen/ir/IRGeneratorForStatements.cpp | 48 ++++++++++++++++--- .../semanticTests/structs/global.sol | 2 + .../memory_struct_named_constructor.sol | 18 +++++++ .../memory_structs_as_function_args.sol | 2 + .../structs/memory_structs_nested.sol | 2 + .../structs/multislot_struct_allocation.sol | 24 ++++++++++ .../structs/nested_struct_allocation.sol | 18 +++++++ .../structs/simple_struct_allocation.sol | 14 ++++++ .../semanticTests/structs/structs.sol | 2 + 11 files changed, 150 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol create mode 100644 test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol create mode 100644 test/libsolidity/semanticTests/structs/nested_struct_allocation.sol create mode 100644 test/libsolidity/semanticTests/structs/simple_struct_allocation.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index f7d9711a260b..7678a0befe92 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1646,13 +1646,30 @@ string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType cons }); } -string YulUtilFunctions::allocateAndInitializeMemoryStructFunction(StructType const& _type) +string YulUtilFunctions::allocateMemoryStructFunction(StructType const& _type) { - string functionName = "allocate_and_initialize_memory_struct_" + _type.identifier(); + string functionName = "allocate_memory_struct_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { Whiskers templ(R"( function () -> memPtr { memPtr := () + } + )"); + templ("functionName", functionName); + templ("alloc", allocationFunction()); + templ("allocSize", _type.memoryDataSize().str()); + + return templ.render(); + }); +} + +string YulUtilFunctions::allocateAndInitializeMemoryStructFunction(StructType const& _type) +{ + string functionName = "allocate_and_zero_memory_struct_" + _type.identifier(); + return m_functionCollector.createFunction(functionName, [&]() { + Whiskers templ(R"( + function () -> memPtr { + memPtr := () let offset := memPtr <#member> mstore(offset, ()) @@ -1661,10 +1678,9 @@ string YulUtilFunctions::allocateAndInitializeMemoryStructFunction(StructType co } )"); templ("functionName", functionName); - templ("alloc", allocationFunction()); + templ("allocStruct", allocateMemoryStructFunction(_type)); TypePointers const& members = _type.memoryMemberTypes(); - templ("allocSize", _type.memoryDataSize().str()); vector> memberParams(members.size()); for (size_t i = 0; i < members.size(); ++i) diff --git a/libsolidity/codegen/YulUtilFunctions.h b/libsolidity/codegen/YulUtilFunctions.h index c23a7d735e76..c1d98cfe48ec 100644 --- a/libsolidity/codegen/YulUtilFunctions.h +++ b/libsolidity/codegen/YulUtilFunctions.h @@ -286,8 +286,13 @@ class YulUtilFunctions /// signature: (length) -> memPtr std::string allocateAndInitializeMemoryArrayFunction(ArrayType const& _type); + /// @returns the name of a function that allocates a memory struct (no + /// initialization takes place). + /// signature: () -> memPtr + std::string allocateMemoryStructFunction(StructType const& _type); + /// @returns the name of a function that allocates and zeroes a memory struct. - /// signature: (members) -> memPtr + /// signature: () -> memPtr std::string allocateAndInitializeMemoryStructFunction(StructType const& _type); /// @returns the name of the function that converts a value of type @a _from diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 3ec89a23315e..c14d6512120e 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -600,22 +600,30 @@ bool IRGeneratorForStatements::visit(FunctionCall const& _functionCall) void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) { solUnimplementedAssert( - _functionCall.annotation().kind == FunctionCallKind::FunctionCall || - _functionCall.annotation().kind == FunctionCallKind::TypeConversion, + _functionCall.annotation().kind != FunctionCallKind::Unset, "This type of function call is not yet implemented" ); - Type const& funcType = type(_functionCall.expression()); - if (_functionCall.annotation().kind == FunctionCallKind::TypeConversion) { - solAssert(funcType.category() == Type::Category::TypeType, "Expected category to be TypeType"); + solAssert( + _functionCall.expression().annotation().type->category() == Type::Category::TypeType, + "Expected category to be TypeType" + ); solAssert(_functionCall.arguments().size() == 1, "Expected one argument for type conversion"); define(_functionCall, *_functionCall.arguments().front()); return; } - FunctionTypePointer functionType = dynamic_cast(&funcType); + FunctionTypePointer functionType = nullptr; + if (_functionCall.annotation().kind == FunctionCallKind::StructConstructorCall) + { + auto const& type = dynamic_cast(*_functionCall.expression().annotation().type); + auto const& structType = dynamic_cast(*type.actualType()); + functionType = structType.constructorType(); + } + else + functionType = dynamic_cast(_functionCall.expression().annotation().type); TypePointers parameterTypes = functionType->parameterTypes(); vector> const& callArguments = _functionCall.arguments(); @@ -639,6 +647,34 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) arguments.push_back(callArguments[static_cast(std::distance(callArgumentNames.begin(), it))]); } + if (_functionCall.annotation().kind == FunctionCallKind::StructConstructorCall) + { + TypeType const& type = dynamic_cast(*_functionCall.expression().annotation().type); + auto const& structType = dynamic_cast(*type.actualType()); + + define(_functionCall) << m_utils.allocateMemoryStructFunction(structType) << "()\n"; + + MemberList::MemberMap members = structType.nativeMembers(nullptr); + + solAssert(members.size() == arguments.size(), "Struct parameter mismatch."); + + for (size_t i = 0; i < arguments.size(); i++) + { + IRVariable converted = convert(*arguments[i], *parameterTypes[i]); + m_code << + m_utils.writeToMemoryFunction(*functionType->parameterTypes()[i]) << + "(add(" << + IRVariable(_functionCall).part("mpos").name() << + ", " << + structType.memoryOffsetOfMember(members[i].name) << + "), " << + converted.commaSeparatedList() << + ")\n"; + } + + return; + } + auto memberAccess = dynamic_cast(&_functionCall.expression()); if (memberAccess) { diff --git a/test/libsolidity/semanticTests/structs/global.sol b/test/libsolidity/semanticTests/structs/global.sol index 18dbf87dd3c6..de8fe21b3337 100644 --- a/test/libsolidity/semanticTests/structs/global.sol +++ b/test/libsolidity/semanticTests/structs/global.sol @@ -6,5 +6,7 @@ contract C { return (s.a, s.b); } } +// ==== +// compileViaYul: also // ---- // f((uint256,uint256)): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol b/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol new file mode 100644 index 000000000000..6cf5378b4b3f --- /dev/null +++ b/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol @@ -0,0 +1,18 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { + uint256 a; + bool x; + } + + function s() public returns(S memory) + { + return S({x: true, a: 8}); + } +} + +// ==== +// compileViaYul: also +// ---- +// s() -> 8, true diff --git a/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol b/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol index 1173a3796590..49bb6ba7a43b 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol @@ -28,5 +28,7 @@ contract Test { } } +// ==== +// compileViaYul: also // ---- // test() -> 1, 2, 3 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_nested.sol b/test/libsolidity/semanticTests/structs/memory_structs_nested.sol index f5c41a232b09..40dba7f26fd8 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_nested.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_nested.sol @@ -38,5 +38,7 @@ contract Test { } } +// ==== +// compileViaYul: also // ---- // test() -> 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol b/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol new file mode 100644 index 000000000000..9766880bf4c7 --- /dev/null +++ b/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol @@ -0,0 +1,24 @@ +contract C { + struct I { + uint b; + uint c; + function(uint) external returns (uint) x; + } + struct S { + I a; + } + + function o(uint a) external returns(uint) { return a+1; } + + function f() external returns (uint) { + S memory s = S(I(1,2, this.o)); + return s.a.x(1); + } +} + + + +// ==== +// compileViaYul: also +// ---- +// f() -> 2 diff --git a/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol b/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol new file mode 100644 index 000000000000..6a795472684e --- /dev/null +++ b/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol @@ -0,0 +1,18 @@ +contract C { + struct I { + uint b; + uint c; + } + struct S { + I a; + } + + function f() external returns (uint) { + S memory s = S(I(1,2)); + return s.a.b; + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol b/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol new file mode 100644 index 000000000000..7e3a54073be7 --- /dev/null +++ b/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol @@ -0,0 +1,14 @@ +contract C { + struct S { + uint a; + } + + function f() external returns (uint) { + S memory s = S(1); + return s.a; + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/structs.sol b/test/libsolidity/semanticTests/structs/structs.sol index 4491f625dfce..d0f63d892ee8 100644 --- a/test/libsolidity/semanticTests/structs/structs.sol +++ b/test/libsolidity/semanticTests/structs/structs.sol @@ -27,6 +27,8 @@ contract test { data.recursive[4].z = 9; } } +// ==== +// compileViaYul: also // ---- // check() -> false // set() -> From 4fcf0b489ac1d27fa0af4bc43353cdc2917dcbf5 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Fri, 3 Jul 2020 01:26:26 +0200 Subject: [PATCH 300/479] Refactor error_codes.py to simplify generation of new error codes --- scripts/error_codes.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 7be125c6ec23..0986bc9b1f99 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -56,14 +56,11 @@ def get_used_ids(file_names): return used_ids -def get_id(available_ids, used_ids): - while len(available_ids) > 0: - k = random.randrange(len(available_ids)) - id = list(available_ids.keys())[k] - del available_ids[id] - if id not in used_ids: - return id - assert False, "Out of IDs" +def get_next_id(available_ids): + assert len(available_ids) > 0, "Out of IDs" + next_id = random.choice(list(available_ids)) + available_ids.remove(next_id) + return next_id def fix_ids_in_file(file_name, available_ids, used_ids): @@ -80,7 +77,8 @@ def fix_ids_in_file(file_name, available_ids, used_ids): # incorrect id or id has a duplicate somewhere if not in_comment(source, m.start()) and (len(id) != 4 or id[0] == "0" or used_ids[id] > 1): assert id in used_ids - new_id = get_id(available_ids, used_ids) + new_id = get_next_id(available_ids) + assert new_id not in used_ids used_ids[id] -= 1 else: new_id = id @@ -97,7 +95,7 @@ def fix_ids_in_file(file_name, available_ids, used_ids): def fix_ids(used_ids, file_names): - available_ids = {str(id): None for id in range(1000, 10000)} + available_ids = {str(id) for id in range(1000, 10000)} - used_ids.keys() for file_name in file_names: fix_ids_in_file(file_name, available_ids, used_ids) From d211a45aa4844821e03c38b1abcecb05dafd27fe Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 2 Jul 2020 18:33:27 +0100 Subject: [PATCH 301/479] Use different error code for various EVM features in Yul --- libyul/AsmAnalysis.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 6cf006638ed1..ebc43b42f872 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -558,9 +558,9 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation // Similarly we assume bitwise shifting and create2 go together. yulAssert(m_evmVersion.hasBitwiseShifting() == m_evmVersion.hasCreate2(), ""); - auto errorForVM = [&](string const& vmKindMessage) { + auto errorForVM = [&](ErrorId _errorId, string const& vmKindMessage) { m_errorReporter.typeError( - 7079_error, + _errorId, _location, "The \"" + boost::to_lower_copy(instructionInfo(_instr).name) @@ -577,21 +577,21 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation _instr == evmasm::Instruction::RETURNDATACOPY || _instr == evmasm::Instruction::RETURNDATASIZE ) && !m_evmVersion.supportsReturndata()) - errorForVM("only available for Byzantium-compatible"); + errorForVM(7756_error, "only available for Byzantium-compatible"); else if (_instr == evmasm::Instruction::STATICCALL && !m_evmVersion.hasStaticCall()) - errorForVM("only available for Byzantium-compatible"); + errorForVM(1503_error, "only available for Byzantium-compatible"); else if (( _instr == evmasm::Instruction::SHL || _instr == evmasm::Instruction::SHR || _instr == evmasm::Instruction::SAR ) && !m_evmVersion.hasBitwiseShifting()) - errorForVM("only available for Constantinople-compatible"); + errorForVM(6612_error, "only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::CREATE2 && !m_evmVersion.hasCreate2()) - errorForVM("only available for Constantinople-compatible"); + errorForVM(6166_error, "only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash()) - errorForVM("only available for Constantinople-compatible"); + errorForVM(7110_error, "only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID()) - errorForVM("only available for Istanbul-compatible"); + errorForVM(1561_error, "only available for Istanbul-compatible"); else if (_instr == evmasm::Instruction::PC) m_errorReporter.warning( 2450_error, @@ -601,7 +601,7 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation "\" instruction is deprecated and will be removed in the next breaking release." ); else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) - errorForVM("only available for Istanbul-compatible"); + errorForVM(3672_error, "only available for Istanbul-compatible"); else if ( _instr == evmasm::Instruction::JUMP || _instr == evmasm::Instruction::JUMPI || From 2e6cbd87182b7960db1cb36158b6a7978f9c2649 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 2 Jul 2020 18:34:39 +0100 Subject: [PATCH 302/479] Rename warnOnInstructions to validateInstructions --- libyul/AsmAnalysis.cpp | 10 +++++----- libyul/AsmAnalysis.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index ebc43b42f872..c7e825759ceb 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -264,7 +264,7 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) if (f->literalArguments) needsLiteralArguments = &f->literalArguments.value(); - warnOnInstructions(_funCall); + validateInstructions(_funCall); } else if (!m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{ [&](Scope::Variable const&) @@ -282,7 +282,7 @@ vector AsmAnalyzer::operator()(FunctionCall const& _funCall) } })) { - if (!warnOnInstructions(_funCall)) + if (!validateInstructions(_funCall)) m_errorReporter.declarationError(4619_error, _funCall.functionName.location, "Function not found."); yulAssert(!watcher.ok(), "Expected a reported error."); } @@ -541,16 +541,16 @@ void AsmAnalyzer::expectType(YulString _expectedType, YulString _givenType, Sour ); } -bool AsmAnalyzer::warnOnInstructions(std::string const& _instructionIdentifier, langutil::SourceLocation const& _location) +bool AsmAnalyzer::validateInstructions(std::string const& _instructionIdentifier, langutil::SourceLocation const& _location) { auto const builtin = EVMDialect::strictAssemblyForEVM(EVMVersion{}).builtin(YulString(_instructionIdentifier)); if (builtin && builtin->instruction.has_value()) - return warnOnInstructions(builtin->instruction.value(), _location); + return validateInstructions(builtin->instruction.value(), _location); else return false; } -bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation const& _location) +bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocation const& _location) { // We assume that returndatacopy, returndatasize and staticcall are either all available // or all not available. diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 29bfca2fd30c..e0a751b1343a 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -110,12 +110,12 @@ class AsmAnalyzer Scope& scope(Block const* _block); void expectValidType(YulString _type, langutil::SourceLocation const& _location); void expectType(YulString _expectedType, YulString _givenType, langutil::SourceLocation const& _location); - bool warnOnInstructions(evmasm::Instruction _instr, langutil::SourceLocation const& _location); - bool warnOnInstructions(std::string const& _instrIdentifier, langutil::SourceLocation const& _location); - bool warnOnInstructions(FunctionCall const& _functionCall) + bool validateInstructions(evmasm::Instruction _instr, langutil::SourceLocation const& _location); + bool validateInstructions(std::string const& _instrIdentifier, langutil::SourceLocation const& _location); + bool validateInstructions(FunctionCall const& _functionCall) { - return warnOnInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); + return validateInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); } yul::ExternalIdentifierAccess::Resolver m_resolver; From e810d84a075eeef6409b7ba8c866bf2923165c72 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Fri, 3 Jul 2020 01:46:10 +0200 Subject: [PATCH 303/479] Introduce error_codes.py --next flag --- scripts/error_codes.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 0986bc9b1f99..7ab136e84c84 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -170,26 +170,29 @@ def examine_id_coverage(top_dir, used_ids): def main(argv): - # pylint: disable=too-many-branches, too-many-locals + # pylint: disable=too-many-branches, too-many-locals, too-many-statements check = False fix = False - noconfirm = False + no_confirm = False examine_coverage = False - opts, args = getopt.getopt(argv, "", ["check", "fix", "noconfirm", "examine-coverage"]) + next = False + opts, args = getopt.getopt(argv, "", ["check", "fix", "no-confirm", "examine-coverage", "next"]) for opt, arg in opts: if opt == '--check': check = True elif opt == "--fix": fix = True - elif opt == '--noconfirm': - noconfirm = True + elif opt == '--no-confirm': + no_confirm = True elif opt == '--examine-coverage': examine_coverage = True + elif opt == '--next': + next = True - if not check and not fix and not examine_coverage: - print("usage: python error_codes.py --check | --fix [--noconfirm] | --examine-coverage") + if [check, fix, examine_coverage, next].count(True) != 1: + print("usage: python error_codes.py --check | --fix [--no-confirm] | --examine-coverage | --next") exit(1) cwd = os.getcwd() @@ -215,10 +218,20 @@ def main(argv): if examine_coverage: if not ok: - print("Incorrect IDs has to be fixed before applying --examine-coverage") + print("Incorrect IDs have to be fixed before applying --examine-coverage") res = examine_id_coverage(cwd, used_ids.keys()) exit(res) + random.seed() + + if next: + if not ok: + print("Incorrect IDs have to be fixed before applying --next") + available_ids = {str(id) for id in range(1000, 10000)} - used_ids.keys() + next_id = get_next_id(available_ids) + print(f"Next ID: {next_id}") + exit(0) + if ok: print("No incorrect IDs found") exit(0) @@ -228,7 +241,7 @@ def main(argv): assert fix, "Unexpected state, should not come here without --fix" - if not noconfirm: + if not no_confirm: answer = input( "\nDo you want to fix incorrect IDs?\n" "Please commit current changes first, and review the results when the script finishes.\n" @@ -239,7 +252,6 @@ def main(argv): if answer not in "yY": exit(1) - random.seed() fix_ids(used_ids, source_file_names) print("Fixing completed") exit(2) From 9a94b89c48b99d75e6b09033f5cf6662bdf5f736 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 00:19:44 +0100 Subject: [PATCH 304/479] Update and add new tests for features of different EVM version --- .../inlineAssembly/evm_byzantium.sol | 16 ++++++++++++ .../evm_byzantium_on_homestead.sol | 21 ++++++++++++++++ .../inlineAssembly/evm_constantinople.sol | 17 +++++++++++++ .../evm_constantinople_on_byzantium.sol | 25 +++++++++++++++++++ .../{istanbul.sol => evm_istanbul.sol} | 0 ...urg.sol => evm_istanbul_on_petersburg.sol} | 4 +-- 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol rename test/libsolidity/syntaxTests/inlineAssembly/{istanbul.sol => evm_istanbul.sol} (100%) rename test/libsolidity/syntaxTests/inlineAssembly/{istanbul_on_petersburg.sol => evm_istanbul_on_petersburg.sol} (83%) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol new file mode 100644 index 000000000000..b08172ebe469 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol @@ -0,0 +1,16 @@ +contract C { + function f() pure external { + assembly { + let s := returndatasize() + returndatacopy(0, 0, s) + } + } + function g() view external returns (uint ret) { + assembly { + ret := staticcall(0, gas(), 0, 0, 0, 0) + } + } +} +// ==== +// EVMVersion: >=byzantium +// ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol new file mode 100644 index 000000000000..bbb32299f3d0 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol @@ -0,0 +1,21 @@ +contract C { + function f() pure external { + assembly { + let s := returndatasize() + returndatacopy(0, 0, s) + } + } + function g() view external returns (uint ret) { + assembly { + ret := staticcall(0, gas(), 0, 0, 0, 0) + } + } +} +// ==== +// EVMVersion: =homestead +// ---- +// TypeError 7756: (86-100): The "returndatasize" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). +// DeclarationError 3812: (77-102): Variable count mismatch: 1 variables and 0 values. +// TypeError 7756: (115-129): The "returndatacopy" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). +// TypeError 1503: (245-255): The "staticcall" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). +// DeclarationError 8678: (238-277): Variable count does not match number of values (1 vs. 0) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol new file mode 100644 index 000000000000..75d2f2895e76 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol @@ -0,0 +1,17 @@ +contract C { + function f() view external returns (uint ret) { + assembly { + ret := shl(gas(), 5) + ret := shr(ret, 2) + ret := sar(ret, 2) + } + } + function g() external returns (address ret) { + assembly { + ret := create2(0, 0, 0, 0) + } + } +} +// ==== +// EVMVersion: >=constantinople +// ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol new file mode 100644 index 000000000000..1e6d85bf1df0 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol @@ -0,0 +1,25 @@ +contract C { + function f() view external returns (uint ret) { + assembly { + ret := shl(gas(), 5) + ret := shr(ret, 2) + ret := sar(ret, 2) + } + } + function g() external returns (address ret) { + assembly { + ret := create2(0, 0, 0, 0) + } + } +} +// ==== +// EVMVersion: =byzantium +// ---- +// TypeError 6612: (103-106): The "shl" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// DeclarationError 8678: (96-116): Variable count does not match number of values (1 vs. 0) +// TypeError 6612: (136-139): The "shr" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// DeclarationError 8678: (129-147): Variable count does not match number of values (1 vs. 0) +// TypeError 6612: (167-170): The "sar" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// DeclarationError 8678: (160-178): Variable count does not match number of values (1 vs. 0) +// TypeError 6166: (283-290): The "create2" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// DeclarationError 8678: (276-302): Variable count does not match number of values (1 vs. 0) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/istanbul.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul.sol similarity index 100% rename from test/libsolidity/syntaxTests/inlineAssembly/istanbul.sol rename to test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul.sol diff --git a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol similarity index 83% rename from test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol rename to test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol index dc15b61f9fe9..66095a021f45 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/istanbul_on_petersburg.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol @@ -13,7 +13,7 @@ contract C { // ==== // EVMVersion: =petersburg // ---- -// TypeError 7079: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// TypeError 1561: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError 8678: (95-110): Variable count does not match number of values (1 vs. 0) -// TypeError 7079: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// TypeError 3672: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError 8678: (209-228): Variable count does not match number of values (1 vs. 0) From 1c7a0dcbea3084f5b75eaa3b4e635abaa4218970 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 2 Jul 2020 06:03:26 +0200 Subject: [PATCH 305/479] Add warnings for oversized subtypes --- libsolidity/analysis/StaticAnalyzer.cpp | 35 +++++++++-- libsolidity/analysis/StaticAnalyzer.h | 16 ++++- .../large_storage_array_mapping.sol | 1 + .../largeTypes/large_storage_structs.sol | 63 ++++++++++++++++--- 4 files changed, 101 insertions(+), 14 deletions(-) diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index 5524b3a6889f..bee1197b38d1 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -158,7 +158,8 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) else if (_variable.isStateVariable()) { set structsSeen; - if (structureSizeEstimate(*_variable.type(), structsSeen) >= bigint(1) << 64) + TypeSet oversizedSubTypes; + if (structureSizeEstimate(*_variable.type(), structsSeen, oversizedSubTypes) >= bigint(1) << 64) m_errorReporter.warning( 3408_error, _variable.location(), @@ -166,6 +167,14 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) "Either use mappings or dynamic arrays and allow their size to be increased only " "in small quantities per transaction." ); + for (Type const* type: oversizedSubTypes) + m_errorReporter.warning( + 7325_error, + _variable.location(), + "Type " + type->canonicalName() + " has large size and thus makes collisions likely. " + "Either use mappings or dynamic arrays and allow their size to be increased only " + "in small quantities per transaction." + ); } return true; } @@ -339,28 +348,44 @@ bool StaticAnalyzer::visit(FunctionCall const& _functionCall) return true; } -bigint StaticAnalyzer::structureSizeEstimate(Type const& _type, set& _structsSeen) +bigint StaticAnalyzer::structureSizeEstimate( + Type const& _type, + set& _structsSeen, + TypeSet& _oversizedSubTypes +) { switch (_type.category()) { case Type::Category::Array: { auto const& t = dynamic_cast(_type); + bigint baseTypeSize = structureSizeEstimate(*t.baseType(), _structsSeen, _oversizedSubTypes); + if (baseTypeSize >= bigint(1) << 64) + _oversizedSubTypes.insert(t.baseType()); if (!t.isDynamicallySized()) - return structureSizeEstimate(*t.baseType(), _structsSeen) * t.length(); + return structureSizeEstimate(*t.baseType(), _structsSeen, _oversizedSubTypes) * t.length(); break; } case Type::Category::Struct: { auto const& t = dynamic_cast(_type); - solAssert(!_structsSeen.count(&t.structDefinition()), "Recursive struct."); bigint size = 1; + if (_structsSeen.count(&t.structDefinition())) + return size; _structsSeen.insert(&t.structDefinition()); for (auto const& m: t.members(nullptr)) - size += structureSizeEstimate(*m.type, _structsSeen); + size += structureSizeEstimate(*m.type, _structsSeen, _oversizedSubTypes); _structsSeen.erase(&t.structDefinition()); return size; } + case Type::Category::Mapping: + { + auto const* valueType = dynamic_cast(_type).valueType(); + bigint valueTypeSize = structureSizeEstimate(*valueType, _structsSeen, _oversizedSubTypes); + if (valueTypeSize >= bigint(1) << 64) + _oversizedSubTypes.insert(valueType); + break; + } default: break; } diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h index 57ac54fb1dfe..8f7fbc59712b 100644 --- a/libsolidity/analysis/StaticAnalyzer.h +++ b/libsolidity/analysis/StaticAnalyzer.h @@ -73,8 +73,22 @@ class StaticAnalyzer: private ASTConstVisitor bool visit(BinaryOperation const& _operation) override; bool visit(FunctionCall const& _functionCall) override; + struct TypeComp + { + bool operator()(Type const* lhs, Type const* rhs) const + { + solAssert(lhs && rhs, ""); + return lhs->richIdentifier() < rhs->richIdentifier(); + } + }; + using TypeSet = std::set; + /// @returns the size of this type in storage, including all sub-types. - static bigint structureSizeEstimate(Type const& _type, std::set& _structsSeen); + static bigint structureSizeEstimate( + Type const& _type, + std::set& _structsSeen, + TypeSet& _oversizedSubTypes + ); langutil::ErrorReporter& m_errorReporter; diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol index 34132bfbe7ca..0471307ef48a 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol @@ -2,3 +2,4 @@ contract C { mapping(uint => uint[2**100]) x; } // ---- +// Warning 7325: (17-48): Type uint256[1267650600228229401496703205376] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol index e7057e7a617f..17113fc7b032 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol @@ -1,18 +1,65 @@ contract C { - struct P0 { uint256[2**63] x; } + struct P { uint256[2**63] x; } + struct S0 { - P0[2**62] y; - P0 x; + P[2**62] x; + P y; } S0 s0; - struct P1 { uint256[2**63] x; } struct S1 { - P1 x; - P1[2**62] y; + P x; + P[2**62] y; } S1 s1; + + struct S2 { + mapping(uint => P[2**62]) x; + mapping(uint => P[2**62]) y; + mapping(uint => S2) z; + } + S2 s2; + + struct Q0 + { + uint[1][][2**65] x; + uint[2**65][][1] y; + uint[][2**65] z; + uint[2**65][] t; + } + Q0 q0; + + struct Q1 + { + uint[1][][2**65] x; + } + Q1 q1; + + struct Q2 + { + uint[2**65][][1] y; + } + Q2 q2; + + struct Q3 + { + uint[][2**65] z; + } + Q3 q3; + + struct Q4 + { + uint[2**65][] t; + } + Q4 q4; } // ---- -// Warning 3408: (110-115): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 3408: (215-220): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (108-113): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (175-180): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (314-319): Type C.P[4611686018427387904] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (458-463): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (458-463): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (524-529): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (590-595): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (653-658): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (716-721): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. From 8b53f85e28d5d1a68663672e1f8e614b9b29ea6b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 15:31:06 +0100 Subject: [PATCH 306/479] Add Yul syntax tests for dots in identifiers --- test/libyul/yulSyntaxTests/are_we_perl_yet.yul | 6 ++++++ test/libyul/yulSyntaxTests/dot_consecutive_function.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul | 4 ++++ .../yulSyntaxTests/dot_consecutive_variabledeclaration.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_ellipse_function.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul | 4 ++++ .../yulSyntaxTests/dot_ellipse_variabledeclaration.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_leading_function.yul | 5 +++++ test/libyul/yulSyntaxTests/dot_leading_function_arg.yul | 5 +++++ test/libyul/yulSyntaxTests/dot_leading_function_ret.yul | 5 +++++ .../yulSyntaxTests/dot_leading_variabledeclaration.yul | 5 +++++ test/libyul/yulSyntaxTests/dot_middle_function.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_middle_function_arg.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_middle_function_ret.yul | 4 ++++ .../yulSyntaxTests/dot_middle_variabledeclaration.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_trailing_function.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul | 4 ++++ test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul | 4 ++++ .../yulSyntaxTests/dot_trailing_variabledeclaration.yul | 4 ++++ 21 files changed, 90 insertions(+) create mode 100644 test/libyul/yulSyntaxTests/are_we_perl_yet.yul create mode 100644 test/libyul/yulSyntaxTests/dot_consecutive_function.yul create mode 100644 test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul create mode 100644 test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul create mode 100644 test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul create mode 100644 test/libyul/yulSyntaxTests/dot_ellipse_function.yul create mode 100644 test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul create mode 100644 test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul create mode 100644 test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul create mode 100644 test/libyul/yulSyntaxTests/dot_leading_function.yul create mode 100644 test/libyul/yulSyntaxTests/dot_leading_function_arg.yul create mode 100644 test/libyul/yulSyntaxTests/dot_leading_function_ret.yul create mode 100644 test/libyul/yulSyntaxTests/dot_leading_variabledeclaration.yul create mode 100644 test/libyul/yulSyntaxTests/dot_middle_function.yul create mode 100644 test/libyul/yulSyntaxTests/dot_middle_function_arg.yul create mode 100644 test/libyul/yulSyntaxTests/dot_middle_function_ret.yul create mode 100644 test/libyul/yulSyntaxTests/dot_middle_variabledeclaration.yul create mode 100644 test/libyul/yulSyntaxTests/dot_trailing_function.yul create mode 100644 test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul create mode 100644 test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul create mode 100644 test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul diff --git a/test/libyul/yulSyntaxTests/are_we_perl_yet.yul b/test/libyul/yulSyntaxTests/are_we_perl_yet.yul new file mode 100644 index 000000000000..ffe8da4078d9 --- /dev/null +++ b/test/libyul/yulSyntaxTests/are_we_perl_yet.yul @@ -0,0 +1,6 @@ +{ + function _...($..) {} + let a... + _...(a...) +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function.yul new file mode 100644 index 000000000000..6b8c0db0880e --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function.yul @@ -0,0 +1,4 @@ +{ + function x..y() {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul new file mode 100644 index 000000000000..1af439328ccc --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul @@ -0,0 +1,4 @@ +{ + function x(a..b) {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul new file mode 100644 index 000000000000..1fc66a18abc5 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul @@ -0,0 +1,4 @@ +{ + function x() -> a..b {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul new file mode 100644 index 000000000000..0f2b4c336991 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul @@ -0,0 +1,4 @@ +{ + let a..b := 1 +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function.yul new file mode 100644 index 000000000000..fbb8f32a3c5a --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function.yul @@ -0,0 +1,4 @@ +{ + function x...y() {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul new file mode 100644 index 000000000000..47dd7b2bb5f8 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul @@ -0,0 +1,4 @@ +{ + function x(a...b) {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul new file mode 100644 index 000000000000..70ba6506991f --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul @@ -0,0 +1,4 @@ +{ + function x() -> a...b {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul new file mode 100644 index 000000000000..47870bfb2276 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul @@ -0,0 +1,4 @@ +{ + let a...b := 1 +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_leading_function.yul b/test/libyul/yulSyntaxTests/dot_leading_function.yul new file mode 100644 index 000000000000..0c9581ec4c22 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_leading_function.yul @@ -0,0 +1,5 @@ +{ + function .x() {} +} +// ---- +// ParserError 2314: (15-16): Expected identifier but got '.' diff --git a/test/libyul/yulSyntaxTests/dot_leading_function_arg.yul b/test/libyul/yulSyntaxTests/dot_leading_function_arg.yul new file mode 100644 index 000000000000..93c8afa6fb06 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_leading_function_arg.yul @@ -0,0 +1,5 @@ +{ + function x(.a) {} +} +// ---- +// ParserError 2314: (17-18): Expected identifier but got '.' diff --git a/test/libyul/yulSyntaxTests/dot_leading_function_ret.yul b/test/libyul/yulSyntaxTests/dot_leading_function_ret.yul new file mode 100644 index 000000000000..c516fd6479a4 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_leading_function_ret.yul @@ -0,0 +1,5 @@ +{ + function x() -> .a {} +} +// ---- +// ParserError 2314: (22-23): Expected identifier but got '.' diff --git a/test/libyul/yulSyntaxTests/dot_leading_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_leading_variabledeclaration.yul new file mode 100644 index 000000000000..b0f86d36de1a --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_leading_variabledeclaration.yul @@ -0,0 +1,5 @@ +{ + let .a := 1 +} +// ---- +// ParserError 2314: (10-11): Expected identifier but got '.' diff --git a/test/libyul/yulSyntaxTests/dot_middle_function.yul b/test/libyul/yulSyntaxTests/dot_middle_function.yul new file mode 100644 index 000000000000..5d5fa15fff08 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_middle_function.yul @@ -0,0 +1,4 @@ +{ + function x.y() {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_middle_function_arg.yul b/test/libyul/yulSyntaxTests/dot_middle_function_arg.yul new file mode 100644 index 000000000000..61ecfcb2cda5 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_middle_function_arg.yul @@ -0,0 +1,4 @@ +{ + function x(a.b) {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_middle_function_ret.yul b/test/libyul/yulSyntaxTests/dot_middle_function_ret.yul new file mode 100644 index 000000000000..06c41be62680 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_middle_function_ret.yul @@ -0,0 +1,4 @@ +{ + function x() -> a.b {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_middle_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_middle_variabledeclaration.yul new file mode 100644 index 000000000000..d7235badc031 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_middle_variabledeclaration.yul @@ -0,0 +1,4 @@ +{ + let a.b := 1 +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function.yul b/test/libyul/yulSyntaxTests/dot_trailing_function.yul new file mode 100644 index 000000000000..4348149d30a3 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_trailing_function.yul @@ -0,0 +1,4 @@ +{ + function x.() {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul b/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul new file mode 100644 index 000000000000..d8fc0336d383 --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul @@ -0,0 +1,4 @@ +{ + function x(a.) {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul b/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul new file mode 100644 index 000000000000..92b9daf161de --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul @@ -0,0 +1,4 @@ +{ + function x() -> a. {} +} +// ---- diff --git a/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul new file mode 100644 index 000000000000..b71a3d583a1b --- /dev/null +++ b/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul @@ -0,0 +1,4 @@ +{ + let a. := 1 +} +// ---- From 4c7c7c02704468cac5d6264bf94a01e27ffec83e Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 20 May 2020 23:54:42 +0100 Subject: [PATCH 307/479] Only use yulAssert and not solAssert in libyul --- libyul/AsmJsonConverter.cpp | 21 ++++++++++----------- libyul/AssemblyStack.cpp | 4 ++-- libyul/backends/evm/EVMDialect.cpp | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index 4af0380cd27b..d2b905ecef43 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include using namespace std; @@ -38,7 +38,7 @@ Json::Value AsmJsonConverter::operator()(Block const& _node) const Json::Value AsmJsonConverter::operator()(TypedName const& _node) const { - solAssert(!_node.name.empty(), "Invalid variable name."); + yulAssert(!_node.name.empty(), "Invalid variable name."); Json::Value ret = createAstNode(_node.location, "YulTypedName"); ret["name"] = _node.name.str(); ret["type"] = _node.type.str(); @@ -51,7 +51,7 @@ Json::Value AsmJsonConverter::operator()(Literal const& _node) const switch (_node.kind) { case LiteralKind::Number: - solAssert( + yulAssert( util::isValidDecimal(_node.value.str()) || util::isValidHex(_node.value.str()), "Invalid number literal" ); @@ -71,7 +71,7 @@ Json::Value AsmJsonConverter::operator()(Literal const& _node) const Json::Value AsmJsonConverter::operator()(Identifier const& _node) const { - solAssert(!_node.name.empty(), "Invalid identifier"); + yulAssert(!_node.name.empty(), "Invalid identifier"); Json::Value ret = createAstNode(_node.location, "YulIdentifier"); ret["name"] = _node.name.str(); return ret; @@ -79,7 +79,7 @@ Json::Value AsmJsonConverter::operator()(Identifier const& _node) const Json::Value AsmJsonConverter::operator()(Assignment const& _node) const { - solAssert(_node.variableNames.size() >= 1, "Invalid assignment syntax"); + yulAssert(_node.variableNames.size() >= 1, "Invalid assignment syntax"); Json::Value ret = createAstNode(_node.location, "YulAssignment"); for (auto const& var: _node.variableNames) ret["variableNames"].append((*this)(var)); @@ -115,7 +115,7 @@ Json::Value AsmJsonConverter::operator()(VariableDeclaration const& _node) const Json::Value AsmJsonConverter::operator()(FunctionDefinition const& _node) const { - solAssert(!_node.name.empty(), "Invalid function name."); + yulAssert(!_node.name.empty(), "Invalid function name."); Json::Value ret = createAstNode(_node.location, "YulFunctionDefinition"); ret["name"] = _node.name.str(); for (auto const& var: _node.parameters) @@ -128,7 +128,7 @@ Json::Value AsmJsonConverter::operator()(FunctionDefinition const& _node) const Json::Value AsmJsonConverter::operator()(If const& _node) const { - solAssert(_node.condition, "Invalid if condition."); + yulAssert(_node.condition, "Invalid if condition."); Json::Value ret = createAstNode(_node.location, "YulIf"); ret["condition"] = std::visit(*this, *_node.condition); ret["body"] = (*this)(_node.body); @@ -137,7 +137,7 @@ Json::Value AsmJsonConverter::operator()(If const& _node) const Json::Value AsmJsonConverter::operator()(Switch const& _node) const { - solAssert(_node.expression, "Invalid expression pointer."); + yulAssert(_node.expression, "Invalid expression pointer."); Json::Value ret = createAstNode(_node.location, "YulSwitch"); ret["expression"] = std::visit(*this, *_node.expression); for (auto const& var: _node.cases) @@ -155,14 +155,14 @@ Json::Value AsmJsonConverter::operator()(Case const& _node) const Json::Value AsmJsonConverter::operator()(ForLoop const& _node) const { - solAssert(_node.condition, "Invalid for loop condition."); + yulAssert(_node.condition, "Invalid for loop condition."); Json::Value ret = createAstNode(_node.location, "YulForLoop"); ret["pre"] = (*this)(_node.pre); ret["condition"] = std::visit(*this, *_node.condition); ret["post"] = (*this)(_node.post); ret["body"] = (*this)(_node.body); return ret; - } +} Json::Value AsmJsonConverter::operator()(Break const& _node) const { @@ -196,7 +196,6 @@ Json::Value AsmJsonConverter::vectorOfVariantsToJson(vector const& _vec) cons Json::Value ret{Json::arrayValue}; for (auto const& var: _vec) ret.append(std::visit(*this, var)); - return ret; } diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index e0ff93939c5e..4598d6d2b90b 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -108,7 +108,7 @@ void AssemblyStack::translate(AssemblyStack::Language _targetLanguage) if (m_language == _targetLanguage) return; - solAssert( + yulAssert( m_language == Language::StrictAssembly && _targetLanguage == Language::Ewasm, "Invalid language combination" ); @@ -160,7 +160,7 @@ void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _evm15, bool _o dialect = &EVMDialectTyped::instance(m_evmVersion); break; default: - solAssert(false, "Invalid language."); + yulAssert(false, "Invalid language."); break; } diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index b6a46043e8f3..99d52d0808a5 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -93,7 +93,7 @@ pair createFunction( std::function)> _generateCode ) { - solAssert(_literalArguments.size() == _params || _literalArguments.empty(), ""); + yulAssert(_literalArguments.size() == _params || _literalArguments.empty(), ""); YulString name{std::move(_name)}; BuiltinFunctionForEVM f; @@ -207,7 +207,7 @@ map createBuiltins(langutil::EVMVersion _evmVe BuiltinContext&, std::function _visitExpression ) { - solAssert(_call.arguments.size() == 2, ""); + yulAssert(_call.arguments.size() == 2, ""); _visitExpression(_call.arguments[1]); _assembly.setSourceLocation(_call.location); @@ -227,7 +227,7 @@ map createBuiltins(langutil::EVMVersion _evmVe BuiltinContext&, std::function ) { - solAssert(_call.arguments.size() == 1, ""); + yulAssert(_call.arguments.size() == 1, ""); _assembly.appendImmutable(std::get(_call.arguments.front()).value.str()); } )); From 711ed588d7dde79a82faff48d1e3354c117cf45d Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 Jul 2020 17:02:26 +0200 Subject: [PATCH 308/479] Require for loop init rewriter for SSA. Co-authored-by: Harikrishnan Mulackal --- libyul/optimiser/SSATransform.cpp | 8 ++--- libyul/optimiser/SSATransform.h | 2 +- test/libyul/YulOptimizerTest.cpp | 1 + .../ssaTransform/for_def_in_init.yul | 33 +++++++++++++++++++ .../ssaTransform/for_reassign_body.yul | 3 +- .../ssaTransform/for_reassign_init.yul | 20 +++-------- .../ssaTransform/for_reassign_post.yul | 3 +- .../ssaTransform/for_simple.yul | 7 ++-- 8 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 test/libyul/yulOptimizerTests/ssaTransform/for_def_in_init.yul diff --git a/libyul/optimiser/SSATransform.cpp b/libyul/optimiser/SSATransform.cpp index 948a0e6a69ff..21165cd47315 100644 --- a/libyul/optimiser/SSATransform.cpp +++ b/libyul/optimiser/SSATransform.cpp @@ -194,7 +194,7 @@ void IntroduceControlFlowSSA::operator()(FunctionDefinition& _function) void IntroduceControlFlowSSA::operator()(ForLoop& _for) { - (*this)(_for.pre); + yulAssert(_for.pre.statements.empty(), "For loop init rewriter not run."); Assignments assignments; assignments(_for.body); @@ -357,11 +357,7 @@ void PropagateValues::operator()(Assignment& _assignment) void PropagateValues::operator()(ForLoop& _for) { - // This will clear the current value in case of a reassignment inside the - // init part, although the new variable would still be in scope inside the whole loop. - // This small inefficiency is fine if we move the pre part of all for loops out - // of the for loop. - (*this)(_for.pre); + yulAssert(_for.pre.statements.empty(), "For loop init rewriter not run."); Assignments assignments; assignments(_for.body); diff --git a/libyul/optimiser/SSATransform.h b/libyul/optimiser/SSATransform.h index aa6efb821156..201b1981a335 100644 --- a/libyul/optimiser/SSATransform.h +++ b/libyul/optimiser/SSATransform.h @@ -85,7 +85,7 @@ class NameDispenser; * * TODO Which transforms are required to keep this idempotent? * - * Prerequisite: Disambiguator. + * Prerequisite: Disambiguator, ForLoopInitRewriter. */ class SSATransform: public ASTModifier { diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index a4507e18031c..95d7bee64c0c 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -255,6 +255,7 @@ TestCase::TestResult YulOptimizerTest::run(ostream& _stream, string const& _line else if (m_optimizerStep == "ssaTransform") { disambiguate(); + ForLoopInitRewriter::run(*m_context, *m_ast); SSATransform::run(*m_context, *m_ast); } else if (m_optimizerStep == "redundantAssignEliminator") diff --git a/test/libyul/yulOptimizerTests/ssaTransform/for_def_in_init.yul b/test/libyul/yulOptimizerTests/ssaTransform/for_def_in_init.yul new file mode 100644 index 000000000000..40fce8613e27 --- /dev/null +++ b/test/libyul/yulOptimizerTests/ssaTransform/for_def_in_init.yul @@ -0,0 +1,33 @@ +{ + for { let x := 0 } 1 { x := 2 } { + for { let y := 0 } 1 { y := 6 } { + } + } +} +// ---- +// step: ssaTransform +// +// { +// let x_1 := 0 +// let x := x_1 +// for { } +// 1 +// { +// let x_7 := x +// let x_2 := 2 +// x := x_2 +// } +// { +// let x_5 := x +// let y_3 := 0 +// let y := y_3 +// for { } +// 1 +// { +// let y_6 := y +// let y_4 := 6 +// y := y_4 +// } +// { } +// } +// } diff --git a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_body.yul b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_body.yul index e1e1c13ba82f..8894a789ef91 100644 --- a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_body.yul +++ b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_body.yul @@ -12,7 +12,8 @@ // { // let a_1 := mload(0) // let a := a_1 -// for { mstore(0, a_1) } +// mstore(0, a_1) +// for { } // a // { // let a_4 := a diff --git a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_init.yul b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_init.yul index 284bdbf3d8e4..d3a095285d45 100644 --- a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_init.yul +++ b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_init.yul @@ -12,19 +12,9 @@ // { // let a_1 := mload(0) // let a := a_1 -// for { -// let a_2 := add(a_1, 3) -// a := a_2 -// } -// a -// { -// let a_4 := a -// mstore(0, a_4) -// } -// { -// let a_3 := a -// mstore(0, a_3) -// } -// let a_5 := a -// mstore(0, a_5) +// let a_2 := add(a_1, 3) +// a := a_2 +// for { } a_2 { mstore(0, a_2) } +// { mstore(0, a_2) } +// mstore(0, a_2) // } diff --git a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_post.yul b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_post.yul index ac7e426abef5..cec17e553085 100644 --- a/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_post.yul +++ b/test/libyul/yulOptimizerTests/ssaTransform/for_reassign_post.yul @@ -12,7 +12,8 @@ // { // let a_1 := mload(0) // let a := a_1 -// for { mstore(0, a_1) } +// mstore(0, a_1) +// for { } // a // { // let a_4 := a diff --git a/test/libyul/yulOptimizerTests/ssaTransform/for_simple.yul b/test/libyul/yulOptimizerTests/ssaTransform/for_simple.yul index 77ac89a60d89..846b22c6c631 100644 --- a/test/libyul/yulOptimizerTests/ssaTransform/for_simple.yul +++ b/test/libyul/yulOptimizerTests/ssaTransform/for_simple.yul @@ -32,10 +32,9 @@ // a := a_4 // } // let a_10 := a -// for { -// let a_5 := add(a_10, 3) -// a := a_5 -// } +// let a_5 := add(a_10, 3) +// a := a_5 +// for { } // a // { // let a_12 := a From 51522f99c4bc2b94a6ff35531c0671184775ab27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 3 Jul 2020 21:20:29 +0200 Subject: [PATCH 309/479] Fix mismatched docstrings in some of the scripts --- scripts/get_version.sh | 2 +- scripts/test_emscripten.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get_version.sh b/scripts/get_version.sh index 3df2b4c40682..180ff3cd6691 100755 --- a/scripts/get_version.sh +++ b/scripts/get_version.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #------------------------------------------------------------------------------ -# Bash script to execute the Solidity tests. +# Prints version of the Solidity compiler that the source code corresponds to. # # The documentation for solidity is hosted at: # diff --git a/scripts/test_emscripten.sh b/scripts/test_emscripten.sh index 13eeeebdee3a..980cee196d53 100755 --- a/scripts/test_emscripten.sh +++ b/scripts/test_emscripten.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #------------------------------------------------------------------------------ -# Bash script to execute the Solidity tests. +# Bash script to execute the Solidity tests using the emscripten binary. # # The documentation for solidity is hosted at: # From 9b2c1970917c9810b8068e6b5ac57d660f991423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 3 Jul 2020 21:21:15 +0200 Subject: [PATCH 310/479] Fix a typo in yul_converage script docstring --- scripts/yul_coverage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/yul_coverage.sh b/scripts/yul_coverage.sh index d49065f69d92..c32dc9472d6d 100755 --- a/scripts/yul_coverage.sh +++ b/scripts/yul_coverage.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #------------------------------------------------------------------------------ -# Bash script to determine the percantage of tests that are compilable via Yul. +# Bash script to determine the percentage of tests that are compilable via Yul. # # Usage: # ./yul_coverage.sh [--no-stats] [--successful] [--internal-compiler-errors] From 67ea1931eeec24e1030c32433ed68e7ed6a98c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 3 Jul 2020 21:26:01 +0200 Subject: [PATCH 311/479] A script that generates version string for nightlies --- scripts/get_nightly_version.sh | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 scripts/get_nightly_version.sh diff --git a/scripts/get_nightly_version.sh b/scripts/get_nightly_version.sh new file mode 100755 index 000000000000..bbac846381c3 --- /dev/null +++ b/scripts/get_nightly_version.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Prints the exact version string that would be used to describe a nightly +# build of the compiler. +# +# The documentation for solidity is hosted at: +# +# https://solidity.readthedocs.org +# +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2017 solidity contributors. +#------------------------------------------------------------------------------ + +set -e + +script_dir="$(dirname "$0")" + +solidity_version=$("${script_dir}/get_version.sh") +last_commit_timestamp=$(git log -1 --date=iso --format=%ad HEAD) +last_commit_date=$(date --date="$last_commit_timestamp" --utc +%Y.%-m.%-d) +last_commit_hash=$(git rev-parse --short=8 HEAD) + +echo "v${solidity_version}-nightly.${last_commit_date}+commit.${last_commit_hash}" From 27f0529b801d1696b0cf144566d55e17c3e4b3e8 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 3 Jul 2020 17:18:57 +0200 Subject: [PATCH 312/479] [SMTChecker] Decrease Z3 resource limit --- libsmtutil/Z3Interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsmtutil/Z3Interface.h b/libsmtutil/Z3Interface.h index 1662323bc5c9..d1fdce0f8d03 100644 --- a/libsmtutil/Z3Interface.h +++ b/libsmtutil/Z3Interface.h @@ -48,9 +48,9 @@ class Z3Interface: public SolverInterface, public boost::noncopyable // Z3 "basic resources" limit. // This is used to make the runs more deterministic and platform/machine independent. - // The tests start failing for Z3 with less than 20000000, + // The tests start failing for Z3 with less than 10000000, // so using double that. - static int const resourceLimit = 40000000; + static int const resourceLimit = 20000000; private: void declareFunction(std::string const& _name, Sort const& _sort); From f0d256bfdbf569973f55a9e4a7739b639ffc25e2 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 12:26:35 +0100 Subject: [PATCH 313/479] Add test case for jumpi in inline assembly --- .../inlineAssembly/invalid/jumpi_disallowed.sol | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/jumpi_disallowed.sol diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/jumpi_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/jumpi_disallowed.sol new file mode 100644 index 000000000000..1b4fc4a65224 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/jumpi_disallowed.sol @@ -0,0 +1,9 @@ +contract C { + function f() pure public { + assembly { + jumpi(2, 1) + } + } +} +// ---- +// DeclarationError 4619: (75-80): Function not found. From 8cdf14f1b37281e45080ef369cb06c0d7173f48d Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 6 Jul 2020 13:44:33 +0200 Subject: [PATCH 314/479] Replace "doesn't" with "does not" in error message --- libsolidity/analysis/TypeChecker.cpp | 2 +- .../282_invalid_different_types_for_conditional_expression.sol | 2 +- .../284_conditional_expression_with_different_struct.sol | 2 +- .../285_conditional_expression_with_different_function_type.sol | 2 +- .../286_conditional_expression_with_different_enum.sol | 2 +- .../287_conditional_expression_with_different_mapping.sol | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8ac88d506c45..5c49bf1dc50c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1336,7 +1336,7 @@ bool TypeChecker::visit(Conditional const& _conditional) _conditional.location(), "True expression's type " + trueType->toString() + - " doesn't match false expression's type " + + " does not match false expression's type " + falseType->toString() + "." ); diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol index 78097742df4e..da2ae63ae4c6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/282_invalid_different_types_for_conditional_expression.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 1080: (47-62): True expression's type bool doesn't match false expression's type uint8. +// TypeError 1080: (47-62): True expression's type bool does not match false expression's type uint8. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol index 509e559d2f8f..1141ff084133 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/284_conditional_expression_with_different_struct.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// TypeError 1080: (165-177): True expression's type struct C.s1 memory doesn't match false expression's type struct C.s2 memory. +// TypeError 1080: (165-177): True expression's type struct C.s1 memory does not match false expression's type struct C.s2 memory. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol index 9846bd656f48..7d55d61efa95 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/285_conditional_expression_with_different_function_type.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError 1080: (106-118): True expression's type function (bool) doesn't match false expression's type function (). +// TypeError 1080: (106-118): True expression's type function (bool) does not match false expression's type function (). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol index dd1303336402..c0cb69db6901 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/286_conditional_expression_with_different_enum.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// TypeError 1080: (139-151): True expression's type enum C.small doesn't match false expression's type enum C.big. +// TypeError 1080: (139-151): True expression's type enum C.small does not match false expression's type enum C.big. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol index b20c872d941f..8bf1268c04ca 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/287_conditional_expression_with_different_mapping.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError 1080: (121-143): True expression's type mapping(uint8 => uint8) doesn't match false expression's type mapping(uint32 => uint8). +// TypeError 1080: (121-143): True expression's type mapping(uint8 => uint8) does not match false expression's type mapping(uint32 => uint8). From 5e4aeaa4606d03664653ee9390afb539ee1903e5 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Sat, 4 Jul 2020 00:04:09 +0200 Subject: [PATCH 315/479] Add variable name to the "Variable covers a large part of storage ...." message --- libsolidity/analysis/StaticAnalyzer.cpp | 6 ++- .../large_storage_array_mapping.sol | 2 +- .../largeTypes/large_storage_array_simple.sol | 2 +- .../large_storage_arrays_struct.sol | 2 +- .../largeTypes/large_storage_structs.sol | 46 ++++++++++--------- .../rational_number_array_index_limit.sol | 2 +- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index bee1197b38d1..b650f1fc1cbe 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -163,7 +163,8 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) m_errorReporter.warning( 3408_error, _variable.location(), - "Variable covers a large part of storage and thus makes collisions likely. " + "Variable " + util::escapeAndQuoteString(_variable.name()) + + " covers a large part of storage and thus makes collisions likely. " "Either use mappings or dynamic arrays and allow their size to be increased only " "in small quantities per transaction." ); @@ -171,7 +172,8 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) m_errorReporter.warning( 7325_error, _variable.location(), - "Type " + type->canonicalName() + " has large size and thus makes collisions likely. " + "Type " + util::escapeAndQuoteString(type->canonicalName()) + + " has large size and thus makes collisions likely. " "Either use mappings or dynamic arrays and allow their size to be increased only " "in small quantities per transaction." ); diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol index 0471307ef48a..01a68bcda6a1 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol @@ -2,4 +2,4 @@ contract C { mapping(uint => uint[2**100]) x; } // ---- -// Warning 7325: (17-48): Type uint256[1267650600228229401496703205376] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (17-48): Type "uint256[1267650600228229401496703205376]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol index 5b8f306a930c..3f7499ca2ed9 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_simple.sol @@ -2,4 +2,4 @@ contract C { uint[2**64] x; } // ---- -// Warning 3408: (17-30): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-30): Variable "x" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol index 02b7276d693b..285b99deb305 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_arrays_struct.sol @@ -3,4 +3,4 @@ contract C { S[2**20] x; } // ---- -// Warning 3408: (64-74): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (64-74): Variable "x" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol index 17113fc7b032..2956a65494b1 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol @@ -2,64 +2,66 @@ contract C { struct P { uint256[2**63] x; } struct S0 { - P[2**62] x; + P[101] x; P y; } S0 s0; struct S1 { P x; - P[2**62] y; + P[102] y; } S1 s1; struct S2 { - mapping(uint => P[2**62]) x; - mapping(uint => P[2**62]) y; - mapping(uint => S2) z; + mapping(uint => P[103]) x; + mapping(uint => P[103]) y; + mapping(uint => P[104]) z; + mapping(uint => S2) t; } S2 s2; struct Q0 { - uint[1][][2**65] x; - uint[2**65][][1] y; - uint[][2**65] z; - uint[2**65][] t; + uint[1][][10**20 + 4] x; + uint[10**20 + 4][][1] y; + uint[][10**20 + 4] z; + uint[10**20 + 4][] t; } Q0 q0; struct Q1 { - uint[1][][2**65] x; + uint[1][][10**20 + 5] x; } Q1 q1; struct Q2 { - uint[2**65][][1] y; + uint[10**20 + 6][][1] y; } Q2 q2; struct Q3 { - uint[][2**65] z; + uint[][10**20 + 7] x; } Q3 q3; struct Q4 { - uint[2**65][] t; + uint[10**20 + 8][] y; } Q4 q4; } // ---- -// Warning 3408: (108-113): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 3408: (175-180): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (314-319): Type C.P[4611686018427387904] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 3408: (458-463): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (458-463): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 3408: (524-529): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (590-595): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 3408: (653-658): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (716-721): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (106-111): Variable "s0" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (171-176): Variable "s1" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (341-346): Type "C.P[103]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (341-346): Type "C.P[104]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (505-510): Variable "q0" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (505-510): Type "uint256[100000000000000000004]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (576-581): Variable "q1" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (647-652): Type "uint256[100000000000000000006]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (715-720): Variable "q3" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (783-788): Type "uint256[100000000000000000008]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol index 912d8df14ca5..9b4f05c42ef6 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_array_index_limit.sol @@ -2,4 +2,4 @@ contract c { uint[2**253] data; } // ---- -// Warning 3408: (17-34): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (17-34): Variable "data" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. From 55e41b602adbde79bc03c1ba9bea2e7f1c029201 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 18:01:07 +0100 Subject: [PATCH 316/479] Explicitly check for jump instructions in EVMDialect --- libyul/backends/evm/EVMDialect.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 602b6c8ff478..bf0c63bfa50c 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -114,12 +114,15 @@ pair createFunction( map createBuiltins(langutil::EVMVersion _evmVersion, bool _objectAccess) { map builtins; + // NOTE: Parser::instructions() will filter JUMPDEST and PUSHnn too for (auto const& instr: Parser::instructions()) if ( !evmasm::isDupInstruction(instr.second) && !evmasm::isSwapInstruction(instr.second) && + !evmasm::isPushInstruction(instr.second) && instr.second != evmasm::Instruction::JUMP && instr.second != evmasm::Instruction::JUMPI && + instr.second != evmasm::Instruction::JUMPDEST && _evmVersion.hasOpcode(instr.second) ) builtins.emplace(createEVMFunction(instr.first, instr.second)); From 67ebb206eab4863d47f67ed219ee4dbaa985819f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 6 Jul 2020 14:46:13 +0100 Subject: [PATCH 317/479] Turn Instruction::JUMP* into yulAssert --- libyul/AsmAnalysis.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index c7e825759ceb..ad697fb40405 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -558,6 +558,13 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio // Similarly we assume bitwise shifting and create2 go together. yulAssert(m_evmVersion.hasBitwiseShifting() == m_evmVersion.hasCreate2(), ""); + // These instructions are disabled in the dialect. + yulAssert( + _instr != evmasm::Instruction::JUMP && + _instr != evmasm::Instruction::JUMPI && + _instr != evmasm::Instruction::JUMPDEST, + ""); + auto errorForVM = [&](ErrorId _errorId, string const& vmKindMessage) { m_errorReporter.typeError( _errorId, @@ -602,19 +609,6 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio ); else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) errorForVM(3672_error, "only available for Istanbul-compatible"); - else if ( - _instr == evmasm::Instruction::JUMP || - _instr == evmasm::Instruction::JUMPI || - _instr == evmasm::Instruction::JUMPDEST - ) - m_errorReporter.error( - 4316_error, - Error::Type::SyntaxError, - _location, - "Jump instructions and labels are low-level EVM features that can lead to " - "incorrect stack access. Because of that they are disallowed in strict assembly. " - "Use functions, \"switch\", \"if\" or \"for\" statements instead." - ); else return false; From 60d4b1e8ccb198cfab27b013df966d7ad51bcd2e Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 6 Jul 2020 15:31:25 +0100 Subject: [PATCH 318/479] Rename drop to i64.drop in WasmDialect Also properly implement support for both i32.drop and i64.drop in BinaryTransform, TextTransform, and YulInterpreter --- Changelog.md | 1 + libyul/backends/wasm/BinaryTransform.cpp | 2 +- libyul/backends/wasm/TextTransform.cpp | 5 ++++- libyul/backends/wasm/WasmDialect.cpp | 6 +++--- test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 837c0f1b9bcc..6407cd8b1806 100644 --- a/Changelog.md +++ b/Changelog.md @@ -20,6 +20,7 @@ Bugfixes: * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. * Type Checker: Do not disallow assigning to calldata variables. * Wasm backend: Fix code generation for for-loops with pre statements. + * Wasm backend: Properly support both ``i32.drop`` and ``i64.drop``, and remove ``drop``. * Yul: Fix source location of variable multi-assignment. diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 82de96b518ae..38438e12eb73 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -390,7 +390,7 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) return toBytes(Opcode::Unreachable); else if (_call.functionName == "nop") return toBytes(Opcode::Nop); - else if (_call.functionName == "drop") + else if (_call.functionName == "i32.drop" || _call.functionName == "i64.drop") return toBytes(Opcode::Drop); else { diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index b7f1e81ea512..ee2aa86e471d 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -94,7 +94,10 @@ string TextTransform::operator()(wasm::GlobalVariable const& _identifier) string TextTransform::operator()(wasm::BuiltinCall const& _builtinCall) { string args = joinTransformed(_builtinCall.arguments); - return "(" + _builtinCall.functionName + (args.empty() ? "" : " " + args) + ")"; + string funcName = _builtinCall.functionName; + if (funcName == "i32.drop" || funcName == "i64.drop") + funcName = "drop"; + return "(" + funcName + (args.empty() ? "" : " " + args) + ")"; } string TextTransform::operator()(wasm::FunctionCall const& _functionCall) diff --git a/libyul/backends/wasm/WasmDialect.cpp b/libyul/backends/wasm/WasmDialect.cpp index c9dfe05c78e0..39138dfb2861 100644 --- a/libyul/backends/wasm/WasmDialect.cpp +++ b/libyul/backends/wasm/WasmDialect.cpp @@ -91,9 +91,9 @@ WasmDialect::WasmDialect() m_functions["i64.load"_yulstring].sideEffects.sideEffectFreeIfNoMSize = true; // Drop is actually overloaded for all types, but Yul does not support that. - // Because of that, we introduce "i32.drop". - addFunction("drop", {i64}, {}); + // Because of that, we introduce "i32.drop" and "i64.drop". addFunction("i32.drop", {i32}, {}); + addFunction("i64.drop", {i64}, {}); addFunction("nop", {}, {}); addFunction("unreachable", {}, {}, false); @@ -122,7 +122,7 @@ BuiltinFunction const* WasmDialect::discardFunction(YulString _type) const if (_type == "i32"_yulstring) return builtin("i32.drop"_yulstring); yulAssert(_type == "i64"_yulstring, ""); - return builtin("drop"_yulstring); + return builtin("i64.drop"_yulstring); } BuiltinFunction const* WasmDialect::equalityFunction(YulString _type) const diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index b523e7efe2fb..b09fb5a87381 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -93,7 +93,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a ); return 0; } - else if (_fun == "drop"_yulstring || _fun == "nop"_yulstring) + else if (_fun == "i32.drop"_yulstring || _fun == "i64.drop"_yulstring || _fun == "nop"_yulstring) return {}; else if (_fun == "i32.wrap_i64"_yulstring) return arg.at(0) & uint32_t(-1); From f372ba6feaf679012417697a32d79e17b282f9c3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 16:52:51 +0200 Subject: [PATCH 319/479] Constructors cannot have calldata parameters. --- Changelog.md | 1 + libsolidity/ast/AST.cpp | 11 ++++++++++- libsolidity/ast/AST.h | 1 + .../constructor/calldata_constructor_args.sol | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol diff --git a/Changelog.md b/Changelog.md index 837c0f1b9bcc..fa4e4680044f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. * Type Checker: Do not disallow assigning to calldata variables. + * Type Checker: Disallow constructor parameters with ``calldata`` data location. * Wasm backend: Fix code generation for for-loops with pre statements. * Yul: Fix source location of variable multi-assignment. diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index f3f79f451284..cba5bccc39e4 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -588,6 +588,15 @@ bool VariableDeclaration::isInternalCallableParameter() const return false; } +bool VariableDeclaration::isConstructorParameter() const +{ + if (!isCallableOrCatchParameter()) + return false; + if (auto const* function = dynamic_cast(scope())) + return function->isConstructor(); + return false; +} + bool VariableDeclaration::isLibraryFunctionParameter() const { if (!isCallableOrCatchParameter()) @@ -622,7 +631,7 @@ set VariableDeclaration::allowedDataLocations() c set locations{ Location::Memory }; if (isInternalCallableParameter() || isLibraryFunctionParameter() || isTryCatchParameter()) locations.insert(Location::Storage); - if (!isTryCatchParameter()) + if (!isTryCatchParameter() && !isConstructorParameter()) locations.insert(Location::CallData); return locations; diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 88c3e1beb094..34fefeb0a042 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -928,6 +928,7 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented /// @returns true if this variable is a parameter or return parameter of an internal function /// or a function type of internal visibility. bool isInternalCallableParameter() const; + bool isConstructorParameter() const; /// @returns true iff this variable is a parameter(or return parameter of a library function bool isLibraryFunctionParameter() const; /// @returns true if the type of the variable does not need to be specified, i.e. it is declared diff --git a/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol new file mode 100644 index 000000000000..c4ce52102d86 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol @@ -0,0 +1,5 @@ +contract C { + constructor(uint[] calldata) public {} +} +// ---- +// TypeError 6651: (29-44): Data location must be "memory" for parameter in function, but "calldata" was given. From c0adf2bb4c24713982413a0fe5d71386dcecd32e Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 17:08:08 +0200 Subject: [PATCH 320/479] Tests for memory in external functions. --- .../memory_params_in_external_function.sol | 18 +++++++++++++++++ .../memory_params_in_external_function.sol | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol create mode 100644 test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol diff --git a/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol b/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol new file mode 100644 index 000000000000..b0ba6dfaf0ff --- /dev/null +++ b/test/libsolidity/semanticTests/abiEncoderV1/memory_params_in_external_function.sol @@ -0,0 +1,18 @@ +contract C { + function f(bytes memory a, bytes calldata b, uint[] memory c) + external + pure + returns (uint, byte, uint, byte, 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) { + uint[] memory x = new uint[](4); + x[3] = 7; + return this.f("abc", "def", x); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 3, 0x6200000000000000000000000000000000000000000000000000000000000000, 3, 0x6600000000000000000000000000000000000000000000000000000000000000, 4, 7 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol b/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol new file mode 100644 index 000000000000..6c4845403b79 --- /dev/null +++ b/test/libsolidity/semanticTests/abiEncoderV2/memory_params_in_external_function.sol @@ -0,0 +1,20 @@ +pragma experimental ABIEncoderV2; + +contract C { + function f(bytes memory a, bytes calldata b, uint[] memory c) + external + pure + returns (uint, byte, uint, byte, 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) { + uint[] memory x = new uint[](4); + x[3] = 7; + return this.f("abc", "def", x); + } +} +// ==== +// compileViaYul: also +// ---- +// g() -> 3, 0x6200000000000000000000000000000000000000000000000000000000000000, 3, 0x6600000000000000000000000000000000000000000000000000000000000000, 4, 7 From 65c50b14c80ef934c0ba4b0e6358938aae8800d0 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 16:49:49 +0100 Subject: [PATCH 321/479] Remove unused instructionNames() function in AsmParser --- libyul/AsmParser.cpp | 14 -------------- libyul/AsmParser.h | 1 - 2 files changed, 15 deletions(-) diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index d3d74ac350d5..8dcb9a83259f 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -297,20 +297,6 @@ Expression Parser::parseExpression() } } -std::map const& Parser::instructionNames() -{ - static map s_instructionNames; - if (s_instructionNames.empty()) - { - for (auto const& instr: instructions()) - s_instructionNames[instr.second] = instr.first; - // set the ambiguous instructions to a clear default - s_instructionNames[evmasm::Instruction::SELFDESTRUCT] = "selfdestruct"; - s_instructionNames[evmasm::Instruction::KECCAK256] = "keccak256"; - } - return s_instructionNames; -} - Parser::ElementaryOperation Parser::parseElementaryOperation() { RecursionGuard recursionGuard(*this); diff --git a/libyul/AsmParser.h b/libyul/AsmParser.h index 3c70abd7ef3c..4c1d6980f3ad 100644 --- a/libyul/AsmParser.h +++ b/libyul/AsmParser.h @@ -86,7 +86,6 @@ class Parser: public langutil::ParserBase ForLoop parseForLoop(); /// Parses a functional expression that has to push exactly one stack element Expression parseExpression(); - static std::map const& instructionNames(); /// Parses an elementary operation, i.e. a literal, identifier, instruction or /// builtin functian call (only the name). ElementaryOperation parseElementaryOperation(); From 4d2b9cd38f95d9338c1b29b37f311e614bb18792 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Jun 2020 14:22:01 +0200 Subject: [PATCH 322/479] Jump types for yul functions. --- Changelog.md | 1 + libsolidity/codegen/CompilerContext.cpp | 2 +- libyul/backends/evm/AbstractAssembly.h | 7 +- libyul/backends/evm/AsmCodeGen.cpp | 31 +++++++-- libyul/backends/evm/AsmCodeGen.h | 7 +- libyul/backends/evm/EVMAssembly.cpp | 8 +-- libyul/backends/evm/EVMAssembly.h | 6 +- libyul/backends/evm/EVMCodeTransform.cpp | 8 ++- libyul/backends/evm/NoOutputAssembly.cpp | 8 +-- libyul/backends/evm/NoOutputAssembly.h | 6 +- test/cmdlineTests/yul_stack_opt/output | 8 ++- test/libsolidity/Assembly.cpp | 24 +++++++ .../libyul/objectCompiler/function_series.yul | 6 +- test/libyul/objectCompiler/jump_tags.yul | 64 +++++++++++++++++++ 14 files changed, 151 insertions(+), 35 deletions(-) create mode 100644 test/libyul/objectCompiler/jump_tags.yul diff --git a/Changelog.md b/Changelog.md index 9736a352c501..2228741c56ad 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Compiler Features: * NatSpec: Add fields "kind" and "version" to the JSON output. * NatSpec: Inherit tags from unique base if derived function does not provide any. * Commandline Interface: Prevent some incompatible commandline options from being used together. + * Debug data: Also tag jumps into and out of Yul functions as jumps into and out of functions. * NatSpec: Support NatSpec comments on events. * Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``. * SMTChecker: Support external calls to unknown code. diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 4a9b1918d356..2f3659010a51 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -146,7 +146,7 @@ void CompilerContext::callYulFunction( m_externallyUsedYulFunctions.insert(_name); auto const retTag = pushNewTag(); CompilerUtils(*this).moveIntoStack(_inArgs); - appendJumpTo(namedTag(_name)); + appendJumpTo(namedTag(_name), evmasm::AssemblyItem::JumpType::IntoFunction); adjustStackOffset(static_cast(_outArgs) - 1 - static_cast(_inArgs)); *this << retTag.tag(); } diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index b46c2f734855..42622272cd87 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -50,6 +50,7 @@ class AbstractAssembly public: using LabelID = size_t; using SubID = size_t; + enum class JumpType { Ordinary, IntoFunction, OutOfFunction }; virtual ~AbstractAssembly() = default; @@ -78,13 +79,13 @@ class AbstractAssembly /// Append a jump instruction. /// @param _stackDiffAfter the stack adjustment after this instruction. /// This is helpful to stack height analysis if there is no continuing control flow. - virtual void appendJump(int _stackDiffAfter) = 0; + virtual void appendJump(int _stackDiffAfter, JumpType _jumpType = JumpType::Ordinary) = 0; /// Append a jump-to-immediate operation. /// @param _stackDiffAfter the stack adjustment after this instruction. - virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter = 0) = 0; + virtual void appendJumpTo(LabelID _labelId, int _stackDiffAfter = 0, JumpType _jumpType = JumpType::Ordinary) = 0; /// Append a jump-to-if-immediate operation. - virtual void appendJumpToIf(LabelID _labelId) = 0; + virtual void appendJumpToIf(LabelID _labelId, JumpType _jumpType = JumpType::Ordinary) = 0; /// Start a subroutine identified by @a _labelId that takes @a _arguments /// stack slots as arguments. virtual void appendBeginsub(LabelID _labelId, int _arguments) = 0; diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 5827f6524844..327ce8895518 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -98,22 +98,22 @@ void EthAssemblyAdapter::appendLinkerSymbol(std::string const& _linkerSymbol) m_assembly.appendLibraryAddress(_linkerSymbol); } -void EthAssemblyAdapter::appendJump(int _stackDiffAfter) +void EthAssemblyAdapter::appendJump(int _stackDiffAfter, JumpType _jumpType) { - appendInstruction(evmasm::Instruction::JUMP); + appendJumpInstruction(evmasm::Instruction::JUMP, _jumpType); m_assembly.adjustDeposit(_stackDiffAfter); } -void EthAssemblyAdapter::appendJumpTo(LabelID _labelId, int _stackDiffAfter) +void EthAssemblyAdapter::appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) { appendLabelReference(_labelId); - appendJump(_stackDiffAfter); + appendJump(_stackDiffAfter, _jumpType); } -void EthAssemblyAdapter::appendJumpToIf(LabelID _labelId) +void EthAssemblyAdapter::appendJumpToIf(LabelID _labelId, JumpType _jumpType) { appendLabelReference(_labelId); - appendInstruction(evmasm::Instruction::JUMPI); + appendJumpInstruction(evmasm::Instruction::JUMPI, _jumpType); } void EthAssemblyAdapter::appendBeginsub(LabelID, int) @@ -189,6 +189,25 @@ EthAssemblyAdapter::LabelID EthAssemblyAdapter::assemblyTagToIdentifier(evmasm:: return LabelID(id); } +void EthAssemblyAdapter::appendJumpInstruction(evmasm::Instruction _instruction, JumpType _jumpType) +{ + yulAssert(_instruction == evmasm::Instruction::JUMP || _instruction == evmasm::Instruction::JUMPI, ""); + evmasm::AssemblyItem jump(_instruction); + switch (_jumpType) + { + case JumpType::Ordinary: + yulAssert(jump.getJumpType() == evmasm::AssemblyItem::JumpType::Ordinary, ""); + break; + case JumpType::IntoFunction: + jump.setJumpType(evmasm::AssemblyItem::JumpType::IntoFunction); + break; + case JumpType::OutOfFunction: + jump.setJumpType(evmasm::AssemblyItem::JumpType::OutOfFunction); + break; + } + m_assembly.append(std::move(jump)); +} + void CodeGenerator::assemble( Block const& _parsedData, AsmAnalysisInfo& _analysisInfo, diff --git a/libyul/backends/evm/AsmCodeGen.h b/libyul/backends/evm/AsmCodeGen.h index e126ba2c08d4..6ff02009c6b9 100644 --- a/libyul/backends/evm/AsmCodeGen.h +++ b/libyul/backends/evm/AsmCodeGen.h @@ -49,9 +49,9 @@ class EthAssemblyAdapter: public AbstractAssembly size_t newLabelId() override; size_t namedLabel(std::string const& _name) override; void appendLinkerSymbol(std::string const& _linkerSymbol) override; - void appendJump(int _stackDiffAfter) override; - void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override; - void appendJumpToIf(LabelID _labelId) override; + void appendJump(int _stackDiffAfter, JumpType _jumpType) override; + void appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) override; + void appendJumpToIf(LabelID _labelId, JumpType _jumpType) override; void appendBeginsub(LabelID, int) override; void appendJumpsub(LabelID, int, int) override; void appendReturnsub(int, int) override; @@ -66,6 +66,7 @@ class EthAssemblyAdapter: public AbstractAssembly private: static LabelID assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag); + void appendJumpInstruction(evmasm::Instruction _instruction, JumpType _jumpType); evmasm::Assembly& m_assembly; std::map m_dataHashBySubId; diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index c13a16083656..73194ef8ad9d 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -91,14 +91,14 @@ void EVMAssembly::appendLinkerSymbol(string const&) yulAssert(false, "Linker symbols not yet implemented."); } -void EVMAssembly::appendJump(int _stackDiffAfter) +void EVMAssembly::appendJump(int _stackDiffAfter, JumpType) { yulAssert(!m_evm15, "Plain JUMP used for EVM 1.5"); appendInstruction(evmasm::Instruction::JUMP); m_stackHeight += _stackDiffAfter; } -void EVMAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter) +void EVMAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) { if (m_evm15) { @@ -109,11 +109,11 @@ void EVMAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter) else { appendLabelReference(_labelId); - appendJump(_stackDiffAfter); + appendJump(_stackDiffAfter, _jumpType); } } -void EVMAssembly::appendJumpToIf(LabelID _labelId) +void EVMAssembly::appendJumpToIf(LabelID _labelId, JumpType) { if (m_evm15) { diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index da4f5c0379f4..9ee974bbb890 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -64,11 +64,11 @@ class EVMAssembly: public AbstractAssembly /// Append a jump instruction. /// @param _stackDiffAfter the stack adjustment after this instruction. - void appendJump(int _stackDiffAfter) override; + void appendJump(int _stackDiffAfter, JumpType _jumpType) override; /// Append a jump-to-immediate operation. - void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override; + void appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) override; /// Append a jump-to-if-immediate operation. - void appendJumpToIf(LabelID _labelId) override; + void appendJumpToIf(LabelID _labelId, JumpType _jumpType) override; /// Start a subroutine. void appendBeginsub(LabelID _labelId, int _arguments) override; /// Call a subroutine. diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index f57fd35f36e3..9182bb393450 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -291,7 +291,8 @@ void CodeTransform::operator()(FunctionCall const& _call) { m_assembly.appendJumpTo( functionEntryID(_call.functionName.name, *function), - static_cast(function->returns.size() - function->arguments.size()) - 1 + static_cast(function->returns.size() - function->arguments.size()) - 1, + AbstractAssembly::JumpType::IntoFunction ); m_assembly.appendLabel(returnLabel); } @@ -511,7 +512,10 @@ void CodeTransform::operator()(FunctionDefinition const& _function) if (m_evm15) m_assembly.appendReturnsub(static_cast(_function.returnVariables.size()), stackHeightBefore); else - m_assembly.appendJump(stackHeightBefore - static_cast(_function.returnVariables.size())); + m_assembly.appendJump( + stackHeightBefore - static_cast(_function.returnVariables.size()), + AbstractAssembly::JumpType::OutOfFunction + ); m_assembly.setStackHeight(stackHeightBefore); } diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index 8e26014a9988..ee280338d8b3 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -70,25 +70,25 @@ void NoOutputAssembly::appendLinkerSymbol(string const&) yulAssert(false, "Linker symbols not yet implemented."); } -void NoOutputAssembly::appendJump(int _stackDiffAfter) +void NoOutputAssembly::appendJump(int _stackDiffAfter, JumpType) { yulAssert(!m_evm15, "Plain JUMP used for EVM 1.5"); appendInstruction(evmasm::Instruction::JUMP); m_stackHeight += _stackDiffAfter; } -void NoOutputAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter) +void NoOutputAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) { if (m_evm15) m_stackHeight += _stackDiffAfter; else { appendLabelReference(_labelId); - appendJump(_stackDiffAfter); + appendJump(_stackDiffAfter, _jumpType); } } -void NoOutputAssembly::appendJumpToIf(LabelID _labelId) +void NoOutputAssembly::appendJumpToIf(LabelID _labelId, JumpType) { if (m_evm15) m_stackHeight--; diff --git a/libyul/backends/evm/NoOutputAssembly.h b/libyul/backends/evm/NoOutputAssembly.h index 7101a30f5a74..ec7e5f2ecead 100644 --- a/libyul/backends/evm/NoOutputAssembly.h +++ b/libyul/backends/evm/NoOutputAssembly.h @@ -58,9 +58,9 @@ class NoOutputAssembly: public AbstractAssembly LabelID namedLabel(std::string const& _name) override; void appendLinkerSymbol(std::string const& _name) override; - void appendJump(int _stackDiffAfter) override; - void appendJumpTo(LabelID _labelId, int _stackDiffAfter) override; - void appendJumpToIf(LabelID _labelId) override; + void appendJump(int _stackDiffAfter, JumpType _jumpType) override; + void appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _jumpType) override; + void appendJumpToIf(LabelID _labelId, JumpType _jumpType) override; void appendBeginsub(LabelID _labelId, int _arguments) override; void appendJumpsub(LabelID _labelId, int _arguments, int _returns) override; void appendReturnsub(int _returns, int _stackDiffAfter) override; diff --git a/test/cmdlineTests/yul_stack_opt/output b/test/cmdlineTests/yul_stack_opt/output index e0ac5ad770e3..e5731f1e1710 100644 --- a/test/cmdlineTests/yul_stack_opt/output +++ b/test/cmdlineTests/yul_stack_opt/output @@ -36,7 +36,8 @@ Binary representation: Text representation: /* "yul_stack_opt/input.sol":495:500 */ tag_1 - jump(tag_2) + tag_2 + jump // in tag_1: /* "yul_stack_opt/input.sol":425:500 */ pop @@ -56,7 +57,8 @@ tag_1: pop /* "yul_stack_opt/input.sol":572:577 */ tag_3 - jump(tag_2) + tag_2 + jump // in tag_3: /* "yul_stack_opt/input.sol":502:577 */ pop @@ -198,5 +200,5 @@ tag_5: swap14 swap15 swap16 - jump + jump // out tag_4: diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 885f0b2d3c71..23bf1a2f829a 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -182,6 +182,30 @@ BOOST_AUTO_TEST_CASE(location_test) checkAssemblyLocations(items, locations); } + +BOOST_AUTO_TEST_CASE(jump_type) +{ + auto sourceCode = make_shared(R"( + contract C { + function f(uint a) public pure returns (uint t) { + assembly { + function g(x) -> y { if x { leave } y := 8 } + t := g(a) + } + } + } + )", ""); + AssemblyItems items = compileContract(sourceCode); + + string jumpTypes; + for (AssemblyItem const& item: items) + if (item.getJumpType() != AssemblyItem::JumpType::Ordinary) + jumpTypes += item.getJumpTypeAsString() + "\n"; + + BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n"); +} + + BOOST_AUTO_TEST_SUITE_END() } // end namespaces diff --git a/test/libyul/objectCompiler/function_series.yul b/test/libyul/objectCompiler/function_series.yul index 90dc88753fe2..34c66ec4678b 100644 --- a/test/libyul/objectCompiler/function_series.yul +++ b/test/libyul/objectCompiler/function_series.yul @@ -13,12 +13,12 @@ object "Contract" { // tag_2: // /* "source":46:48 */ // tag_3: -// jump +// jump // out // /* "source":53:68 */ // tag_4: // /* "source":66:68 */ // tag_5: -// jump +// jump // out // tag_1: // /* "source":83:84 */ // 0x01 @@ -28,4 +28,4 @@ object "Contract" { // sstore // Bytecode: 6009565b5b565b5b565b6001600055 // Opcodes: PUSH1 0x9 JUMP JUMPDEST JUMPDEST JUMP JUMPDEST JUMPDEST JUMP JUMPDEST PUSH1 0x1 PUSH1 0x0 SSTORE -// SourceMappings: 33:15:0:-:0;;;46:2;;53:15;66:2;;;83:1;80;73:12 +// SourceMappings: 33:15:0:-:0;;;46:2;:::o;53:15::-;66:2;:::o;:::-;83:1;80;73:12 diff --git a/test/libyul/objectCompiler/jump_tags.yul b/test/libyul/objectCompiler/jump_tags.yul new file mode 100644 index 000000000000..718b5a4a4606 --- /dev/null +++ b/test/libyul/objectCompiler/jump_tags.yul @@ -0,0 +1,64 @@ +object "Contract" { + code { + function f() { g(1) } + function g(x) { if x { leave } g(add(x, 2)) } + g(1) + } +} + +// ---- +// Assembly: +// /* "source":33:54 */ +// jump(tag_1) +// tag_2: +// /* "source":48:52 */ +// tag_4 +// /* "source":50:51 */ +// 0x01 +// /* "source":48:52 */ +// tag_5 +// jump // in +// tag_4: +// /* "source":46:54 */ +// tag_3: +// jump // out +// /* "source":59:104 */ +// tag_5: +// /* "source":78:79 */ +// dup1 +// /* "source":75:77 */ +// iszero +// tag_7 +// jumpi +// /* "source":82:87 */ +// jump(tag_6) +// /* "source":75:77 */ +// tag_7: +// /* "source":90:102 */ +// tag_8 +// /* "source":99:100 */ +// 0x02 +// /* "source":96:97 */ +// dup3 +// /* "source":92:101 */ +// add +// /* "source":90:102 */ +// tag_5 +// jump // in +// tag_8: +// /* "source":73:104 */ +// tag_6: +// pop +// jump // out +// tag_1: +// /* "source":109:113 */ +// tag_9 +// /* "source":111:112 */ +// 0x01 +// /* "source":109:113 */ +// tag_5 +// jump // in +// tag_9: +// Bytecode: 6025565b600b6001600e565b5b565b80156017576022565b602160028201600e565b5b50565b602d6001600e565b +// Opcodes: PUSH1 0x25 JUMP JUMPDEST PUSH1 0xB PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST JUMPDEST JUMP JUMPDEST DUP1 ISZERO PUSH1 0x17 JUMPI PUSH1 0x22 JUMP JUMPDEST PUSH1 0x21 PUSH1 0x2 DUP3 ADD PUSH1 0xE JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x2D PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST +// SourceMappings: 33:21:0:-:0;;;48:4;50:1;48:4;:::i;:::-;46:8;:::o;59:45::-;78:1;75:2;;;82:5;;75:2;90:12;99:1;96;92:9;90:12;:::i;:::-;73:31;;:::o;:::-;109:4;111:1;109:4;:::i;:::- From e48d3e584710ab64e7293ac8ae8aa22823aa044a Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 19:16:21 +0200 Subject: [PATCH 323/479] Fix wording of error message. --- libsolidity/analysis/ContractLevelChecker.cpp | 4 ++-- .../inheritance/override/calldata_memory_conflict.sol | 8 ++++---- .../inheritance/override/internal_external.sol | 2 +- .../087_double_event_declaration.sol | 2 +- .../088_double_event_declaration_ignores_anonymous.sol | 2 +- .../089_double_event_declaration_ignores_indexed.sol | 2 +- .../nameAndTypeResolution/182_equal_overload.sol | 2 +- .../syntaxTests/parsing/two_exact_functions.sol | 2 +- .../syntaxTests/scoping/double_function_declaration.sol | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index c0fdd9e3082d..c0da545644a0 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -151,13 +151,13 @@ void ContractLevelChecker::findDuplicateDefinitions(map> const if constexpr (is_same_v) { error = 1686_error; - message = "Function with same name and arguments defined twice."; + message = "Function with same name and parameter types defined twice."; } else { static_assert(is_same_v, "Expected \"FunctionDefinition const*\" or \"EventDefinition const*\""); error = 5883_error; - message = "Event with same name and arguments defined twice."; + message = "Event with same name and parameter types defined twice."; } ssl.limitSize(message); diff --git a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol index 32958ef7a58e..8bd2a2b5850b 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_conflict.sol @@ -16,7 +16,7 @@ contract B is A { function i(uint[] memory) public override payable {} } // ---- -// DeclarationError 1686: (300-353): Function with same name and arguments defined twice. -// DeclarationError 1686: (358-419): Function with same name and arguments defined twice. -// DeclarationError 1686: (424-485): Function with same name and arguments defined twice. -// DeclarationError 1686: (490-546): Function with same name and arguments defined twice. +// DeclarationError 1686: (300-353): Function with same name and parameter types defined twice. +// DeclarationError 1686: (358-419): Function with same name and parameter types defined twice. +// DeclarationError 1686: (424-485): Function with same name and parameter types defined twice. +// DeclarationError 1686: (490-546): Function with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol b/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol index e4b674035e1d..ba4eb83bdfc0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/internal_external.sol @@ -3,4 +3,4 @@ contract A { function f(uint[] memory) internal pure {} } // ---- -// DeclarationError 1686: (17-61): Function with same name and arguments defined twice. +// DeclarationError 1686: (17-61): Function with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol index c515e1b035f0..fd48e247e7d5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol @@ -3,4 +3,4 @@ contract test { event A(uint i); } // ---- -// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol index e742c9dd29cb..0b35181059cc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol @@ -3,4 +3,4 @@ contract test { event A(uint i) anonymous; } // ---- -// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol index 951abc8307ec..fb45ebe1078a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol @@ -3,4 +3,4 @@ contract test { event A(uint indexed i); } // ---- -// DeclarationError 5883: (20-36): Event with same name and arguments defined twice. +// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol index 062f2eb2407f..8f15ea1be7f7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/182_equal_overload.sol @@ -3,4 +3,4 @@ contract C { function test(uint a) external {} } // ---- -// DeclarationError 1686: (17-66): Function with same name and arguments defined twice. +// DeclarationError 1686: (17-66): Function with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol b/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol index ccd0fb7b9fdf..82171ce0b66d 100644 --- a/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol +++ b/test/libsolidity/syntaxTests/parsing/two_exact_functions.sol @@ -6,4 +6,4 @@ contract test { function fun(uint a) public returns(uint r) { return a; } } // ---- -// DeclarationError 1686: (189-246): Function with same name and arguments defined twice. +// DeclarationError 1686: (189-246): Function with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol index 324788e2c949..b8904d59411a 100644 --- a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol +++ b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol @@ -3,4 +3,4 @@ contract test { function fun() public { } } // ---- -// DeclarationError 1686: (20-45): Function with same name and arguments defined twice. +// DeclarationError 1686: (20-45): Function with same name and parameter types defined twice. From 8e711a8b9908ba71770869155e38f596c2f247ab Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 18:14:51 +0200 Subject: [PATCH 324/479] Remove duplicate creation of internal routine. --- libsolidity/codegen/ArrayUtils.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index eebe03e53849..409c16cd7ffd 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -935,11 +935,6 @@ void ArrayUtils::clearStorageLoop(TypePointer _type) const } // stack: end_pos pos - // jump to and return from the loop to allow for duplicate code removal - evmasm::AssemblyItem returnTag = _context.pushNewTag(); - _context << Instruction::SWAP2 << Instruction::SWAP1; - - // stack: end_pos pos evmasm::AssemblyItem loopStart = _context.appendJumpToNew(); _context << loopStart; // check for loop condition @@ -959,11 +954,8 @@ void ArrayUtils::clearStorageLoop(TypePointer _type) const _context.appendJumpTo(loopStart); // cleanup _context << zeroLoopEnd; - _context << Instruction::POP << Instruction::SWAP1; - // "return" - _context << Instruction::JUMP; + _context << Instruction::POP; - _context << returnTag; solAssert(_context.stackHeight() == stackHeightStart - 1, ""); } ); From 70615a73a45bc89a8aa698e89e00c11e899e4250 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 6 Jul 2020 17:25:55 +0200 Subject: [PATCH 325/479] Disallow the same yul variable occurring multiple times on the LHS of an assignment. --- Changelog.md | 1 + docs/yul.rst | 4 ++++ libyul/AsmAnalysis.cpp | 11 +++++++++++ .../yulSyntaxTests/assignment_duplicate_vars.yul | 10 ++++++++++ .../yulSyntaxTests/declaration_duplicate_vars.yul | 6 ++++++ 5 files changed, 32 insertions(+) create mode 100644 test/libyul/yulSyntaxTests/assignment_duplicate_vars.yul create mode 100644 test/libyul/yulSyntaxTests/declaration_duplicate_vars.yul diff --git a/Changelog.md b/Changelog.md index 837c0f1b9bcc..2be5093aa5cb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ Bugfixes: * Type Checker: Do not disallow assigning to calldata variables. * Wasm backend: Fix code generation for for-loops with pre statements. * Yul: Fix source location of variable multi-assignment. + * Yul: Disallow the same variable to occur multiple times on the left-hand side of an assignment. ### 0.6.10 (2020-06-11) diff --git a/docs/yul.rst b/docs/yul.rst index 58a8b745afaa..2054f35c7e4c 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -288,6 +288,8 @@ variables at the same time. For this, the number and types of the values have to match. If you want to assign the values returned from a function that has multiple return parameters, you have to provide multiple variables. +The same variable may not occur multiple times on the left-hand side of +an assignment, e.g. ``x, x := f()`` is invalid. .. code-block:: yul @@ -506,6 +508,8 @@ In variable declarations and assignments, the right-hand-side expression variables on the left-hand-side. This is the only situation where an expression evaluating to more than one value is allowed. +The same variable name cannot occur more than once in the left-hand-side of +an assignment or variable declaration. Expressions that are also statements (i.e. at the block level) have to evaluate to zero values. diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index ad697fb40405..f0ac3c24255c 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -167,6 +167,17 @@ void AsmAnalyzer::operator()(Assignment const& _assignment) size_t const numVariables = _assignment.variableNames.size(); yulAssert(numVariables >= 1, ""); + set variables; + for (auto const& _variableName: _assignment.variableNames) + if (!variables.insert(_variableName.name).second) + m_errorReporter.declarationError( + 9005_error, + _assignment.location, + "Variable " + + _variableName.name.str() + + " occurs multiple times on the left-hand side of the assignment." + ); + vector types = std::visit(*this, *_assignment.value); if (types.size() != numVariables) diff --git a/test/libyul/yulSyntaxTests/assignment_duplicate_vars.yul b/test/libyul/yulSyntaxTests/assignment_duplicate_vars.yul new file mode 100644 index 000000000000..9bb725fd61a6 --- /dev/null +++ b/test/libyul/yulSyntaxTests/assignment_duplicate_vars.yul @@ -0,0 +1,10 @@ +{ + function f() -> a, b {} + function g() -> a, b, c {} + let x, y + x, x := f() + y, x, y := g() +} +// ---- +// DeclarationError 9005: (70-81): Variable x occurs multiple times on the left-hand side of the assignment. +// DeclarationError 9005: (84-98): Variable y occurs multiple times on the left-hand side of the assignment. diff --git a/test/libyul/yulSyntaxTests/declaration_duplicate_vars.yul b/test/libyul/yulSyntaxTests/declaration_duplicate_vars.yul new file mode 100644 index 000000000000..7f786ac9a88c --- /dev/null +++ b/test/libyul/yulSyntaxTests/declaration_duplicate_vars.yul @@ -0,0 +1,6 @@ +{ + function f() -> a, b {} + let x, x := f() +} +// ---- +// DeclarationError 1395: (30-45): Variable name x already taken in this scope. From beb4b1d5636ae60fa2c2d891787a5652123a4394 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 7 Jul 2020 10:17:58 +0100 Subject: [PATCH 326/479] Fix tests on breaking --- .../syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol index 66095a021f45..9937fc465333 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_istanbul_on_petersburg.sol @@ -15,5 +15,5 @@ contract C { // ---- // TypeError 1561: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError 8678: (95-110): Variable count does not match number of values (1 vs. 0) -// TypeError 3672: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). +// TypeError 7721: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg"). // DeclarationError 8678: (209-228): Variable count does not match number of values (1 vs. 0) From da36400576304bc6daa924d40684b6655914e4a5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2020 18:19:42 +0200 Subject: [PATCH 327/479] Disallow visibility for constructors. --- libsolidity/analysis/SyntaxChecker.cpp | 8 +++++++- libsolidity/analysis/TypeChecker.cpp | 19 +++++++------------ libsolidity/ast/AST.cpp | 8 +------- libsolidity/ast/AST.h | 4 +--- libsolidity/ast/ASTJsonConverter.cpp | 9 ++++++++- libsolidity/ast/ASTJsonImporter.cpp | 2 +- libsolidity/interface/ABI.cpp | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 267d5764fd66..19952e32baac 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -301,7 +301,13 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract) bool SyntaxChecker::visit(FunctionDefinition const& _function) { - if (_function.noVisibilitySpecified()) + if (_function.isConstructor() && !_function.noVisibilitySpecified()) + m_errorReporter.syntaxError( + 2462_error, + _function.location(), + "Visibility specified for constructor. If you want the contract to be non-deployable, make it \"abstract\"." + ); + else if (!_function.isConstructor() && _function.noVisibilitySpecified()) { string suggestedVisibility = _function.isFallback() || _function.isReceive() || m_isInterface ? "external" : "public"; m_errorReporter.syntaxError( diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ce314a7155fb..8e2c721f7160 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -323,11 +323,13 @@ bool TypeChecker::visit(FunctionDefinition const& _function) { if (_function.markedVirtual()) { - if (_function.annotation().contract->isInterface()) + if (_function.isConstructor()) + m_errorReporter.typeError(7001_error, _function.location(), "Constructors cannot be virtual."); + else if (_function.annotation().contract->isInterface()) m_errorReporter.warning(5815_error, _function.location(), "Interface functions are implicitly \"virtual\""); - if (_function.visibility() == Visibility::Private) + else if (_function.visibility() == Visibility::Private) m_errorReporter.typeError(3942_error, _function.location(), "\"virtual\" and \"private\" cannot be used together."); - if (_function.libraryFunction()) + else if (_function.libraryFunction()) m_errorReporter.typeError(7801_error, _function.location(), "Library functions cannot be \"virtual\"."); } @@ -403,11 +405,10 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.isImplemented()) m_errorReporter.typeError(4726_error, _function.location(), "Functions in interfaces cannot have an implementation."); - if (_function.visibility() != Visibility::External) - m_errorReporter.typeError(1560_error, _function.location(), "Functions in interfaces must be declared external."); - if (_function.isConstructor()) m_errorReporter.typeError(6482_error, _function.location(), "Constructor cannot be defined in interfaces."); + else if (_function.visibility() != Visibility::External) + m_errorReporter.typeError(1560_error, _function.location(), "Functions in interfaces must be declared external."); } else if (m_currentContract->contractKind() == ContractKind::Library) if (_function.isConstructor()) @@ -1881,8 +1882,6 @@ void TypeChecker::typeCheckReceiveFunction(FunctionDefinition const& _function) void TypeChecker::typeCheckConstructor(FunctionDefinition const& _function) { solAssert(_function.isConstructor(), ""); - if (_function.markedVirtual()) - m_errorReporter.typeError(7001_error, _function.location(), "Constructors cannot be virtual."); if (_function.overrides()) m_errorReporter.typeError(1209_error, _function.location(), "Constructors cannot override."); if (!_function.returnParameters().empty()) @@ -1895,8 +1894,6 @@ void TypeChecker::typeCheckConstructor(FunctionDefinition const& _function) stateMutabilityToString(_function.stateMutability()) + "\"." ); - if (_function.visibility() != Visibility::Public && _function.visibility() != Visibility::Internal) - m_errorReporter.typeError(9239_error, _function.location(), "Constructor must be public or internal."); } void TypeChecker::typeCheckABIEncodeFunctions( @@ -2495,8 +2492,6 @@ void TypeChecker::endVisit(NewExpression const& _newExpression) m_errorReporter.fatalTypeError(5540_error, _newExpression.location(), "Identifier is not a contract."); if (contract->isInterface()) m_errorReporter.fatalTypeError(2971_error, _newExpression.location(), "Cannot instantiate an interface."); - if (!contract->constructorIsPublic()) - m_errorReporter.typeError(9054_error, _newExpression.location(), "Contract with internal constructor cannot be created directly."); if (contract->abstract()) m_errorReporter.typeError(4614_error, _newExpression.location(), "Cannot instantiate an abstract contract."); diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index cba5bccc39e4..735f8e2c60e7 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -122,15 +122,9 @@ FunctionDefinition const* ContractDefinition::constructor() const return nullptr; } -bool ContractDefinition::constructorIsPublic() const -{ - FunctionDefinition const* f = constructor(); - return !f || f->isPublic(); -} - bool ContractDefinition::canBeDeployed() const { - return constructorIsPublic() && !abstract() && !isInterface(); + return !abstract() && !isInterface(); } FunctionDefinition const* ContractDefinition::fallbackFunction() const diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 34fefeb0a042..157be088d831 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -505,8 +505,6 @@ class ContractDefinition: public Declaration, public StructurallyDocumented /// Returns the constructor or nullptr if no constructor was specified. FunctionDefinition const* constructor() const; - /// @returns true iff the constructor of this contract is public (or non-existing). - bool constructorIsPublic() const; /// @returns true iff the contract can be deployed, i.e. is not abstract and has a /// public constructor. /// Should only be called after the type checker has run. @@ -814,7 +812,7 @@ class FunctionDefinition: public CallableDeclaration, public StructurallyDocumen } bool isVisibleViaContractTypeAccess() const override { - return visibility() >= Visibility::Public; + return isOrdinary() && visibility() >= Visibility::Public; } bool isPartOfExternalInterface() const override { return isPublic() && isOrdinary(); } diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index bcc92420df39..b289ef34bf61 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -350,12 +350,18 @@ bool ASTJsonConverter::visit(OverrideSpecifier const& _node) bool ASTJsonConverter::visit(FunctionDefinition const& _node) { + Visibility visibility; + if (_node.isConstructor()) + visibility = _node.annotation().contract->abstract() ? Visibility::Internal : Visibility::Public; + else + visibility = _node.visibility(); + std::vector> attributes = { make_pair("name", _node.name()), make_pair("documentation", _node.documentation() ? toJson(*_node.documentation()) : Json::nullValue), make_pair("kind", TokenTraits::toString(_node.kind())), make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())), - make_pair("visibility", Declaration::visibilityToString(_node.visibility())), + make_pair("visibility", Declaration::visibilityToString(visibility)), make_pair("virtual", _node.markedVirtual()), make_pair("overrides", _node.overrides() ? toJson(*_node.overrides()) : Json::nullValue), make_pair("parameters", toJson(_node.parameterList())), @@ -365,6 +371,7 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node) make_pair("implemented", _node.isImplemented()), make_pair("scope", idOrNull(_node.scope())) }; + if (_node.isPartOfExternalInterface()) attributes.emplace_back("functionSelector", _node.externalIdentifierHex()); if (!_node.annotation().baseFunctions.empty()) diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 240b35f54d19..1d9f77ad19a1 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -399,7 +399,7 @@ ASTPointer ASTJsonImporter::createFunctionDefinition(Json::V return createASTNode( _node, memberAsASTString(_node, "name"), - visibility(_node), + kind == Token::Constructor ? Visibility::Default : visibility(_node), stateMutability(_node), kind, memberAsBool(_node, "virtual"), diff --git a/libsolidity/interface/ABI.cpp b/libsolidity/interface/ABI.cpp index c00c2f83cd47..3e2480a0e084 100644 --- a/libsolidity/interface/ABI.cpp +++ b/libsolidity/interface/ABI.cpp @@ -74,7 +74,7 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) abi.emplace(std::move(method)); } FunctionDefinition const* constructor = _contractDef.constructor(); - if (constructor && constructor->visibility() >= Visibility::Public) + if (constructor && !_contractDef.abstract()) { FunctionType constrType(*constructor); FunctionType const* externalFunctionType = constrType.interfaceFunctionType(); From f6232393efaa3b0d6c2caac57e74995528226376 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2020 17:33:36 +0200 Subject: [PATCH 328/479] Force contracts with constructors with internal parameters abstract. --- libsolidity/analysis/TypeChecker.cpp | 66 ++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8e2c721f7160..21ab7dd35f7f 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -340,35 +340,62 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.isOrdinary() && !_function.isPartOfExternalInterface()) m_errorReporter.typeError(5587_error, _function.location(), "Internal functions cannot be payable."); } - auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& var) { - if (type(var)->containsNestedMapping()) - if (var.referenceLocation() == VariableDeclaration::Location::Storage) + + vector internalParametersInConstructor; + + auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& _var) { + if (type(_var)->containsNestedMapping()) + if (_var.referenceLocation() == VariableDeclaration::Location::Storage) solAssert( - _function.libraryFunction() || !_function.isPublic(), + _function.libraryFunction() || _function.isConstructor() || !_function.isPublic(), "Mapping types for parameters or return variables " "can only be used in internal or library functions." ); - if (_function.isPublic()) + bool functionIsExternallyVisible = + (!_function.isConstructor() && _function.isPublic()) || + (_function.isConstructor() && !m_currentContract->abstract()); + if ( + _function.isConstructor() && + _var.referenceLocation() == VariableDeclaration::Location::Storage && + !m_currentContract->abstract() + ) + m_errorReporter.typeError( + 3644_error, + _var.location(), + "This parameter has a type that can only be used internally. " + "You can make the contract abstract to avoid this problem." + ); + else if (functionIsExternallyVisible) { - auto iType = type(var)->interfaceType(_function.libraryFunction()); + auto iType = type(_var)->interfaceType(_function.libraryFunction()); if (!iType) { - solAssert(!iType.message().empty(), "Expected detailed error message!"); - m_errorReporter.typeError(4103_error, var.location(), iType.message()); + string message = iType.message(); + solAssert(!message.empty(), "Expected detailed error message!"); + if (_function.isConstructor()) + message += " You can make the contract abstract to avoid this problem."; + m_errorReporter.typeError(4103_error, _var.location(), message); + } + else if ( + !experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2) && + !typeSupportedByOldABIEncoder(*type(_var), _function.libraryFunction()) + ) + { + string message = + "This type is only supported in ABIEncoderV2. " + "Use \"pragma experimental ABIEncoderV2;\" to enable the feature."; + if (_function.isConstructor()) + message += + " Alternatively, make the contract abstract and supply the " + "constructor arguments from a derived contract."; + m_errorReporter.typeError( + 4957_error, + _var.location(), + message + ); } } - if ( - _function.isPublic() && - !experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2) && - !typeSupportedByOldABIEncoder(*type(var), _function.libraryFunction()) - ) - m_errorReporter.typeError( - 4957_error, - var.location(), - "This type is only supported in ABIEncoderV2. " - "Use \"pragma experimental ABIEncoderV2;\" to enable the feature." - ); }; for (ASTPointer const& var: _function.parameters()) { @@ -380,6 +407,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) checkArgumentAndReturnParameter(*var); var->accept(*this); } + set modifiers; for (ASTPointer const& modifier: _function.modifiers()) { From 747aeb4999edc1e28ea30350a6472e3f9ec48557 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2020 17:34:05 +0200 Subject: [PATCH 329/479] Assert that visibility of constructor is not queried. --- libsolidity/analysis/TypeChecker.cpp | 2 +- libsolidity/ast/AST.cpp | 13 ++++++++++++- libsolidity/ast/AST.h | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 21ab7dd35f7f..74b3130e17ab 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -558,7 +558,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (auto referenceType = dynamic_cast(varType)) { auto result = referenceType->validForLocation(referenceType->location()); - if (result && _variable.isPublicCallableParameter()) + if (result && (_variable.isConstructorParameter() || _variable.isPublicCallableParameter())) result = referenceType->validForLocation(DataLocation::CallData); if (!result) { diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 735f8e2c60e7..83cf70a929ab 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -288,6 +288,12 @@ bool FunctionDefinition::libraryFunction() const return false; } +Visibility FunctionDefinition::defaultVisibility() const +{ + solAssert(!isConstructor(), ""); + return Declaration::defaultVisibility(); +} + FunctionTypePointer FunctionDefinition::functionType(bool _internal) const { if (_internal) @@ -623,7 +629,12 @@ set VariableDeclaration::allowedDataLocations() c else if (isCallableOrCatchParameter()) { set locations{ Location::Memory }; - if (isInternalCallableParameter() || isLibraryFunctionParameter() || isTryCatchParameter()) + if ( + isConstructorParameter() || + isInternalCallableParameter() || + isLibraryFunctionParameter() || + isTryCatchParameter() + ) locations.insert(Location::Storage); if (!isTryCatchParameter() && !isConstructorParameter()) locations.insert(Location::CallData); diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 157be088d831..9fcbe29269db 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -806,15 +806,16 @@ class FunctionDefinition: public CallableDeclaration, public StructurallyDocumen bool isPayable() const { return m_stateMutability == StateMutability::Payable; } std::vector> const& modifiers() const { return m_functionModifiers; } Block const& body() const { solAssert(m_body, ""); return *m_body; } + Visibility defaultVisibility() const override; bool isVisibleInContract() const override { - return Declaration::isVisibleInContract() && isOrdinary(); + return isOrdinary() && Declaration::isVisibleInContract(); } bool isVisibleViaContractTypeAccess() const override { return isOrdinary() && visibility() >= Visibility::Public; } - bool isPartOfExternalInterface() const override { return isPublic() && isOrdinary(); } + bool isPartOfExternalInterface() const override { return isOrdinary() && isPublic(); } /// @returns the external signature of the function /// That consists of the name of the function followed by the types of the @@ -926,6 +927,7 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented /// @returns true if this variable is a parameter or return parameter of an internal function /// or a function type of internal visibility. bool isInternalCallableParameter() const; + /// @returns true if this variable is the parameter of a constructor. bool isConstructorParameter() const; /// @returns true iff this variable is a parameter(or return parameter of a library function bool isLibraryFunctionParameter() const; From 28de7cbce9e14080428b3dc9266b69f5bfc307a4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jul 2020 11:57:16 +0200 Subject: [PATCH 330/479] Fix wording of non-function override error messages. --- libsolidity/analysis/OverrideChecker.cpp | 32 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index c488fd278a01..6a2ccc83aa41 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -514,7 +514,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr ); if (!_overriding.overrides()) - overrideError(_overriding, _super, 9456_error, "Overriding " + _overriding.astNodeName() + " is missing \"override\" specifier."); + overrideError( + _overriding, + _super, + 9456_error, + "Overriding " + _overriding.astNodeName() + " is missing \"override\" specifier.", + "Overridden " + _overriding.astNodeName() + " is here:" + ); if (_super.isVariable()) overrideError( @@ -536,7 +542,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr if (_overriding.isVariable()) { if (_super.visibility() != Visibility::External) - overrideError(_overriding, _super, 5225_error, "Public state variables can only override functions with external visibility."); + overrideError( + _overriding, + _super, + 5225_error, + "Public state variables can only override functions with external visibility.", + "Overridden function is here:" + ); solAssert(_overriding.visibility() == Visibility::External, ""); } else if (_overriding.visibility() != _super.visibility()) @@ -547,7 +559,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr _super.visibility() == Visibility::External && _overriding.visibility() == Visibility::Public )) - overrideError(_overriding, _super, 9098_error, "Overriding " + _overriding.astNodeName() + " visibility differs."); + overrideError( + _overriding, + _super, + 9098_error, + "Overriding " + _overriding.astNodeName() + " visibility differs.", + "Overridden " + _overriding.astNodeName() + " is here:" + ); } if (_super.isFunction()) @@ -558,7 +576,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr solAssert(functionType->hasEqualParameterTypes(*superType), "Override doesn't have equal parameters!"); if (!functionType->hasEqualReturnTypes(*superType)) - overrideError(_overriding, _super, 4822_error, "Overriding " + _overriding.astNodeName() + " return types differ."); + overrideError( + _overriding, + _super, + 4822_error, + "Overriding " + _overriding.astNodeName() + " return types differ.", + "Overridden " + _overriding.astNodeName() + " is here:" + ); // This is only relevant for a function overriding a function. if (_overriding.isFunction()) From 9743390a536b0c6bf40a8564088915622f771a04 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 23 Jun 2020 14:14:24 +0200 Subject: [PATCH 331/479] Update tests. --- .../input.sol | 2 +- test/cmdlineTests/message_format_utf8/err | 6 +- .../message_format_utf8/input.sol | 2 +- .../cmdlineTests/optimizer_user_yul/input.sol | 2 +- test/cmdlineTests/optimizer_user_yul/output | 50 ++++++------ .../recovery_ast_constructor/input.sol | 2 +- .../recovery_ast_constructor/output | 26 +++--- .../input.json | 2 +- .../output.json | 20 ++--- .../yul_optimizer_steps/input.sol | 2 +- .../MultiSigWallet/MultiSigWallet.sol | 1 - .../MultiSigWalletWithDailyLimit.sol | 1 - test/compilationTests/corion/ico.sol | 2 +- .../compilationTests/corion/moduleHandler.sol | 2 +- test/compilationTests/corion/multiOwner.sol | 2 +- test/compilationTests/corion/premium.sol | 2 +- test/compilationTests/corion/provider.sol | 2 +- test/compilationTests/corion/publisher.sol | 2 +- test/compilationTests/corion/schelling.sol | 4 +- test/compilationTests/corion/token.sol | 2 +- .../gnosis/Events/CategoricalEvent.sol | 1 - test/compilationTests/gnosis/Events/Event.sol | 1 - .../gnosis/Events/ScalarEvent.sol | 1 - .../gnosis/Markets/Campaign.sol | 1 - .../gnosis/Markets/StandardMarket.sol | 1 - test/compilationTests/gnosis/Migrations.sol | 2 +- .../gnosis/Oracles/CentralizedOracle.sol | 1 - .../gnosis/Oracles/DifficultyOracle.sol | 1 - .../gnosis/Oracles/FutarchyOracle.sol | 1 - .../gnosis/Oracles/FutarchyOracleFactory.sol | 1 - .../gnosis/Oracles/MajorityOracle.sol | 1 - .../gnosis/Oracles/SignedMessageOracle.sol | 1 - .../gnosis/Oracles/UltimateOracle.sol | 1 - .../gnosis/Tokens/OutcomeToken.sol | 1 - .../milestonetracker/MilestoneTracker.sol | 2 +- test/contracts/AuctionRegistrar.cpp | 2 +- test/contracts/Wallet.cpp | 6 +- .../solc-js/DAO/ManagedAccount.sol | 2 +- test/libsolidity/ABIDecoderTests.cpp | 10 +-- test/libsolidity/ABIEncoderTests.cpp | 6 +- test/libsolidity/ABIJson/constructor_abi.sol | 2 +- .../ABIJson/internal_constructor.sol | 4 +- .../ABIJson/payable_constructor_abi.sol | 2 +- .../ABIJson/return_param_in_abi.sol | 2 +- .../ASTJSON/abstract_contract.json | 12 +-- .../libsolidity/ASTJSON/abstract_contract.sol | 2 +- .../ASTJSON/abstract_contract_legacy.json | 12 +-- test/libsolidity/ASTJSON/constructor.json | 10 +-- test/libsolidity/ASTJSON/constructor.sol | 2 +- .../ASTJSON/constructor_legacy.json | 10 +-- test/libsolidity/GasMeter.cpp | 4 +- test/libsolidity/SolidityCompiler.cpp | 2 +- test/libsolidity/SolidityEndToEndTest.cpp | 80 +++++++++---------- .../SolidityNameAndTypeResolution.cpp | 2 +- test/libsolidity/SolidityNatspecJSON.cpp | 10 +-- test/libsolidity/SolidityOptimizer.cpp | 4 +- .../constructor_recovers.sol | 6 +- .../errorRecoveryTests/missing_rhs.sol | 6 +- .../errorRecoveryTests/multiple_errors.sol | 14 ++-- .../array/constant_var_as_array_length.sol | 2 +- .../array/fixed_arrays_in_constructors.sol | 2 +- .../semanticTests/array/reusing_memory.sol | 2 +- .../array/string_allocation_bug.sol | 2 +- .../semanticTests/array/strings_in_struct.sol | 2 +- .../calldata_internal_function_pointer.sol | 2 +- .../base_constructor_arguments.sol | 4 +- .../constructor/callvalue_check.sol | 6 +- .../constructor_arguments_external.sol | 2 +- .../constructor_arguments_internal.sol | 4 +- .../constructor_static_array_argument.sol | 2 +- ...vm_exceptions_in_constructor_call_fail.sol | 2 +- ...unction_usage_in_constructor_arguments.sol | 2 +- .../functions_called_by_constructor.sol | 2 +- ...called_by_constructor_through_dispatch.sol | 2 +- .../constructor/no_callvalue_check.sol | 8 +- .../constructor/payable_constructor.sol | 2 +- .../store_function_in_constructor.sol | 2 +- ...nternal_unused_function_in_constructor.sol | 2 +- ...unused_library_function_in_constructor.sol | 2 +- .../constructor_inheritance_init_order.sol | 2 +- .../semanticTests/constructor_with_params.sol | 2 +- ...ructor_with_params_diamond_inheritance.sol | 8 +- .../constructor_with_params_inheritance.sol | 4 +- .../constructor_with_params_inheritance_2.sol | 2 +- .../enums/enum_explicit_overflow.sol | 2 +- .../semanticTests/enums/using_enums.sol | 2 +- .../creation_function_call_no_args.sol | 2 +- .../creation_function_call_with_args.sol | 4 +- .../creation_function_call_with_salt.sol | 4 +- .../functionCall/gas_and_value_basic.sol | 2 +- .../gas_and_value_brace_syntax.sol | 2 +- .../functionCall/member_accessors.sol | 2 +- .../functionCall/send_zero_ether.sol | 2 +- .../functionTypes/mapping_of_functions.sol | 2 +- ...e_function_in_construction_and_runtime.sol | 2 +- ...onstruction_and_runtime_equality_check.sol | 2 +- .../getters/array_mapping_struct.sol | 2 +- .../semanticTests/getters/arrays.sol | 2 +- .../semanticTests/getters/mapping.sol | 2 +- .../getters/mapping_array_struct.sol | 2 +- .../getters/mapping_of_string.sol | 2 +- .../getters/mapping_to_struct.sol | 2 +- .../semanticTests/getters/small_types.sol | 2 +- .../getters/struct_with_bytes.sol | 2 +- .../getters/struct_with_bytes_simple.sol | 2 +- .../immutable/getter_call_in_constructor.sol | 2 +- .../semanticTests/immutable/inheritance.sol | 8 +- .../immutable/internal_function_pointer.sol | 2 +- .../immutable/multi_creation.sol | 6 +- .../semanticTests/immutable/stub.sol | 2 +- .../semanticTests/immutable/use_scratch.sol | 2 +- .../semanticTests/interfaceID/lisa.sol | 6 +- .../interfaceID/lisa_interfaceId.sol | 6 +- .../pass_dynamic_arguments_to_the_base.sol | 4 +- ...ass_dynamic_arguments_to_the_base_base.sol | 6 +- ...ic_arguments_to_the_base_base_with_gap.sol | 6 +- .../intheritance/super_in_constructor.sol | 2 +- .../intheritance/value_for_constructor.sol | 4 +- .../library_delegatecall_guard_pure.sol | 2 +- ...library_delegatecall_guard_view_needed.sol | 2 +- ...ary_delegatecall_guard_view_not_needed.sol | 2 +- ...ary_delegatecall_guard_view_staticcall.sol | 4 +- .../libraries/library_function_selectors.sol | 2 +- .../library_function_selectors_struct.sol | 2 +- ..._calling_functions_in_creation_context.sol | 2 +- .../function_modifier_for_constructor.sol | 2 +- .../salted_create_with_value.sol | 2 +- .../semanticTests/smoke/constructor.sol | 2 +- .../state_var_initialization.sol | 2 +- .../state_variables_init_order_2.sol | 2 +- .../state_variables_init_order_3.sol | 4 +- .../storage/accessors_mapping_for_array.sol | 2 +- .../semanticTests/storage/array_accessor.sol | 2 +- .../storage/complex_accessors.sol | 2 +- .../semanticTests/storage/simple_accessor.sol | 2 +- .../semanticTests/storage/struct_accessor.sol | 2 +- .../conversion/recursive_storage_memory.sol | 2 +- .../recursive_storage_memory_complex.sol | 2 +- .../semanticTests/structs/delete_struct.sol | 2 +- .../struct_assign_reference_to_struct.sol | 2 +- .../structs/struct_constructor_nested.sol | 2 +- .../structs/struct_delete_member.sol | 2 +- .../struct_delete_struct_in_mapping.sol | 2 +- .../structs/struct_named_constructor.sol | 2 +- .../semanticTests/tryCatch/create.sol | 4 +- .../invalidInConstructor.sol | 2 +- .../invalidStoredInConstructor.sol | 2 +- .../uninitializedFunctionPointer/store2.sol | 2 +- .../storeInConstructor.sol | 2 +- .../semanticTests/various/balance.sol | 2 +- .../various/code_access_content.sol | 2 +- .../various/code_access_create.sol | 2 +- .../various/code_access_runtime.sol | 2 +- .../various/external_types_in_calls.sol | 2 +- .../various/inline_member_init.sol | 2 +- .../inline_member_init_inheritence.sol | 4 +- .../semanticTests/various/senders_balance.sol | 2 +- .../semanticTests/various/value_complex.sol | 2 +- .../semanticTests/various/value_insane.sol | 2 +- .../semanticTests/viaYul/erc20.sol | 2 +- .../viaYul/struct_member_access.sol | 2 +- ...unction_usage_in_constructor_arguments.sol | 2 +- .../array_members/pop_constructor_safe.sol | 2 +- .../array_members/pop_constructor_unsafe.sol | 4 +- .../array_members/push_overflow_1_safe.sol | 2 +- ...overflow_1_safe_no_overflow_assumption.sol | 2 +- .../complex/slither/data_dependency.sol | 4 +- .../external_calls/external_hash.sol | 4 +- .../external_hash_known_code_pure.sol | 4 +- .../external_hash_known_code_state.sol | 6 +- ...ernal_hash_known_code_state_reentrancy.sol | 4 +- ...h_known_code_state_reentrancy_indirect.sol | 6 +- ...ash_known_code_state_reentrancy_unsafe.sol | 6 +- .../external_hash_known_code_state_unsafe.sol | 8 +- .../functions/constructor_base_basic.sol | 4 +- .../functions/constructor_hierarchy.sol | 6 +- .../functions/constructor_hierarchy_2.sol | 10 +-- .../functions/constructor_hierarchy_3.sol | 12 +-- .../functions/constructor_hierarchy_4.sol | 12 +-- .../constructor_hierarchy_diamond.sol | 16 ++-- .../constructor_hierarchy_diamond_2.sol | 16 ++-- .../constructor_hierarchy_diamond_3.sol | 24 +++--- ...tructor_hierarchy_diamond_empty_middle.sol | 8 +- ...rarchy_diamond_empty_middle_empty_base.sol | 4 +- .../constructor_hierarchy_empty_chain.sol | 8 +- .../constructor_hierarchy_empty_middle.sol | 8 +- ...r_hierarchy_empty_middle_no_invocation.sol | 8 +- .../constructor_hierarchy_mixed_chain.sol | 12 +-- ...uctor_hierarchy_mixed_chain_empty_base.sol | 6 +- ...uctor_hierarchy_mixed_chain_local_vars.sol | 12 +-- ...ctor_hierarchy_mixed_chain_with_params.sol | 14 ++-- ...or_hierarchy_mixed_chain_with_params_2.sol | 10 +-- .../constructor_hierarchy_modifier.sol | 6 +- .../constructor_hierarchy_same_var.sol | 8 +- .../functions/constructor_simple.sol | 4 +- .../functions/constructor_state_value.sol | 4 +- .../constructor_state_value_inherited.sol | 4 +- .../constructor_state_value_parameter.sol | 8 +- .../functions/constructor_this.sol | 6 +- .../internal_call_with_assertion_1.sol | 6 +- .../internal_call_with_assertion_1_fail.sol | 20 ++--- ...rnal_call_with_assertion_inheritance_1.sol | 2 +- ...call_with_assertion_inheritance_1_fail.sol | 6 +- ...ternal_multiple_calls_with_assertion_1.sol | 8 +- ...l_multiple_calls_with_assertion_1_fail.sol | 14 ++-- ...ctor_hierarchy_mixed_chain_with_params.sol | 14 ++-- .../constructor_state_variable_init.sol | 4 +- .../constructor_state_variable_init_base.sol | 4 +- .../constructor_state_variable_init_chain.sol | 8 +- ...or_state_variable_init_chain_alternate.sol | 6 +- ...ctor_state_variable_init_chain_run_all.sol | 24 +++--- ...or_state_variable_init_chain_run_all_2.sol | 20 ++--- ...onstructor_state_variable_init_diamond.sol | 4 +- ...tor_state_variable_init_diamond_middle.sol | 8 +- ...ctor_state_variable_init_function_call.sol | 2 +- .../implicit_constructor_hierarchy.sol | 4 +- .../abstract_contract_instantiation.sol | 4 +- .../syntaxTests/abstract/contract.sol | 2 +- .../abstract_creation_forward_reference.sol | 4 +- .../constructor/calldata_constructor_args.sol | 2 +- .../constructible_internal_constructor.sol | 6 +- .../syntaxTests/constructor/constructor.sol | 2 +- .../constructor/constructor_no_visibility.sol | 3 - .../constructor/constructor_override.sol | 4 +- .../constructor/constructor_payable.sol | 2 +- .../constructor_state_mutability.sol | 8 +- .../constructor/constructor_virtual.sol | 4 +- .../constructor/constructor_visibility.sol | 6 +- .../constructor_without_implementation.sol | 4 +- .../constructor/external_constructor.sol | 2 +- .../function_named_constructor.sol | 2 +- .../inconstructible_internal_constructor.sol | 6 +- ...ructible_internal_constructor_inverted.sol | 8 +- .../constructor/interface_constructor.sol | 7 +- .../constructor/library_constructor.sol | 6 +- .../constructor/nonpayable_new.sol | 14 ++-- .../syntaxTests/constructor/payable_new.sol | 8 +- .../constructor/returns_in_constructor.sol | 4 +- .../constructor/two_constructors.sol | 6 +- .../syntaxTests/constructor_this.sol | 6 +- .../functionCalls/new_with_calloptions.sol | 2 +- .../new_with_calloptions_unsupported.sol | 8 +- .../error_deprecate_value_constructor.sol | 4 +- .../function_type_constructor.sol | 6 +- .../conditional_return_uninitialized.sol | 4 +- .../immutable/conditionally_initialized.sol | 4 +- .../ctor_indirect_initialization.sol | 4 +- .../ctor_initialization_indirect_reading.sol | 4 +- .../immutable/ctor_initialization_reading.sol | 4 +- .../immutable/ctor_initialization_tuple.sol | 2 +- .../immutable/ctor_modifier_args.sol | 2 +- .../ctor_modifier_initialization.sol | 4 +- .../immutable/ctor_modifier_reading.sol | 4 +- .../syntaxTests/immutable/decrement.sol | 4 +- .../syntaxTests/immutable/delete.sol | 4 +- .../function_pointer_initializing.sol | 4 +- .../immutable/function_pointer_reading.sol | 4 +- .../syntaxTests/immutable/increment.sol | 4 +- .../immutable/inheritance_ctor.sol | 4 +- .../immutable/inheritance_ctor_argument.sol | 6 +- ...e_ctor_inherit_specifier_argument_init.sol | 4 +- ...tor_inherit_specifier_argument_reading.sol | 6 +- .../inheritance_virtual_functions.sol | 4 +- ...eritance_virtual_functions_direct_call.sol | 2 +- .../inheritance_virtual_functions_super.sol | 2 +- .../inheritance_virtual_modifiers.sol | 4 +- .../immutable/inheritance_wrong_ctor.sol | 6 +- .../immutable/initialized_after_ctor.sol | 2 +- .../immutable/loop_initialized.sol | 4 +- ...multiple_inheritance_virtual_functions.sol | 4 +- ...heritance_virtual_functions_with_super.sol | 4 +- .../immutable/multiple_initializations.sol | 4 +- .../immutable/private_state_var.sol | 6 +- .../immutable/return_uninitialized.sol | 4 +- .../syntaxTests/immutable/selector.sol | 6 +- .../immutable/selector_function_name.sol | 6 +- .../immutable/selector_function_pointer.sol | 2 +- .../uninitialized_private_state_var.sol | 8 +- ...mpty_duplicated_super_constructor_call.sol | 4 +- .../base_arguments_empty_parentheses.sol | 4 +- .../base_arguments_multiple_inheritance.sol | 6 +- .../base_arguments_no_parentheses.sol | 2 +- ...low_modifier_style_without_parentheses.sol | 6 +- .../duplicated_constructor_call/ancestor.sol | 8 +- .../duplicated_constructor_call/base.sol | 6 +- .../base_multi.sol | 8 +- .../base_multi_no_constructor.sol | 4 +- ...se_multi_no_constructor_modifier_style.sol | 8 +- .../modifiers_in_constructor_context.sol | 4 +- ...implement_interface_by_public_variable.sol | 2 +- ...t_internal_function_by_public_variable.sol | 2 +- ...nt_private_function_by_public_variable.sol | 2 +- ...ent_public_function_by_public_variable.sol | 2 +- .../inheritance/reference_non_base_ctor.sol | 2 +- .../inheritance/too_few_base_arguments.sol | 8 +- .../inheritance/wrong_type_base_arguments.sol | 6 +- .../assignment_from_functiontype2.sol | 4 +- .../memberLookup/internal_function_type.sol | 2 +- .../metaTypes/runtimeCodeWarningAssembly.sol | 4 +- .../missing_functions_duplicate_bug.sol | 2 +- .../base_constructor_double_invocation.sol | 8 +- .../modifiers/constructor_as_modifier.sol | 2 +- .../constructor_call_invalid_arg_count.sol | 6 +- ...061_missing_base_constructor_arguments.sol | 4 +- ...62_base_constructor_arguments_override.sol | 4 +- .../110_no_overflow_with_large_literal.sol | 2 +- .../111_overflow_caused_by_ether_units.sol | 4 +- .../124_enum_member_access.sol | 2 +- .../126_enum_invalid_member_access.sol | 4 +- .../127_enum_invalid_direct_member_access.sol | 4 +- .../128_enum_explicit_conversion_is_okay.sol | 2 +- ...nt_to_enum_explicit_conversion_is_okay.sol | 2 +- ...um_implicit_conversion_is_not_okay_256.sol | 4 +- ...num_implicit_conversion_is_not_okay_64.sol | 4 +- ...32_enum_to_enum_conversion_is_not_okay.sol | 4 +- .../363_non_payable_constructor.sol | 4 +- .../366_invalid_array_as_statement.sol | 4 +- .../462_callable_crash.sol | 4 +- .../491_using_this_in_constructor.sol | 4 +- .../invalidTypes/constructor_call.sol | 4 +- .../shadowsBuiltin/ignores_constructor.sol | 2 +- .../parsing/constructor_allowed_this.sol | 4 +- .../syntaxTests/parsing/constructor_super.sol | 2 +- .../parsing/enum_valid_declaration.sol | 2 +- ..._ether_subdenominations_in_expressions.sol | 2 +- 325 files changed, 757 insertions(+), 776 deletions(-) delete mode 100644 test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol diff --git a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol index 160c4cd1dee2..8d523bd4dec9 100644 --- a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol +++ b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol @@ -2,7 +2,7 @@ pragma solidity >=0.6.0; contract C { - constructor() public {} + constructor() {} } contract D is C { } \ No newline at end of file diff --git a/test/cmdlineTests/message_format_utf8/err b/test/cmdlineTests/message_format_utf8/err index fcd1717b87a2..c73ed714fe74 100644 --- a/test/cmdlineTests/message_format_utf8/err +++ b/test/cmdlineTests/message_format_utf8/err @@ -5,10 +5,10 @@ Warning: Source file does not specify required compiler version! --> message_format_utf8/input.sol Warning: Statement has no effect. - --> message_format_utf8/input.sol:2:58: + --> message_format_utf8/input.sol:2:51: | -2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } - | ^^^^^^^^^^^^ +2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () { "©©©©ᄅ©©©©©" ; } + | ^^^^^^^^^^^^ Warning: Statement has no effect. --> message_format_utf8/input.sol:6:25: diff --git a/test/cmdlineTests/message_format_utf8/input.sol b/test/cmdlineTests/message_format_utf8/input.sol index 51585efdebfc..dbeddfa01573 100644 --- a/test/cmdlineTests/message_format_utf8/input.sol +++ b/test/cmdlineTests/message_format_utf8/input.sol @@ -1,5 +1,5 @@ contract Foo { -/* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } +/* ©©©©ᄅ©©©©© 2017 */ constructor () { "©©©©ᄅ©©©©©" ; } function f() public pure { diff --git a/test/cmdlineTests/optimizer_user_yul/input.sol b/test/cmdlineTests/optimizer_user_yul/input.sol index e61b132e493d..f43ccc755d78 100644 --- a/test/cmdlineTests/optimizer_user_yul/input.sol +++ b/test/cmdlineTests/optimizer_user_yul/input.sol @@ -3,7 +3,7 @@ pragma solidity >=0.0; contract C { - constructor() public payable + constructor() payable { int a; diff --git a/test/cmdlineTests/optimizer_user_yul/output b/test/cmdlineTests/optimizer_user_yul/output index 340d709140af..34f35c643a85 100644 --- a/test/cmdlineTests/optimizer_user_yul/output +++ b/test/cmdlineTests/optimizer_user_yul/output @@ -1,69 +1,69 @@ ======= optimizer_user_yul/input.sol:C ======= EVM assembly: - /* "optimizer_user_yul/input.sol":60:525 contract C... */ + /* "optimizer_user_yul/input.sol":60:518 contract C... */ mstore(0x40, 0x80) - /* "optimizer_user_yul/input.sol":108:113 int a */ + /* "optimizer_user_yul/input.sol":101:106 int a */ 0x00 - /* "optimizer_user_yul/input.sol":188:197 let x,y,z */ + /* "optimizer_user_yul/input.sol":181:190 let x,y,z */ dup1 0x00 dup1 - /* "optimizer_user_yul/input.sol":212:213 1 */ + /* "optimizer_user_yul/input.sol":205:206 1 */ 0x01 - /* "optimizer_user_yul/input.sol":209:210 0 */ + /* "optimizer_user_yul/input.sol":202:203 0 */ 0x00 - /* "optimizer_user_yul/input.sol":202:214 sstore(0, 1) */ + /* "optimizer_user_yul/input.sol":195:207 sstore(0, 1) */ sstore - /* "optimizer_user_yul/input.sol":219:265 for { } sload(4) { } {... */ + /* "optimizer_user_yul/input.sol":212:258 for { } sload(4) { } {... */ tag_3: - /* "optimizer_user_yul/input.sol":233:234 4 */ + /* "optimizer_user_yul/input.sol":226:227 4 */ 0x04 - /* "optimizer_user_yul/input.sol":227:235 sload(4) */ + /* "optimizer_user_yul/input.sol":220:228 sload(4) */ sload - /* "optimizer_user_yul/input.sol":219:265 for { } sload(4) { } {... */ + /* "optimizer_user_yul/input.sol":212:258 for { } sload(4) { } {... */ iszero tag_5 jumpi pop - /* "optimizer_user_yul/input.sol":251:260 exp(x, y) */ + /* "optimizer_user_yul/input.sol":244:253 exp(x, y) */ dup1 dup3 exp - /* "optimizer_user_yul/input.sol":219:265 for { } sload(4) { } {... */ + /* "optimizer_user_yul/input.sol":212:258 for { } sload(4) { } {... */ jump(tag_3) tag_5: - /* "optimizer_user_yul/input.sol":223:226 { } */ + /* "optimizer_user_yul/input.sol":216:219 { } */ pop pop pop - /* "optimizer_user_yul/input.sol":275:276 2 */ + /* "optimizer_user_yul/input.sol":268:269 2 */ 0x02 - /* "optimizer_user_yul/input.sol":270:276 a := 2 */ + /* "optimizer_user_yul/input.sol":263:269 a := 2 */ swap1 pop - /* "optimizer_user_yul/input.sol":376:377 3 */ + /* "optimizer_user_yul/input.sol":369:370 3 */ 0x03 - /* "optimizer_user_yul/input.sol":373:374 2 */ + /* "optimizer_user_yul/input.sol":366:367 2 */ 0x02 - /* "optimizer_user_yul/input.sol":366:378 sstore(2, 3) */ + /* "optimizer_user_yul/input.sol":359:371 sstore(2, 3) */ sstore - /* "optimizer_user_yul/input.sol":383:516 for { } sload(5) { } {... */ + /* "optimizer_user_yul/input.sol":376:509 for { } sload(5) { } {... */ tag_6: - /* "optimizer_user_yul/input.sol":397:398 5 */ + /* "optimizer_user_yul/input.sol":390:391 5 */ 0x05 - /* "optimizer_user_yul/input.sol":391:399 sload(5) */ + /* "optimizer_user_yul/input.sol":384:392 sload(5) */ sload tag_9 jumpi jump(tag_8) tag_9: - /* "optimizer_user_yul/input.sol":383:516 for { } sload(5) { } {... */ + /* "optimizer_user_yul/input.sol":376:509 for { } sload(5) { } {... */ jump(tag_6) tag_8: - /* "optimizer_user_yul/input.sol":347:520 {... */ + /* "optimizer_user_yul/input.sol":340:513 {... */ pop - /* "optimizer_user_yul/input.sol":60:525 contract C... */ + /* "optimizer_user_yul/input.sol":60:518 contract C... */ dataSize(sub_0) dup1 dataOffset(sub_0) @@ -74,7 +74,7 @@ tag_8: stop sub_0: assembly { - /* "optimizer_user_yul/input.sol":60:525 contract C... */ + /* "optimizer_user_yul/input.sol":60:518 contract C... */ mstore(0x40, 0x80) 0x00 dup1 diff --git a/test/cmdlineTests/recovery_ast_constructor/input.sol b/test/cmdlineTests/recovery_ast_constructor/input.sol index 9035590d9c44..8da09638ae18 100644 --- a/test/cmdlineTests/recovery_ast_constructor/input.sol +++ b/test/cmdlineTests/recovery_ast_constructor/input.sol @@ -2,7 +2,7 @@ pragma solidity >=0.0.0; contract Error1 { - constructor() public { + constructor() { balances[tx.origin] = ; // missing RHS. } diff --git a/test/cmdlineTests/recovery_ast_constructor/output b/test/cmdlineTests/recovery_ast_constructor/output index 27a7b5ce56e3..d4a7d02884b6 100644 --- a/test/cmdlineTests/recovery_ast_constructor/output +++ b/test/cmdlineTests/recovery_ast_constructor/output @@ -97,7 +97,7 @@ JSON AST: "children": [], "id": 3, "name": "ParameterList", - "src": "103:0:0" + "src": "96:0:0" }, { "attributes": @@ -110,12 +110,12 @@ JSON AST: "children": [], "id": 8, "name": "Block", - "src": "103:49:0" + "src": "96:49:0" } ], "id": 9, "name": "FunctionDefinition", - "src": "82:70:0" + "src": "82:63:0" }, { "attributes": @@ -147,7 +147,7 @@ JSON AST: "children": [], "id": 10, "name": "ParameterList", - "src": "418:2:0" + "src": "411:2:0" }, { "children": @@ -174,17 +174,17 @@ JSON AST: }, "id": 11, "name": "ElementaryTypeName", - "src": "441:4:0" + "src": "434:4:0" } ], "id": 12, "name": "VariableDeclaration", - "src": "441:4:0" + "src": "434:4:0" } ], "id": 13, "name": "ParameterList", - "src": "440:6:0" + "src": "433:6:0" }, { "children": @@ -210,30 +210,30 @@ JSON AST: }, "id": 14, "name": "Literal", - "src": "460:1:0" + "src": "453:1:0" } ], "id": 15, "name": "Return", - "src": "453:8:0" + "src": "446:8:0" } ], "id": 16, "name": "Block", - "src": "447:19:0" + "src": "440:19:0" } ], "id": 17, "name": "FunctionDefinition", - "src": "405:61:0" + "src": "398:61:0" } ], "id": 18, "name": "ContractDefinition", - "src": "62:406:0" + "src": "62:399:0" } ], "id": 19, "name": "SourceUnit", - "src": "36:433:0" + "src": "36:426:0" } diff --git a/test/cmdlineTests/standard_secondary_source_location/input.json b/test/cmdlineTests/standard_secondary_source_location/input.json index 0cd6a6126492..e429265b429f 100644 --- a/test/cmdlineTests/standard_secondary_source_location/input.json +++ b/test/cmdlineTests/standard_secondary_source_location/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract A { constructor(uint) public {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {}" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract A { constructor(uint) {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {}" } } } diff --git a/test/cmdlineTests/standard_secondary_source_location/output.json b/test/cmdlineTests/standard_secondary_source_location/output.json index b32b00028f95..45874df276e2 100644 --- a/test/cmdlineTests/standard_secondary_source_location/output.json +++ b/test/cmdlineTests/standard_secondary_source_location/output.json @@ -1,10 +1,10 @@ -{"errors":[{"component":"general","errorCode":"3364","formattedMessage":"A:2:112: DeclarationError: Base constructor arguments given twice. -pragma solidity >=0.0; contract A { constructor(uint) public {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} - ^-------------------^ -A:2:81: First constructor call is here: -pragma solidity >=0.0; contract A { constructor(uint) public {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} - ^--^ -A:2:104: Second constructor call is here: -pragma solidity >=0.0; contract A { constructor(uint) public {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} - ^--^ -","message":"Base constructor arguments given twice.","secondarySourceLocations":[{"end":119,"file":"A","message":"First constructor call is here:","start":115},{"end":142,"file":"A","message":"Second constructor call is here:","start":138}],"severity":"error","sourceLocation":{"end":167,"file":"A","start":146},"type":"DeclarationError"}],"sources":{}} +{"errors":[{"component":"general","errorCode":"3364","formattedMessage":"A:2:105: DeclarationError: Base constructor arguments given twice. +pragma solidity >=0.0; contract A { constructor(uint) {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} + ^-------------------^ +A:2:74: First constructor call is here: +pragma solidity >=0.0; contract A { constructor(uint) {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} + ^--^ +A:2:97: Second constructor call is here: +pragma solidity >=0.0; contract A { constructor(uint) {} } contract B is A(2) { } contract C is A(3) {} contract D is B, C {} + ^--^ +","message":"Base constructor arguments given twice.","secondarySourceLocations":[{"end":112,"file":"A","message":"First constructor call is here:","start":108},{"end":135,"file":"A","message":"Second constructor call is here:","start":131}],"severity":"error","sourceLocation":{"end":160,"file":"A","start":139},"type":"DeclarationError"}],"sources":{}} diff --git a/test/cmdlineTests/yul_optimizer_steps/input.sol b/test/cmdlineTests/yul_optimizer_steps/input.sol index a75662b25803..c93363e41d4c 100644 --- a/test/cmdlineTests/yul_optimizer_steps/input.sol +++ b/test/cmdlineTests/yul_optimizer_steps/input.sol @@ -3,5 +3,5 @@ pragma solidity >=0.0; contract C { - constructor() public {} + constructor() {} } diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol index cbb4355e8a8a..b4594344c2b1 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol @@ -104,7 +104,6 @@ contract MultiSigWallet { /// @param _owners List of initial owners. /// @param _required Number of required confirmations. constructor(address[] memory _owners, uint _required) - public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol index bb85c46d0103..6207f9764b5e 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol @@ -20,7 +20,6 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { /// @param _required Number of required confirmations. /// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. constructor(address[] memory _owners, uint _required, uint _dailyLimit) - public MultiSigWallet(_owners, _required) { dailyLimit = _dailyLimit; diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index a8804fd4cb40..a0c31cbc3f6c 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -50,7 +50,7 @@ contract ico is safeMath { uint256 public totalMint; uint256 public totalPremiumMint; - constructor(address payable foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public { + constructor(address payable foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) { /* Installation function. diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index ccbe5ac92051..e8e65760c8a7 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -36,7 +36,7 @@ contract moduleHandler is multiOwner, announcementTypes { uint256 debugModeUntil = block.number + 1000000; - constructor(address[] memory newOwners) multiOwner(newOwners) public {} + constructor(address[] memory newOwners) multiOwner(newOwners) {} function load(address payable foundation, bool forReplace, address payable Token, address payable Premium, address payable Publisher, address payable Schelling, address payable Provider) public { /* Loading modulest to ModuleHandler. diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol index b61289dd2ea1..cad0ce7a8667 100644 --- a/test/compilationTests/corion/multiOwner.sol +++ b/test/compilationTests/corion/multiOwner.sol @@ -12,7 +12,7 @@ contract multiOwner is safeMath { /* Constructor */ - constructor(address[] memory newOwners) public { + constructor(address[] memory newOwners) { for ( uint256 a=0 ; a bool) public genesis; - constructor(bool forReplace, address payable moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public { + constructor(bool forReplace, address payable moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) { /* Setup function. If an ICOaddress is defined then the balance of the genesis addresses will be set as well. diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 8b8761179c3d..1e2d308a1ac8 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -118,7 +118,7 @@ contract provider is module, safeMath, announcementTypes { uint256 private currentSchellingRound = 1; - constructor(address payable _moduleHandler) public { + constructor(address payable _moduleHandler) { /* Install function. diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol index 19746ec57930..ec8ce33bc392 100644 --- a/test/compilationTests/corion/publisher.sol +++ b/test/compilationTests/corion/publisher.sol @@ -61,7 +61,7 @@ contract publisher is announcementTypes, module, safeMath { mapping (address => uint256[]) public opponents; - constructor(address payable moduleHandler) public { + constructor(address payable moduleHandler) { /* Installation function. The installer will be registered in the admin list automatically diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol index 51f4727ef8d3..bbb16e250647 100644 --- a/test/compilationTests/corion/schelling.sol +++ b/test/compilationTests/corion/schelling.sol @@ -45,7 +45,7 @@ contract schellingDB is safeMath, schellingVars { /* Constructor */ - constructor() public { + constructor() { rounds.push(); rounds.push(); rounds[0].blockHeight = block.number; @@ -249,7 +249,7 @@ contract schelling is module, announcementTypes, schellingVars { bytes1 public belowChar = 0x30; schellingDB private db; - constructor(address payable _moduleHandler, address _db, bool _forReplace) public { + constructor(address payable _moduleHandler, address _db, bool _forReplace) { /* Installation function. diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index 0888744dba41..865372d5f7e0 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -49,7 +49,7 @@ contract token is safeMath, module, announcementTypes { mapping(address => bool) public genesis; - constructor(bool forReplace, address payable moduleHandler, address dbAddr, address payable icoContractAddr, address payable exchangeContractAddress, address payable[] memory genesisAddr, uint256[] memory genesisValue) public payable { + constructor(bool forReplace, address payable moduleHandler, address dbAddr, address payable icoContractAddr, address payable exchangeContractAddress, address payable[] memory genesisAddr, uint256[] memory genesisValue) payable { /* Installation function diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol index 6b04b73d92dc..e3cd0edc7b4c 100644 --- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol +++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol @@ -18,7 +18,6 @@ contract CategoricalEvent is Event { Oracle _oracle, uint8 outcomeCount ) - public Event(_collateralToken, _oracle, outcomeCount) { diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol index 8f48d4ac2dde..4b5bb24d0daf 100644 --- a/test/compilationTests/gnosis/Events/Event.sol +++ b/test/compilationTests/gnosis/Events/Event.sol @@ -34,7 +34,6 @@ abstract contract Event { /// @param _oracle Oracle contract used to resolve the event /// @param outcomeCount Number of event outcomes constructor(Token _collateralToken, Oracle _oracle, uint8 outcomeCount) - public { // Validate input require(address(_collateralToken) != address(0) && address(_oracle) != address(0) && outcomeCount >= 2); diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol index 6df1dc072af4..c2b0a90a2527 100644 --- a/test/compilationTests/gnosis/Events/ScalarEvent.sol +++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol @@ -34,7 +34,6 @@ contract ScalarEvent is Event { int _lowerBound, int _upperBound ) - public Event(_collateralToken, _oracle, 2) { // Validate bounds diff --git a/test/compilationTests/gnosis/Markets/Campaign.sol b/test/compilationTests/gnosis/Markets/Campaign.sol index a4aa97134bf9..450a381704e2 100644 --- a/test/compilationTests/gnosis/Markets/Campaign.sol +++ b/test/compilationTests/gnosis/Markets/Campaign.sol @@ -78,7 +78,6 @@ contract Campaign { uint _funding, uint _deadline ) - public { // Validate input require( address(_eventContract) != address(0) diff --git a/test/compilationTests/gnosis/Markets/StandardMarket.sol b/test/compilationTests/gnosis/Markets/StandardMarket.sol index d77fadacae46..5e476a86fafb 100644 --- a/test/compilationTests/gnosis/Markets/StandardMarket.sol +++ b/test/compilationTests/gnosis/Markets/StandardMarket.sol @@ -39,7 +39,6 @@ contract StandardMarket is Market { /// @param _marketMaker Market maker contract /// @param _fee Market fee constructor(address _creator, Event _eventContract, MarketMaker _marketMaker, uint24 _fee) - public { // Validate inputs require(address(_eventContract) != address(0) && address(_marketMaker) != address(0) && _fee < FEE_RANGE); diff --git a/test/compilationTests/gnosis/Migrations.sol b/test/compilationTests/gnosis/Migrations.sol index 396e3649448a..9d37ef688abe 100644 --- a/test/compilationTests/gnosis/Migrations.sol +++ b/test/compilationTests/gnosis/Migrations.sol @@ -8,7 +8,7 @@ contract Migrations { if (msg.sender == owner) _; } - constructor() public { + constructor() { owner = msg.sender; } diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol index 97253229c25f..08df083050c0 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol @@ -35,7 +35,6 @@ contract CentralizedOracle is Oracle { /// @dev Constructor sets owner address and IPFS hash /// @param _ipfsHash Hash identifying off chain event description constructor(address _owner, bytes memory _ipfsHash) - public { // Description hash cannot be null require(_ipfsHash.length == 46); diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol index a42f2ba66303..b94f5b64bf35 100644 --- a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol @@ -23,7 +23,6 @@ contract DifficultyOracle is Oracle { /// @dev Contract constructor validates and sets target block number /// @param _blockNumber Target block number constructor(uint _blockNumber) - public { // Block has to be in the future require(_blockNumber > block.number); diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol index 1f92bcd9c057..89b418b73e9f 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol @@ -68,7 +68,6 @@ contract FutarchyOracle is Oracle { uint24 fee, uint _deadline ) - public { // Deadline is in the future require(_deadline > block.timestamp); diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol index 4a440c58c0f2..a6438379b195 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracleFactory.sol @@ -34,7 +34,6 @@ contract FutarchyOracleFactory { /// @dev Constructor sets event factory contract /// @param _eventFactory Event factory contract constructor(EventFactory _eventFactory) - public { require(address(_eventFactory) != address(0)); eventFactory = _eventFactory; diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol index d57c894299c4..854088fa4411 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol @@ -17,7 +17,6 @@ contract MajorityOracle is Oracle { /// @dev Allows to create an oracle for a majority vote based on other oracles /// @param _oracles List of oracles taking part in the majority vote constructor(Oracle[] memory _oracles) - public { // At least 2 oracles should be defined require(_oracles.length > 2); diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol index 694b7374278f..7b56a107ee58 100644 --- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol +++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol @@ -39,7 +39,6 @@ contract SignedMessageOracle is Oracle { /// @param r Signature parameter /// @param s Signature parameter constructor(bytes32 _descriptionHash, uint8 v, bytes32 r, bytes32 s) - public { signer = ecrecover(_descriptionHash, v, r, s); descriptionHash = _descriptionHash; diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol index 9b8b982904e1..9fc7a0cc9d7b 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol @@ -54,7 +54,6 @@ contract UltimateOracle is Oracle { uint _challengeAmount, uint _frontRunnerPeriod ) - public { // Validate inputs require( address(_forwardedOracle) != address(0) diff --git a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol index 11f4ece1474a..ed63541db23c 100644 --- a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol +++ b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol @@ -32,7 +32,6 @@ contract OutcomeToken is StandardToken { */ /// @dev Constructor sets events contract address constructor() - public { eventContract = msg.sender; } diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index 70ded719fde1..2aee9f4cf443 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -112,7 +112,7 @@ contract MilestoneTracker { address _arbitrator, address _donor, address _recipient - ) public { + ) { arbitrator = _arbitrator; donor = _donor; recipient = _recipient; diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index 29c734f20920..9a76aae7abe6 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -114,7 +114,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem { uint constant c_renewalInterval = 365 days; uint constant c_freeBytes = 12; - constructor() public { + constructor() { // TODO: Populate with hall-of-fame. } diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 5f353b0bcad8..764cae0ae6eb 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -100,7 +100,7 @@ contract multiowned { // constructor is given number of sigs required to do protected "onlymanyowners" transactions // as well as the selection of addresses capable of confirming them. - constructor(address[] memory _owners, uint _required) public { + constructor(address[] memory _owners, uint _required) { m_numOwners = _owners.length + 1; m_owners[1] = uint(msg.sender); m_ownerIndex[uint(msg.sender)] = 1; @@ -288,7 +288,7 @@ abstract contract daylimit is multiowned { // METHODS // constructor - stores initial daily limit and records the present day's index. - constructor(uint _limit) public { + constructor(uint _limit) { m_dailyLimit = _limit; m_lastDay = today(); } @@ -369,7 +369,7 @@ contract Wallet is multisig, multiowned, daylimit { // constructor - just pass on the owner array to the multiowned and // the limit to daylimit - constructor(address[] memory _owners, uint _required, uint _daylimit) public payable + constructor(address[] memory _owners, uint _required, uint _daylimit) payable multiowned(_owners, _required) daylimit(_daylimit) { } diff --git a/test/externalTests/solc-js/DAO/ManagedAccount.sol b/test/externalTests/solc-js/DAO/ManagedAccount.sol index 11b0b3c326c6..879de9587718 100644 --- a/test/externalTests/solc-js/DAO/ManagedAccount.sol +++ b/test/externalTests/solc-js/DAO/ManagedAccount.sol @@ -42,7 +42,7 @@ abstract contract ManagedAccountInterface { contract ManagedAccount is ManagedAccountInterface{ // The constructor sets the owner of the account - constructor(address _owner, bool _payOwnerOnly) public { + constructor(address _owner, bool _payOwnerOnly) { owner = _owner; payOwnerOnly = _payOwnerOnly; } diff --git a/test/libsolidity/ABIDecoderTests.cpp b/test/libsolidity/ABIDecoderTests.cpp index 39bf7602c6ca..5226aa0d6892 100644 --- a/test/libsolidity/ABIDecoderTests.cpp +++ b/test/libsolidity/ABIDecoderTests.cpp @@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(decode_from_memory_simple) contract C { uint public _a; uint[] public _b; - constructor(uint a, uint[] memory b) public { + constructor(uint a, uint[] memory b) { _a = a; _b = b; } @@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(decode_function_type) string sourceCode = R"( contract D { function () external returns (uint) public _a; - constructor(function () external returns (uint) a) public { + constructor(function () external returns (uint) a) { _a = a; } } @@ -377,13 +377,13 @@ BOOST_AUTO_TEST_CASE(decode_function_type_array) string sourceCode = R"( contract D { function () external returns (uint)[] public _a; - constructor(function () external returns (uint)[] memory a) public { + constructor(function () external returns (uint)[] memory a) { _a = a; } } contract E { function () external returns (uint)[3] public _a; - constructor(function () external returns (uint)[3] memory a) public { + constructor(function () external returns (uint)[3] memory a) { _a = a; } } @@ -445,7 +445,7 @@ BOOST_AUTO_TEST_CASE(decode_from_memory_complex) uint public _a; uint[] public _b; bytes[2] public _c; - constructor(uint a, uint[] memory b, bytes[2] memory c) public { + constructor(uint a, uint[] memory b, bytes[2] memory c) { _a = a; _b = b; _c = c; diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index 777f991a340c..9cb6f350bb6e 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -718,7 +718,7 @@ BOOST_AUTO_TEST_CASE(struct_in_constructor) string c; } S public x; - constructor(S memory s) public { x = s; } + constructor(S memory s) { x = s; } } )"; @@ -738,7 +738,7 @@ BOOST_AUTO_TEST_CASE(struct_in_constructor_indirect) string c; } S public x; - constructor(S memory s) public { x = s; } + constructor(S memory s) { x = s; } } contract D { @@ -771,7 +771,7 @@ BOOST_AUTO_TEST_CASE(struct_in_constructor_data_short) string c; } S public x; - constructor(S memory s) public { x = s; } + constructor(S memory s) { x = s; } } )"; diff --git a/test/libsolidity/ABIJson/constructor_abi.sol b/test/libsolidity/ABIJson/constructor_abi.sol index d6cb1d49509b..ae07c9401138 100644 --- a/test/libsolidity/ABIJson/constructor_abi.sol +++ b/test/libsolidity/ABIJson/constructor_abi.sol @@ -1,5 +1,5 @@ contract test { - constructor(uint param1, test param2, bool param3) public {} + constructor(uint param1, test param2, bool param3) {} } // ---- // :test diff --git a/test/libsolidity/ABIJson/internal_constructor.sol b/test/libsolidity/ABIJson/internal_constructor.sol index 7f8ea5ed2e00..47c783b5d8a8 100644 --- a/test/libsolidity/ABIJson/internal_constructor.sol +++ b/test/libsolidity/ABIJson/internal_constructor.sol @@ -1,7 +1,7 @@ // bug #8712 -contract B { +abstract contract B { uint immutable x; - constructor(function() internal returns(uint) fp) internal { + constructor(function() internal returns(uint) fp) { x = fp(); } } // ---- diff --git a/test/libsolidity/ABIJson/payable_constructor_abi.sol b/test/libsolidity/ABIJson/payable_constructor_abi.sol index e9497b248e96..579e83efb10f 100644 --- a/test/libsolidity/ABIJson/payable_constructor_abi.sol +++ b/test/libsolidity/ABIJson/payable_constructor_abi.sol @@ -1,5 +1,5 @@ contract test { - constructor(uint param1, test param2, bool param3) public payable {} + constructor(uint param1, test param2, bool param3) payable {} } // ---- // :test diff --git a/test/libsolidity/ABIJson/return_param_in_abi.sol b/test/libsolidity/ABIJson/return_param_in_abi.sol index 92782a73d45a..23995d62a323 100644 --- a/test/libsolidity/ABIJson/return_param_in_abi.sol +++ b/test/libsolidity/ABIJson/return_param_in_abi.sol @@ -1,7 +1,7 @@ // bug #1801 contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - constructor(ActionChoices param) public {} + constructor(ActionChoices param) {} function ret() public returns (ActionChoices) { ActionChoices action = ActionChoices.GoLeft; return action; diff --git a/test/libsolidity/ASTJSON/abstract_contract.json b/test/libsolidity/ASTJSON/abstract_contract.json index 27b74a32d157..08b1e6d95c07 100644 --- a/test/libsolidity/ASTJSON/abstract_contract.json +++ b/test/libsolidity/ASTJSON/abstract_contract.json @@ -31,7 +31,7 @@ { "id": 3, "nodeType": "Block", - "src": "44:4:1", + "src": "37:4:1", "statements": [] }, "id": 4, @@ -52,18 +52,18 @@ "id": 2, "nodeType": "ParameterList", "parameters": [], - "src": "44:0:1" + "src": "37:0:1" }, "scope": 5, - "src": "23:25:1", + "src": "23:18:1", "stateMutability": "nonpayable", "virtual": false, - "visibility": "public" + "visibility": "internal" } ], "scope": 6, - "src": "0:50:1" + "src": "0:43:1" } ], - "src": "0:51:1" + "src": "0:44:1" } diff --git a/test/libsolidity/ASTJSON/abstract_contract.sol b/test/libsolidity/ASTJSON/abstract_contract.sol index 8ff9955c202a..bddbc177931a 100644 --- a/test/libsolidity/ASTJSON/abstract_contract.sol +++ b/test/libsolidity/ASTJSON/abstract_contract.sol @@ -1,5 +1,5 @@ abstract contract C { - constructor() public { + constructor() { } } diff --git a/test/libsolidity/ASTJSON/abstract_contract_legacy.json b/test/libsolidity/ASTJSON/abstract_contract_legacy.json index c345ab6bae6a..c13abca7f0af 100644 --- a/test/libsolidity/ASTJSON/abstract_contract_legacy.json +++ b/test/libsolidity/ASTJSON/abstract_contract_legacy.json @@ -49,7 +49,7 @@ "scope": 5, "stateMutability": "nonpayable", "virtual": false, - "visibility": "public" + "visibility": "internal" }, "children": [ @@ -77,7 +77,7 @@ "children": [], "id": 2, "name": "ParameterList", - "src": "44:0:1" + "src": "37:0:1" }, { "attributes": @@ -90,20 +90,20 @@ "children": [], "id": 3, "name": "Block", - "src": "44:4:1" + "src": "37:4:1" } ], "id": 4, "name": "FunctionDefinition", - "src": "23:25:1" + "src": "23:18:1" } ], "id": 5, "name": "ContractDefinition", - "src": "0:50:1" + "src": "0:43:1" } ], "id": 6, "name": "SourceUnit", - "src": "0:51:1" + "src": "0:44:1" } diff --git a/test/libsolidity/ASTJSON/constructor.json b/test/libsolidity/ASTJSON/constructor.json index 24a91d1feeb9..31747901e231 100644 --- a/test/libsolidity/ASTJSON/constructor.json +++ b/test/libsolidity/ASTJSON/constructor.json @@ -31,7 +31,7 @@ { "id": 3, "nodeType": "Block", - "src": "35:4:1", + "src": "28:4:1", "statements": [] }, "id": 4, @@ -52,18 +52,18 @@ "id": 2, "nodeType": "ParameterList", "parameters": [], - "src": "35:0:1" + "src": "28:0:1" }, "scope": 5, - "src": "14:25:1", + "src": "14:18:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], "scope": 6, - "src": "0:41:1" + "src": "0:34:1" } ], - "src": "0:42:1" + "src": "0:35:1" } diff --git a/test/libsolidity/ASTJSON/constructor.sol b/test/libsolidity/ASTJSON/constructor.sol index f89ac45b4135..b2b1c646048b 100644 --- a/test/libsolidity/ASTJSON/constructor.sol +++ b/test/libsolidity/ASTJSON/constructor.sol @@ -1,5 +1,5 @@ contract C { - constructor() public { + constructor() { } } diff --git a/test/libsolidity/ASTJSON/constructor_legacy.json b/test/libsolidity/ASTJSON/constructor_legacy.json index 108fbcdf0ee2..68a648bc9d54 100644 --- a/test/libsolidity/ASTJSON/constructor_legacy.json +++ b/test/libsolidity/ASTJSON/constructor_legacy.json @@ -77,7 +77,7 @@ "children": [], "id": 2, "name": "ParameterList", - "src": "35:0:1" + "src": "28:0:1" }, { "attributes": @@ -90,20 +90,20 @@ "children": [], "id": 3, "name": "Block", - "src": "35:4:1" + "src": "28:4:1" } ], "id": 4, "name": "FunctionDefinition", - "src": "14:25:1" + "src": "14:18:1" } ], "id": 5, "name": "ContractDefinition", - "src": "0:41:1" + "src": "0:34:1" } ], "id": 6, "name": "SourceUnit", - "src": "0:42:1" + "src": "0:35:1" } diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 09e257664546..38f980506384 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(store_keccak256) char const* sourceCode = R"( contract test { bytes32 public shaValue; - constructor() public { + constructor() { shaValue = keccak256(abi.encodePacked(this)); } } @@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(updating_store) contract test { uint data; uint data2; - constructor() public { + constructor() { data = 1; data = 2; data2 = 0; diff --git a/test/libsolidity/SolidityCompiler.cpp b/test/libsolidity/SolidityCompiler.cpp index 971a74a75698..13f714e5e90a 100644 --- a/test/libsolidity/SolidityCompiler.cpp +++ b/test/libsolidity/SolidityCompiler.cpp @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(does_not_include_creation_time_only_internal_functions) char const* sourceCode = R"( contract C { uint x; - constructor() public { f(); } + constructor() { f(); } function f() internal { for (uint i = 0; i < 10; ++i) x += 3 + i; } } )"; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 2d3e4f762e32..32b7132598f5 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -980,7 +980,7 @@ BOOST_AUTO_TEST_CASE(constructor) char const* sourceCode = R"( contract test { mapping(uint => uint) data; - constructor() public { + constructor() { data[7] = 8; } function get(uint key) public returns (uint value) { @@ -1007,7 +1007,7 @@ BOOST_AUTO_TEST_CASE(blockchain) { char const* sourceCode = R"( contract test { - constructor() public payable {} + constructor() payable {} function someInfo() public payable returns (uint256 value, address coinbase, uint256 blockNumber) { value = msg.value; coinbase = block.coinbase; @@ -1029,7 +1029,7 @@ BOOST_AUTO_TEST_CASE(send_ether) { char const* sourceCode = R"( contract test { - constructor() payable public {} + constructor() payable {} function a(address payable addr, uint amount) public returns (uint ret) { addr.send(amount); return address(this).balance; @@ -1049,7 +1049,7 @@ BOOST_AUTO_TEST_CASE(transfer_ether) { char const* sourceCode = R"( contract A { - constructor() public payable {} + constructor() payable {} function a(address payable addr, uint amount) public returns (uint) { addr.transfer(amount); return address(this).balance; @@ -1205,7 +1205,7 @@ BOOST_AUTO_TEST_CASE(log_in_constructor) { char const* sourceCode = R"( contract test { - constructor() public { + constructor() { log1(bytes32(uint256(1)), bytes32(uint256(2))); } } @@ -1224,7 +1224,7 @@ BOOST_AUTO_TEST_CASE(selfdestruct) { char const* sourceCode = R"( contract test { - constructor() public payable {} + constructor() payable {} function a(address payable receiver) public returns (uint ret) { selfdestruct(receiver); return 10; @@ -1613,7 +1613,7 @@ BOOST_AUTO_TEST_CASE(constructor_with_long_arguments) string public a; string public b; - constructor(string memory _a, string memory _b) public { + constructor(string memory _a, string memory _b) { a = _a; b = _b; } @@ -1642,7 +1642,7 @@ BOOST_AUTO_TEST_CASE(contracts_as_addresses) } contract test { helper h; - constructor() public payable { h = new helper(); address(h).send(5); } + constructor() payable { h = new helper(); address(h).send(5); } function getBalance() public returns (uint256 myBalance, uint256 helperBalance) { myBalance = address(this).balance; helperBalance = address(h).balance; @@ -1719,8 +1719,8 @@ BOOST_AUTO_TEST_CASE(blockhash) BOOST_AUTO_TEST_CASE(internal_constructor) { char const* sourceCode = R"( - contract C { - constructor() internal {} + abstract contract C { + constructor() {} } )"; BOOST_CHECK(compileAndRunWithoutCheck({{"", sourceCode}}, 0, "C").empty()); @@ -2378,7 +2378,7 @@ BOOST_AUTO_TEST_CASE(generic_call) function recv(uint256 x) public payable { received = x; } } contract sender { - constructor() public payable {} + constructor() payable {} function doSend(address rec) public returns (uint d) { bytes4 signature = bytes4(bytes32(keccak256("recv(uint256)"))); @@ -2401,14 +2401,14 @@ BOOST_AUTO_TEST_CASE(generic_delegatecall) uint public received; address public sender; uint public value; - constructor() public payable {} + constructor() payable {} function recv(uint256 x) public payable { received = x; sender = msg.sender; value = msg.value; } } contract Sender { uint public received; address public sender; uint public value; - constructor() public payable {} + constructor() payable {} function doSend(address rec) public payable { bytes4 signature = bytes4(bytes32(keccak256("recv(uint256)"))); @@ -2449,7 +2449,7 @@ BOOST_AUTO_TEST_CASE(generic_staticcall) char const* sourceCode = R"**( contract A { uint public x; - constructor() public { x = 42; } + constructor() { x = 42; } function pureFunction(uint256 p) public pure returns (uint256) { return p; } function viewFunction(uint256 p) public view returns (uint256) { return p + x; } function nonpayableFunction(uint256 p) public returns (uint256) { x = p; return x; } @@ -2584,7 +2584,7 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes) fallback() external { received = 0x80; } } contract sender { - constructor() public { rec = new receiver(); } + constructor() { rec = new receiver(); } fallback() external { savedData = msg.data; } function forward() public returns (bool) { address(rec).call(savedData); return true; } function clear() public returns (bool) { delete savedData; return true; } @@ -2613,7 +2613,7 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length) } contract sender { receiver rec; - constructor() public { rec = new receiver(); } + constructor() { rec = new receiver(); } function viaCalldata() public returns (uint) { (bool success,) = address(rec).call(msg.data); require(success); @@ -2657,7 +2657,7 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign) fallback() external { received = 0x80; } } contract sender { - constructor() public { rec = new receiver(); } + constructor() { rec = new receiver(); } fallback() external { savedData1 = savedData2 = msg.data; } function forward(bool selector) public returns (bool) { if (selector) { address(rec).call(savedData1); delete savedData1; } @@ -3609,7 +3609,7 @@ BOOST_AUTO_TEST_CASE(evm_exceptions_in_constructor_out_of_baund) contract A { uint public test = 1; uint[3] arr; - constructor() public + constructor() { uint index = 5; test = arr[index]; @@ -3631,7 +3631,7 @@ BOOST_AUTO_TEST_CASE(failing_send) } } contract Main { - constructor() public payable {} + constructor() payable {} function callHelper(address payable _a) public returns (bool r, uint bal) { r = !_a.send(5); bal = address(this).balance; @@ -3856,7 +3856,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_constructors_unpacker) contract Test { uint public m_x; bytes public m_s; - constructor(uint x, bytes memory s) public { + constructor(uint x, bytes memory s) { m_x = x; m_s = s; } @@ -3877,7 +3877,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_constructors_packer) contract Base { uint public m_x; bytes m_s; - constructor(uint x, bytes memory s) public { + constructor(uint x, bytes memory s) { m_x = x; m_s = s; } @@ -3886,7 +3886,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_constructors_packer) } } contract Main is Base { - constructor(bytes memory s, uint x) Base(x, f(s)) public {} + constructor(bytes memory s, uint x) Base(x, f(s)) {} function f(bytes memory s) public returns (bytes memory) { return s; } @@ -3916,7 +3916,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_constructors) contract Base { uint public m_x; address[] m_s; - constructor(uint x, address[] memory s) public { + constructor(uint x, address[] memory s) { m_x = x; m_s = s; } @@ -3925,7 +3925,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_constructors) } } contract Main is Base { - constructor(address[] memory s, uint x) Base(x, f(s)) public {} + constructor(address[] memory s, uint x) Base(x, f(s)) {} function f(address[] memory s) public returns (address[] memory) { return s; } @@ -4468,7 +4468,7 @@ BOOST_AUTO_TEST_CASE(constant_string_literal) bytes32 constant public b = "abcdefghijklmnopq"; string constant public x = "abefghijklmnopqabcdefghijklmnopqabcdefghijklmnopqabca"; - constructor() public { + constructor() { string memory xx = x; bytes32 bb = b; } @@ -4969,7 +4969,7 @@ BOOST_AUTO_TEST_CASE(calldata_offset) { address[] _arr; string public last = "nd"; - constructor(address[] memory guardians) public + constructor(address[] memory guardians) { _arr = guardians; } @@ -4984,7 +4984,7 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library) char const* sourceCode = R"( library lib {} contract c { - constructor() public payable {} + constructor() payable {} function f(address payable x) public returns (bool) { return x.send(1); } @@ -5203,10 +5203,10 @@ BOOST_AUTO_TEST_CASE(index_access_with_type_conversion) BOOST_AUTO_TEST_CASE(failed_create) { char const* sourceCode = R"( - contract D { constructor() public payable {} } + contract D { constructor() payable {} } contract C { uint public x; - constructor() public payable {} + constructor() payable {} function f(uint amount) public returns (D) { x++; return (new D){value: amount}(); @@ -5235,7 +5235,7 @@ BOOST_AUTO_TEST_CASE(correctly_initialize_memory_array_in_constructor) char const* sourceCode = R"( contract C { bool public success; - constructor() public { + constructor() { // Make memory dirty. assembly { for { let i := 0 } lt(i, 64) { i := add(i, 1) } { @@ -5272,7 +5272,7 @@ BOOST_AUTO_TEST_CASE(mutex) } contract Fund is mutexed { uint shares; - constructor() public payable { shares = msg.value; } + constructor() payable { shares = msg.value; } function withdraw(uint amount) public protected returns (uint) { // NOTE: It is very bad practice to write this function this way. // Please refer to the documentation of how to do this properly. @@ -5297,7 +5297,7 @@ BOOST_AUTO_TEST_CASE(mutex) uint callDepth; bool protected; function setProtected(bool _protected) public { protected = _protected; } - constructor(Fund _fund) public { fund = _fund; } + constructor(Fund _fund) { fund = _fund; } function attack() public returns (uint) { callDepth = 0; return attackInternal(); @@ -5537,7 +5537,7 @@ BOOST_AUTO_TEST_CASE(include_creation_bytecode_only_once) contract D { bytes a = hex"1237651237125387136581271652831736512837126583171583712358126123765123712538713658127165283173651283712658317158371235812612376512371253871365812716528317365128371265831715837123581261237651237125387136581271652831736512837126583171583712358126"; bytes b = hex"1237651237125327136581271252831736512837126583171383712358126123765125712538713658127165253173651283712658357158371235812612376512371a5387136581271652a317365128371265a317158371235812612a765123712538a13658127165a83173651283712a58317158371235a126"; - constructor(uint) public {} + constructor(uint) {} } contract Double { function f() public { @@ -5783,7 +5783,7 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_create) { char const* sourceCode = R"( contract E { - constructor() public { + constructor() { revert("message"); } } @@ -5897,7 +5897,7 @@ BOOST_AUTO_TEST_CASE(bare_call_return_data) { string sourceCode = R"DELIMITER( contract A { - constructor() public { + constructor() { } function return_bool() public pure returns(bool) { return true; @@ -5928,7 +5928,7 @@ BOOST_AUTO_TEST_CASE(bare_call_return_data) } contract C { A addr; - constructor() public { + constructor() { addr = new A(); } function f(string memory signature) public returns (bool, bytes memory) { @@ -6259,7 +6259,7 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_structs) } S s; event E(S indexed); - constructor() public { + constructor() { s.a = 0x12; s.b = -7; s.c[0] = 2; @@ -6324,7 +6324,7 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_arrayOfStrings) contract C { string[] x; event E(string[] indexed); - constructor() public { + constructor() { x.push("abc"); x.push("0123456789012345678901234567890123456789"); } @@ -6367,7 +6367,7 @@ BOOST_AUTO_TEST_CASE(event_signature_in_library) } } contract C { - constructor() public { + constructor() { L.f(); } } @@ -6695,7 +6695,7 @@ BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser) char const* sourceCode = R"( contract C { event X(uint); - constructor() public { + constructor() { assembly { // make scratch space dirty mstore(0, 0x4242424242424242424242424242424242424242424242424242424242424242) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index b97d7bd4d675..65a8026a48e0 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(implement_abstract_via_constructor) SourceUnit const* sourceUnit = nullptr; char const* text = R"( abstract contract base { function foo() public virtual; } - abstract contract foo is base { constructor() public {} } + abstract contract foo is base { constructor() {} } )"; sourceUnit = parseAndAnalyse(text); std::vector> nodes = sourceUnit->nodes(); diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 48ddfac4db14..e3ead6f0504a 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -1070,7 +1070,7 @@ BOOST_AUTO_TEST_CASE(user_constructor) char const* sourceCode = R"( contract test { /// @notice this is a really nice constructor - constructor(uint a, uint second) public { } + constructor(uint a, uint second) { } } )"; @@ -1090,7 +1090,7 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function) char const* sourceCode = R"( contract test { /// @notice this is a really nice constructor - constructor(uint a, uint second) public { } + constructor(uint a, uint second) { } /// another multiplier function mul(uint a, uint second) public returns(uint d) { return a * 7 + second; } } @@ -1117,7 +1117,7 @@ BOOST_AUTO_TEST_CASE(dev_constructor) /// @author Alex /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion - constructor(uint a, uint second) public { } + constructor(uint a, uint second) { } } )"; @@ -1144,7 +1144,7 @@ BOOST_AUTO_TEST_CASE(dev_constructor_return) /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion /// @return return should not work within constructors - constructor(uint a, uint second) public { } + constructor(uint a, uint second) { } } )"; @@ -1158,7 +1158,7 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function) /// @author Alex /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion - constructor(uint a, uint second) public { } + constructor(uint a, uint second) { } /// @dev Multiplies a number by 7 and adds second parameter /// @param a Documentation for the first parameter starts here. /// Since it's a really complicated parameter we need 2 lines diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 5efc0f71e9b8..6e4d359c8f3a 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -378,7 +378,7 @@ BOOST_AUTO_TEST_CASE(computing_constants) uint m_b; uint m_c; uint m_d; - constructor() public { + constructor() { set(); } function set() public returns (uint) { @@ -562,7 +562,7 @@ BOOST_AUTO_TEST_CASE(dead_code_elimination_across_assemblies) char const* sourceCode = R"( contract DCE { function () internal returns (uint) stored; - constructor() public { + constructor() { stored = f; } function f() internal returns (uint) { return 7; } diff --git a/test/libsolidity/errorRecoveryTests/constructor_recovers.sol b/test/libsolidity/errorRecoveryTests/constructor_recovers.sol index 393a638cae26..cc03f1e89f1d 100644 --- a/test/libsolidity/errorRecoveryTests/constructor_recovers.sol +++ b/test/libsolidity/errorRecoveryTests/constructor_recovers.sol @@ -1,7 +1,7 @@ pragma solidity >=0.0.0; contract Error1 { - constructor() public { + constructor() { balances[tx.origin] = ; // missing RHS. } @@ -16,5 +16,5 @@ contract Error1 { } } // ---- -// ParserError 6933: (95-96): Expected primary expression. -// Warning 3347: (95-96): Recovered in Statement at ';'. +// ParserError 6933: (88-89): Expected primary expression. +// Warning 3347: (88-89): Recovered in Statement at ';'. diff --git a/test/libsolidity/errorRecoveryTests/missing_rhs.sol b/test/libsolidity/errorRecoveryTests/missing_rhs.sol index 6cd99f76a68c..aaf7a7509e95 100644 --- a/test/libsolidity/errorRecoveryTests/missing_rhs.sol +++ b/test/libsolidity/errorRecoveryTests/missing_rhs.sol @@ -1,11 +1,11 @@ pragma solidity >=0.0.0; contract Error3 { - constructor() public { + constructor() { balances[tx.origin] = ; // missing RHS. } } // ---- -// ParserError 6933: (95-96): Expected primary expression. -// Warning 3347: (95-96): Recovered in Statement at ';'. +// ParserError 6933: (88-89): Expected primary expression. +// Warning 3347: (88-89): Recovered in Statement at ';'. diff --git a/test/libsolidity/errorRecoveryTests/multiple_errors.sol b/test/libsolidity/errorRecoveryTests/multiple_errors.sol index 2beccac727a8..c0a0bd32c54c 100644 --- a/test/libsolidity/errorRecoveryTests/multiple_errors.sol +++ b/test/libsolidity/errorRecoveryTests/multiple_errors.sol @@ -6,7 +6,7 @@ pragma solidity >=0.0.0; contract Error4 { - constructor() public { + constructor() { balances[tx.origin] = 1 2; // missing operator } @@ -21,9 +21,9 @@ contract Error4 { } // ---- -// ParserError 6635: (249-250): Expected ';' but got 'Number' -// ParserError 6635: (471-479): Expected ';' but got identifier -// ParserError 6635: (529-533): Expected ';' but got 'emit' -// ParserError 6635: (577-583): Expected ',' but got 'return' -// ParserError 6933: (577-583): Expected primary expression. -// Warning 3796: (588-589): Recovered in Statement at ';'. +// ParserError 6635: (242-243): Expected ';' but got 'Number' +// ParserError 6635: (464-472): Expected ';' but got identifier +// ParserError 6635: (522-526): Expected ';' but got 'emit' +// ParserError 6635: (570-576): Expected ',' but got 'return' +// ParserError 6933: (570-576): Expected primary expression. +// Warning 3796: (581-582): Recovered in Statement at ';'. diff --git a/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol b/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol index 017de5d7b32a..6a34670ffe2f 100644 --- a/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol +++ b/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol @@ -2,7 +2,7 @@ contract C { uint256 constant LEN = 3; uint256[LEN] public a; - constructor(uint256[LEN] memory _a) public { + constructor(uint256[LEN] memory _a) { a = _a; } } diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol b/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol index e85cb599ea38..c6e46a7fad9b 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol @@ -2,7 +2,7 @@ contract Creator { uint256 public r; address public ch; - constructor(address[3] memory s, uint256 x) public { + constructor(address[3] memory s, uint256 x) { r = x; ch = s[2]; } diff --git a/test/libsolidity/semanticTests/array/reusing_memory.sol b/test/libsolidity/semanticTests/array/reusing_memory.sol index 994a31db9ef2..32f21b67558c 100644 --- a/test/libsolidity/semanticTests/array/reusing_memory.sol +++ b/test/libsolidity/semanticTests/array/reusing_memory.sol @@ -2,7 +2,7 @@ contract Helper { uint256 public flag; - constructor(uint256 x) public { + constructor(uint256 x) { flag = x; } } diff --git a/test/libsolidity/semanticTests/array/string_allocation_bug.sol b/test/libsolidity/semanticTests/array/string_allocation_bug.sol index 9c2ec2e5352a..d6dadb78a964 100644 --- a/test/libsolidity/semanticTests/array/string_allocation_bug.sol +++ b/test/libsolidity/semanticTests/array/string_allocation_bug.sol @@ -7,7 +7,7 @@ contract Sample { } s[2] public p; - constructor() public { + constructor() { s memory m; m.x = 0xbbbb; m.y = 0xcccc; diff --git a/test/libsolidity/semanticTests/array/strings_in_struct.sol b/test/libsolidity/semanticTests/array/strings_in_struct.sol index a6ec607f442e..bacf8dec7a00 100644 --- a/test/libsolidity/semanticTests/array/strings_in_struct.sol +++ b/test/libsolidity/semanticTests/array/strings_in_struct.sol @@ -8,7 +8,7 @@ contract buggystruct { string last; } - constructor() public { + constructor() { bug = Buggy(10, 20, 30, "asdfghjkl"); } diff --git a/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol index 539653219837..1c900b497d17 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol @@ -1,6 +1,6 @@ contract C { function(bytes calldata) returns (byte) x; - constructor() public { x = f; } + constructor() { x = f; } function f(bytes calldata b) internal pure returns (byte) { return b[2]; } diff --git a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol index ffb98ada1bed..76c18244e570 100644 --- a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol @@ -1,14 +1,14 @@ contract BaseBase { uint256 m_a; - constructor(uint256 a) public { + constructor(uint256 a) { m_a = a; } } contract Base is BaseBase(7) { - constructor() public { + constructor() { m_a *= m_a; } } diff --git a/test/libsolidity/semanticTests/constructor/callvalue_check.sol b/test/libsolidity/semanticTests/constructor/callvalue_check.sol index c096382d0b77..3b7c63a9ddc8 100644 --- a/test/libsolidity/semanticTests/constructor/callvalue_check.sol +++ b/test/libsolidity/semanticTests/constructor/callvalue_check.sol @@ -1,12 +1,12 @@ -contract A1 { constructor() public {} } +contract A1 { constructor() {} } contract B1 is A1 {} -contract A2 { constructor() public payable {} } +contract A2 { constructor() payable {} } contract B2 is A2 {} contract B3 {} -contract B4 { constructor() public {} } +contract B4 { constructor() {} } contract C { function createWithValue(bytes memory c, uint256 value) public payable returns (bool) { diff --git a/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol b/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol index fe6a4c59b695..bb271ec1745c 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol @@ -2,7 +2,7 @@ contract Main { bytes3 name; bool flag; - constructor(bytes3 x, bool f) public { + constructor(bytes3 x, bool f) { name = x; flag = f; } diff --git a/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol b/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol index b294980833e6..c7534faaf54b 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol @@ -2,7 +2,7 @@ contract Helper { bytes3 name; bool flag; - constructor(bytes3 x, bool f) public { + constructor(bytes3 x, bool f) { name = x; flag = f; } @@ -20,7 +20,7 @@ contract Helper { contract Main { Helper h; - constructor() public { + constructor() { h = new Helper("abc", true); } diff --git a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol index 10243f8979b2..d59f2cd190da 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol @@ -2,7 +2,7 @@ contract C { uint256 public a; uint256[3] public b; - constructor(uint256 _a, uint256[3] memory _b) public { + constructor(uint256 _a, uint256[3] memory _b) { a = _a; b = _b; } diff --git a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol index 4517c9702334..5310d097bf8a 100644 --- a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol +++ b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol @@ -1,5 +1,5 @@ contract A { - constructor() public { + constructor() { address(this).call("123"); } } diff --git a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol index 6f2f414289fe..44d376cb6387 100644 --- a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol @@ -1,7 +1,7 @@ contract BaseBase { uint256 m_a; - constructor(uint256 a) public { + constructor(uint256 a) { m_a = a; } diff --git a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol index 42db8582aed1..9eb3754ff99d 100644 --- a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol @@ -2,7 +2,7 @@ contract Test { bytes3 name; bool flag; - constructor() public { + constructor() { setName("abc"); } diff --git a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol index 56f92cd50c5d..7549f1387429 100644 --- a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol +++ b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol @@ -1,7 +1,7 @@ contract Test { bytes6 name; - constructor() public { + constructor() { function (bytes6 _name) internal setter = setName; setter("abcdef"); diff --git a/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol b/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol index 9744aa3ceb7e..0da5f49b7a26 100644 --- a/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol +++ b/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol @@ -1,10 +1,10 @@ contract A1 {} -contract B1 is A1 { constructor() public payable {} } +contract B1 is A1 { constructor() payable {} } -contract A2 { constructor() public {} } -contract B2 is A2 { constructor() public payable {} } +contract A2 { constructor() {} } +contract B2 is A2 { constructor() payable {} } -contract B3 { constructor() public payable {} } +contract B3 { constructor() payable {} } contract C { function f() public payable returns (bool) { diff --git a/test/libsolidity/semanticTests/constructor/payable_constructor.sol b/test/libsolidity/semanticTests/constructor/payable_constructor.sol index 9a3c56ebee66..143212cba7d8 100644 --- a/test/libsolidity/semanticTests/constructor/payable_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/payable_constructor.sol @@ -1,5 +1,5 @@ contract C { - constructor() public payable {} + constructor() payable {} } // ==== diff --git a/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol index ab8ad47f9be4..72833717d0db 100644 --- a/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol @@ -2,7 +2,7 @@ contract C { uint256 public result_in_constructor; function(uint256) returns (uint256) internal x; - constructor() public { + constructor() { x = double; result_in_constructor = use(2); } diff --git a/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol index 7492a42811d7..04be9f8ed0e5 100644 --- a/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol @@ -1,7 +1,7 @@ contract C { function() returns (uint256) internal x; - constructor() public { + constructor() { x = unused; } diff --git a/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol index 0a4295114f4d..7b166489fb8c 100644 --- a/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol @@ -8,7 +8,7 @@ library L { contract C { function() returns (uint256) internal x; - constructor() public { + constructor() { x = L.x; } diff --git a/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol b/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol index 898edf6ad954..61d8016318e8 100644 --- a/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol +++ b/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol @@ -1,6 +1,6 @@ contract A { uint x; - constructor() public { + constructor() { x = 42; } function f() public returns(uint256) { diff --git a/test/libsolidity/semanticTests/constructor_with_params.sol b/test/libsolidity/semanticTests/constructor_with_params.sol index 19f0bdb574c4..e3ac5b386c84 100644 --- a/test/libsolidity/semanticTests/constructor_with_params.sol +++ b/test/libsolidity/semanticTests/constructor_with_params.sol @@ -2,7 +2,7 @@ contract C { uint public i; uint public k; - constructor(uint newI, uint newK) public { + constructor(uint newI, uint newK) { i = newI; k = newK; } diff --git a/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol b/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol index 0ec3479638ba..89cb202c600d 100644 --- a/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol +++ b/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol @@ -2,22 +2,22 @@ contract A { uint public i; uint public k; - constructor(uint newI, uint newK) public { + constructor(uint newI, uint newK) { i = newI; k = newK; } } abstract contract B is A { uint public j; - constructor(uint newJ) public { + constructor(uint newJ) { j = newJ; } } contract C is A { - constructor(uint newI, uint newK) A(newI, newK) public {} + constructor(uint newI, uint newK) A(newI, newK) {} } contract D is B, C { - constructor(uint newI, uint newK) B(newI) C(newI, newK + 1) public {} + constructor(uint newI, uint newK) B(newI) C(newI, newK + 1) {} } // ==== // compileViaYul: also diff --git a/test/libsolidity/semanticTests/constructor_with_params_inheritance.sol b/test/libsolidity/semanticTests/constructor_with_params_inheritance.sol index 3419a9c25a93..d477bbc0d9fb 100644 --- a/test/libsolidity/semanticTests/constructor_with_params_inheritance.sol +++ b/test/libsolidity/semanticTests/constructor_with_params_inheritance.sol @@ -2,13 +2,13 @@ contract C { uint public i; uint public k; - constructor(uint newI, uint newK) public { + constructor(uint newI, uint newK) { i = newI; k = newK; } } contract D is C { - constructor(uint newI, uint newK) C(newI, newK + 1) public {} + constructor(uint newI, uint newK) C(newI, newK + 1) {} } // ==== // compileViaYul: also diff --git a/test/libsolidity/semanticTests/constructor_with_params_inheritance_2.sol b/test/libsolidity/semanticTests/constructor_with_params_inheritance_2.sol index f2c39e75edca..e009697269ce 100644 --- a/test/libsolidity/semanticTests/constructor_with_params_inheritance_2.sol +++ b/test/libsolidity/semanticTests/constructor_with_params_inheritance_2.sol @@ -2,7 +2,7 @@ contract C { uint public i; uint public k; - constructor(uint newI, uint newK) public { + constructor(uint newI, uint newK) { i = newI; k = newK; } diff --git a/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol b/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol index fd4c96ce7658..9d5492d1e945 100644 --- a/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol +++ b/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol @@ -1,7 +1,7 @@ contract test { enum ActionChoices {GoLeft, GoRight, GoStraight} - constructor() public {} + constructor() {} function getChoiceExp(uint256 x) public returns (uint256 d) { choice = ActionChoices(x); diff --git a/test/libsolidity/semanticTests/enums/using_enums.sol b/test/libsolidity/semanticTests/enums/using_enums.sol index 883726f7c24d..b903e51827e8 100644 --- a/test/libsolidity/semanticTests/enums/using_enums.sol +++ b/test/libsolidity/semanticTests/enums/using_enums.sol @@ -1,7 +1,7 @@ contract test { enum ActionChoices {GoLeft, GoRight, GoStraight, Sit} - constructor() public { + constructor() { choices = ActionChoices.GoStraight; } diff --git a/test/libsolidity/semanticTests/functionCall/creation_function_call_no_args.sol b/test/libsolidity/semanticTests/functionCall/creation_function_call_no_args.sol index eac910f05411..f60827738dda 100644 --- a/test/libsolidity/semanticTests/functionCall/creation_function_call_no_args.sol +++ b/test/libsolidity/semanticTests/functionCall/creation_function_call_no_args.sol @@ -1,6 +1,6 @@ contract C { uint public i; - constructor() public { + constructor() { i = 2; } } diff --git a/test/libsolidity/semanticTests/functionCall/creation_function_call_with_args.sol b/test/libsolidity/semanticTests/functionCall/creation_function_call_with_args.sol index 32c2910e277b..56e458110da9 100644 --- a/test/libsolidity/semanticTests/functionCall/creation_function_call_with_args.sol +++ b/test/libsolidity/semanticTests/functionCall/creation_function_call_with_args.sol @@ -1,12 +1,12 @@ contract C { uint public i; - constructor(uint newI) public { + constructor(uint newI) { i = newI; } } contract D { C c; - constructor(uint v) public { + constructor(uint v) { c = new C(v); } function f() public returns (uint r) { diff --git a/test/libsolidity/semanticTests/functionCall/creation_function_call_with_salt.sol b/test/libsolidity/semanticTests/functionCall/creation_function_call_with_salt.sol index 3bb9765a9f46..725a54b54744 100644 --- a/test/libsolidity/semanticTests/functionCall/creation_function_call_with_salt.sol +++ b/test/libsolidity/semanticTests/functionCall/creation_function_call_with_salt.sol @@ -1,12 +1,12 @@ contract C { uint public i; - constructor(uint newI) public { + constructor(uint newI) { i = newI; } } contract D { C c; - constructor(uint v) public { + constructor(uint v) { c = new C{salt: "abc"}(v); } function f() public returns (uint r) { diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol index b9a56935f487..5ca46b4e1955 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol @@ -18,7 +18,7 @@ contract helper { contract test { helper h; - constructor() public payable { + constructor() payable { h = new helper(); } diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol index 46c922a9cbf1..3da540807cd3 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol @@ -15,7 +15,7 @@ contract helper { } contract test { helper h; - constructor() public payable { + constructor() payable { h = new helper(); } diff --git a/test/libsolidity/semanticTests/functionCall/member_accessors.sol b/test/libsolidity/semanticTests/functionCall/member_accessors.sol index 238d99a61380..d7b2b3284160 100644 --- a/test/libsolidity/semanticTests/functionCall/member_accessors.sol +++ b/test/libsolidity/semanticTests/functionCall/member_accessors.sol @@ -3,7 +3,7 @@ contract test { bytes6 public name; bytes32 public a_hash; address public an_address; - constructor() public { + constructor() { data = 8; name = "Celina"; a_hash = keccak256("\x7b"); diff --git a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol index 07f6ff51d743..bb1b28b3ede1 100644 --- a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol +++ b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol @@ -6,7 +6,7 @@ contract Receiver { contract Main { - constructor() public payable {} + constructor() payable {} function s() public returns (bool) { Receiver r = new Receiver(); diff --git a/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol b/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol index ac802ee9e5da..353844723c23 100644 --- a/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol +++ b/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol @@ -15,7 +15,7 @@ contract Flow { success = true; } - constructor() public { + constructor() { stages[msg.sender] = stage0; } diff --git a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol index d829c1554263..dc0731485985 100644 --- a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol +++ b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol @@ -1,7 +1,7 @@ contract C { uint256 public initial; - constructor() public { + constructor() { initial = double(2); } diff --git a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol index f8230b21aff4..a778589abff0 100644 --- a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol +++ b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol @@ -1,7 +1,7 @@ contract C { function(uint256) returns (uint256) internal x; - constructor() public { + constructor() { x = double; } diff --git a/test/libsolidity/semanticTests/getters/array_mapping_struct.sol b/test/libsolidity/semanticTests/getters/array_mapping_struct.sol index 534dcd8a6970..d824897e8326 100644 --- a/test/libsolidity/semanticTests/getters/array_mapping_struct.sol +++ b/test/libsolidity/semanticTests/getters/array_mapping_struct.sol @@ -5,7 +5,7 @@ contract C { } mapping(uint256 => Y)[] public m; mapping(uint256 => Y)[3] public n; - constructor() public { + constructor() { m.push(); m.push(); m[1][0].a = 1; diff --git a/test/libsolidity/semanticTests/getters/arrays.sol b/test/libsolidity/semanticTests/getters/arrays.sol index 2a8641a9b6a7..184d6ce7ff18 100644 --- a/test/libsolidity/semanticTests/getters/arrays.sol +++ b/test/libsolidity/semanticTests/getters/arrays.sol @@ -1,6 +1,6 @@ contract C { uint8[][2] public a; - constructor() public { + constructor() { a[1].push(3); a[1].push(4); } diff --git a/test/libsolidity/semanticTests/getters/mapping.sol b/test/libsolidity/semanticTests/getters/mapping.sol index 5b28a0f06929..194e44792b35 100644 --- a/test/libsolidity/semanticTests/getters/mapping.sol +++ b/test/libsolidity/semanticTests/getters/mapping.sol @@ -1,6 +1,6 @@ contract C { mapping(uint => mapping(uint => uint)) public x; - constructor() public { + constructor() { x[1][2] = 3; } } diff --git a/test/libsolidity/semanticTests/getters/mapping_array_struct.sol b/test/libsolidity/semanticTests/getters/mapping_array_struct.sol index 2b237c4df9a0..60683dfc0a0f 100644 --- a/test/libsolidity/semanticTests/getters/mapping_array_struct.sol +++ b/test/libsolidity/semanticTests/getters/mapping_array_struct.sol @@ -5,7 +5,7 @@ contract C { } mapping(uint256 => Y[]) public m; mapping(uint256 => Y[3]) public n; - constructor() public { + constructor() { m[1].push().a = 1; m[1][0].b = 2; m[1].push().a = 3; diff --git a/test/libsolidity/semanticTests/getters/mapping_of_string.sol b/test/libsolidity/semanticTests/getters/mapping_of_string.sol index ea0a8b8f8a54..319f0a655f66 100644 --- a/test/libsolidity/semanticTests/getters/mapping_of_string.sol +++ b/test/libsolidity/semanticTests/getters/mapping_of_string.sol @@ -1,6 +1,6 @@ contract C { mapping(string => uint8[3]) public x; - constructor() public { + constructor() { x["abc"][0] = 1; x["abc"][2] = 3; x["abc"][1] = 2; diff --git a/test/libsolidity/semanticTests/getters/mapping_to_struct.sol b/test/libsolidity/semanticTests/getters/mapping_to_struct.sol index fed9f6ec5e0e..c2d70a35a495 100644 --- a/test/libsolidity/semanticTests/getters/mapping_to_struct.sol +++ b/test/libsolidity/semanticTests/getters/mapping_to_struct.sol @@ -6,7 +6,7 @@ contract C { uint d; } mapping(uint => mapping(uint => S)) public x; - constructor() public { + constructor() { x[1][2].a = 3; x[1][2].b = 4; x[1][2].c = 5; diff --git a/test/libsolidity/semanticTests/getters/small_types.sol b/test/libsolidity/semanticTests/getters/small_types.sol index d970f9138a7b..a26eba785ba3 100644 --- a/test/libsolidity/semanticTests/getters/small_types.sol +++ b/test/libsolidity/semanticTests/getters/small_types.sol @@ -3,7 +3,7 @@ contract C { uint16 public b; uint128 public c; uint public d; - constructor() public { + constructor() { a = 3; b = 4; c = 5; diff --git a/test/libsolidity/semanticTests/getters/struct_with_bytes.sol b/test/libsolidity/semanticTests/getters/struct_with_bytes.sol index 2bbd7e8b823e..477a1297fba0 100644 --- a/test/libsolidity/semanticTests/getters/struct_with_bytes.sol +++ b/test/libsolidity/semanticTests/getters/struct_with_bytes.sol @@ -7,7 +7,7 @@ contract C { } uint shifter; S public s; - constructor() public { + constructor() { s.a = 7; s.b = "abc"; s.c[0] = 9; diff --git a/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol b/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol index 974ca9e809c7..281b29c871d6 100644 --- a/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol +++ b/test/libsolidity/semanticTests/getters/struct_with_bytes_simple.sol @@ -7,7 +7,7 @@ contract C { } uint shifter; S public s; - constructor() public { + constructor() { s.a = 7; s.b = "abc"; s.c[0] = 9; diff --git a/test/libsolidity/semanticTests/immutable/getter_call_in_constructor.sol b/test/libsolidity/semanticTests/immutable/getter_call_in_constructor.sol index e4aa474f2b05..2ef12c04aa95 100644 --- a/test/libsolidity/semanticTests/immutable/getter_call_in_constructor.sol +++ b/test/libsolidity/semanticTests/immutable/getter_call_in_constructor.sol @@ -1,7 +1,7 @@ contract A { uint immutable public x = 1; uint public y; - constructor() public { + constructor() { y = this.x(); } } diff --git a/test/libsolidity/semanticTests/immutable/inheritance.sol b/test/libsolidity/semanticTests/immutable/inheritance.sol index bca0ee8895cd..0e131535eb28 100644 --- a/test/libsolidity/semanticTests/immutable/inheritance.sol +++ b/test/libsolidity/semanticTests/immutable/inheritance.sol @@ -1,25 +1,25 @@ contract A { uint8 immutable a; - constructor() public { + constructor() { a = 4; } } contract B is A { uint8 immutable b; - constructor() public { + constructor() { b = 3; } } contract C is A { uint8 immutable c; - constructor() public { + constructor() { c = 2; } } contract D is B, C { uint8 immutable d; - constructor() public { + constructor() { d = 1; } function f() public view returns (uint256, uint256, uint, uint) { diff --git a/test/libsolidity/semanticTests/immutable/internal_function_pointer.sol b/test/libsolidity/semanticTests/immutable/internal_function_pointer.sol index 0119a90a2e22..f046395d2b91 100644 --- a/test/libsolidity/semanticTests/immutable/internal_function_pointer.sol +++ b/test/libsolidity/semanticTests/immutable/internal_function_pointer.sol @@ -1,6 +1,6 @@ contract C { function() internal view returns(uint256) immutable z; - constructor() public { + constructor() { z = f; } function f() public view returns (uint256) { diff --git a/test/libsolidity/semanticTests/immutable/multi_creation.sol b/test/libsolidity/semanticTests/immutable/multi_creation.sol index 970ea9155aa8..33820b18b953 100644 --- a/test/libsolidity/semanticTests/immutable/multi_creation.sol +++ b/test/libsolidity/semanticTests/immutable/multi_creation.sol @@ -1,13 +1,13 @@ contract A { uint immutable a; - constructor() public { + constructor() { a = 7; } function f() public view returns (uint) { return a; } } contract B { uint immutable a; - constructor() public { + constructor() { a = 5; } function f() public view returns (uint) { return a; } @@ -16,7 +16,7 @@ contract C { uint immutable a; uint public x; uint public y; - constructor() public { + constructor() { a = 3; x = (new A()).f(); y = (new B()).f(); diff --git a/test/libsolidity/semanticTests/immutable/stub.sol b/test/libsolidity/semanticTests/immutable/stub.sol index a800ab90407a..eda441c7550a 100644 --- a/test/libsolidity/semanticTests/immutable/stub.sol +++ b/test/libsolidity/semanticTests/immutable/stub.sol @@ -1,7 +1,7 @@ contract C { uint256 immutable x; uint256 immutable y; - constructor() public { + constructor() { x = 42; y = 23; } diff --git a/test/libsolidity/semanticTests/immutable/use_scratch.sol b/test/libsolidity/semanticTests/immutable/use_scratch.sol index 442ef56360c4..71381fc9b4ba 100644 --- a/test/libsolidity/semanticTests/immutable/use_scratch.sol +++ b/test/libsolidity/semanticTests/immutable/use_scratch.sol @@ -2,7 +2,7 @@ contract C { uint256 immutable x; uint256 immutable y; mapping(uint => uint) public m; - constructor(uint _a) public { + constructor(uint _a) { x = 42; y = 23; m[_a] = 7; diff --git a/test/libsolidity/semanticTests/interfaceID/lisa.sol b/test/libsolidity/semanticTests/interfaceID/lisa.sol index ea844dd819b9..885cf9b2463c 100644 --- a/test/libsolidity/semanticTests/interfaceID/lisa.sol +++ b/test/libsolidity/semanticTests/interfaceID/lisa.sol @@ -8,11 +8,11 @@ interface ERC165 { function supportsInterface(bytes4 interfaceID) external view returns (bool); } -contract ERC165MappingImplementation is ERC165 { +abstract contract ERC165MappingImplementation is ERC165 { /// @dev You must not set element 0xffffffff to true mapping(bytes4 => bool) internal supportedInterfaces; - constructor() internal { + constructor() { supportedInterfaces[this.supportsInterface.selector] = true; } @@ -27,7 +27,7 @@ interface Simpson { } contract Lisa is ERC165MappingImplementation, Simpson { - constructor() public { + constructor() { supportedInterfaces[this.is2D.selector ^ this.skinColor.selector] = true; } diff --git a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol index 96f1a4742f53..c535df5285aa 100644 --- a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol +++ b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol @@ -8,11 +8,11 @@ interface ERC165 { function supportsInterface(bytes4 interfaceID) external view returns (bool); } -contract ERC165MappingImplementation is ERC165 { +abstract contract ERC165MappingImplementation is ERC165 { /// @dev You must not set element 0xffffffff to true mapping(bytes4 => bool) internal supportedInterfaces; - constructor() internal { + constructor() { supportedInterfaces[this.supportsInterface.selector] = true; } @@ -27,7 +27,7 @@ interface Simpson { } contract Lisa is ERC165MappingImplementation, Simpson { - constructor() public { + constructor() { supportedInterfaces[type(Simpson).interfaceId] = true; } diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol index 98922c389da9..e564c560c687 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol @@ -1,5 +1,5 @@ contract Base { - constructor(uint256 i) public { + constructor(uint256 i) { m_i = i; } @@ -8,7 +8,7 @@ contract Base { contract Derived is Base { - constructor(uint256 i) public Base(i) {} + constructor(uint256 i) Base(i) {} } diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol index cab918567e69..0ae3e1ce49af 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol @@ -1,5 +1,5 @@ contract Base { - constructor(uint256 j) public { + constructor(uint256 j) { m_i = j; } @@ -8,12 +8,12 @@ contract Base { contract Base1 is Base { - constructor(uint256 k) public Base(k) {} + constructor(uint256 k) Base(k) {} } contract Derived is Base, Base1 { - constructor(uint256 i) public Base1(i) {} + constructor(uint256 i) Base1(i) {} } diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol index ab7bada38669..def99634453b 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol @@ -1,5 +1,5 @@ contract Base { - constructor(uint256 i) public { + constructor(uint256 i) { m_i = i; } @@ -8,12 +8,12 @@ contract Base { abstract contract Base1 is Base { - constructor(uint256 k) public {} + constructor(uint256 k) {} } contract Derived is Base, Base1 { - constructor(uint256 i) public Base(i) Base1(7) {} + constructor(uint256 i) Base(i) Base1(7) {} } diff --git a/test/libsolidity/semanticTests/intheritance/super_in_constructor.sol b/test/libsolidity/semanticTests/intheritance/super_in_constructor.sol index 33e270c9ea1b..5be2158a258a 100644 --- a/test/libsolidity/semanticTests/intheritance/super_in_constructor.sol +++ b/test/libsolidity/semanticTests/intheritance/super_in_constructor.sol @@ -22,7 +22,7 @@ contract C is A { contract D is B, C { uint256 data; - constructor() public { + constructor() { data = super.f() | 8; } diff --git a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol index 51cee33b0767..057b3b8e451e 100644 --- a/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol +++ b/test/libsolidity/semanticTests/intheritance/value_for_constructor.sol @@ -2,7 +2,7 @@ contract Helper { bytes3 name; bool flag; - constructor(bytes3 x, bool f) public payable { + constructor(bytes3 x, bool f) payable { name = x; flag = f; } @@ -20,7 +20,7 @@ contract Helper { contract Main { Helper h; - constructor() public payable { + constructor() payable { h = (new Helper){value: 10}("abc", true); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol index 902ca66c165c..94e2cb45c61d 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol @@ -6,7 +6,7 @@ library L { contract C { uint256[] y; string x; - constructor() public { y.push(42); } + constructor() { y.push(42); } function f() public view returns (uint256) { return L.f(y); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol index b9254c811dad..827fbb9864a2 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol @@ -6,7 +6,7 @@ library L { contract C { uint256[] y; string x; - constructor() public { y.push(42); } + constructor() { y.push(42); } function f() public view returns (uint256) { return L.f(y); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol index 450f74f1dd10..6f09b84781c1 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol @@ -5,7 +5,7 @@ library L { } contract C { uint256[] y; - constructor() public { y.push(42); } + constructor() { y.push(42); } function f() public view returns (uint256) { return L.f(y); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_staticcall.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_staticcall.sol index dc394f7fae64..d8cdb9a4d463 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_staticcall.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_staticcall.sol @@ -1,6 +1,6 @@ contract D { uint public x; - constructor() public { x = 42; } + constructor() { x = 42; } } library L { function f(D d) public view returns (uint256) { @@ -9,7 +9,7 @@ library L { } contract C { D d; - constructor() public { d = new D(); } + constructor() { d = new D(); } function f() public view returns (uint256) { return L.f(d); } diff --git a/test/libsolidity/semanticTests/libraries/library_function_selectors.sol b/test/libsolidity/semanticTests/libraries/library_function_selectors.sol index 305ccf39bac5..185c34492206 100644 --- a/test/libsolidity/semanticTests/libraries/library_function_selectors.sol +++ b/test/libsolidity/semanticTests/libraries/library_function_selectors.sol @@ -5,7 +5,7 @@ library L { } contract C { uint256[] s; - constructor() public { while (s.length < 42) s.push(0); } + constructor() { while (s.length < 42) s.push(0); } function f() public returns (bool, bool, uint256) { (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.f.selector, 7)); return (L.f.selector == bytes4(keccak256("f(uint256)")), success, abi.decode(data, (uint256))); diff --git a/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol b/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol index f0c71dec704a..ea3bfb682047 100644 --- a/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol +++ b/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol @@ -6,7 +6,7 @@ library L { } contract C { L.S s; - constructor() public { s.a = 42; } + constructor() { s.a = 42; } function f() public returns (bool, bool, uint256) { uint256 s_ptr; diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol index f4a73ebebc8a..ebe8d60868ec 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol @@ -1,7 +1,7 @@ contract A { uint256 data; - constructor() public mod1 { + constructor() mod1 { f1(); } diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol index ac99b0cf74f8..c05f7e202495 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol @@ -1,7 +1,7 @@ contract A { uint256 data; - constructor() public mod1 { + constructor() mod1 { data |= 2; } diff --git a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol index 4e62acc5ed5a..16383f8b953e 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol @@ -4,7 +4,7 @@ contract B function getBalance() public view returns (uint) { return address(this).balance * 1000 + x; } - constructor(uint _x) public payable { + constructor(uint _x) payable { x = _x; } } diff --git a/test/libsolidity/semanticTests/smoke/constructor.sol b/test/libsolidity/semanticTests/smoke/constructor.sol index 27e26f1ebc66..9cf4350871a5 100644 --- a/test/libsolidity/semanticTests/smoke/constructor.sol +++ b/test/libsolidity/semanticTests/smoke/constructor.sol @@ -1,6 +1,6 @@ contract C { uint public state = 0; - constructor(uint _state) public payable { + constructor(uint _state) payable { state = _state; } function balance() public payable returns (uint256) { diff --git a/test/libsolidity/semanticTests/state_var_initialization.sol b/test/libsolidity/semanticTests/state_var_initialization.sol index ba97a9441c50..5da329fa41fe 100644 --- a/test/libsolidity/semanticTests/state_var_initialization.sol +++ b/test/libsolidity/semanticTests/state_var_initialization.sol @@ -2,7 +2,7 @@ contract C { uint public i = 1; uint public k = 2; - constructor() public { + constructor() { i = i + i; k = k - i; } diff --git a/test/libsolidity/semanticTests/state_variables_init_order_2.sol b/test/libsolidity/semanticTests/state_variables_init_order_2.sol index 9bdf9c70cfff..67e38da6ba15 100644 --- a/test/libsolidity/semanticTests/state_variables_init_order_2.sol +++ b/test/libsolidity/semanticTests/state_variables_init_order_2.sol @@ -8,7 +8,7 @@ contract A { } contract B is A { uint public z; - constructor() public { + constructor() { z = x; } } diff --git a/test/libsolidity/semanticTests/state_variables_init_order_3.sol b/test/libsolidity/semanticTests/state_variables_init_order_3.sol index 81a5a693d4cb..0a0aad59b8f1 100644 --- a/test/libsolidity/semanticTests/state_variables_init_order_3.sol +++ b/test/libsolidity/semanticTests/state_variables_init_order_3.sol @@ -2,7 +2,7 @@ contract A { uint public a = 42; uint public b; uint public c; - constructor(uint x) public { + constructor(uint x) { b = a; a = x; } @@ -14,7 +14,7 @@ contract B is A { uint public b_a; uint public b_b; uint public b_c; - constructor() public A(17) { b_a = a; b_b = b; b_c = c; } + constructor() A(17) { b_a = a; b_b = b; b_c = c; } } // ==== // compileViaYul: true diff --git a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol index 01460a1c86b1..2a478f35f58f 100644 --- a/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol +++ b/test/libsolidity/semanticTests/storage/accessors_mapping_for_array.sol @@ -1,7 +1,7 @@ contract test { mapping(uint => uint[8]) public data; mapping(uint => uint[]) public dynamicData; - constructor() public { + constructor() { data[2][2] = 8; for (uint i = 0; i < 3; i++) dynamicData[2].push(); diff --git a/test/libsolidity/semanticTests/storage/array_accessor.sol b/test/libsolidity/semanticTests/storage/array_accessor.sol index eb4d3ce369f5..599931a372c7 100644 --- a/test/libsolidity/semanticTests/storage/array_accessor.sol +++ b/test/libsolidity/semanticTests/storage/array_accessor.sol @@ -5,7 +5,7 @@ contract test { struct st { uint a; uint[] finalArray; } mapping(uint256 => mapping(uint256 => st[5])) public multiple_map; - constructor() public { + constructor() { data[0] = 8; dynamicData.push(); diff --git a/test/libsolidity/semanticTests/storage/complex_accessors.sol b/test/libsolidity/semanticTests/storage/complex_accessors.sol index 9b3fa7a3c16d..d1087f800bf5 100644 --- a/test/libsolidity/semanticTests/storage/complex_accessors.sol +++ b/test/libsolidity/semanticTests/storage/complex_accessors.sol @@ -3,7 +3,7 @@ contract test { mapping(uint256 => bool) public to_bool_map; mapping(uint256 => uint256) public to_uint_map; mapping(uint256 => mapping(uint256 => uint256)) public to_multiple_map; - constructor() public { + constructor() { to_string_map[42] = "24"; to_bool_map[42] = false; to_uint_map[42] = 12; diff --git a/test/libsolidity/semanticTests/storage/simple_accessor.sol b/test/libsolidity/semanticTests/storage/simple_accessor.sol index aacfb93a06b8..70e8a331f3f8 100644 --- a/test/libsolidity/semanticTests/storage/simple_accessor.sol +++ b/test/libsolidity/semanticTests/storage/simple_accessor.sol @@ -1,6 +1,6 @@ contract test { uint256 public data; - constructor() public { + constructor() { data = 8; } } diff --git a/test/libsolidity/semanticTests/storage/struct_accessor.sol b/test/libsolidity/semanticTests/storage/struct_accessor.sol index de57d4697116..ea030de1a64c 100644 --- a/test/libsolidity/semanticTests/storage/struct_accessor.sol +++ b/test/libsolidity/semanticTests/storage/struct_accessor.sol @@ -1,7 +1,7 @@ contract test { struct Data { uint a; uint8 b; mapping(uint => uint) c; bool d; } mapping(uint => Data) public data; - constructor() public { + constructor() { data[7].a = 1; data[7].b = 2; data[7].c[0] = 3; diff --git a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol index fc0748b7f95a..89138b60b9f2 100644 --- a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol +++ b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol @@ -6,7 +6,7 @@ contract CopyTest { Tree storageTree; Tree[] children; - constructor() public { + constructor() { for (uint i = 0; i < 2; i++) storageTree.children.push(); for (uint i = 0; i < 23; i++) diff --git a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory_complex.sol b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory_complex.sol index e8a08e5136ce..d14bff96961f 100644 --- a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory_complex.sol +++ b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory_complex.sol @@ -6,7 +6,7 @@ contract CopyTest { Tree storageTree; Tree childStorageTree; - constructor() public { + constructor() { storageTree.data = 0x42; for (uint i = 0; i < 2; i++) storageTree.children.push(childStorageTree); diff --git a/test/libsolidity/semanticTests/structs/delete_struct.sol b/test/libsolidity/semanticTests/structs/delete_struct.sol index 7f57ce63a057..48de502c720d 100644 --- a/test/libsolidity/semanticTests/structs/delete_struct.sol +++ b/test/libsolidity/semanticTests/structs/delete_struct.sol @@ -10,7 +10,7 @@ contract test { uint nestedValue; mapping (uint => bool) nestedMapping; } - constructor() public { + constructor() { toDelete = 5; str.topValue = 1; str.topMapping[0] = 1; diff --git a/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol b/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol index 8591131be896..ca6dffb9d5e1 100644 --- a/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol +++ b/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol @@ -6,7 +6,7 @@ contract test { testStruct data2; testStruct data3; - constructor() public { + constructor() { data1.m_value = 2; } diff --git a/test/libsolidity/semanticTests/structs/struct_constructor_nested.sol b/test/libsolidity/semanticTests/structs/struct_constructor_nested.sol index dbd67ab586c0..7ce22e45aa6d 100644 --- a/test/libsolidity/semanticTests/structs/struct_constructor_nested.sol +++ b/test/libsolidity/semanticTests/structs/struct_constructor_nested.sol @@ -10,7 +10,7 @@ contract C { } S s; - constructor() public { + constructor() { uint256[3] memory s2; s2[1] = 9; s = S(1, s2, X(4, 5)); diff --git a/test/libsolidity/semanticTests/structs/struct_delete_member.sol b/test/libsolidity/semanticTests/structs/struct_delete_member.sol index fbaf7b6d9e8f..2b3f41402909 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_member.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_member.sol @@ -4,7 +4,7 @@ contract test { } testStruct data1; - constructor() public { + constructor() { data1.m_value = 2; } diff --git a/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol b/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol index 59d79da9fa3a..b5c8a2cfa622 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol @@ -4,7 +4,7 @@ contract test { } mapping(uint256 => testStruct) campaigns; - constructor() public { + constructor() { campaigns[0].m_value = 2; } diff --git a/test/libsolidity/semanticTests/structs/struct_named_constructor.sol b/test/libsolidity/semanticTests/structs/struct_named_constructor.sol index 5368b090ea86..f74cc90bd17a 100644 --- a/test/libsolidity/semanticTests/structs/struct_named_constructor.sol +++ b/test/libsolidity/semanticTests/structs/struct_named_constructor.sol @@ -5,7 +5,7 @@ contract C { } S public s; - constructor() public { + constructor() { s = S({a: 1, x: true}); } } diff --git a/test/libsolidity/semanticTests/tryCatch/create.sol b/test/libsolidity/semanticTests/tryCatch/create.sol index e80f1944a2a9..ad7f734c750a 100644 --- a/test/libsolidity/semanticTests/tryCatch/create.sol +++ b/test/libsolidity/semanticTests/tryCatch/create.sol @@ -1,8 +1,8 @@ contract Reverts { - constructor(uint) public { revert("test message."); } + constructor(uint) { revert("test message."); } } contract Succeeds { - constructor(uint) public { } + constructor(uint) { } } contract C { diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol index 26c02f3e37d7..15ebeca438ce 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol @@ -4,7 +4,7 @@ contract C { bool flag; - constructor() public { + constructor() { if (!flag) { flag = true; function() internal invalid; diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol index 710348a1ad36..323e47f8bd52 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol @@ -4,7 +4,7 @@ contract C { bool flag; - constructor() public { + constructor() { if (!flag) { flag = true; function() internal invalid; diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol index 8351565679ee..a9ffff0b6b79 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol @@ -5,7 +5,7 @@ contract InvalidTest { function() internal storedFn; uint public x; - constructor() public { + constructor() { uint _y1; uint _y2; uint _y3; diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol index 8a11832c8c9f..df28ca1cca1a 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol @@ -4,7 +4,7 @@ contract InvalidTest { bool flag; - constructor() public { + constructor() { function() internal invalid; storedFn = invalid; } diff --git a/test/libsolidity/semanticTests/various/balance.sol b/test/libsolidity/semanticTests/various/balance.sol index d6a80dbf9bff..99fdf4da7493 100644 --- a/test/libsolidity/semanticTests/various/balance.sol +++ b/test/libsolidity/semanticTests/various/balance.sol @@ -1,5 +1,5 @@ contract test { - constructor() public payable {} + constructor() payable {} function getBalance() public returns (uint256 balance) { return address(this).balance; diff --git a/test/libsolidity/semanticTests/various/code_access_content.sol b/test/libsolidity/semanticTests/various/code_access_content.sol index 2c115d6c8dae..10ceec3a463e 100644 --- a/test/libsolidity/semanticTests/various/code_access_content.sol +++ b/test/libsolidity/semanticTests/various/code_access_content.sol @@ -1,7 +1,7 @@ contract D { bytes32 public x; - constructor() public { + constructor() { bytes32 codeHash; assembly { let size := codesize() diff --git a/test/libsolidity/semanticTests/various/code_access_create.sol b/test/libsolidity/semanticTests/various/code_access_create.sol index 9029e59ec8b6..9b8b3175ed65 100644 --- a/test/libsolidity/semanticTests/various/code_access_create.sol +++ b/test/libsolidity/semanticTests/various/code_access_create.sol @@ -1,7 +1,7 @@ contract D { uint256 x; - constructor() public { + constructor() { x = 7; } diff --git a/test/libsolidity/semanticTests/various/code_access_runtime.sol b/test/libsolidity/semanticTests/various/code_access_runtime.sol index cc1401c6f1bc..67c2ce90b9b3 100644 --- a/test/libsolidity/semanticTests/various/code_access_runtime.sol +++ b/test/libsolidity/semanticTests/various/code_access_runtime.sol @@ -1,7 +1,7 @@ contract D { uint256 x; - constructor() public { + constructor() { x = 7; } diff --git a/test/libsolidity/semanticTests/various/external_types_in_calls.sol b/test/libsolidity/semanticTests/various/external_types_in_calls.sol index 0e65511c16b2..1b3ab196a204 100644 --- a/test/libsolidity/semanticTests/various/external_types_in_calls.sol +++ b/test/libsolidity/semanticTests/various/external_types_in_calls.sol @@ -1,7 +1,7 @@ contract C1 { C1 public bla; - constructor(C1 x) public { + constructor(C1 x) { bla = x; } } diff --git a/test/libsolidity/semanticTests/various/inline_member_init.sol b/test/libsolidity/semanticTests/various/inline_member_init.sol index cac10c786891..15ad78fe14ab 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init.sol @@ -1,5 +1,5 @@ contract test { - constructor() public { + constructor() { m_b = 6; m_c = 8; } diff --git a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol index 7ee1028c9707..00ea47451f6e 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol @@ -1,5 +1,5 @@ contract Base { - constructor() public {} + constructor() {} uint256 m_base = 5; @@ -10,7 +10,7 @@ contract Base { contract Derived is Base { - constructor() public {} + constructor() {} uint256 m_derived = 6; diff --git a/test/libsolidity/semanticTests/various/senders_balance.sol b/test/libsolidity/semanticTests/various/senders_balance.sol index 7da77aab2af6..08b83401c0c8 100644 --- a/test/libsolidity/semanticTests/various/senders_balance.sol +++ b/test/libsolidity/semanticTests/various/senders_balance.sol @@ -8,7 +8,7 @@ contract C { contract D { C c = new C(); - constructor() public payable {} + constructor() payable {} function f() public view returns (uint256) { return c.f(); diff --git a/test/libsolidity/semanticTests/various/value_complex.sol b/test/libsolidity/semanticTests/various/value_complex.sol index 64460d397263..8d091ec9829f 100644 --- a/test/libsolidity/semanticTests/various/value_complex.sol +++ b/test/libsolidity/semanticTests/various/value_complex.sol @@ -8,7 +8,7 @@ contract helper { contract test { helper h; - constructor() public payable { + constructor() payable { h = new helper(); } diff --git a/test/libsolidity/semanticTests/various/value_insane.sol b/test/libsolidity/semanticTests/various/value_insane.sol index a588fad54496..c81570626c74 100644 --- a/test/libsolidity/semanticTests/various/value_insane.sol +++ b/test/libsolidity/semanticTests/various/value_insane.sol @@ -8,7 +8,7 @@ contract helper { contract test { helper h; - constructor() public payable { + constructor() payable { h = new helper(); } diff --git a/test/libsolidity/semanticTests/viaYul/erc20.sol b/test/libsolidity/semanticTests/viaYul/erc20.sol index 2ba09521cd7e..9a49a053bb22 100644 --- a/test/libsolidity/semanticTests/viaYul/erc20.sol +++ b/test/libsolidity/semanticTests/viaYul/erc20.sol @@ -8,7 +8,7 @@ contract ERC20 { mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; - constructor() public { + constructor() { _mint(msg.sender, 20); } diff --git a/test/libsolidity/semanticTests/viaYul/struct_member_access.sol b/test/libsolidity/semanticTests/viaYul/struct_member_access.sol index 60733d414033..957226195fb3 100644 --- a/test/libsolidity/semanticTests/viaYul/struct_member_access.sol +++ b/test/libsolidity/semanticTests/viaYul/struct_member_access.sol @@ -8,7 +8,7 @@ contract C { } S s; - constructor() public { + constructor() { s.a = 42; s.b.push(1); s.b.push(2); diff --git a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol index e66b8ad4f6f1..71ee82fd3639 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol @@ -1,7 +1,7 @@ contract BaseBase { uint256 m_a; - constructor(uint256 a) public { + constructor(uint256 a) { m_a = a; } diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol index 4842ee56f74d..c462713df845 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_safe.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C { uint[] a; - constructor() public { + constructor() { a.push(); a.pop(); } diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol index fc1264ddcd89..d7fc43fc44db 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol @@ -2,9 +2,9 @@ pragma experimental SMTChecker; contract C { uint[] a; - constructor() public { + constructor() { a.pop(); } } // ---- -// Warning 2529: (83-90): Empty array "pop" detected here. +// Warning 2529: (76-83): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol index f563504f4b2d..dac9b10a0b43 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C { uint256[] x; - constructor() public { x.push(42); } + constructor() { x.push(42); } function f() public { x.push(23); assert(x[0] == 42 || x[0] == 23); diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol index 7ed99a69edaf..6b4642bfd3e9 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_1_safe_no_overflow_assumption.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C { uint256[] x; - constructor() public { x.push(42); } + constructor() { x.push(42); } function f() public { x.push(23); assert(x[0] == 42); diff --git a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol index b75ef605ff93..d88e553b7fc3 100644 --- a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol +++ b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol @@ -46,7 +46,7 @@ contract SolidityVar{ address addr_1; address addr_2; - constructor() public{ + constructor(){ addr_1 = msg.sender; } @@ -117,7 +117,7 @@ contract PropagateThroughReturnValue { } } // ---- -// Warning 2018: (1886-1954): Function state mutability can be restricted to view +// Warning 2018: (1879-1947): Function state mutability can be restricted to view // Warning 8115: (318-332): Assertion checker does not yet support the type of this variable. // Warning 8115: (338-347): Assertion checker does not yet support the type of this variable. // Warning 8115: (353-378): Assertion checker does not yet support the type of this variable. diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol index c0e9a7965d91..f98b1fc8e626 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol @@ -10,7 +10,7 @@ contract C { bytes32 sig_2; Crypto d; - constructor() public { + constructor() { owner = msg.sender; } @@ -26,4 +26,4 @@ contract C { } } // ---- -// Warning 4661: (430-452): Assertion violation happens here +// Warning 4661: (423-445): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol index 8aef1f312d14..8e0adad374f3 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol @@ -12,7 +12,7 @@ contract C { bytes32 sig_2; Crypto d; - constructor() public { + constructor() { owner = msg.sender; } @@ -28,4 +28,4 @@ contract C { } } // ---- -// Warning 4661: (438-460): Assertion violation happens here +// Warning 4661: (431-453): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol index 3f6244e1e3fe..2a2e79328bd3 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol @@ -16,7 +16,7 @@ contract C { uint z; State s; - constructor() public { + constructor() { owner = msg.sender; } @@ -34,5 +34,5 @@ contract C { } } // ---- -// Warning 5084: (551-561): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (535-572): Assertion violation happens here +// Warning 5084: (544-554): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (528-565): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol index 2439fc864c90..e862a8e9e8b9 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol @@ -13,7 +13,7 @@ contract C { uint y; State s; - constructor() public { + constructor() { owner = msg.sender; } @@ -29,4 +29,4 @@ contract C { } } // ---- -// Warning 4661: (306-320): Assertion violation happens here +// Warning 4661: (299-313): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol index 9a8f9ed8e50c..46fae86b6af1 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol @@ -22,7 +22,7 @@ contract C { uint y; State s; - constructor() public { + constructor() { owner = msg.sender; } @@ -43,5 +43,5 @@ contract C { } // ---- // Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (459-473): Assertion violation happens here -// Warning 4661: (477-503): Assertion violation happens here +// Warning 4661: (452-466): Assertion violation happens here +// Warning 4661: (470-496): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol index c60b6b05da79..39e9f0749930 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol @@ -14,7 +14,7 @@ contract C { uint y; State s; - constructor() public { + constructor() { owner = msg.sender; } @@ -35,5 +35,5 @@ contract C { } // ---- // Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (388-402): Assertion violation happens here -// Warning 4661: (406-432): Assertion violation happens here +// Warning 4661: (381-395): Assertion violation happens here +// Warning 4661: (399-425): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol index 336d75b97224..5465eb57b67b 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol @@ -16,7 +16,7 @@ contract C { uint z; State s; - constructor() public { + constructor() { owner = msg.sender; } @@ -38,6 +38,6 @@ contract C { } } // ---- -// Warning 4661: (442-468): Assertion violation happens here -// Warning 5084: (617-627): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (601-638): Assertion violation happens here +// Warning 4661: (435-461): Assertion violation happens here +// Warning 5084: (610-620): Type conversion is not yet fully supported and might yield false positives. +// Warning 4661: (594-631): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_base_basic.sol b/test/libsolidity/smtCheckerTests/functions/constructor_base_basic.sol index f1ea2e05375f..155290dcc846 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_base_basic.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_base_basic.sol @@ -2,13 +2,13 @@ pragma experimental SMTChecker; contract A { uint x; - constructor() public { + constructor() { x = 2; } } contract B is A { - constructor() A() public { + constructor() A() { x = 3; } } diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol index 1521f833dcf4..fd7c9663bb0c 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol @@ -1,16 +1,16 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } contract A is C { - constructor() C(2) public { + constructor() C(2) { assert(a == 2); assert(a == 3); } } // ---- -// Warning 4661: (166-180): Assertion violation happens here +// Warning 4661: (152-166): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol index 7efa68b94967..126f5b745bd1 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; -contract C { uint a; constructor(uint x) public { a = x; } } -contract A is C { constructor() C(2) public { assert(a == 2); } } -contract B is C { constructor() C(3) public { assert(a == 3); } } -contract J is C { constructor() C(3) public { assert(a == 4); } } +contract C { uint a; constructor(uint x) { a = x; } } +contract A is C { constructor() C(2) { assert(a == 2); } } +contract B is C { constructor() C(3) { assert(a == 3); } } +contract J is C { constructor() C(3) { assert(a == 4); } } // ---- -// Warning 4661: (271-285): Assertion violation happens here +// Warning 4661: (243-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol index 638b29f5e077..6b59b98297b7 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol @@ -1,24 +1,24 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B is C { - constructor(uint x) public { + constructor(uint x) { a = x; } } contract A is B { - constructor(uint x) B(x) C(x + 2) public { + constructor(uint x) B(x) C(x + 2) { assert(a == x); assert(a == x + 1); } } // ---- -// Warning 2661: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (265-270): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (253-271): Assertion violation happens here +// Warning 2661: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (244-249): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (232-250): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol index aa964a10237c..c2466c0d1eea 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_4.sol @@ -1,23 +1,23 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B is C { - constructor(uint x) public { + constructor(uint x) { a = x; } } contract A is B { - constructor(uint x) C(x + 2) B(x + 1) public { + constructor(uint x) C(x + 2) B(x + 1) { assert(a == x + 1); } } // ---- -// Warning 2661: (221-226): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (212-217): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (251-256): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (207-212): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (198-203): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (230-235): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol index 1427498c407a..1e3166920da0 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol @@ -1,31 +1,31 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B1 is C { - constructor(uint x) public { + constructor(uint x) { a = x; } } contract B2 is C { - constructor(uint x) C(x + 2) public { + constructor(uint x) C(x + 2) { a = x; } } contract A is B2, B1 { - constructor(uint x) B2(x) B1(x) public { + constructor(uint x) B2(x) B1(x) { assert(a == x); assert(a == x + 1); } } // ---- -// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (330-348): Assertion violation happens here +// Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (314-319): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (302-320): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol index 18505a24eb49..0ec12ffac84b 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol @@ -1,31 +1,31 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B1 is C { - constructor(uint x) public { + constructor(uint x) { a = x; } } contract B2 is C { - constructor(uint x) C(x + 2) public { + constructor(uint x) C(x + 2) { a = x; } } contract A is B2, B1 { - constructor(uint x) B1(x) B2(x) public { + constructor(uint x) B1(x) B2(x) { assert(a == x); assert(a == x + 1); } } // ---- -// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (330-348): Assertion violation happens here +// Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (314-319): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (302-320): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol index caa4e67e2740..9f5d6d40254d 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol @@ -1,37 +1,37 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B1 is C { uint b1; - constructor(uint x) public { + constructor(uint x) { b1 = x + a; } } contract B2 is C { uint b2; - constructor(uint x) C(x + 2) public { + constructor(uint x) C(x + 2) { b2 = x + a; } } contract A is B2, B1 { - constructor(uint x) B2(x) B1(x) public { + constructor(uint x) B2(x) B1(x) { assert(b1 == b2); assert(b1 != b2); } } // ---- -// Warning 4144: (174-179): Underflow (resulting value less than 0) happens here -// Warning 2661: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (362-378): Assertion violation happens here +// Warning 4144: (160-165): Underflow (resulting value less than 0) happens here +// Warning 2661: (160-165): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (225-230): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (241-246): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (225-230): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (241-246): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (160-165): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (334-350): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol index b9e6232e2e49..64acae43731f 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract C { uint a; - constructor() public { + constructor() { a = 2; } } @@ -13,11 +13,11 @@ contract B2 is C { } contract A is B, B2 { - constructor(uint x) public { + constructor(uint x) { assert(a == 2); assert(a == 3); } } // ---- -// Warning 5667: (171-177): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (208-222): Assertion violation happens here +// Warning 5667: (164-170): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (194-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle_empty_base.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle_empty_base.sol index 7c35f4fae915..2a196b23f012 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle_empty_base.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle_empty_base.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract C { uint a; - constructor() public { + constructor() { a = 2; } } @@ -10,7 +10,7 @@ contract B is C { } contract B2 is C { - constructor() public { + constructor() { assert(a == 2); } } diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol index 7e4a1a28fa77..6cb0cd8ab4b8 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract F { uint a; - constructor() public { + constructor() { a = 2; } } @@ -12,11 +12,11 @@ contract C is D {} contract B is C {} contract A is B { - constructor(uint x) public { + constructor(uint x) { assert(a == 2); assert(a == 3); } } // ---- -// Warning 5667: (201-207): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (238-252): Assertion violation happens here +// Warning 5667: (194-200): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (224-238): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol index 3e2d932e7e4f..40a67ce2fee1 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract C { uint a; - constructor() public { + constructor() { a = 2; } } @@ -10,11 +10,11 @@ contract B is C { } contract A is B { - constructor(uint x) B() public { + constructor(uint x) B() { assert(a == 2); assert(a == 3); } } // ---- -// Warning 5667: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (186-200): Assertion violation happens here +// Warning 5667: (138-144): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (172-186): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol index ffcc13c99f31..a3891d3bd76a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract C { uint a; - constructor() public { + constructor() { a = 2; } } @@ -10,10 +10,10 @@ contract B is C { } contract A is B { - constructor(uint x) public { + constructor(uint x) { assert(a == 3); } } // ---- -// Warning 5667: (145-151): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (164-178): Assertion violation happens here +// Warning 5667: (138-144): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol index 189297364f07..ae93d962a502 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol @@ -1,30 +1,30 @@ pragma experimental SMTChecker; contract F { uint a; - constructor() public { + constructor() { a = 2; } } contract E is F {} contract D is E { - constructor() public { + constructor() { a = 3; } } contract C is D {} contract B is C { - constructor() public { + constructor() { a = 4; } } contract A is B { - constructor(uint x) public { + constructor(uint x) { assert(a == 4); assert(a == 5); } } // ---- -// Warning 5667: (275-281): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (312-326): Assertion violation happens here +// Warning 5667: (254-260): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (284-298): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_empty_base.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_empty_base.sol index 71cbbd13cb3f..534c0eecb406 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_empty_base.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_empty_base.sol @@ -1,20 +1,20 @@ pragma experimental SMTChecker; contract F { uint a; - constructor() public { + constructor() { a = 2; } } contract E is F {} contract D is E { - constructor() public { + constructor() { a = 3; } } contract C is D {} contract B is C { - constructor() public { + constructor() { assert(a == 3); a = 4; } diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol index 6f3e1e55fe93..b595f795139f 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract F { uint a; - constructor() public { + constructor() { uint f = 2; a = f; } @@ -9,21 +9,21 @@ contract F { contract E is F {} contract D is E { - constructor() public { + constructor() { uint d = 3; a = d; } } contract C is D {} contract B is C { - constructor() public { + constructor() { uint b = 4; a = b; } } contract A is B { - constructor(uint x) public { + constructor(uint x) { uint a1 = 4; uint a2 = 5; assert(a == a1); @@ -31,5 +31,5 @@ contract A is B { } } // ---- -// Warning 5667: (317-323): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (385-400): Assertion violation happens here +// Warning 5667: (296-302): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 4661: (357-372): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol index 179c9bc7b73a..60c3ce9efc6a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol @@ -1,30 +1,30 @@ pragma experimental SMTChecker; contract F { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract E is F {} abstract contract D is E { - constructor() public { + constructor() { a = 3; } } abstract contract C is D {} contract B is C { - constructor(uint x) F(x + 1) public { + constructor(uint x) F(x + 1) { } } contract A is B { - constructor(uint x) B(x) public { + constructor(uint x) B(x) { assert(a == 3); assert(a == 4); } } // ---- -// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (356-370): Assertion violation happens here +// Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (328-342): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol index 6bbc33d1e894..291636786710 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol @@ -1,20 +1,20 @@ pragma experimental SMTChecker; contract F { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract E is F {} abstract contract D is E { - constructor() public { + constructor() { a = 3; } } abstract contract C is D {} contract B is C { - constructor() F(1) public { + constructor() F(1) { assert(a == 3); assert(a == 2); } @@ -23,5 +23,5 @@ contract B is C { contract A is B { } // ---- -// Warning 4661: (287-301): Assertion violation happens here -// Warning 4661: (287-301): Assertion violation happens here +// Warning 4661: (266-280): Assertion violation happens here +// Warning 4661: (266-280): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol index d0aa94920471..6a15e4e93c97 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol @@ -2,16 +2,16 @@ pragma experimental SMTChecker; contract C { uint a; modifier n { _; a = 7; } - constructor(uint x) n public { + constructor(uint x) n { a = x; } } contract A is C { modifier m { a = 5; _; } - constructor() C(2) public { + constructor() C(2) { assert(a == 4); } } // ---- -// Warning 4661: (202-216): Assertion violation happens here +// Warning 4661: (188-202): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol index 572c04aa842b..daa89fe0a869 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol @@ -1,17 +1,17 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } contract A is C { - constructor() C(2) public { + constructor() C(2) { assert(a == 0); assert(C.a == 0); } } // ---- -// Warning 4661: (148-162): Assertion violation happens here -// Warning 4661: (166-182): Assertion violation happens here +// Warning 4661: (134-148): Assertion violation happens here +// Warning 4661: (152-168): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol index 5503f66abf66..cb8e7b560127 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol @@ -3,7 +3,7 @@ pragma experimental SMTChecker; contract C { uint x; - constructor() public { + constructor() { assert(x == 0); x = 10; } @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning 4661: (148-162): Assertion violation happens here +// Warning 4661: (141-155): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol index b238a0c1bc14..f1657cddd1ab 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol @@ -3,7 +3,7 @@ pragma experimental SMTChecker; contract C { uint x = 5; - constructor() public { + constructor() { assert(x == 5); x = 10; } @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning 4661: (152-166): Assertion violation happens here +// Warning 4661: (145-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol index 27b3c8b30571..5b0c2b11a79b 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol @@ -5,7 +5,7 @@ contract B { } contract C is B { - constructor() public { + constructor() { assert(x == 5); x = 10; } @@ -15,4 +15,4 @@ contract C is B { } } // ---- -// Warning 4661: (172-186): Assertion violation happens here +// Warning 4661: (165-179): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol index 80e633f6aa83..19a36a7c0f1a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol @@ -3,15 +3,15 @@ pragma experimental SMTChecker; contract C { uint x = 5; - constructor(uint a, uint b) public { + constructor(uint a, uint b) { assert(x == 5); x = a + b; } - function f(uint y) public view { + function f(uint y) view public { assert(y == x); } } // ---- -// Warning 4661: (169-183): Assertion violation happens here -// Warning 2661: (122-127): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (162-176): Assertion violation happens here +// Warning 2661: (115-120): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_this.sol b/test/libsolidity/smtCheckerTests/functions/constructor_this.sol index 591cd8245469..a72dc095b24a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_this.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_this.sol @@ -1,7 +1,7 @@ pragma experimental SMTChecker; contract C { function f() public pure {} - constructor() public { + constructor() { C c = this; c.f(); // this does not warn now, but should warn in the future this.f(); @@ -9,5 +9,5 @@ contract C { } } // ---- -// Warning 5805: (204-208): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. -// Warning 5805: (223-227): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (197-201): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (216-220): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol index 3ea4f4c467a3..05d965aa3e50 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C{ uint x; - constructor(uint y) public { + constructor(uint y) { assert(x == 0); x = 1; } @@ -21,5 +21,5 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4144: (245-248): Underflow (resulting value less than 0) happens here +// Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (238-241): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol index d433912551b8..f704de56caee 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C{ uint x; - constructor(uint y) public { + constructor(uint y) { assert(x == 1); x = 1; } @@ -21,12 +21,12 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (145-159): Assertion violation happens here -// Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (227-241): Assertion violation happens here -// Warning 4661: (252-266): Assertion violation happens here -// Warning 4661: (177-191): Assertion violation happens here -// Warning 4661: (227-241): Assertion violation happens here -// Warning 4144: (245-248): Underflow (resulting value less than 0) happens here -// Warning 4661: (252-266): Assertion violation happens here -// Warning 4661: (89-103): Assertion violation happens here +// Warning 4661: (138-152): Assertion violation happens here +// Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (220-234): Assertion violation happens here +// Warning 4661: (245-259): Assertion violation happens here +// Warning 4661: (170-184): Assertion violation happens here +// Warning 4661: (220-234): Assertion violation happens here +// Warning 4144: (238-241): Underflow (resulting value less than 0) happens here +// Warning 4661: (245-259): Assertion violation happens here +// Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol index ec3b88ed53fe..067ce603b23c 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol @@ -9,7 +9,7 @@ contract A { } contract C is A { - constructor() public { + constructor() { assert(x == 0); ++x; f(); diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol index 1e239016452e..3fd4a7477b9d 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol @@ -9,7 +9,7 @@ contract A { } contract C is A { - constructor() public { + constructor() { assert(x == 1); ++x; f(); @@ -21,6 +21,6 @@ contract C is A { // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here // Warning 4661: (82-96): Assertion violation happens here // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here -// Warning 4661: (155-169): Assertion violation happens here +// Warning 4661: (148-162): Assertion violation happens here // Warning 4661: (82-96): Assertion violation happens here -// Warning 4661: (187-201): Assertion violation happens here +// Warning 4661: (180-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol index 338a91cd7554..f8ec40ab7500 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C{ uint x; - constructor(uint y) public { + constructor(uint y) { assert(x == 0); x = 1; } @@ -21,7 +21,7 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4144: (241-244): Underflow (resulting value less than 0) happens here +// Warning 2661: (234-237): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4144: (234-237): Underflow (resulting value less than 0) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol index 509bf241d1ec..f3fda1b8a070 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C{ uint x; - constructor(uint y) public { + constructor(uint y) { assert(x == 1); x = 1; } @@ -21,10 +21,10 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (145-159): Assertion violation happens here +// Warning 4661: (138-152): Assertion violation happens here +// Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (191-205): Assertion violation happens here -// Warning 4144: (241-244): Underflow (resulting value less than 0) happens here -// Warning 4661: (89-103): Assertion violation happens here +// Warning 2661: (234-237): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (184-198): Assertion violation happens here +// Warning 4144: (234-237): Underflow (resulting value less than 0) happens here +// Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol index 179c9bc7b73a..60c3ce9efc6a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol @@ -1,30 +1,30 @@ pragma experimental SMTChecker; contract F { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract E is F {} abstract contract D is E { - constructor() public { + constructor() { a = 3; } } abstract contract C is D {} contract B is C { - constructor(uint x) F(x + 1) public { + constructor(uint x) F(x + 1) { } } contract A is B { - constructor(uint x) B(x) public { + constructor(uint x) B(x) { assert(a == 3); assert(a == 4); } } // ---- -// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (356-370): Assertion violation happens here +// Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (328-342): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol index ec6c995e57be..ccb9a93864f0 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol @@ -2,10 +2,10 @@ pragma experimental SMTChecker; contract C { uint x = 2; - constructor () public { + constructor () { assert(x == 2); assert(x == 3); } } // ---- -// Warning 4661: (104-118): Assertion violation happens here +// Warning 4661: (97-111): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol index 8112ddb59e5f..876616fa719a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol @@ -5,10 +5,10 @@ contract C { } contract D is C { - constructor() public { + constructor() { assert(x == 2); assert(x == 3); } } // ---- -// Warning 4661: (124-138): Assertion violation happens here +// Warning 4661: (117-131): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol index c7b42c04377c..fac5f2545400 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol @@ -5,18 +5,18 @@ contract A { } contract B is A { - constructor() public { x = 2; } + constructor() { x = 2; } } contract C is B { - constructor() public { x = 3; } + constructor() { x = 3; } } contract D is C { - constructor() public { + constructor() { assert(x == 3); assert(x == 2); } } // ---- -// Warning 4661: (232-246): Assertion violation happens here +// Warning 4661: (211-225): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol index 820829a9e3b9..bba7fc27b60a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol @@ -5,17 +5,17 @@ contract A { } contract B is A { - constructor() public { x = 2; } + constructor() { x = 2; } } contract C is B { } contract D is C { - constructor() public { + constructor() { assert(x == 2); assert(x == 3); } } // ---- -// Warning 4661: (199-213): Assertion violation happens here +// Warning 4661: (185-199): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol index c75e003b233a..0f391dac3ef2 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol @@ -1,20 +1,20 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B is C { uint b; - constructor(uint x) public { + constructor(uint x) { b = a + x; } } contract A is B { - constructor(uint x) B(x) C(x + 2) public { + constructor(uint x) B(x) C(x + 2) { assert(a == x + 2); assert(b == x + x + 2); assert(a == x + 5); @@ -22,12 +22,12 @@ contract A is B { } // ---- -// Warning 4144: (171-176): Underflow (resulting value less than 0) happens here -// Warning 2661: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (230-235): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (260-265): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (282-287): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (282-291): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (308-313): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (296-314): Assertion violation happens here +// Warning 4144: (157-162): Underflow (resulting value less than 0) happens here +// Warning 2661: (157-162): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (216-221): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (157-162): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (261-270): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (287-292): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (275-293): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol index cac1394468ee..5912dd855901 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol @@ -1,20 +1,20 @@ pragma experimental SMTChecker; contract C { uint a; - constructor(uint x) public { + constructor(uint x) { a = x; } } abstract contract B is C { uint b; - constructor(uint x) public { + constructor(uint x) { b = x + 10; } } contract A is B { - constructor(uint x) B(x) C(x + 2) public { + constructor(uint x) B(x) C(x + 2) { assert(a == x + 2); assert(b == x + 10); assert(b == x + 5); @@ -22,10 +22,10 @@ contract A is B { } // ---- -// Warning 2661: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (231-236): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (283-289): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 2661: (306-311): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (294-312): Assertion violation happens here +// Warning 2661: (157-163): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (157-163): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (240-245): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (262-268): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 2661: (285-290): Overflow (resulting value larger than 2**256 - 1) happens here +// Warning 4661: (273-291): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol index 066651f7234d..4841d6fa2101 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol @@ -11,10 +11,10 @@ contract C is A { } contract D is B, C { - constructor() public { + constructor() { assert(x == 2); assert(x == 3); } } // ---- -// Warning 4661: (169-183): Assertion violation happens here +// Warning 4661: (162-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol index 1b5563c69094..ba2cb9549a60 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol @@ -5,18 +5,18 @@ contract A { } contract B is A { - constructor() public { x = 2; } + constructor() { x = 2; } } contract C is A { - constructor() public { x = 3; } + constructor() { x = 3; } } contract D is B, C { - constructor() public { + constructor() { assert(x == 3); assert(x == 4); } } // ---- -// Warning 4661: (235-249): Assertion violation happens here +// Warning 4661: (214-228): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_function_call.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_function_call.sol index 36c8ce55186a..451ef0c96c7f 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_function_call.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_function_call.sol @@ -2,7 +2,7 @@ pragma experimental SMTChecker; contract C { uint x = f(2); - constructor () public { + constructor () { assert(x == 2); } diff --git a/test/libsolidity/smtCheckerTests/inheritance/implicit_constructor_hierarchy.sol b/test/libsolidity/smtCheckerTests/inheritance/implicit_constructor_hierarchy.sol index 37210a843a1a..4c883595023e 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/implicit_constructor_hierarchy.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/implicit_constructor_hierarchy.sol @@ -2,11 +2,11 @@ pragma experimental SMTChecker; contract A { uint x; - constructor (uint y) public { assert(x == 0); x = y; } + constructor (uint y) { assert(x == 0); x = y; } } contract B is A { - constructor () A(2) public { assert(x == 2); } + constructor () A(2) { assert(x == 2); } } contract C is B { diff --git a/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol b/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol index 1c374383cb45..560f473732bf 100644 --- a/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol +++ b/test/libsolidity/syntaxTests/abstract/abstract_contract_instantiation.sol @@ -1,5 +1,5 @@ abstract contract AbstractContract { - constructor() public { } + constructor() { } function utterance() public returns (bytes32) { return "miaow"; } } @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError 4614: (215-235): Cannot instantiate an abstract contract. +// TypeError 4614: (208-228): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/abstract/contract.sol b/test/libsolidity/syntaxTests/abstract/contract.sol index 0888b8fb928a..799b4ca643ea 100644 --- a/test/libsolidity/syntaxTests/abstract/contract.sol +++ b/test/libsolidity/syntaxTests/abstract/contract.sol @@ -1 +1 @@ -abstract contract A { constructor() public {} } +abstract contract A { constructor() {} } diff --git a/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol b/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol index 3f989b001620..491c688cc855 100644 --- a/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol +++ b/test/libsolidity/syntaxTests/constructor/abstract_creation_forward_reference.sol @@ -6,10 +6,10 @@ contract Test { } contract Parent { - constructor(address _address) public {} + constructor(address _address) {} } contract Child is Parent { } // ---- -// TypeError 3656: (233-261): Contract "Child" should be marked as abstract. +// TypeError 3656: (226-254): Contract "Child" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol index c4ce52102d86..5562117ce203 100644 --- a/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol +++ b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol @@ -2,4 +2,4 @@ contract C { constructor(uint[] calldata) public {} } // ---- -// TypeError 6651: (29-44): Data location must be "memory" for parameter in function, but "calldata" was given. +// TypeError 6651: (29-44): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol b/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol index 8dee4c7125bf..de68229c9e7d 100644 --- a/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol @@ -1,6 +1,6 @@ -contract C { - constructor() internal {} +abstract contract C { + constructor() {} } contract D is C { - constructor() public { } + constructor() { } } diff --git a/test/libsolidity/syntaxTests/constructor/constructor.sol b/test/libsolidity/syntaxTests/constructor/constructor.sol index aa3422cc234a..4e5c360a7bd6 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor.sol @@ -1 +1 @@ -contract A { constructor() public {} } +contract A { constructor() {} } diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol deleted file mode 100644 index 0b8f45947a8f..000000000000 --- a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol +++ /dev/null @@ -1,3 +0,0 @@ -contract A { constructor() {} } -// ---- -// SyntaxError 4937: (13-29): No visibility specified. Did you intend to add "public"? diff --git a/test/libsolidity/syntaxTests/constructor/constructor_override.sol b/test/libsolidity/syntaxTests/constructor/constructor_override.sol index ddcafcf7a293..c0e363f35091 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_override.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_override.sol @@ -1,5 +1,5 @@ contract C { - constructor() override public {} + constructor() override {} } // ---- -// TypeError 1209: (17-49): Constructors cannot override. +// TypeError 1209: (17-42): Constructors cannot override. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_payable.sol b/test/libsolidity/syntaxTests/constructor/constructor_payable.sol index e5c6ac28d5b4..8885e6256199 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_payable.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_payable.sol @@ -1,5 +1,5 @@ contract C { - constructor() public payable { } + constructor() payable { } } contract D { diff --git a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol index 37bf60bb59bf..487009d07865 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability.sol @@ -1,9 +1,9 @@ contract test1 { - constructor() public view {} + constructor() view {} } contract test2 { - constructor() public pure {} + constructor() pure {} } // ---- -// TypeError 1558: (19-47): Constructor must be payable or non-payable, but is "view". -// TypeError 1558: (69-97): Constructor must be payable or non-payable, but is "pure". +// TypeError 1558: (19-40): Constructor must be payable or non-payable, but is "view". +// TypeError 1558: (62-83): Constructor must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol b/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol index 7d75eec38ced..61955b6eff53 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_virtual.sol @@ -1,5 +1,5 @@ contract C { - constructor() virtual public {} + constructor() virtual {} } // ---- -// TypeError 7001: (17-48): Constructors cannot be virtual. +// TypeError 7001: (17-41): Constructors cannot be virtual. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol index f2ebd21d251c..9213f4189ae0 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_visibility.sol @@ -1,5 +1,5 @@ // The constructor of a base class should not be visible in the derived class -contract A { constructor(string memory) public { } } +contract A { constructor(string memory) { } } contract B is A { function f() pure public { A x = A(0); // convert from address @@ -9,5 +9,5 @@ contract B is A { } } // ---- -// TypeError 3656: (131-301): Contract "B" should be marked as abstract. -// TypeError 9640: (250-254): Explicit type conversion not allowed from "string memory" to "contract A". +// TypeError 3656: (124-294): Contract "B" should be marked as abstract. +// TypeError 9640: (243-247): Explicit type conversion not allowed from "string memory" to "contract A". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol index 0d65fe9842f8..869cc18add14 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol @@ -1,5 +1,5 @@ contract C { - constructor() public; + constructor(); } // ---- -// TypeError 5700: (14-35): Constructor must be implemented if declared. +// TypeError 5700: (14-28): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/external_constructor.sol b/test/libsolidity/syntaxTests/constructor/external_constructor.sol index d3f21b8fa3ed..5f1f92684279 100644 --- a/test/libsolidity/syntaxTests/constructor/external_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/external_constructor.sol @@ -2,4 +2,4 @@ contract test { constructor() external {} } // ---- -// TypeError 9239: (17-42): Constructor must be public or internal. +// SyntaxError 2462: (17-42): Visibility specified for constructor. If you want the contract to be non-deployable, make it "abstract". diff --git a/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol b/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol index e6a2ca3bea99..ae0815ec6390 100644 --- a/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/function_named_constructor.sol @@ -1,5 +1,5 @@ contract C { - function constructor() public; + function constructor(); } // ---- // ParserError 3323: (26-37): This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) { ... }" without the "function" keyword to define it. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol index 1c03e249b08c..461857ff135b 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol @@ -1,8 +1,8 @@ -contract C { - constructor() internal {} +abstract contract C { + constructor() {} } contract D { function f() public { C c = new C(); c; } } // ---- -// TypeError 9054: (84-89): Contract with internal constructor cannot be created directly. +// TypeError 4614: (84-89): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol index 76ba9766375c..f947ed6753db 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol @@ -2,12 +2,12 @@ // "new A". contract B { A a; - constructor() public { + constructor() { a = new A(address(this)); } } -contract A { - constructor(address) internal {} +abstract contract A { + constructor(address) {} } // ---- -// TypeError 9054: (141-146): Contract with internal constructor cannot be created directly. +// TypeError 4614: (134-139): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/constructor/interface_constructor.sol b/test/libsolidity/syntaxTests/constructor/interface_constructor.sol index 864e4e6d2d4f..bbdab25a6f82 100644 --- a/test/libsolidity/syntaxTests/constructor/interface_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/interface_constructor.sol @@ -1,7 +1,6 @@ interface I { - constructor() public; + constructor(); } // ---- -// TypeError 1560: (15-36): Functions in interfaces must be declared external. -// TypeError 6482: (15-36): Constructor cannot be defined in interfaces. -// TypeError 5700: (15-36): Constructor must be implemented if declared. +// TypeError 6482: (15-29): Constructor cannot be defined in interfaces. +// TypeError 5700: (15-29): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/library_constructor.sol b/test/libsolidity/syntaxTests/constructor/library_constructor.sol index 230b144f518c..bd1fa9550e5b 100644 --- a/test/libsolidity/syntaxTests/constructor/library_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/library_constructor.sol @@ -1,6 +1,6 @@ library Lib { - constructor() public; + constructor(); } // ---- -// TypeError 7634: (15-36): Constructor cannot be defined in libraries. -// TypeError 5700: (15-36): Constructor must be implemented if declared. +// TypeError 7634: (15-29): Constructor cannot be defined in libraries. +// TypeError 5700: (15-29): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol b/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol index fa94ee4e50b3..cb1923c1f416 100644 --- a/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol +++ b/test/libsolidity/syntaxTests/constructor/nonpayable_new.sol @@ -1,12 +1,12 @@ -contract A1 { constructor() public {} } +contract A1 { constructor() {} } contract B1 is A1 {} -contract A2 { constructor() public payable {} } +contract A2 { constructor() payable {} } contract B2 is A2 {} contract B3 {} -contract B4 { constructor() public {} } +contract B4 { constructor() {} } contract C { function f() public payable { @@ -17,7 +17,7 @@ contract C { } } // ---- -// TypeError 7006: (235-252): Cannot set option "value", since the constructor of contract B1 is not payable. -// TypeError 7006: (258-275): Cannot set option "value", since the constructor of contract B2 is not payable. -// TypeError 7006: (281-298): Cannot set option "value", since the constructor of contract B3 is not payable. -// TypeError 7006: (304-321): Cannot set option "value", since the constructor of contract B4 is not payable. +// TypeError 7006: (214-231): Cannot set option "value", since the constructor of contract B1 is not payable. +// TypeError 7006: (237-254): Cannot set option "value", since the constructor of contract B2 is not payable. +// TypeError 7006: (260-277): Cannot set option "value", since the constructor of contract B3 is not payable. +// TypeError 7006: (283-300): Cannot set option "value", since the constructor of contract B4 is not payable. diff --git a/test/libsolidity/syntaxTests/constructor/payable_new.sol b/test/libsolidity/syntaxTests/constructor/payable_new.sol index fb8e9ef53bab..350956a4c303 100644 --- a/test/libsolidity/syntaxTests/constructor/payable_new.sol +++ b/test/libsolidity/syntaxTests/constructor/payable_new.sol @@ -1,10 +1,10 @@ contract A1 {} -contract B1 is A1 { constructor() public payable {} } +contract B1 is A1 { constructor() payable {} } -contract A2 { constructor() public {} } -contract B2 is A2 { constructor() public payable {} } +contract A2 { constructor() {} } +contract B2 is A2 { constructor() payable {} } -contract B3 { constructor() public payable {} } +contract B3 { constructor() payable {} } contract C { function f() public payable { diff --git a/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol b/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol index 20920dea730f..c3eea9ea8369 100644 --- a/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol @@ -1,5 +1,5 @@ contract test { - constructor() public returns (uint a) { } + constructor() returns (uint a) { } } // ---- -// TypeError 9712: (46-54): Non-empty "returns" directive for constructor. +// TypeError 9712: (39-47): Non-empty "returns" directive for constructor. diff --git a/test/libsolidity/syntaxTests/constructor/two_constructors.sol b/test/libsolidity/syntaxTests/constructor/two_constructors.sol index d44124d38bb4..6cd7abf734e1 100644 --- a/test/libsolidity/syntaxTests/constructor/two_constructors.sol +++ b/test/libsolidity/syntaxTests/constructor/two_constructors.sol @@ -1,6 +1,6 @@ contract test { - constructor(uint) public { } - constructor() public {} + constructor(uint) { } + constructor() {} } // ---- -// DeclarationError 7997: (47-70): More than one constructor defined. +// DeclarationError 7997: (40-56): More than one constructor defined. diff --git a/test/libsolidity/syntaxTests/constructor_this.sol b/test/libsolidity/syntaxTests/constructor_this.sol index 7d18407dc1f1..3740cf867f90 100644 --- a/test/libsolidity/syntaxTests/constructor_this.sol +++ b/test/libsolidity/syntaxTests/constructor_this.sol @@ -1,6 +1,6 @@ contract C { function f() public pure {} - constructor() public { + constructor() { C c = this; c.f(); // this does not warn now, but should warn in the future this.f(); @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning 5805: (172-176): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. -// Warning 5805: (191-195): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (165-169): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. +// Warning 5805: (184-188): "this" used in constructor. Note that external functions of a contract cannot be called while it is being constructed. diff --git a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions.sol b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions.sol index 5f961fbb9e3f..173bfc5452d8 100644 --- a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions.sol +++ b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions.sol @@ -1,4 +1,4 @@ -contract D { constructor() public payable {} } +contract D { constructor() payable {} } contract C { function foo() pure internal { new D{salt:"abc", value:3}; diff --git a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol index 5fd802c0a09f..89ec2b110b1f 100644 --- a/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol +++ b/test/libsolidity/syntaxTests/functionCalls/new_with_calloptions_unsupported.sol @@ -1,4 +1,4 @@ -contract D { constructor() public payable {} } +contract D { constructor() payable {} } contract C { function foo() pure internal { new D{salt:"abc", value:3}; @@ -10,6 +10,6 @@ contract C { // ==== // EVMVersion: Date: Tue, 23 Jun 2020 18:11:34 +0200 Subject: [PATCH 332/479] Documentation. --- docs/070-breaking-changes.rst | 2 + docs/abi-spec.rst | 4 +- docs/common-patterns.rst | 8 +-- docs/contracts/constant-state-variables.rst | 4 +- docs/contracts/creating-contracts.rst | 2 +- docs/contracts/function-modifiers.rst | 6 +-- docs/contracts/inheritance.rst | 58 ++++++++++++--------- docs/control-structures.rst | 8 +-- docs/examples/blind-auction.rst | 8 +-- docs/examples/micropayment.rst | 7 ++- docs/examples/safe-remote.rst | 4 +- docs/examples/voting.rst | 4 +- docs/introduction-to-smart-contracts.rst | 6 +-- docs/security-considerations.rst | 8 +-- docs/style-guide.rst | 41 +++++++-------- docs/types/reference-types.rst | 4 +- docs/using-the-compiler.rst | 4 +- 17 files changed, 91 insertions(+), 87 deletions(-) diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 2971a25ea2f6..31faef694ae7 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -18,3 +18,5 @@ This section gives detailed instructions on how to update prior code for every b * Change ``now`` to ``block.timestamp``. * Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to ``x >> uint(256 - y)``. +* Remove the ``public`` keyword from every constructor. +* Remove the ``internal`` keyword from every constructor and add ``abstract`` to the contract (if not already present). diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst index b51dd4e17731..e46d0d650c9c 100644 --- a/docs/abi-spec.rst +++ b/docs/abi-spec.rst @@ -537,11 +537,11 @@ For example, :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Test { - constructor() public { b = hex"12345678901234567890123456789012"; } + constructor() { b = hex"12345678901234567890123456789012"; } event Event(uint indexed a, bytes32 b); event Event2(uint indexed a, bytes32 b); function foo(uint a) public { emit Event(a, b); } diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 418bf574bdf0..5dcc33ed6f41 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -28,7 +28,7 @@ you receive the funds of the person who is now the richest. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract WithdrawalContract { address public richest; @@ -36,7 +36,7 @@ you receive the funds of the person who is now the richest. mapping (address => uint) pendingWithdrawals; - constructor() public payable { + constructor() payable { richest = msg.sender; mostSent = msg.value; } @@ -62,13 +62,13 @@ This is as opposed to the more intuitive sending pattern: :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract SendContract { address payable public richest; uint public mostSent; - constructor() public payable { + constructor() payable { richest = msg.sender; mostSent = msg.value; } diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst index 3484853e80f9..c5c520d336ee 100644 --- a/docs/contracts/constant-state-variables.rst +++ b/docs/contracts/constant-state-variables.rst @@ -18,7 +18,7 @@ Not all types for constants and immutables are implemented at this time. The onl :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >0.6.4 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract C { uint constant X = 32**22 + 8; @@ -28,7 +28,7 @@ Not all types for constants and immutables are implemented at this time. The onl uint immutable maxBalance; address immutable owner = msg.sender; - constructor(uint _decimals, address _reference) public { + constructor(uint _decimals, address _reference) { decimals = _decimals; // Assignments to immutables can even access the environment. maxBalance = _reference.balance; diff --git a/docs/contracts/creating-contracts.rst b/docs/contracts/creating-contracts.rst index 4d5a84854f01..2679d05a5449 100644 --- a/docs/contracts/creating-contracts.rst +++ b/docs/contracts/creating-contracts.rst @@ -48,7 +48,7 @@ This means that cyclic creation dependencies are impossible. // This is the constructor which registers the // creator and the assigned name. - constructor(bytes32 _name) public { + constructor(bytes32 _name) { // State variables are accessed via their name // and not via e.g. `this.owner`. Functions can // be accessed directly or through `this.f`, diff --git a/docs/contracts/function-modifiers.rst b/docs/contracts/function-modifiers.rst index d95196698565..823e6e6ac388 100644 --- a/docs/contracts/function-modifiers.rst +++ b/docs/contracts/function-modifiers.rst @@ -18,10 +18,10 @@ if they are marked ``virtual``. For details, please see :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract owned { - constructor() public { owner = msg.sender; } + constructor() { owner = msg.sender; } address payable owner; // This contract only defines a modifier but does not use @@ -63,7 +63,7 @@ if they are marked ``virtual``. For details, please see mapping (address => bool) registeredAddresses; uint price; - constructor(uint initialPrice) public { price = initialPrice; } + constructor(uint initialPrice) { price = initialPrice; } // It is important to also provide the // `payable` keyword here, otherwise the function will diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index 0839cd6e07ac..e03ac397c309 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -39,11 +39,11 @@ Details are given in the following example. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Owned { - constructor() public { owner = msg.sender; } + constructor() { owner = msg.sender; } address payable owner; } @@ -80,7 +80,7 @@ Details are given in the following example. // also a base class of `Destructible`, yet there is only a single // instance of `owned` (as for virtual inheritance in C++). contract Named is Owned, Destructible { - constructor(bytes32 name) public { + constructor(bytes32 name) { Config config = Config(0xD5f9D8D94886E70b06E474c3fB14Fd43E2f23970); NameReg(config.lookup(1)).register(name); } @@ -106,8 +106,8 @@ Details are given in the following example. // If a constructor takes an argument, it needs to be - // provided in the header (or modifier-invocation-style at - // the constructor of the derived contract (see below)). + // provided in the header or modifier-invocation-style at + // the constructor of the derived contract (see below). contract PriceFeed is Owned, Destructible, Named("GoldFeed") { function updateInfo(uint newInfo) public { if (msg.sender == owner) info = newInfo; @@ -127,10 +127,10 @@ destruction request. The way this is done is problematic, as seen in the following example:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract owned { - constructor() public { owner = msg.sender; } + constructor() { owner = msg.sender; } address payable owner; } @@ -157,10 +157,10 @@ explicitly in the final override, but this function will bypass ``Base1.destroy``. The way around this is to use ``super``:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract owned { - constructor() public { owner = msg.sender; } + constructor() { owner = msg.sender; } address payable owner; } @@ -392,33 +392,39 @@ and all functions that are reachable from there through function calls. It does not include the constructor code or internal functions that are only called from the constructor. -Constructor functions can be either ``public`` or ``internal``. If there is no +If there is no constructor, the contract will assume the default constructor, which is -equivalent to ``constructor() public {}``. For example: +equivalent to ``constructor() {}``. For example: :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; - contract A { + abstract contract A { uint public a; - constructor(uint _a) internal { + constructor(uint _a) { a = _a; } } contract B is A(1) { - constructor() public {} + constructor() {} } -A constructor set as ``internal`` causes the contract to be marked as :ref:`abstract `. +You can use internal parameters in a constructor (for example storage pointers). In this case, +the contract has to be marked :ref:`abstract `, because these parameters +cannot be assigned valid values from outside but only through the constructors of derived contracts. .. warning :: Prior to version 0.4.22, constructors were defined as functions with the same name as the contract. This syntax was deprecated and is not allowed anymore in version 0.5.0. +.. warning :: + Prior to version 0.7.0, you had to specify the visibility of constructors as either + ``internal`` or ``public``. + .. index:: ! base;constructor @@ -430,21 +436,21 @@ linearization rules explained below. If the base constructors have arguments, derived contracts need to specify all of them. This can be done in two ways:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Base { uint x; - constructor(uint _x) public { x = _x; } + constructor(uint _x) { x = _x; } } // Either directly specify in the inheritance list... contract Derived1 is Base(7) { - constructor() public {} + constructor() {} } // or through a "modifier" of the derived constructor. contract Derived2 is Base { - constructor(uint _y) Base(_y * _y) public {} + constructor(uint _y) Base(_y * _y) {} } One way is directly in the inheritance list (``is Base(7)``). The other is in @@ -511,14 +517,14 @@ One area where inheritance linearization is especially important and perhaps not :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Base1 { - constructor() public {} + constructor() {} } contract Base2 { - constructor() public {} + constructor() {} } // Constructors are executed in the following order: @@ -526,7 +532,7 @@ One area where inheritance linearization is especially important and perhaps not // 2 - Base2 // 3 - Derived1 contract Derived1 is Base1, Base2 { - constructor() public Base1() Base2() {} + constructor() Base1() Base2() {} } // Constructors are executed in the following order: @@ -534,7 +540,7 @@ One area where inheritance linearization is especially important and perhaps not // 2 - Base1 // 3 - Derived2 contract Derived2 is Base2, Base1 { - constructor() public Base2() Base1() {} + constructor() Base2() Base1() {} } // Constructors are still executed in the following order: @@ -542,7 +548,7 @@ One area where inheritance linearization is especially important and perhaps not // 2 - Base1 // 3 - Derived3 contract Derived3 is Base2, Base1 { - constructor() public Base1() Base2() {} + constructor() Base1() Base2() {} } diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 1d599b52606b..3b4bc4448d20 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -188,11 +188,11 @@ is compiled so recursive creation-dependencies are not possible. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.2 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract D { uint public x; - constructor(uint a) public payable { + constructor(uint a) payable { x = a; } } @@ -244,11 +244,11 @@ which only need to be created if there is a dispute. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.2 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract D { uint public x; - constructor(uint a) public { + constructor(uint a) { x = a; } } diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst index 5e11191616e5..3034b69150f8 100644 --- a/docs/examples/blind-auction.rst +++ b/docs/examples/blind-auction.rst @@ -25,7 +25,7 @@ to receive their money - contracts cannot activate themselves. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract SimpleAuction { // Parameters of the auction. Times are either @@ -60,7 +60,7 @@ to receive their money - contracts cannot activate themselves. constructor( uint _biddingTime, address payable _beneficiary - ) public { + ) { beneficiary = _beneficiary; auctionEndTime = block.timestamp + _biddingTime; } @@ -186,7 +186,7 @@ invalid bids. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract BlindAuction { struct Bid { @@ -220,7 +220,7 @@ invalid bids. uint _biddingTime, uint _revealTime, address payable _beneficiary - ) public { + ) { beneficiary = _beneficiary; biddingEnd = block.timestamp + _biddingTime; revealEnd = biddingEnd + _revealTime; diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst index 39734ca7148c..b68de3cadcbe 100644 --- a/docs/examples/micropayment.rst +++ b/docs/examples/micropayment.rst @@ -143,14 +143,14 @@ The full contract :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.24 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract ReceiverPays { address owner = msg.sender; mapping(uint256 => bool) usedNonces; - constructor() public payable {} + constructor() payable {} function claimPayment(uint256 amount, uint256 nonce, bytes memory signature) public { require(!usedNonces[nonce]); @@ -340,7 +340,7 @@ The full contract :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract SimplePaymentChannel { address payable public sender; // The account sending payments. @@ -348,7 +348,6 @@ The full contract uint256 public expiration; // Timeout in case the recipient never closes. constructor (address payable _recipient, uint256 duration) - public payable { sender = msg.sender; diff --git a/docs/examples/safe-remote.rst b/docs/examples/safe-remote.rst index fbd141c2394a..bae6a3a50a71 100644 --- a/docs/examples/safe-remote.rst +++ b/docs/examples/safe-remote.rst @@ -26,7 +26,7 @@ you can use state machine-like constructs inside a contract. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Purchase { uint public value; @@ -74,7 +74,7 @@ you can use state machine-like constructs inside a contract. // Ensure that `msg.value` is an even number. // Division will truncate if it is an odd number. // Check via multiplication that it wasn't an odd number. - constructor() public payable { + constructor() payable { seller = msg.sender; value = msg.value / 2; require((2 * value) == msg.value, "Value has to be even."); diff --git a/docs/examples/voting.rst b/docs/examples/voting.rst index 5dbdaa1c7994..56a880edf6d9 100644 --- a/docs/examples/voting.rst +++ b/docs/examples/voting.rst @@ -33,7 +33,7 @@ of votes. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; /// @title Voting with delegation. contract Ballot { @@ -63,7 +63,7 @@ of votes. Proposal[] public proposals; /// Create a new ballot to choose one of `proposalNames`. - constructor(bytes32[] memory proposalNames) public { + constructor(bytes32[] memory proposalNames) { chairperson = msg.sender; voters[chairperson].weight = 1; diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 6713f5f2498f..556d486f73ca 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -83,7 +83,7 @@ registering with a username and password, all you need is an Ethereum keypair. :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.5.99 <0.8.0; contract Coin { // The keyword "public" makes variables @@ -97,7 +97,7 @@ registering with a username and password, all you need is an Ethereum keypair. // Constructor code is only run when the contract // is created - constructor() public { + constructor() { minter = msg.sender; } @@ -186,7 +186,7 @@ and any user interface calls the automatically generated ``balances`` function f .. index:: coin -The :ref:`constructor` is a special function run during the creation of the contract and +The :ref:`constructor` is a special function that is executed during the creation of the contract and cannot be called afterwards. In this case, it permanently stores the address of the person creating the contract. The ``msg`` variable (together with ``tx`` and ``block``) is a :ref:`special global variable ` that diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index a75551ed8a9e..a471fdd00244 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -201,13 +201,13 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract TxUserWallet { address owner; - constructor() public { + constructor() { owner = msg.sender; } @@ -222,7 +222,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet: :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; interface TxUserWallet { function transferTo(address payable dest, uint amount) external; @@ -231,7 +231,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet: contract TxAttackWallet { address payable owner; - constructor() public { + constructor() { owner = msg.sender; } diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 30093a6fcba0..30ceec3a98a2 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -300,10 +300,10 @@ Within a grouping, place the ``view`` and ``pure`` functions last. Yes:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract A { - constructor() public { + constructor() { // ... } @@ -337,7 +337,7 @@ Yes:: No:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract A { @@ -357,7 +357,7 @@ No:: // Public functions // ... - constructor() public { + constructor() { // ... } @@ -758,19 +758,19 @@ manner as modifiers if the function declaration is long or hard to read. Yes:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; // Base contracts just to make this compile contract B { - constructor(uint) public { + constructor(uint) { } } contract C { - constructor(uint, uint) public { + constructor(uint, uint) { } } contract D { - constructor(uint) public { + constructor(uint) { } } @@ -781,7 +781,6 @@ Yes:: B(param1) C(param2, param3) D(param4) - public { // do something with param5 x = param5; @@ -791,24 +790,24 @@ Yes:: No:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; // Base contracts just to make this compile contract B { - constructor(uint) public { + constructor(uint) { } } contract C { - constructor(uint, uint) public { + constructor(uint, uint) { } } contract D { - constructor(uint) public { + constructor(uint) { } } @@ -819,8 +818,7 @@ No:: constructor(uint param1, uint param2, uint param3, uint param4, uint param5) B(param1) C(param2, param3) - D(param4) - public { + D(param4) { x = param5; } } @@ -832,8 +830,7 @@ No:: constructor(uint param1, uint param2, uint param3, uint param4, uint param5) B(param1) C(param2, param3) - D(param4) - public { + D(param4) { x = param5; } } @@ -1015,14 +1012,14 @@ As shown in the example below, if the contract name is ``Congress`` and the libr Yes:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; // Owned.sol contract Owned { address public owner; - constructor() public { + constructor() { owner = msg.sender; } @@ -1051,14 +1048,14 @@ and in ``Congress.sol``:: No:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.22 <0.8.0; + pragma solidity >0.6.99 <0.8.0; // owned.sol contract owned { address public owner; - constructor() public { + constructor() { owner = msg.sender; } @@ -1096,7 +1093,7 @@ Events should be named using the CapWords style. Examples: ``Deposit``, ``Transf Function Names ============== -Functions other than constructors should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``. +Functions should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``. Function Argument Names diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index e26ee0405236..445f1a4640f7 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -417,13 +417,13 @@ Array slices are useful to ABI-decode secondary data passed in function paramete :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Proxy { /// @dev Address of the client contract managed by proxy i.e., this contract address client; - constructor(address _client) public { + constructor(address _client) { client = _client; } diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index ae32155f724a..ba07d9e5443e 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -721,7 +721,7 @@ The command above applies all changes as shown below. Please review them careful .. code-block:: solidity // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; abstract contract Updateable { function run() public view virtual returns (bool); @@ -734,7 +734,7 @@ The command above applies all changes as shown below. Please review them careful } contract Source is Updateable, Upgradable { - constructor() public {} + constructor() {} function run() public From 5959d442cbac92ecb052d704ef76c217eb2a68d7 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 30 Jun 2020 12:04:58 +0200 Subject: [PATCH 333/479] Make visibility optional, but it has to be consistent. --- Changelog.md | 1 + libsolidity/analysis/SyntaxChecker.cpp | 8 +------ libsolidity/analysis/TypeChecker.cpp | 24 +++++++++++++++++++ .../constructible_abstract_base.sol | 6 +++++ .../constructible_internal_constructor.sol | 4 +++- .../constructor/external_constructor.sol | 2 +- .../inconstructible_abstract_contract.sol | 8 +++++++ ...nstructible_abstract_contract_inverted.sol | 13 ++++++++++ .../inconstructible_internal_constructor.sol | 6 ++--- ...ructible_internal_constructor_inverted.sol | 6 ++--- .../internal_constructor_non_abstract.sol | 5 ++++ .../public_constructor_abstract.sol | 5 ++++ .../public_constructor_non_abstract.sol | 5 ++++ 13 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 test/libsolidity/syntaxTests/constructor/constructible_abstract_base.sol create mode 100644 test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract_inverted.sol create mode 100644 test/libsolidity/syntaxTests/constructor/internal_constructor_non_abstract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/public_constructor_abstract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/public_constructor_non_abstract.sol diff --git a/Changelog.md b/Changelog.md index 5cacceba91cc..2cf034273202 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ Breaking changes: * Type Checker: Disallow virtual for library functions. + * Constructors should not have visibility. * Deprecated dot syntax for `value` and `gas`. * Deprecated the identifier `now`. * JSON AST: Removes members with ``null`` value from JSON output. diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 19952e32baac..6fc7154fc534 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -301,13 +301,7 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract) bool SyntaxChecker::visit(FunctionDefinition const& _function) { - if (_function.isConstructor() && !_function.noVisibilitySpecified()) - m_errorReporter.syntaxError( - 2462_error, - _function.location(), - "Visibility specified for constructor. If you want the contract to be non-deployable, make it \"abstract\"." - ); - else if (!_function.isConstructor() && _function.noVisibilitySpecified()) + if (!_function.isConstructor() && _function.noVisibilitySpecified()) { string suggestedVisibility = _function.isFallback() || _function.isReceive() || m_isInterface ? "external" : "public"; m_errorReporter.syntaxError( diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 74b3130e17ab..565ca68b0595 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1922,6 +1922,30 @@ void TypeChecker::typeCheckConstructor(FunctionDefinition const& _function) stateMutabilityToString(_function.stateMutability()) + "\"." ); + if (!_function.noVisibilitySpecified()) + { + auto const& contract = dynamic_cast(*_function.scope()); + if (_function.visibility() != Visibility::Public && _function.visibility() != Visibility::Internal) + m_errorReporter.typeError(9239_error, _function.location(), "Constructor cannot have visibility."); + else if (_function.isPublic() && contract.abstract()) + m_errorReporter.declarationError( + 8295_error, + _function.location(), + "Abstract contracts cannot have public constructors. Remove the \"public\" keyword to fix this." + ); + else if (!_function.isPublic() && !contract.abstract()) + m_errorReporter.declarationError( + 1845_error, + _function.location(), + "Non-abstract contracts cannot have internal constructors. Remove the \"internal\" keyword and make the contract abstract to fix this." + ); + else + m_errorReporter.warning( + 2462_error, + _function.location(), + "Visibility for constructor is ignored. If you want the contract to be non-deployable, making it \"abstract\" is sufficient." + ); + } } void TypeChecker::typeCheckABIEncodeFunctions( diff --git a/test/libsolidity/syntaxTests/constructor/constructible_abstract_base.sol b/test/libsolidity/syntaxTests/constructor/constructible_abstract_base.sol new file mode 100644 index 000000000000..de68229c9e7d --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructible_abstract_base.sol @@ -0,0 +1,6 @@ +abstract contract C { + constructor() {} +} +contract D is C { + constructor() { } +} diff --git a/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol b/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol index de68229c9e7d..c2735f467824 100644 --- a/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol @@ -1,6 +1,8 @@ abstract contract C { - constructor() {} + constructor() internal {} } contract D is C { constructor() { } } +// ---- +// Warning 2462: (23-48): Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient. diff --git a/test/libsolidity/syntaxTests/constructor/external_constructor.sol b/test/libsolidity/syntaxTests/constructor/external_constructor.sol index 5f1f92684279..54ce01b286b8 100644 --- a/test/libsolidity/syntaxTests/constructor/external_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/external_constructor.sol @@ -2,4 +2,4 @@ contract test { constructor() external {} } // ---- -// SyntaxError 2462: (17-42): Visibility specified for constructor. If you want the contract to be non-deployable, make it "abstract". +// TypeError 9239: (17-42): Constructor cannot have visibility. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract.sol new file mode 100644 index 000000000000..461857ff135b --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract.sol @@ -0,0 +1,8 @@ +abstract contract C { + constructor() {} +} +contract D { + function f() public { C c = new C(); c; } +} +// ---- +// TypeError 4614: (84-89): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract_inverted.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract_inverted.sol new file mode 100644 index 000000000000..f947ed6753db --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_abstract_contract_inverted.sol @@ -0,0 +1,13 @@ +// Previously, the type information for A was not yet available at the point of +// "new A". +contract B { + A a; + constructor() { + a = new A(address(this)); + } +} +abstract contract A { + constructor(address) {} +} +// ---- +// TypeError 4614: (134-139): Cannot instantiate an abstract contract. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol index 461857ff135b..fa2b494c06d0 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor.sol @@ -1,8 +1,8 @@ -abstract contract C { - constructor() {} +contract C { + constructor() internal {} } contract D { function f() public { C c = new C(); c; } } // ---- -// TypeError 4614: (84-89): Cannot instantiate an abstract contract. +// DeclarationError 1845: (14-39): Non-abstract contracts cannot have internal constructors. Remove the "internal" keyword and make the contract abstract to fix this. diff --git a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol index f947ed6753db..a20e9e2e33af 100644 --- a/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol +++ b/test/libsolidity/syntaxTests/constructor/inconstructible_internal_constructor_inverted.sol @@ -6,8 +6,8 @@ contract B { a = new A(address(this)); } } -abstract contract A { - constructor(address) {} +contract A { + constructor(address) internal {} } // ---- -// TypeError 4614: (134-139): Cannot instantiate an abstract contract. +// DeclarationError 1845: (175-207): Non-abstract contracts cannot have internal constructors. Remove the "internal" keyword and make the contract abstract to fix this. diff --git a/test/libsolidity/syntaxTests/constructor/internal_constructor_non_abstract.sol b/test/libsolidity/syntaxTests/constructor/internal_constructor_non_abstract.sol new file mode 100644 index 000000000000..66f6636056d5 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/internal_constructor_non_abstract.sol @@ -0,0 +1,5 @@ +contract C { + constructor() internal {} +} +// ---- +// DeclarationError 1845: (14-39): Non-abstract contracts cannot have internal constructors. Remove the "internal" keyword and make the contract abstract to fix this. diff --git a/test/libsolidity/syntaxTests/constructor/public_constructor_abstract.sol b/test/libsolidity/syntaxTests/constructor/public_constructor_abstract.sol new file mode 100644 index 000000000000..0134fd24321e --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/public_constructor_abstract.sol @@ -0,0 +1,5 @@ +abstract contract C { + constructor() public {} +} +// ---- +// DeclarationError 8295: (23-46): Abstract contracts cannot have public constructors. Remove the "public" keyword to fix this. diff --git a/test/libsolidity/syntaxTests/constructor/public_constructor_non_abstract.sol b/test/libsolidity/syntaxTests/constructor/public_constructor_non_abstract.sol new file mode 100644 index 000000000000..8f6ca5e5497e --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/public_constructor_non_abstract.sol @@ -0,0 +1,5 @@ +contract C { + constructor() public {} +} +// ---- +// Warning 2462: (14-37): Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient. From 552d3534309e4d9afe7550de86d9198db735077f Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 15:47:40 +0200 Subject: [PATCH 334/479] New tests. --- .../constructor/constructer_internal_function_abstract.sol | 3 +++ .../constructor/constructor_internal_function.sol | 5 +++++ .../syntaxTests/constructor/constructor_mapping_memory.sol | 6 ++++++ .../constructor/constructor_mapping_memory_abstract.sol | 5 +++++ .../syntaxTests/constructor/constructor_storage.sol | 5 +++++ .../constructor/constructor_storage_abstract.sol | 3 +++ test/libsolidity/syntaxTests/constructor/nonabiv2_type.sol | 5 +++++ .../syntaxTests/constructor/nonabiv2_type_abstract.sol | 4 ++++ 8 files changed, 36 insertions(+) create mode 100644 test/libsolidity/syntaxTests/constructor/constructer_internal_function_abstract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/constructor_internal_function.sol create mode 100644 test/libsolidity/syntaxTests/constructor/constructor_mapping_memory.sol create mode 100644 test/libsolidity/syntaxTests/constructor/constructor_mapping_memory_abstract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/constructor_storage.sol create mode 100644 test/libsolidity/syntaxTests/constructor/constructor_storage_abstract.sol create mode 100644 test/libsolidity/syntaxTests/constructor/nonabiv2_type.sol create mode 100644 test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol diff --git a/test/libsolidity/syntaxTests/constructor/constructer_internal_function_abstract.sol b/test/libsolidity/syntaxTests/constructor/constructer_internal_function_abstract.sol new file mode 100644 index 000000000000..de9a1d5f054e --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructer_internal_function_abstract.sol @@ -0,0 +1,3 @@ +abstract contract A { + constructor(function() internal) {} +} diff --git a/test/libsolidity/syntaxTests/constructor/constructor_internal_function.sol b/test/libsolidity/syntaxTests/constructor/constructor_internal_function.sol new file mode 100644 index 000000000000..bc57055e84ac --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_internal_function.sol @@ -0,0 +1,5 @@ +contract A { + constructor(function() internal) {} +} +// ---- +// TypeError 4103: (29-49): Internal type is not allowed for public or external functions. You can make the contract abstract to avoid this problem. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory.sol b/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory.sol new file mode 100644 index 000000000000..266a440d6343 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory.sol @@ -0,0 +1,6 @@ +contract A { + constructor(mapping(uint => uint) memory a) {} +} +// ---- +// TypeError 4103: (29-59): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. You can make the contract abstract to avoid this problem. +// TypeError 4061: (29-59): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory_abstract.sol b/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory_abstract.sol new file mode 100644 index 000000000000..4162878958c3 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_mapping_memory_abstract.sol @@ -0,0 +1,5 @@ +abstract contract A { + constructor(mapping(uint => uint) memory a) {} +} +// ---- +// TypeError 4061: (38-68): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_storage.sol b/test/libsolidity/syntaxTests/constructor/constructor_storage.sol new file mode 100644 index 000000000000..9388da132564 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_storage.sol @@ -0,0 +1,5 @@ +contract A { + constructor(uint[] storage a) {} +} +// ---- +// TypeError 3644: (29-45): This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_storage_abstract.sol b/test/libsolidity/syntaxTests/constructor/constructor_storage_abstract.sol new file mode 100644 index 000000000000..d00d4f5e3fd2 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_storage_abstract.sol @@ -0,0 +1,3 @@ +abstract contract A { + constructor(uint[] storage a) {} +} diff --git a/test/libsolidity/syntaxTests/constructor/nonabiv2_type.sol b/test/libsolidity/syntaxTests/constructor/nonabiv2_type.sol new file mode 100644 index 000000000000..13b0d02af425 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/nonabiv2_type.sol @@ -0,0 +1,5 @@ +contract C { + constructor(uint[][][] memory t) {} +} +// ---- +// TypeError 4957: (26-45): This type is only supported in ABIEncoderV2. Use "pragma experimental ABIEncoderV2;" to enable the feature. Alternatively, make the contract abstract and supply the constructor arguments from a derived contract. diff --git a/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol b/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol new file mode 100644 index 000000000000..7fc802247f4f --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol @@ -0,0 +1,4 @@ +abstract contract C { + constructor(uint[][][] memory t) {} +} +// ---- From 1f0f5d218372432409c2ba2df6497b51159e9a67 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jul 2020 12:32:50 +0200 Subject: [PATCH 335/479] Prepare changelog for 0.6.11. --- Changelog.md | 16 ++++++++-------- docs/bugs_by_version.json | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7a0a6a3af1dc..5c52d5e65e90 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,30 +1,30 @@ -### 0.6.11 (unreleased) +### 0.6.11 (2020-07-07) Language Features: * General: Add unit denomination ``gwei`` - * Yul: Support ``linkersymbol`` builtin in standalone assembly mode. + * Yul: Support ``linkersymbol`` builtin in standalone assembly mode to refer to library addresses. * Yul: Support using string literals exceeding 32 bytes as literal arguments for builtins. Compiler Features: - * NatSpec: Add fields "kind" and "version" to the JSON output. - * NatSpec: Inherit tags from unique base if derived function does not provide any. + * NatSpec: Add fields ``kind`` and ``version`` to the JSON output. + * NatSpec: Inherit tags from unique base functions if derived function does not provide any. * Commandline Interface: Prevent some incompatible commandline options from being used together. - * Debug data: Also tag jumps into and out of Yul functions as jumps into and out of functions. * NatSpec: Support NatSpec comments on events. * Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``. * SMTChecker: Support external calls to unknown code. + * Source Maps: Also tag jumps into and out of Yul functions as jumps into and out of functions. Bugfixes: * NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments. - * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. - * Type Checker: Do not disallow assigning to calldata variables. * Type Checker: Disallow constructor parameters with ``calldata`` data location. + * Type Checker: Do not disallow assigning to calldata variables. + * Type Checker: Fix internal error related to ``using for`` applied to non-libraries. * Wasm backend: Fix code generation for for-loops with pre statements. * Wasm backend: Properly support both ``i32.drop`` and ``i64.drop``, and remove ``drop``. - * Yul: Fix source location of variable multi-assignment. * Yul: Disallow the same variable to occur multiple times on the left-hand side of an assignment. + * Yul: Fix source location of variable multi-assignment. ### 0.6.10 (2020-06-11) diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 8472ed5e427a..000ab3ef8c13 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1109,6 +1109,10 @@ "bugs": [], "released": "2020-06-11" }, + "0.6.11": { + "bugs": [], + "released": "2020-07-07" + }, "0.6.2": { "bugs": [ "MissingEscapingInFormatting", From 849bae2aa77e10d52fed1d9509c9a596b7935ac0 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 7 Jul 2020 17:22:09 +0530 Subject: [PATCH 336/479] Natspec: change events() to interfaceEvents() --- libsolidity/interface/Natspec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 459536e9a0f9..a292c7a3d05c 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -82,7 +82,7 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) } } - for (auto const& event: _contractDef.events()) + for (auto const& event: _contractDef.interfaceEvents()) { string value = extractDoc(event->annotation().docTags, "notice"); if (!value.empty()) From fc8947d3e8439b3388e2b2a205f5e6624f720491 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 2 Jul 2020 18:23:36 +0100 Subject: [PATCH 337/479] Restrict dots in Yul identifiers --- Changelog.md | 2 +- libyul/AsmAnalysis.cpp | 25 +++++++++++++++++++++++++ libyul/AsmAnalysis.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 5cacceba91cc..c41bf5944466 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,7 +13,7 @@ Breaking changes: Language Features: * Yul: Disallow EVM instruction `pc()`. - + * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. Compiler Features: diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index db35c8dc603a..1d2c9a40fb93 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -197,7 +197,10 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) m_currentScope->insideFunction() ); for (auto const& variable: _varDecl.variables) + { + expectValidIdentifier(variable.name, variable.location); expectValidType(variable.type, variable.location); + } if (_varDecl.value) { @@ -237,11 +240,13 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) void AsmAnalyzer::operator()(FunctionDefinition const& _funDef) { yulAssert(!_funDef.name.empty(), ""); + expectValidIdentifier(_funDef.name, _funDef.location); Block const* virtualBlock = m_info.virtualBlocks.at(&_funDef).get(); yulAssert(virtualBlock, ""); Scope& varScope = scope(virtualBlock); for (auto const& var: _funDef.parameters + _funDef.returnVariables) { + expectValidIdentifier(var.name, var.location); expectValidType(var.type, var.location); m_activeVariables.insert(&std::get(varScope.identifiers.at(var.name))); } @@ -517,6 +522,26 @@ Scope& AsmAnalyzer::scope(Block const* _block) return *scopePtr; } +void AsmAnalyzer::expectValidIdentifier(YulString _identifier, SourceLocation const& _location) +{ + // NOTE: the leading dot case is handled by the parser not allowing it. + + if (boost::ends_with(_identifier.str(), ".")) + m_errorReporter.syntaxError( + 3384_error, + _location, + "\"" + _identifier.str() + "\" is not a valid identifier (ends with a dot)." + ); + + if (_identifier.str().find("..") != std::string::npos) + m_errorReporter.syntaxError( + 7771_error, + _location, + "\"" + _identifier.str() + "\" is not a valid identifier (contains consecutive dots)." + ); + +} + void AsmAnalyzer::expectValidType(YulString _type, SourceLocation const& _location) { if (!m_dialect.types.count(_type)) diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index e0a751b1343a..345ecab6b942 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -108,6 +108,7 @@ class AsmAnalyzer void checkAssignment(Identifier const& _variable, YulString _valueType); Scope& scope(Block const* _block); + void expectValidIdentifier(YulString _identifier, langutil::SourceLocation const& _location); void expectValidType(YulString _type, langutil::SourceLocation const& _location); void expectType(YulString _expectedType, YulString _givenType, langutil::SourceLocation const& _location); From 0bd6fb027b4258bb036b1d106bcd14ad231f6729 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 15:51:32 +0100 Subject: [PATCH 338/479] Update tests --- test/libyul/yulSyntaxTests/are_we_perl_yet.yul | 6 ++++++ test/libyul/yulSyntaxTests/dot_consecutive_function.yul | 1 + test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul | 1 + test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul | 1 + .../yulSyntaxTests/dot_consecutive_variabledeclaration.yul | 1 + test/libyul/yulSyntaxTests/dot_ellipse_function.yul | 1 + test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul | 1 + test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul | 1 + .../yulSyntaxTests/dot_ellipse_variabledeclaration.yul | 1 + test/libyul/yulSyntaxTests/dot_trailing_function.yul | 1 + test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul | 1 + test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul | 1 + .../yulSyntaxTests/dot_trailing_variabledeclaration.yul | 1 + 13 files changed, 18 insertions(+) diff --git a/test/libyul/yulSyntaxTests/are_we_perl_yet.yul b/test/libyul/yulSyntaxTests/are_we_perl_yet.yul index ffe8da4078d9..7a79436b4549 100644 --- a/test/libyul/yulSyntaxTests/are_we_perl_yet.yul +++ b/test/libyul/yulSyntaxTests/are_we_perl_yet.yul @@ -4,3 +4,9 @@ _...(a...) } // ---- +// SyntaxError 3384: (6-27): "_..." is not a valid identifier (ends with a dot). +// SyntaxError 7771: (6-27): "_..." is not a valid identifier (contains consecutive dots). +// SyntaxError 3384: (20-23): "$.." is not a valid identifier (ends with a dot). +// SyntaxError 7771: (20-23): "$.." is not a valid identifier (contains consecutive dots). +// SyntaxError 3384: (36-40): "a..." is not a valid identifier (ends with a dot). +// SyntaxError 7771: (36-40): "a..." is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function.yul index 6b8c0db0880e..3d58fd47d580 100644 --- a/test/libyul/yulSyntaxTests/dot_consecutive_function.yul +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function.yul @@ -2,3 +2,4 @@ function x..y() {} } // ---- +// SyntaxError 7771: (6-24): "x..y" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul index 1af439328ccc..150b81405034 100644 --- a/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function_arg.yul @@ -2,3 +2,4 @@ function x(a..b) {} } // ---- +// SyntaxError 7771: (17-21): "a..b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul b/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul index 1fc66a18abc5..0d3a7be3fea3 100644 --- a/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul +++ b/test/libyul/yulSyntaxTests/dot_consecutive_function_ret.yul @@ -2,3 +2,4 @@ function x() -> a..b {} } // ---- +// SyntaxError 7771: (22-26): "a..b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul index 0f2b4c336991..d426a7b7d687 100644 --- a/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul +++ b/test/libyul/yulSyntaxTests/dot_consecutive_variabledeclaration.yul @@ -2,3 +2,4 @@ let a..b := 1 } // ---- +// SyntaxError 7771: (10-14): "a..b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function.yul index fbb8f32a3c5a..ebfa0f5794b0 100644 --- a/test/libyul/yulSyntaxTests/dot_ellipse_function.yul +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function.yul @@ -2,3 +2,4 @@ function x...y() {} } // ---- +// SyntaxError 7771: (6-25): "x...y" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul index 47dd7b2bb5f8..75298aa0e4db 100644 --- a/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function_arg.yul @@ -2,3 +2,4 @@ function x(a...b) {} } // ---- +// SyntaxError 7771: (17-22): "a...b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul b/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul index 70ba6506991f..7d1b95155154 100644 --- a/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul +++ b/test/libyul/yulSyntaxTests/dot_ellipse_function_ret.yul @@ -2,3 +2,4 @@ function x() -> a...b {} } // ---- +// SyntaxError 7771: (22-27): "a...b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul index 47870bfb2276..c772073cd5df 100644 --- a/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul +++ b/test/libyul/yulSyntaxTests/dot_ellipse_variabledeclaration.yul @@ -2,3 +2,4 @@ let a...b := 1 } // ---- +// SyntaxError 7771: (10-15): "a...b" is not a valid identifier (contains consecutive dots). diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function.yul b/test/libyul/yulSyntaxTests/dot_trailing_function.yul index 4348149d30a3..c3b151e89d60 100644 --- a/test/libyul/yulSyntaxTests/dot_trailing_function.yul +++ b/test/libyul/yulSyntaxTests/dot_trailing_function.yul @@ -2,3 +2,4 @@ function x.() {} } // ---- +// SyntaxError 3384: (6-22): "x." is not a valid identifier (ends with a dot). diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul b/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul index d8fc0336d383..c81c18446ead 100644 --- a/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul +++ b/test/libyul/yulSyntaxTests/dot_trailing_function_arg.yul @@ -2,3 +2,4 @@ function x(a.) {} } // ---- +// SyntaxError 3384: (17-19): "a." is not a valid identifier (ends with a dot). diff --git a/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul b/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul index 92b9daf161de..adfa02410ec1 100644 --- a/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul +++ b/test/libyul/yulSyntaxTests/dot_trailing_function_ret.yul @@ -2,3 +2,4 @@ function x() -> a. {} } // ---- +// SyntaxError 3384: (22-24): "a." is not a valid identifier (ends with a dot). diff --git a/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul b/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul index b71a3d583a1b..cc86ca23e8ad 100644 --- a/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul +++ b/test/libyul/yulSyntaxTests/dot_trailing_variabledeclaration.yul @@ -2,3 +2,4 @@ let a. := 1 } // ---- +// SyntaxError 3384: (10-12): "a." is not a valid identifier (ends with a dot). From 38c479ffd40254752bc4fa01ecfe7986f0a79aeb Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jul 2020 15:16:21 +0200 Subject: [PATCH 339/479] Set version to 0.6.12. --- CMakeLists.txt | 2 +- Changelog.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3374ff09d57f..18949721e62b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.11") +set(PROJECT_VERSION "0.6.12") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index 5c52d5e65e90..d427d637f18b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +### 0.6.12 (unreleased) + + + + ### 0.6.11 (2020-07-07) Language Features: From b23f7d879009306c294438ef47b216722d8457ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 7 Jul 2020 16:47:31 +0200 Subject: [PATCH 340/479] [yul-phaser] Temporarily disable very slow tests for the classic algorithm --- test/yulPhaser/GeneticAlgorithms.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/yulPhaser/GeneticAlgorithms.cpp b/test/yulPhaser/GeneticAlgorithms.cpp index d7ef8db57c94..12302bb8b107 100644 --- a/test/yulPhaser/GeneticAlgorithms.cpp +++ b/test/yulPhaser/GeneticAlgorithms.cpp @@ -212,7 +212,8 @@ BOOST_FIXTURE_TEST_CASE(runNextRound_should_generate_individuals_in_the_crossove BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(ClassicGeneticAlgorithmTest) -BOOST_FIXTURE_TEST_CASE(runNextRound_should_select_individuals_with_probability_proportional_to_fitness, ClassicGeneticAlgorithmFixture) +// FIXME: This test runs *very* slowly (tens of seconds). Investigate, fix and re-enable. +BOOST_FIXTURE_TEST_CASE(runNextRound_should_select_individuals_with_probability_proportional_to_fitness, ClassicGeneticAlgorithmFixture, *boost::unit_test::disabled()) { constexpr double relativeTolerance = 0.1; constexpr size_t populationSize = 1000; @@ -253,7 +254,8 @@ BOOST_FIXTURE_TEST_CASE(runNextRound_should_select_individuals_with_probability_ BOOST_TEST(abs(meanSquaredError(newFitness, expectedValue) - variance) < variance * relativeTolerance); } -BOOST_FIXTURE_TEST_CASE(runNextRound_should_select_only_individuals_existing_in_the_original_population, ClassicGeneticAlgorithmFixture) +// FIXME: This test runs *very* slowly (tens of seconds). Investigate, fix and re-enable. +BOOST_FIXTURE_TEST_CASE(runNextRound_should_select_only_individuals_existing_in_the_original_population, ClassicGeneticAlgorithmFixture, *boost::unit_test::disabled()) { constexpr size_t populationSize = 1000; auto population = Population::makeRandom(m_fitnessMetric, populationSize, 1, 10); @@ -297,7 +299,8 @@ BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_crossover, ClassicGeneticAlgorith BOOST_TEST(totalCrossed >= 2); } -BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_mutation, ClassicGeneticAlgorithmFixture) +// FIXME: This test runs *very* slowly (tens of seconds). Investigate, fix and re-enable. +BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_mutation, ClassicGeneticAlgorithmFixture, *boost::unit_test::disabled()) { m_options.mutationChance = 0.6; ClassicGeneticAlgorithm algorithm(m_options); @@ -326,7 +329,8 @@ BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_mutation, ClassicGeneticAlgorithm BOOST_TEST(abs(meanSquaredError(bernoulliTrials, expectedValue) - variance) < variance * relativeTolerance); } -BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_deletion, ClassicGeneticAlgorithmFixture) +// FIXME: This test runs *very* slowly (tens of seconds). Investigate, fix and re-enable. +BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_deletion, ClassicGeneticAlgorithmFixture, *boost::unit_test::disabled()) { m_options.deletionChance = 0.6; ClassicGeneticAlgorithm algorithm(m_options); @@ -355,7 +359,8 @@ BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_deletion, ClassicGeneticAlgorithm BOOST_TEST(abs(meanSquaredError(bernoulliTrials, expectedValue) - variance) < variance * relativeTolerance); } -BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_addition, ClassicGeneticAlgorithmFixture) +// FIXME: This test runs *very* slowly (tens of seconds). Investigate, fix and re-enable. +BOOST_FIXTURE_TEST_CASE(runNextRound_should_do_addition, ClassicGeneticAlgorithmFixture, *boost::unit_test::disabled()) { m_options.additionChance = 0.6; ClassicGeneticAlgorithm algorithm(m_options); From 5ebf2b84ef6127b273df9a1e898759155a89906c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Jul 2020 09:33:30 +0200 Subject: [PATCH 341/479] Improve testing speed by only enabling the Yul optimizer if needed. --- .../SolidityExecutionFramework.cpp | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 29b3b8b4390d..2d0ae44dadca 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -61,18 +61,40 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( evmasm::LinkerObject obj; if (m_compileViaYul) { - yul::AssemblyStack asmStack( - m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, - // Ignore optimiser settings here because we need Yul optimisation to - // get code that does not exhaust the stack. - OptimiserSettings::full() - ); - bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); - solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); + // Try compiling twice: If the first run fails due to stack errors, forcefully enable + // the optimizer. + for (bool forceEnableOptimizer: {false, true}) + { + OptimiserSettings optimiserSettings = m_optimiserSettings; + if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser) + { + // Enable some optimizations on the first run + optimiserSettings.runYulOptimiser = true; + optimiserSettings.yulOptimiserSteps = "uljmul jmul"; + } + else if (forceEnableOptimizer) + optimiserSettings = OptimiserSettings::full(); - asmStack.optimize(); - obj = std::move(*asmStack.assemble(yul::AssemblyStack::Machine::EVM).bytecode); + yul::AssemblyStack asmStack( + m_evmVersion, + yul::AssemblyStack::Language::StrictAssembly, + optimiserSettings + ); + bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); + solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); + + try + { + asmStack.optimize(); + obj = std::move(*asmStack.assemble(yul::AssemblyStack::Machine::EVM).bytecode); + break; + } + catch (...) + { + if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full()) + throw; + } + } } else obj = m_compiler.object(contractName); From f9d6fa71fd6b72d86c54a62f5cd79c71794ed07d Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 7 Jul 2020 19:03:25 +0200 Subject: [PATCH 342/479] Add create & delete array tests for yul --- .../array/create_memory_array.sol | 3 +- .../array/delete_memory_array.sol | 17 ++++++++ .../array/delete_storage_array.sol | 40 +++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/semanticTests/array/delete_memory_array.sol create mode 100644 test/libsolidity/semanticTests/array/delete_storage_array.sol diff --git a/test/libsolidity/semanticTests/array/create_memory_array.sol b/test/libsolidity/semanticTests/array/create_memory_array.sol index fd4fe943cb65..cf00ccaa6142 100644 --- a/test/libsolidity/semanticTests/array/create_memory_array.sol +++ b/test/libsolidity/semanticTests/array/create_memory_array.sol @@ -16,6 +16,7 @@ contract C { return (x[199], y[203][1], z[170].a[1], z[170].b[99]); } } - +// ==== +// compileViaYul: also // ---- // f() -> "A", 8, 4, "B" diff --git a/test/libsolidity/semanticTests/array/delete_memory_array.sol b/test/libsolidity/semanticTests/array/delete_memory_array.sol new file mode 100644 index 000000000000..64fc9a9724ec --- /dev/null +++ b/test/libsolidity/semanticTests/array/delete_memory_array.sol @@ -0,0 +1,17 @@ +contract C { + + function len() public returns (uint ret) { + uint[] memory data = new uint[](2); + data[0] = 234; + data[1] = 123; + delete data; + assembly { + ret := mload(data) + } + } +} + +// ==== +// compileViaYul: also +// ---- +// len() -> 0 diff --git a/test/libsolidity/semanticTests/array/delete_storage_array.sol b/test/libsolidity/semanticTests/array/delete_storage_array.sol new file mode 100644 index 000000000000..f0bb769788bc --- /dev/null +++ b/test/libsolidity/semanticTests/array/delete_storage_array.sol @@ -0,0 +1,40 @@ +contract C { + uint[] data; + + function len() public returns (uint ret) { + data.push(234); + data.push(123); + delete data; + assembly { + ret := sload(data_slot) + } + } + + function val() public returns (uint ret) { + assembly { + sstore(0, 2) + mstore(0, 0) + sstore(keccak256(0, 32), 234) + sstore(add(keccak256(0, 32), 1), 123) + } + + assert(data[0] == 234); + assert(data[1] == 123); + + delete data; + + uint size = 999; + + assembly { + size := sload(0) + mstore(0, 0) + ret := sload(keccak256(0, 32)) + } + } +} + +// ==== +// compileViaYul: also +// ---- +// len() -> 0 +// val() -> 0 From 48ac4b295495c81649a980c9807a5d7a2243241d Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Mon, 6 Jul 2020 14:09:06 +0200 Subject: [PATCH 343/479] Disable more than one reference to a variable on the LHS of a tuple assignment --- test/tools/ossfuzz/protoToYul.cpp | 54 +++++++++++++++++++++++-------- test/tools/ossfuzz/protoToYul.h | 2 ++ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 8d5ced0a85f2..73462356b53d 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -178,6 +178,14 @@ bool ProtoConverter::functionCallNotPossible(FunctionCall_Returns _type) (_type == FunctionCall::MULTIASSIGN && !varDeclAvailable()); } +unsigned ProtoConverter::numVarsInScope() +{ + if (m_inFunctionDef) + return m_currentFuncVars.size(); + else + return m_currentGlobalVars.size(); +} + void ProtoConverter::visit(VarRef const& _x) { if (m_inFunctionDef) @@ -830,18 +838,18 @@ void ProtoConverter::visitFunctionInputParams(FunctionCall const& _x, unsigned _ case 4: visit(_x.in_param4()); m_output << ", "; - BOOST_FALLTHROUGH; + [[fallthrough]]; case 3: visit(_x.in_param3()); m_output << ", "; - BOOST_FALLTHROUGH; + [[fallthrough]]; case 2: visit(_x.in_param2()); m_output << ", "; - BOOST_FALLTHROUGH; + [[fallthrough]]; case 1: visit(_x.in_param1()); - BOOST_FALLTHROUGH; + [[fallthrough]]; case 0: break; default: @@ -966,23 +974,43 @@ void ProtoConverter::visit(FunctionCall const& _x) "Proto fuzzer: Function call with too many output params encountered." ); + // Return early if numOutParams > number of available variables + if (numOutParams > numVarsInScope()) + return; + + // Copy variables in scope in order to prevent repeated references + vector variables; + if (m_inFunctionDef) + for (auto var: m_currentFuncVars) + variables.push_back(*var); + else + for (auto var: m_currentGlobalVars) + variables.push_back(*var); + + auto refVar = [](vector& _var, unsigned _rand, bool _comma = true) -> string + { + auto index = _rand % _var.size(); + string ref = _var[index]; + _var.erase(_var.begin() + index); + if (_comma) + ref += ", "; + return ref; + }; + // Convert LHS of multi assignment // We reverse the order of out param visits since the order does not matter. // This helps reduce the size of this switch statement. switch (numOutParams) { case 4: - visit(_x.out_param4()); - m_output << ", "; - BOOST_FALLTHROUGH; + m_output << refVar(variables, _x.out_param4().varnum()); + [[fallthrough]]; case 3: - visit(_x.out_param3()); - m_output << ", "; - BOOST_FALLTHROUGH; + m_output << refVar(variables, _x.out_param3().varnum()); + [[fallthrough]]; case 2: - visit(_x.out_param2()); - m_output << ", "; - visit(_x.out_param1()); + m_output << refVar(variables, _x.out_param2().varnum()); + m_output << refVar(variables, _x.out_param1().varnum(), false); break; default: yulAssert(false, "Proto fuzzer: Function call with too many or too few input parameters."); diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 9f7240f5eeb0..950dd97a94cd 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -120,6 +120,8 @@ class ProtoConverter void closeFunctionScope(); /// Adds @a _vars to current scope void addVarsToScope(std::vector const& _vars); + /// @returns number of variables that are in scope + unsigned numVarsInScope(); std::string createHex(std::string const& _hexBytes); From 6b435b2192efed65ce18c895c2f33e08bd088f32 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Wed, 24 Jun 2020 15:13:31 +0530 Subject: [PATCH 344/479] solidity-upgrade: added module to remove visibility of constructors --- docs/using-the-compiler.rst | 57 +++++++++++++------------ tools/solidityUpgrade/SourceTransform.h | 11 ++++- tools/solidityUpgrade/SourceUpgrade.cpp | 2 + tools/solidityUpgrade/SourceUpgrade.h | 8 +++- tools/solidityUpgrade/Upgrade070.cpp | 24 +++++++++++ tools/solidityUpgrade/Upgrade070.h | 9 ++++ 6 files changed, 81 insertions(+), 30 deletions(-) diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index ba07d9e5443e..d37934ccad00 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -566,33 +566,36 @@ the latest version of the compiler. Available upgrade modules ~~~~~~~~~~~~~~~~~~~~~~~~~ -+-----------------+---------+--------------------------------------------------+ -| Module | Version | Description | -+=================+=========+==================================================+ -| ``constructor`` | 0.5.0 | Constructors must now be defined using the | -| | | ``constructor`` keyword. | -+-----------------+---------+--------------------------------------------------+ -| ``visibility`` | 0.5.0 | Explicit function visibility is now mandatory, | -| | | defaults to ``public``. | -+-----------------+---------+--------------------------------------------------+ -| ``abstract`` | 0.6.0 | The keyword ``abstract`` has to be used if a | -| | | contract does not implement all its functions. | -+-----------------+---------+--------------------------------------------------+ -| ``virtual`` | 0.6.0 | Functions without implementation outside an | -| | | interface have to be marked ``virtual``. | -+-----------------+---------+--------------------------------------------------+ -| ``override`` | 0.6.0 | When overriding a function or modifier, the new | -| | | keyword ``override`` must be used. | -+-----------------+---------+--------------------------------------------------+ -| ``dotsyntax`` | 0.7.0 | The following syntax is deprecated: | -| | | ``f.gas(...)()``, ``f.value(...)()`` and | -| | | ``(new C).value(...)()``. Replace these calls by | -| | | ``f{gas: ..., value: ...}()`` and | -| | | ``(new C){value: ...}()``. | -+-----------------+---------+--------------------------------------------------+ -| ``now`` | 0.7.0 | The ``now`` keyword is deprecated. Use | -| | | ``block.timestamp`` instead. | -+-----------------+---------+--------------------------------------------------+ ++----------------------------+---------+--------------------------------------------------+ +| Module | Version | Description | ++============================+=========+==================================================+ +| ``constructor`` | 0.5.0 | Constructors must now be defined using the | +| | | ``constructor`` keyword. | ++----------------------------+---------+--------------------------------------------------+ +| ``visibility`` | 0.5.0 | Explicit function visibility is now mandatory, | +| | | defaults to ``public``. | ++----------------------------+---------+--------------------------------------------------+ +| ``abstract`` | 0.6.0 | The keyword ``abstract`` has to be used if a | +| | | contract does not implement all its functions. | ++----------------------------+---------+--------------------------------------------------+ +| ``virtual`` | 0.6.0 | Functions without implementation outside an | +| | | interface have to be marked ``virtual``. | ++----------------------------+---------+--------------------------------------------------+ +| ``override`` | 0.6.0 | When overriding a function or modifier, the new | +| | | keyword ``override`` must be used. | ++----------------------------+---------+--------------------------------------------------+ +| ``dotsyntax`` | 0.7.0 | The following syntax is deprecated: | +| | | ``f.gas(...)()``, ``f.value(...)()`` and | +| | | ``(new C).value(...)()``. Replace these calls by | +| | | ``f{gas: ..., value: ...}()`` and | +| | | ``(new C){value: ...}()``. | ++----------------------------+---------+--------------------------------------------------+ +| ``now`` | 0.7.0 | The ``now`` keyword is deprecated. Use | +| | | ``block.timestamp`` instead. | ++----------------------------+---------+--------------------------------------------------+ +| ``constructor-visibility`` | 0.7.0 | Removes visibility of constructors. | +| | | | ++----------------------------+---------+--------------------------------------------------+ Please read :doc:`0.5.0 release notes <050-breaking-changes>`, :doc:`0.6.0 release notes <060-breaking-changes>` and diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index 5da2fc7990fc..1b56f73a75b4 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -132,7 +132,8 @@ class SourceTransform return regex_replace( _location.text(), _regex, - _expression + " " + _keyword + _expression + " " + _keyword, + std::regex_constants::format_first_only ); else solAssert( @@ -274,6 +275,14 @@ class SourceTransform { return regex_replace(_location.text(), std::regex{"now"}, "block.timestamp"); } + + static std::string removeVisibility(langutil::SourceLocation const& _location) + { + std::string replacement = _location.text(); + for (auto const& replace: {"public ", "public", "internal ", "internal", "external ", "external"}) + replacement = regex_replace(replacement, std::regex{replace}, ""); + return replacement; + } }; } diff --git a/tools/solidityUpgrade/SourceUpgrade.cpp b/tools/solidityUpgrade/SourceUpgrade.cpp index 72d9ba19d52e..a7d6916889a0 100644 --- a/tools/solidityUpgrade/SourceUpgrade.cpp +++ b/tools/solidityUpgrade/SourceUpgrade.cpp @@ -198,6 +198,8 @@ Allowed options)", m_suite.activateModule(Module::DotSyntax); else if (module == "now") m_suite.activateModule(Module::NowKeyword); + else if (module == "constructor-visibility") + m_suite.activateModule(Module::ConstrutorVisibility); else { error() << "Unknown upgrade module \"" + module + "\"" << endl; diff --git a/tools/solidityUpgrade/SourceUpgrade.h b/tools/solidityUpgrade/SourceUpgrade.h index 8b82b310e4b2..0f2124bdd3dc 100644 --- a/tools/solidityUpgrade/SourceUpgrade.h +++ b/tools/solidityUpgrade/SourceUpgrade.h @@ -59,7 +59,8 @@ class SourceUpgrade OverridingFunction, VirtualFunction, DotSyntax, - NowKeyword + NowKeyword, + ConstrutorVisibility }; /// Upgrade suite that hosts all available modules. @@ -87,6 +88,8 @@ class SourceUpgrade DotSyntax{m_changes}.analyze(_sourceUnit); if (isActivated(Module::NowKeyword)) NowKeyword{m_changes}.analyze(_sourceUnit); + if (isActivated(Module::ConstrutorVisibility)) + ConstructorVisibility{m_changes}.analyze(_sourceUnit); } void activateModule(Module _module) { m_modules.insert(_module); } @@ -107,7 +110,8 @@ class SourceUpgrade Module::OverridingFunction, Module::VirtualFunction, Module::DotSyntax, - Module::NowKeyword + Module::NowKeyword, + Module::ConstrutorVisibility }; }; diff --git a/tools/solidityUpgrade/Upgrade070.cpp b/tools/solidityUpgrade/Upgrade070.cpp index d71f3685df12..a5ee50c01066 100644 --- a/tools/solidityUpgrade/Upgrade070.cpp +++ b/tools/solidityUpgrade/Upgrade070.cpp @@ -59,3 +59,27 @@ void NowKeyword::endVisit(Identifier const& _identifier) ); } } + +void ConstructorVisibility::endVisit(ContractDefinition const& _contract) +{ + if (!_contract.abstract()) + for (FunctionDefinition const* function: _contract.definedFunctions()) + if ( + function->isConstructor() && + !function->noVisibilitySpecified() && + function->visibility() == Visibility::Internal + ) + m_changes.emplace_back( + UpgradeChange::Level::Safe, + _contract.location(), + SourceTransform::insertBeforeKeyword(_contract.location(), "contract", "abstract") + ); + + for (FunctionDefinition const* function: _contract.definedFunctions()) + if (function->isConstructor() && !function->noVisibilitySpecified()) + m_changes.emplace_back( + UpgradeChange::Level::Safe, + function->location(), + SourceTransform::removeVisibility(function->location()) + ); +} diff --git a/tools/solidityUpgrade/Upgrade070.h b/tools/solidityUpgrade/Upgrade070.h index bfa07ce51788..b99f9d306a00 100644 --- a/tools/solidityUpgrade/Upgrade070.h +++ b/tools/solidityUpgrade/Upgrade070.h @@ -41,4 +41,13 @@ class NowKeyword: public AnalysisUpgrade void endVisit(frontend::Identifier const& _expression) override; }; +class ConstructorVisibility: public AnalysisUpgrade +{ +public: + using AnalysisUpgrade::AnalysisUpgrade; + void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } +private: + void endVisit(frontend::ContractDefinition const& _contract) override; +}; + } From 0a0f578d7c11dfd1878eeaa3ffee2d240b9eb951 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jul 2020 15:10:21 +0200 Subject: [PATCH 345/479] Evaluate keccak256 of string literals at compile-time. --- Changelog.md | 2 ++ libsolidity/codegen/ExpressionCompiler.cpp | 12 ++++--- .../codegen/ir/IRGeneratorForStatements.cpp | 32 ++++++++++++------- .../specialFunctions/keccak256_optimized.sol | 19 +++++++++++ 4 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 test/libsolidity/semanticTests/specialFunctions/keccak256_optimized.sol diff --git a/Changelog.md b/Changelog.md index d427d637f18b..e6e49a3c67a3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ ### 0.6.12 (unreleased) +Compiler Features: + * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index ffa8ced4c426..694ea8fa6fe4 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -792,20 +792,24 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) TypePointer const& argType = arguments.front()->annotation().type; solAssert(argType, ""); arguments.front()->accept(*this); - // Optimization: If type is bytes or string, then do not encode, - // but directly compute keccak256 on memory. - if (*argType == *TypeProvider::bytesMemory() || *argType == *TypeProvider::stringMemory()) + if (auto const* stringLiteral = dynamic_cast(argType)) + // Optimization: Compute keccak256 on string literals at compile-time. + m_context << u256(keccak256(stringLiteral->value())); + else if (*argType == *TypeProvider::bytesMemory() || *argType == *TypeProvider::stringMemory()) { + // Optimization: If type is bytes or string, then do not encode, + // but directly compute keccak256 on memory. ArrayUtils(m_context).retrieveLength(*TypeProvider::bytesMemory()); m_context << Instruction::SWAP1 << u256(0x20) << Instruction::ADD; + m_context << Instruction::KECCAK256; } else { utils().fetchFreeMemoryPointer(); utils().packedEncode({argType}, TypePointers()); utils().toSizeAfterFreeMemoryPointer(); + m_context << Instruction::KECCAK256; } - m_context << Instruction::KECCAK256; break; } case FunctionType::Kind::Log0: diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index c14d6512120e..a8d657b028c9 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1020,18 +1020,28 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) ArrayType const* arrayType = TypeProvider::bytesMemory(); - auto array = convert(*arguments[0], *arrayType); + if (auto const* stringLiteral = dynamic_cast(arguments.front()->annotation().type)) + { + // Optimization: Compute keccak256 on string literals at compile-time. + define(_functionCall) << + ("0x" + keccak256(stringLiteral->value()).hex()) << + "\n"; + } + else + { + auto array = convert(*arguments[0], *arrayType); - define(_functionCall) << - "keccak256(" << - m_utils.arrayDataAreaFunction(*arrayType) << - "(" << - array.commaSeparatedList() << - "), " << - m_utils.arrayLengthFunction(*arrayType) << - "(" << - array.commaSeparatedList() << - "))\n"; + define(_functionCall) << + "keccak256(" << + m_utils.arrayDataAreaFunction(*arrayType) << + "(" << + array.commaSeparatedList() << + "), " << + m_utils.arrayLengthFunction(*arrayType) << + "(" << + array.commaSeparatedList() << + "))\n"; + } break; } case FunctionType::Kind::ArrayPop: diff --git a/test/libsolidity/semanticTests/specialFunctions/keccak256_optimized.sol b/test/libsolidity/semanticTests/specialFunctions/keccak256_optimized.sol new file mode 100644 index 000000000000..cb3c8d608764 --- /dev/null +++ b/test/libsolidity/semanticTests/specialFunctions/keccak256_optimized.sol @@ -0,0 +1,19 @@ +// tests compile-time evaluation of keccak256 on literal strings +contract C { + function short() public pure returns (bool) { + bytes32 a = keccak256("abcdefghijklmn"); + bytes memory s = "abcdefghijklmn"; + return a == keccak256(s); + } + bytes32 constant sc = keccak256("abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn"); + function long() public pure returns (bool, bool) { + bytes32 a = keccak256("abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn"); + bytes memory s = "abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn"; + return (a == keccak256(s), sc == keccak256(s)); + } +} +// ==== +// compileViaYul: also +// ---- +// short() -> true +// long() -> true, true From 83337c850eab317b8d3dcd6b3b54f3b66e48195d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Jul 2020 17:56:14 +0200 Subject: [PATCH 346/479] Do not run tests that do not need options multiple times. --- .circleci/soltest.sh | 2 +- .circleci/soltest_all.sh | 2 +- test/libsolutil/IpfsHash.cpp | 2 +- test/libsolutil/IterateReplacing.cpp | 2 +- test/libsolutil/JSON.cpp | 2 +- test/libsolutil/Keccak256.cpp | 2 +- test/libsolutil/LazyInit.cpp | 2 +- test/libsolutil/StringUtils.cpp | 2 +- test/libsolutil/SwarmHash.cpp | 2 +- test/libsolutil/UTF8.cpp | 2 +- test/libsolutil/Whiskers.cpp | 2 +- test/libyul/StackReuseCodegen.cpp | 2 +- test/yulPhaser/AlgorithmRunner.cpp | 2 +- test/yulPhaser/Chromosome.cpp | 2 +- test/yulPhaser/Common.cpp | 2 +- test/yulPhaser/FitnessMetrics.cpp | 2 +- test/yulPhaser/GeneticAlgorithms.cpp | 2 +- test/yulPhaser/Mutations.cpp | 2 +- test/yulPhaser/PairSelections.cpp | 2 +- test/yulPhaser/Phaser.cpp | 2 +- test/yulPhaser/Population.cpp | 2 +- test/yulPhaser/Program.cpp | 2 +- test/yulPhaser/ProgramCache.cpp | 2 +- test/yulPhaser/Selections.cpp | 2 +- test/yulPhaser/SimulationRNG.cpp | 2 +- test/yulPhaser/TestHelpersTest.cpp | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.circleci/soltest.sh b/.circleci/soltest.sh index f55239e60362..41ab71875026 100755 --- a/.circleci/soltest.sh +++ b/.circleci/soltest.sh @@ -54,7 +54,7 @@ get_logfile_basename() { echo -ne "${filename}" } -BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/`get_logfile_basename`.xml" +BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/`get_logfile_basename`.xml ${BOOST_TEST_ARGS}" SOLTEST_ARGS="--evm-version=$EVM $SOLTEST_FLAGS" test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize" test "${ABI_ENCODER_V2}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv2" diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index 74b3f1197935..94a89704a918 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -30,7 +30,7 @@ REPODIR="$(realpath $(dirname $0)/..)" for OPTIMIZE in 0 1; do for EVM in homestead byzantium constantinople petersburg istanbul; do - EVM=$EVM OPTIMIZE=$OPTIMIZE ${REPODIR}/.circleci/soltest.sh + EVM=$EVM OPTIMIZE=$OPTIMIZE BOOST_TEST_ARGS="-t !@nooptions" ${REPODIR}/.circleci/soltest.sh done done diff --git a/test/libsolutil/IpfsHash.cpp b/test/libsolutil/IpfsHash.cpp index 9d6f0f8fc2cb..40385d43f7e7 100644 --- a/test/libsolutil/IpfsHash.cpp +++ b/test/libsolutil/IpfsHash.cpp @@ -29,7 +29,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(IpfsHash) +BOOST_AUTO_TEST_SUITE(IpfsHash, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(test_small) { diff --git a/test/libsolutil/IterateReplacing.cpp b/test/libsolutil/IterateReplacing.cpp index d1598dbc3981..e28091c7601a 100644 --- a/test/libsolutil/IterateReplacing.cpp +++ b/test/libsolutil/IterateReplacing.cpp @@ -29,7 +29,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(IterateReplacing) +BOOST_AUTO_TEST_SUITE(IterateReplacing, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(no_replacement) { diff --git a/test/libsolutil/JSON.cpp b/test/libsolutil/JSON.cpp index e45c6fdec35d..d0e86c3c7501 100644 --- a/test/libsolutil/JSON.cpp +++ b/test/libsolutil/JSON.cpp @@ -30,7 +30,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(JsonTest) +BOOST_AUTO_TEST_SUITE(JsonTest, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(json_pretty_print) { diff --git a/test/libsolutil/Keccak256.cpp b/test/libsolutil/Keccak256.cpp index 4bb3bddd6a50..bad8510c5e78 100644 --- a/test/libsolutil/Keccak256.cpp +++ b/test/libsolutil/Keccak256.cpp @@ -26,7 +26,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(Keccak256) +BOOST_AUTO_TEST_SUITE(Keccak256, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(empty) { diff --git a/test/libsolutil/LazyInit.cpp b/test/libsolutil/LazyInit.cpp index 346805c82093..ec170946de4c 100644 --- a/test/libsolutil/LazyInit.cpp +++ b/test/libsolutil/LazyInit.cpp @@ -59,7 +59,7 @@ T valueOf(LazyInit _lazyInit) } -BOOST_AUTO_TEST_SUITE(LazyInitTests) +BOOST_AUTO_TEST_SUITE(LazyInitTests, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(default_constructed_is_empty) { diff --git a/test/libsolutil/StringUtils.cpp b/test/libsolutil/StringUtils.cpp index e50260e88b4f..a9c03acd9d34 100644 --- a/test/libsolutil/StringUtils.cpp +++ b/test/libsolutil/StringUtils.cpp @@ -33,7 +33,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(StringUtils) +BOOST_AUTO_TEST_SUITE(StringUtils, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(test_similarity) { diff --git a/test/libsolutil/SwarmHash.cpp b/test/libsolutil/SwarmHash.cpp index a976bfccf0d2..cacb04adfac3 100644 --- a/test/libsolutil/SwarmHash.cpp +++ b/test/libsolutil/SwarmHash.cpp @@ -31,7 +31,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(SwarmHash) +BOOST_AUTO_TEST_SUITE(SwarmHash, *boost::unit_test::label("nooptions")) string bzzr0HashHex(string const& _input) { diff --git a/test/libsolutil/UTF8.cpp b/test/libsolutil/UTF8.cpp index b3e969b9b5e0..94ec6c6d7886 100644 --- a/test/libsolutil/UTF8.cpp +++ b/test/libsolutil/UTF8.cpp @@ -30,7 +30,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(UTF8) +BOOST_AUTO_TEST_SUITE(UTF8, *boost::unit_test::label("nooptions")) namespace { diff --git a/test/libsolutil/Whiskers.cpp b/test/libsolutil/Whiskers.cpp index 093b0acb69fd..3ed87acb9a35 100644 --- a/test/libsolutil/Whiskers.cpp +++ b/test/libsolutil/Whiskers.cpp @@ -29,7 +29,7 @@ using namespace std; namespace solidity::util::test { -BOOST_AUTO_TEST_SUITE(WhiskersTest) +BOOST_AUTO_TEST_SUITE(WhiskersTest, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(no_templates) { diff --git a/test/libyul/StackReuseCodegen.cpp b/test/libyul/StackReuseCodegen.cpp index 5103befb03cd..eec882e8c5bf 100644 --- a/test/libyul/StackReuseCodegen.cpp +++ b/test/libyul/StackReuseCodegen.cpp @@ -43,7 +43,7 @@ string assemble(string const& _input) } } -BOOST_AUTO_TEST_SUITE(StackReuseCodegen) +BOOST_AUTO_TEST_SUITE(StackReuseCodegen, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/yulPhaser/AlgorithmRunner.cpp b/test/yulPhaser/AlgorithmRunner.cpp index 042cd4c2bf39..0cd731aefe49 100644 --- a/test/yulPhaser/AlgorithmRunner.cpp +++ b/test/yulPhaser/AlgorithmRunner.cpp @@ -121,7 +121,7 @@ class AlgorithmRunnerAutosaveFixture: public AlgorithmRunnerFixture RandomisingAlgorithm m_algorithm; }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(AlgorithmRunnerTest) BOOST_FIXTURE_TEST_CASE(run_should_call_runNextRound_once_per_round, AlgorithmRunnerFixture) diff --git a/test/yulPhaser/Chromosome.cpp b/test/yulPhaser/Chromosome.cpp index 442f7967f612..94b95d82c2c6 100644 --- a/test/yulPhaser/Chromosome.cpp +++ b/test/yulPhaser/Chromosome.cpp @@ -46,7 +46,7 @@ using namespace solidity::util; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(ChromosomeTest) BOOST_AUTO_TEST_CASE(constructor_should_convert_from_string_to_optimisation_steps) diff --git a/test/yulPhaser/Common.cpp b/test/yulPhaser/Common.cpp index 39e6dd7843fe..b24143a94748 100644 --- a/test/yulPhaser/Common.cpp +++ b/test/yulPhaser/Common.cpp @@ -66,7 +66,7 @@ map const StringToTestEnumMap = invertMap(TestEnumToStringMap) } -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(CommonTest) BOOST_FIXTURE_TEST_CASE(readLinesFromFile_should_return_all_lines_from_a_text_file_as_strings_without_newlines, ReadLinesFromFileFixture) diff --git a/test/yulPhaser/FitnessMetrics.cpp b/test/yulPhaser/FitnessMetrics.cpp index e668b54e9d17..73a92fb40978 100644 --- a/test/yulPhaser/FitnessMetrics.cpp +++ b/test/yulPhaser/FitnessMetrics.cpp @@ -95,7 +95,7 @@ class FitnessMetricCombinationFixture: public ProgramBasedMetricFixture }; }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(FitnessMetricsTest) BOOST_AUTO_TEST_SUITE(ProgramBasedMetricTest) diff --git a/test/yulPhaser/GeneticAlgorithms.cpp b/test/yulPhaser/GeneticAlgorithms.cpp index 12302bb8b107..473a6c0099c6 100644 --- a/test/yulPhaser/GeneticAlgorithms.cpp +++ b/test/yulPhaser/GeneticAlgorithms.cpp @@ -56,7 +56,7 @@ class ClassicGeneticAlgorithmFixture: public GeneticAlgorithmFixture }; }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(GeneticAlgorithmsTest) BOOST_AUTO_TEST_SUITE(RandomAlgorithmTest) diff --git a/test/yulPhaser/Mutations.cpp b/test/yulPhaser/Mutations.cpp index b20cb8e4cb7a..aae16ccedca9 100644 --- a/test/yulPhaser/Mutations.cpp +++ b/test/yulPhaser/Mutations.cpp @@ -33,7 +33,7 @@ using namespace solidity::util; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(MutationsTest) BOOST_AUTO_TEST_SUITE(GeneRandomisationTest) diff --git a/test/yulPhaser/PairSelections.cpp b/test/yulPhaser/PairSelections.cpp index 62a4dd4bcfaf..a63704cf55f0 100644 --- a/test/yulPhaser/PairSelections.cpp +++ b/test/yulPhaser/PairSelections.cpp @@ -31,7 +31,7 @@ using namespace std; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(PairSelectionsTest) BOOST_AUTO_TEST_SUITE(RandomPairSelectionTest) diff --git a/test/yulPhaser/Phaser.cpp b/test/yulPhaser/Phaser.cpp index 5cef037786a8..f1e0fd96a389 100644 --- a/test/yulPhaser/Phaser.cpp +++ b/test/yulPhaser/Phaser.cpp @@ -103,7 +103,7 @@ class PoulationFactoryFixture }; }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(PhaserTest) BOOST_AUTO_TEST_SUITE(GeneticAlgorithmFactoryTest) diff --git a/test/yulPhaser/Population.cpp b/test/yulPhaser/Population.cpp index 5fd8c2073cf1..fb6d45940dd3 100644 --- a/test/yulPhaser/Population.cpp +++ b/test/yulPhaser/Population.cpp @@ -59,7 +59,7 @@ class PopulationFixture shared_ptr m_fitnessMetric = make_shared(); }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(PopulationTest) BOOST_AUTO_TEST_CASE(isFitter_should_use_fitness_as_the_main_criterion) diff --git a/test/yulPhaser/Program.cpp b/test/yulPhaser/Program.cpp index 0a7520dd7b7c..d951c4e4e697 100644 --- a/test/yulPhaser/Program.cpp +++ b/test/yulPhaser/Program.cpp @@ -57,7 +57,7 @@ namespace namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(ProgramTest) BOOST_AUTO_TEST_CASE(copy_constructor_should_make_deep_copy_of_ast) diff --git a/test/yulPhaser/ProgramCache.cpp b/test/yulPhaser/ProgramCache.cpp index 3b652e3fbffa..da4b7c18cd06 100644 --- a/test/yulPhaser/ProgramCache.cpp +++ b/test/yulPhaser/ProgramCache.cpp @@ -70,7 +70,7 @@ class ProgramCacheFixture ProgramCache m_programCache{m_program}; }; -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(ProgramCacheTest) BOOST_AUTO_TEST_CASE(CacheStats_operator_plus_should_add_stats_together) diff --git a/test/yulPhaser/Selections.cpp b/test/yulPhaser/Selections.cpp index d25766ae6284..7fdea619234a 100644 --- a/test/yulPhaser/Selections.cpp +++ b/test/yulPhaser/Selections.cpp @@ -34,7 +34,7 @@ using namespace solidity::util; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(SelectionsTest) BOOST_AUTO_TEST_SUITE(RangeSelectionTest) diff --git a/test/yulPhaser/SimulationRNG.cpp b/test/yulPhaser/SimulationRNG.cpp index 0cdacc428d63..306074b3c191 100644 --- a/test/yulPhaser/SimulationRNG.cpp +++ b/test/yulPhaser/SimulationRNG.cpp @@ -28,7 +28,7 @@ using namespace std; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(RandomTest) BOOST_AUTO_TEST_CASE(bernoulliTrial_should_produce_samples_with_right_expected_value_and_variance) diff --git a/test/yulPhaser/TestHelpersTest.cpp b/test/yulPhaser/TestHelpersTest.cpp index 7fc4ef0afa90..09b722517315 100644 --- a/test/yulPhaser/TestHelpersTest.cpp +++ b/test/yulPhaser/TestHelpersTest.cpp @@ -34,7 +34,7 @@ namespace fs = boost::filesystem; namespace solidity::phaser::test { -BOOST_AUTO_TEST_SUITE(Phaser) +BOOST_AUTO_TEST_SUITE(Phaser, *boost::unit_test::label("nooptions")) BOOST_AUTO_TEST_SUITE(TestHelpersTest) BOOST_AUTO_TEST_CASE(ChromosomeLengthMetric_evaluate_should_return_chromosome_length) From d4ecd332477d9ff0ab5ad1d27241d72a8d0b7f90 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jul 2020 11:30:15 +0200 Subject: [PATCH 347/479] Propagate function call argument types across function call options. --- Changelog.md | 2 ++ libsolidity/analysis/TypeChecker.cpp | 2 ++ .../functionCall/call_options_overload.sol | 14 ++++++++++++++ .../functionCalls/call_options_overload.sol | 9 --------- 4 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 test/libsolidity/semanticTests/functionCall/call_options_overload.sol delete mode 100644 test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol diff --git a/Changelog.md b/Changelog.md index e6e49a3c67a3..9795ecb51887 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,8 @@ Compiler Features: * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. +Bugfixes: + * Type Checker: Fix overload resolution in combination with ``{value: ...}``. ### 0.6.11 (2020-07-07) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 5c49bf1dc50c..6bb9dd39fc11 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2354,6 +2354,8 @@ bool TypeChecker::visit(FunctionCallOptions const& _functionCallOptions) { solAssert(_functionCallOptions.options().size() == _functionCallOptions.names().size(), "Lengths of name & value arrays differ!"); + _functionCallOptions.expression().annotation().arguments = _functionCallOptions.annotation().arguments; + _functionCallOptions.expression().accept(*this); auto expressionFunctionType = dynamic_cast(type(_functionCallOptions.expression())); diff --git a/test/libsolidity/semanticTests/functionCall/call_options_overload.sol b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol new file mode 100644 index 000000000000..27e8e4127fdb --- /dev/null +++ b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol @@ -0,0 +1,14 @@ +contract C { + function f(uint x) external payable returns (uint) { return 1; } + function f(uint x, uint y) external payable returns (uint) { return 2; } + function call() public payable returns (uint v, uint x, uint y, uint z) { + v = this.f{value: 10}(2); + x = this.f{gas: 1000}(2, 3); + y = this.f{gas: 1000, value: 10}(2, 3); + z = this.f{gas: 1000}{value: 10}(2, 3); + } + receive() external payable {} +} +// ---- +// (), 1 ether +// call() -> 1, 2, 2, 2 diff --git a/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol b/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol deleted file mode 100644 index 11021f7d7f44..000000000000 --- a/test/libsolidity/syntaxTests/functionCalls/call_options_overload.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract C { - function f(uint x) external payable { } - function f(uint x, uint y) external payable { } - function call() internal { - this.f{value: 10}(2); - } -} -// ---- -// TypeError 6675: (148-154): Member "f" not unique after argument-dependent lookup in contract C. From 8eb459c825f544c32747bb69be1e4aabd77aa23a Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 Jul 2020 14:38:36 +0200 Subject: [PATCH 348/479] Disallow dot in inline assembly identifiers. --- Changelog.md | 1 + libsolidity/analysis/ReferencesResolver.cpp | 17 +++++++++++++++-- libsolidity/analysis/ReferencesResolver.h | 3 +++ .../inlineAssembly/invalid/dot_in_fun_param.sol | 12 ++++++++++++ .../inlineAssembly/invalid/dot_in_fundecl.sol | 11 +++++++++++ .../invalid/dot_in_multi_vardecl.sol | 11 +++++++++++ .../inlineAssembly/invalid/dot_in_vardecl.sol | 15 +++++++++++++++ .../invalid/identifier_starting_with_dot.sol | 9 +++++++++ .../shadowing/name_clash_in_import.sol | 1 + .../shadowing/no_name_clash_in_import.sol | 1 - .../shadowing/qualified_names.sol | 2 ++ 11 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fun_param.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fundecl.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_multi_vardecl.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_vardecl.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/identifier_starting_with_dot.sol diff --git a/Changelog.md b/Changelog.md index dc7dcc94cef9..1d3212e185a3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Breaking changes: * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. * Type Checker: Disallow assignments to state variables that contain nested mappings. + * Inline Assembly: Disallow `.` in user-defined function and variable names. Language Features: * Yul: Disallow EVM instruction `pc()`. diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 408a7ff83782..a0d70fd8fa8d 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -38,9 +38,8 @@ using namespace std; using namespace solidity::langutil; +using namespace solidity::frontend; -namespace solidity::frontend -{ bool ReferencesResolver::resolve(ASTNode const& _root) { @@ -184,6 +183,10 @@ bool ReferencesResolver::visit(Return const& _return) void ReferencesResolver::operator()(yul::FunctionDefinition const& _function) { + validateYulIdentifierName(_function.name, _function.location); + for (yul::TypedName const& varName: _function.parameters + _function.returnVariables) + validateYulIdentifierName(varName.name, varName.location); + bool wasInsideFunction = m_yulInsideFunction; m_yulInsideFunction = true; this->operator()(_function.body); @@ -249,6 +252,8 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) { for (auto const& identifier: _varDecl.variables) { + validateYulIdentifierName(identifier.name, identifier.location); + bool isSlot = boost::algorithm::ends_with(identifier.name.str(), "_slot"); bool isOffset = boost::algorithm::ends_with(identifier.name.str(), "_offset"); @@ -283,4 +288,12 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) visit(*_varDecl.value); } +void ReferencesResolver::validateYulIdentifierName(yul::YulString _name, SourceLocation const& _location) +{ + if (util::contains(_name.str(), '.')) + m_errorReporter.declarationError( + 3927_error, + _location, + "User-defined identifiers in inline assembly cannot contain '.'." + ); } diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 7da745cc5e4c..6b496eda9972 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -88,6 +88,9 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker void operator()(yul::Identifier const& _identifier) override; void operator()(yul::VariableDeclaration const& _varDecl) override; + /// Checks if the name contains a '.'. + void validateYulIdentifierName(yul::YulString _name, langutil::SourceLocation const& _location); + langutil::ErrorReporter& m_errorReporter; NameAndTypeResolver& m_resolver; langutil::EVMVersion m_evmVersion; diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fun_param.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fun_param.sol new file mode 100644 index 000000000000..e6644e9da685 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fun_param.sol @@ -0,0 +1,12 @@ +contract C { + function f() public pure { + assembly { + function f(a., x.b) -> t.b, b.. {} + } + } +} +// ---- +// DeclarationError 3927: (74-76): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (78-81): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (86-89): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (91-94): User-defined identifiers in inline assembly cannot contain '.'. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fundecl.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fundecl.sol new file mode 100644 index 000000000000..2e8118b78784 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_fundecl.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure { + assembly { + function f.() {} + function g.f() {} + } + } +} +// ---- +// DeclarationError 3927: (63-79): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (86-103): User-defined identifiers in inline assembly cannot contain '.'. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_multi_vardecl.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_multi_vardecl.sol new file mode 100644 index 000000000000..58efb2de6402 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_multi_vardecl.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure { + assembly { + function f() -> x, y, z {} + let a., aa.b := f() + } + } +} +// ---- +// DeclarationError 3927: (100-102): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (104-108): User-defined identifiers in inline assembly cannot contain '.'. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_vardecl.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_vardecl.sol new file mode 100644 index 000000000000..0537afb74466 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/dot_in_vardecl.sol @@ -0,0 +1,15 @@ +contract C { + function f() public pure { + assembly { + let a. := 2 + let a.. := 2 + let a.b := 2 + let a..b := 2 + } + } +} +// ---- +// DeclarationError 3927: (67-69): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (85-88): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (104-107): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (123-127): User-defined identifiers in inline assembly cannot contain '.'. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/identifier_starting_with_dot.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/identifier_starting_with_dot.sol new file mode 100644 index 000000000000..0122dc4dbaf3 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/identifier_starting_with_dot.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure { + assembly { + let a, .a, aa.b := f() + } + } +} +// ---- +// ParserError 2314: (70-71): Expected identifier but got '.' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol index 50a1b749cd31..e0ae12e95162 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol @@ -15,4 +15,5 @@ contract B { } // ---- // DeclarationError 3859: (b:105-106): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3927: (b:128-131): User-defined identifiers in inline assembly cannot contain '.'. // DeclarationError 3859: (b:128-131): The prefix of this declaration conflicts with a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/no_name_clash_in_import.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/no_name_clash_in_import.sol index 86426aad9b35..bb593da64ebd 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/no_name_clash_in_import.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/no_name_clash_in_import.sol @@ -9,7 +9,6 @@ contract B { function f() public pure { assembly { let A := 1 - let A.b := 2 } } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol index 7fba010f55ad..2f54bab68b13 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol @@ -10,5 +10,7 @@ contract C { } } // ---- +// DeclarationError 3927: (115-118): User-defined identifiers in inline assembly cannot contain '.'. // DeclarationError 3859: (115-118): The prefix of this declaration conflicts with a declaration outside the inline assembly block. +// DeclarationError 3927: (140-143): User-defined identifiers in inline assembly cannot contain '.'. // DeclarationError 3859: (140-143): The prefix of this declaration conflicts with a declaration outside the inline assembly block. From d3abbd5610824ad82337d9926655da02d45063ea Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Jul 2020 20:13:11 +0200 Subject: [PATCH 349/479] Remove unneccessary masking of tags. --- Changelog.md | 1 + libevmasm/PeepholeOptimiser.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 9795ecb51887..ca81e04d8631 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ Compiler Features: * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. + * Peephole Optimizer: Remove unnecessary masking of tags. Bugfixes: * Type Checker: Fix overload resolution in combination with ``{value: ...}``. diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 861cae0f2bdf..dd5f9399cbec 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -266,9 +266,10 @@ struct TagConjunctions: SimplePeepholeOptimizerMethod std::back_insert_iterator _out ) { + if (_and != Instruction::AND) + return false; if ( _pushTag.type() == PushTag && - _and == Instruction::AND && _pushConstant.type() == Push && (_pushConstant.data() & u256(0xFFFFFFFF)) == u256(0xFFFFFFFF) ) @@ -276,6 +277,16 @@ struct TagConjunctions: SimplePeepholeOptimizerMethod *_out = _pushTag; return true; } + else if ( + // tag and constant are swapped + _pushConstant.type() == PushTag && + _pushTag.type() == Push && + (_pushTag.data() & u256(0xFFFFFFFF)) == u256(0xFFFFFFFF) + ) + { + *_out = _pushConstant; + return true; + } else return false; } From 59f4989966ead898cc2a048a73361d6c996a8320 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 4 Jun 2020 11:11:53 +0200 Subject: [PATCH 350/479] Optimize combination of byte and shl. --- .gitignore | 2 +- Changelog.md | 3 ++ libevmasm/RuleList.h | 14 ++++++ test/formal/combine_byte_shl.py | 29 ++++++++++++ test/formal/combine_byte_shr_1.py | 30 +++++++++++++ test/formal/combine_byte_shr_2.py | 30 +++++++++++++ test/formal/opcodes.py | 4 ++ .../semanticTests/optimizer/shift_bytes.sol | 44 +++++++++++++++++++ 8 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 test/formal/combine_byte_shl.py create mode 100644 test/formal/combine_byte_shr_1.py create mode 100644 test/formal/combine_byte_shr_2.py create mode 100644 test/libsolidity/semanticTests/optimizer/shift_bytes.sol diff --git a/.gitignore b/.gitignore index f6eeba75fffa..67e4507591ab 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,7 @@ build/ build*/ emscripten_build/ docs/_build -docs/utils/__pycache__ +__pycache__ docs/utils/*.pyc /deps/downloads/ deps/install diff --git a/Changelog.md b/Changelog.md index 9795ecb51887..7b0a87a9abef 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,9 @@ Compiler Features: Bugfixes: * Type Checker: Fix overload resolution in combination with ``{value: ...}``. +Compiler Features: + * Optimizer: Add rule to remove shifts inside the byte opcode. + ### 0.6.11 (2020-07-07) diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index e29141b494ad..9442524b10d0 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -571,6 +571,20 @@ std::vector> simplificationRuleListPart7( feasibilityFunction }); + rules.push_back({ + Builtins::BYTE(A, Builtins::SHL(B, X)), + [=]() -> Pattern { return Builtins::BYTE(A.d() + B.d() / 8, X); }, + false, + [=] { return B.d() % 8 == 0 && A.d() <= 32 && B.d() <= 256; } + }); + + rules.push_back({ + Builtins::BYTE(A, Builtins::SHR(B, X)), + [=]() -> Pattern { return A.d() < B.d() / 8 ? Word(0) : Builtins::BYTE(A.d() - B.d() / 8, X); }, + false, + [=] { return B.d() % 8 == 0 && A.d() < Pattern::WordSize / 8 && B.d() <= Pattern::WordSize; } + }); + return rules; } diff --git a/test/formal/combine_byte_shl.py b/test/formal/combine_byte_shl.py new file mode 100644 index 000000000000..e2a6034ffd33 --- /dev/null +++ b/test/formal/combine_byte_shl.py @@ -0,0 +1,29 @@ +from rule import Rule +from opcodes import * + +""" +byte(A, shl(B, X)) +given B % 8 == 0 && A <= 32 && B <= 256 +-> +byte(A + B / 8, X) +""" + +rule = Rule() + +n_bits = 256 + +# Input vars +X = BitVec('X', n_bits) +A = BitVec('A', n_bits) +B = BitVec('B', n_bits) + +# Non optimized result +nonopt = BYTE(A, SHL(B, X)) +# Optimized result +opt = BYTE(A + B / 8, X) + +rule.require(B % 8 == 0) +rule.require(ULE(A, 32)) +rule.require(ULE(B, 256)) + +rule.check(nonopt, opt) diff --git a/test/formal/combine_byte_shr_1.py b/test/formal/combine_byte_shr_1.py new file mode 100644 index 000000000000..4938e73f75c0 --- /dev/null +++ b/test/formal/combine_byte_shr_1.py @@ -0,0 +1,30 @@ +from rule import Rule +from opcodes import * + +""" +byte(A, shr(B, X)) +given B % 8 == 0 && A < n_bits/8 && B <= n_bits && A >= B / 8 +-> +byte(A - B / 8, X) +""" + +rule = Rule() + +n_bits = 256 + +# Input vars +X = BitVec('X', n_bits) +A = BitVec('A', n_bits) +B = BitVec('B', n_bits) + +# Non optimized result +nonopt = BYTE(A, SHR(B, X)) +# Optimized result +opt = BYTE(A - B / 8, X) + +rule.require(B % 8 == 0) +rule.require(ULT(A, n_bits/8)) +rule.require(ULE(B, n_bits)) +rule.require(UGE(A, DIV(B,8))) + +rule.check(nonopt, opt) diff --git a/test/formal/combine_byte_shr_2.py b/test/formal/combine_byte_shr_2.py new file mode 100644 index 000000000000..d74114e855ab --- /dev/null +++ b/test/formal/combine_byte_shr_2.py @@ -0,0 +1,30 @@ +from rule import Rule +from opcodes import * + +""" +byte(A, shr(B, X)) +given B % 8 == 0 && A < n_bits/8 && B <= n_bits && A < B / 8 +-> +0 +""" + +rule = Rule() + +n_bits = 256 + +# Input vars +X = BitVec('X', n_bits) +A = BitVec('A', n_bits) +B = BitVec('B', n_bits) + +# Non optimized result +nonopt = BYTE(A, SHR(B, X)) +# Optimized result +opt = 0 + +rule.require(B % 8 == 0) +rule.require(ULT(A, n_bits/8)) +rule.require(ULE(B, n_bits)) +rule.require(ULT(A, DIV(B,8))) + +rule.check(nonopt, opt) diff --git a/test/formal/opcodes.py b/test/formal/opcodes.py index 589bd9520bb5..24d53484bdac 100644 --- a/test/formal/opcodes.py +++ b/test/formal/opcodes.py @@ -56,3 +56,7 @@ def SHR(x, y): def SAR(x, y): return y >> x + +def BYTE(i, x): + bit = (i + 1) * 8 + return If(UGT(bit, x.size()), BitVecVal(0, x.size()), (LShR(x, (x.size() - bit))) & 0xff) diff --git a/test/libsolidity/semanticTests/optimizer/shift_bytes.sol b/test/libsolidity/semanticTests/optimizer/shift_bytes.sol new file mode 100644 index 000000000000..5a85160f96be --- /dev/null +++ b/test/libsolidity/semanticTests/optimizer/shift_bytes.sol @@ -0,0 +1,44 @@ +// This tests the optimizer rule +// byte(A, shl(B, X)) +// -> +// byte(A + B / 8, X) +// given A <= 32 && B % 8 == 0 && B <= 256 +// +// and the respective rule about shr +contract C { + function f(uint a) public returns (uint, uint, uint) { + uint x = a << (256 - 8); + assembly { + x := byte(0, x) + } + uint y = a << 8; + assembly { + y := byte(30, y) + } + uint z = a << 16; + assembly { + z := byte(1, z) + } + return (x, y, z); + } + function g(uint a) public returns (uint, uint, uint) { + uint x = a >> (256 - 16); + assembly { + x := byte(31, x) + } + uint y = a >> 8; + assembly { + y := byte(4, y) + } + uint z = a >> 16; + assembly { + z := byte(7, z) + } + return (x, y, z); + } +} +// ==== +// compileViaYul: also +// ---- +// f(uint256): 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -> 0x1f, 0x1f, 3 +// g(uint256): 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -> 1, 3, 5 From fe5bcf759e607f6685ad0822fb877864b000d2a1 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 8 Jul 2020 22:57:36 +0200 Subject: [PATCH 351/479] Run proof script only on existing files. --- scripts/run_proofs.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/run_proofs.sh b/scripts/run_proofs.sh index bc6cd8e8ac4a..db6b0e02b289 100755 --- a/scripts/run_proofs.sh +++ b/scripts/run_proofs.sh @@ -10,16 +10,18 @@ git fetch origin error=0 for new_proof in $(git diff origin/develop --name-only test/formal/) do - set +e - echo "Proving $new_proof..." - output=$(python3 "$new_proof") - result=$? - set -e + if [ -e "$new_proof" ]; then + set +e + echo "Proving $new_proof..." + output=$(python3 "$new_proof") + result=$? + set -e - if [[ "$result" != 0 ]] - then - echo "Proof $(basename "$new_proof" ".py") failed: $output." - error=1 + if [[ "$result" != 0 ]] + then + echo "Proof $(basename "$new_proof" ".py") failed: $output." + error=1 + fi fi done From 72721293548d89d089195e73c263efab01c5d27d Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Mon, 18 Nov 2019 12:12:30 +0100 Subject: [PATCH 352/479] yul fuzzer: Add framework for yul optimizer custom mutation routines Co-authored-by: Leonardo --- .circleci/config.yml | 1 + test/tools/ossfuzz/CMakeLists.txt | 23 ++- .../ossfuzz/protomutators/YulProtoMutator.cpp | 147 ++++++++++++++++++ .../ossfuzz/protomutators/YulProtoMutator.h | 98 ++++++++++++ 4 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 test/tools/ossfuzz/protomutators/YulProtoMutator.cpp create mode 100644 test/tools/ossfuzz/protomutators/YulProtoMutator.h diff --git a/.circleci/config.yml b/.circleci/config.yml index 5157f06615f0..d17f13baadd4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,6 +97,7 @@ defaults: - test/tools/ossfuzz/strictasm_diff_ossfuzz - test/tools/ossfuzz/strictasm_opt_ossfuzz - test/tools/ossfuzz/yul_proto_diff_ossfuzz + - test/tools/ossfuzz/yul_proto_diff_custom_mutate_ossfuzz - test/tools/ossfuzz/yul_proto_ossfuzz - test/tools/ossfuzz/sol_proto_ossfuzz diff --git a/test/tools/ossfuzz/CMakeLists.txt b/test/tools/ossfuzz/CMakeLists.txt index ccd71a983c82..8a33f1f7c80c 100644 --- a/test/tools/ossfuzz/CMakeLists.txt +++ b/test/tools/ossfuzz/CMakeLists.txt @@ -10,7 +10,12 @@ add_dependencies(ossfuzz if (OSSFUZZ) add_custom_target(ossfuzz_proto) - add_dependencies(ossfuzz_proto yul_proto_ossfuzz yul_proto_diff_ossfuzz sol_proto_ossfuzz) + add_dependencies(ossfuzz_proto + sol_proto_ossfuzz + yul_proto_ossfuzz + yul_proto_diff_ossfuzz + yul_proto_diff_custom_mutate_ossfuzz + ) add_custom_target(ossfuzz_abiv2) add_dependencies(ossfuzz_abiv2 abiv2_proto_ossfuzz) @@ -60,6 +65,22 @@ if (OSSFUZZ) ) set_target_properties(yul_proto_diff_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(yul_proto_diff_custom_mutate_ossfuzz + yulProto_diff_ossfuzz.cpp + yulFuzzerCommon.cpp + protoToYul.cpp + yulProto.pb.cc + protomutators/YulProtoMutator.cpp +) + target_include_directories(yul_proto_diff_custom_mutate_ossfuzz PRIVATE /usr/include/libprotobuf-mutator) + target_link_libraries(yul_proto_diff_custom_mutate_ossfuzz PRIVATE yul + yulInterpreter + protobuf-mutator-libfuzzer.a + protobuf-mutator.a + protobuf.a +) + set_target_properties(yul_proto_diff_custom_mutate_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(abiv2_proto_ossfuzz ../../EVMHost.cpp abiV2ProtoFuzzer.cpp diff --git a/test/tools/ossfuzz/protomutators/YulProtoMutator.cpp b/test/tools/ossfuzz/protomutators/YulProtoMutator.cpp new file mode 100644 index 000000000000..32fda663d56b --- /dev/null +++ b/test/tools/ossfuzz/protomutators/YulProtoMutator.cpp @@ -0,0 +1,147 @@ +#include + +#include + +#include + +using namespace solidity::yul::test::yul_fuzzer; +using namespace protobuf_mutator; +using namespace std; + +using YPM = YulProtoMutator; + +MutationInfo::MutationInfo(ProtobufMessage const* _message, string const& _info): + ScopeGuard([&]{ exitInfo(); }), + m_protobufMsg(_message) +{ + writeLine("----------------------------------"); + writeLine("YULMUTATOR: " + _info); + writeLine("Before"); + writeLine(SaveMessageAsText(*m_protobufMsg)); +} + +void MutationInfo::exitInfo() +{ + writeLine("After"); + writeLine(SaveMessageAsText(*m_protobufMsg)); +} + +/// Initialize deterministic PRNG. +static YulRandomNumGenerator s_rand(1337); + +/// Add m/sstore(0, variable) +static LPMPostProcessor addStoreToZero( + [](Block* _message, unsigned _seed) + { + if (_seed % YPM::s_highIP == 0) + { + MutationInfo m{_message, "Added store to zero"}; + auto storeStmt = new StoreFunc(); + storeStmt->set_st(YPM::EnumTypeConverter{}.enumFromSeed(s_rand())); + storeStmt->set_allocated_loc(YPM::litExpression(0)); + storeStmt->set_allocated_val(YPM::refExpression(s_rand)); + auto stmt = _message->add_statements(); + stmt->set_allocated_storage_func(storeStmt); + } + } +); + +Literal* YPM::intLiteral(unsigned _value) +{ + auto lit = new Literal(); + lit->set_intval(_value); + return lit; +} + +VarRef* YPM::varRef(unsigned _seed) +{ + auto varref = new VarRef(); + varref->set_varnum(_seed); + return varref; +} + +Expression* YPM::refExpression(YulRandomNumGenerator& _rand) +{ + auto refExpr = new Expression(); + refExpr->set_allocated_varref(varRef(_rand())); + return refExpr; +} + +Expression* YPM::litExpression(unsigned _value) +{ + auto lit = intLiteral(_value); + auto expr = new Expression(); + expr->set_allocated_cons(lit); + return expr; +} + +template +T YPM::EnumTypeConverter::validEnum(unsigned _seed) +{ + auto ret = static_cast(_seed % (enumMax() - enumMin() + 1) + enumMin()); + if constexpr (std::is_same_v, FunctionCall_Returns>) + yulAssert(FunctionCall_Returns_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, StoreFunc_Storage>) + yulAssert(StoreFunc_Storage_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, NullaryOp_NOp>) + yulAssert(NullaryOp_NOp_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, BinaryOp_BOp>) + yulAssert(BinaryOp_BOp_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, UnaryOp_UOp>) + yulAssert(UnaryOp_UOp_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, LowLevelCall_Type>) + yulAssert(LowLevelCall_Type_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, Create_Type>) + yulAssert(Create_Type_IsValid(ret), "Yul proto mutator: Invalid enum"); + else if constexpr (std::is_same_v, UnaryOpData_UOpData>) + yulAssert(UnaryOpData_UOpData_IsValid(ret), "Yul proto mutator: Invalid enum"); + else + static_assert(AlwaysFalse::value, "Yul proto mutator: non-exhaustive visitor."); + return ret; +} + +template +unsigned YPM::EnumTypeConverter::enumMax() +{ + if constexpr (std::is_same_v, FunctionCall_Returns>) + return FunctionCall_Returns_Returns_MAX; + else if constexpr (std::is_same_v, StoreFunc_Storage>) + return StoreFunc_Storage_Storage_MAX; + else if constexpr (std::is_same_v, NullaryOp_NOp>) + return NullaryOp_NOp_NOp_MAX; + else if constexpr (std::is_same_v, BinaryOp_BOp>) + return BinaryOp_BOp_BOp_MAX; + else if constexpr (std::is_same_v, UnaryOp_UOp>) + return UnaryOp_UOp_UOp_MAX; + else if constexpr (std::is_same_v, LowLevelCall_Type>) + return LowLevelCall_Type_Type_MAX; + else if constexpr (std::is_same_v, Create_Type>) + return Create_Type_Type_MAX; + else if constexpr (std::is_same_v, UnaryOpData_UOpData>) + return UnaryOpData_UOpData_UOpData_MAX; + else + static_assert(AlwaysFalse::value, "Yul proto mutator: non-exhaustive visitor."); +} + +template +unsigned YPM::EnumTypeConverter::enumMin() +{ + if constexpr (std::is_same_v, FunctionCall_Returns>) + return FunctionCall_Returns_Returns_MIN; + else if constexpr (std::is_same_v, StoreFunc_Storage>) + return StoreFunc_Storage_Storage_MIN; + else if constexpr (std::is_same_v, NullaryOp_NOp>) + return NullaryOp_NOp_NOp_MIN; + else if constexpr (std::is_same_v, BinaryOp_BOp>) + return BinaryOp_BOp_BOp_MIN; + else if constexpr (std::is_same_v, UnaryOp_UOp>) + return UnaryOp_UOp_UOp_MIN; + else if constexpr (std::is_same_v, LowLevelCall_Type>) + return LowLevelCall_Type_Type_MIN; + else if constexpr (std::is_same_v, Create_Type>) + return Create_Type_Type_MIN; + else if constexpr (std::is_same_v, UnaryOpData_UOpData>) + return UnaryOpData_UOpData_UOpData_MIN; + else + static_assert(AlwaysFalse::value, "Yul proto mutator: non-exhaustive visitor."); +} diff --git a/test/tools/ossfuzz/protomutators/YulProtoMutator.h b/test/tools/ossfuzz/protomutators/YulProtoMutator.h new file mode 100644 index 000000000000..0627a34687fd --- /dev/null +++ b/test/tools/ossfuzz/protomutators/YulProtoMutator.h @@ -0,0 +1,98 @@ +#pragma once + +#include + +#include + +#include + +#include + +namespace solidity::yul::test::yul_fuzzer +{ + +using ProtobufMessage = google::protobuf::Message; + +template +using LPMPostProcessor = protobuf_mutator::libfuzzer::PostProcessorRegistration; + +class MutationInfo: public ScopeGuard +{ +public: + MutationInfo(ProtobufMessage const* _message, std::string const& _info); + + static void writeLine(std::string const& _str) + { + std::cout << _str << std::endl; + } + void exitInfo(); + + ProtobufMessage const* m_protobufMsg; +}; + +struct YulRandomNumGenerator +{ + using RandomEngine = std::minstd_rand; + + explicit YulRandomNumGenerator(unsigned _seed): m_random(RandomEngine(_seed)) {} + + unsigned operator()() + { + return m_random(); + } + + RandomEngine m_random; +}; + +struct YulProtoMutator +{ + /// @param _value: Value of the integer literal + /// @returns an integer literal protobuf message initialized with + /// the given value. + static Literal* intLiteral(unsigned _value); + + /// @param _seed: Pseudo-random unsigned integer used as index + /// of variable to be referenced + /// @returns a variable reference protobuf message. + static VarRef* varRef(unsigned _seed); + + /// @param _value: value of literal expression + /// @returns an expression protobuf message + static Expression* litExpression(unsigned _value); + + /// @param _rand: Pseudo-random number generator + /// of variable to be referenced + /// @returns a variable reference protobuf message + static Expression* refExpression(YulRandomNumGenerator& _rand); + + /// Helper type for type matching visitor. + template struct AlwaysFalse: std::false_type {}; + + /// Template struct for obtaining a valid enum value of + /// template type from a pseudo-random unsigned integer. + /// @param _seed: Pseudo-random integer + /// @returns Valid enum of enum type T + template + struct EnumTypeConverter + { + T enumFromSeed(unsigned _seed) + { + return validEnum(_seed); + } + + /// @returns a valid enum of type T from _seed + T validEnum(unsigned _seed); + /// @returns maximum enum value for enum of type T + static unsigned enumMax(); + /// @returns minimum enum value for enum of type T + static unsigned enumMin(); + }; + + /// Modulo for mutations that should occur rarely + static constexpr unsigned s_lowIP = 31; + /// Modulo for mutations that should occur not too often + static constexpr unsigned s_mediumIP = 29; + /// Modulo for mutations that should occur often + static constexpr unsigned s_highIP = 23; +}; +} From a068583bece4073477eec7df73baf52a76abe0b8 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 9 Jul 2020 14:39:05 +0200 Subject: [PATCH 353/479] Cover cmdlineTests.sh errors --- scripts/error_codes.py | 11 +++++++++++ test/cmdlineTests/error_codes/err | 19 +++++++++++-------- test/cmdlineTests/error_codes/input.sol | 2 -- .../imports/declaration_not_found.sol | 7 +++++++ test/libsolidity/syntaxTests/unexpected.sol | 3 +++ 5 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 test/libsolidity/syntaxTests/imports/declaration_not_found.sol create mode 100644 test/libsolidity/syntaxTests/unexpected.sol diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 7ab136e84c84..da317d45c959 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -127,6 +127,12 @@ def find_ids_in_test_files(file_names): return used_ids +def find_ids_in_cmdline_test_err(file_name): + source = read_file(file_name) + pattern = r' \(\d\d\d\d\):' + return {m.group(0)[-6:-2] for m in re.finditer(pattern, source, flags=re.MULTILINE)} + + def print_ids(ids): for k, id in enumerate(sorted(ids)): if k % 10 > 0: @@ -149,6 +155,11 @@ def examine_id_coverage(top_dir, used_ids): ) covered_ids = find_ids_in_test_files(test_file_names) + # special case, we are interested in warnings which are ignored by regular tests: + # Warning (1878): SPDX license identifier not provided in source file. .... + # Warning (3420): Source file does not specify required compiler version! + covered_ids |= find_ids_in_cmdline_test_err(path.join(top_dir, "test", "cmdlineTests", "error_codes", "err")) + print(f"IDs in source files: {len(used_ids)}") print(f"IDs in test files : {len(covered_ids)} ({len(covered_ids) - len(used_ids)})") print() diff --git a/test/cmdlineTests/error_codes/err b/test/cmdlineTests/error_codes/err index 1d983a7fd19e..a10362a863a8 100644 --- a/test/cmdlineTests/error_codes/err +++ b/test/cmdlineTests/error_codes/err @@ -1,26 +1,29 @@ +Warning (1878): SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. +--> error_codes/input.sol + Error (4937): No visibility specified. Did you intend to add "public"? - --> error_codes/input.sol:4:5: + --> error_codes/input.sol:2:5: | -4 | function f() { +2 | function f() { | ^ (Relevant source part starts here and spans across multiple lines). Warning (3420): Source file does not specify required compiler version! --> error_codes/input.sol Error (4247): Expression has to be an lvalue. - --> error_codes/input.sol:5:9: + --> error_codes/input.sol:3:9: | -5 | 2=0; +3 | 2=0; | ^ Error (7407): Type int_const 0 is not implicitly convertible to expected type int_const 2. - --> error_codes/input.sol:5:11: + --> error_codes/input.sol:3:11: | -5 | 2=0; +3 | 2=0; | ^ Error (2614): Indexed expression has to be a type, mapping or array (is literal_string "") - --> error_codes/input.sol:6:9: + --> error_codes/input.sol:4:9: | -6 | ""[2]; +4 | ""[2]; | ^^ diff --git a/test/cmdlineTests/error_codes/input.sol b/test/cmdlineTests/error_codes/input.sol index 78aceb41f1e3..5ea2800c567c 100644 --- a/test/cmdlineTests/error_codes/input.sol +++ b/test/cmdlineTests/error_codes/input.sol @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: GPL-3.0 - contract C { function f() { 2=0; diff --git a/test/libsolidity/syntaxTests/imports/declaration_not_found.sol b/test/libsolidity/syntaxTests/imports/declaration_not_found.sol new file mode 100644 index 000000000000..b02868e542e0 --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/declaration_not_found.sol @@ -0,0 +1,7 @@ +==== Source: a ==== +contract A { } +==== Source: b ==== +import {C} from "a"; +contract B { } +// ---- +// DeclarationError 2904: (b:0-20): Declaration "C" not found in "a" (referenced as "a"). diff --git a/test/libsolidity/syntaxTests/unexpected.sol b/test/libsolidity/syntaxTests/unexpected.sol new file mode 100644 index 000000000000..79ee1b6cbecb --- /dev/null +++ b/test/libsolidity/syntaxTests/unexpected.sol @@ -0,0 +1,3 @@ +unexpected +// ---- +// ParserError 7858: (0-10): Expected pragma, import directive or contract/interface/library/struct/enum definition. From ec2393d3b656291636f827f81b067caac17bad89 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 9 Jul 2020 14:24:49 +0200 Subject: [PATCH 354/479] Refactor interpreter. --- test/libyul/EwasmTranslationTest.cpp | 4 +- test/libyul/YulInterpreterTest.cpp | 3 +- test/tools/ossfuzz/yulFuzzerCommon.cpp | 3 +- test/tools/yulInterpreter/Interpreter.cpp | 81 +++++++++++------------ test/tools/yulInterpreter/Interpreter.h | 48 +++++++------- test/tools/yulrun.cpp | 5 +- 6 files changed, 69 insertions(+), 75 deletions(-) diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index 8ef5ba0a01a6..9ef203dd0ead 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -99,11 +99,9 @@ string EwasmTranslationTest::interpret() InterpreterState state; state.maxTraceSize = 10000; state.maxSteps = 100000; - WasmDialect dialect; - Interpreter interpreter(state, dialect); try { - interpreter(*m_object->code); + Interpreter::run(state, WasmDialect{}, *m_object->code); } catch (InterpreterTerminatedGeneric const&) { diff --git a/test/libyul/YulInterpreterTest.cpp b/test/libyul/YulInterpreterTest.cpp index 9925b95463f5..fa84c0869997 100644 --- a/test/libyul/YulInterpreterTest.cpp +++ b/test/libyul/YulInterpreterTest.cpp @@ -88,10 +88,9 @@ string YulInterpreterTest::interpret() InterpreterState state; state.maxTraceSize = 10000; state.maxSteps = 10000; - Interpreter interpreter(state, EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion{})); try { - interpreter(*m_ast); + Interpreter::run(state, EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion{}), *m_ast); } catch (InterpreterTerminatedGeneric const&) { diff --git a/test/tools/ossfuzz/yulFuzzerCommon.cpp b/test/tools/ossfuzz/yulFuzzerCommon.cpp index 214caf3f8f53..3682eef48520 100644 --- a/test/tools/ossfuzz/yulFuzzerCommon.cpp +++ b/test/tools/ossfuzz/yulFuzzerCommon.cpp @@ -44,12 +44,11 @@ yulFuzzerUtil::TerminationReason yulFuzzerUtil::interpret( 0xc7, 0x60, 0x5f, 0x7c, 0xcd, 0xfb, 0x92, 0xcd, 0x8e, 0xf3, 0x9b, 0xe4, 0x4f, 0x6c, 0x14, 0xde }; - Interpreter interpreter(state, _dialect); TerminationReason reason = TerminationReason::None; try { - interpreter(*_ast); + Interpreter::run(state, _dialect, *_ast); } catch (StepLimitReached const&) { diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index 5f0861d143dd..cd4fa5d692cf 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -64,6 +64,12 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const _out << " " << slot.first.hex() << ": " << slot.second.hex() << endl; } +void Interpreter::run(InterpreterState& _state, Dialect const& _dialect, Block const& _ast) +{ + Scope scope; + Interpreter{_state, _dialect, scope}(_ast); +} + void Interpreter::operator()(ExpressionStatement const& _expressionStatement) { evaluateMulti(_expressionStatement.expression); @@ -94,8 +100,7 @@ void Interpreter::operator()(VariableDeclaration const& _declaration) YulString varName = _declaration.variables.at(i).name; solAssert(!m_variables.count(varName), ""); m_variables[varName] = values.at(i); - solAssert(!m_scopes.back().count(varName), ""); - m_scopes.back().emplace(varName, nullptr); + m_scope->names.emplace(varName, nullptr); } } @@ -128,8 +133,8 @@ void Interpreter::operator()(ForLoop const& _forLoop) { solAssert(_forLoop.condition, ""); - openScope(); - ScopeGuard g([this]{ closeScope(); }); + enterScope(_forLoop.pre); + ScopeGuard g([this]{ leaveScope(); }); for (auto const& statement: _forLoop.pre.statements) { @@ -176,14 +181,13 @@ void Interpreter::operator()(Block const& _block) m_state.trace.emplace_back("Interpreter execution step limit reached."); throw StepLimitReached(); } - openScope(); + enterScope(_block); // Register functions. for (auto const& statement: _block.statements) if (holds_alternative(statement)) { FunctionDefinition const& funDef = std::get(statement); - solAssert(!m_scopes.back().count(funDef.name), ""); - m_scopes.back().emplace(funDef.name, &funDef); + m_scope->names.emplace(funDef.name, &funDef); } for (auto const& statement: _block.statements) @@ -193,29 +197,41 @@ void Interpreter::operator()(Block const& _block) break; } - closeScope(); + leaveScope(); } u256 Interpreter::evaluate(Expression const& _expression) { - ExpressionEvaluator ev(m_state, m_dialect, m_variables, m_scopes); + ExpressionEvaluator ev(m_state, m_dialect, *m_scope, m_variables); ev.visit(_expression); return ev.value(); } vector Interpreter::evaluateMulti(Expression const& _expression) { - ExpressionEvaluator ev(m_state, m_dialect, m_variables, m_scopes); + ExpressionEvaluator ev(m_state, m_dialect, *m_scope, m_variables); ev.visit(_expression); return ev.values(); } -void Interpreter::closeScope() +void Interpreter::enterScope(Block const& _block) +{ + if (!m_scope->subScopes.count(&_block)) + m_scope->subScopes[&_block] = make_unique(Scope{ + {}, + {}, + m_scope + }); + m_scope = m_scope->subScopes[&_block].get(); +} + +void Interpreter::leaveScope() { - for (auto const& [var, funDeclaration]: m_scopes.back()) + for (auto const& [var, funDeclaration]: m_scope->names) if (!funDeclaration) - solAssert(m_variables.erase(var) == 1, ""); - m_scopes.pop_back(); + m_variables.erase(var); + m_scope = m_scope->parent; + yulAssert(m_scope, ""); } void ExpressionEvaluator::operator()(Literal const& _literal) @@ -253,10 +269,15 @@ void ExpressionEvaluator::operator()(FunctionCall const& _funCall) return; } - auto [functionScopes, fun] = findFunctionAndScope(_funCall.functionName.name); + Scope* scope = &m_scope; + for (; scope; scope = scope->parent) + if (scope->names.count(_funCall.functionName.name)) + break; + yulAssert(scope, ""); - solAssert(fun, "Function not found."); - solAssert(m_values.size() == fun->parameters.size(), ""); + FunctionDefinition const* fun = scope->names.at(_funCall.functionName.name); + yulAssert(fun, "Function not found."); + yulAssert(m_values.size() == fun->parameters.size(), ""); map variables; for (size_t i = 0; i < fun->parameters.size(); ++i) variables[fun->parameters.at(i).name] = m_values.at(i); @@ -264,7 +285,7 @@ void ExpressionEvaluator::operator()(FunctionCall const& _funCall) variables[fun->returnVariables.at(i).name] = 0; m_state.controlFlowState = ControlFlowState::Default; - Interpreter interpreter(m_state, m_dialect, variables, functionScopes); + Interpreter interpreter(m_state, m_dialect, *scope, std::move(variables)); interpreter(fun->body); m_state.controlFlowState = ControlFlowState::Default; @@ -297,27 +318,3 @@ void ExpressionEvaluator::evaluateArgs(vector const& _expr) m_values = std::move(values); std::reverse(m_values.begin(), m_values.end()); } - -pair< - vector>, - FunctionDefinition const* -> ExpressionEvaluator::findFunctionAndScope(YulString _functionName) const -{ - FunctionDefinition const* fun = nullptr; - std::vector> newScopes; - for (auto const& scope: m_scopes) - { - // Copy over all functions. - newScopes.emplace_back(); - for (auto const& [name, funDef]: scope) - if (funDef) - newScopes.back().emplace(name, funDef); - // Stop at the called function. - if (scope.count(_functionName)) - { - fun = scope.at(_functionName); - break; - } - } - return {move(newScopes), fun}; -} diff --git a/test/tools/yulInterpreter/Interpreter.h b/test/tools/yulInterpreter/Interpreter.h index f50cbe6c4a8a..3c9619d21675 100644 --- a/test/tools/yulInterpreter/Interpreter.h +++ b/test/tools/yulInterpreter/Interpreter.h @@ -96,23 +96,37 @@ struct InterpreterState void dumpTraceAndState(std::ostream& _out) const; }; +/** + * Scope structure built and maintained during execution. + */ +struct Scope +{ + /// Used for variables and functions. Value is nullptr for variables. + std::map names; + std::map> subScopes; + Scope* parent = nullptr; +}; + /** * Yul interpreter. */ class Interpreter: public ASTWalker { public: + static void run(InterpreterState& _state, Dialect const& _dialect, Block const& _ast); + Interpreter( InterpreterState& _state, Dialect const& _dialect, - std::map _variables = {}, - std::vector> _scopes = {} + Scope& _scope, + std::map _variables = {} ): m_dialect(_dialect), m_state(_state), m_variables(std::move(_variables)), - m_scopes(std::move(_scopes)) - {} + m_scope(&_scope) + { + } void operator()(ExpressionStatement const& _statement) override; void operator()(Assignment const& _assignment) override; @@ -136,18 +150,14 @@ class Interpreter: public ASTWalker /// Evaluates the expression and returns its value. std::vector evaluateMulti(Expression const& _expression); - void openScope() { m_scopes.emplace_back(); } - /// Unregisters variables and functions. - void closeScope(); + void enterScope(Block const& _block); + void leaveScope(); Dialect const& m_dialect; InterpreterState& m_state; /// Values of variables. std::map m_variables; - /// Scopes of variables and functions. Used for lookup, clearing at end of blocks - /// and passing over the visible functions across function calls. - /// The pointer is nullptr if and only if the key is a variable. - std::vector> m_scopes; + Scope* m_scope; }; /** @@ -159,13 +169,13 @@ class ExpressionEvaluator: public ASTWalker ExpressionEvaluator( InterpreterState& _state, Dialect const& _dialect, - std::map const& _variables, - std::vector> const& _scopes + Scope& _scope, + std::map const& _variables ): m_state(_state), m_dialect(_dialect), m_variables(_variables), - m_scopes(_scopes) + m_scope(_scope) {} void operator()(Literal const&) override; @@ -184,19 +194,11 @@ class ExpressionEvaluator: public ASTWalker /// stores it in m_value. void evaluateArgs(std::vector const& _expr); - /// Finds the function called @a _functionName in the current scope stack and returns - /// the function's scope stack (with variables removed) and definition. - std::pair< - std::vector>, - FunctionDefinition const* - > findFunctionAndScope(YulString _functionName) const; - InterpreterState& m_state; Dialect const& m_dialect; /// Values of variables. std::map const& m_variables; - /// Stack of scopes in the current context. - std::vector> const& m_scopes; + Scope& m_scope; /// Current value of the expression std::vector m_values; }; diff --git a/test/tools/yulrun.cpp b/test/tools/yulrun.cpp index 1e82fba7fc4c..494115540707 100644 --- a/test/tools/yulrun.cpp +++ b/test/tools/yulrun.cpp @@ -88,11 +88,10 @@ void interpret(string const& _source) InterpreterState state; state.maxTraceSize = 10000; - Dialect const& dialect(EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion{})); - Interpreter interpreter(state, dialect); try { - interpreter(*ast); + Dialect const& dialect(EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion{})); + Interpreter::run(state, dialect, *ast); } catch (InterpreterTerminatedGeneric const&) { From 3cf5ed9514211d18d5171f9ddbf849c850fcd1e4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 9 Jul 2020 14:56:34 +0200 Subject: [PATCH 355/479] Use plain strings for comparison. --- .../EwasmBuiltinInterpreter.cpp | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index b09fb5a87381..1d8e29e9183a 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -76,11 +76,12 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a for (u256 const& a: _arguments) arg.emplace_back(uint64_t(a & uint64_t(-1))); - if (_fun == "datasize"_yulstring) + string fun = _fun.str(); + if (fun == "datasize") return u256(keccak256(h256(_arguments.at(0)))) & 0xfff; - else if (_fun == "dataoffset"_yulstring) + else if (fun == "dataoffset") return u256(keccak256(h256(_arguments.at(0) + 2))) & 0xfff; - else if (_fun == "datacopy"_yulstring) + else if (fun == "datacopy") { // This is identical to codecopy. if (accessMemory(_arguments.at(0), _arguments.at(2))) @@ -93,49 +94,49 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a ); return 0; } - else if (_fun == "i32.drop"_yulstring || _fun == "i64.drop"_yulstring || _fun == "nop"_yulstring) + else if (fun == "i32.drop" || fun == "i64.drop" || fun == "nop") return {}; - else if (_fun == "i32.wrap_i64"_yulstring) + else if (fun == "i32.wrap_i64") return arg.at(0) & uint32_t(-1); - else if (_fun == "i64.extend_i32_u"_yulstring) + else if (fun == "i64.extend_i32_u") // Return the same as above because everything is u256 anyway. return arg.at(0) & uint32_t(-1); - else if (_fun == "unreachable"_yulstring) + else if (fun == "unreachable") { logTrace(evmasm::Instruction::INVALID, {}); throw ExplicitlyTerminated(); } - else if (_fun == "i64.store"_yulstring) + else if (fun == "i64.store") { accessMemory(arg[0], 8); writeMemoryWord(arg[0], arg[1]); return 0; } - else if (_fun == "i64.store8"_yulstring || _fun == "i32.store8"_yulstring) + else if (fun == "i64.store8" || fun == "i32.store8") { accessMemory(arg[0], 1); writeMemoryByte(arg[0], static_cast(arg[1] & 0xff)); return 0; } - else if (_fun == "i64.load"_yulstring) + else if (fun == "i64.load") { accessMemory(arg[0], 8); return readMemoryWord(arg[0]); } - else if (_fun == "i32.store"_yulstring) + else if (fun == "i32.store") { accessMemory(arg[0], 4); writeMemoryHalfWord(arg[0], arg[1]); return 0; } - else if (_fun == "i32.load"_yulstring) + else if (fun == "i32.load") { accessMemory(arg[0], 4); return readMemoryHalfWord(arg[0]); } - string prefix = _fun.str(); + string prefix = fun; string suffix; auto dot = prefix.find("."); if (dot != string::npos) From 3c57e047519758be464c3bbb19dc5bb1d798d3ab Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 3 Jun 2020 10:25:46 +0200 Subject: [PATCH 356/479] Adding -Wsign-conversion flag to cmake. --- cmake/EthCompilerSettings.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 1f7600d9b141..3bcdad47bec7 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -50,6 +50,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA add_compile_options(-pedantic) add_compile_options(-Wno-unknown-pragmas) add_compile_options(-Wimplicit-fallthrough) + add_compile_options(-Wsign-conversion) # Configuration-specific compiler settings. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DETH_DEBUG") From 872858078f8e4c583a6a6bf0ba154f143efd9f20 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 9 Jul 2020 16:16:17 +0200 Subject: [PATCH 357/479] Run "options" test first to get early failures. --- .circleci/soltest_all.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index 94a89704a918..86f172a04ca8 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -28,10 +28,10 @@ set -e REPODIR="$(realpath $(dirname $0)/..)" +EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh + for OPTIMIZE in 0 1; do for EVM in homestead byzantium constantinople petersburg istanbul; do EVM=$EVM OPTIMIZE=$OPTIMIZE BOOST_TEST_ARGS="-t !@nooptions" ${REPODIR}/.circleci/soltest.sh done done - -EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh From 6b37f1c02597d40dc3f70b2e17dc6a1bb3916e93 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 1 Jul 2020 16:21:52 +0200 Subject: [PATCH 358/479] Remove visiblity of libraries in inherited contracts. --- Changelog.md | 1 + docs/070-breaking-changes.rst | 1 + docs/contracts/libraries.rst | 5 ++--- libsolidity/ast/Types.cpp | 8 +++----- .../syntaxTests/scoping/library_inherited.sol | 17 +++++++++++++++++ .../syntaxTests/scoping/library_inherited2.sol | 16 ++++++++++++++++ 6 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/syntaxTests/scoping/library_inherited.sol create mode 100644 test/libsolidity/syntaxTests/scoping/library_inherited2.sol diff --git a/Changelog.md b/Changelog.md index 6293fdc4eb02..817016258631 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Breaking changes: * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. * Type Checker: Disallow assignments to state variables that contain nested mappings. + * ``using A for B`` only affects the contract it is mentioned in and not all derived contracts * Inline Assembly: Disallow `.` in user-defined function and variable names. Language Features: diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 31faef694ae7..1c6ba132e425 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -18,5 +18,6 @@ This section gives detailed instructions on how to update prior code for every b * Change ``now`` to ``block.timestamp``. * Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to ``x >> uint(256 - y)``. +* Repeat the ``using A for B`` statements in all derived contracts if needed. * Remove the ``public`` keyword from every constructor. * Remove the ``internal`` keyword from every constructor and add ``abstract`` to the contract (if not already present). diff --git a/docs/contracts/libraries.rst b/docs/contracts/libraries.rst index 5a196e5dcb63..e28a16da2618 100644 --- a/docs/contracts/libraries.rst +++ b/docs/contracts/libraries.rst @@ -30,9 +30,8 @@ not possible to destroy a library. Libraries can be seen as implicit base contracts of the contracts that use them. They will not be explicitly visible in the inheritance hierarchy, but calls to library functions look just like calls to functions of explicit base -contracts (``L.f()`` if ``L`` is the name of the library). Furthermore, -``internal`` functions of libraries are visible in all contracts, just as -if the library were a base contract. Of course, calls to internal functions +contracts (using qualified access like ``L.f()``). +Of course, calls to internal functions use the internal calling convention, which means that all internal types can be passed and types :ref:`stored in memory ` will be passed by reference and not copied. To realize this in the EVM, code of internal library functions diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index ff04e402fd2b..6160238b6998 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -355,11 +355,9 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ASTNode const& _sc if (auto const* sourceUnit = dynamic_cast(&_scope)) usingForDirectives += ASTNode::filteredNodes(sourceUnit->nodes()); else if (auto const* contract = dynamic_cast(&_scope)) - { - for (ContractDefinition const* contract: contract->annotation().linearizedBaseContracts) - usingForDirectives += contract->usingForDirectives(); - usingForDirectives += ASTNode::filteredNodes(contract->sourceUnit().nodes()); - } + usingForDirectives += + contract->usingForDirectives() + + ASTNode::filteredNodes(contract->sourceUnit().nodes()); else solAssert(false, ""); diff --git a/test/libsolidity/syntaxTests/scoping/library_inherited.sol b/test/libsolidity/syntaxTests/scoping/library_inherited.sol new file mode 100644 index 000000000000..60c16d7c48ac --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/library_inherited.sol @@ -0,0 +1,17 @@ +library Lib { + function foo(uint256 value) internal returns (uint256) { + return value + 42; + } +} + +contract A { + using Lib for uint256; +} + +contract B is A { + function bar(uint256 value) public returns (uint256) { + return value.foo(); // Usage of Lib + } +} +// ---- +// TypeError 9582: (246-255): Member "foo" not found or not visible after argument-dependent lookup in uint256. diff --git a/test/libsolidity/syntaxTests/scoping/library_inherited2.sol b/test/libsolidity/syntaxTests/scoping/library_inherited2.sol new file mode 100644 index 000000000000..528ee05f359d --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/library_inherited2.sol @@ -0,0 +1,16 @@ +library Lib { + function foo(uint256 value) internal pure returns (uint256) { + return value + 42; + } +} + +contract A { + using Lib for uint256; +} + +contract B is A { + using Lib for uint256; + function bar(uint256 value) public pure returns (uint256) { + return value.foo(); // Usage of Lib + } +} From 547590b972138ffa2d49a388ccd889d93b024154 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Mon, 15 Jun 2020 12:51:58 +0200 Subject: [PATCH 359/479] Fixing additional signedness errors after adding -Wsign-conversion flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- liblangutil/SemVerHandler.cpp | 6 +++--- libsmtutil/CVC4Interface.cpp | 2 +- libsmtutil/SMTLib2Interface.cpp | 2 +- libsmtutil/Z3Interface.cpp | 2 +- libsolidity/codegen/ContractCompiler.cpp | 2 +- libsolidity/formal/SMTEncoder.cpp | 2 +- libyul/backends/evm/EVMCodeTransform.cpp | 10 +++++----- test/tools/ossfuzz/protoToYul.cpp | 4 ++-- test/tools/ossfuzz/solProtoFuzzer.cpp | 2 +- test/tools/ossfuzz/yulProtoFuzzer.cpp | 2 +- test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp | 2 +- test/yulPhaser/Mutations.cpp | 4 ++-- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/liblangutil/SemVerHandler.cpp b/liblangutil/SemVerHandler.cpp index a626c5aa708b..d997cb073e45 100644 --- a/liblangutil/SemVerHandler.cpp +++ b/liblangutil/SemVerHandler.cpp @@ -245,14 +245,14 @@ unsigned SemVerMatchExpressionParser::parseVersionPart() return 0; else if ('1' <= c && c <= '9') { - unsigned v(c - '0'); + auto v = static_cast(c - '0'); // If we skip to the next token, the current number is terminated. while (m_pos == startPos && '0' <= currentChar() && currentChar() <= '9') { c = currentChar(); - if (v * 10 < v || v * 10 + unsigned(c - '0') < v * 10) + if (v * 10 < v || v * 10 + static_cast(c - '0') < v * 10) throw SemVerError(); - v = v * 10 + unsigned(c - '0'); + v = v * 10 + static_cast(c - '0'); nextChar(); } return v; diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 7735d5a16daa..f58e4680177d 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -191,7 +191,7 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) return m_context.mkExpr(CVC4::kind::BITVECTOR_AND, arguments[0], arguments[1]); else if (n == "int2bv") { - size_t size = std::stoi(_expr.arguments[1].name); + size_t size = std::stoul(_expr.arguments[1].name); auto i2bvOp = m_context.mkConst(CVC4::IntToBitVector(size)); // CVC4 treats all BVs as unsigned, so we need to manually apply 2's complement if needed. return m_context.mkExpr( diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index ce1efb5f6805..1f87b9b72070 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -139,7 +139,7 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) std::string sexpr = "("; if (_expr.name == "int2bv") { - size_t size = std::stoi(_expr.arguments[1].name); + size_t size = std::stoul(_expr.arguments[1].name); auto arg = toSExpr(_expr.arguments.front()); auto int2bv = "(_ int2bv " + to_string(size) + ")"; // Some solvers treat all BVs as unsigned, so we need to manually apply 2's complement if needed. diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index a71d008aba89..c2309ad4fbd3 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -184,7 +184,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) return arguments[0] & arguments[1]; else if (n == "int2bv") { - size_t size = std::stoi(_expr.arguments[1].name); + size_t size = std::stoul(_expr.arguments[1].name); return z3::int2bv(size, arguments[0]); } else if (n == "bv2int") diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 3d1b41e41ff7..ad9c97474bc6 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -646,7 +646,7 @@ bool ContractCompiler::visit(FunctionDefinition const& _function) } else { - m_context << swapInstruction(stackLayout.size() - static_cast(stackLayout.back()) - 1); + m_context << swapInstruction(stackLayout.size() - static_cast(stackLayout.back()) - 1u); swap(stackLayout[static_cast(stackLayout.back())], stackLayout.back()); } for (size_t i = 0; i < stackLayout.size(); ++i) diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 6faaaf600ce8..8e8e34ab29c9 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1253,7 +1253,7 @@ pair SMTEncoder::arithmeticOperation( // - RHS is -1 // the result is then -(type.min), which wraps back to type.min smtutil::Expression maxLeft = _left == smt::minValue(*intType); - smtutil::Expression minusOneRight = _right == -1; + smtutil::Expression minusOneRight = _right == numeric_limits::max(); smtutil::Expression wrap = smtutil::Expression::ite(maxLeft && minusOneRight, smt::minValue(*intType), valueUnbounded); return {wrap, valueUnbounded}; } diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 9182bb393450..6b0f06e019f4 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -165,7 +165,7 @@ void CodeTransform::deleteVariable(Scope::Variable const& _var) { yulAssert(m_allowStackOpt, ""); yulAssert(m_context->variableStackHeights.count(&_var) > 0, ""); - m_unusedStackSlots.insert(m_context->variableStackHeights[&_var]); + m_unusedStackSlots.insert(static_cast(m_context->variableStackHeights[&_var])); m_context->variableStackHeights.erase(&_var); m_context->variableReferences.erase(&_var); m_variablesScheduledForDeletion.erase(&_var); @@ -402,7 +402,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) yulAssert(m_scope->identifiers.count(_function.name), ""); Scope::Function& function = std::get(m_scope->identifiers.at(_function.name)); - int height = m_evm15 ? 0 : 1; + size_t height = m_evm15 ? 0 : 1; yulAssert(m_info.scopes.at(&_function.body), ""); Scope* varScope = m_info.scopes.at(m_info.virtualBlocks.at(&_function).get()).get(); yulAssert(varScope, ""); @@ -420,7 +420,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) else m_assembly.appendLabel(functionEntryID(_function.name, function)); - m_assembly.setStackHeight(height); + m_assembly.setStackHeight(static_cast(height)); for (auto const& v: _function.returnVariables) { @@ -457,7 +457,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) StackTooDeepError error(_error); if (error.functionName.empty()) error.functionName = _function.name; - stackError(std::move(error), height); + stackError(std::move(error), static_cast(height)); } m_assembly.appendLabel(m_context->functionExitPoints.top().label); @@ -502,7 +502,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) } else { - m_assembly.appendInstruction(evmasm::swapInstruction(stackLayout.size() - static_cast(stackLayout.back()) - 1)); + m_assembly.appendInstruction(evmasm::swapInstruction(static_cast(stackLayout.size()) - static_cast(stackLayout.back()) - 1u)); swap(stackLayout[static_cast(stackLayout.back())], stackLayout.back()); } for (size_t i = 0; i < stackLayout.size(); ++i) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 8d5ced0a85f2..05787a2dfc30 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -184,13 +184,13 @@ void ProtoConverter::visit(VarRef const& _x) { // Ensure that there is at least one variable declaration to reference in function scope. yulAssert(m_currentFuncVars.size() > 0, "Proto fuzzer: No variables to reference."); - m_output << *m_currentFuncVars[_x.varnum() % m_currentFuncVars.size()]; + m_output << *m_currentFuncVars[static_cast(_x.varnum()) % m_currentFuncVars.size()]; } else { // Ensure that there is at least one variable declaration to reference in nested scopes. yulAssert(m_currentGlobalVars.size() > 0, "Proto fuzzer: No global variables to reference."); - m_output << *m_currentGlobalVars[_x.varnum() % m_currentGlobalVars.size()]; + m_output << *m_currentGlobalVars[static_cast(_x.varnum()) % m_currentGlobalVars.size()]; } } diff --git a/test/tools/ossfuzz/solProtoFuzzer.cpp b/test/tools/ossfuzz/solProtoFuzzer.cpp index 80facb3e132f..663a94d36fd9 100644 --- a/test/tools/ossfuzz/solProtoFuzzer.cpp +++ b/test/tools/ossfuzz/solProtoFuzzer.cpp @@ -202,7 +202,7 @@ DEFINE_PROTO_FUZZER(Program const& _input) // With libFuzzer binary run this to generate a YUL source file x.yul: // PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input ofstream of(dump_path); - of.write(sol_source.data(), sol_source.size()); + of.write(sol_source.data(), static_cast(sol_source.size())); } if (char const* dump_path = getenv("SOL_DEBUG_FILE")) diff --git a/test/tools/ossfuzz/yulProtoFuzzer.cpp b/test/tools/ossfuzz/yulProtoFuzzer.cpp index b78f6fc5c8bf..cc0205d168e2 100644 --- a/test/tools/ossfuzz/yulProtoFuzzer.cpp +++ b/test/tools/ossfuzz/yulProtoFuzzer.cpp @@ -43,7 +43,7 @@ DEFINE_PROTO_FUZZER(Program const& _input) // With libFuzzer binary run this to generate a YUL source file x.yul: // PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input ofstream of(dump_path); - of.write(yul_source.data(), yul_source.size()); + of.write(yul_source.data(), static_cast(yul_source.size())); } if (yul_source.size() > 1200) diff --git a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp index fd0f2e0a52c4..e5e6b203f790 100644 --- a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp @@ -64,7 +64,7 @@ DEFINE_PROTO_FUZZER(Program const& _input) // With libFuzzer binary run this to generate a YUL source file x.yul: // PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input ofstream of(dump_path); - of.write(yul_source.data(), yul_source.size()); + of.write(yul_source.data(), static_cast(yul_source.size())); } YulStringRepository::reset(); diff --git a/test/yulPhaser/Mutations.cpp b/test/yulPhaser/Mutations.cpp index aae16ccedca9..2d6b65c88c4c 100644 --- a/test/yulPhaser/Mutations.cpp +++ b/test/yulPhaser/Mutations.cpp @@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(alternativeMutations_should_choose_between_mutations_with_g for (size_t i = 0; i < 10; ++i) { Chromosome mutatedChromosome = mutation(chromosome); - cCount += (mutatedChromosome == Chromosome("c") ? 1 : 0); - fCount += (mutatedChromosome == Chromosome("f") ? 1 : 0); + cCount += (mutatedChromosome == Chromosome("c") ? 1u : 0u); + fCount += (mutatedChromosome == Chromosome("f") ? 1u : 0u); } // This particular seed results in 7 "c"s out of 10 which looks plausible given the 80% chance. From a0300835eb7b6c7e26a4cd5757675a5e68988fa8 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 8 Jul 2020 10:47:03 +0100 Subject: [PATCH 360/479] Change CHC to avoid sign mismatch --- libsolidity/formal/CHC.cpp | 4 ++-- libsolidity/formal/CHC.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index c3e9d6cb4763..88f932beceaf 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -990,13 +990,13 @@ vector CHC::initialStateVariables(ContractDefinition const& return stateVariablesAtIndex(0, _contract); } -vector CHC::stateVariablesAtIndex(int _index) +vector CHC::stateVariablesAtIndex(unsigned _index) { solAssert(m_currentContract, ""); return stateVariablesAtIndex(_index, *m_currentContract); } -vector CHC::stateVariablesAtIndex(int _index, ContractDefinition const& _contract) +vector CHC::stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract) { return applyMap( stateVariablesIncludingInheritedAndPrivate(_contract), diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index dcba90606c91..e9357a38d2d8 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -152,8 +152,8 @@ class CHC: public SMTEncoder /// of the current transaction. std::vector initialStateVariables(); std::vector initialStateVariables(ContractDefinition const& _contract); - std::vector stateVariablesAtIndex(int _index); - std::vector stateVariablesAtIndex(int _index, ContractDefinition const& _contract); + std::vector stateVariablesAtIndex(unsigned _index); + std::vector stateVariablesAtIndex(unsigned _index, ContractDefinition const& _contract); /// @returns the current symbolic values of the current state variables. std::vector currentStateVariables(); std::vector currentStateVariables(ContractDefinition const& _contract); From 3781ee6349c2761f78e3a228fa04a068fd1626f0 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 8 Jul 2020 16:43:22 +0200 Subject: [PATCH 361/479] Removing -Wsign-conversion flag for ossfuzz targets --- test/tools/ossfuzz/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/tools/ossfuzz/CMakeLists.txt b/test/tools/ossfuzz/CMakeLists.txt index ccd71a983c82..ca923ae3a271 100644 --- a/test/tools/ossfuzz/CMakeLists.txt +++ b/test/tools/ossfuzz/CMakeLists.txt @@ -8,6 +8,7 @@ add_dependencies(ossfuzz strictasm_assembly_ossfuzz ) + if (OSSFUZZ) add_custom_target(ossfuzz_proto) add_dependencies(ossfuzz_proto yul_proto_ossfuzz yul_proto_diff_ossfuzz sol_proto_ossfuzz) @@ -49,6 +50,7 @@ if (OSSFUZZ) protobuf.a ) set_target_properties(yul_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + target_compile_options(yul_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) add_executable(yul_proto_diff_ossfuzz yulProto_diff_ossfuzz.cpp yulFuzzerCommon.cpp protoToYul.cpp yulProto.pb.cc) target_include_directories(yul_proto_diff_ossfuzz PRIVATE /usr/include/libprotobuf-mutator) @@ -59,6 +61,7 @@ if (OSSFUZZ) protobuf.a ) set_target_properties(yul_proto_diff_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + target_compile_options(yul_proto_diff_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) add_executable(abiv2_proto_ossfuzz ../../EVMHost.cpp @@ -78,6 +81,7 @@ if (OSSFUZZ) protobuf.a ) set_target_properties(abiv2_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + target_compile_options(abiv2_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) add_executable(sol_proto_ossfuzz solProtoFuzzer.cpp @@ -97,6 +101,7 @@ if (OSSFUZZ) protobuf.a ) set_target_properties(sol_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + target_compile_options(sol_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) else() add_library(solc_opt_ossfuzz solc_opt_ossfuzz.cpp From 88030c65683f1f425d6d577609f09691a27d7429 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 10 Jul 2020 10:28:49 +0200 Subject: [PATCH 362/479] [SMTChecker] Refactor verification targets --- libsolidity/formal/BMC.cpp | 30 +++--- libsolidity/formal/BMC.h | 6 +- libsolidity/formal/CHC.cpp | 141 +++++++++++++++++-------- libsolidity/formal/CHC.h | 31 +++++- libsolidity/formal/EncodingContext.cpp | 10 +- libsolidity/formal/EncodingContext.h | 8 +- libsolidity/formal/ModelChecker.cpp | 7 +- libsolidity/formal/SMTEncoder.cpp | 2 +- 8 files changed, 160 insertions(+), 75 deletions(-) diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index 8f74dbb3e8b3..921c71ccf3f6 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -52,11 +52,11 @@ BMC::BMC( #endif } -void BMC::analyze(SourceUnit const& _source, set _safeAssertions) +void BMC::analyze(SourceUnit const& _source, map> _solvedTargets) { solAssert(_source.annotation().experimentalFeatures.count(ExperimentalFeature::SMTChecker), ""); - m_safeAssertions += move(_safeAssertions); + m_solvedTargets = move(_solvedTargets); m_context.setSolver(m_interface.get()); m_context.clear(); m_context.setAssertionAccumulation(true); @@ -684,16 +684,22 @@ void BMC::checkBalance(BMCVerificationTarget& _target) void BMC::checkAssert(BMCVerificationTarget& _target) { solAssert(_target.type == VerificationTarget::Type::Assert, ""); - if (!m_safeAssertions.count(_target.expression)) - checkCondition( - _target.constraints && !_target.value, - _target.callStack, - _target.modelExpressions, - _target.expression->location(), - 4661_error, - 7812_error, - "Assertion violation" - ); + + if ( + m_solvedTargets.count(_target.expression) && + m_solvedTargets.at(_target.expression).count(_target.type) + ) + return; + + checkCondition( + _target.constraints && !_target.value, + _target.callStack, + _target.modelExpressions, + _target.expression->location(), + 4661_error, + 7812_error, + "Assertion violation" + ); } void BMC::addVerificationTarget( diff --git a/libsolidity/formal/BMC.h b/libsolidity/formal/BMC.h index 4f0a980236d4..2eed58101233 100644 --- a/libsolidity/formal/BMC.h +++ b/libsolidity/formal/BMC.h @@ -63,7 +63,7 @@ class BMC: public SMTEncoder smtutil::SMTSolverChoice _enabledSolvers ); - void analyze(SourceUnit const& _sources, std::set _safeAssertions); + void analyze(SourceUnit const& _sources, std::map> _solvedTargets); /// This is used if the SMT solver is not directly linked into this binary. /// @returns a list of inputs to the SMT solver that were not part of the argument to @@ -180,8 +180,8 @@ class BMC: public SMTEncoder std::vector m_verificationTargets; - /// Assertions that are known to be safe. - std::set m_safeAssertions; + /// Targets that were already proven. + std::map> m_solvedTargets; }; } diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index c3e9d6cb4763..336dfaa3751a 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -96,48 +96,7 @@ void CHC::analyze(SourceUnit const& _source) for (auto const* source: sources) source->accept(*this); - for (auto const& [scope, target]: m_verificationTargets) - { - if (target.type == VerificationTarget::Type::Assert) - { - auto assertions = transactionAssertions(scope); - for (auto const* assertion: assertions) - { - createErrorBlock(); - connectBlocks(target.value, error(), target.constraints && (target.errorId == static_cast(assertion->id()))); - auto [result, model] = query(error(), assertion->location()); - // This should be fine but it's a bug in the old compiler - (void)model; - if (result == smtutil::CheckResult::UNSATISFIABLE) - m_safeAssertions.insert(assertion); - } - } - else if (target.type == VerificationTarget::Type::PopEmptyArray) - { - solAssert(dynamic_cast(scope), ""); - createErrorBlock(); - connectBlocks(target.value, error(), target.constraints && (target.errorId == static_cast(scope->id()))); - auto [result, model] = query(error(), scope->location()); - // This should be fine but it's a bug in the old compiler - (void)model; - if (result != smtutil::CheckResult::UNSATISFIABLE) - { - string msg = "Empty array \"pop\" "; - if (result == smtutil::CheckResult::SATISFIABLE) - msg += "detected here."; - else - msg += "might happen here."; - m_unsafeTargets.insert(scope); - m_outerErrorReporter.warning( - 2529_error, - scope->location(), - msg - ); - } - } - else - solAssert(false, ""); - } + checkVerificationTargets(); } vector CHC::unhandledQueries() const @@ -540,7 +499,7 @@ void CHC::visitAssert(FunctionCall const& _funCall) m_currentBlock, m_currentFunction->isConstructor() ? summary(*m_currentContract) : summary(*m_currentFunction), currentPathConditions() && !m_context.expression(*args.front())->currentValue() && ( - m_error.currentValue() == static_cast(_funCall.id()) + m_error.currentValue() == newErrorId(_funCall) ) ); @@ -638,7 +597,7 @@ void CHC::makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) connectBlocks( m_currentBlock, m_currentFunction->isConstructor() ? summary(*m_currentContract) : summary(*m_currentFunction), - currentPathConditions() && symbArray->length() <= 0 && m_error.currentValue() == static_cast(_arrayPop.id()) + currentPathConditions() && symbArray->length() <= 0 && m_error.currentValue() == newErrorId(_arrayPop) ); m_context.addAssertion(m_error.currentValue() == previousError); @@ -647,9 +606,10 @@ void CHC::makeArrayPopVerificationTarget(FunctionCall const& _arrayPop) void CHC::resetSourceAnalysis() { m_verificationTargets.clear(); - m_safeAssertions.clear(); + m_safeTargets.clear(); m_unsafeTargets.clear(); m_functionAssertions.clear(); + m_errorIds.clear(); m_callGraph.clear(); m_summaries.clear(); } @@ -1167,7 +1127,98 @@ void CHC::addArrayPopVerificationTarget(ASTNode const* _scope, smtutil::Expressi } } +void CHC::checkVerificationTargets() +{ + for (auto const& [scope, target]: m_verificationTargets) + { + if (target.type == VerificationTarget::Type::Assert) + checkAssertTarget(scope, target); + else + { + string satMsg; + string unknownMsg; + + if (target.type == VerificationTarget::Type::PopEmptyArray) + { + solAssert(dynamic_cast(scope), ""); + satMsg = "Empty array \"pop\" detected here."; + unknownMsg = "Empty array \"pop\" might happen here."; + } + else + solAssert(false, ""); + + auto it = m_errorIds.find(scope->id()); + solAssert(it != m_errorIds.end(), ""); + checkAndReportTarget(scope, target, it->second, satMsg, unknownMsg); + } + } +} + +void CHC::checkAssertTarget(ASTNode const* _scope, CHCVerificationTarget const& _target) +{ + solAssert(_target.type == VerificationTarget::Type::Assert, ""); + auto assertions = transactionAssertions(_scope); + for (auto const* assertion: assertions) + { + auto it = m_errorIds.find(assertion->id()); + solAssert(it != m_errorIds.end(), ""); + unsigned errorId = it->second; + + createErrorBlock(); + connectBlocks(_target.value, error(), _target.constraints && (_target.errorId == errorId)); + auto [result, model] = query(error(), assertion->location()); + // This should be fine but it's a bug in the old compiler + (void)model; + if (result == smtutil::CheckResult::UNSATISFIABLE) + m_safeTargets[assertion].insert(_target.type); + } +} + +void CHC::checkAndReportTarget( + ASTNode const* _scope, + CHCVerificationTarget const& _target, + unsigned _errorId, + string _satMsg, + string _unknownMsg +) +{ + createErrorBlock(); + connectBlocks(_target.value, error(), _target.constraints && (_target.errorId == _errorId)); + auto [result, model] = query(error(), _scope->location()); + // This should be fine but it's a bug in the old compiler + (void)model; + if (result == smtutil::CheckResult::UNSATISFIABLE) + m_safeTargets[_scope].insert(_target.type); + else if (result == smtutil::CheckResult::SATISFIABLE) + { + solAssert(!_satMsg.empty(), ""); + m_unsafeTargets[_scope].insert(_target.type); + m_outerErrorReporter.warning( + 2529_error, + _scope->location(), + _satMsg + ); + } + else if (!_unknownMsg.empty()) + m_outerErrorReporter.warning( + 1147_error, + _scope->location(), + _unknownMsg + ); +} + string CHC::uniquePrefix() { return to_string(m_blockCounter++); } + +unsigned CHC::newErrorId(frontend::Expression const& _expr) +{ + unsigned errorId = m_context.newUniqueId(); + // We need to make sure the error id is not zero, + // because error id zero actually means no error in the CHC encoding. + if (errorId == 0) + errorId = m_context.newUniqueId(); + m_errorIds.emplace(_expr.id(), errorId); + return errorId; +} diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index dcba90606c91..07af4c76bf47 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -36,6 +36,7 @@ #include +#include #include namespace solidity::frontend @@ -54,7 +55,8 @@ class CHC: public SMTEncoder void analyze(SourceUnit const& _sources); - std::set const& safeAssertions() const { return m_safeAssertions; } + std::map> const& safeTargets() const { return m_safeTargets; } + std::map> const& unsafeTargets() const { return m_unsafeTargets; } /// This is used if the Horn solver is not directly linked into this binary. /// @returns a list of inputs to the Horn solver that were not part of the argument to @@ -191,6 +193,18 @@ class CHC: public SMTEncoder void addVerificationTarget(ASTNode const* _scope, VerificationTarget::Type _type, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); void addAssertVerificationTarget(ASTNode const* _scope, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); void addArrayPopVerificationTarget(ASTNode const* _scope, smtutil::Expression _errorId); + + void checkVerificationTargets(); + // Forward declaration. Definition is below. + struct CHCVerificationTarget; + void checkAssertTarget(ASTNode const* _scope, CHCVerificationTarget const& _target); + void checkAndReportTarget( + ASTNode const* _scope, + CHCVerificationTarget const& _target, + unsigned _errorId, + std::string _satMsg, + std::string _unknownMsg + ); //@} /// Misc. @@ -198,6 +212,10 @@ class CHC: public SMTEncoder /// Returns a prefix to be used in a new unique block name /// and increases the block counter. std::string uniquePrefix(); + + /// @returns a new unique error id associated with _expr and stores + /// it into m_errorIds. + unsigned newErrorId(Expression const& _expr); //@} /// Predicates. @@ -257,10 +275,10 @@ class CHC: public SMTEncoder std::map m_verificationTargets; - /// Assertions proven safe. - std::set m_safeAssertions; + /// Targets proven safe. + std::map> m_safeTargets; /// Targets proven unsafe. - std::set m_unsafeTargets; + std::map> m_unsafeTargets; //@} /// Control-flow. @@ -271,6 +289,11 @@ class CHC: public SMTEncoder std::map, IdCompare> m_functionAssertions; + /// Maps ASTNode ids to error ids. + /// A multimap is used instead of map anticipating the UnderOverflow + /// target which has 2 error ids. + std::multimap m_errorIds; + /// The current block. smtutil::Expression m_currentBlock = smtutil::Expression(true); diff --git a/libsolidity/formal/EncodingContext.cpp b/libsolidity/formal/EncodingContext.cpp index 57686ace460d..b581602303ff 100644 --- a/libsolidity/formal/EncodingContext.cpp +++ b/libsolidity/formal/EncodingContext.cpp @@ -32,21 +32,21 @@ EncodingContext::EncodingContext(): void EncodingContext::reset() { resetAllVariables(); - resetSlackId(); + resetUniqueId(); m_expressions.clear(); m_globalContext.clear(); m_state.reset(); m_assertions.clear(); } -void EncodingContext::resetSlackId() +void EncodingContext::resetUniqueId() { - m_nextSlackId = 0; + m_nextUniqueId = 0; } -unsigned EncodingContext::newSlackId() +unsigned EncodingContext::newUniqueId() { - return m_nextSlackId++; + return m_nextUniqueId++; } void EncodingContext::clear() diff --git a/libsolidity/formal/EncodingContext.h b/libsolidity/formal/EncodingContext.h index fcfd5e149456..09316709a423 100644 --- a/libsolidity/formal/EncodingContext.h +++ b/libsolidity/formal/EncodingContext.h @@ -41,9 +41,9 @@ class EncodingContext /// To be used in the beginning of a root function visit. void reset(); /// Resets the fresh id for slack variables. - void resetSlackId(); + void resetUniqueId(); /// Returns the current fresh slack id and increments it. - unsigned newSlackId(); + unsigned newUniqueId(); /// Clears the entire context, erasing everything. /// To be used before a model checking engine starts. void clear(); @@ -173,8 +173,8 @@ class EncodingContext bool m_accumulateAssertions = true; //@} - /// Fresh ids for slack variables to be created deterministically. - unsigned m_nextSlackId = 0; + /// Central source of unique ids. + unsigned m_nextUniqueId = 0; }; } diff --git a/libsolidity/formal/ModelChecker.cpp b/libsolidity/formal/ModelChecker.cpp index f74e1327da9e..718a41ae17df 100644 --- a/libsolidity/formal/ModelChecker.cpp +++ b/libsolidity/formal/ModelChecker.cpp @@ -41,7 +41,12 @@ void ModelChecker::analyze(SourceUnit const& _source) return; m_chc.analyze(_source); - m_bmc.analyze(_source, m_chc.safeAssertions()); + + auto solvedTargets = m_chc.safeTargets(); + for (auto const& target: m_chc.unsafeTargets()) + solvedTargets[target.first] += target.second; + + m_bmc.analyze(_source, solvedTargets); } vector ModelChecker::unhandledQueries() diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 6faaaf600ce8..bd2a9a7548f3 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1262,7 +1262,7 @@ pair SMTEncoder::arithmeticOperation( auto symbMax = smt::maxValue(*intType); smtutil::Expression intValueRange = (0 - symbMin) + symbMax + 1; - string suffix = to_string(_operation.id()) + "_" + to_string(m_context.newSlackId()); + string suffix = to_string(_operation.id()) + "_" + to_string(m_context.newUniqueId()); smt::SymbolicIntVariable k(intType, intType, "k_" + suffix, m_context); smt::SymbolicIntVariable m(intType, intType, "m_" + suffix, m_context); From efc5ee207d9532ad5113d6db53ca3898667fa1e3 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Mon, 6 Jul 2020 21:40:50 +0200 Subject: [PATCH 363/479] Fix internal compiler error caused by oversized objects --- Changelog.md | 1 + libsolidity/analysis/StaticAnalyzer.cpp | 67 ----------- libsolidity/analysis/StaticAnalyzer.h | 17 --- libsolidity/analysis/TypeChecker.cpp | 43 +++++++ libsolidity/ast/Types.cpp | 107 ++++++++++++++++++ libsolidity/ast/Types.h | 8 ++ .../large_storage_array_mapping.sol | 2 +- .../largeTypes/large_storage_structs.sol | 17 +-- .../largeTypes/oversized_array.sol | 8 ++ .../largeTypes/oversized_contract.sol | 10 ++ .../largeTypes/oversized_struct.sol | 12 ++ .../largeTypes/storage_parameter.sol | 6 + 12 files changed, 205 insertions(+), 93 deletions(-) create mode 100644 test/libsolidity/syntaxTests/largeTypes/oversized_array.sol create mode 100644 test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol create mode 100644 test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol create mode 100644 test/libsolidity/syntaxTests/largeTypes/storage_parameter.sol diff --git a/Changelog.md b/Changelog.md index 7b0a87a9abef..1c8ffe17113a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Compiler Features: Bugfixes: * Type Checker: Fix overload resolution in combination with ``{value: ...}``. + * Type Checker: Fix internal compiler error related to oversized types. Compiler Features: * Optimizer: Add rule to remove shifts inside the byte opcode. diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index b650f1fc1cbe..62a1861d16c7 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -155,29 +155,6 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) // This is not a no-op, the entry might pre-exist. m_localVarUseCount[make_pair(_variable.id(), &_variable)] += 0; } - else if (_variable.isStateVariable()) - { - set structsSeen; - TypeSet oversizedSubTypes; - if (structureSizeEstimate(*_variable.type(), structsSeen, oversizedSubTypes) >= bigint(1) << 64) - m_errorReporter.warning( - 3408_error, - _variable.location(), - "Variable " + util::escapeAndQuoteString(_variable.name()) + - " covers a large part of storage and thus makes collisions likely. " - "Either use mappings or dynamic arrays and allow their size to be increased only " - "in small quantities per transaction." - ); - for (Type const* type: oversizedSubTypes) - m_errorReporter.warning( - 7325_error, - _variable.location(), - "Type " + util::escapeAndQuoteString(type->canonicalName()) + - " has large size and thus makes collisions likely. " - "Either use mappings or dynamic arrays and allow their size to be increased only " - "in small quantities per transaction." - ); - } return true; } @@ -349,47 +326,3 @@ bool StaticAnalyzer::visit(FunctionCall const& _functionCall) } return true; } - -bigint StaticAnalyzer::structureSizeEstimate( - Type const& _type, - set& _structsSeen, - TypeSet& _oversizedSubTypes -) -{ - switch (_type.category()) - { - case Type::Category::Array: - { - auto const& t = dynamic_cast(_type); - bigint baseTypeSize = structureSizeEstimate(*t.baseType(), _structsSeen, _oversizedSubTypes); - if (baseTypeSize >= bigint(1) << 64) - _oversizedSubTypes.insert(t.baseType()); - if (!t.isDynamicallySized()) - return structureSizeEstimate(*t.baseType(), _structsSeen, _oversizedSubTypes) * t.length(); - break; - } - case Type::Category::Struct: - { - auto const& t = dynamic_cast(_type); - bigint size = 1; - if (_structsSeen.count(&t.structDefinition())) - return size; - _structsSeen.insert(&t.structDefinition()); - for (auto const& m: t.members(nullptr)) - size += structureSizeEstimate(*m.type, _structsSeen, _oversizedSubTypes); - _structsSeen.erase(&t.structDefinition()); - return size; - } - case Type::Category::Mapping: - { - auto const* valueType = dynamic_cast(_type).valueType(); - bigint valueTypeSize = structureSizeEstimate(*valueType, _structsSeen, _oversizedSubTypes); - if (valueTypeSize >= bigint(1) << 64) - _oversizedSubTypes.insert(valueType); - break; - } - default: - break; - } - return bigint(1); -} diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h index 8f7fbc59712b..7886b428859a 100644 --- a/libsolidity/analysis/StaticAnalyzer.h +++ b/libsolidity/analysis/StaticAnalyzer.h @@ -73,23 +73,6 @@ class StaticAnalyzer: private ASTConstVisitor bool visit(BinaryOperation const& _operation) override; bool visit(FunctionCall const& _functionCall) override; - struct TypeComp - { - bool operator()(Type const* lhs, Type const* rhs) const - { - solAssert(lhs && rhs, ""); - return lhs->richIdentifier() < rhs->richIdentifier(); - } - }; - using TypeSet = std::set; - - /// @returns the size of this type in storage, including all sub-types. - static bigint structureSizeEstimate( - Type const& _type, - std::set& _structsSeen, - TypeSet& _oversizedSubTypes - ); - langutil::ErrorReporter& m_errorReporter; /// Flag that indicates whether the current contract definition is a library. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6bb9dd39fc11..aa316cb4857b 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -91,6 +92,20 @@ bool TypeChecker::visit(ContractDefinition const& _contract) for (auto const& n: _contract.subNodes()) n->accept(*this); + bigint size = 0; + vector variables; + for (ContractDefinition const* contract: boost::adaptors::reverse(m_currentContract->annotation().linearizedBaseContracts)) + for (VariableDeclaration const* variable: contract->stateVariables()) + if (!(variable->isConstant() || variable->immutable())) + { + size += storageSizeUpperBound(*(variable->annotation().type)); + if (size >= bigint(1) << 256) + { + m_errorReporter.typeError(7676_error, m_currentContract->location(), "Contract too large for storage."); + break; + } + } + return false; } @@ -523,6 +538,10 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) m_errorReporter.typeError(6744_error, _variable.location(), "Internal or recursive type is not allowed for public state variables."); } + bool isStructMemberDeclaration = dynamic_cast(_variable.scope()) != nullptr; + if (isStructMemberDeclaration) + return false; + if (auto referenceType = dynamic_cast(varType)) { auto result = referenceType->validForLocation(referenceType->location()); @@ -532,7 +551,31 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) { solAssert(!result.message().empty(), "Expected detailed error message"); m_errorReporter.typeError(1534_error, _variable.location(), result.message()); + return false; + } + } + + if (varType->dataStoredIn(DataLocation::Storage)) + { + auto collisionMessage = [&](string const& variableOrType, bool isVariable) -> string { + return + (isVariable ? "Variable " : "Type ") + + util::escapeAndQuoteString(variableOrType) + + " covers a large part of storage and thus makes collisions likely." + " Either use mappings or dynamic arrays and allow their size to be increased only" + " in small quantities per transaction."; + }; + + if (storageSizeUpperBound(*varType) >= bigint(1) << 64) + { + if (_variable.isStateVariable()) + m_errorReporter.warning(3408_error, _variable.location(), collisionMessage(_variable.name(), true)); + else + m_errorReporter.warning(2332_error, _variable.typeName()->location(), collisionMessage(varType->canonicalName(), false)); } + vector oversizedSubtypes = frontend::oversizedSubtypes(*varType); + for (Type const* subtype: oversizedSubtypes) + m_errorReporter.warning(7325_error, _variable.typeName()->location(), collisionMessage(subtype->canonicalName(), false)); } return false; diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 992f0343d953..546e6ee63abc 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -53,6 +53,88 @@ using namespace solidity::frontend; namespace { +struct TypeComp +{ + bool operator()(Type const* lhs, Type const* rhs) const + { + solAssert(lhs && rhs, ""); + return lhs->richIdentifier() < rhs->richIdentifier(); + } +}; +using TypeSet = std::set; + +bigint storageSizeUpperBoundInner( + Type const& _type, + set& _structsSeen +) +{ + switch (_type.category()) + { + case Type::Category::Array: + { + auto const& t = dynamic_cast(_type); + if (!t.isDynamicallySized()) + return storageSizeUpperBoundInner(*t.baseType(), _structsSeen) * t.length(); + break; + } + case Type::Category::Struct: + { + auto const& t = dynamic_cast(_type); + solAssert(!_structsSeen.count(&t.structDefinition()), "Recursive struct."); + bigint size = 1; + _structsSeen.insert(&t.structDefinition()); + for (auto const& m: t.members(nullptr)) + size += storageSizeUpperBoundInner(*m.type, _structsSeen); + _structsSeen.erase(&t.structDefinition()); + return size; + } + default: + break; + } + return bigint(1); +} + +void oversizedSubtypesInner( + Type const& _type, + bool _includeType, + set& _structsSeen, + TypeSet& _oversizedSubtypes +) +{ + switch (_type.category()) + { + case Type::Category::Array: + { + auto const& t = dynamic_cast(_type); + if (_includeType && storageSizeUpperBound(t) >= bigint(1) << 64) + _oversizedSubtypes.insert(&t); + oversizedSubtypesInner(*t.baseType(), t.isDynamicallySized(), _structsSeen, _oversizedSubtypes); + break; + } + case Type::Category::Struct: + { + auto const& t = dynamic_cast(_type); + if (_structsSeen.count(&t.structDefinition())) + return; + if (_includeType && storageSizeUpperBound(t) >= bigint(1) << 64) + _oversizedSubtypes.insert(&t); + _structsSeen.insert(&t.structDefinition()); + for (auto const& m: t.members(nullptr)) + oversizedSubtypesInner(*m.type, false, _structsSeen, _oversizedSubtypes); + _structsSeen.erase(&t.structDefinition()); + break; + } + case Type::Category::Mapping: + { + auto const* valueType = dynamic_cast(_type).valueType(); + oversizedSubtypesInner(*valueType, true, _structsSeen, _oversizedSubtypes); + break; + } + default: + break; + } +} + /// Check whether (_base ** _exp) fits into 4096 bits. bool fitsPrecisionExp(bigint const& _base, bigint const& _exp) { @@ -149,6 +231,22 @@ util::Result transformParametersToExternal(TypePointers const& _pa } +bigint solidity::frontend::storageSizeUpperBound(frontend::Type const& _type) +{ + set structsSeen; + return storageSizeUpperBoundInner(_type, structsSeen); +} + +vector solidity::frontend::oversizedSubtypes(frontend::Type const& _type) +{ + set structsSeen; + TypeSet oversized; + oversizedSubtypesInner(_type, false, structsSeen, oversized); + vector res; + copy(oversized.cbegin(), oversized.cend(), back_inserter(res)); + return res; +} + void Type::clearCache() const { m_members.clear(); @@ -1749,6 +1847,8 @@ BoolResult ArrayType::validForLocation(DataLocation _loc) const break; } case DataLocation::Storage: + if (storageSizeUpperBound(*this) >= bigint(1) << 256) + return BoolResult::err("Type too large for storage."); break; } return true; @@ -2388,6 +2488,13 @@ BoolResult StructType::validForLocation(DataLocation _loc) const if (!result) return result; } + + if ( + _loc == DataLocation::Storage && + storageSizeUpperBound(*this) >= bigint(1) << 256 + ) + return BoolResult::err("Type too large for storage."); + return true; } diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index b902a1c77de1..b05021630b24 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -54,6 +54,14 @@ using rational = boost::rational; using TypeResult = util::Result; using BoolResult = util::Result; +} + +namespace solidity::frontend +{ + +bigint storageSizeUpperBound(frontend::Type const& _type); +std::vector oversizedSubtypes(frontend::Type const& _type); + inline rational makeRational(bigint const& _numerator, bigint const& _denominator) { solAssert(_denominator != 0, "division by zero"); diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol index 01a68bcda6a1..2dfc50a415f2 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_array_mapping.sol @@ -2,4 +2,4 @@ contract C { mapping(uint => uint[2**100]) x; } // ---- -// Warning 7325: (17-48): Type "uint256[1267650600228229401496703205376]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (17-46): Type "uint256[1267650600228229401496703205376]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol index 2956a65494b1..a29401d948ef 100644 --- a/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol +++ b/test/libsolidity/syntaxTests/largeTypes/large_storage_structs.sol @@ -23,9 +23,9 @@ contract C { struct Q0 { - uint[1][][10**20 + 4] x; - uint[10**20 + 4][][1] y; - uint[][10**20 + 4] z; + uint[1][][10**20 + 1] x; + uint[10**20 + 2][][1] y; + uint[][10**20 + 3] z; uint[10**20 + 4][] t; } Q0 q0; @@ -57,11 +57,12 @@ contract C { // ---- // Warning 3408: (106-111): Variable "s0" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 3408: (171-176): Variable "s1" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (341-346): Type "C.P[103]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (341-346): Type "C.P[104]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (341-343): Type "C.P[103]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (341-343): Type "C.P[104]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 3408: (505-510): Variable "q0" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (505-510): Type "uint256[100000000000000000004]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (505-507): Type "uint256[100000000000000000002]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (505-507): Type "uint256[100000000000000000004]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 3408: (576-581): Variable "q1" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (647-652): Type "uint256[100000000000000000006]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (647-649): Type "uint256[100000000000000000006]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 3408: (715-720): Variable "q3" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 7325: (783-788): Type "uint256[100000000000000000008]" has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 7325: (783-785): Type "uint256[100000000000000000008]" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol new file mode 100644 index 000000000000..951840fd4216 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >= 0.0; +contract C { + uint[2**255][2] a; +} +// ---- +// TypeError 1534: (77-94): Type too large for storage. +// TypeError 7676: (60-97): Contract too large for storage. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol new file mode 100644 index 000000000000..69f8b1024df6 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >= 0.0; +contract C { + uint[2**255] a; + uint[2**255] b; +} +// ---- +// Warning 3408: (77-91): Variable "a" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (97-111): Variable "b" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// TypeError 7676: (60-114): Contract too large for storage. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol new file mode 100644 index 000000000000..a3f3a4160f86 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >= 0.0; +contract C { + struct S { + uint[2**255] a; + uint[2**255] b; + } + S s; +} +// ---- +// TypeError 1534: (146-149): Type too large for storage. +// TypeError 7676: (60-152): Contract too large for storage. diff --git a/test/libsolidity/syntaxTests/largeTypes/storage_parameter.sol b/test/libsolidity/syntaxTests/largeTypes/storage_parameter.sol new file mode 100644 index 000000000000..b32815028923 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/storage_parameter.sol @@ -0,0 +1,6 @@ +contract C { + struct S { uint256[2**255] x; } + function f(S storage) internal {} +} +// ---- +// Warning 2332: (64-65): Type "C.S" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. From f5ae9c57619ebfa4fff58209b6dc78a4e1b229aa Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 8 Jul 2020 23:25:13 +0100 Subject: [PATCH 364/479] Fix yulInterpreter to correctly handle i32.clz --- .../yulInterpreter/EwasmBuiltinInterpreter.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index b09fb5a87381..440ffcd7ab28 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -51,8 +51,9 @@ void copyZeroExtended( _target[_targetOffset + i] = _sourceOffset + i < _source.size() ? _source[_sourceOffset + i] : 0; } -/// Count leading zeros for uint64 -uint64_t clz(uint64_t _v) +/// Count leading zeros for uint64. Following WebAssembly rules, it returns 64 for @a _v being zero. +/// NOTE: the clz builtin of the compiler may or may not do this +uint64_t clz64(uint64_t _v) { if (_v == 0) return 64; @@ -133,7 +134,11 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a accessMemory(arg[0], 4); return readMemoryHalfWord(arg[0]); } - + else if (_fun == "i32.clz"_yulstring) + // NOTE: the clz implementation assumes 64-bit inputs, hence the adjustment + return clz64(arg[0] & uint32_t(-1)) - 32; + else if (_fun == "i64.clz"_yulstring) + return clz64(arg[0]); string prefix = _fun.str(); string suffix; @@ -202,8 +207,6 @@ u256 EwasmBuiltinInterpreter::evalWasmBuiltin(string const& _fun, vector c return arg[0] != arg[1] ? 1 : 0; else if (_fun == "eqz") return arg[0] == 0 ? 1 : 0; - else if (_fun == "clz") - return clz(arg[0]); else if (_fun == "lt_u") return arg[0] < arg[1] ? 1 : 0; else if (_fun == "gt_u") From 0fd13b7a9ec00906df5658af0cd1f49fd2c0ebd7 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Jul 2020 19:42:24 +0200 Subject: [PATCH 365/479] Upgrade json-cpp to 1.9.3. --- Changelog.md | 1 + cmake/jsoncpp.cmake | 7 ++++--- libsolutil/JSON.cpp | 4 ++-- scripts/create_source_tarball.sh | 2 +- scripts/release_ppa.sh | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 1c8ffe17113a..e4310c339da3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Bugfixes: * Type Checker: Fix internal compiler error related to oversized types. Compiler Features: + * Build System: Update internal dependency of jsoncpp to 1.9.3. * Optimizer: Add rule to remove shifts inside the byte opcode. diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake index 1377041b9a69..80a16f8d57c8 100644 --- a/cmake/jsoncpp.cmake +++ b/cmake/jsoncpp.cmake @@ -37,15 +37,16 @@ endif() ExternalProject_Add(jsoncpp-project PREFIX "${prefix}" DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads" - DOWNLOAD_NAME jsoncpp-1.9.2.tar.gz - URL https://github.com/open-source-parsers/jsoncpp/archive/1.9.2.tar.gz - URL_HASH SHA256=77a402fb577b2e0e5d0bdc1cf9c65278915cdb25171e3452c68b6da8a561f8f0 + DOWNLOAD_NAME jsoncpp-1.9.3.tar.gz + URL https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz + URL_HASH SHA256=8593c1d69e703563d94d8c12244e2e18893eeb9a8a9f8aa3d09a327aa45c8f7d CMAKE_COMMAND ${JSONCPP_CMAKE_COMMAND} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_LIBDIR=lib # Build static lib but suitable to be included in a shared lib. -DCMAKE_POSITION_INDEPENDENT_CODE=${BUILD_SHARED_LIBS} + -DJSONCPP_WITH_EXAMPLE=OFF -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF -DCMAKE_CXX_FLAGS=${JSONCPP_CXX_FLAGS} diff --git a/libsolutil/JSON.cpp b/libsolutil/JSON.cpp index c66aab9b2537..609b9bb04558 100644 --- a/libsolutil/JSON.cpp +++ b/libsolutil/JSON.cpp @@ -32,8 +32,8 @@ using namespace std; static_assert( - (JSONCPP_VERSION_MAJOR == 1) && (JSONCPP_VERSION_MINOR == 9) && (JSONCPP_VERSION_PATCH == 2), - "Unexpected jsoncpp version: " JSONCPP_VERSION_STRING ". Expecting 1.9.2." + (JSONCPP_VERSION_MAJOR == 1) && (JSONCPP_VERSION_MINOR == 9) && (JSONCPP_VERSION_PATCH == 3), + "Unexpected jsoncpp version: " JSONCPP_VERSION_STRING ". Expecting 1.9.3." ); namespace solidity::util diff --git a/scripts/create_source_tarball.sh b/scripts/create_source_tarball.sh index a4b4fbec13a3..d75650a53e0d 100755 --- a/scripts/create_source_tarball.sh +++ b/scripts/create_source_tarball.sh @@ -31,7 +31,7 @@ REPO_ROOT="$(dirname "$0")"/.. fi # Add dependencies mkdir -p "$SOLDIR/deps/downloads/" 2>/dev/null || true - wget -O "$SOLDIR/deps/downloads/jsoncpp-1.9.2.tar.gz" https://github.com/open-source-parsers/jsoncpp/archive/1.9.2.tar.gz + wget -O "$SOLDIR/deps/downloads/jsoncpp-1.9.3.tar.gz" https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz mkdir -p "$REPO_ROOT/upload" tar --owner 0 --group 0 -czf "$REPO_ROOT/upload/solidity_$versionstring.tar.gz" -C "$TEMPDIR" "solidity_$versionstring" rm -r "$TEMPDIR" diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index 267346e417cb..d15f8d221bb4 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -107,7 +107,7 @@ mv solidity solc # Fetch jsoncpp dependency mkdir -p ./solc/deps/downloads/ 2>/dev/null || true -wget -O ./solc/deps/downloads/jsoncpp-1.9.2.tar.gz https://github.com/open-source-parsers/jsoncpp/archive/1.9.2.tar.gz +wget -O ./solc/deps/downloads/jsoncpp-1.9.3.tar.gz https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz # Determine version cd solc From 20dd66f398077a149116dd84652908f92d8321b9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 10 Jul 2020 21:06:09 +0100 Subject: [PATCH 366/479] Fix missing quote in error message for invalid Yul types --- libyul/AsmAnalysis.cpp | 2 +- test/libyul/yulSyntaxTests/invalid_type2.yul | 2 +- test/libyul/yulSyntaxTests/user_defined_functions_fail.yul | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index f0ac3c24255c..315699153fb5 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -234,7 +234,7 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) m_errorReporter.typeError( 3947_error, variable.location, - "Assigning value of type \"" + givenType.str() + "\" to variable of type \"" + variable.type.str() + "." + "Assigning value of type \"" + givenType.str() + "\" to variable of type \"" + variable.type.str() + "\"." ); } } diff --git a/test/libyul/yulSyntaxTests/invalid_type2.yul b/test/libyul/yulSyntaxTests/invalid_type2.yul index 25320b055142..2ad035dcfc74 100644 --- a/test/libyul/yulSyntaxTests/invalid_type2.yul +++ b/test/libyul/yulSyntaxTests/invalid_type2.yul @@ -5,4 +5,4 @@ // dialect: evmTyped // ---- // TypeError 5473: (15-28): "invalidType" is not a valid type (user defined types are not yet supported). -// TypeError 3947: (10-11): Assigning value of type "invalidType" to variable of type "u256. +// TypeError 3947: (10-11): Assigning value of type "invalidType" to variable of type "u256". diff --git a/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul b/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul index e81474613dd4..7b8d012bb597 100644 --- a/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul +++ b/test/libyul/yulSyntaxTests/user_defined_functions_fail.yul @@ -8,5 +8,5 @@ // ==== // dialect: evmTyped // ---- -// TypeError 3947: (126-127): Assigning value of type "bool" to variable of type "u256. -// TypeError 3947: (129-136): Assigning value of type "u256" to variable of type "bool. +// TypeError 3947: (126-127): Assigning value of type "bool" to variable of type "u256". +// TypeError 3947: (129-136): Assigning value of type "u256" to variable of type "bool". From c8f25142a72e153297ff88e430674c95cf3697c0 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Jul 2020 11:22:57 +0200 Subject: [PATCH 367/479] Add nooptions label to smt checks. --- test/InteractiveTests.h | 5 +++-- test/boostTest.cpp | 10 ++++++++-- test/libsolidity/SMTChecker.cpp | 4 ++-- test/libsolidity/SMTCheckerTest.cpp | 2 +- test/libsolidity/SMTCheckerTest.h | 4 ++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/test/InteractiveTests.h b/test/InteractiveTests.h index 409d8607daf4..4e836579653d 100644 --- a/test/InteractiveTests.h +++ b/test/InteractiveTests.h @@ -46,6 +46,7 @@ struct Testsuite bool smt; bool needsVM; TestCase::TestCaseCreator testCaseCreator; + std::vector labels{}; }; @@ -64,8 +65,8 @@ Testsuite const g_interactiveTestsuites[] = { {"Semantic", "libsolidity", "semanticTests", false, true, &SemanticTest::create}, {"JSON AST", "libsolidity", "ASTJSON", false, false, &ASTJSONTest::create}, {"JSON ABI", "libsolidity", "ABIJson", false, false, &ABIJsonTest::create}, - {"SMT Checker", "libsolidity", "smtCheckerTests", true, false, &SMTCheckerTest::create}, - {"SMT Checker JSON", "libsolidity", "smtCheckerTestsJSON", true, false, &SMTCheckerJSONTest::create}, + {"SMT Checker", "libsolidity", "smtCheckerTests", true, false, &SMTCheckerTest::create, {"nooptions"}}, + {"SMT Checker JSON", "libsolidity", "smtCheckerTestsJSON", true, false, &SMTCheckerJSONTest::create, {"nooptions"}}, {"Gas Estimates", "libsolidity", "gasTests", false, false, &GasTest::create} }; diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 5b45cc758214..19cdfc423326 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -65,6 +65,7 @@ int registerTests( boost::filesystem::path const& _basepath, boost::filesystem::path const& _path, bool _enforceViaYul, + vector const& _labels, TestCase::TestCaseCreator _testCaseCreator ) { @@ -83,6 +84,7 @@ int registerTests( *sub_suite, _basepath, _path / entry.path().filename(), _enforceViaYul, + _labels, _testCaseCreator ); _suite.add(sub_suite); @@ -95,7 +97,7 @@ int registerTests( static vector> filenames; filenames.emplace_back(make_unique(_path.string())); - _suite.add(make_test_case( + auto test_case = make_test_case( [config, _testCaseCreator] { BOOST_REQUIRE_NO_THROW({ @@ -125,7 +127,10 @@ int registerTests( _path.stem().string(), *filenames.back(), 0 - )); + ); + for (auto const& _label: _labels) + test_case->add_label(_label); + _suite.add(test_case); numTestsAdded = 1; } return numTestsAdded; @@ -174,6 +179,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) options.testPath / ts.path, ts.subpath, options.enforceViaYul, + ts.labels, ts.testCaseCreator ) > 0, std::string("no ") + ts.title + " tests found"); } diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp index 66398381ef7f..a7347a21a628 100644 --- a/test/libsolidity/SMTChecker.cpp +++ b/test/libsolidity/SMTChecker.cpp @@ -55,7 +55,7 @@ class SMTCheckerFramework: public AnalysisFramework BOOST_FIXTURE_TEST_SUITE(SMTChecker, SMTCheckerFramework) -BOOST_AUTO_TEST_CASE(import_base) +BOOST_AUTO_TEST_CASE(import_base, *boost::unit_test::label("no_options")) { CompilerStack c; c.setSources({ @@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(import_base) BOOST_CHECK_EQUAL(asserts, 1); } -BOOST_AUTO_TEST_CASE(import_library) +BOOST_AUTO_TEST_CASE(import_library, *boost::unit_test::label("no_options")) { CompilerStack c; c.setSources({ diff --git a/test/libsolidity/SMTCheckerTest.cpp b/test/libsolidity/SMTCheckerTest.cpp index 7daa6f182298..ac858747da16 100644 --- a/test/libsolidity/SMTCheckerTest.cpp +++ b/test/libsolidity/SMTCheckerTest.cpp @@ -26,7 +26,7 @@ using namespace solidity::langutil; using namespace solidity::frontend; using namespace solidity::frontend::test; -SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion _evmVersion): SyntaxTest(_filename, _evmVersion) +SMTCheckerTest::SMTCheckerTest(string const& _filename): SyntaxTest(_filename, EVMVersion{}) { auto const& choice = m_reader.stringSetting("SMTSolvers", "any"); if (choice == "any") diff --git a/test/libsolidity/SMTCheckerTest.h b/test/libsolidity/SMTCheckerTest.h index 34f526cd9b83..b710cde45b54 100644 --- a/test/libsolidity/SMTCheckerTest.h +++ b/test/libsolidity/SMTCheckerTest.h @@ -31,9 +31,9 @@ class SMTCheckerTest: public SyntaxTest public: static std::unique_ptr create(Config const& _config) { - return std::make_unique(_config.filename, _config.evmVersion); + return std::make_unique(_config.filename); } - SMTCheckerTest(std::string const& _filename, langutil::EVMVersion _evmVersion); + SMTCheckerTest(std::string const& _filename); TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override; From ab2f64f442bee622b549006db5f1468452eea70b Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Jul 2020 19:09:14 +0200 Subject: [PATCH 368/479] Disallow multiple events with same name and types. --- Changelog.md | 1 + libsolidity/analysis/ContractLevelChecker.cpp | 5 +++-- .../syntaxTests/events/inheritance_adds_anonymous.sol | 8 ++++++++ .../syntaxTests/events/inheritance_adds_indexed.sol | 8 ++++++++ .../syntaxTests/events/inheritance_adds_parameter.sol | 6 ++++++ .../syntaxTests/events/inheritance_event_repeated.sol | 8 ++++++++ .../syntaxTests/events/inheritance_multi_parent.sol | 10 ++++++++++ .../syntaxTests/events/inheritance_removes_indexed.sol | 8 ++++++++ .../syntaxTests/events/multiple_inheritance.sol | 4 ++++ .../syntaxTests/events/overloading_in_contract.sol | 5 +++++ 10 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/syntaxTests/events/inheritance_adds_anonymous.sol create mode 100644 test/libsolidity/syntaxTests/events/inheritance_adds_indexed.sol create mode 100644 test/libsolidity/syntaxTests/events/inheritance_adds_parameter.sol create mode 100644 test/libsolidity/syntaxTests/events/inheritance_event_repeated.sol create mode 100644 test/libsolidity/syntaxTests/events/inheritance_multi_parent.sol create mode 100644 test/libsolidity/syntaxTests/events/inheritance_removes_indexed.sol create mode 100644 test/libsolidity/syntaxTests/events/multiple_inheritance.sol create mode 100644 test/libsolidity/syntaxTests/events/overloading_in_contract.sol diff --git a/Changelog.md b/Changelog.md index 817016258631..ad06e4196abe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Breaking changes: * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. * Type Checker: Disallow assignments to state variables that contain nested mappings. + * Type checker: Disallow events with same name and parameter types in inheritance hierarchy. * ``using A for B`` only affects the contract it is mentioned in and not all derived contracts * Inline Assembly: Disallow `.` in user-defined function and variable names. diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index c0da545644a0..2ca95f2a5d54 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -120,8 +120,9 @@ void ContractLevelChecker::checkDuplicateEvents(ContractDefinition const& _contr /// Checks that two events with the same name defined in this contract have different /// argument types map> events; - for (EventDefinition const* event: _contract.events()) - events[event->name()].push_back(event); + for (auto const* contract: _contract.annotation().linearizedBaseContracts) + for (EventDefinition const* event: contract->events()) + events[event->name()].push_back(event); findDuplicateDefinitions(events); } diff --git a/test/libsolidity/syntaxTests/events/inheritance_adds_anonymous.sol b/test/libsolidity/syntaxTests/events/inheritance_adds_anonymous.sol new file mode 100644 index 000000000000..0e92a88b9b59 --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_adds_anonymous.sol @@ -0,0 +1,8 @@ +contract A { + event X(); +} +contract B is A { + event X() anonymous; +} +// ---- +// DeclarationError 5883: (52-72): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/events/inheritance_adds_indexed.sol b/test/libsolidity/syntaxTests/events/inheritance_adds_indexed.sol new file mode 100644 index 000000000000..f68a96ea9601 --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_adds_indexed.sol @@ -0,0 +1,8 @@ +contract A { + event X(uint); +} +contract B is A { + event X(uint indexed); +} +// ---- +// DeclarationError 5883: (56-78): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/events/inheritance_adds_parameter.sol b/test/libsolidity/syntaxTests/events/inheritance_adds_parameter.sol new file mode 100644 index 000000000000..d987570c326c --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_adds_parameter.sol @@ -0,0 +1,6 @@ +contract A { + event X(); +} +contract B is A { + event X(uint); +} \ No newline at end of file diff --git a/test/libsolidity/syntaxTests/events/inheritance_event_repeated.sol b/test/libsolidity/syntaxTests/events/inheritance_event_repeated.sol new file mode 100644 index 000000000000..9c19ebb33e5c --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_event_repeated.sol @@ -0,0 +1,8 @@ +contract A { + event X(uint); +} +contract B is A { + event X(uint); +} +// ---- +// DeclarationError 5883: (56-70): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/events/inheritance_multi_parent.sol b/test/libsolidity/syntaxTests/events/inheritance_multi_parent.sol new file mode 100644 index 000000000000..3724fc10c6c4 --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_multi_parent.sol @@ -0,0 +1,10 @@ +contract A { + event X(uint, uint indexed); +} +contract B { + event X(uint, uint); +} +contract C is A, B { +} +// ---- +// DeclarationError 5883: (65-85): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/events/inheritance_removes_indexed.sol b/test/libsolidity/syntaxTests/events/inheritance_removes_indexed.sol new file mode 100644 index 000000000000..6379618b1840 --- /dev/null +++ b/test/libsolidity/syntaxTests/events/inheritance_removes_indexed.sol @@ -0,0 +1,8 @@ +contract A { + event X(uint, uint indexed); +} +contract B is A { + event X(uint, uint); +} +// ---- +// DeclarationError 5883: (70-90): Event with same name and parameter types defined twice. diff --git a/test/libsolidity/syntaxTests/events/multiple_inheritance.sol b/test/libsolidity/syntaxTests/events/multiple_inheritance.sol new file mode 100644 index 000000000000..2cc158f7765f --- /dev/null +++ b/test/libsolidity/syntaxTests/events/multiple_inheritance.sol @@ -0,0 +1,4 @@ +contract A { event X(uint); } +contract B is A {} +contract C is A {} +contract D is B, C {} diff --git a/test/libsolidity/syntaxTests/events/overloading_in_contract.sol b/test/libsolidity/syntaxTests/events/overloading_in_contract.sol new file mode 100644 index 000000000000..9349f1751a3d --- /dev/null +++ b/test/libsolidity/syntaxTests/events/overloading_in_contract.sol @@ -0,0 +1,5 @@ +contract A { + event X(); + event X(uint); +} +// ---- \ No newline at end of file From 87557896ed8bf88f5860629f73c332cfdb5bd4ed Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 11 Dec 2019 13:23:43 +0000 Subject: [PATCH 369/479] Add ctz and popcnt to WasmDialect --- Changelog.md | 3 +++ libyul/backends/wasm/WasmDialect.cpp | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index e4310c339da3..a63b806970e3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### 0.6.12 (unreleased) +Language Features: + * Wasm backend: Add ``i32.ctz``, ``i64.ctz``, ``i32.popcnt``, and ``i64.popcnt``. + Compiler Features: * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. diff --git a/libyul/backends/wasm/WasmDialect.cpp b/libyul/backends/wasm/WasmDialect.cpp index 39138dfb2861..9dddddd69256 100644 --- a/libyul/backends/wasm/WasmDialect.cpp +++ b/libyul/backends/wasm/WasmDialect.cpp @@ -38,13 +38,18 @@ WasmDialect::WasmDialect() "add", "sub", "mul", + // TODO: div_s "div_u", + // TODO: rem_s "rem_u", "and", "or", "xor", "shl", + // TODO: shr_s "shr_u", + // TODO: rotl + // TODO: rotr }) addFunction(t.str() + "." + name, {t, t}, {t}); @@ -52,9 +57,13 @@ WasmDialect::WasmDialect() for (auto const& name: { "eq", "ne", + // TODO: lt_s "lt_u", + // TODO: gt_s "gt_u", + // TODO: le_s "le_u", + // TODO: ge_s "ge_u" }) addFunction(t.str() + "." + name, {t, t}, {i32}); @@ -62,8 +71,13 @@ WasmDialect::WasmDialect() addFunction("i32.eqz", {i32}, {i32}); addFunction("i64.eqz", {i64}, {i32}); - addFunction("i32.clz", {i32}, {i32}); - addFunction("i64.clz", {i64}, {i64}); + for (auto t: types) + for (auto const& name: { + "clz", + "ctz", + "popcnt", + }) + addFunction(t.str() + "." + name, {t}, {t}); addFunction("i32.wrap_i64", {i64}, {i32}); @@ -73,6 +87,7 @@ WasmDialect::WasmDialect() m_functions["i32.store"_yulstring].sideEffects.invalidatesStorage = false; addFunction("i64.store", {i32, i64}, {}, false); m_functions["i64.store"_yulstring].sideEffects.invalidatesStorage = false; + // TODO: add i32.store16, i64.store8, i64.store16, i64.store32 addFunction("i32.store8", {i32, i32}, {}, false); m_functions["i32.store8"_yulstring].sideEffects.invalidatesStorage = false; @@ -89,6 +104,7 @@ WasmDialect::WasmDialect() m_functions["i64.load"_yulstring].sideEffects.invalidatesMemory = false; m_functions["i64.load"_yulstring].sideEffects.sideEffectFree = true; m_functions["i64.load"_yulstring].sideEffects.sideEffectFreeIfNoMSize = true; + // TODO: add i32.load8, i32.load16, i64.load8, i64.load16, i64.load32 // Drop is actually overloaded for all types, but Yul does not support that. // Because of that, we introduce "i32.drop" and "i64.drop". From 8df4baac4292d72cc1fffd4851cb3c5e4c248d28 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 8 Jul 2020 23:16:43 +0100 Subject: [PATCH 370/479] Implement ctz/popcnt in yulInterpreter --- .../EwasmBuiltinInterpreter.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index 440ffcd7ab28..5ad07c5bbdf5 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -67,6 +67,50 @@ uint64_t clz64(uint64_t _v) return r; } +/// Count trailing zeros for uint32. Following WebAssembly rules, it returns 32 for @a _v being zero. +/// NOTE: the ctz builtin of the compiler may or may not do this +uint32_t ctz32(uint32_t _v) +{ + if (_v == 0) + return 32; + + uint32_t r = 0; + while (!(_v & 1)) + { + r++; + _v >>= 1; + } + return r; +} + +/// Count trailing zeros for uint64. Following WebAssembly rules, it returns 64 for @a _v being zero. +/// NOTE: the ctz builtin of the compiler may or may not do this +uint64_t ctz64(uint64_t _v) +{ + if (_v == 0) + return 64; + + uint64_t r = 0; + while (!(_v & 1)) + { + r++; + _v >>= 1; + } + return r; +} + +/// Count number of bits set for uint64 +uint64_t popcnt(uint64_t _v) +{ + uint64_t r = 0; + while (_v) + { + r += (_v & 1); + _v >>= 1; + } + return r; +} + } using u512 = boost::multiprecision::number>; @@ -139,6 +183,10 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a return clz64(arg[0] & uint32_t(-1)) - 32; else if (_fun == "i64.clz"_yulstring) return clz64(arg[0]); + else if (_fun == "i32.ctz"_yulstring) + return ctz32(uint32_t(arg[0] & uint32_t(-1))); + else if (_fun == "i64.ctz"_yulstring) + return ctz64(arg[0]); string prefix = _fun.str(); string suffix; @@ -207,6 +255,8 @@ u256 EwasmBuiltinInterpreter::evalWasmBuiltin(string const& _fun, vector c return arg[0] != arg[1] ? 1 : 0; else if (_fun == "eqz") return arg[0] == 0 ? 1 : 0; + else if (_fun == "popcnt") + return popcnt(arg[0]); else if (_fun == "lt_u") return arg[0] < arg[1] ? 1 : 0; else if (_fun == "gt_u") From a72b0deea6b637d44f97350e42422dd5654abdbe Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Mon, 13 Jul 2020 14:01:53 +0200 Subject: [PATCH 371/479] Disabling -Wsign-conversion for yul_proto_diff_custom_mutate_ossfuzz target --- test/tools/ossfuzz/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/tools/ossfuzz/CMakeLists.txt b/test/tools/ossfuzz/CMakeLists.txt index 419b2021e268..9ad7b9c80e3d 100644 --- a/test/tools/ossfuzz/CMakeLists.txt +++ b/test/tools/ossfuzz/CMakeLists.txt @@ -83,6 +83,7 @@ if (OSSFUZZ) protobuf.a ) set_target_properties(yul_proto_diff_custom_mutate_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + target_compile_options(yul_proto_diff_custom_mutate_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) add_executable(abiv2_proto_ossfuzz ../../EVMHost.cpp From fc2e9ec2ff4ca397f0aa743cc44b40352894fec2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 1 Jul 2020 19:25:14 +0200 Subject: [PATCH 372/479] Use `.slot` and `.offest` to access storage items. --- libsolidity/analysis/ReferencesResolver.cpp | 41 +++++++++++-------- libsolidity/analysis/TypeChecker.cpp | 12 +++--- .../ASTJSON/assembly/slot_offset.json | 4 +- .../ASTJSON/assembly/slot_offset.sol | 2 +- .../ASTJSON/assembly/slot_offset_legacy.json | 2 +- .../array/byte_array_storage_layout.sol | 12 +++--- .../array/delete_storage_array.sol | 2 +- .../dirty_memory_bytes_to_storgage_copy.sol | 2 +- .../inline_assembly_storage_access.sol | 6 +-- ...ssembly_storage_access_inside_function.sol | 4 +- ...ne_assembly_storage_access_via_pointer.sol | 4 +- .../inlineAssembly/slot_access.sol | 2 +- .../library_delegatecall_guard_pure.sol | 4 +- ...library_delegatecall_guard_view_needed.sol | 4 +- ...ary_delegatecall_guard_view_not_needed.sol | 4 +- .../libraries/library_function_selectors.sol | 2 +- .../library_function_selectors_struct.sol | 2 +- .../array_storage_index_zeroed_test.sol | 2 +- .../viaYul/storage/dirty_storage_bytes.sol | 2 +- .../storage/dirty_storage_bytes_long.sol | 4 +- .../storage/dirty_storage_dynamic_array.sol | 2 +- .../storage/dirty_storage_static_array.sol | 2 +- .../viaYul/storage/dirty_storage_struct.sol | 2 +- .../assembly/for_declaration_err.sol | 8 ++-- .../assembly/for_declaration_fine.sol | 4 +- .../assembly/if_declaration_err.sol | 2 +- .../returning_function_declaration.sol | 2 +- .../assembly/stub_declaration.sol | 2 +- .../assembly/switch_declaration_err.sol | 8 ++-- .../assembly/switch_declaration_fine.sol | 6 +-- .../storageReturn/assembly/for_err.sol | 8 ++-- .../storageReturn/assembly/for_fine.sol | 4 +- .../storageReturn/assembly/if_err.sol | 2 +- .../assembly/returning_function.sol | 2 +- .../storageReturn/assembly/stub.sol | 2 +- .../storageReturn/assembly/switch_err.sol | 8 ++-- .../storageReturn/assembly/switch_fine.sol | 6 +-- .../assembly/switch_only_default_warn.sol | 2 +- .../uninitializedAccess/assembly.sol | 2 +- .../invalid/constant_variable_via_offset.sol | 4 +- ...le_access_out_of_functions_storage_ptr.sol | 2 +- .../invalid/storage_assignment.sol | 2 +- .../storage_assignment_in_modifier.sol | 2 +- ...orage_variable_access_out_of_functions.sol | 2 +- .../invalid/unbalanced_two_stack_load.sol | 2 +- .../variable_declaration_suffix_offset.sol | 12 ++---- .../shadowing/name_clash_in_import.sol | 1 - .../shadowing/qualified_names.sol | 2 - .../inlineAssembly/storage_reference.sol | 2 +- .../storage_reference_assignment.sol | 6 +-- .../storage_reference_assignment_statevar.sol | 4 +- .../storage_reference_empty_offset.sol | 4 +- .../storage_reference_empty_slot.sol | 4 +- .../inlineAssembly/storage_reference_fine.sol | 4 +- .../inlineAssembly/storage_reference_old.sol | 13 ++++++ .../storage_reference_old_shadow.sol | 14 +++++++ .../storage_reference_on_function.sol | 4 +- .../storage_reference_on_memory.sol | 8 ++-- .../inlineAssembly/storage_slot_assign.yul | 6 +-- .../syntaxTests/viewPureChecker/assembly.sol | 2 +- 60 files changed, 158 insertions(+), 133 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old_shadow.sol diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index a0d70fd8fa8d..45353e2ee9d2 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -33,6 +33,7 @@ #include #include +#include #include @@ -195,9 +196,10 @@ void ReferencesResolver::operator()(yul::FunctionDefinition const& _function) void ReferencesResolver::operator()(yul::Identifier const& _identifier) { - bool isSlot = boost::algorithm::ends_with(_identifier.name.str(), "_slot"); - bool isOffset = boost::algorithm::ends_with(_identifier.name.str(), "_offset"); + bool isSlot = boost::algorithm::ends_with(_identifier.name.str(), ".slot"); + bool isOffset = boost::algorithm::ends_with(_identifier.name.str(), ".offset"); + // Could also use `pathFromCurrentScope`, split by '.' auto declarations = m_resolver.nameFromCurrentScope(_identifier.name.str()); if (isSlot || isOffset) { @@ -207,19 +209,22 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) return; string realName = _identifier.name.str().substr(0, _identifier.name.str().size() - ( isSlot ? - string("_slot").size() : - string("_offset").size() + string(".slot").size() : + string(".offset").size() )); if (realName.empty()) { m_errorReporter.declarationError( 4794_error, _identifier.location, - "In variable names _slot and _offset can only be used as a suffix." + "In variable names .slot and .offset can only be used as a suffix." ); return; } declarations = m_resolver.nameFromCurrentScope(realName); + if (!declarations.empty()) + // To support proper path resolution, we have to use pathFromCurrentScope. + solAssert(!util::contains(realName, '.'), ""); } if (declarations.size() > 1) { @@ -231,7 +236,18 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) return; } else if (declarations.size() == 0) + { + if ( + boost::algorithm::ends_with(_identifier.name.str(), "_slot") || + boost::algorithm::ends_with(_identifier.name.str(), "_offset") + ) + m_errorReporter.declarationError( + 9467_error, + _identifier.location, + "Identifier not found. Use ``.slot`` and ``.offset`` to access storage variables." + ); return; + } if (auto var = dynamic_cast(declarations.front())) if (var->isLocalVariable() && m_yulInsideFunction) { @@ -254,18 +270,9 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) { validateYulIdentifierName(identifier.name, identifier.location); - bool isSlot = boost::algorithm::ends_with(identifier.name.str(), "_slot"); - bool isOffset = boost::algorithm::ends_with(identifier.name.str(), "_offset"); - string namePrefix = identifier.name.str().substr(0, identifier.name.str().find('.')); - if (isSlot || isOffset) - m_errorReporter.declarationError( - 9155_error, - identifier.location, - "In variable declarations _slot and _offset can not be used as a suffix." - ); - else if ( - auto declarations = m_resolver.nameFromCurrentScope(namePrefix); + if ( + auto declarations = m_resolver.nameFromCurrentScope(identifier.name.str()); !declarations.empty() ) { @@ -277,8 +284,6 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) 3859_error, identifier.location, ssl, - namePrefix.size() < identifier.name.str().size() ? - "The prefix of this declaration conflicts with a declaration outside the inline assembly block." : "This declaration shadows a declaration outside the inline assembly block." ); } diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c05cceb9c0af..e23f15885260 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -767,7 +767,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } else if (requiresStorage) { - m_errorReporter.typeError(6617_error, _identifier.location, "The suffixes _offset and _slot can only be used on non-constant storage variables."); + m_errorReporter.typeError(6617_error, _identifier.location, "The suffixes .offset and .slot can only be used on non-constant storage variables."); return false; } else if (var && var->value() && !var->value()->annotation().type && !dynamic_cast(var->value().get())) @@ -795,7 +795,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) { if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage)) { - m_errorReporter.typeError(3622_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); + m_errorReporter.typeError(3622_error, _identifier.location, "The suffixes .offset and .slot can only be used on storage variables."); return false; } else if (_context == yul::IdentifierContext::LValue) @@ -807,7 +807,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } else if (identifierInfo.isOffset) { - m_errorReporter.typeError(9739_error, _identifier.location, "Only _slot can be assigned to."); + m_errorReporter.typeError(9739_error, _identifier.location, "Only .slot can be assigned to."); return false; } else @@ -816,12 +816,12 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } else if (!var->isConstant() && var->isStateVariable()) { - m_errorReporter.typeError(1408_error, _identifier.location, "Only local variables are supported. To access storage variables, use the _slot and _offset suffixes."); + m_errorReporter.typeError(1408_error, _identifier.location, "Only local variables are supported. To access storage variables, use the .slot and .offset suffixes."); return false; } else if (var->type()->dataStoredIn(DataLocation::Storage)) { - m_errorReporter.typeError(9068_error, _identifier.location, "You have to use the _slot or _offset suffix to access storage reference variables."); + m_errorReporter.typeError(9068_error, _identifier.location, "You have to use the .slot or .offset suffix to access storage reference variables."); return false; } else if (var->type()->sizeOnStack() != 1) @@ -835,7 +835,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } else if (requiresStorage) { - m_errorReporter.typeError(7944_error, _identifier.location, "The suffixes _offset and _slot can only be used on storage variables."); + m_errorReporter.typeError(7944_error, _identifier.location, "The suffixes .offset and .slot can only be used on storage variables."); return false; } else if (_context == yul::IdentifierContext::LValue) diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.json b/test/libsolidity/ASTJSON/assembly/slot_offset.json index 2bdcccadc5d6..0858fe6170d2 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.json @@ -117,7 +117,7 @@ "src": "97:17:1", "value": { - "name": "s_offset", + "name": "s.offset", "nodeType": "YulIdentifier", "src": "106:8:1" }, @@ -139,7 +139,7 @@ "arguments": [ { - "name": "s_slot", + "name": "s.slot", "nodeType": "YulIdentifier", "src": "128:6:1" }, diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.sol b/test/libsolidity/ASTJSON/assembly/slot_offset.sol index 367d661797e7..d3c8f75542e2 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.sol +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.sol @@ -2,7 +2,7 @@ contract C { struct S { uint x; } S s; function e() pure public { - assembly { let x := s_offset let y := mul(s_slot, 2) } + assembly { let x := s.offset let y := mul(s.slot, 2) } } } diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json index aa137111eb0f..50747baaac47 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset_legacy.json @@ -178,7 +178,7 @@ "valueSize": 1 } ], - "operations": "{\n let x := s_offset\n let y := mul(s_slot, 2)\n}" + "operations": "{\n let x := s.offset\n let y := mul(s.slot, 2)\n}" }, "children": [], "id": 8, diff --git a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol index b04ad9e46a6e..7277e8502f01 100644 --- a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol +++ b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol @@ -2,38 +2,38 @@ contract c { bytes data; function test_short() public returns (uint256 r) { assembly { - sstore(data_slot, 0) + sstore(data.slot, 0) } for (uint8 i = 0; i < 15; i++) { data.push(bytes1(i)); } assembly { - r := sload(data_slot) + r := sload(data.slot) } } function test_long() public returns (uint256 r) { assembly { - sstore(data_slot, 0) + sstore(data.slot, 0) } for (uint8 i = 0; i < 33; i++) { data.push(bytes1(i)); } assembly { - r := sload(data_slot) + r := sload(data.slot) } } function test_pop() public returns (uint256 r) { assembly { - sstore(data_slot, 0) + sstore(data.slot, 0) } for (uint8 i = 0; i < 32; i++) { data.push(bytes1(i)); } data.pop(); assembly { - r := sload(data_slot) + r := sload(data.slot) } } } diff --git a/test/libsolidity/semanticTests/array/delete_storage_array.sol b/test/libsolidity/semanticTests/array/delete_storage_array.sol index f0bb769788bc..d8bf81d8af54 100644 --- a/test/libsolidity/semanticTests/array/delete_storage_array.sol +++ b/test/libsolidity/semanticTests/array/delete_storage_array.sol @@ -6,7 +6,7 @@ contract C { data.push(123); delete data; assembly { - ret := sload(data_slot) + ret := sload(data.slot) } } diff --git a/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol b/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol index 8fc6c33ec4cc..bdb1a7c64cc6 100644 --- a/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol +++ b/test/libsolidity/semanticTests/dirty_memory_bytes_to_storgage_copy.sol @@ -8,7 +8,7 @@ contract C { } x = m; assembly { - r := sload(x_slot) + r := sload(x.slot) } } } diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol index 8e42595d4cad..3dfdcbc66e9d 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol @@ -7,9 +7,9 @@ contract C { uint256 off1; uint256 off2; assembly { - sstore(z_slot, 7) - off1 := z_offset - off2 := y_offset + sstore(z.slot, 7) + off1 := z.offset + off2 := y.offset } assert(off1 == 0); assert(off2 == 2); diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol index 8f48f2f52181..c7707aebe1dc 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol @@ -8,8 +8,8 @@ contract C { uint256 off2; assembly { function f() -> o1 { - sstore(z_slot, 7) - o1 := y_offset + sstore(z.slot, 7) + o1 := y.offset } off2 := f() } diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol index 3893c8e89b2f..1837098350b9 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol @@ -10,8 +10,8 @@ contract C { Data storage x = a; uint256 off; assembly { - sstore(x_slot, 7) - off := x_offset + sstore(x.slot, 7) + off := x.offset } assert(off == 0); return true; diff --git a/test/libsolidity/semanticTests/inlineAssembly/slot_access.sol b/test/libsolidity/semanticTests/inlineAssembly/slot_access.sol index 4f3be74897bd..abfc6d09be32 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/slot_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/slot_access.sol @@ -13,7 +13,7 @@ contract C { bytes32 slot = keccak256(abi.encode(uint(1), uint(0))); assembly { - _data_slot := slot + _data.slot := slot } } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol index 94e2cb45c61d..b540e9a63feb 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_pure.sol @@ -12,13 +12,13 @@ contract C { } function g() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } function h() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).call(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol index 827fbb9864a2..3c5274990f13 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_needed.sol @@ -12,13 +12,13 @@ contract C { } function g() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } function h() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).call(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } diff --git a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol index 6f09b84781c1..2d4e6468e0e3 100644 --- a/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol +++ b/test/libsolidity/semanticTests/libraries/library_delegatecall_guard_view_not_needed.sol @@ -11,13 +11,13 @@ contract C { } function g() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } function h() public returns (bool, uint256) { uint256 ys; - assembly { ys := y_slot } + assembly { ys := y.slot } (bool success, bytes memory data) = address(L).call(abi.encodeWithSelector(L.f.selector, ys)); return (success, success ? abi.decode(data,(uint256)) : 0); } diff --git a/test/libsolidity/semanticTests/libraries/library_function_selectors.sol b/test/libsolidity/semanticTests/libraries/library_function_selectors.sol index 185c34492206..baeb5ceddc2c 100644 --- a/test/libsolidity/semanticTests/libraries/library_function_selectors.sol +++ b/test/libsolidity/semanticTests/libraries/library_function_selectors.sol @@ -12,7 +12,7 @@ contract C { } function g() public returns (bool, bool, uint256) { uint256 s_ptr; - assembly { s_ptr := s_slot } + assembly { s_ptr := s.slot } (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.g.selector, s_ptr)); return (L.g.selector == bytes4(keccak256("g(uint256[] storage)")), success, abi.decode(data, (uint256))); } diff --git a/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol b/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol index ea3bfb682047..8081b0e24715 100644 --- a/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol +++ b/test/libsolidity/semanticTests/libraries/library_function_selectors_struct.sol @@ -10,7 +10,7 @@ contract C { function f() public returns (bool, bool, uint256) { uint256 s_ptr; - assembly { s_ptr := s_slot } + assembly { s_ptr := s.slot } (bool success, bytes memory data) = address(L).delegatecall(abi.encodeWithSelector(L.f.selector, s_ptr)); return (L.f.selector == bytes4(keccak256("f(L.S storage)")), success, abi.decode(data, (uint256))); } diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol index 98b25a40ed27..c0ae21681a7d 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol @@ -20,7 +20,7 @@ contract C { for (uint i = 3; i < len; i++) { assembly { - mstore(0, storageArray_slot) + mstore(0, storageArray.slot) let pos := add(keccak256(0, 0x20), i) if iszero(eq(sload(pos), 0)) { diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol index ea0112fe521a..d79bceb55d0c 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol @@ -2,7 +2,7 @@ contract C { bytes b; function f() public returns (bool correct) { assembly { - sstore(b_slot, or("deadbeef", 0x08)) + sstore(b.slot, or("deadbeef", 0x08)) } byte s = b[3]; uint r; 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 9cb01d63a814..6770df0f3c85 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes_long.sol @@ -2,8 +2,8 @@ contract C { bytes b; function f() public returns (bool correct) { assembly { - sstore(b_slot, 0x41) - mstore(0, b_slot) + sstore(b.slot, 0x41) + mstore(0, b.slot) sstore(keccak256(0, 0x20), "deadbeefdeadbeefdeadbeefdeadbeef") } byte s = b[31]; diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol index bc886b93d914..011cf7d88a95 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_dynamic_array.sol @@ -3,7 +3,7 @@ contract C { function f() public returns (bool correct) { s.push(); assembly { - mstore(0, s_slot) + mstore(0, s.slot) sstore(keccak256(0, 0x20), 257) } uint8 x = s[0]; diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol index 7d7298fee7ad..e3bec359dd47 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol @@ -2,7 +2,7 @@ contract C { uint8[1] s; function f() public returns (bool correct) { assembly { - sstore(s_slot, 257) + sstore(s.slot, 257) } uint8 x = s[0]; uint r; diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol index 1cf19c5beb21..695184c8ff56 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_struct.sol @@ -6,7 +6,7 @@ contract C { function f() public returns (bool correct) { s.m.push(); assembly { - mstore(0, s_slot) + mstore(0, s.slot) sstore(keccak256(0, 0x20), 257) } uint8 x = s.m[0]; diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol index 516861a8cf01..61c3822827c7 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_err.sol @@ -4,28 +4,28 @@ contract C { function f() internal pure { S storage c; assembly { - for {} eq(0,0) { c_slot := s_slot } {} + for {} eq(0,0) { c.slot := s.slot } {} } c; } function g() internal pure { S storage c; assembly { - for {} eq(0,1) { c_slot := s_slot } {} + for {} eq(0,1) { c.slot := s.slot } {} } c; } function h() internal pure { S storage c; assembly { - for {} eq(0,0) {} { c_slot := s_slot } + for {} eq(0,0) {} { c.slot := s.slot } } c; } function i() internal pure { S storage c; assembly { - for {} eq(0,1) {} { c_slot := s_slot } + for {} eq(0,1) {} { c.slot := s.slot } } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_fine.sol index 19a58b2349bf..4d797e6bdea0 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/for_declaration_fine.sol @@ -4,14 +4,14 @@ contract C { function f() internal pure { S storage c; assembly { - for { c_slot := s_slot } iszero(0) {} {} + for { c.slot := s.slot } iszero(0) {} {} } c; } function g() internal pure { S storage c; assembly { - for { c_slot := s_slot } iszero(1) {} {} + for { c.slot := s.slot } iszero(1) {} {} } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol index 13874595c3cb..120199c14cf5 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/if_declaration_err.sol @@ -4,7 +4,7 @@ contract C { function f(bool flag) internal pure { S storage c; assembly { - if flag { c_slot := s_slot } + if flag { c.slot := s.slot } } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/returning_function_declaration.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/returning_function_declaration.sol index 180feb770be2..6c4ee97d6fab 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/returning_function_declaration.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/returning_function_declaration.sol @@ -7,7 +7,7 @@ contract C { assembly { function f() { return(0, 0) } f() - c_slot := s_slot + c.slot := s.slot } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/stub_declaration.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/stub_declaration.sol index c3f2409158ea..f637652c1d60 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/stub_declaration.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/stub_declaration.sol @@ -4,7 +4,7 @@ contract C { function f() internal pure { S storage c; assembly { - c_slot := s_slot + c.slot := s.slot } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol index c3aff356adc4..da2f2fe61193 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_err.sol @@ -5,7 +5,7 @@ contract C { S storage c; assembly { switch a - case 0 { c_slot := s_slot } + case 0 { c.slot := s.slot } } c; } @@ -13,8 +13,8 @@ contract C { S storage c; assembly { switch flag - case 0 { c_slot := s_slot } - case 1 { c_slot := s_slot } + case 0 { c.slot := s.slot } + case 1 { c.slot := s.slot } } c; } @@ -22,7 +22,7 @@ contract C { S storage c; assembly { switch a - case 0 { c_slot := s_slot } + case 0 { c.slot := s.slot } default { return(0,0) } } c; diff --git a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol index a32599d7bc1d..a92664f4d088 100644 --- a/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/localStorageVariables/assembly/switch_declaration_fine.sol @@ -5,8 +5,8 @@ contract C { S storage c; assembly { switch flag - case 0 { c_slot := s_slot } - default { c_slot := s_slot } + case 0 { c.slot := s.slot } + default { c.slot := s.slot } } c; } @@ -15,7 +15,7 @@ contract C { assembly { switch a case 0 { revert(0, 0) } - default { c_slot := s_slot } + default { c.slot := s.slot } } c; } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol index f4446922876d..5195d037994c 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_err.sol @@ -3,22 +3,22 @@ contract C { S s; function f() internal pure returns (S storage c) { assembly { - for {} eq(0,0) { c_slot := s_slot } {} + for {} eq(0,0) { c.slot := s.slot } {} } } function g() internal pure returns (S storage c) { assembly { - for {} eq(0,1) { c_slot := s_slot } {} + for {} eq(0,1) { c.slot := s.slot } {} } } function h() internal pure returns (S storage c) { assembly { - for {} eq(0,0) {} { c_slot := s_slot } + for {} eq(0,0) {} { c.slot := s.slot } } } function i() internal pure returns (S storage c) { assembly { - for {} eq(0,1) {} { c_slot := s_slot } + for {} eq(0,1) {} { c.slot := s.slot } } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_fine.sol index ac3532aaf3a4..3160c9e287d7 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/for_fine.sol @@ -3,12 +3,12 @@ contract C { S s; function f() internal pure returns (S storage c) { assembly { - for { c_slot := s_slot } iszero(0) {} {} + for { c.slot := s.slot } iszero(0) {} {} } } function g() internal pure returns (S storage c) { assembly { - for { c_slot := s_slot } iszero(1) {} {} + for { c.slot := s.slot } iszero(1) {} {} } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol index 1bf0d25c39b6..7e3ceeb2014a 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/if_err.sol @@ -3,7 +3,7 @@ contract C { S s; function f(bool flag) internal pure returns (S storage c) { assembly { - if flag { c_slot := s_slot } + if flag { c.slot := s.slot } } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/returning_function.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/returning_function.sol index 81b6bcfe7268..fbff48f46d12 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/returning_function.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/returning_function.sol @@ -6,7 +6,7 @@ contract C { assembly { function f() { return(0, 0) } f() - c_slot := s_slot + c.slot := s.slot } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/stub.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/stub.sol index e5873f3d1a35..df747d623a06 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/stub.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/stub.sol @@ -3,7 +3,7 @@ contract C { S s; function f() internal pure returns (S storage c) { assembly { - c_slot := s_slot + c.slot := s.slot } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol index a0dfa5dd4b92..414078fb1522 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_err.sol @@ -4,20 +4,20 @@ contract C { function f(uint256 a) internal pure returns (S storage c) { assembly { switch a - case 0 { c_slot := s_slot } + case 0 { c.slot := s.slot } } } function g(bool flag) internal pure returns (S storage c) { assembly { switch flag - case 0 { c_slot := s_slot } - case 1 { c_slot := s_slot } + case 0 { c.slot := s.slot } + case 1 { c.slot := s.slot } } } function h(uint256 a) internal pure returns (S storage c) { assembly { switch a - case 0 { c_slot := s_slot } + case 0 { c.slot := s.slot } default { return(0,0) } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol index 8d0b564fcfa3..42f58eac3a90 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_fine.sol @@ -4,15 +4,15 @@ contract C { function f(bool flag) internal pure returns (S storage c) { assembly { switch flag - case 0 { c_slot := s_slot } - default { c_slot := s_slot } + case 0 { c.slot := s.slot } + default { c.slot := s.slot } } } function g(uint256 a) internal pure returns (S storage c) { assembly { switch a case 0 { revert(0, 0) } - default { c_slot := s_slot } + default { c.slot := s.slot } } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol index ce4d4b2621a3..611f68624945 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/assembly/switch_only_default_warn.sol @@ -4,7 +4,7 @@ contract C { function f(uint256 a) internal pure returns (S storage c) { assembly { switch a - default { c_slot := s_slot } + default { c.slot := s.slot } } } } diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol index cb9f2d54c422..4b3f17219eee 100644 --- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol +++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/assembly.sol @@ -1,7 +1,7 @@ contract C { uint[] r; function f() internal view returns (uint[] storage s) { - assembly { pop(s_slot) } + assembly { pop(s.slot) } s = r; } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol index 063199ab4022..eab2d2b4ef2f 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/constant_variable_via_offset.sol @@ -2,9 +2,9 @@ contract test { uint constant x = 2; function f() pure public { assembly { - let r := x_offset + let r := x.offset } } } // ---- -// TypeError 6617: (112-120): The suffixes _offset and _slot can only be used on non-constant storage variables. +// TypeError 6617: (112-120): The suffixes .offset and .slot can only be used on non-constant storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol index d8df7e45d7ec..24cc283b1238 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/local_variable_access_out_of_functions_storage_ptr.sol @@ -3,7 +3,7 @@ contract test { function f() public { uint[] storage a = r; assembly { - function g() -> x { x := a_offset } + function g() -> x { x := a.offset } } } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol index fa1c97431983..f833d1740cb8 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// TypeError 1408: (89-90): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (89-90): Only local variables are supported. To access storage variables, use the .slot and .offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol index 945295e779fd..a86fdc14b78d 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_assignment_in_modifier.sol @@ -10,4 +10,4 @@ contract test { } } // ---- -// TypeError 1408: (80-81): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (80-81): Only local variables are supported. To access storage variables, use the .slot and .offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_variable_access_out_of_functions.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_variable_access_out_of_functions.sol index abe9067a5f28..9d2db81627bc 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_variable_access_out_of_functions.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/storage_variable_access_out_of_functions.sol @@ -2,7 +2,7 @@ contract test { uint a; function f() pure public { assembly { - function g() -> x { x := a_slot } + function g() -> x { x := a.slot } } } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol index b41cd93dfaf7..9f51fe572ca6 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/unbalanced_two_stack_load.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// TypeError 1408: (75-76): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError 1408: (75-76): Only local variables are supported. To access storage variables, use the .slot and .offset suffixes. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol index 68de25206673..dd69058f305b 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/variable_declaration_suffix_offset.sol @@ -1,15 +1,11 @@ contract C { function f() public pure { assembly { - let x_offset := 1 - let x_slot := 1 - let _offset := 1 - let _slot := 1 + let x.offset := 1 + let x.slot := 1 } } } // ---- -// DeclarationError 9155: (79-87): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError 9155: (109-115): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError 9155: (137-144): In variable declarations _slot and _offset can not be used as a suffix. -// DeclarationError 9155: (166-171): In variable declarations _slot and _offset can not be used as a suffix. +// DeclarationError 3927: (79-87): User-defined identifiers in inline assembly cannot contain '.'. +// DeclarationError 3927: (109-115): User-defined identifiers in inline assembly cannot contain '.'. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol index e0ae12e95162..c5cc1a5781fb 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/name_clash_in_import.sol @@ -16,4 +16,3 @@ contract B { // ---- // DeclarationError 3859: (b:105-106): This declaration shadows a declaration outside the inline assembly block. // DeclarationError 3927: (b:128-131): User-defined identifiers in inline assembly cannot contain '.'. -// DeclarationError 3859: (b:128-131): The prefix of this declaration conflicts with a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol index 2f54bab68b13..ea410943e7c8 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/shadowing/qualified_names.sol @@ -11,6 +11,4 @@ contract C { } // ---- // DeclarationError 3927: (115-118): User-defined identifiers in inline assembly cannot contain '.'. -// DeclarationError 3859: (115-118): The prefix of this declaration conflicts with a declaration outside the inline assembly block. // DeclarationError 3927: (140-143): User-defined identifiers in inline assembly cannot contain '.'. -// DeclarationError 3859: (140-143): The prefix of this declaration conflicts with a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol index 649195c17326..91ea7aea4d91 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError 9068: (118-119): You have to use the _slot or _offset suffix to access storage reference variables. +// TypeError 9068: (118-119): You have to use the .slot or .offset suffix to access storage reference variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol index effe604601a0..4f8e36068e0a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol @@ -3,10 +3,10 @@ contract C { fallback() external { uint[] storage y = x; assembly { - y_slot := 1 - y_offset := 2 + y.slot := 1 + y.offset := 2 } } } // ---- -// TypeError 9739: (138-146): Only _slot can be assigned to. +// TypeError 9739: (138-146): Only .slot can be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol index 783306b5e215..f4ed7c378730 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment_statevar.sol @@ -2,8 +2,8 @@ contract C { uint[] x; fallback() external { assembly { - x_slot := 1 - x_offset := 2 + x.slot := 1 + x.offset := 2 } } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol index 479b34718934..ab13d1dd6b1a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol @@ -1,9 +1,9 @@ contract C { function f() public pure { assembly { - let x := _offset + let x := .offset } } } // ---- -// DeclarationError 4794: (84-91): In variable names _slot and _offset can only be used as a suffix. +// ParserError 1856: (84-85): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol index b0f383d3ad15..43d5ab8e2286 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol @@ -1,9 +1,9 @@ contract C { function f() public pure { assembly { - let x := _slot + let x := .slot } } } // ---- -// DeclarationError 4794: (84-89): In variable names _slot and _offset can only be used as a suffix. +// ParserError 1856: (84-85): Literal or identifier expected. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol index fd5d2596a4f5..362a5c6472bb 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol @@ -3,8 +3,8 @@ contract C { fallback() external { uint[] storage y = x; assembly { - pop(y_slot) - pop(y_offset) + pop(y.slot) + pop(y.offset) } } } diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old.sol new file mode 100644 index 000000000000..4b50fbd6ea45 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old.sol @@ -0,0 +1,13 @@ +contract C { + uint[] x; + fallback() external { + uint[] storage y = x; + assembly { + pop(y_slot) + pop(y_offset) + } + } +} +// ---- +// DeclarationError 9467: (118-124): Identifier not found. Use ``.slot`` and ``.offset`` to access storage variables. +// DeclarationError 9467: (142-150): Identifier not found. Use ``.slot`` and ``.offset`` to access storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old_shadow.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old_shadow.sol new file mode 100644 index 000000000000..9914eb09ffd5 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_old_shadow.sol @@ -0,0 +1,14 @@ +contract C { + uint[] x; + fallback() external { + uint y_slot = 2; + uint y_offset = 3; + uint[] storage y = x; + assembly { + pop(y_slot) + pop(y_offset) + } + y[0] = 2; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol index 8f680ec3cd66..b5ac0b1d8a10 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_function.sol @@ -1,9 +1,9 @@ contract C { function f() pure public { assembly { - let x := f_slot + let x := f.slot } } } // ---- -// TypeError 7944: (84-90): The suffixes _offset and _slot can only be used on storage variables. +// TypeError 7944: (84-90): The suffixes .offset and .slot can only be used on storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol index 552a717dd910..d85bc8c280cc 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol @@ -3,11 +3,11 @@ contract C { fallback() external { uint[] memory y = x; assembly { - pop(y_slot) - pop(y_offset) + pop(y.slot) + pop(y.offset) } } } // ---- -// TypeError 3622: (117-123): The suffixes _offset and _slot can only be used on storage variables. -// TypeError 3622: (141-149): The suffixes _offset and _slot can only be used on storage variables. +// TypeError 3622: (117-123): The suffixes .offset and .slot can only be used on storage variables. +// TypeError 3622: (141-149): The suffixes .offset and .slot can only be used on storage variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul b/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul index effe604601a0..4f8e36068e0a 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_slot_assign.yul @@ -3,10 +3,10 @@ contract C { fallback() external { uint[] storage y = x; assembly { - y_slot := 1 - y_offset := 2 + y.slot := 1 + y.offset := 2 } } } // ---- -// TypeError 9739: (138-146): Only _slot can be assigned to. +// TypeError 9739: (138-146): Only .slot can be assigned to. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol b/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol index 92b5e4c8b502..c3ab88b5bd98 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol @@ -2,7 +2,7 @@ contract C { struct S { uint x; } S s; function e() pure public { - assembly { mstore(keccak256(0, 20), mul(s_slot, 2)) } + assembly { mstore(keccak256(0, 20), mul(s.slot, 2)) } } function f() pure public { uint x; From 9b5611dda686c84adfdfe64c8be5d606058114f9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 Jul 2020 15:25:11 +0200 Subject: [PATCH 373/479] Documentation. --- Changelog.md | 1 + docs/070-breaking-changes.rst | 1 + docs/assembly.rst | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Changelog.md b/Changelog.md index f2c057e94373..676a57f5bd68 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ Breaking changes: * Type Checker: Disallow assignments to state variables that contain nested mappings. * ``using A for B`` only affects the contract it is mentioned in and not all derived contracts * Inline Assembly: Disallow `.` in user-defined function and variable names. + * Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``. Language Features: * Yul: Disallow EVM instruction `pc()`. diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 1c6ba132e425..9c2d43e417cd 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -21,3 +21,4 @@ This section gives detailed instructions on how to update prior code for every b * Repeat the ``using A for B`` statements in all derived contracts if needed. * Remove the ``public`` keyword from every constructor. * Remove the ``internal`` keyword from every constructor and add ``abstract`` to the contract (if not already present). +* Change ``_slot`` and ``_offset`` suffixes in inline assembly to ``.slot`` and ``.offset``, respectively. diff --git a/docs/assembly.rst b/docs/assembly.rst index 713a3f8ef7ee..b54800d46168 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -132,14 +132,15 @@ For local storage variables or state variables, a single Yul identifier is not sufficient, since they do not necessarily occupy a single full storage slot. Therefore, their "address" is composed of a slot and a byte-offset inside that slot. To retrieve the slot pointed to by the variable ``x``, you -use ``x_slot``, and to retrieve the byte-offset you use ``x_offset``. +use ``x.slot``, and to retrieve the byte-offset you use ``x.offset``. +Using ``x`` itself will result in an error. Local Solidity variables are available for assignments, for example: .. code:: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.16 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract C { uint b; @@ -147,7 +148,7 @@ Local Solidity variables are available for assignments, for example: assembly { // We ignore the storage slot offset, we know it is zero // in this special case. - r := mul(x, sload(b_slot)) + r := mul(x, sload(b.slot)) } } } @@ -164,20 +165,21 @@ Local Solidity variables are available for assignments, for example: ``assembly { signextend(, x) }`` -Since Solidity 0.6.0 the name of a inline assembly variable may not end in ``_offset`` or ``_slot`` -and it may not shadow any declaration visible in the scope of the inline assembly block -(including variable, contract and function declarations). Similarly, if the name of a declared -variable contains a dot ``.``, the prefix up to the ``.`` may not conflict with any -declaration visible in the scope of the inline assembly block. +Since Solidity 0.6.0 the name of a inline assembly variable may not +shadow any declaration visible in the scope of the inline assembly block +(including variable, contract and function declarations). +Since Solidity 0.7.0, variables and functions declared inside the +inline assembly block may not contain ``.``, but using ``.`` is +valid to access Solidity variables from outside the inline assembly block. Assignments are possible to assembly-local variables and to function-local variables. Take care that when you assign to variables that point to memory or storage, you will only change the pointer and not the data. -You can assign to the ``_slot`` part of a local storage variable pointer. -For these (structs, arrays or mappings), the ``_offset`` part is always zero. -It is not possible to assign to the ``_slot`` or ``_offset`` part of a state variable, +You can assign to the ``.slot`` part of a local storage variable pointer. +For these (structs, arrays or mappings), the ``.offset`` part is always zero. +It is not possible to assign to the ``.slot`` or ``.offset`` part of a state variable, though. From 59fd1b894a9f51a4740cdd3660e9cf6528a34eed Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 9 Jul 2020 15:25:48 +0200 Subject: [PATCH 374/479] Allow dots in assembly identifiers. --- docs/Solidity.g4 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index af351731b28f..d4e86c523063 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -306,7 +306,7 @@ assemblyBlock : '{' assemblyItem* '}' ; assemblyExpression - : assemblyCall | assemblyLiteral ; + : assemblyCall | assemblyLiteral | assemblyIdentifier ; assemblyCall : ( 'return' | 'address' | 'byte' | identifier ) ( '(' assemblyExpression? ( ',' assemblyExpression )* ')' )? ; @@ -318,7 +318,10 @@ assemblyAssignment : assemblyIdentifierList ':=' assemblyExpression ; assemblyIdentifierList - : identifier ( ',' identifier )* ; + : assemblyIdentifier ( ',' assemblyIdentifier )* ; + +assemblyIdentifier + : identifier ( '.' identifier )* ; assemblyStackAssignment : '=:' identifier ; From 080f33a72c31b07e185e04088873285fcf2db1db Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 13 Jul 2020 11:16:30 +0200 Subject: [PATCH 375/479] Remove swap after dup. --- Changelog.md | 1 + libevmasm/PeepholeOptimiser.cpp | 26 +++++++++- test/cmdlineTests/dup_opt_peephole/args | 1 + test/cmdlineTests/dup_opt_peephole/err | 5 ++ test/cmdlineTests/dup_opt_peephole/input.sol | 9 ++++ test/cmdlineTests/dup_opt_peephole/output | 54 ++++++++++++++++++++ 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 test/cmdlineTests/dup_opt_peephole/args create mode 100644 test/cmdlineTests/dup_opt_peephole/err create mode 100644 test/cmdlineTests/dup_opt_peephole/input.sol create mode 100644 test/cmdlineTests/dup_opt_peephole/output diff --git a/Changelog.md b/Changelog.md index e4310c339da3..f82e99119b08 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Bugfixes: Compiler Features: * Build System: Update internal dependency of jsoncpp to 1.9.3. * Optimizer: Add rule to remove shifts inside the byte opcode. + * Peephole Optimizer: Add rule to remove swap after dup. ### 0.6.11 (2020-07-07) diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 861cae0f2bdf..343f2f824875 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -205,6 +205,30 @@ struct SwapComparison: SimplePeepholeOptimizerMethod } }; +/// Remove swapN after dupN +struct DupSwap: SimplePeepholeOptimizerMethod +{ + static size_t applySimple( + AssemblyItem const& _dupN, + AssemblyItem const& _swapN, + std::back_insert_iterator _out + ) + { + if ( + SemanticInformation::isDupInstruction(_dupN) && + SemanticInformation::isSwapInstruction(_swapN) && + getDupNumber(_dupN.instruction()) == getSwapNumber(_swapN.instruction()) + ) + { + *_out = _dupN; + return true; + } + else + return false; + } +}; + + struct IsZeroIsZeroJumpI: SimplePeepholeOptimizerMethod { static size_t applySimple( @@ -357,7 +381,7 @@ bool PeepholeOptimiser::optimise() applyMethods( state, PushPop(), OpPop(), DoublePush(), DoubleSwap(), CommutativeSwap(), SwapComparison(), - IsZeroIsZeroJumpI(), JumpToNext(), UnreachableCode(), + DupSwap(), IsZeroIsZeroJumpI(), JumpToNext(), UnreachableCode(), TagConjunctions(), TruthyAnd(), Identity() ); if (m_optimisedItems.size() < m_items.size() || ( diff --git a/test/cmdlineTests/dup_opt_peephole/args b/test/cmdlineTests/dup_opt_peephole/args new file mode 100644 index 000000000000..d3047670e161 --- /dev/null +++ b/test/cmdlineTests/dup_opt_peephole/args @@ -0,0 +1 @@ +--asm \ No newline at end of file diff --git a/test/cmdlineTests/dup_opt_peephole/err b/test/cmdlineTests/dup_opt_peephole/err new file mode 100644 index 000000000000..cfaa88dcfeba --- /dev/null +++ b/test/cmdlineTests/dup_opt_peephole/err @@ -0,0 +1,5 @@ +Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. +--> dup_opt_peephole/input.sol + +Warning: Source file does not specify required compiler version! +--> dup_opt_peephole/input.sol diff --git a/test/cmdlineTests/dup_opt_peephole/input.sol b/test/cmdlineTests/dup_opt_peephole/input.sol new file mode 100644 index 000000000000..1474a8f44668 --- /dev/null +++ b/test/cmdlineTests/dup_opt_peephole/input.sol @@ -0,0 +1,9 @@ +contract C { + fallback() external { + assembly { + let x := calldataload(0) + x := x + sstore(0, x) + } + } +} diff --git a/test/cmdlineTests/dup_opt_peephole/output b/test/cmdlineTests/dup_opt_peephole/output new file mode 100644 index 000000000000..020260c2b39e --- /dev/null +++ b/test/cmdlineTests/dup_opt_peephole/output @@ -0,0 +1,54 @@ + +======= dup_opt_peephole/input.sol:C ======= +EVM assembly: + /* "dup_opt_peephole/input.sol":0:111 contract C {... */ + mstore(0x40, 0x80) + callvalue + dup1 + iszero + tag_1 + jumpi + 0x00 + dup1 + revert +tag_1: + pop + dataSize(sub_0) + dup1 + dataOffset(sub_0) + 0x00 + codecopy + 0x00 + return +stop + +sub_0: assembly { + /* "dup_opt_peephole/input.sol":0:111 contract C {... */ + mstore(0x40, 0x80) + callvalue + dup1 + iszero + tag_3 + jumpi + 0x00 + dup1 + revert + tag_3: + pop + /* "dup_opt_peephole/input.sol":74:75 0 */ + 0x00 + /* "dup_opt_peephole/input.sol":61:76 calldataload(0) */ + calldataload + /* "dup_opt_peephole/input.sol":100:101 x */ + dup1 + /* "dup_opt_peephole/input.sol":97:98 0 */ + 0x00 + /* "dup_opt_peephole/input.sol":90:102 sstore(0, x) */ + sstore + /* "dup_opt_peephole/input.sol":47:106 {... */ + pop + /* "dup_opt_peephole/input.sol":0:111 contract C {... */ + stop + + auxdata: AUXDATA REMOVED +} From bb2faf5e490d706ae5ca7a9db148f360a4e9e1a3 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Wed, 8 Jul 2020 21:11:45 +0530 Subject: [PATCH 376/479] Updated docs --- docs/using-the-compiler.rst | 130 ++++++++++++++---------------------- 1 file changed, 51 insertions(+), 79 deletions(-) diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index d37934ccad00..9ef1758c1219 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -635,116 +635,88 @@ If you found a bug or if you have a feature request, please Example ~~~~~~~ -Assume you have the following contracts you want to update declared in ``Source.sol``: +Assume that you have the following contract in ``Source.sol``: -.. code-block:: none +.. code-block:: solidity - // This will not compile after 0.5.0 + pragma solidity >=0.6.0 <0.6.4; + // This will not compile after 0.7.0 // SPDX-License-Identifier: GPL-3.0 - pragma solidity >0.4.23 <0.5.0; - - contract Updateable { - function run() public view returns (bool); - function update() public; + contract C { + // FIXME: remove constructor visibility and make the contract abstract + constructor() internal {} } - contract Upgradable { - function run() public view returns (bool); - function upgrade(); + contract D { + uint time; + + function f() public payable { + // FIXME: change now to block.timestamp + time = now; + } } - contract Source is Updateable, Upgradable { - function Source() public {} + contract E { + D d; - function run() - public - view - returns (bool) {} + // FIXME: remove constructor visibility + constructor() public {} - function update() {} - function upgrade() {} + function g() public { + // FIXME: change .value(5) => {value: 5} + d.f.value(5)(); + } } + Required changes ^^^^^^^^^^^^^^^^ -To bring the contracts up to date with the current Solidity version, the -following upgrade modules have to be executed: ``constructor``, -``visibility``, ``abstract``, ``override`` and ``virtual``. Please read the -documentation on :ref:`available modules ` for further details. +The above contract will not compile starting from 0.7.0. To bring the contract up to date with the +current Solidity version, the following upgrade modules have to be executed: +``constructor-visibility``, ``now`` and ``dotsyntax``. Please read the documentation on +:ref:`available modules ` for further details. + Running the upgrade ^^^^^^^^^^^^^^^^^^^ -In this example, all modules needed to upgrade the contracts above, -are available and all of them are activated by default. Therefore you -do not need to specify the ``--modules`` option. +It is recommended to explicitly specify the upgrade modules by using ``--modules`` argument. .. code-block:: none - $ solidity-upgrade Source.sol --dry-run - -.. code-block:: none - - Running analysis (and upgrade) on given source files. - .............. - - After upgrade: - - Found 0 errors. - Found 0 upgrades. - -The above performs a dry-run upgrade on the given file and logs statistics at -the end. In this case, the upgrade was successful and no further adjustments are -needed. - -Finally, you can run the upgrade and also write to the source file. - -.. code-block:: none + $ solidity-upgrade --modules constructor-visibility,now,dotsyntax Source.sol - $ solidity-upgrade Source.sol - -.. code-block:: none - - Running analysis (and upgrade) on given source files. - .............. - - After upgrade: - - Found 0 errors. - Found 0 upgrades. - - -Review changes -^^^^^^^^^^^^^^ - -The command above applies all changes as shown below. Please review them carefully. +The command above applies all changes as shown below. Please review them carefully (the pragmas will +have to be updated manually.) .. code-block:: solidity - // SPDX-License-Identifier: GPL-3.0 pragma solidity >0.6.99 <0.8.0; - - abstract contract Updateable { - function run() public view virtual returns (bool); - function update() public virtual; + // SPDX-License-Identifier: GPL-3.0 + abstract contract C { + // FIXME: remove constructor visibility and make the contract abstract + constructor() {} } - abstract contract Upgradable { - function run() public view virtual returns (bool); - function upgrade() public virtual; + contract D { + uint time; + + function f() public payable { + // FIXME: change now to block.timestamp + time = block.timestamp; + } } - contract Source is Updateable, Upgradable { - constructor() {} + contract E { + D d; - function run() - public - view - override(Updateable,Upgradable) - returns (bool) {} + // FIXME: remove constructor visibility + constructor() {} - function update() public override {} - function upgrade() public override {} + function g() public { + // FIXME: change .value(5) => {value: 5} + d.f{value: 5}(); + } } From def0ebbb3e4a8eeb68d2e29155778eb7ede59188 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Jul 2020 17:39:23 +0200 Subject: [PATCH 377/479] Free variables directly after visiting RHS of Variable Declarations during EVMCodeTransform. --- Changelog.md | 1 + libyul/backends/evm/EVMCodeTransform.cpp | 14 +++--- libyul/backends/evm/EVMCodeTransform.h | 5 +- test/libyul/StackReuseCodegen.cpp | 63 ++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 8 deletions(-) diff --git a/Changelog.md b/Changelog.md index e140ebea529d..047b06ddfa0c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Language Features: Compiler Features: * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. * Peephole Optimizer: Remove unnecessary masking of tags. + * Yul EVM Code Transform: Free stack slots directly after visiting the right-hand-side of variable declarations instead of at the end of the statement only. Bugfixes: * Type Checker: Fix overload resolution in combination with ``{value: ...}``. diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 6b0f06e019f4..041e0038019c 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -141,7 +141,7 @@ bool CodeTransform::unreferenced(Scope::Variable const& _var) const return !m_context->variableReferences.count(&_var) || m_context->variableReferences[&_var] == 0; } -void CodeTransform::freeUnusedVariables() +void CodeTransform::freeUnusedVariables(bool _popUnusedSlotsAtStackTop) { if (!m_allowStackOpt) return; @@ -154,11 +154,12 @@ void CodeTransform::freeUnusedVariables() deleteVariable(var); } - while (m_unusedStackSlots.count(m_assembly.stackHeight() - 1)) - { - yulAssert(m_unusedStackSlots.erase(m_assembly.stackHeight() - 1), ""); - m_assembly.appendInstruction(evmasm::Instruction::POP); - } + if (_popUnusedSlotsAtStackTop) + while (m_unusedStackSlots.count(m_assembly.stackHeight() - 1)) + { + yulAssert(m_unusedStackSlots.erase(m_assembly.stackHeight() - 1), ""); + m_assembly.appendInstruction(evmasm::Instruction::POP); + } } void CodeTransform::deleteVariable(Scope::Variable const& _var) @@ -181,6 +182,7 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl) { std::visit(*this, *_varDecl.value); expectDeposit(static_cast(numVariables), static_cast(heightAtStart)); + freeUnusedVariables(false); } else { diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 3c9506b4797f..1cfa6afd7ebb 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -161,8 +161,9 @@ class CodeTransform bool unreferenced(Scope::Variable const& _var) const; /// Marks slots of variables that are not used anymore /// and were defined in the current scope for reuse. - /// Also POPs unused topmost stack slots. - void freeUnusedVariables(); + /// Also POPs unused topmost stack slots, + /// unless @a _popUnusedSlotsAtStackTop is set to false. + void freeUnusedVariables(bool _popUnusedSlotsAtStackTop = true); /// Marks the stack slot of @a _var to be reused. void deleteVariable(Scope::Variable const& _var); diff --git a/test/libyul/StackReuseCodegen.cpp b/test/libyul/StackReuseCodegen.cpp index eec882e8c5bf..1b6b91657944 100644 --- a/test/libyul/StackReuseCodegen.cpp +++ b/test/libyul/StackReuseCodegen.cpp @@ -345,6 +345,69 @@ BOOST_AUTO_TEST_CASE(reuse_slots_function_with_gaps) ); } +BOOST_AUTO_TEST_CASE(reuse_on_decl_assign_to_last_used) +{ + string in = R"({ + let x := 5 + let y := x // y should reuse the stack slot of x + sstore(y, y) + })"; + BOOST_CHECK_EQUAL(assemble(in), + "PUSH1 0x5 " + "DUP1 SWAP1 POP " + "DUP1 DUP2 SSTORE " + "POP " + ); +} + +BOOST_AUTO_TEST_CASE(reuse_on_decl_assign_to_last_used_expr) +{ + string in = R"({ + let x := 5 + let y := add(x, 2) // y should reuse the stack slot of x + sstore(y, y) + })"; + BOOST_CHECK_EQUAL(assemble(in), + "PUSH1 0x5 " + "PUSH1 0x2 DUP2 ADD " + "SWAP1 POP " + "DUP1 DUP2 SSTORE " + "POP " + ); +} + +BOOST_AUTO_TEST_CASE(reuse_on_decl_assign_to_not_last_used) +{ + string in = R"({ + let x := 5 + let y := x // y should not reuse the stack slot of x, since x is still used below + sstore(y, x) + })"; + BOOST_CHECK_EQUAL(assemble(in), + "PUSH1 0x5 " + "DUP1 " + "DUP2 DUP2 SSTORE " + "POP POP " + ); +} + +BOOST_AUTO_TEST_CASE(reuse_on_decl_assign_not_same_scope) +{ + string in = R"({ + let x := 5 + { + let y := x // y should not reuse the stack slot of x, since x is not in the same scope + sstore(y, y) + } + })"; + BOOST_CHECK_EQUAL(assemble(in), + "PUSH1 0x5 " + "DUP1 " + "DUP1 DUP2 SSTORE " + "POP POP " + ); +} + BOOST_AUTO_TEST_SUITE_END() From 38c6ecbbe28880887a83ed522091281469a2f7da Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 8 Jul 2020 19:45:30 +0200 Subject: [PATCH 378/479] Remove finney and szabo denominations. --- Changelog.md | 1 + docs/Solidity.g4 | 9 ++++-- docs/units-and-global-variables.rst | 8 ++--- liblangutil/Token.h | 4 +-- libsolidity/ast/AST.h | 2 -- libsolidity/ast/ASTJsonImporter.cpp | 4 --- libsolidity/ast/Types.cpp | 6 ---- test/ExecutionFramework.h | 12 +++---- .../SolidityExpressionCompiler.cpp | 31 ------------------- test/libsolidity/SolidityScanner.cpp | 4 +-- .../denominations/denominations.sol | 6 ++-- .../denominations/finney_invalid.sol | 7 +++++ .../szabo_finney_identifiers.sol | 6 ++++ .../denominations/szabo_invalid.sol | 7 +++++ ..._constants_with_ether_subdenominations.sol | 8 ++--- ..._ether_subdenominations_in_expressions.sol | 2 +- test/tools/ossfuzz/config/solidity.dict | 2 -- 17 files changed, 43 insertions(+), 76 deletions(-) create mode 100644 test/libsolidity/syntaxTests/denominations/finney_invalid.sol create mode 100644 test/libsolidity/syntaxTests/denominations/szabo_finney_identifiers.sol create mode 100644 test/libsolidity/syntaxTests/denominations/szabo_invalid.sol diff --git a/Changelog.md b/Changelog.md index ec24544ab7d3..82a16fe0d835 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ Breaking changes: * ``using A for B`` only affects the contract it is mentioned in and not all derived contracts * Inline Assembly: Disallow `.` in user-defined function and variable names. * Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``. + * Remove the finney and szabo denominations. Language Features: * Yul: Disallow EVM instruction `pc()`. diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index d4e86c523063..f86d95fc4945 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -361,11 +361,12 @@ assemblyType subAssembly : 'assembly' identifier assemblyBlock ; +// 'finney' and 'szabo' are no longer supported as denominations by latest Solidity. numberLiteral - : (DecimalNumber | HexNumber) (NumberUnit | Gwei)?; + : (DecimalNumber | HexNumber) (NumberUnit | Gwei | Finney | Szabo)?; identifier - : (Gwei | 'from' | 'calldata' | 'address' | Identifier) ; + : (Gwei | Finney | Szabo | 'from' | 'calldata' | 'address' | Identifier) ; BooleanLiteral : 'true' | 'false' ; @@ -385,10 +386,12 @@ HexDigits : HexCharacter ( '_'? HexCharacter )* ; NumberUnit - : 'wei' | 'szabo' | 'finney' | 'ether' + : 'wei' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' ; Gwei: 'gwei' ; +Szabo: 'szabo' ; +Finney: 'finney' ; HexLiteralFragment : 'hex' (('"' HexDigits? '"') | ('\'' HexDigits? '\'')) ; diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 28232f6a9962..a32900a505a7 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -2,23 +2,23 @@ Units and Globally Available Variables ************************************** -.. index:: wei, finney, szabo, ether +.. index:: wei, finney, szabo, gwei, ether Ether Units =========== -A literal number can take a suffix of ``wei``, ``gwei``, ``finney``, ``szabo`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei. +A literal number can take a suffix of ``wei``, ``gwei`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei. :: assert(1 wei == 1); assert(1 gwei == 1e9); - assert(1 szabo == 1e12); - assert(1 finney == 1e15); assert(1 ether == 1e18); The only effect of the subdenomination suffix is a multiplication by a power of ten. +.. note:: + The denominations ``finney`` and ``szabo`` have been removed in version 0.7.0. .. index:: time, seconds, minutes, hours, days, weeks, years diff --git a/liblangutil/Token.h b/liblangutil/Token.h index 916f71c75c9c..d887e39013ff 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -196,8 +196,6 @@ namespace solidity::langutil \ /* Ether subdenominations */ \ K(SubWei, "wei", 0) \ - K(SubSzabo, "szabo", 0) \ - K(SubFinney, "finney", 0) \ K(SubEther, "ether", 0) \ K(SubSecond, "seconds", 0) \ K(SubMinute, "minutes", 0) \ @@ -313,7 +311,7 @@ namespace TokenTraits || op == Token::Pure || op == Token::View || op == Token::Payable; } - constexpr bool isEtherSubdenomination(Token op) { return op == Token::SubWei || op == Token::SubSzabo || op == Token::SubFinney || op == Token::SubEther; } + constexpr bool isEtherSubdenomination(Token op) { return op == Token::SubWei || op == Token::SubEther; } constexpr bool isTimeSubdenomination(Token op) { return op == Token::SubSecond || op == Token::SubMinute || op == Token::SubHour || op == Token::SubDay || op == Token::SubWeek || op == Token::SubYear; } constexpr bool isReservedKeyword(Token op) { return (Token::After <= op && op <= Token::Unchecked); } diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 9fcbe29269db..ec37044a414c 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -2086,8 +2086,6 @@ class Literal: public PrimaryExpression None = static_cast(Token::Illegal), Wei = static_cast(Token::SubWei), Gwei = static_cast(Token::SubGwei), - Szabo = static_cast(Token::SubSzabo), - Finney = static_cast(Token::SubFinney), Ether = static_cast(Token::SubEther), Second = static_cast(Token::SubSecond), Minute = static_cast(Token::SubMinute), diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 1d9f77ad19a1..dfce6cb415a1 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -1004,10 +1004,6 @@ Literal::SubDenomination ASTJsonImporter::subdenomination(Json::Value const& _no return Literal::SubDenomination::Wei; else if (subDenStr == "gwei") return Literal::SubDenomination::Gwei; - else if (subDenStr == "szabo") - return Literal::SubDenomination::Szabo; - else if (subDenStr == "finney") - return Literal::SubDenomination::Finney; else if (subDenStr == "ether") return Literal::SubDenomination::Ether; else if (subDenStr == "seconds") diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index e50c4b6171b1..a3521adbd42b 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -988,12 +988,6 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal case Literal::SubDenomination::Gwei: value *= bigint("1000000000"); break; - case Literal::SubDenomination::Szabo: - value *= bigint("1000000000000"); - break; - case Literal::SubDenomination::Finney: - value *= bigint("1000000000000000"); - break; case Literal::SubDenomination::Ether: value *= bigint("1000000000000000000"); break; diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index 6fea5310a7b8..5e660c8056e5 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -45,13 +45,9 @@ using rational = boost::rational; /// @NOTE This is not endian-specific; it's just a bunch of bytes. using Address = util::h160; -// The various denominations; here for ease of use where needed within code. -static const u256 wei = 1; -static const u256 shannon = u256("1000000000"); -static const u256 gwei = shannon; -static const u256 szabo = shannon * 1000; -static const u256 finney = szabo * 1000; -static const u256 ether = finney * 1000; +// The ether and gwei denominations; here for ease of use where needed within code. +static const u256 gwei = u256(1) << 9; +static const u256 ether = u256(1) << 18; class ExecutionFramework { @@ -287,7 +283,7 @@ class ExecutionFramework bool m_transactionSuccessful = true; Address m_sender = account(0); Address m_contractAddress; - u256 const m_gasPrice = 100 * szabo; + u256 const m_gasPrice = 10 * gwei; u256 const m_gas = 100000000; bytes m_output; u256 m_gasUsed; diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 10083b8274ae..5885bc616e43 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -236,37 +236,6 @@ BOOST_AUTO_TEST_CASE(int_with_gwei_ether_subdenomination) BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); } -BOOST_AUTO_TEST_CASE(int_with_szabo_ether_subdenomination) -{ - char const* sourceCode = R"( - contract test { - function test () { - uint x = 1 szabo; - } - } - )"; - bytes code = compileFirstExpression(sourceCode); - - bytes expectation({uint8_t(Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00}); - BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); -} - -BOOST_AUTO_TEST_CASE(int_with_finney_ether_subdenomination) -{ - char const* sourceCode = R"( - contract test { - constructor() - { - uint x = 1 finney; - } - } - )"; - bytes code = compileFirstExpression(sourceCode); - - bytes expectation({uint8_t(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00}); - BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); -} - BOOST_AUTO_TEST_CASE(int_with_ether_ether_subdenomination) { char const* sourceCode = R"( diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index b02a910a59f3..93e44a5bfe05 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -428,11 +428,9 @@ BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence) BOOST_AUTO_TEST_CASE(ether_subdenominations) { - Scanner scanner(CharStream("wei gwei szabo finney ether", "")); + Scanner scanner(CharStream("wei gwei ether", "")); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubWei); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); - BOOST_CHECK_EQUAL(scanner.next(), Token::SubSzabo); - BOOST_CHECK_EQUAL(scanner.next(), Token::SubFinney); BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); } diff --git a/test/libsolidity/syntaxTests/denominations/denominations.sol b/test/libsolidity/syntaxTests/denominations/denominations.sol index a34c03de0d78..3c1c305cfef2 100644 --- a/test/libsolidity/syntaxTests/denominations/denominations.sol +++ b/test/libsolidity/syntaxTests/denominations/denominations.sol @@ -1,7 +1,7 @@ contract C { - uint constant a = 1 wei + 2 szabo + 3 finney + 4 ether; + uint constant a = 1 wei + 4 ether; uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks; - uint constant c = 2 szabo / 1 seconds + 3 finney * 3 hours; - uint constant d = 2 gwei / 1 seconds + 3 finney * 3 hours; + uint constant c = 2 ether / 1 seconds + 3 gwei * 3 hours; + uint constant d = 2 gwei / 1 seconds + 3 minutes * 3 hours; } // ---- diff --git a/test/libsolidity/syntaxTests/denominations/finney_invalid.sol b/test/libsolidity/syntaxTests/denominations/finney_invalid.sol new file mode 100644 index 000000000000..b7bae7fa7049 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/finney_invalid.sol @@ -0,0 +1,7 @@ +contract C { + function f() { + uint x = 1 finney; + } +} +// ---- +// ParserError 2314: (45-51): Expected ';' but got identifier diff --git a/test/libsolidity/syntaxTests/denominations/szabo_finney_identifiers.sol b/test/libsolidity/syntaxTests/denominations/szabo_finney_identifiers.sol new file mode 100644 index 000000000000..8facd62d4c48 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/szabo_finney_identifiers.sol @@ -0,0 +1,6 @@ +contract C { + function f(uint finney) public pure returns (uint szabo) { + // These used to be denominations. + szabo = finney; + } +} \ No newline at end of file diff --git a/test/libsolidity/syntaxTests/denominations/szabo_invalid.sol b/test/libsolidity/syntaxTests/denominations/szabo_invalid.sol new file mode 100644 index 000000000000..d206830d5e3f --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/szabo_invalid.sol @@ -0,0 +1,7 @@ +contract C { + function f() { + uint x = 1 szabo; + } +} +// ---- +// ParserError 2314: (45-50): Expected ';' but got identifier diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol index 51ce8b4d5d90..6b3ccc7c05be 100644 --- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol +++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol @@ -2,15 +2,11 @@ contract C { function f() public { a = 1 wei; - b = 2 szabo; - c = 3 finney; - d = 4 ether; - e = 5 gwei; + b = 2 ether; + c = 3 gwei; } uint256 a; uint256 b; uint256 c; - uint256 d; - uint256 e; } // ---- diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol index efe2d2670710..537320737f7d 100644 --- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol +++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol @@ -1,7 +1,7 @@ contract c { constructor() { - a = 1 wei * 100 wei + 7 szabo - 3; + a = 1 wei * 100 wei + 7 gwei - 3; } uint256 a; } diff --git a/test/tools/ossfuzz/config/solidity.dict b/test/tools/ossfuzz/config/solidity.dict index f788d49c2774..f80fab989a5e 100644 --- a/test/tools/ossfuzz/config/solidity.dict +++ b/test/tools/ossfuzz/config/solidity.dict @@ -6,7 +6,6 @@ " block.timestamp " " days " " ether " -" finney " " gasleft() " " gwei " " hours " @@ -18,7 +17,6 @@ " msg.value " " now " " seconds " -" szabo " " tx.gasprice " " tx.origin " " weeks " From c3e13b67331da4313f0bbb345644b535458f7911 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 8 Jul 2020 20:35:02 +0200 Subject: [PATCH 379/479] Promote gwei to a proper keyword. --- Changelog.md | 1 + liblangutil/Token.h | 4 ++-- libsolidity/parsing/Parser.cpp | 9 ++------- test/libsolidity/SolidityScanner.cpp | 2 +- test/libsolidity/semanticTests/literals/gwei.sol | 4 ++-- test/libsolidity/syntaxTests/denominations/gwei.sol | 3 --- .../syntaxTests/denominations/gwei_as_identifier.sol | 5 +++++ 7 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 test/libsolidity/syntaxTests/denominations/gwei.sol create mode 100644 test/libsolidity/syntaxTests/denominations/gwei_as_identifier.sol diff --git a/Changelog.md b/Changelog.md index 82a16fe0d835..e45646c91c97 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Breaking changes: * Constructors should not have visibility. * Deprecated dot syntax for `value` and `gas`. * Deprecated the identifier `now`. + * Disallow `gwei` as identifier. * JSON AST: Removes members with ``null`` value from JSON output. * Parser: NatSpec comments on variables are only allowed for public state variables. * Type Checker: Disallow shifts by signed types. diff --git a/liblangutil/Token.h b/liblangutil/Token.h index d887e39013ff..cea102f0f282 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -196,6 +196,7 @@ namespace solidity::langutil \ /* Ether subdenominations */ \ K(SubWei, "wei", 0) \ + K(SubGwei, "gwei", 0) \ K(SubEther, "ether", 0) \ K(SubSecond, "seconds", 0) \ K(SubMinute, "minutes", 0) \ @@ -230,7 +231,6 @@ namespace solidity::langutil \ /* Identifiers (not keywords or future reserved words). */ \ T(Identifier, nullptr, 0) \ - T(SubGwei, "gwei", 0) \ \ /* Keywords reserved for future use. */ \ K(After, "after", 0) \ @@ -311,7 +311,7 @@ namespace TokenTraits || op == Token::Pure || op == Token::View || op == Token::Payable; } - constexpr bool isEtherSubdenomination(Token op) { return op == Token::SubWei || op == Token::SubEther; } + constexpr bool isEtherSubdenomination(Token op) { return op >= Token::SubWei && op <= Token::SubEther; } constexpr bool isTimeSubdenomination(Token op) { return op == Token::SubSecond || op == Token::SubMinute || op == Token::SubHour || op == Token::SubDay || op == Token::SubWeek || op == Token::SubYear; } constexpr bool isReservedKeyword(Token op) { return (Token::After <= op && op <= Token::Unchecked); } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 819d18a79d4c..ab8180dc7eb4 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1825,16 +1825,11 @@ ASTPointer Parser::parsePrimaryExpression() expression = nodeFactory.createNode(token, getLiteralAndAdvance()); break; case Token::Number: - if ( - (m_scanner->peekNextToken() == Token::Identifier && m_scanner->peekLiteral() == "gwei") || - TokenTraits::isEtherSubdenomination(m_scanner->peekNextToken()) - ) + if (TokenTraits::isEtherSubdenomination(m_scanner->peekNextToken())) { ASTPointer literal = getLiteralAndAdvance(); nodeFactory.markEndPosition(); - Token actualToken = m_scanner->currentToken() == Token::Identifier ? Token::SubGwei : m_scanner->currentToken(); - - Literal::SubDenomination subdenomination = static_cast(actualToken); + Literal::SubDenomination subdenomination = static_cast(m_scanner->currentToken()); m_scanner->next(); expression = nodeFactory.createNode(token, literal, subdenomination); } diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 93e44a5bfe05..5b83778bacbc 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(ether_subdenominations) { Scanner scanner(CharStream("wei gwei ether", "")); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubWei); - BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubGwei); BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); } diff --git a/test/libsolidity/semanticTests/literals/gwei.sol b/test/libsolidity/semanticTests/literals/gwei.sol index 7762021dce5e..54870040ff44 100644 --- a/test/libsolidity/semanticTests/literals/gwei.sol +++ b/test/libsolidity/semanticTests/literals/gwei.sol @@ -1,7 +1,7 @@ contract C { - uint constant gwei = 1 gwei; + uint constant x = 1 gwei; - function f() public view returns(uint) { return gwei; } + function f() public view returns(uint) { return x; } } // ==== // compileViaYul: also diff --git a/test/libsolidity/syntaxTests/denominations/gwei.sol b/test/libsolidity/syntaxTests/denominations/gwei.sol deleted file mode 100644 index 5bc5edb3d991..000000000000 --- a/test/libsolidity/syntaxTests/denominations/gwei.sol +++ /dev/null @@ -1,3 +0,0 @@ -contract C { - uint constant gwei = 1 gwei; -} diff --git a/test/libsolidity/syntaxTests/denominations/gwei_as_identifier.sol b/test/libsolidity/syntaxTests/denominations/gwei_as_identifier.sol new file mode 100644 index 000000000000..43fde5ed79fb --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/gwei_as_identifier.sol @@ -0,0 +1,5 @@ +contract C { + uint constant gwei = 1; +} +// ---- +// ParserError 2314: (28-32): Expected identifier but got 'gwei' From 41710acbca530af60a43e8e77971922505ac2f24 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 9 Jul 2020 13:14:33 +0200 Subject: [PATCH 380/479] More semantic tests. --- .../libsolidity/semanticTests/literals/denominations.sol | 9 +++++++++ test/libsolidity/semanticTests/literals/ether.sol | 9 +++++++++ test/libsolidity/semanticTests/literals/wei.sol | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 test/libsolidity/semanticTests/literals/denominations.sol create mode 100644 test/libsolidity/semanticTests/literals/ether.sol create mode 100644 test/libsolidity/semanticTests/literals/wei.sol diff --git a/test/libsolidity/semanticTests/literals/denominations.sol b/test/libsolidity/semanticTests/literals/denominations.sol new file mode 100644 index 000000000000..256525cb932d --- /dev/null +++ b/test/libsolidity/semanticTests/literals/denominations.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 ether + 1 gwei + 1 wei; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1000000001000000001 diff --git a/test/libsolidity/semanticTests/literals/ether.sol b/test/libsolidity/semanticTests/literals/ether.sol new file mode 100644 index 000000000000..f03171796461 --- /dev/null +++ b/test/libsolidity/semanticTests/literals/ether.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 ether; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1000000000000000000 diff --git a/test/libsolidity/semanticTests/literals/wei.sol b/test/libsolidity/semanticTests/literals/wei.sol new file mode 100644 index 000000000000..59af2a3d731b --- /dev/null +++ b/test/libsolidity/semanticTests/literals/wei.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 wei; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1 From 870ea98c21d4b0d6b3eea67a1ce37753610b8817 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 13 Jul 2020 15:20:29 +0100 Subject: [PATCH 381/479] Prefix EIP-615 opcodes with EIP615 in Instructions --- libevmasm/Instruction.h | 20 ++++++++--------- libyul/backends/evm/EVMAssembly.cpp | 10 ++++----- .../EVMInstructionInterpreter.cpp | 22 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h index 511e3cf1b096..67a77f0c9a63 100644 --- a/libevmasm/Instruction.h +++ b/libevmasm/Instruction.h @@ -174,16 +174,16 @@ enum class Instruction: uint8_t LOG3, ///< Makes a log entry; 3 topics. LOG4, ///< Makes a log entry; 4 topics. - JUMPTO = 0xb0, ///< alter the program counter to a jumpdest -- not part of Instructions.cpp - JUMPIF, ///< conditionally alter the program counter -- not part of Instructions.cpp - JUMPV, ///< alter the program counter to a jumpdest -- not part of Instructions.cpp - JUMPSUB, ///< alter the program counter to a beginsub -- not part of Instructions.cpp - JUMPSUBV, ///< alter the program counter to a beginsub -- not part of Instructions.cpp - BEGINSUB, ///< set a potential jumpsub destination -- not part of Instructions.cpp - BEGINDATA, ///< begin the data section -- not part of Instructions.cpp - RETURNSUB, ///< return to subroutine jumped from -- not part of Instructions.cpp - PUTLOCAL, ///< pop top of stack to local variable -- not part of Instructions.cpp - GETLOCAL, ///< push local variable to top of stack -- not part of Instructions.cpp + EIP615_JUMPTO = 0xb0, ///< alter the program counter to a jumpdest -- not part of Instructions.cpp + EIP615_JUMPIF, ///< conditionally alter the program counter -- not part of Instructions.cpp + EIP615_JUMPV, ///< alter the program counter to a jumpdest -- not part of Instructions.cpp + EIP615_JUMPSUB, ///< alter the program counter to a beginsub -- not part of Instructions.cpp + EIP615_JUMPSUBV, ///< alter the program counter to a beginsub -- not part of Instructions.cpp + EIP615_BEGINSUB, ///< set a potential jumpsub destination -- not part of Instructions.cpp + EIP615_BEGINDATA, ///< begin the data section -- not part of Instructions.cpp + EIP615_RETURNSUB, ///< return to subroutine jumped from -- not part of Instructions.cpp + EIP615_PUTLOCAL, ///< pop top of stack to local variable -- not part of Instructions.cpp + EIP615_GETLOCAL, ///< push local variable to top of stack -- not part of Instructions.cpp CREATE = 0xf0, ///< create a new account with associated code CALL, ///< message-call into an account diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index 73194ef8ad9d..7cf3d0662c1a 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -102,7 +102,7 @@ void EVMAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter, JumpType _ { if (m_evm15) { - m_bytecode.push_back(uint8_t(evmasm::Instruction::JUMPTO)); + m_bytecode.push_back(uint8_t(evmasm::Instruction::EIP615_JUMPTO)); appendLabelReferenceInternal(_labelId); m_stackHeight += _stackDiffAfter; } @@ -117,7 +117,7 @@ void EVMAssembly::appendJumpToIf(LabelID _labelId, JumpType) { if (m_evm15) { - m_bytecode.push_back(uint8_t(evmasm::Instruction::JUMPIF)); + m_bytecode.push_back(uint8_t(evmasm::Instruction::EIP615_JUMPIF)); appendLabelReferenceInternal(_labelId); m_stackHeight--; } @@ -133,7 +133,7 @@ void EVMAssembly::appendBeginsub(LabelID _labelId, int _arguments) yulAssert(m_evm15, "BEGINSUB used for EVM 1.0"); yulAssert(_arguments >= 0, ""); setLabelToCurrentPosition(_labelId); - m_bytecode.push_back(uint8_t(evmasm::Instruction::BEGINSUB)); + m_bytecode.push_back(uint8_t(evmasm::Instruction::EIP615_BEGINSUB)); m_stackHeight += _arguments; } @@ -141,7 +141,7 @@ void EVMAssembly::appendJumpsub(LabelID _labelId, int _arguments, int _returns) { yulAssert(m_evm15, "JUMPSUB used for EVM 1.0"); yulAssert(_arguments >= 0 && _returns >= 0, ""); - m_bytecode.push_back(uint8_t(evmasm::Instruction::JUMPSUB)); + m_bytecode.push_back(uint8_t(evmasm::Instruction::EIP615_JUMPSUB)); appendLabelReferenceInternal(_labelId); m_stackHeight += _returns - _arguments; } @@ -150,7 +150,7 @@ void EVMAssembly::appendReturnsub(int _returns, int _stackDiffAfter) { yulAssert(m_evm15, "RETURNSUB used for EVM 1.0"); yulAssert(_returns >= 0, ""); - m_bytecode.push_back(uint8_t(evmasm::Instruction::RETURNSUB)); + m_bytecode.push_back(uint8_t(evmasm::Instruction::EIP615_RETURNSUB)); m_stackHeight += _stackDiffAfter - _returns; } diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index c17fa33e86b5..956db124f7fa 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -409,17 +409,17 @@ u256 EVMInstructionInterpreter::eval( case Instruction::SWAP14: case Instruction::SWAP15: case Instruction::SWAP16: - // --------------- EVM 2.0 --------------- - case Instruction::JUMPTO: - case Instruction::JUMPIF: - case Instruction::JUMPV: - case Instruction::JUMPSUB: - case Instruction::JUMPSUBV: - case Instruction::BEGINSUB: - case Instruction::BEGINDATA: - case Instruction::RETURNSUB: - case Instruction::PUTLOCAL: - case Instruction::GETLOCAL: + // --------------- EIP-615 --------------- + case Instruction::EIP615_JUMPTO: + case Instruction::EIP615_JUMPIF: + case Instruction::EIP615_JUMPV: + case Instruction::EIP615_JUMPSUB: + case Instruction::EIP615_JUMPSUBV: + case Instruction::EIP615_BEGINSUB: + case Instruction::EIP615_BEGINDATA: + case Instruction::EIP615_RETURNSUB: + case Instruction::EIP615_PUTLOCAL: + case Instruction::EIP615_GETLOCAL: { yulAssert(false, ""); return 0; From 6a1ad7e59ceccd8a56a17d2af3e1025a321eb079 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 13 Jul 2020 19:05:34 +0100 Subject: [PATCH 382/479] Fix formatting hex strings in isoltest update --- test/libsolidity/util/BytesUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index fd2cd2fcf730..7416ca9a2874 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -22,6 +22,7 @@ #include +#include #include #include @@ -198,8 +199,7 @@ string BytesUtils::formatString(bytes const& _bytes, size_t _cutOff) if (isprint(v)) os << v; else - os << "\\x" << setw(2) << setfill('0') << hex << v; - + os << "\\x" << toHex(v); } } os << "\""; From 950612cf42b3812e5ad292d9f6e3a56f96b8f0f4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 13 Jul 2020 18:23:42 +0100 Subject: [PATCH 383/479] Add more tests for strings with unicode (escapes) --- .../semanticTests/strings/unicode_escapes.sol | 22 +++++++++++++++++++ .../semanticTests/strings/unicode_string.sol | 7 ++++++ .../invalid_utf8_explicit_string.sol} | 0 .../string/invalid_utf8_hex_string.sol | 5 +++++ .../invalid_utf8_implicit_string.sol} | 0 .../string/invalid_utf8_in_bytes.sol | 6 +++++ .../large_utf8_codepoint.sol} | 0 .../syntaxTests/string/string_unicode.sol | 6 +++++ .../{ => string}/unicode_escape_literals.sol | 12 +--------- ...code_escape_literals_invalid_codepoint.sol | 7 ++++++ ...unicode_escape_literals_invalid_format.sol | 10 +++++++++ 11 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/semanticTests/strings/unicode_escapes.sol create mode 100644 test/libsolidity/semanticTests/strings/unicode_string.sol rename test/libsolidity/syntaxTests/{nameAndTypeResolution/186_invalid_utf8_explicit.sol => string/invalid_utf8_explicit_string.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/string/invalid_utf8_hex_string.sol rename test/libsolidity/syntaxTests/{nameAndTypeResolution/185_invalid_utf8_implicit.sol => string/invalid_utf8_implicit_string.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/string/invalid_utf8_in_bytes.sol rename test/libsolidity/syntaxTests/{nameAndTypeResolution/187_large_utf8_codepoint.sol => string/large_utf8_codepoint.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/string/string_unicode.sol rename test/libsolidity/syntaxTests/{ => string}/unicode_escape_literals.sol (60%) create mode 100644 test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_codepoint.sol create mode 100644 test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_format.sol diff --git a/test/libsolidity/semanticTests/strings/unicode_escapes.sol b/test/libsolidity/semanticTests/strings/unicode_escapes.sol new file mode 100644 index 000000000000..401d8b61e4ec --- /dev/null +++ b/test/libsolidity/semanticTests/strings/unicode_escapes.sol @@ -0,0 +1,22 @@ +contract C { + function oneByteUTF8() public pure returns (string memory) { + return "aaa\u0024aaa"; // usdollar + } + + function twoBytesUTF8() public pure returns (string memory) { + return "aaa\u00A2aaa"; // cent + } + + function threeBytesUTF8() public pure returns (string memory) { + return "aaa\u20ACaaa"; // euro + } + + function combined() public pure returns (string memory) { + return "\u0024\u00A2\u20AC"; + } +} +// ---- +// oneByteUTF8() -> 0x20, 7, "aaa$aaa" +// twoBytesUTF8() -> 0x20, 8, "aaa\xc2\xa2aaa" +// threeBytesUTF8() -> 0x20, 9, "aaa\xe2\x82\xacaaa" +// combined() -> 0x20, 6, "$\xc2\xa2\xe2\x82\xac" diff --git a/test/libsolidity/semanticTests/strings/unicode_string.sol b/test/libsolidity/semanticTests/strings/unicode_string.sol new file mode 100644 index 000000000000..c139d6b8b9cf --- /dev/null +++ b/test/libsolidity/semanticTests/strings/unicode_string.sol @@ -0,0 +1,7 @@ +contract C { + function f() public pure returns (string memory) { + return "😃, 😭, and 😈"; + } +} +// ---- +// f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol b/test/libsolidity/syntaxTests/string/invalid_utf8_explicit_string.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/186_invalid_utf8_explicit.sol rename to test/libsolidity/syntaxTests/string/invalid_utf8_explicit_string.sol diff --git a/test/libsolidity/syntaxTests/string/invalid_utf8_hex_string.sol b/test/libsolidity/syntaxTests/string/invalid_utf8_hex_string.sol new file mode 100644 index 000000000000..d72ee5af0dda --- /dev/null +++ b/test/libsolidity/syntaxTests/string/invalid_utf8_hex_string.sol @@ -0,0 +1,5 @@ +contract C { + string s = hex"a000"; +} +// ---- +// TypeError 7407: (28-37): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol b/test/libsolidity/syntaxTests/string/invalid_utf8_implicit_string.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/185_invalid_utf8_implicit.sol rename to test/libsolidity/syntaxTests/string/invalid_utf8_implicit_string.sol diff --git a/test/libsolidity/syntaxTests/string/invalid_utf8_in_bytes.sol b/test/libsolidity/syntaxTests/string/invalid_utf8_in_bytes.sol new file mode 100644 index 000000000000..c5af0d094f10 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/invalid_utf8_in_bytes.sol @@ -0,0 +1,6 @@ +contract C { + bytes b1 = "\xa0\x00"; + bytes32 b2 = "\xa0\x00"; + bytes b3 = hex"a000"; +} +// ---- diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/187_large_utf8_codepoint.sol b/test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/187_large_utf8_codepoint.sol rename to test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol diff --git a/test/libsolidity/syntaxTests/string/string_unicode.sol b/test/libsolidity/syntaxTests/string/string_unicode.sol new file mode 100644 index 000000000000..380ad9e39d60 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/string_unicode.sol @@ -0,0 +1,6 @@ +contract test { + function f() public pure returns (string memory) { + return "😃, 😭, and 😈"; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/unicode_escape_literals.sol b/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol similarity index 60% rename from test/libsolidity/syntaxTests/unicode_escape_literals.sol rename to test/libsolidity/syntaxTests/string/unicode_escape_literals.sol index d78e6aa09750..011f58b409f6 100644 --- a/test/libsolidity/syntaxTests/unicode_escape_literals.sol +++ b/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol @@ -1,5 +1,4 @@ contract test { - function oneByteUTF8() public pure returns (bytes32) { bytes32 usdollar = "aaa\u0024aaa"; return usdollar; @@ -15,17 +14,8 @@ contract test { return eur; } - function together() public pure returns (bytes32) { + function combined() public pure returns (bytes32) { bytes32 res = "\u0024\u00A2\u20AC"; return res; } - - // this function returns an invalid unicode character - function invalidLiteral() public pure returns(bytes32) { - bytes32 invalid = "\u00xx"; - return invalid; - } - } -// ---- -// ParserError 8936: (678-681): Invalid escape sequence. diff --git a/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_codepoint.sol b/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_codepoint.sol new file mode 100644 index 000000000000..46a0de5f4fe5 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_codepoint.sol @@ -0,0 +1,7 @@ +contract test { + function f() public pure returns (string memory) { + return "\xc1"; + } +} +// ---- +// TypeError 6359: (86-92): Return argument type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type (type of first return variable) string memory. diff --git a/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_format.sol b/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_format.sol new file mode 100644 index 000000000000..6afcd94afcff --- /dev/null +++ b/test/libsolidity/syntaxTests/string/unicode_escape_literals_invalid_format.sol @@ -0,0 +1,10 @@ +contract test { + // this function returns an invalid unicode character + function invalidLiteral() public pure returns (bytes32) { + bytes32 invalid = "\u00xx"; + return invalid; + } + +} +// ---- +// ParserError 8936: (162-165): Invalid escape sequence. From f73b25bb78e64a57e30ade9c7982d9c2375a3b7b Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 14 Jul 2020 12:42:15 +0530 Subject: [PATCH 384/479] Removed specialized errors related to constant state mutability --- liblangutil/Token.h | 5 ++--- libsolidity/parsing/Parser.cpp | 12 ++---------- .../syntaxTests/parsing/constant_state_modifier.sol | 2 +- .../parsing/multiple_statemutability_specifiers.sol | 8 ++------ 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/liblangutil/Token.h b/liblangutil/Token.h index cea102f0f282..47b7985d6862 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -305,10 +305,9 @@ namespace TokenTraits constexpr bool isVisibilitySpecifier(Token op) { return isVariableVisibilitySpecifier(op) || op == Token::External; } constexpr bool isLocationSpecifier(Token op) { return op == Token::Memory || op == Token::Storage || op == Token::CallData; } - constexpr bool isStateMutabilitySpecifier(Token op, bool _allowConstant = true) + constexpr bool isStateMutabilitySpecifier(Token op) { - return (op == Token::Constant && _allowConstant) - || op == Token::Pure || op == Token::View || op == Token::Payable; + return op == Token::Pure || op == Token::View || op == Token::Payable; } constexpr bool isEtherSubdenomination(Token op) { return op >= Token::SubWei && op <= Token::SubEther; } diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index ab8180dc7eb4..977741cd05c3 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -464,14 +464,6 @@ StateMutability Parser::parseStateMutability() case Token::Pure: stateMutability = StateMutability::Pure; break; - case Token::Constant: - stateMutability = StateMutability::View; - parserError( - 7698_error, - "The state mutability modifier \"constant\" was removed in version 0.5.0. " - "Use \"view\" or \"pure\" instead." - ); - break; default: solAssert(false, "Invalid state mutability specifier."); } @@ -997,7 +989,7 @@ ASTPointer Parser::parseTypeName(bool _allowVar) auto stateMutability = elemTypeName.token() == Token::Address ? optional{StateMutability::NonPayable} : nullopt; - if (TokenTraits::isStateMutabilitySpecifier(m_scanner->currentToken(), false)) + if (TokenTraits::isStateMutabilitySpecifier(m_scanner->currentToken())) { if (elemTypeName.token() == Token::Address) { @@ -2065,7 +2057,7 @@ Parser::LookAheadInfo Parser::peekStatementType() const // kind of statement. This means, for example, that we do not allow type expressions of the form // ``address payable;``. // If we want to change this in the future, we need to consider another scanner token here. - if (TokenTraits::isElementaryTypeName(token) && TokenTraits::isStateMutabilitySpecifier(next, false)) + if (TokenTraits::isElementaryTypeName(token) && TokenTraits::isStateMutabilitySpecifier(next)) return LookAheadInfo::VariableDeclaration; if (next == Token::Identifier || TokenTraits::isLocationSpecifier(next)) return LookAheadInfo::VariableDeclaration; diff --git a/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol index 6f007633d9b2..ea3b7abd8196 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError 7698: (43-51): The state mutability modifier "constant" was removed in version 0.5.0. Use "view" or "pure" instead. +// ParserError 2314: (43-51): Expected '{' but got 'constant' diff --git a/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol index e92302f37fb2..e2c56ae577a7 100644 --- a/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol @@ -17,10 +17,7 @@ contract c6 { function f() pure payable {} } contract c7 { - function f() pure constant {} -} -contract c8 { - function f() view constant {} + function f() view payable {} } // ---- // ParserError 9680: (39-46): State mutability already specified as "payable". @@ -29,5 +26,4 @@ contract c8 { // ParserError 9680: (180-184): State mutability already specified as "pure". // ParserError 9680: (229-233): State mutability already specified as "payable". // ParserError 9680: (275-282): State mutability already specified as "pure". -// ParserError 9680: (324-332): State mutability already specified as "pure". -// ParserError 9680: (374-382): State mutability already specified as "view". +// ParserError 9680: (324-331): State mutability already specified as "view". From f28bede34a632a0c2417be8399c3daa864092bb0 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2020 10:32:11 +0200 Subject: [PATCH 385/479] Refactor storageSizeUpperBound. --- libsolidity/analysis/ContractLevelChecker.cpp | 18 ++++++ libsolidity/analysis/ContractLevelChecker.h | 2 + libsolidity/analysis/TypeChecker.cpp | 16 +---- libsolidity/ast/Types.cpp | 61 ++++++------------- libsolidity/ast/Types.h | 7 ++- .../largeTypes/oversized_array.sol | 2 +- .../largeTypes/oversized_contract.sol | 2 +- .../oversized_contract_inheritance.sol | 12 ++++ .../largeTypes/oversized_struct.sol | 2 +- 9 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 test/libsolidity/syntaxTests/largeTypes/oversized_contract_inheritance.sol diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index c0da545644a0..fc391f196fd7 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -60,6 +60,7 @@ bool ContractLevelChecker::check(ContractDefinition const& _contract) checkLibraryRequirements(_contract); checkBaseABICompatibility(_contract); checkPayableFallbackWithoutReceive(_contract); + checkStorageSize(_contract); return Error::containsOnlyWarnings(m_errorReporter.errors()); } @@ -458,3 +459,20 @@ void ContractLevelChecker::checkPayableFallbackWithoutReceive(ContractDefinition SecondarySourceLocation{}.append("The payable fallback function is defined here.", fallback->location()) ); } + +void ContractLevelChecker::checkStorageSize(ContractDefinition const& _contract) +{ + bigint size = 0; + vector variables; + for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.annotation().linearizedBaseContracts)) + for (VariableDeclaration const* variable: contract->stateVariables()) + if (!(variable->isConstant() || variable->immutable())) + { + size += variable->annotation().type->storageSizeUpperBound(); + if (size >= bigint(1) << 256) + { + m_errorReporter.typeError(7676_error, _contract.location(), "Contract too large for storage."); + break; + } + } +} diff --git a/libsolidity/analysis/ContractLevelChecker.h b/libsolidity/analysis/ContractLevelChecker.h index e40cb8b0d5b8..3a0d7d7402f8 100644 --- a/libsolidity/analysis/ContractLevelChecker.h +++ b/libsolidity/analysis/ContractLevelChecker.h @@ -83,6 +83,8 @@ class ContractLevelChecker /// Warns if the contract has a payable fallback, but no receive ether function. void checkPayableFallbackWithoutReceive(ContractDefinition const& _contract); + /// Error if the contract requires too much storage + void checkStorageSize(ContractDefinition const& _contract); OverrideChecker m_overrideChecker; langutil::ErrorReporter& m_errorReporter; diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index aa316cb4857b..0c47f20738f8 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -92,19 +92,7 @@ bool TypeChecker::visit(ContractDefinition const& _contract) for (auto const& n: _contract.subNodes()) n->accept(*this); - bigint size = 0; - vector variables; - for (ContractDefinition const* contract: boost::adaptors::reverse(m_currentContract->annotation().linearizedBaseContracts)) - for (VariableDeclaration const* variable: contract->stateVariables()) - if (!(variable->isConstant() || variable->immutable())) - { - size += storageSizeUpperBound(*(variable->annotation().type)); - if (size >= bigint(1) << 256) - { - m_errorReporter.typeError(7676_error, m_currentContract->location(), "Contract too large for storage."); - break; - } - } + m_currentContract = nullptr; return false; } @@ -566,7 +554,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) " in small quantities per transaction."; }; - if (storageSizeUpperBound(*varType) >= bigint(1) << 64) + if (varType->storageSizeUpperBound() >= bigint(1) << 64) { if (_variable.isStateVariable()) m_errorReporter.warning(3408_error, _variable.location(), collisionMessage(_variable.name(), true)); diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 546e6ee63abc..825fc8d0c27f 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -63,37 +63,6 @@ struct TypeComp }; using TypeSet = std::set; -bigint storageSizeUpperBoundInner( - Type const& _type, - set& _structsSeen -) -{ - switch (_type.category()) - { - case Type::Category::Array: - { - auto const& t = dynamic_cast(_type); - if (!t.isDynamicallySized()) - return storageSizeUpperBoundInner(*t.baseType(), _structsSeen) * t.length(); - break; - } - case Type::Category::Struct: - { - auto const& t = dynamic_cast(_type); - solAssert(!_structsSeen.count(&t.structDefinition()), "Recursive struct."); - bigint size = 1; - _structsSeen.insert(&t.structDefinition()); - for (auto const& m: t.members(nullptr)) - size += storageSizeUpperBoundInner(*m.type, _structsSeen); - _structsSeen.erase(&t.structDefinition()); - return size; - } - default: - break; - } - return bigint(1); -} - void oversizedSubtypesInner( Type const& _type, bool _includeType, @@ -106,7 +75,7 @@ void oversizedSubtypesInner( case Type::Category::Array: { auto const& t = dynamic_cast(_type); - if (_includeType && storageSizeUpperBound(t) >= bigint(1) << 64) + if (_includeType && t.storageSizeUpperBound() >= bigint(1) << 64) _oversizedSubtypes.insert(&t); oversizedSubtypesInner(*t.baseType(), t.isDynamicallySized(), _structsSeen, _oversizedSubtypes); break; @@ -116,7 +85,7 @@ void oversizedSubtypesInner( auto const& t = dynamic_cast(_type); if (_structsSeen.count(&t.structDefinition())) return; - if (_includeType && storageSizeUpperBound(t) >= bigint(1) << 64) + if (_includeType && t.storageSizeUpperBound() >= bigint(1) << 64) _oversizedSubtypes.insert(&t); _structsSeen.insert(&t.structDefinition()); for (auto const& m: t.members(nullptr)) @@ -231,12 +200,6 @@ util::Result transformParametersToExternal(TypePointers const& _pa } -bigint solidity::frontend::storageSizeUpperBound(frontend::Type const& _type) -{ - set structsSeen; - return storageSizeUpperBoundInner(_type, structsSeen); -} - vector solidity::frontend::oversizedSubtypes(frontend::Type const& _type) { set structsSeen; @@ -1847,7 +1810,7 @@ BoolResult ArrayType::validForLocation(DataLocation _loc) const break; } case DataLocation::Storage: - if (storageSizeUpperBound(*this) >= bigint(1) << 256) + if (storageSizeUpperBound() >= bigint(1) << 256) return BoolResult::err("Type too large for storage."); break; } @@ -1888,6 +1851,14 @@ bool ArrayType::isDynamicallyEncoded() const return isDynamicallySized() || baseType()->isDynamicallyEncoded(); } +bigint ArrayType::storageSizeUpperBound() const +{ + if (isDynamicallySized()) + return 1; + else + return length() * baseType()->storageSizeUpperBound(); +} + u256 ArrayType::storageSize() const { if (isDynamicallySized()) @@ -2347,6 +2318,14 @@ u256 StructType::memoryDataSize() const return size; } +bigint StructType::storageSizeUpperBound() const +{ + bigint size = 1; + for (auto const& member: members(nullptr)) + size += member.type->storageSizeUpperBound(); + return size; +} + u256 StructType::storageSize() const { return max(1, members(nullptr).storageSize()); @@ -2491,7 +2470,7 @@ BoolResult StructType::validForLocation(DataLocation _loc) const if ( _loc == DataLocation::Storage && - storageSizeUpperBound(*this) >= bigint(1) << 256 + storageSizeUpperBound() >= bigint(1) << 256 ) return BoolResult::err("Type too large for storage."); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index b05021630b24..155fa7f14009 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -59,7 +59,6 @@ using BoolResult = util::Result; namespace solidity::frontend { -bigint storageSizeUpperBound(frontend::Type const& _type); std::vector oversizedSubtypes(frontend::Type const& _type); inline rational makeRational(bigint const& _numerator, bigint const& _denominator) @@ -251,6 +250,10 @@ class Type /// @returns the number of storage slots required to hold this value in storage. /// For dynamically "allocated" types, it returns the size of the statically allocated head, virtual u256 storageSize() const { return 1; } + /// @returns an upper bound on the total storage size required by this type, descending + /// into structs and statically-sized arrays. This is mainly to ensure that the storage + /// slot allocation algorithm does not overflow, it is not a protection against collisions. + virtual bigint storageSizeUpperBound() const { return 1; } /// Multiple small types can be packed into a single storage slot. If such a packing is possible /// this function @returns the size in bytes smaller than 32. Data is moved to the next slot if /// it does not fit. @@ -788,6 +791,7 @@ class ArrayType: public ReferenceType unsigned calldataEncodedTailSize() const override; bool isDynamicallySized() const override { return m_hasDynamicLength; } bool isDynamicallyEncoded() const override; + bigint storageSizeUpperBound() const override; u256 storageSize() const override; bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); } bool nameable() const override { return true; } @@ -952,6 +956,7 @@ class StructType: public ReferenceType unsigned calldataEncodedTailSize() const override; bool isDynamicallyEncoded() const override; u256 memoryDataSize() const override; + bigint storageSizeUpperBound() const override; u256 storageSize() const override; bool canLiveOutsideStorage() const override { return true; } bool nameable() const override { return true; } diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol index 951840fd4216..123773403a2c 100644 --- a/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_array.sol @@ -4,5 +4,5 @@ contract C { uint[2**255][2] a; } // ---- -// TypeError 1534: (77-94): Type too large for storage. // TypeError 7676: (60-97): Contract too large for storage. +// TypeError 1534: (77-94): Type too large for storage. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol index 69f8b1024df6..44c7274e6468 100644 --- a/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_contract.sol @@ -5,6 +5,6 @@ contract C { uint[2**255] b; } // ---- +// TypeError 7676: (60-114): Contract too large for storage. // Warning 3408: (77-91): Variable "a" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 3408: (97-111): Variable "b" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// TypeError 7676: (60-114): Contract too large for storage. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_contract_inheritance.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_contract_inheritance.sol new file mode 100644 index 000000000000..24073d4c0316 --- /dev/null +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_contract_inheritance.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >= 0.0; +contract C { + uint[2**255] a; +} +contract D is C { + uint[2**255] b; +} +// ---- +// TypeError 7676: (95-134): Contract too large for storage. +// Warning 3408: (77-91): Variable "a" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 3408: (117-131): Variable "b" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol b/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol index a3f3a4160f86..757ec9e4afc8 100644 --- a/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol +++ b/test/libsolidity/syntaxTests/largeTypes/oversized_struct.sol @@ -8,5 +8,5 @@ contract C { S s; } // ---- -// TypeError 1534: (146-149): Type too large for storage. // TypeError 7676: (60-152): Contract too large for storage. +// TypeError 1534: (146-149): Type too large for storage. From 9c62ea182dad60467bbc39a6914aba7b703b9286 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 14 Jul 2020 10:08:24 +0200 Subject: [PATCH 386/479] Fix segfault in oversized objects check in combination with var. --- libsolidity/analysis/TypeChecker.cpp | 6 +++++- .../iceRegressionTests/oversized_var.sol | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index aa316cb4857b..02cbaaadd74f 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -571,7 +571,11 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (_variable.isStateVariable()) m_errorReporter.warning(3408_error, _variable.location(), collisionMessage(_variable.name(), true)); else - m_errorReporter.warning(2332_error, _variable.typeName()->location(), collisionMessage(varType->canonicalName(), false)); + m_errorReporter.warning( + 2332_error, + _variable.typeName() ? _variable.typeName()->location() : _variable.location(), + collisionMessage(varType->canonicalName(), false) + ); } vector oversizedSubtypes = frontend::oversizedSubtypes(*varType); for (Type const* subtype: oversizedSubtypes) diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol new file mode 100644 index 000000000000..0e50ae138dfe --- /dev/null +++ b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol @@ -0,0 +1,15 @@ +contract b { + struct c { + uint [2 ** 253] a; + } + + c d; + function e() public { + var d = d; + } +} +// ---- +// Warning 2519: (105-110): This declaration shadows an existing declaration. +// Warning 3408: (66-69): Variable "d" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// Warning 2332: (105-110): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. +// SyntaxError 1719: (105-114): Use of the "var" keyword is disallowed. Use explicit declaration `struct b.c storage pointer d = ...´ instead. From 349114684d750ba55c89b78540ade620d605a8fa Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2020 14:19:37 +0200 Subject: [PATCH 387/479] Fix windows build. --- libsolidity/analysis/ReferencesResolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 45353e2ee9d2..84b5a48fb546 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -38,6 +38,7 @@ #include using namespace std; +using namespace solidity; using namespace solidity::langutil; using namespace solidity::frontend; From eab12ecf77e3d352981fa4a71297ccfc8a9f3aea Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 14 Jul 2020 14:25:17 +0100 Subject: [PATCH 388/479] Nicer error message for private payable functions --- libsolidity/analysis/TypeChecker.cpp | 2 +- .../syntaxTests/nameAndTypeResolution/356_payable_internal.sol | 2 +- .../syntaxTests/nameAndTypeResolution/357_payable_private.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 762361080bf2..94d9544df6e9 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -337,7 +337,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (_function.libraryFunction()) m_errorReporter.typeError(7708_error, _function.location(), "Library functions cannot be payable."); if (_function.isOrdinary() && !_function.isPartOfExternalInterface()) - m_errorReporter.typeError(5587_error, _function.location(), "Internal functions cannot be payable."); + m_errorReporter.typeError(5587_error, _function.location(), "\"internal\" and \"private\" functions cannot be payable."); } auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& var) { if (type(var)->category() == Type::Category::Mapping) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol index 2bf491b5d8df..a21a18d9c2bf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol @@ -2,4 +2,4 @@ contract test { function f() payable internal {} } // ---- -// TypeError 5587: (20-52): Internal functions cannot be payable. +// TypeError 5587: (20-52): "internal" and "private" functions cannot be payable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol index fcc0dba35402..3436ce76fda4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol @@ -2,4 +2,4 @@ contract test { function f() payable private {} } // ---- -// TypeError 5587: (20-51): Internal functions cannot be payable. +// TypeError 5587: (20-51): "internal" and "private" functions cannot be payable. From aed424f23e9f671e968377381ef138eb3c34489d Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Tue, 23 Jun 2020 12:17:15 -0500 Subject: [PATCH 389/479] Initial docker image creation workflows. --- .circleci/config.yml | 19 +----- .github/workflows/buildpack-deps.yml | 42 ++++++++++++ .gitignore | 2 +- scripts/ci/build.sh | 23 +++++++ scripts/ci/build_ossfuzz.sh | 15 ++++ scripts/ci/buildpack-deps_test_emscripten.sh | 1 + ...pack-deps_test_ubuntu1604.clang.ossfuzz.sh | 1 + scripts/ci/buildpack-deps_test_ubuntu1804.sh | 1 + .../buildpack-deps_test_ubuntu2004.clang.sh | 1 + scripts/ci/buildpack-deps_test_ubuntu2004.sh | 1 + scripts/ci/docker_upgrade.sh | 68 +++++++++++++++++++ .../buildpack-deps}/Dockerfile.emscripten | 2 + .../Dockerfile.ubuntu1604.clang.ossfuzz | 2 + .../buildpack-deps}/Dockerfile.ubuntu1804 | 2 + .../buildpack-deps}/Dockerfile.ubuntu2004 | 2 + .../Dockerfile.ubuntu2004.clang | 2 + scripts/docker/buildpack-deps/README.md | 35 ++++++++++ .../docker/buildpack-deps}/emscripten.jam | 0 18 files changed, 201 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/buildpack-deps.yml create mode 100755 scripts/ci/build.sh create mode 100755 scripts/ci/build_ossfuzz.sh create mode 120000 scripts/ci/buildpack-deps_test_emscripten.sh create mode 120000 scripts/ci/buildpack-deps_test_ubuntu1604.clang.ossfuzz.sh create mode 120000 scripts/ci/buildpack-deps_test_ubuntu1804.sh create mode 120000 scripts/ci/buildpack-deps_test_ubuntu2004.clang.sh create mode 120000 scripts/ci/buildpack-deps_test_ubuntu2004.sh create mode 100755 scripts/ci/docker_upgrade.sh rename {.circleci/docker => scripts/docker/buildpack-deps}/Dockerfile.emscripten (99%) rename {.circleci/docker => scripts/docker/buildpack-deps}/Dockerfile.ubuntu1604.clang.ossfuzz (99%) rename {.circleci/docker => scripts/docker/buildpack-deps}/Dockerfile.ubuntu1804 (99%) rename {.circleci/docker => scripts/docker/buildpack-deps}/Dockerfile.ubuntu2004 (99%) rename {.circleci/docker => scripts/docker/buildpack-deps}/Dockerfile.ubuntu2004.clang (99%) create mode 100644 scripts/docker/buildpack-deps/README.md rename {.circleci/docker => scripts/docker/buildpack-deps}/emscripten.jam (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index d17f13baadd4..288749974fb3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,26 +33,11 @@ defaults: - run_build: &run_build name: Build - command: | - set -ex - if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi - echo -n "$CIRCLE_SHA1" > commit_hash.txt - mkdir -p build - cd build - [ -n "$COVERAGE" -a "$CIRCLE_BRANCH" != release -a -z "$CIRCLE_TAG" ] && CMAKE_OPTIONS="$CMAKE_OPTIONS -DCOVERAGE=ON" - cmake .. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} $CMAKE_OPTIONS -G "Unix Makefiles" - make -j4 + command: scripts/ci/build.sh - run_build_ossfuzz: &run_build_ossfuzz name: Build_ossfuzz - command: | - mkdir -p build - cd build - protoc --proto_path=../test/tools/ossfuzz yulProto.proto --cpp_out=../test/tools/ossfuzz - protoc --proto_path=../test/tools/ossfuzz abiV2Proto.proto --cpp_out=../test/tools/ossfuzz - protoc --proto_path=../test/tools/ossfuzz solProto.proto --cpp_out=../test/tools/ossfuzz - cmake .. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} $CMAKE_OPTIONS - make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j4 + command: scripts/ci/build_ossfuzz.sh - run_proofs: &run_proofs name: Correctness proofs for optimization rules diff --git a/.github/workflows/buildpack-deps.yml b/.github/workflows/buildpack-deps.yml new file mode 100644 index 000000000000..48d83b77cd04 --- /dev/null +++ b/.github/workflows/buildpack-deps.yml @@ -0,0 +1,42 @@ +name: buildpack-deps + +on: + pull_request: + branches: [ develop ] + paths: + - 'scripts/docker/buildpack-deps/Dockerfile.emscripten' + - 'scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz' + - 'scripts/docker/buildpack-deps/Dockerfile.ubuntu1804' + - 'scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang' + - 'scripts/docker/buildpack-deps/Dockerfile.ubuntu2004' + +jobs: + buildpack-deps: + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }} + IMAGE_NAME: buildpack-deps + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + image_variant: [emscripten, ubuntu1604.clang.ossfuzz, ubuntu1804, ubuntu2004.clang, ubuntu2004] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Upgrade ${{ env.IMAGE_NAME }}-${{ matrix.image_variant }} + run: | + echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin + scripts/ci/docker_upgrade.sh ${{ env.IMAGE_NAME }} ${{ matrix.image_variant }} ${{ env.DOCKER_REPOSITORY }} + docker logout docker.pkg.github.com + + - name: comment PR + if: "env.DOCKER_IMAGE" + uses: aarlt/comment-on-pr@v1.2.0 + with: + msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`." \ No newline at end of file diff --git a/.gitignore b/.gitignore index 67e4507591ab..749860301975 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ prerelease.txt # Build directory build/ -build*/ +/build*/ emscripten_build/ docs/_build __pycache__ diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh new file mode 100755 index 000000000000..1c8824abf46f --- /dev/null +++ b/scripts/ci/build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -ex + +ROOTDIR="$(dirname "$0")/../.." +cd "${ROOTDIR}" + +# shellcheck disable=SC2166 +if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" >prerelease.txt; fi +if [ -n "$CIRCLE_SHA1" ] +then + echo -n "$CIRCLE_SHA1" >commit_hash.txt +fi + +mkdir -p build +cd build + +# shellcheck disable=SC2166 +[ -n "$COVERAGE" -a "$CIRCLE_BRANCH" != release -a -z "$CIRCLE_TAG" ] && CMAKE_OPTIONS="$CMAKE_OPTIONS -DCOVERAGE=ON" + +# shellcheck disable=SC2086 +cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS -G "Unix Makefiles" + +make -j 4 diff --git a/scripts/ci/build_ossfuzz.sh b/scripts/ci/build_ossfuzz.sh new file mode 100755 index 000000000000..42f7b3a3959c --- /dev/null +++ b/scripts/ci/build_ossfuzz.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +ROOTDIR="$(dirname "$0")/../.." +BUILDDIR="${ROOTDIR}/build" + +mkdir -p "${BUILDDIR}" +cd "${BUILDDIR}" + +protoc --proto_path=../test/tools/ossfuzz yulProto.proto --cpp_out=../test/tools/ossfuzz +protoc --proto_path=../test/tools/ossfuzz abiV2Proto.proto --cpp_out=../test/tools/ossfuzz +protoc --proto_path=../test/tools/ossfuzz solProto.proto --cpp_out=../test/tools/ossfuzz +cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/libfuzzer.cmake + +make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j 4 diff --git a/scripts/ci/buildpack-deps_test_emscripten.sh b/scripts/ci/buildpack-deps_test_emscripten.sh new file mode 120000 index 000000000000..6e838fba7fb3 --- /dev/null +++ b/scripts/ci/buildpack-deps_test_emscripten.sh @@ -0,0 +1 @@ +../../scripts/travis-emscripten/build_emscripten.sh \ No newline at end of file diff --git a/scripts/ci/buildpack-deps_test_ubuntu1604.clang.ossfuzz.sh b/scripts/ci/buildpack-deps_test_ubuntu1604.clang.ossfuzz.sh new file mode 120000 index 000000000000..86beda7dd2c3 --- /dev/null +++ b/scripts/ci/buildpack-deps_test_ubuntu1604.clang.ossfuzz.sh @@ -0,0 +1 @@ +build_ossfuzz.sh \ No newline at end of file diff --git a/scripts/ci/buildpack-deps_test_ubuntu1804.sh b/scripts/ci/buildpack-deps_test_ubuntu1804.sh new file mode 120000 index 000000000000..c07a74de4fb4 --- /dev/null +++ b/scripts/ci/buildpack-deps_test_ubuntu1804.sh @@ -0,0 +1 @@ +build.sh \ No newline at end of file diff --git a/scripts/ci/buildpack-deps_test_ubuntu2004.clang.sh b/scripts/ci/buildpack-deps_test_ubuntu2004.clang.sh new file mode 120000 index 000000000000..c07a74de4fb4 --- /dev/null +++ b/scripts/ci/buildpack-deps_test_ubuntu2004.clang.sh @@ -0,0 +1 @@ +build.sh \ No newline at end of file diff --git a/scripts/ci/buildpack-deps_test_ubuntu2004.sh b/scripts/ci/buildpack-deps_test_ubuntu2004.sh new file mode 120000 index 000000000000..c07a74de4fb4 --- /dev/null +++ b/scripts/ci/buildpack-deps_test_ubuntu2004.sh @@ -0,0 +1 @@ +build.sh \ No newline at end of file diff --git a/scripts/ci/docker_upgrade.sh b/scripts/ci/docker_upgrade.sh new file mode 100755 index 000000000000..a8212c2c24d4 --- /dev/null +++ b/scripts/ci/docker_upgrade.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +set -e + +function error() { + echo >&2 "ERROR: ${1} Aborting." && false +} + +function warning() { + echo >&2 "WARNING: ${1}" +} + +[[ $# == 3 ]] || error "Expected exactly 3 parameters: '${0} '." + +IMAGE_NAME="${1}" +IMAGE_VARIANT="${2}" +DOCKER_REPOSITORY="${3}" +DOCKERFILE="scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}" + +echo "-- check_dockerfile_was_changed" + +# exit, if the dockerfile was not changed. +if git diff --quiet origin/develop HEAD -- "${DOCKERFILE}"; then + echo "${DOCKERFILE} was not changed. Nothing to do." + exit 0 +fi + +echo "-- check_version" + +PREV_VERSION=$(git diff origin/develop HEAD -- "${DOCKERFILE}" | grep -e '^\s*-LABEL\s\+version=".*"\s*$' | awk -F'"' '{ print $2 }') +NEXT_VERSION=$(git diff origin/develop HEAD -- "${DOCKERFILE}" | grep -e '^\s*+LABEL\s\+version=".*"\s*$' | awk -F'"' '{ print $2 }') + +[[ $NEXT_VERSION != "" ]] || error "No version label defined in Dockerfile. You may need to add 'LABEL version' in '${DOCKERFILE}'." + +[[ $PREV_VERSION != "" ]] || { + warning "no previous version found. Will set \$PREV_VERSION = 0." + PREV_VERSION=0 +} + +if [[ $((PREV_VERSION + 1)) != $((NEXT_VERSION)) ]]; then + error "Version label in Dockerfile was not incremented. You may need to change 'LABEL version' in '${DOCKERFILE}'." +fi + +echo "-- build_docker" + +# This is a workaround: we run `docker build` twice to prevent the `layer does not exist` problem. +# See https://github.com/moby/moby/issues/37965. +docker build "scripts/docker/${IMAGE_NAME}" --file "scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}" --tag "${IMAGE_NAME}" || + docker build "scripts/docker/${IMAGE_NAME}" --file "scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}" --tag "${IMAGE_NAME}" + +echo "-- test_docker @ '${PWD}'" + +docker run --rm --volume "${PWD}:/root/project" "${IMAGE_NAME}" "/root/project/scripts/ci/${IMAGE_NAME}_test_${IMAGE_VARIANT}.sh" + +echo "-- push_docker" + +VERSION=$(docker inspect --format='{{.Config.Labels.version}}' "${IMAGE_NAME}") +DOCKER_IMAGE_ID="${DOCKER_REPOSITORY}/${IMAGE_NAME}-${IMAGE_VARIANT}" + +docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:${VERSION}" +docker push "${DOCKER_IMAGE_ID}:${VERSION}" + +REPO_DIGEST=$(docker inspect --format='{{.RepoDigests}}' "${DOCKER_IMAGE_ID}:${VERSION}") + +docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:latest" +docker push "${DOCKER_IMAGE_ID}:latest" + +echo "::set-env name=DOCKER_IMAGE::${DOCKER_IMAGE_ID}:${VERSION}" +echo "::set-env name=DOCKER_REPO_DIGEST::${REPO_DIGEST}" diff --git a/.circleci/docker/Dockerfile.emscripten b/scripts/docker/buildpack-deps/Dockerfile.emscripten similarity index 99% rename from .circleci/docker/Dockerfile.emscripten rename to scripts/docker/buildpack-deps/Dockerfile.emscripten index d2456bb2ae0b..8885e1302508 100644 --- a/.circleci/docker/Dockerfile.emscripten +++ b/scripts/docker/buildpack-deps/Dockerfile.emscripten @@ -29,6 +29,7 @@ # make version=1.39.15 build # FROM emscripten/emsdk:1.39.15 AS base +LABEL version="0" ADD emscripten.jam /usr/src RUN set -ex; \ @@ -63,3 +64,4 @@ RUN set -ex; \ cxxflags="-s DISABLE_EXCEPTION_CATCHING=0 -Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ --prefix=/emsdk/emscripten/sdk/system install; \ rm -r /usr/src/boost_1_73_0 + diff --git a/.circleci/docker/Dockerfile.ubuntu1604.clang.ossfuzz b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz similarity index 99% rename from .circleci/docker/Dockerfile.ubuntu1604.clang.ossfuzz rename to scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz index f7dfc7001bdf..add0bfec433e 100644 --- a/.circleci/docker/Dockerfile.ubuntu1604.clang.ossfuzz +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz @@ -22,6 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM gcr.io/oss-fuzz-base/base-clang as base +LABEL version="0" ARG DEBIAN_FRONTEND=noninteractive @@ -99,3 +100,4 @@ FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin COPY --from=libraries /usr/include /usr/include + diff --git a/.circleci/docker/Dockerfile.ubuntu1804 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 similarity index 99% rename from .circleci/docker/Dockerfile.ubuntu1804 rename to scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 index fa651900b873..34f1e674b866 100644 --- a/.circleci/docker/Dockerfile.ubuntu1804 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 @@ -22,6 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:bionic AS base +LABEL version="0" ARG DEBIAN_FRONTEND=noninteractive @@ -91,3 +92,4 @@ FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin COPY --from=libraries /usr/include /usr/include + diff --git a/.circleci/docker/Dockerfile.ubuntu2004 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 similarity index 99% rename from .circleci/docker/Dockerfile.ubuntu2004 rename to scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 index a021b6533486..6c5486bd2776 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 @@ -22,6 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base +LABEL version="0" ARG DEBIAN_FRONTEND=noninteractive @@ -60,3 +61,4 @@ FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin COPY --from=libraries /usr/include /usr/include + diff --git a/.circleci/docker/Dockerfile.ubuntu2004.clang b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang similarity index 99% rename from .circleci/docker/Dockerfile.ubuntu2004.clang rename to scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang index c8d057eb11a0..b38fe4f1a261 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004.clang +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang @@ -22,6 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base +LABEL version="0" ARG DEBIAN_FRONTEND=noninteractive @@ -62,3 +63,4 @@ FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin COPY --from=libraries /usr/include /usr/include + diff --git a/scripts/docker/buildpack-deps/README.md b/scripts/docker/buildpack-deps/README.md new file mode 100644 index 000000000000..004a89e91f78 --- /dev/null +++ b/scripts/docker/buildpack-deps/README.md @@ -0,0 +1,35 @@ +# buildpack-deps docker images + +The `buildpack-deps` docker images are used to compile and test solidity within our CI. + +## GitHub Workflow + +The creation of the images are triggered by a single workflow, defined in `.github/workflows/buildpack-deps.yml`. +For each resulting `buildpack-deps` docker image a strategy is defined in the workflow file - the image variant. +The workflow gets triggered, if any Dockerfile defined in `scripts/docker/buildpack-deps/Dockerfile.*` were changed +within the PR. + +### Versioning + +The version of the docker images can be defined within the Dockerfile with `LABEL version`. A new docker image +will only be created and pushed, if the new version is incremented by `1` compared with the version of the Dockerfile +located in `develop`. + +### Build, Test & Push + +Note that the whole workflow - including all defined strategies (image variants) - will be triggered, +even if only a single Dockerfile was change. The full workflow will only gets executed, if the corresponding +Dockerfile was changed. The execution of workflows of unchanged Dockerfiles will not continue and just return success. +See `scripts/ci/docker_upgrade.sh`. + +If the version check was successful, the docker image will be built using the Dockerfile located in +`scripts/docker/buildpack-deps/Dockerfile.*`. + +The resulting docker image will be tested by executing +the corresponding `scripts/ci/buildpack-deps_test_*` scripts. These scripts are normally symlinked to `scripts/ci/build.sh`, +except for the `buildpack-deps-ubuntu1604.clang.ossfuzz` docker image, that is symlinked to `scripts/ci/build_ossfuzz.sh`. +These scripts `scripts/ci/build.sh` and `scripts/ci/build_ossfuzz.sh` are also used by CircleCI, see `.circleci/config.yml`. + +If the tests passed successfully, the docker image will get tagged by the version defined within the corresponding `Dockerfile`. +Finally, a comment will be added to the PR that contains the full repository, version and repository digest +of the freshly created docker image. \ No newline at end of file diff --git a/.circleci/docker/emscripten.jam b/scripts/docker/buildpack-deps/emscripten.jam similarity index 100% rename from .circleci/docker/emscripten.jam rename to scripts/docker/buildpack-deps/emscripten.jam From ca313e40030a8c52e8427947820f0594d94edffb Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 15 Jul 2020 12:10:56 +0200 Subject: [PATCH 390/479] Use more processors to build base builds. --- .circleci/config.yml | 5 +++++ .travis.yml | 1 + scripts/ci/build.sh | 2 +- scripts/travis-emscripten/build_emscripten.sh | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 288749974fb3..826c04785e84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -407,8 +407,11 @@ jobs: - persist_to_workspace: *artifacts_executables b_ubu: &build_ubuntu2004 + resource_class: xlarge docker: - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + environment: + MAKEFLAGS: -j 10 steps: - checkout - run: *run_build @@ -583,9 +586,11 @@ jobs: - store_artifacts: *artifacts_test_results b_ems: + resource_class: xlarge docker: - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 environment: + MAKEFLAGS: -j 10 TERM: xterm steps: - checkout diff --git a/.travis.yml b/.travis.yml index ef7832777448..e20a4d20298e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,7 @@ env: - SOLC_TESTS=On - SOLC_STOREBYTECODE=Off - SOLC_DOCKER=Off + - MAKEFLAGS="-j 4" matrix: include: diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 1c8824abf46f..a939412f6dc5 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -20,4 +20,4 @@ cd build # shellcheck disable=SC2086 cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS -G "Unix Makefiles" -make -j 4 +make diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh index 5c7e3f052a95..3162e13b661a 100755 --- a/scripts/travis-emscripten/build_emscripten.sh +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -53,7 +53,7 @@ cmake \ -DBoost_USE_STATIC_RUNTIME=1 \ -DTESTS=0 \ .. -make -j 4 soljson +make soljson # Patch soljson.js for backwards compatibility. # TODO: remove this with 0.7. # "viiiii" encodes the signature of the callback function. From 46653b2d434f026933aa4a8a244a1152ceb7009d Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 15 Jul 2020 18:10:14 +0200 Subject: [PATCH 391/479] Fix ICE when bitwise operator on fixed bytes --- Changelog.md | 1 + libsmtutil/SolverInterface.h | 23 +++++++++++-------- libsolidity/formal/SMTEncoder.cpp | 6 +++-- libsolidity/formal/SymbolicTypes.cpp | 4 ++++ .../operators/bitwise_and_fixed_bytes.sol | 8 +++++++ .../operators/bitwise_xor_fixed_bytes.sol | 9 ++++++++ 6 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol diff --git a/Changelog.md b/Changelog.md index 047b06ddfa0c..4953a4e49b0f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ Compiler Features: * Yul EVM Code Transform: Free stack slots directly after visiting the right-hand-side of variable declarations instead of at the end of the statement only. Bugfixes: + * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index be12c3a80811..a62a39b37fe4 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -59,10 +59,10 @@ class Expression public: explicit Expression(bool _v): Expression(_v ? "true" : "false", Kind::Bool) {} explicit Expression(std::shared_ptr _sort, std::string _name = ""): Expression(std::move(_name), {}, _sort) {} - Expression(size_t _number): Expression(std::to_string(_number), Kind::Int) {} - Expression(u256 const& _number): Expression(_number.str(), Kind::Int) {} - Expression(s256 const& _number): Expression(_number.str(), Kind::Int) {} - Expression(bigint const& _number): Expression(_number.str(), Kind::Int) {} + Expression(size_t _number): Expression(std::to_string(_number), {}, SortProvider::sintSort) {} + Expression(u256 const& _number): Expression(_number.str(), {}, SortProvider::sintSort) {} + Expression(s256 const& _number): Expression(_number.str(), {}, SortProvider::sintSort) {} + Expression(bigint const& _number): Expression(_number.str(), {}, SortProvider::sintSort) {} Expression(Expression const&) = default; Expression(Expression&&) = default; @@ -262,23 +262,28 @@ class Expression } friend Expression operator+(Expression _a, Expression _b) { - return Expression("+", std::move(_a), std::move(_b), Kind::Int); + auto intSort = _a.sort; + return Expression("+", {std::move(_a), std::move(_b)}, intSort); } friend Expression operator-(Expression _a, Expression _b) { - return Expression("-", std::move(_a), std::move(_b), Kind::Int); + auto intSort = _a.sort; + return Expression("-", {std::move(_a), std::move(_b)}, intSort); } friend Expression operator*(Expression _a, Expression _b) { - return Expression("*", std::move(_a), std::move(_b), Kind::Int); + auto intSort = _a.sort; + return Expression("*", {std::move(_a), std::move(_b)}, intSort); } friend Expression operator/(Expression _a, Expression _b) { - return Expression("/", std::move(_a), std::move(_b), Kind::Int); + auto intSort = _a.sort; + return Expression("/", {std::move(_a), std::move(_b)}, intSort); } friend Expression operator%(Expression _a, Expression _b) { - return Expression("mod", std::move(_a), std::move(_b), Kind::Int); + auto intSort = _a.sort; + return Expression("mod", {std::move(_a), std::move(_b)}, intSort); } friend Expression operator&(Expression _a, Expression _b) { diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index eea0b24e59e6..6a403051168a 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1376,9 +1376,11 @@ void SMTEncoder::bitwiseOperation(BinaryOperation const& _op) bvSize = fixedType->numBits(); isSigned = fixedType->isSigned(); } + else if (auto const* fixedBytesType = dynamic_cast(commonType)) + bvSize = fixedBytesType->numBytes() * 8; - auto bvLeft = smtutil::Expression::int2bv(expr(_op.leftExpression()), bvSize); - auto bvRight = smtutil::Expression::int2bv(expr(_op.rightExpression()), bvSize); + auto bvLeft = smtutil::Expression::int2bv(expr(_op.leftExpression(), commonType), bvSize); + auto bvRight = smtutil::Expression::int2bv(expr(_op.rightExpression(), commonType), bvSize); optional result; if (_op.getOperator() == Token::BitAnd) diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index a46b88e03140..096f496c4acd 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -441,7 +441,11 @@ optional symbolicTypeConversion(TypePointer _from, TypePoin // case they'd need to be encoded as numbers. if (auto strType = dynamic_cast(_from)) if (_to->category() == frontend::Type::Category::FixedBytes) + { + if (strType->value().empty()) + return smtutil::Expression(size_t(0)); return smtutil::Expression(u256(toHex(util::asBytes(strType->value()), util::HexPrefix::Add))); + } return std::nullopt; } diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol new file mode 100644 index 000000000000..c3212bb23c69 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_fixed_bytes.sol @@ -0,0 +1,8 @@ +pragma experimental SMTChecker; +contract C { + function f() public pure returns (byte) { + return (byte("") & ("")); + } +} +// ---- +// Warning 5084: (101-109): Type conversion is not yet fully supported and might yield false positives. diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol new file mode 100644 index 000000000000..3852563be270 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_xor_fixed_bytes.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; +contract Simp { + function f3() public pure returns (byte) { + bytes memory y = "def"; + return y[0] ^ "e"; + } +} +// ---- +// Warning 1093: (142-152): Assertion checker does not yet implement this bitwise operator. From 99d831d7d150fc03941cbd0482d51dc54d228fae Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 15 Jul 2020 19:50:19 +0200 Subject: [PATCH 392/479] Extract recursive function detection from Semantics into the CallGraph. --- libyul/optimiser/CallGraphGenerator.cpp | 41 +++++++++++++++++++++++++ libyul/optimiser/CallGraphGenerator.h | 4 +++ libyul/optimiser/Semantics.cpp | 22 +------------ 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/libyul/optimiser/CallGraphGenerator.cpp b/libyul/optimiser/CallGraphGenerator.cpp index d3805e7f72d0..565518af093b 100644 --- a/libyul/optimiser/CallGraphGenerator.cpp +++ b/libyul/optimiser/CallGraphGenerator.cpp @@ -30,6 +30,47 @@ using namespace solidity; using namespace solidity::yul; using namespace solidity::util; +namespace +{ +// TODO: This algorithm is non-optimal. +struct CallGraphCycleFinder +{ + CallGraph const& callGraph; + set containedInCycle{}; + set visited{}; + vector currentPath{}; + + void visit(YulString _function) + { + if (visited.count(_function)) + return; + if ( + auto it = find(currentPath.begin(), currentPath.end(), _function); + it != currentPath.end() + ) + containedInCycle.insert(it, currentPath.end()); + else + { + currentPath.emplace_back(_function); + if (callGraph.functionCalls.count(_function)) + for (auto const& child: callGraph.functionCalls.at(_function)) + visit(child); + currentPath.pop_back(); + visited.insert(_function); + } + } +}; +} + +set CallGraph::recursiveFunctions() const +{ + CallGraphCycleFinder cycleFinder{*this}; + // Visiting the root only is not enough, since there may be disconnected recursive functions. + for (auto const& call: functionCalls) + cycleFinder.visit(call.first); + return cycleFinder.containedInCycle; +} + CallGraph CallGraphGenerator::callGraph(Block const& _ast) { CallGraphGenerator gen; diff --git a/libyul/optimiser/CallGraphGenerator.h b/libyul/optimiser/CallGraphGenerator.h index 2a05c7564930..2b57f8592fde 100644 --- a/libyul/optimiser/CallGraphGenerator.h +++ b/libyul/optimiser/CallGraphGenerator.h @@ -35,6 +35,10 @@ struct CallGraph { std::map> functionCalls; std::set functionsWithLoops; + /// @returns the set of functions contained in cycles in the call graph, i.e. + /// functions that are part of a (mutual) recursion. + /// Note that this does not include functions that merely call recursive functions. + std::set recursiveFunctions() const; }; /** diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index f9d831b7abef..6100b1cdcf22 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -102,33 +102,13 @@ map SideEffectsPropagator::sideEffects( // is actually a bit different from "not movable". map ret; - for (auto const& function: _directCallGraph.functionsWithLoops) + for (auto const& function: _directCallGraph.functionsWithLoops + _directCallGraph.recursiveFunctions()) { ret[function].movable = false; ret[function].sideEffectFree = false; ret[function].sideEffectFreeIfNoMSize = false; } - // Detect recursive functions. - for (auto const& call: _directCallGraph.functionCalls) - { - // TODO we could shortcut the search as soon as we find a - // function that has as bad side-effects as we can - // ever achieve via recursion. - auto search = [&](YulString const& _functionName, util::CycleDetector& _cycleDetector, size_t) { - for (auto const& callee: _directCallGraph.functionCalls.at(_functionName)) - if (!_dialect.builtin(callee)) - if (_cycleDetector.run(callee)) - return; - }; - if (util::CycleDetector(search).run(call.first)) - { - ret[call.first].movable = false; - ret[call.first].sideEffectFree = false; - ret[call.first].sideEffectFreeIfNoMSize = false; - } - } - for (auto const& call: _directCallGraph.functionCalls) { YulString funName = call.first; From 0b9bb84c39a25b0361d8fe30eddf47c8c4c441d4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 15 Jul 2020 13:05:08 +0200 Subject: [PATCH 393/479] Run tests in parallel. --- .circleci/config.yml | 1 + .circleci/soltest_all.sh | 47 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 826c04785e84..df0eba03da1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,6 +139,7 @@ defaults: - test_ubuntu2004: &test_ubuntu2004 docker: - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + parallelism: 6 steps: - checkout - attach_workspace: diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index 86f172a04ca8..7b1fb053bd69 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -28,10 +28,49 @@ set -e REPODIR="$(realpath $(dirname $0)/..)" -EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh +EVM_VALUES=(homestead byzantium constantinople petersburg istanbul) +OPTIMIZE_VALUES=(0 1) +STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} )) -for OPTIMIZE in 0 1; do - for EVM in homestead byzantium constantinople petersburg istanbul; do - EVM=$EVM OPTIMIZE=$OPTIMIZE BOOST_TEST_ARGS="-t !@nooptions" ${REPODIR}/.circleci/soltest.sh +if (( $CIRCLE_NODE_TOTAL )) && (( $CIRCLE_NODE_TOTAL > 1 )) +then + # Run step 1 as the only step on the first executor + # and evenly distribute the other steps among + # the other executors. + # The first step takes much longer than the other steps. + if (( $CIRCLE_NODE_INDEX == 0 )) + then + RUN_STEPS="1" + else + export CIRCLE_NODE_INDEX=$(($CIRCLE_NODE_INDEX - 1)) + export CIRCLE_NODE_TOTAL=$(($CIRCLE_NODE_TOTAL - 1)) + RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split) + fi +else + RUN_STEPS=$(seq "$STEPS") +fi + +# turn newlines into spaces +RUN_STEPS=$(echo $RUN_STEPS) + +echo "Running steps $RUN_STEPS..." + +STEP=1 + +[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 "${REPODIR}/.circleci/soltest.sh" +STEP=$(($STEP + 1)) + +for OPTIMIZE in ${OPTIMIZE_VALUES[@]} +do + for EVM in ${EVM_VALUES[@]} + do + [[ " $RUN_STEPS " =~ " $STEP " ]] && EVM="$EVM" OPTIMIZE="$OPTIMIZE" BOOST_TEST_ARGS="-t !@nooptions" "${REPODIR}/.circleci/soltest.sh" + STEP=$(($STEP + 1)) done done + +if (($STEP != $STEPS + 1)) +then + echo "Step counter not properly adjusted!" >2 + exit 1 +fi From f47981d484606172af1a393ea2d107eee48e11be Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 8 Jun 2020 17:50:55 +0200 Subject: [PATCH 394/479] Prepare testcase for avoiding double cleanup --- test/libsolidity/SolidityOptimizer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 4062b1928b2b..68c500e8ca63 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -708,6 +708,18 @@ BOOST_AUTO_TEST_CASE(shift_optimizer_bug) compareVersions("g(uint256)", u256(-1)); } +BOOST_AUTO_TEST_CASE(avoid_double_cleanup) +{ + char const* sourceCode = R"( + contract C { + receive() external payable { + abi.encodePacked(uint200(0)); + } + } + )"; + compileBothVersions(sourceCode, 0, "C", 50); + BOOST_CHECK_EQUAL(numInstructions(m_nonOptimizedBytecode, Instruction::AND), 2); +} BOOST_AUTO_TEST_SUITE_END() From d3af598c49b42f62c56f250f72546686a2bd83a6 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 8 Jun 2020 17:52:40 +0200 Subject: [PATCH 395/479] CodeGen: Avoid double cleanup when copying to memory --- Changelog.md | 1 + libsolidity/codegen/CompilerUtils.cpp | 19 +++++++++++++------ libsolidity/codegen/CompilerUtils.h | 6 ++++-- test/libsolidity/SolidityOptimizer.cpp | 3 ++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4953a4e49b0f..0f0e533b9077 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. + * Code Generator: Avoid double cleanup when copying to memory. Compiler Features: * Build System: Update internal dependency of jsoncpp to 1.9.3. diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index b3fc9da2efa2..2d7b38b259ad 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -180,7 +180,7 @@ void CompilerUtils::storeInMemory(unsigned _offset) m_context << u256(_offset) << Instruction::MSTORE; } -void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries) +void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries, bool _cleanup) { // process special types (Reference, StringLiteral, Function) if (auto ref = dynamic_cast(&_type)) @@ -189,7 +189,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound ref->location() == DataLocation::Memory, "Only in-memory reference type can be stored." ); - storeInMemoryDynamic(*TypeProvider::uint256(), _padToWordBoundaries); + storeInMemoryDynamic(*TypeProvider::uint256(), _padToWordBoundaries, _cleanup); } else if (auto str = dynamic_cast(&_type)) { @@ -212,7 +212,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound } else if (_type.isValueType()) { - unsigned numBytes = prepareMemoryStore(_type, _padToWordBoundaries); + unsigned numBytes = prepareMemoryStore(_type, _padToWordBoundaries, _cleanup); m_context << Instruction::DUP2 << Instruction::MSTORE; m_context << u256(numBytes) << Instruction::ADD; } @@ -463,6 +463,7 @@ void CompilerUtils::encodeToMemory( } else { + bool needCleanup = true; copyToStackTop(argSize - stackPos + dynPointers + 2, _givenTypes[i]->sizeOnStack()); solAssert(!!targetType, "Externalable type expected."); TypePointer type = targetType; @@ -481,7 +482,11 @@ void CompilerUtils::encodeToMemory( ) type = _givenTypes[i]; // delay conversion else + { convertType(*_givenTypes[i], *targetType, true); + needCleanup = false; + } + if (auto arrayType = dynamic_cast(type)) ArrayUtils(m_context).copyArrayToMemory(*arrayType, _padToWordBoundaries); else if (auto arraySliceType = dynamic_cast(type)) @@ -495,7 +500,7 @@ void CompilerUtils::encodeToMemory( ArrayUtils(m_context).copyArrayToMemory(arraySliceType->arrayType(), _padToWordBoundaries); } else - storeInMemoryDynamic(*type, _padToWordBoundaries); + storeInMemoryDynamic(*type, _padToWordBoundaries, needCleanup); } stackPos += _givenTypes[i]->sizeOnStack(); } @@ -1499,7 +1504,7 @@ void CompilerUtils::rightShiftNumberOnStack(unsigned _bits) m_context << (u256(1) << _bits) << Instruction::SWAP1 << Instruction::DIV; } -unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords) +unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords, bool _cleanup) { solAssert( _type.sizeOnStack() == 1, @@ -1522,7 +1527,9 @@ unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords) bool leftAligned = _type.category() == Type::Category::FixedBytes; - convertType(_type, _type, true); + if (_cleanup) + convertType(_type, _type, true); + if (numBytes != 32 && !leftAligned && !_padToWords) // shift the value accordingly before storing leftShiftNumberOnStack((32 - numBytes) * 8); diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index a3c266bdee35..a65edb8f2acd 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -107,10 +107,11 @@ class CompilerUtils /// and also updates that. For reference types, only copies the data pointer. Fails for /// non-memory-references. /// @param _padToWords if true, adds zeros to pad to multiple of 32 bytes. Array elements + /// @param _cleanup if true, adds code to cleanup the value before storing it. /// are always padded (except for byte arrays), regardless of this parameter. /// Stack pre: memory_offset value... /// Stack post: (memory_offset+length) - void storeInMemoryDynamic(Type const& _type, bool _padToWords = true); + void storeInMemoryDynamic(Type const& _type, bool _padToWords = true, bool _cleanup = true); /// Creates code that unpacks the arguments according to their types specified by a vector of TypePointers. /// From memory if @a _fromMemory is true, otherwise from call data. @@ -309,7 +310,8 @@ class CompilerUtils void cleanHigherOrderBits(IntegerType const& _typeOnStack); /// Prepares the given type for storing in memory by shifting it if necessary. - unsigned prepareMemoryStore(Type const& _type, bool _padToWords); + /// @param _cleanup if true, also cleanup the value when preparing to store it in memory + unsigned prepareMemoryStore(Type const& _type, bool _padToWords, bool _cleanup = true); /// Loads type from memory assuming memory offset is on stack top. unsigned loadFromMemoryHelper(Type const& _type, bool _fromCalldata, bool _padToWords); diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 68c500e8ca63..c4f7a2e71481 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -718,7 +718,8 @@ BOOST_AUTO_TEST_CASE(avoid_double_cleanup) } )"; compileBothVersions(sourceCode, 0, "C", 50); - BOOST_CHECK_EQUAL(numInstructions(m_nonOptimizedBytecode, Instruction::AND), 2); + // Check that there is no double AND instruction in the resulting code + BOOST_CHECK_EQUAL(numInstructions(m_nonOptimizedBytecode, Instruction::AND), 1); } BOOST_AUTO_TEST_SUITE_END() From f7e180fb8f1283a4e0bd16d9f16bafd8daaf196d Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 15 Jul 2020 10:42:15 -0500 Subject: [PATCH 396/479] Push images to docker hub. --- .github/workflows/buildpack-deps.yml | 7 ++++--- scripts/ci/docker_upgrade.sh | 13 +++++-------- scripts/docker/buildpack-deps/Dockerfile.emscripten | 2 +- .../Dockerfile.ubuntu1604.clang.ossfuzz | 2 +- scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 | 2 +- scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 | 2 +- .../buildpack-deps/Dockerfile.ubuntu2004.clang | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/buildpack-deps.yml b/.github/workflows/buildpack-deps.yml index 48d83b77cd04..2e2ea547fc54 100644 --- a/.github/workflows/buildpack-deps.yml +++ b/.github/workflows/buildpack-deps.yml @@ -14,7 +14,8 @@ jobs: buildpack-deps: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + DOCKER_REPOSITORY: solbuildpackpusher/solidity-buildpack-deps IMAGE_NAME: buildpack-deps runs-on: ubuntu-latest @@ -31,9 +32,9 @@ jobs: - name: Upgrade ${{ env.IMAGE_NAME }}-${{ matrix.image_variant }} run: | - echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin + echo ${DOCKERHUB_TOKEN} | docker login -u solbuildpackpusher --password-stdin scripts/ci/docker_upgrade.sh ${{ env.IMAGE_NAME }} ${{ matrix.image_variant }} ${{ env.DOCKER_REPOSITORY }} - docker logout docker.pkg.github.com + docker logout - name: comment PR if: "env.DOCKER_IMAGE" diff --git a/scripts/ci/docker_upgrade.sh b/scripts/ci/docker_upgrade.sh index a8212c2c24d4..16d6222305bf 100755 --- a/scripts/ci/docker_upgrade.sh +++ b/scripts/ci/docker_upgrade.sh @@ -54,15 +54,12 @@ docker run --rm --volume "${PWD}:/root/project" "${IMAGE_NAME}" "/root/project/s echo "-- push_docker" VERSION=$(docker inspect --format='{{.Config.Labels.version}}' "${IMAGE_NAME}") -DOCKER_IMAGE_ID="${DOCKER_REPOSITORY}/${IMAGE_NAME}-${IMAGE_VARIANT}" +DOCKER_IMAGE_ID="${DOCKER_REPOSITORY}:${IMAGE_VARIANT}" -docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:${VERSION}" -docker push "${DOCKER_IMAGE_ID}:${VERSION}" +docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}-${VERSION}" +docker push "${DOCKER_IMAGE_ID}-${VERSION}" -REPO_DIGEST=$(docker inspect --format='{{.RepoDigests}}' "${DOCKER_IMAGE_ID}:${VERSION}") +REPO_DIGEST=$(docker inspect --format='{{.RepoDigests}}' "${DOCKER_IMAGE_ID}-${VERSION}") -docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:latest" -docker push "${DOCKER_IMAGE_ID}:latest" - -echo "::set-env name=DOCKER_IMAGE::${DOCKER_IMAGE_ID}:${VERSION}" +echo "::set-env name=DOCKER_IMAGE::${DOCKER_IMAGE_ID}-${VERSION}" echo "::set-env name=DOCKER_REPO_DIGEST::${REPO_DIGEST}" diff --git a/scripts/docker/buildpack-deps/Dockerfile.emscripten b/scripts/docker/buildpack-deps/Dockerfile.emscripten index 8885e1302508..2d9ce401ddc1 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.emscripten +++ b/scripts/docker/buildpack-deps/Dockerfile.emscripten @@ -29,7 +29,7 @@ # make version=1.39.15 build # FROM emscripten/emsdk:1.39.15 AS base -LABEL version="0" +LABEL version="1" ADD emscripten.jam /usr/src RUN set -ex; \ diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz index add0bfec433e..ceea17d8180c 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM gcr.io/oss-fuzz-base/base-clang as base -LABEL version="0" +LABEL version="1" ARG DEBIAN_FRONTEND=noninteractive diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 index 34f1e674b866..51eed0a9e4ed 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:bionic AS base -LABEL version="0" +LABEL version="1" ARG DEBIAN_FRONTEND=noninteractive diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 index 6c5486bd2776..591e430af77a 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base -LABEL version="0" +LABEL version="1" ARG DEBIAN_FRONTEND=noninteractive diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang index b38fe4f1a261..c1663fdba7a9 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base -LABEL version="0" +LABEL version="1" ARG DEBIAN_FRONTEND=noninteractive From 34c34bda264d2adee6ac54adea9bdcaf7f383662 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 15 Jul 2020 12:44:35 +0200 Subject: [PATCH 397/479] Switch CI to new docker images. --- .circleci/config.yml | 45 ++++++++++++++++++++----------------- .travis.yml | 2 +- scripts/build_emscripten.sh | 3 ++- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df0eba03da1c..4a48caf546b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,18 +7,21 @@ # - ems: Emscripten version: 2.1 parameters: - ubuntu-1804-docker-image-rev: + ubuntu-1804-docker-image: type: string - default: "4" - ubuntu-2004-docker-image-rev: + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:4484ac3da8fdc337cc77a7a7be1af71cd0f28f9c890d934f1d6ae7532beb66b1" + ubuntu-2004-docker-image: type: string - default: "2" - ubuntu-2004-clang-docker-image-rev: + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:48b5bb6b91ac7dddfe9345c88876ebed126c652258800f114caed69db73b29bf" + ubuntu-2004-clang-docker-image: type: string - default: "2" - ubuntu-1604-clang-ossfuzz-docker-image-rev: + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d8775de58167db5a11690fdb6ef639317fe1e579ec5d46e9732d2d903b55d135" + ubuntu-1604-clang-ossfuzz-docker-image: type: string - default: "2" + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:db52f3257396814215744a19904e42c07e040ab36b68be72a27ba71ad2f1083c" + emscripten-docker-image: + type: string + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d557d015918c3cf68b0d22839bab41013f0757b651a7fef21595f89721dbebcc" defaults: @@ -116,7 +119,7 @@ defaults: - test_ubuntu1604_clang: &test_ubuntu1604_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1604-clang-ossfuzz-<< pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >> steps: - checkout - attach_workspace: @@ -127,7 +130,7 @@ defaults: - test_ubuntu2004_clang: &test_ubuntu2004_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-clang-<< pipeline.parameters.ubuntu-2004-clang-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> steps: - checkout - attach_workspace: @@ -138,7 +141,7 @@ defaults: - test_ubuntu2004: &test_ubuntu2004 docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> parallelism: 6 steps: - checkout @@ -374,7 +377,7 @@ jobs: chk_docs_pragma_min_version: docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> environment: TERM: xterm steps: @@ -383,7 +386,7 @@ jobs: b_ubu_clang: &build_ubuntu2004_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-clang-<< pipeline.parameters.ubuntu-2004-clang-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> environment: CC: clang CXX: clang++ @@ -396,7 +399,7 @@ jobs: b_ubu_asan_clang: &build_ubuntu2004_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-clang-<< pipeline.parameters.ubuntu-2004-clang-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> environment: CC: clang CXX: clang++ @@ -410,7 +413,7 @@ jobs: b_ubu: &build_ubuntu2004 resource_class: xlarge docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> environment: MAKEFLAGS: -j 10 steps: @@ -427,7 +430,7 @@ jobs: b_ubu18: &build_ubuntu1804 docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1804-<< pipeline.parameters.ubuntu-1804-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-1804-docker-image >> environment: CMAKE_OPTIONS: -DCMAKE_CXX_FLAGS=-O2 CMAKE_BUILD_TYPE: RelWithDebugInfo @@ -481,7 +484,7 @@ jobs: b_ubu_ossfuzz: &build_ubuntu1604_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1604-clang-ossfuzz-<< pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >> environment: CC: clang CXX: clang++ @@ -589,7 +592,7 @@ jobs: b_ems: resource_class: xlarge docker: - - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 + - image: << pipeline.parameters.emscripten-docker-image >> environment: MAKEFLAGS: -j 10 TERM: xterm @@ -625,7 +628,7 @@ jobs: b_docs: docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> steps: - checkout - run: *setup_prerelease_commit_hash @@ -641,7 +644,7 @@ jobs: t_ubu_soltest_enforce_yul: &t_ubu_soltest_enforce_yul docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> environment: EVM: constantinople SOLTEST_FLAGS: --enforce-via-yul @@ -667,7 +670,7 @@ jobs: t_ubu_cli: &t_ubu_cli docker: - - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> + - image: << pipeline.parameters.ubuntu-2004-docker-image >> environment: TERM: xterm steps: diff --git a/.travis.yml b/.travis.yml index e20a4d20298e..3d00a974de7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,7 @@ matrix: before_install: - nvm install 10 - nvm use 10 - - docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 + - docker pull solbuildpackpusher/solidity-buildpack-deps@sha256:d557d015918c3cf68b0d22839bab41013f0757b651a7fef21595f89721dbebcc env: - SOLC_EMSCRIPTEN=On - SOLC_INSTALL_DEPS_TRAVIS=Off diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index 7a052aa77eb6..f4b0fe647a7c 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -34,5 +34,6 @@ else BUILD_DIR="$1" fi -docker run -v $(pwd):/root/project -w /root/project ethereum/solidity-buildpack-deps:emsdk-1.39.15-2 \ +docker run -v $(pwd):/root/project -w /root/project \ + solbuildpackpusher/solidity-buildpack-deps@sha256:d557d015918c3cf68b0d22839bab41013f0757b651a7fef21595f89721dbebcc \ ./scripts/travis-emscripten/build_emscripten.sh $BUILD_DIR From aa3f51ab47ffc2ba393c2524fcd1ff0f4a795a35 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 15 Jul 2020 11:52:56 +0200 Subject: [PATCH 398/479] Issue state mutability restriction for overriding and not for virtual functions. --- Changelog.md | 1 + docs/contracts/abstract-contracts.rst | 4 ++-- libsolidity/analysis/ViewPureChecker.cpp | 2 +- .../interface/diamond/diamond_no_relist.sol | 4 ++-- .../interface/diamond/diamond_with_relist.sol | 8 ++++---- .../interface/implementation/complete.sol | 12 ++++++------ .../restrict_mutability_for_override_only.sol | 14 ++++++++++++++ ...r_bug_override_function_with_bytearray_type.sol | 2 +- 8 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/restrict_mutability_for_override_only.sol diff --git a/Changelog.md b/Changelog.md index dbdd34448292..d961fc275398 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ Breaking changes: * Remove the finney and szabo denominations. Language Features: + * State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override. * Yul: Disallow EVM instruction `pc()`. * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. diff --git a/docs/contracts/abstract-contracts.rst b/docs/contracts/abstract-contracts.rst index df9844eadcbc..fe31c0b328a2 100644 --- a/docs/contracts/abstract-contracts.rst +++ b/docs/contracts/abstract-contracts.rst @@ -27,11 +27,11 @@ all defined functions. The usage of an abstract contract as a base class is show pragma solidity >=0.6.0 <0.8.0; abstract contract Feline { - function utterance() public virtual returns (bytes32); + function utterance() public pure virtual returns (bytes32); } contract Cat is Feline { - function utterance() public override returns (bytes32) { return "miaow"; } + function utterance() public pure override returns (bytes32) { return "miaow"; } } If a contract inherits from an abstract contract and does not implement all non-implemented diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index 09c8a34b3c59..701126e76730 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -168,7 +168,7 @@ void ViewPureChecker::endVisit(FunctionDefinition const& _funDef) !_funDef.isConstructor() && !_funDef.isFallback() && !_funDef.isReceive() && - !_funDef.overrides() + !_funDef.virtualSemantics() ) m_errorReporter.warning( 2018_error, diff --git a/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_no_relist.sol b/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_no_relist.sol index 5d525fde4f0d..23b98f2c9cf9 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_no_relist.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_no_relist.sol @@ -1,10 +1,10 @@ interface Parent { - function test() external returns (uint256); + function test() external pure returns (uint256); } interface SubA is Parent {} interface SubB is Parent {} contract C is SubA, SubB { - function test() external override returns (uint256) { return 42; } + function test() external override pure returns (uint256) { return 42; } } diff --git a/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_with_relist.sol b/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_with_relist.sol index 30ee63cc7cc9..ecffe019e5a9 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_with_relist.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/diamond/diamond_with_relist.sol @@ -1,15 +1,15 @@ interface Parent { - function test() external returns (uint256); + function test() external pure returns (uint256); } interface SubA is Parent { - function test() external override returns (uint256); + function test() external pure override returns (uint256); } interface SubB is Parent { - function test() external override returns (uint256); + function test() external pure override returns (uint256); } contract C is SubA, SubB { - function test() external override(SubA, SubB) returns (uint256) { return 42; } + function test() external pure override(SubA, SubB) returns (uint256) { return 42; } } diff --git a/test/libsolidity/syntaxTests/inheritance/interface/implementation/complete.sol b/test/libsolidity/syntaxTests/inheritance/interface/implementation/complete.sol index 09334dafce32..acdd01200a0c 100644 --- a/test/libsolidity/syntaxTests/inheritance/interface/implementation/complete.sol +++ b/test/libsolidity/syntaxTests/inheritance/interface/implementation/complete.sol @@ -1,17 +1,17 @@ interface ParentA { - function testA() external returns (uint256); + function testA() external pure returns (uint256); } interface ParentB { - function testB() external returns (uint256); + function testB() external pure returns (uint256); } interface Sub is ParentA, ParentB { - function testSub() external returns (uint256); + function testSub() external pure returns (uint256); } contract SubImpl is Sub { - function testA() external override returns (uint256) { return 12; } - function testB() external override(ParentB) returns (uint256) { return 42; } - function testSub() external override returns (uint256) { return 99; } + function testA() external pure override returns (uint256) { return 12; } + function testB() external pure override(ParentB) returns (uint256) { return 42; } + function testSub() external pure override returns (uint256) { return 99; } } diff --git a/test/libsolidity/syntaxTests/inheritance/override/restrict_mutability_for_override_only.sol b/test/libsolidity/syntaxTests/inheritance/override/restrict_mutability_for_override_only.sol new file mode 100644 index 000000000000..bbcb89203ee4 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/restrict_mutability_for_override_only.sol @@ -0,0 +1,14 @@ +contract A { + // no "state mutability can be restricted"-warning here + function foo() external virtual returns (uint) { return 1; } +} +contract B is A { + // no "state mutability can be restricted"-warning here + function foo() external virtual override returns (uint) { return 2; } +} +contract C is B { + // warning is here + function foo() external override returns (uint) { return 3; } +} +// ---- +// Warning 2018: (339-400): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol index 284f85341d73..1864913f72ce 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol @@ -5,4 +5,4 @@ contract Bike is Vehicle { function f(bytes calldata) override external returns (uint256 r) {r = 42;} } // ---- -// Warning 2018: (23-95): Function state mutability can be restricted to pure +// Warning 2018: (129-203): Function state mutability can be restricted to pure From 579e4b5a6949581eb9cac3cc1be2114b804c7fff Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 8 Jul 2020 12:54:52 +0200 Subject: [PATCH 399/479] Report all stack errors in the EVM code transform. --- libyul/CompilabilityChecker.cpp | 9 +---- libyul/backends/evm/AsmCodeGen.cpp | 12 ++---- libyul/backends/evm/EVMCodeTransform.cpp | 47 +++++++++-------------- libyul/backends/evm/EVMObjectCompiler.cpp | 3 +- test/libyul/CompilabilityChecker.cpp | 4 +- 5 files changed, 27 insertions(+), 48 deletions(-) diff --git a/libyul/CompilabilityChecker.cpp b/libyul/CompilabilityChecker.cpp index 344266a1250c..0d80a510f8aa 100644 --- a/libyul/CompilabilityChecker.cpp +++ b/libyul/CompilabilityChecker.cpp @@ -59,14 +59,7 @@ map CompilabilityChecker::run( builtinContext, _optimizeStackAllocation ); - try - { - transform(*_object.code); - } - catch (StackTooDeepError const&) - { - yulAssert(!transform.stackErrors().empty(), "Got stack too deep exception that was not stored."); - } + transform(*_object.code); std::map functions; for (StackTooDeepError const& error: transform.stackErrors()) diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 327ce8895518..8c6f672ab72f 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -231,18 +231,12 @@ void CodeGenerator::assemble( _identifierAccess, _useNamedLabelsForFunctions ); - try - { - transform(_parsedData); - } - catch (StackTooDeepError const& _e) - { + transform(_parsedData); + if (!transform.stackErrors().empty()) assertThrow( false, langutil::StackTooDeepError, "Stack too deep when compiling inline assembly" + - (_e.comment() ? ": " + *_e.comment() : ".") + (transform.stackErrors().front().comment() ? ": " + *transform.stackErrors().front().comment() : ".") ); - } - yulAssert(transform.stackErrors().empty(), "Stack errors present but not thrown."); } diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 041e0038019c..0287f585d869 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -435,31 +435,24 @@ void CodeTransform::operator()(FunctionDefinition const& _function) m_context->functionExitPoints.push( CodeTransformContext::JumpInfo{m_assembly.newLabelId(), m_assembly.stackHeight()} ); - try - { - CodeTransform( - m_assembly, - m_info, - _function.body, - m_allowStackOpt, - m_dialect, - m_builtinContext, - m_evm15, - m_identifierAccess, - m_useNamedLabelsForFunctions, - m_context - )(_function.body); - } - catch (StackTooDeepError const& _error) + CodeTransform subTransform( + m_assembly, + m_info, + _function.body, + m_allowStackOpt, + m_dialect, + m_builtinContext, + m_evm15, + m_identifierAccess, + m_useNamedLabelsForFunctions, + m_context + ); + subTransform(_function.body); + for (auto& stackError: subTransform.m_stackErrors) { - // This exception will be re-thrown after the end of the surrounding block. - // It enables us to see which functions compiled successfully and which did not. - // Even if we emit actual code, add an illegal instruction to make sure that tests - // will catch it. - StackTooDeepError error(_error); - if (error.functionName.empty()) - error.functionName = _function.name; - stackError(std::move(error), static_cast(height)); + if (stackError.functionName.empty()) + stackError.functionName = _function.name; + m_stackErrors.emplace_back(std::move(stackError)); } m_assembly.appendLabel(m_context->functionExitPoints.top().label); @@ -605,9 +598,6 @@ void CodeTransform::operator()(Block const& _block) finalizeBlock(_block, blockStartStackHeight); m_scope = originalScope; - - if (!m_stackErrors.empty()) - BOOST_THROW_EXCEPTION(m_stackErrors.front()); } AbstractAssembly::LabelID CodeTransform::functionEntryID(YulString _name, Scope::Function const& _function) @@ -728,7 +718,8 @@ size_t CodeTransform::variableHeightDiff(Scope::Variable const& _var, YulString to_string(heightDiff - limit) + " slot(s) too deep inside the stack." ); - BOOST_THROW_EXCEPTION(m_stackErrors.back()); + // TODO: maybe make this return something special that results in producing INVALID instead. + return _forSwap ? 2 : 1; } return heightDiff; } diff --git a/libyul/backends/evm/EVMObjectCompiler.cpp b/libyul/backends/evm/EVMObjectCompiler.cpp index 6463b4a46ca6..685ca517eb08 100644 --- a/libyul/backends/evm/EVMObjectCompiler.cpp +++ b/libyul/backends/evm/EVMObjectCompiler.cpp @@ -59,5 +59,6 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize) // which should be native to this part of the code. CodeTransform transform{m_assembly, *_object.analysisInfo, *_object.code, m_dialect, context, _optimize, m_evm15}; transform(*_object.code); - yulAssert(transform.stackErrors().empty(), "Stack errors present but not thrown."); + if (!transform.stackErrors().empty()) + BOOST_THROW_EXCEPTION(transform.stackErrors().front()); } diff --git a/test/libyul/CompilabilityChecker.cpp b/test/libyul/CompilabilityChecker.cpp index 51aefc6107f5..ad1a6fd5eade 100644 --- a/test/libyul/CompilabilityChecker.cpp +++ b/test/libyul/CompilabilityChecker.cpp @@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(nested) x := add(add(add(add(add(add(add(add(add(add(add(add(x, r12), r11), r10), r9), r8), r7), r6), r5), r4), r3), r2), r1) } })"); - BOOST_CHECK_EQUAL(out, "h: 9 "); + BOOST_CHECK_EQUAL(out, "h: 9 g: 5 f: 5 "); } BOOST_AUTO_TEST_CASE(also_in_outer_block) @@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(also_in_outer_block) function g(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19) -> w, v { } })"); - BOOST_CHECK_EQUAL(out, ": 9 "); + BOOST_CHECK_EQUAL(out, "g: 5 : 9 "); } BOOST_AUTO_TEST_SUITE_END() From 92cd1ddb7d6c39965101e8638440832f7e4a6bea Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 15 Jul 2020 11:32:34 +0200 Subject: [PATCH 400/479] Add markAsInvalid to the various assemblies. --- libevmasm/Assembly.cpp | 1 + libevmasm/Assembly.h | 4 ++++ libyul/backends/evm/AbstractAssembly.h | 3 +++ libyul/backends/evm/AsmCodeGen.cpp | 5 +++++ libyul/backends/evm/AsmCodeGen.h | 2 ++ libyul/backends/evm/EVMAssembly.cpp | 1 + libyul/backends/evm/EVMAssembly.h | 3 +++ libyul/backends/evm/EVMCodeTransform.cpp | 15 ++++++++++----- libyul/backends/evm/NoOutputAssembly.h | 2 ++ 9 files changed, 31 insertions(+), 5 deletions(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 8588832fe429..d70ef9fed0ed 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -521,6 +521,7 @@ map Assembly::optimiseInternal( LinkerObject const& Assembly::assemble() const { + assertThrow(!m_invalid, AssemblyException, "Attempted to assemble invalid Assembly object."); // Return the already assembled object, if present. if (!m_assembledObject.bytecode.empty()) return m_assembledObject; diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index e82fee7ddda4..3b8c7e3a82d1 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -142,6 +142,9 @@ class Assembly std::map const& _sourceIndices = std::map() ) const; + /// Mark this assembly as invalid. Calling ``assemble`` on it will throw. + void markAsInvalid() { m_invalid = true; } + protected: /// Does the same operations as @a optimise, but should only be applied to a sub and /// returns the replaced tags. Also takes an argument containing the tags of this assembly @@ -161,6 +164,7 @@ class Assembly ); static std::string toStringInHex(u256 _value); + bool m_invalid = false; protected: /// 0 is reserved for exception unsigned m_usedTags = 1; diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index 42622272cd87..d138968ba576 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -111,6 +111,9 @@ class AbstractAssembly virtual void appendImmutable(std::string const& _identifier) = 0; /// Appends an assignment to an immutable variable. virtual void appendImmutableAssignment(std::string const& _identifier) = 0; + + /// Mark this assembly as invalid. Any attempt to request bytecode from it should throw. + virtual void markAsInvalid() = 0; }; enum class IdentifierContext { LValue, RValue, VariableDeclaration }; diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 8c6f672ab72f..8e245f99d633 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -182,6 +182,11 @@ void EthAssemblyAdapter::appendImmutableAssignment(std::string const& _identifie m_assembly.appendImmutableAssignment(_identifier); } +void EthAssemblyAdapter::markAsInvalid() +{ + m_assembly.markAsInvalid(); +} + EthAssemblyAdapter::LabelID EthAssemblyAdapter::assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag) { u256 id = _tag.data(); diff --git a/libyul/backends/evm/AsmCodeGen.h b/libyul/backends/evm/AsmCodeGen.h index 6ff02009c6b9..4933fbfd22f5 100644 --- a/libyul/backends/evm/AsmCodeGen.h +++ b/libyul/backends/evm/AsmCodeGen.h @@ -64,6 +64,8 @@ class EthAssemblyAdapter: public AbstractAssembly void appendImmutable(std::string const& _identifier) override; void appendImmutableAssignment(std::string const& _identifier) override; + void markAsInvalid() override; + private: static LabelID assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag); void appendJumpInstruction(evmasm::Instruction _instruction, JumpType _jumpType); diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index 7cf3d0662c1a..0158e7bfa7eb 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -156,6 +156,7 @@ void EVMAssembly::appendReturnsub(int _returns, int _stackDiffAfter) evmasm::LinkerObject EVMAssembly::finalize() { + yulAssert(!m_invalid, "Attempted to finalize invalid assembly object."); size_t bytecodeSize = m_bytecode.size(); for (auto const& ref: m_assemblySizePositions) updateReference(ref, assemblySizeReferenceSize, u256(bytecodeSize)); diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index 9ee974bbb890..858ae3def8c3 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -86,6 +86,8 @@ class EVMAssembly: public AbstractAssembly void appendImmutable(std::string const& _identifier) override; void appendImmutableAssignment(std::string const& _identifier) override; + void markAsInvalid() override { m_invalid = true; } + /// Resolves references inside the bytecode and returns the linker object. evmasm::LinkerObject finalize(); @@ -102,6 +104,7 @@ class EVMAssembly: public AbstractAssembly std::map m_labelPositions; std::map m_labelReferences; std::vector m_assemblySizePositions; + bool m_invalid = false; }; } diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 0287f585d869..df8fb934374d 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -237,6 +237,7 @@ void CodeTransform::stackError(StackTooDeepError _error, int _targetStackHeight) m_assembly.appendConstant(u256(0)); // Store error. m_stackErrors.emplace_back(std::move(_error)); + m_assembly.markAsInvalid(); } void CodeTransform::operator()(Assignment const& _assignment) @@ -448,11 +449,15 @@ void CodeTransform::operator()(FunctionDefinition const& _function) m_context ); subTransform(_function.body); - for (auto& stackError: subTransform.m_stackErrors) + if (!subTransform.m_stackErrors.empty()) { - if (stackError.functionName.empty()) - stackError.functionName = _function.name; - m_stackErrors.emplace_back(std::move(stackError)); + m_assembly.markAsInvalid(); + for (StackTooDeepError& stackError: subTransform.m_stackErrors) + { + if (stackError.functionName.empty()) + stackError.functionName = _function.name; + m_stackErrors.emplace_back(std::move(stackError)); + } } m_assembly.appendLabel(m_context->functionExitPoints.top().label); @@ -718,7 +723,7 @@ size_t CodeTransform::variableHeightDiff(Scope::Variable const& _var, YulString to_string(heightDiff - limit) + " slot(s) too deep inside the stack." ); - // TODO: maybe make this return something special that results in producing INVALID instead. + m_assembly.markAsInvalid(); return _forSwap ? 2 : 1; } return heightDiff; diff --git a/libyul/backends/evm/NoOutputAssembly.h b/libyul/backends/evm/NoOutputAssembly.h index ec7e5f2ecead..a5bcecd2cf62 100644 --- a/libyul/backends/evm/NoOutputAssembly.h +++ b/libyul/backends/evm/NoOutputAssembly.h @@ -74,6 +74,8 @@ class NoOutputAssembly: public AbstractAssembly void appendImmutable(std::string const& _identifier) override; void appendImmutableAssignment(std::string const& _identifier) override; + void markAsInvalid() override {} + private: bool m_evm15 = false; ///< if true, switch to evm1.5 mode int m_stackHeight = 0; From 672633af0adc369aea4394464e2d8fa3519a37de Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 16 Jul 2020 16:47:36 +0200 Subject: [PATCH 401/479] [SMTChecker] Fix ICE on compound assignment to array index --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 6 +++++- .../operators/compound_bitwise_or_1.sol | 11 ++++------- .../operators/compound_bitwise_or_2.sol | 10 ++++++++++ .../operators/compound_bitwise_or_3.sol | 16 ++++++++++++++++ .../operators/compound_bitwise_or_4.sol | 17 +++++++++++++++++ 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_2.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_3.sol create mode 100644 test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_4.sol diff --git a/Changelog.md b/Changelog.md index 0f0e533b9077..46c02667e163 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Compiler Features: Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. + * SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches. * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. * Code Generator: Avoid double cleanup when copying to memory. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 6a403051168a..ac87bade1067 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -363,8 +363,12 @@ void SMTEncoder::endVisit(Assignment const& _assignment) Token op = _assignment.assignmentOperator(); if (op != Token::Assign && !compoundOps.count(op)) { + Expression const* identifier = &_assignment.leftHandSide(); + if (auto const* indexAccess = dynamic_cast(identifier)) + identifier = leftmostBase(*indexAccess); // Give it a new index anyway to keep the SSA scheme sound. - if (auto varDecl = identifierToVariable(_assignment.leftHandSide())) + solAssert(identifier, ""); + if (auto varDecl = identifierToVariable(*identifier)) m_context.newValue(*varDecl); m_errorReporter.warning( diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol index a17f2f466efc..24e61cf58315 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_1.sol @@ -1,13 +1,10 @@ pragma experimental SMTChecker; - contract C { - function f(bool b) public pure { - uint v = 0; + int[1] c; + function f(bool b) public { if (b) - v |= 1; - assert(v == 1); + c[0] |= 1; } } // ---- -// Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning 4661: (116-130): Assertion violation happens here +// Warning 9149: (97-106): Assertion checker does not yet implement this assignment operator. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_2.sol new file mode 100644 index 000000000000..4569afa88325 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_2.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; +contract C { + int[1][20] c; + function f(bool b) public { + if (b) + c[10][0] |= 1; + } +} +// ---- +// Warning 9149: (101-114): Assertion checker does not yet implement this assignment operator. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_3.sol new file mode 100644 index 000000000000..617ae7af3b9a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_3.sol @@ -0,0 +1,16 @@ +pragma experimental SMTChecker; +contract C { + struct S { + uint x; + } + S s; + function f(bool b) public { + if (b) + s.x |= 1; + } +} +// ---- +// Warning 8115: (71-74): Assertion checker does not yet support the type of this variable. +// Warning 7650: (117-120): Assertion checker does not yet support this expression. +// Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9149: (117-125): Assertion checker does not yet implement this assignment operator. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_4.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_4.sol new file mode 100644 index 000000000000..091f0ca0d8e9 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_or_4.sol @@ -0,0 +1,17 @@ +pragma experimental SMTChecker; +contract C { + struct S { + uint[] x; + } + S s; + function f(bool b) public { + if (b) + s.x[2] |= 1; + } +} +// ---- +// Warning 8115: (73-76): Assertion checker does not yet support the type of this variable. +// Warning 7650: (119-122): Assertion checker does not yet support this expression. +// Warning 8364: (119-120): Assertion checker does not yet implement type struct C.S storage ref +// Warning 9118: (119-125): Assertion checker does not yet implement this expression. +// Warning 9149: (119-130): Assertion checker does not yet implement this assignment operator. From dfffecfe2ccf5779f91d571c1de9161d1ffb1c3e Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 6 Jul 2020 16:36:06 +0200 Subject: [PATCH 402/479] Allow overrides to have a more strict mutability than super --- Changelog.md | 1 + docs/contracts/inheritance.rst | 14 +++++++---- libsolidity/analysis/OverrideChecker.cpp | 8 ++++++- .../inheritance/override/add_view.sol | 4 +--- .../override_less_strict_mutability.sol | 24 +++++++++++++++++++ .../override/override_stricter_mutability.sol | 16 +++++++++++++ .../override_stricter_mutability1.sol | 8 +++++++ .../override_stricter_mutability2.sol | 7 ++++++ .../override_stricter_mutability3.sol | 7 ++++++ .../override_stricter_mutability4.sol | 8 +++++++ .../override_stricter_mutability5.sol | 8 +++++++ .../override_stricter_mutability6.sol | 8 +++++++ .../override_stricter_mutability7.sol | 8 +++++++ 13 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_less_strict_mutability.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability1.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability2.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability3.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability4.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability5.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability6.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability7.sol diff --git a/Changelog.md b/Changelog.md index e45646c91c97..e65ed4322640 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ Breaking changes: Language Features: * Yul: Disallow EVM instruction `pc()`. * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. + * Inheritance: Allow overrides to have stricter state mutability: ``view`` can override ``nonpayable`` and ``pure`` can override ``view``. Compiler Features: diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index e03ac397c309..343604a345a3 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -203,23 +203,29 @@ Function Overriding Base functions can be overridden by inheriting contracts to change their behavior if they are marked as ``virtual``. The overriding function must then -use the ``override`` keyword in the function header as shown in this example: +use the ``override`` keyword in the function header. +The overriding function may only change the visibility of the overridden function from ``external`` to ``public``. +The mutability may be changed to a more strict one following the order: +``nonpayable`` can be overridden by ``view`` and ``pure``. ``view`` can be overridden by ``pure``. +``payable`` is an exception and cannot be changed to any other mutability. + +The following example demonstrates changing mutability and visibility: :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.8.0; + pragma solidity >0.6.99 <0.8.0; contract Base { - function foo() virtual public {} + function foo() virtual external view {} } contract Middle is Base {} contract Inherited is Middle { - function foo() public override {} + function foo() override public pure {} } For multiple inheritance, the most derived base contracts that define the same diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 6a2ccc83aa41..c58fd2c8500a 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -587,7 +587,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr // This is only relevant for a function overriding a function. if (_overriding.isFunction()) { - if (_overriding.stateMutability() != _super.stateMutability()) + // Stricter mutability is always okay except when super is Payable + if (( + _overriding.stateMutability() > _super.stateMutability() || + _super.stateMutability() == StateMutability::Payable + ) && + _overriding.stateMutability() != _super.stateMutability() + ) overrideError( _overriding, _super, diff --git a/test/libsolidity/syntaxTests/inheritance/override/add_view.sol b/test/libsolidity/syntaxTests/inheritance/override/add_view.sol index 14c6297c3ed7..508678514f04 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/add_view.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/add_view.sol @@ -1,5 +1,3 @@ contract B { function f() virtual public {} } -contract C is B { function f() public view {} } +contract C is B { function f() override public view {} } // ---- -// TypeError 9456: (64-91): Overriding function is missing "override" specifier. -// TypeError 6959: (64-91): Overriding function changes state mutability from "nonpayable" to "view". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_less_strict_mutability.sol b/test/libsolidity/syntaxTests/inheritance/override/override_less_strict_mutability.sol new file mode 100644 index 000000000000..4bf72532c3fd --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_less_strict_mutability.sol @@ -0,0 +1,24 @@ +contract A { + function foo() external pure virtual returns (uint256) {} +} +contract B is A { + function foo() external pure override virtual returns (uint256) {} +} +contract C is A { + function foo() external view override virtual returns (uint256) {} +} +contract D is B, C { + function foo() external override(B, C) virtual returns (uint256) {} +} +contract E is C, B { + function foo() external pure override(B, C) virtual returns (uint256) {} +} +contract F is C, B { + function foo() external payable override(B, C) virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (181-247): Overriding function changes state mutability from "pure" to "view". +// TypeError 6959: (272-339): Overriding function changes state mutability from "pure" to "nonpayable". +// TypeError 6959: (272-339): Overriding function changes state mutability from "view" to "nonpayable". +// TypeError 6959: (461-536): Overriding function changes state mutability from "view" to "payable". +// TypeError 6959: (461-536): Overriding function changes state mutability from "pure" to "payable". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability.sol new file mode 100644 index 000000000000..3c09e5722f34 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability.sol @@ -0,0 +1,16 @@ +contract A { + function foo() internal view virtual returns (uint256) {} +} +contract B is A { + function foo() internal pure override virtual returns (uint256) {} +} +contract C is A { + function foo() internal view override virtual returns (uint256) {} +} +contract D is B, C { + function foo() internal pure override(B, C) virtual returns (uint256) {} +} +contract E is C, B { + function foo() internal pure override(B, C) virtual returns (uint256) {} +} +// ---- diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability1.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability1.sol new file mode 100644 index 000000000000..959774a7b9ff --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability1.sol @@ -0,0 +1,8 @@ +contract A { + function foo() public payable virtual returns (uint256) {} +} +contract B is A { + function foo() public override virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (94-153): Overriding function changes state mutability from "payable" to "nonpayable". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability2.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability2.sol new file mode 100644 index 000000000000..7e62c2023c43 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability2.sol @@ -0,0 +1,7 @@ +contract A { + function foo() internal virtual returns (uint256) {} +} +contract B is A { + function foo() internal view override virtual returns (uint256) {} +} +// ---- diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability3.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability3.sol new file mode 100644 index 000000000000..e1117f2b2b91 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability3.sol @@ -0,0 +1,7 @@ +contract A { + function foo() internal view virtual returns (uint256) {} +} +contract B is A { + function foo() internal pure override virtual returns (uint256) {} +} +// ---- diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability4.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability4.sol new file mode 100644 index 000000000000..da539d6df0f2 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability4.sol @@ -0,0 +1,8 @@ +contract A { + function foo() public payable virtual returns (uint256) {} +} +contract B is A { + function foo() public view override virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (94-158): Overriding function changes state mutability from "payable" to "view". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability5.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability5.sol new file mode 100644 index 000000000000..2c11faed9a01 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability5.sol @@ -0,0 +1,8 @@ +contract A { + function foo() public payable virtual returns (uint256) {} +} +contract B is A { + function foo() public pure override virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (94-158): Overriding function changes state mutability from "payable" to "pure". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability6.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability6.sol new file mode 100644 index 000000000000..8947c357afc7 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability6.sol @@ -0,0 +1,8 @@ +contract A { + function foo() public virtual returns (uint256) {} +} +contract B is A { + function foo() public payable override virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (86-153): Overriding function changes state mutability from "nonpayable" to "payable". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability7.sol b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability7.sol new file mode 100644 index 000000000000..c0965660891a --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/override_stricter_mutability7.sol @@ -0,0 +1,8 @@ +contract A { + function foo() public view virtual returns (uint256) {} +} +contract B is A { + function foo() public payable override virtual returns (uint256) {} +} +// ---- +// TypeError 6959: (91-158): Overriding function changes state mutability from "view" to "payable". From 2e1067a05ac5ab672f56fc51abac0d28a61195ff Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 17 Jul 2020 10:49:36 +0200 Subject: [PATCH 403/479] Set type properly for event parameters --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 2 +- .../smtCheckerTests/types/event_with_rational_size_array.sol | 2 ++ .../syntaxTests/types/event_with_rational_size_array.sol | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol create mode 100644 test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol diff --git a/Changelog.md b/Changelog.md index 46c02667e163..e0987a9195b9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Compiler Features: Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches. + * SMTChecker: Fix error in events with indices of type static array. * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. * Code Generator: Avoid double cleanup when copying to memory. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 94d9544df6e9..a81520b05d6a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -664,7 +664,7 @@ bool TypeChecker::visit(EventDefinition const& _eventDef) m_errorReporter.typeError(8598_error, _eventDef.location(), "More than 4 indexed arguments for anonymous event."); else if (!_eventDef.isAnonymous() && numIndexed > 3) m_errorReporter.typeError(7249_error, _eventDef.location(), "More than 3 indexed arguments for event."); - return false; + return true; } void TypeChecker::endVisit(FunctionTypeName const& _funType) diff --git a/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol b/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol new file mode 100644 index 000000000000..98dfcec33112 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol @@ -0,0 +1,2 @@ +pragma experimental SMTChecker; +contract a { event b(uint[(1 / 1)]); } diff --git a/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol b/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol new file mode 100644 index 000000000000..d0846345a445 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol @@ -0,0 +1 @@ +contract a { event b(uint[(1 / 1)]); } From b7adb2aa424cdec2ff0d51042dcf5aa7cadb3e3e Mon Sep 17 00:00:00 2001 From: Sachin Grover Date: Fri, 17 Jul 2020 20:24:12 +0530 Subject: [PATCH 404/479] Add SPDX license identifier if not present already in source file Fixes: #9220 --- libevmasm/Assembly.cpp | 1 + libevmasm/Assembly.h | 1 + libevmasm/AssemblyItem.cpp | 1 + libevmasm/AssemblyItem.h | 1 + libevmasm/BlockDeduplicator.cpp | 1 + libevmasm/BlockDeduplicator.h | 1 + libevmasm/CommonSubexpressionEliminator.cpp | 1 + libevmasm/CommonSubexpressionEliminator.h | 1 + libevmasm/ConstantOptimiser.cpp | 1 + libevmasm/ConstantOptimiser.h | 1 + libevmasm/ControlFlowGraph.cpp | 1 + libevmasm/ControlFlowGraph.h | 1 + libevmasm/Exceptions.h | 1 + libevmasm/ExpressionClasses.cpp | 1 + libevmasm/ExpressionClasses.h | 1 + libevmasm/GasMeter.cpp | 1 + libevmasm/GasMeter.h | 1 + libevmasm/Instruction.cpp | 1 + libevmasm/Instruction.h | 1 + libevmasm/JumpdestRemover.cpp | 1 + libevmasm/JumpdestRemover.h | 1 + libevmasm/KnownState.cpp | 1 + libevmasm/KnownState.h | 1 + libevmasm/LinkerObject.cpp | 1 + libevmasm/LinkerObject.h | 1 + libevmasm/PathGasMeter.cpp | 1 + libevmasm/PathGasMeter.h | 1 + libevmasm/PeepholeOptimiser.cpp | 1 + libevmasm/PeepholeOptimiser.h | 1 + libevmasm/RuleList.h | 1 + libevmasm/SemanticInformation.cpp | 1 + libevmasm/SemanticInformation.h | 1 + libevmasm/SimplificationRule.h | 1 + libevmasm/SimplificationRules.cpp | 1 + libevmasm/SimplificationRules.h | 1 + liblangutil/EVMVersion.cpp | 1 + liblangutil/EVMVersion.h | 1 + liblangutil/ErrorReporter.cpp | 1 + liblangutil/ErrorReporter.h | 1 + liblangutil/Exceptions.cpp | 1 + liblangutil/Exceptions.h | 1 + liblangutil/ParserBase.cpp | 1 + liblangutil/ParserBase.h | 1 + liblangutil/SemVerHandler.cpp | 1 + liblangutil/SemVerHandler.h | 1 + liblangutil/SourceLocation.cpp | 1 + liblangutil/SourceLocation.h | 1 + liblangutil/SourceReferenceExtractor.cpp | 1 + liblangutil/SourceReferenceExtractor.h | 1 + liblangutil/SourceReferenceFormatter.cpp | 1 + liblangutil/SourceReferenceFormatter.h | 1 + liblangutil/SourceReferenceFormatterHuman.cpp | 1 + liblangutil/SourceReferenceFormatterHuman.h | 1 + liblangutil/UndefMacros.h | 1 + libsmtutil/CHCSmtLib2Interface.cpp | 1 + libsmtutil/CHCSmtLib2Interface.h | 1 + libsmtutil/CHCSolverInterface.h | 1 + libsmtutil/CVC4Interface.cpp | 1 + libsmtutil/CVC4Interface.h | 1 + libsmtutil/Exceptions.h | 1 + libsmtutil/SMTLib2Interface.cpp | 1 + libsmtutil/SMTLib2Interface.h | 1 + libsmtutil/SMTPortfolio.cpp | 1 + libsmtutil/SMTPortfolio.h | 1 + libsmtutil/SolverInterface.h | 1 + libsmtutil/Sorts.cpp | 1 + libsmtutil/Sorts.h | 1 + libsmtutil/Z3CHCInterface.cpp | 1 + libsmtutil/Z3CHCInterface.h | 1 + libsmtutil/Z3Interface.cpp | 1 + libsmtutil/Z3Interface.h | 1 + libsolc/libsolc.cpp | 1 + libsolc/libsolc.h | 1 + libsolidity/analysis/ConstantEvaluator.cpp | 1 + libsolidity/analysis/ConstantEvaluator.h | 1 + libsolidity/analysis/ContractLevelChecker.cpp | 1 + libsolidity/analysis/ContractLevelChecker.h | 1 + libsolidity/analysis/ControlFlowAnalyzer.cpp | 1 + libsolidity/analysis/ControlFlowAnalyzer.h | 1 + libsolidity/analysis/ControlFlowBuilder.cpp | 1 + libsolidity/analysis/ControlFlowBuilder.h | 1 + libsolidity/analysis/ControlFlowGraph.cpp | 1 + libsolidity/analysis/ControlFlowGraph.h | 1 + libsolidity/analysis/DeclarationContainer.cpp | 1 + libsolidity/analysis/DeclarationContainer.h | 1 + libsolidity/analysis/DeclarationTypeChecker.cpp | 1 + libsolidity/analysis/DeclarationTypeChecker.h | 1 + libsolidity/analysis/DocStringAnalyser.cpp | 1 + libsolidity/analysis/DocStringAnalyser.h | 1 + libsolidity/analysis/GlobalContext.cpp | 1 + libsolidity/analysis/GlobalContext.h | 1 + libsolidity/analysis/ImmutableValidator.cpp | 1 + libsolidity/analysis/ImmutableValidator.h | 1 + libsolidity/analysis/NameAndTypeResolver.cpp | 1 + libsolidity/analysis/NameAndTypeResolver.h | 1 + libsolidity/analysis/OverrideChecker.cpp | 1 + libsolidity/analysis/OverrideChecker.h | 1 + libsolidity/analysis/PostTypeChecker.cpp | 1 + libsolidity/analysis/PostTypeChecker.h | 1 + libsolidity/analysis/ReferencesResolver.cpp | 1 + libsolidity/analysis/ReferencesResolver.h | 1 + libsolidity/analysis/StaticAnalyzer.cpp | 1 + libsolidity/analysis/StaticAnalyzer.h | 1 + libsolidity/analysis/SyntaxChecker.cpp | 1 + libsolidity/analysis/SyntaxChecker.h | 1 + libsolidity/analysis/TypeChecker.cpp | 1 + libsolidity/analysis/TypeChecker.h | 1 + libsolidity/analysis/ViewPureChecker.cpp | 1 + libsolidity/analysis/ViewPureChecker.h | 1 + libsolidity/ast/AST.cpp | 1 + libsolidity/ast/AST.h | 1 + libsolidity/ast/ASTAnnotations.cpp | 1 + libsolidity/ast/ASTAnnotations.h | 1 + libsolidity/ast/ASTEnums.h | 1 + libsolidity/ast/ASTForward.h | 1 + libsolidity/ast/ASTJsonConverter.cpp | 1 + libsolidity/ast/ASTJsonConverter.h | 1 + libsolidity/ast/ASTJsonImporter.cpp | 1 + libsolidity/ast/ASTJsonImporter.h | 1 + libsolidity/ast/ASTUtils.cpp | 1 + libsolidity/ast/ASTUtils.h | 1 + libsolidity/ast/ASTVisitor.h | 1 + libsolidity/ast/AST_accept.h | 1 + libsolidity/ast/AsmJsonImporter.cpp | 1 + libsolidity/ast/AsmJsonImporter.h | 1 + libsolidity/ast/ExperimentalFeatures.h | 1 + libsolidity/ast/TypeProvider.cpp | 1 + libsolidity/ast/TypeProvider.h | 1 + libsolidity/ast/Types.cpp | 1 + libsolidity/ast/Types.h | 1 + libsolidity/codegen/ABIFunctions.cpp | 1 + libsolidity/codegen/ABIFunctions.h | 1 + libsolidity/codegen/ArrayUtils.cpp | 1 + libsolidity/codegen/ArrayUtils.h | 1 + libsolidity/codegen/Compiler.cpp | 1 + libsolidity/codegen/Compiler.h | 1 + libsolidity/codegen/CompilerContext.cpp | 1 + libsolidity/codegen/CompilerContext.h | 1 + libsolidity/codegen/CompilerUtils.cpp | 1 + libsolidity/codegen/CompilerUtils.h | 1 + libsolidity/codegen/ContractCompiler.cpp | 1 + libsolidity/codegen/ContractCompiler.h | 1 + libsolidity/codegen/ExpressionCompiler.cpp | 1 + libsolidity/codegen/ExpressionCompiler.h | 1 + libsolidity/codegen/LValue.cpp | 1 + libsolidity/codegen/LValue.h | 1 + libsolidity/codegen/MultiUseYulFunctionCollector.cpp | 1 + libsolidity/codegen/MultiUseYulFunctionCollector.h | 1 + libsolidity/codegen/ReturnInfo.cpp | 1 + libsolidity/codegen/ReturnInfo.h | 1 + libsolidity/codegen/YulUtilFunctions.cpp | 1 + libsolidity/codegen/YulUtilFunctions.h | 1 + libsolidity/codegen/ir/Common.cpp | 1 + libsolidity/codegen/ir/Common.h | 1 + libsolidity/codegen/ir/IRGenerationContext.cpp | 1 + libsolidity/codegen/ir/IRGenerationContext.h | 1 + libsolidity/codegen/ir/IRGenerator.cpp | 1 + libsolidity/codegen/ir/IRGenerator.h | 1 + libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 1 + libsolidity/codegen/ir/IRGeneratorForStatements.h | 1 + libsolidity/codegen/ir/IRLValue.h | 1 + libsolidity/codegen/ir/IRVariable.cpp | 1 + libsolidity/codegen/ir/IRVariable.h | 1 + libsolidity/formal/BMC.cpp | 1 + libsolidity/formal/BMC.h | 1 + libsolidity/formal/CHC.cpp | 1 + libsolidity/formal/CHC.h | 1 + libsolidity/formal/EncodingContext.cpp | 1 + libsolidity/formal/EncodingContext.h | 1 + libsolidity/formal/ModelChecker.cpp | 1 + libsolidity/formal/ModelChecker.h | 1 + libsolidity/formal/SMTEncoder.cpp | 1 + libsolidity/formal/SMTEncoder.h | 1 + libsolidity/formal/SSAVariable.cpp | 1 + libsolidity/formal/SSAVariable.h | 1 + libsolidity/formal/SymbolicState.cpp | 1 + libsolidity/formal/SymbolicState.h | 1 + libsolidity/formal/SymbolicTypes.cpp | 1 + libsolidity/formal/SymbolicTypes.h | 1 + libsolidity/formal/SymbolicVariables.cpp | 1 + libsolidity/formal/SymbolicVariables.h | 1 + libsolidity/formal/VariableUsage.cpp | 1 + libsolidity/formal/VariableUsage.h | 1 + libsolidity/interface/ABI.cpp | 1 + libsolidity/interface/ABI.h | 1 + libsolidity/interface/CompilerStack.cpp | 1 + libsolidity/interface/CompilerStack.h | 1 + libsolidity/interface/DebugSettings.h | 1 + libsolidity/interface/GasEstimator.cpp | 1 + libsolidity/interface/GasEstimator.h | 1 + libsolidity/interface/Natspec.cpp | 1 + libsolidity/interface/Natspec.h | 1 + libsolidity/interface/OptimiserSettings.h | 1 + libsolidity/interface/ReadFile.h | 1 + libsolidity/interface/StandardCompiler.cpp | 1 + libsolidity/interface/StandardCompiler.h | 1 + libsolidity/interface/StorageLayout.cpp | 1 + libsolidity/interface/StorageLayout.h | 1 + libsolidity/interface/Version.cpp | 1 + libsolidity/interface/Version.h | 1 + libsolidity/parsing/DocStringParser.cpp | 1 + libsolidity/parsing/DocStringParser.h | 1 + libsolidity/parsing/Parser.cpp | 1 + libsolidity/parsing/Parser.h | 1 + libsolidity/parsing/Token.h | 1 + libsolutil/Algorithms.h | 1 + libsolutil/AnsiColorized.h | 1 + libsolutil/Assertions.h | 1 + libsolutil/Common.h | 1 + libsolutil/CommonData.cpp | 1 + libsolutil/CommonData.h | 1 + libsolutil/CommonIO.cpp | 1 + libsolutil/CommonIO.h | 1 + libsolutil/Exceptions.cpp | 1 + libsolutil/Exceptions.h | 1 + libsolutil/FixedHash.h | 1 + libsolutil/IndentedWriter.cpp | 1 + libsolutil/IndentedWriter.h | 1 + libsolutil/InvertibleMap.h | 1 + libsolutil/IpfsHash.cpp | 1 + libsolutil/IpfsHash.h | 1 + libsolutil/JSON.cpp | 1 + libsolutil/JSON.h | 1 + libsolutil/Keccak256.cpp | 1 + libsolutil/Keccak256.h | 1 + libsolutil/LazyInit.h | 1 + libsolutil/Result.h | 1 + libsolutil/StringUtils.cpp | 1 + libsolutil/StringUtils.h | 1 + libsolutil/SwarmHash.cpp | 1 + libsolutil/SwarmHash.h | 1 + libsolutil/UTF8.cpp | 1 + libsolutil/UTF8.h | 1 + libsolutil/Visitor.h | 1 + libsolutil/Whiskers.cpp | 1 + libsolutil/Whiskers.h | 1 + libyul/AsmAnalysis.cpp | 1 + libyul/AsmAnalysis.h | 1 + libyul/AsmAnalysisInfo.h | 1 + libyul/AsmData.h | 1 + libyul/AsmDataForward.h | 1 + libyul/AsmJsonConverter.cpp | 1 + libyul/AsmJsonConverter.h | 1 + libyul/AsmParser.cpp | 1 + libyul/AsmParser.h | 1 + libyul/AsmPrinter.cpp | 1 + libyul/AsmPrinter.h | 1 + libyul/AsmScope.cpp | 1 + libyul/AsmScope.h | 1 + libyul/AsmScopeFiller.cpp | 1 + libyul/AsmScopeFiller.h | 1 + libyul/AssemblyStack.cpp | 1 + libyul/AssemblyStack.h | 1 + libyul/CompilabilityChecker.h | 1 + libyul/ControlFlowSideEffects.h | 1 + libyul/Dialect.cpp | 1 + libyul/Dialect.h | 1 + libyul/Exceptions.h | 1 + libyul/Object.cpp | 1 + libyul/Object.h | 1 + libyul/ObjectParser.cpp | 1 + libyul/ObjectParser.h | 1 + libyul/SideEffects.h | 1 + libyul/Utilities.cpp | 1 + libyul/Utilities.h | 1 + libyul/YulString.h | 1 + libyul/backends/evm/AbstractAssembly.h | 1 + libyul/backends/evm/AsmCodeGen.cpp | 1 + libyul/backends/evm/AsmCodeGen.h | 1 + libyul/backends/evm/ConstantOptimiser.cpp | 1 + libyul/backends/evm/ConstantOptimiser.h | 1 + libyul/backends/evm/EVMAssembly.cpp | 1 + libyul/backends/evm/EVMAssembly.h | 1 + libyul/backends/evm/EVMCodeTransform.cpp | 1 + libyul/backends/evm/EVMCodeTransform.h | 1 + libyul/backends/evm/EVMDialect.cpp | 1 + libyul/backends/evm/EVMDialect.h | 1 + libyul/backends/evm/EVMMetrics.cpp | 1 + libyul/backends/evm/EVMMetrics.h | 1 + libyul/backends/evm/EVMObjectCompiler.cpp | 1 + libyul/backends/evm/EVMObjectCompiler.h | 1 + libyul/backends/evm/NoOutputAssembly.cpp | 1 + libyul/backends/evm/NoOutputAssembly.h | 1 + libyul/backends/wasm/BinaryTransform.cpp | 1 + libyul/backends/wasm/BinaryTransform.h | 1 + libyul/backends/wasm/EVMToEwasmTranslator.cpp | 1 + libyul/backends/wasm/EVMToEwasmTranslator.h | 1 + libyul/backends/wasm/TextTransform.cpp | 1 + libyul/backends/wasm/TextTransform.h | 1 + libyul/backends/wasm/WasmAST.h | 1 + libyul/backends/wasm/WasmCodeTransform.cpp | 1 + libyul/backends/wasm/WasmCodeTransform.h | 1 + libyul/backends/wasm/WasmDialect.cpp | 1 + libyul/backends/wasm/WasmDialect.h | 1 + libyul/backends/wasm/WasmObjectCompiler.cpp | 1 + libyul/backends/wasm/WasmObjectCompiler.h | 1 + libyul/backends/wasm/WordSizeTransform.cpp | 1 + libyul/backends/wasm/WordSizeTransform.h | 1 + libyul/optimiser/ASTCopier.cpp | 1 + libyul/optimiser/ASTCopier.h | 1 + libyul/optimiser/ASTWalker.cpp | 1 + libyul/optimiser/ASTWalker.h | 1 + libyul/optimiser/BlockFlattener.cpp | 1 + libyul/optimiser/BlockFlattener.h | 1 + libyul/optimiser/BlockHasher.cpp | 1 + libyul/optimiser/BlockHasher.h | 1 + libyul/optimiser/CallGraphGenerator.cpp | 1 + libyul/optimiser/CallGraphGenerator.h | 1 + libyul/optimiser/CircularReferencesPruner.cpp | 1 + libyul/optimiser/CircularReferencesPruner.h | 1 + libyul/optimiser/CommonSubexpressionEliminator.h | 1 + libyul/optimiser/ConditionalSimplifier.cpp | 1 + libyul/optimiser/ConditionalSimplifier.h | 1 + libyul/optimiser/ConditionalUnsimplifier.cpp | 1 + libyul/optimiser/ConditionalUnsimplifier.h | 1 + libyul/optimiser/ControlFlowSimplifier.cpp | 1 + libyul/optimiser/ControlFlowSimplifier.h | 1 + libyul/optimiser/DataFlowAnalyzer.h | 1 + libyul/optimiser/DeadCodeEliminator.cpp | 1 + libyul/optimiser/DeadCodeEliminator.h | 1 + libyul/optimiser/Disambiguator.cpp | 1 + libyul/optimiser/Disambiguator.h | 1 + libyul/optimiser/EquivalentFunctionCombiner.cpp | 1 + libyul/optimiser/EquivalentFunctionCombiner.h | 1 + libyul/optimiser/EquivalentFunctionDetector.cpp | 1 + libyul/optimiser/EquivalentFunctionDetector.h | 1 + libyul/optimiser/ExpressionInliner.cpp | 1 + libyul/optimiser/ExpressionInliner.h | 1 + libyul/optimiser/ExpressionJoiner.cpp | 1 + libyul/optimiser/ExpressionJoiner.h | 1 + libyul/optimiser/ExpressionSimplifier.cpp | 1 + libyul/optimiser/ExpressionSimplifier.h | 1 + libyul/optimiser/ExpressionSplitter.cpp | 1 + libyul/optimiser/ExpressionSplitter.h | 1 + libyul/optimiser/ForLoopConditionIntoBody.cpp | 1 + libyul/optimiser/ForLoopConditionIntoBody.h | 1 + libyul/optimiser/ForLoopConditionOutOfBody.cpp | 1 + libyul/optimiser/ForLoopConditionOutOfBody.h | 1 + libyul/optimiser/ForLoopInitRewriter.cpp | 1 + libyul/optimiser/ForLoopInitRewriter.h | 1 + libyul/optimiser/FullInliner.cpp | 1 + libyul/optimiser/FullInliner.h | 1 + libyul/optimiser/FunctionGrouper.cpp | 1 + libyul/optimiser/FunctionGrouper.h | 1 + libyul/optimiser/FunctionHoister.cpp | 1 + libyul/optimiser/FunctionHoister.h | 1 + libyul/optimiser/InlinableExpressionFunctionFinder.cpp | 1 + libyul/optimiser/InlinableExpressionFunctionFinder.h | 1 + libyul/optimiser/KnowledgeBase.cpp | 1 + libyul/optimiser/KnowledgeBase.h | 1 + libyul/optimiser/LoadResolver.cpp | 1 + libyul/optimiser/LoadResolver.h | 1 + libyul/optimiser/LoopInvariantCodeMotion.cpp | 1 + libyul/optimiser/LoopInvariantCodeMotion.h | 1 + libyul/optimiser/MainFunction.cpp | 1 + libyul/optimiser/MainFunction.h | 1 + libyul/optimiser/Metrics.h | 1 + libyul/optimiser/NameCollector.cpp | 1 + libyul/optimiser/NameCollector.h | 1 + libyul/optimiser/NameDispenser.cpp | 1 + libyul/optimiser/NameDispenser.h | 1 + libyul/optimiser/NameDisplacer.cpp | 1 + libyul/optimiser/NameDisplacer.h | 1 + libyul/optimiser/OptimiserStep.h | 1 + libyul/optimiser/OptimizerUtilities.cpp | 1 + libyul/optimiser/OptimizerUtilities.h | 1 + libyul/optimiser/RedundantAssignEliminator.cpp | 1 + libyul/optimiser/RedundantAssignEliminator.h | 1 + libyul/optimiser/Rematerialiser.h | 1 + libyul/optimiser/SSAReverser.cpp | 1 + libyul/optimiser/SSAReverser.h | 1 + libyul/optimiser/SSATransform.cpp | 1 + libyul/optimiser/SSATransform.h | 1 + libyul/optimiser/SSAValueTracker.cpp | 1 + libyul/optimiser/SSAValueTracker.h | 1 + libyul/optimiser/Semantics.cpp | 1 + libyul/optimiser/Semantics.h | 1 + libyul/optimiser/SimplificationRules.cpp | 1 + libyul/optimiser/SimplificationRules.h | 1 + libyul/optimiser/StackCompressor.h | 1 + libyul/optimiser/StructuralSimplifier.cpp | 1 + libyul/optimiser/StructuralSimplifier.h | 1 + libyul/optimiser/Substitution.cpp | 1 + libyul/optimiser/Substitution.h | 1 + libyul/optimiser/Suite.cpp | 1 + libyul/optimiser/Suite.h | 1 + libyul/optimiser/SyntacticalEquality.h | 1 + libyul/optimiser/TypeInfo.cpp | 1 + libyul/optimiser/TypeInfo.h | 1 + libyul/optimiser/UnusedPruner.h | 1 + libyul/optimiser/VarDeclInitializer.cpp | 1 + libyul/optimiser/VarDeclInitializer.h | 1 + libyul/optimiser/VarNameCleaner.cpp | 1 + libyul/optimiser/VarNameCleaner.h | 1 + solc/CommandLineInterface.cpp | 1 + solc/CommandLineInterface.h | 1 + solc/main.cpp | 1 + test/Common.cpp | 1 + test/Common.h | 1 + test/CommonSyntaxTest.cpp | 1 + test/CommonSyntaxTest.h | 1 + test/EVMHost.cpp | 1 + test/EVMHost.h | 1 + test/ExecutionFramework.cpp | 1 + test/ExecutionFramework.h | 1 + test/InteractiveTests.h | 1 + test/Metadata.cpp | 1 + test/Metadata.h | 1 + test/TestCase.cpp | 1 + test/TestCase.h | 1 + test/TestCaseReader.cpp | 1 + test/TestCaseReader.h | 1 + test/boostTest.cpp | 1 + test/contracts/AuctionRegistrar.cpp | 1 + test/contracts/ContractInterface.h | 1 + test/contracts/FixedFeeRegistrar.cpp | 1 + test/contracts/Wallet.cpp | 1 + test/libevmasm/Assembler.cpp | 1 + test/libevmasm/Optimiser.cpp | 1 + test/liblangutil/CharStream.cpp | 1 + test/liblangutil/SourceLocation.cpp | 1 + test/libsolidity/ABIDecoderTests.cpp | 1 + test/libsolidity/ABIEncoderTests.cpp | 1 + test/libsolidity/ABIJsonTest.h | 1 + test/libsolidity/ABITestsCommon.h | 1 + test/libsolidity/ASTJSONTest.cpp | 1 + test/libsolidity/ASTJSONTest.h | 1 + test/libsolidity/AnalysisFramework.cpp | 1 + test/libsolidity/AnalysisFramework.h | 1 + test/libsolidity/Assembly.cpp | 1 + test/libsolidity/ErrorCheck.cpp | 1 + test/libsolidity/ErrorCheck.h | 1 + test/libsolidity/GasCosts.cpp | 1 + test/libsolidity/GasMeter.cpp | 1 + test/libsolidity/GasTest.cpp | 1 + test/libsolidity/GasTest.h | 1 + test/libsolidity/Imports.cpp | 1 + test/libsolidity/LibSolc.cpp | 1 + test/libsolidity/SMTCheckerJSONTest.cpp | 1 + test/libsolidity/SMTCheckerJSONTest.h | 1 + test/libsolidity/SMTCheckerTest.cpp | 1 + test/libsolidity/SMTCheckerTest.h | 1 + test/libsolidity/SemVerMatcher.cpp | 1 + test/libsolidity/SolidityEndToEndTest.cpp | 1 + test/libsolidity/SolidityExecutionFramework.cpp | 1 + test/libsolidity/SolidityExecutionFramework.h | 1 + test/libsolidity/SolidityExpressionCompiler.cpp | 1 + test/libsolidity/SolidityOptimizer.cpp | 1 + test/libsolidity/SolidityTypes.cpp | 1 + test/libsolidity/StandardCompiler.cpp | 1 + test/libsolidity/SyntaxTest.cpp | 1 + test/libsolidity/SyntaxTest.h | 1 + test/libsolidity/util/BytesUtils.cpp | 1 + test/libsolidity/util/ContractABIUtils.cpp | 1 + test/libsolidity/util/TestFileParser.cpp | 1 + test/libsolidity/util/TestFileParserTests.cpp | 1 + test/libsolidity/util/TestFunctionCallTests.cpp | 1 + test/libsolutil/Checksum.cpp | 1 + test/libsolutil/CommonData.cpp | 1 + test/libsolutil/IndentedWriter.cpp | 1 + test/libsolutil/IpfsHash.cpp | 1 + test/libsolutil/IterateReplacing.cpp | 1 + test/libsolutil/JSON.cpp | 1 + test/libsolutil/Keccak256.cpp | 1 + test/libsolutil/LazyInit.cpp | 1 + test/libsolutil/StringUtils.cpp | 1 + test/libsolutil/SwarmHash.cpp | 1 + test/libsolutil/UTF8.cpp | 1 + test/libsolutil/Whiskers.cpp | 1 + test/libyul/EwasmTranslationTest.cpp | 1 + test/libyul/EwasmTranslationTest.h | 1 + test/libyul/FunctionSideEffects.cpp | 1 + test/libyul/FunctionSideEffects.h | 1 + test/libyul/Inliner.cpp | 1 + test/libyul/ObjectCompilerTest.cpp | 1 + test/libyul/ObjectCompilerTest.h | 1 + test/libyul/SyntaxTest.cpp | 1 + test/libyul/SyntaxTest.h | 1 + test/libyul/YulInterpreterTest.cpp | 1 + test/libyul/YulInterpreterTest.h | 1 + test/libyul/YulOptimizerTest.cpp | 1 + test/libyul/YulOptimizerTest.h | 1 + test/tools/IsolTestOptions.cpp | 1 + test/tools/IsolTestOptions.h | 1 + test/tools/afl_fuzzer.cpp | 1 + test/tools/fuzzer_common.cpp | 1 + test/tools/fuzzer_common.h | 1 + test/tools/isoltest.cpp | 1 + test/tools/ossfuzz/abiV2Proto.proto | 1 + test/tools/ossfuzz/abiV2ProtoFuzzer.cpp | 1 + test/tools/ossfuzz/const_opt_ossfuzz.cpp | 1 + test/tools/ossfuzz/protoToSol.cpp | 1 + test/tools/ossfuzz/protoToSol.h | 1 + test/tools/ossfuzz/protoToYul.cpp | 1 + test/tools/ossfuzz/protoToYul.h | 1 + test/tools/ossfuzz/solProto.proto | 1 + test/tools/ossfuzz/solProtoFuzzer.cpp | 1 + test/tools/ossfuzz/solc_noopt_ossfuzz.cpp | 1 + test/tools/ossfuzz/solc_opt_ossfuzz.cpp | 1 + test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp | 1 + test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp | 1 + test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp | 1 + test/tools/ossfuzz/yulFuzzerCommon.cpp | 1 + test/tools/ossfuzz/yulFuzzerCommon.h | 1 + test/tools/ossfuzz/yulProto.proto | 1 + test/tools/ossfuzz/yulProtoFuzzer.cpp | 1 + test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp | 1 + test/tools/yulInterpreter/EVMInstructionInterpreter.cpp | 1 + test/tools/yulInterpreter/EVMInstructionInterpreter.h | 1 + test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp | 1 + test/tools/yulInterpreter/EwasmBuiltinInterpreter.h | 1 + test/tools/yulInterpreter/Interpreter.cpp | 1 + test/tools/yulInterpreter/Interpreter.h | 1 + test/tools/yulopti.cpp | 1 + test/tools/yulrun.cpp | 1 + test/yulPhaser/AlgorithmRunner.cpp | 1 + test/yulPhaser/Chromosome.cpp | 1 + test/yulPhaser/Common.cpp | 1 + test/yulPhaser/FitnessMetrics.cpp | 1 + test/yulPhaser/GeneticAlgorithms.cpp | 1 + test/yulPhaser/Mutations.cpp | 1 + test/yulPhaser/PairSelections.cpp | 1 + test/yulPhaser/Phaser.cpp | 1 + test/yulPhaser/Population.cpp | 1 + test/yulPhaser/Program.cpp | 1 + test/yulPhaser/ProgramCache.cpp | 1 + test/yulPhaser/Selections.cpp | 1 + test/yulPhaser/SimulationRNG.cpp | 1 + test/yulPhaser/TestHelpers.cpp | 1 + test/yulPhaser/TestHelpers.h | 1 + test/yulPhaser/TestHelpersTest.cpp | 1 + tools/solidityUpgrade/SourceTransform.h | 1 + tools/solidityUpgrade/SourceUpgrade.cpp | 1 + tools/solidityUpgrade/SourceUpgrade.h | 1 + tools/solidityUpgrade/Upgrade050.cpp | 1 + tools/solidityUpgrade/Upgrade050.h | 1 + tools/solidityUpgrade/Upgrade060.cpp | 1 + tools/solidityUpgrade/Upgrade060.h | 1 + tools/solidityUpgrade/UpgradeChange.cpp | 1 + tools/solidityUpgrade/UpgradeSuite.h | 1 + tools/solidityUpgrade/main.cpp | 1 + tools/yulPhaser/AlgorithmRunner.cpp | 1 + tools/yulPhaser/AlgorithmRunner.h | 1 + tools/yulPhaser/Chromosome.cpp | 1 + tools/yulPhaser/Chromosome.h | 1 + tools/yulPhaser/Common.cpp | 1 + tools/yulPhaser/Common.h | 1 + tools/yulPhaser/Exceptions.h | 1 + tools/yulPhaser/FitnessMetrics.cpp | 1 + tools/yulPhaser/FitnessMetrics.h | 1 + tools/yulPhaser/GeneticAlgorithms.cpp | 1 + tools/yulPhaser/GeneticAlgorithms.h | 1 + tools/yulPhaser/Mutations.cpp | 1 + tools/yulPhaser/Mutations.h | 1 + tools/yulPhaser/PairSelections.cpp | 1 + tools/yulPhaser/PairSelections.h | 1 + tools/yulPhaser/Phaser.cpp | 1 + tools/yulPhaser/Phaser.h | 1 + tools/yulPhaser/Population.cpp | 1 + tools/yulPhaser/Population.h | 1 + tools/yulPhaser/Program.cpp | 1 + tools/yulPhaser/Program.h | 1 + tools/yulPhaser/ProgramCache.cpp | 1 + tools/yulPhaser/ProgramCache.h | 1 + tools/yulPhaser/Selections.cpp | 1 + tools/yulPhaser/Selections.h | 1 + tools/yulPhaser/SimulationRNG.cpp | 1 + tools/yulPhaser/SimulationRNG.h | 1 + tools/yulPhaser/main.cpp | 1 + 569 files changed, 569 insertions(+) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 8588832fe429..70fc4565db77 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Assembly.cpp * @author Gav Wood * @date 2014 diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index e82fee7ddda4..dbd5e130e68d 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index b78c0e60c718..80d34f57caa6 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index 4b0b7ca722e5..dd65b109f4aa 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file AssemblyItem.h * @author Gav Wood * @date 2014 diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index 95aba2a01d86..5f9fa768ffde 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file BlockDeduplicator.cpp * @author Christian diff --git a/libevmasm/BlockDeduplicator.h b/libevmasm/BlockDeduplicator.h index ce12b4bfb951..ef131ae52afc 100644 --- a/libevmasm/BlockDeduplicator.h +++ b/libevmasm/BlockDeduplicator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file BlockDeduplicator.h * @author Christian diff --git a/libevmasm/CommonSubexpressionEliminator.cpp b/libevmasm/CommonSubexpressionEliminator.cpp index 7fa5c938bbc5..9d07e47caf0b 100644 --- a/libevmasm/CommonSubexpressionEliminator.cpp +++ b/libevmasm/CommonSubexpressionEliminator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file CommonSubexpressionEliminator.cpp * @author Christian diff --git a/libevmasm/CommonSubexpressionEliminator.h b/libevmasm/CommonSubexpressionEliminator.h index ce9c898ee4e0..88e559719320 100644 --- a/libevmasm/CommonSubexpressionEliminator.h +++ b/libevmasm/CommonSubexpressionEliminator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file CommonSubexpressionEliminator.h * @author Christian diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp index 018be38ea43d..87ef57089126 100644 --- a/libevmasm/ConstantOptimiser.cpp +++ b/libevmasm/ConstantOptimiser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file ConstantOptimiser.cpp * @author Christian * @date 2015 diff --git a/libevmasm/ConstantOptimiser.h b/libevmasm/ConstantOptimiser.h index a9db47ab1d19..aad0fd169bef 100644 --- a/libevmasm/ConstantOptimiser.h +++ b/libevmasm/ConstantOptimiser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file ConstantOptimiser.cpp * @author Christian * @date 2015 diff --git a/libevmasm/ControlFlowGraph.cpp b/libevmasm/ControlFlowGraph.cpp index 4c9d59c8b0a9..8431fb51c0af 100644 --- a/libevmasm/ControlFlowGraph.cpp +++ b/libevmasm/ControlFlowGraph.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file ControlFlowGraph.cpp * @author Christian diff --git a/libevmasm/ControlFlowGraph.h b/libevmasm/ControlFlowGraph.h index 5fceb6388440..d27702c2ac0b 100644 --- a/libevmasm/ControlFlowGraph.h +++ b/libevmasm/ControlFlowGraph.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file ControlFlowGraph.h * @author Christian diff --git a/libevmasm/Exceptions.h b/libevmasm/Exceptions.h index e4fadb53ce9c..02757757602e 100644 --- a/libevmasm/Exceptions.h +++ b/libevmasm/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Exceptions.h * @author Christian * @date 2014 diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp index a208fabe7dae..55a3a04c79c1 100644 --- a/libevmasm/ExpressionClasses.cpp +++ b/libevmasm/ExpressionClasses.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file ExpressionClasses.cpp * @author Christian diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h index f9eebabd086f..bfab317dcb80 100644 --- a/libevmasm/ExpressionClasses.h +++ b/libevmasm/ExpressionClasses.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file ExpressionClasses.h * @author Christian diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp index 6a07e9905e3c..eb259ba6286d 100644 --- a/libevmasm/GasMeter.cpp +++ b/libevmasm/GasMeter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libevmasm/GasMeter.h b/libevmasm/GasMeter.h index a6c0f29d9137..ddba491aad52 100644 --- a/libevmasm/GasMeter.h +++ b/libevmasm/GasMeter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file GasMeter.cpp * @author Christian * @date 2015 diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp index 0a61fbea041f..55af2340a386 100644 --- a/libevmasm/Instruction.cpp +++ b/libevmasm/Instruction.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Instruction.cpp * @author Gav Wood * @date 2014 diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h index 67a77f0c9a63..5c8eeb3ee5ff 100644 --- a/libevmasm/Instruction.h +++ b/libevmasm/Instruction.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Instruction.h * @author Gav Wood * @date 2014 diff --git a/libevmasm/JumpdestRemover.cpp b/libevmasm/JumpdestRemover.cpp index cbb498c01d85..c4901700fa5b 100644 --- a/libevmasm/JumpdestRemover.cpp +++ b/libevmasm/JumpdestRemover.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * Removes unused JUMPDESTs. diff --git a/libevmasm/JumpdestRemover.h b/libevmasm/JumpdestRemover.h index 80b546d79dd7..e07550e2dd40 100644 --- a/libevmasm/JumpdestRemover.h +++ b/libevmasm/JumpdestRemover.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * Removes unused JUMPDESTs. diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index 10e4a4f10fc3..ec6c50702014 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file KnownState.cpp * @author Christian diff --git a/libevmasm/KnownState.h b/libevmasm/KnownState.h index b19585036aac..458a48b3efcb 100644 --- a/libevmasm/KnownState.h +++ b/libevmasm/KnownState.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file KnownState.h * @author Christian diff --git a/libevmasm/LinkerObject.cpp b/libevmasm/LinkerObject.cpp index b7ffaac6682f..fdb9a460f2d0 100644 --- a/libevmasm/LinkerObject.cpp +++ b/libevmasm/LinkerObject.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file LinkerObject.cpp * @author Christian R * @date 2015 diff --git a/libevmasm/LinkerObject.h b/libevmasm/LinkerObject.h index ab0e26507261..03d01cc2c916 100644 --- a/libevmasm/LinkerObject.h +++ b/libevmasm/LinkerObject.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Assembly.h * @author Gav Wood * @date 2014 diff --git a/libevmasm/PathGasMeter.cpp b/libevmasm/PathGasMeter.cpp index 749cc7bb166d..b7c985f1bc80 100644 --- a/libevmasm/PathGasMeter.cpp +++ b/libevmasm/PathGasMeter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file PathGasMeter.cpp * @author Christian * @date 2015 diff --git a/libevmasm/PathGasMeter.h b/libevmasm/PathGasMeter.h index 38a1979734ac..ecac17cac2f8 100644 --- a/libevmasm/PathGasMeter.h +++ b/libevmasm/PathGasMeter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file PathGasMeter.cpp * @author Christian * @date 2015 diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 2b68198f8a34..6df80dac86a2 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file PeepholeOptimiser.cpp * Performs local optimising code changes to assembly. diff --git a/libevmasm/PeepholeOptimiser.h b/libevmasm/PeepholeOptimiser.h index a260d31481eb..64ad5227fae1 100644 --- a/libevmasm/PeepholeOptimiser.h +++ b/libevmasm/PeepholeOptimiser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file PeepholeOptimiser.h * Performs local optimising code changes to assembly. diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index 9442524b10d0..93ccdcaf96e0 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2018 * Templatized list of simplification rules. diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp index 76eeb59566f3..3d4ead64f384 100644 --- a/libevmasm/SemanticInformation.cpp +++ b/libevmasm/SemanticInformation.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file SemanticInformation.cpp * @author Christian diff --git a/libevmasm/SemanticInformation.h b/libevmasm/SemanticInformation.h index 39a1b2439418..f919b4207b4c 100644 --- a/libevmasm/SemanticInformation.h +++ b/libevmasm/SemanticInformation.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file SemanticInformation.h * @author Christian diff --git a/libevmasm/SimplificationRule.h b/libevmasm/SimplificationRule.h index 1fa1d8ea8182..6ce9a9e7c08b 100644 --- a/libevmasm/SimplificationRule.h +++ b/libevmasm/SimplificationRule.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Expression simplification pattern. */ diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index c4cc598639b1..d2f30c22e4ff 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file ExpressionClasses.cpp * @author Christian diff --git a/libevmasm/SimplificationRules.h b/libevmasm/SimplificationRules.h index 72884d32ab12..f548f501d87d 100644 --- a/libevmasm/SimplificationRules.h +++ b/libevmasm/SimplificationRules.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file SimplificationRules * @author Christian diff --git a/liblangutil/EVMVersion.cpp b/liblangutil/EVMVersion.cpp index fa100c091fad..c953eda0f8e0 100644 --- a/liblangutil/EVMVersion.cpp +++ b/liblangutil/EVMVersion.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * EVM versioning. */ diff --git a/liblangutil/EVMVersion.h b/liblangutil/EVMVersion.h index 2c9e87ef3d3d..b34426c928cb 100644 --- a/liblangutil/EVMVersion.h +++ b/liblangutil/EVMVersion.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * EVM versioning. */ diff --git a/liblangutil/ErrorReporter.cpp b/liblangutil/ErrorReporter.cpp index a8dccd55761b..29a20a8d8ce0 100644 --- a/liblangutil/ErrorReporter.cpp +++ b/liblangutil/ErrorReporter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Rhett * @date 2017 diff --git a/liblangutil/ErrorReporter.h b/liblangutil/ErrorReporter.h index 3dc8c59c7845..e533d7f6cbda 100644 --- a/liblangutil/ErrorReporter.h +++ b/liblangutil/ErrorReporter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Rhett * @date 2017 diff --git a/liblangutil/Exceptions.cpp b/liblangutil/Exceptions.cpp index fa65031cd66e..2e9d22b418cf 100644 --- a/liblangutil/Exceptions.cpp +++ b/liblangutil/Exceptions.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Liana * @date 2015 diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 0dd7568481b0..69745a2fc0df 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/liblangutil/ParserBase.cpp b/liblangutil/ParserBase.cpp index c2162044a082..19c4d187cc58 100644 --- a/liblangutil/ParserBase.cpp +++ b/liblangutil/ParserBase.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/liblangutil/ParserBase.h b/liblangutil/ParserBase.h index 0f61460059f6..475b08456a6b 100644 --- a/liblangutil/ParserBase.h +++ b/liblangutil/ParserBase.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/liblangutil/SemVerHandler.cpp b/liblangutil/SemVerHandler.cpp index d997cb073e45..ee5490f55ac8 100644 --- a/liblangutil/SemVerHandler.cpp +++ b/liblangutil/SemVerHandler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/liblangutil/SemVerHandler.h b/liblangutil/SemVerHandler.h index d3dfd5a5b0a3..0a291224e0db 100644 --- a/liblangutil/SemVerHandler.h +++ b/liblangutil/SemVerHandler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/liblangutil/SourceLocation.cpp b/liblangutil/SourceLocation.cpp index 8c531c6255b5..160a3616bd35 100644 --- a/liblangutil/SourceLocation.cpp +++ b/liblangutil/SourceLocation.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 283c8a52420e..4b7122de33f8 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris Karapetsas * @date 2015 diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 89f84011db71..2faefc9b0a97 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/liblangutil/SourceReferenceExtractor.h b/liblangutil/SourceReferenceExtractor.h index b9dababb9671..7eb54845c7f9 100644 --- a/liblangutil/SourceReferenceExtractor.h +++ b/liblangutil/SourceReferenceExtractor.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/liblangutil/SourceReferenceFormatter.cpp b/liblangutil/SourceReferenceFormatter.cpp index e10f251d5b21..d7a0a21690ff 100644 --- a/liblangutil/SourceReferenceFormatter.cpp +++ b/liblangutil/SourceReferenceFormatter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/liblangutil/SourceReferenceFormatter.h b/liblangutil/SourceReferenceFormatter.h index 439fe177c26c..636ddfcb03b4 100644 --- a/liblangutil/SourceReferenceFormatter.h +++ b/liblangutil/SourceReferenceFormatter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index 998ca7bf59b6..96bef2ed7753 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Formatting functions for errors referencing positions and locations in the source. */ diff --git a/liblangutil/SourceReferenceFormatterHuman.h b/liblangutil/SourceReferenceFormatterHuman.h index b468f375651b..21816ce67004 100644 --- a/liblangutil/SourceReferenceFormatterHuman.h +++ b/liblangutil/SourceReferenceFormatterHuman.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Formatting functions for errors referencing positions and locations in the source. */ diff --git a/liblangutil/UndefMacros.h b/liblangutil/UndefMacros.h index d96e242ec8a4..e3dde6d31514 100644 --- a/liblangutil/UndefMacros.h +++ b/liblangutil/UndefMacros.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file UndefMacros.h * @author Lefteris * @date 2015 diff --git a/libsmtutil/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp index 8116ea2a26ce..c6c5a4cac1aa 100644 --- a/libsmtutil/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/CHCSmtLib2Interface.h b/libsmtutil/CHCSmtLib2Interface.h index 8ec3f8dd263f..5a74bacbe997 100644 --- a/libsmtutil/CHCSmtLib2Interface.h +++ b/libsmtutil/CHCSmtLib2Interface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Interface for solving Horn systems via smtlib2. diff --git a/libsmtutil/CHCSolverInterface.h b/libsmtutil/CHCSolverInterface.h index f2d14cbcfa41..bf8b6a4ccce7 100644 --- a/libsmtutil/CHCSolverInterface.h +++ b/libsmtutil/CHCSolverInterface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Interface for constrained Horn solvers. diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index f58e4680177d..2a795d827586 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/CVC4Interface.h b/libsmtutil/CVC4Interface.h index 99059035182e..16f9f1f81860 100644 --- a/libsmtutil/CVC4Interface.h +++ b/libsmtutil/CVC4Interface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/Exceptions.h b/libsmtutil/Exceptions.h index 6321c4f6a647..29011dab97a4 100644 --- a/libsmtutil/Exceptions.h +++ b/libsmtutil/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index 1f87b9b72070..f1d21c2cc668 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h index dfb32a959bc4..2a43c04418b5 100644 --- a/libsmtutil/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/SMTPortfolio.cpp b/libsmtutil/SMTPortfolio.cpp index 80c1a47506bb..334d91dd73b6 100644 --- a/libsmtutil/SMTPortfolio.cpp +++ b/libsmtutil/SMTPortfolio.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/SMTPortfolio.h b/libsmtutil/SMTPortfolio.h index 0399ac033f3e..3e933df5d133 100644 --- a/libsmtutil/SMTPortfolio.h +++ b/libsmtutil/SMTPortfolio.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index a62a39b37fe4..d4c4d7fefa8a 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/Sorts.cpp b/libsmtutil/Sorts.cpp index 7624cbb5b57a..303e8bb8448a 100644 --- a/libsmtutil/Sorts.cpp +++ b/libsmtutil/Sorts.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/Sorts.h b/libsmtutil/Sorts.h index 20cbf2be5af8..de94e8fff6bc 100644 --- a/libsmtutil/Sorts.h +++ b/libsmtutil/Sorts.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index d2bce2f1c6dd..262e72e1a947 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h index f36ee2caae46..7fe9e66537f6 100644 --- a/libsmtutil/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Z3 specific Horn solver interface. diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index c2309ad4fbd3..501446553bf5 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsmtutil/Z3Interface.h b/libsmtutil/Z3Interface.h index d1fdce0f8d03..22f79333785a 100644 --- a/libsmtutil/Z3Interface.h +++ b/libsmtutil/Z3Interface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolc/libsolc.cpp b/libsolc/libsolc.cpp index d216ae8a22a2..f87f075d6465 100644 --- a/libsolc/libsolc.cpp +++ b/libsolc/libsolc.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolc/libsolc.h b/libsolc/libsolc.h index 655c9e7b54a6..c5b3b3db732b 100644 --- a/libsolc/libsolc.h +++ b/libsolc/libsolc.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/ConstantEvaluator.cpp b/libsolidity/analysis/ConstantEvaluator.cpp index 4bd8b1389865..d00affb91a9b 100644 --- a/libsolidity/analysis/ConstantEvaluator.cpp +++ b/libsolidity/analysis/ConstantEvaluator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/ConstantEvaluator.h b/libsolidity/analysis/ConstantEvaluator.h index f07e6783d342..521f463384ad 100644 --- a/libsolidity/analysis/ConstantEvaluator.h +++ b/libsolidity/analysis/ConstantEvaluator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index fc391f196fd7..8d40ace0e746 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that verifies overloads, abstract contracts, function clashes and others * checks at contract or function level. diff --git a/libsolidity/analysis/ContractLevelChecker.h b/libsolidity/analysis/ContractLevelChecker.h index 3a0d7d7402f8..2af0963d7d60 100644 --- a/libsolidity/analysis/ContractLevelChecker.h +++ b/libsolidity/analysis/ContractLevelChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that verifies overloads, abstract contracts, function clashes and others * checks at contract or function level. diff --git a/libsolidity/analysis/ControlFlowAnalyzer.cpp b/libsolidity/analysis/ControlFlowAnalyzer.cpp index 4937ee1d4269..1ed66f72b6db 100644 --- a/libsolidity/analysis/ControlFlowAnalyzer.cpp +++ b/libsolidity/analysis/ControlFlowAnalyzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/ControlFlowAnalyzer.h b/libsolidity/analysis/ControlFlowAnalyzer.h index a839c5679f96..c731cc31fc92 100644 --- a/libsolidity/analysis/ControlFlowAnalyzer.h +++ b/libsolidity/analysis/ControlFlowAnalyzer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/ControlFlowBuilder.cpp b/libsolidity/analysis/ControlFlowBuilder.cpp index a0c557a3ef14..4eb4658e1d50 100644 --- a/libsolidity/analysis/ControlFlowBuilder.cpp +++ b/libsolidity/analysis/ControlFlowBuilder.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libsolidity/analysis/ControlFlowBuilder.h b/libsolidity/analysis/ControlFlowBuilder.h index 2d0910d6a741..0efd55d77bcb 100644 --- a/libsolidity/analysis/ControlFlowBuilder.h +++ b/libsolidity/analysis/ControlFlowBuilder.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/ControlFlowGraph.cpp b/libsolidity/analysis/ControlFlowGraph.cpp index fb5fc1be0221..f7344e7fc94e 100644 --- a/libsolidity/analysis/ControlFlowGraph.cpp +++ b/libsolidity/analysis/ControlFlowGraph.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/ControlFlowGraph.h b/libsolidity/analysis/ControlFlowGraph.h index 4d11ef8f6bb2..7d51f2196a8d 100644 --- a/libsolidity/analysis/ControlFlowGraph.h +++ b/libsolidity/analysis/ControlFlowGraph.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/DeclarationContainer.cpp b/libsolidity/analysis/DeclarationContainer.cpp index 2450778cd918..b514c2c3973f 100644 --- a/libsolidity/analysis/DeclarationContainer.cpp +++ b/libsolidity/analysis/DeclarationContainer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h index 4b4df9339a41..8036a5a58e81 100644 --- a/libsolidity/analysis/DeclarationContainer.h +++ b/libsolidity/analysis/DeclarationContainer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index 07e8f606675f..0027b3045ba4 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/DeclarationTypeChecker.h b/libsolidity/analysis/DeclarationTypeChecker.h index 0edd97bd94ed..6ba9d1aad6c2 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.h +++ b/libsolidity/analysis/DeclarationTypeChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 92989ddac413..96fde8550292 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index 9bc8ec5782a4..ee79cd9f7719 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/GlobalContext.cpp b/libsolidity/analysis/GlobalContext.cpp index 53020afce97d..885ae49a7e00 100644 --- a/libsolidity/analysis/GlobalContext.cpp +++ b/libsolidity/analysis/GlobalContext.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @author Gav Wood diff --git a/libsolidity/analysis/GlobalContext.h b/libsolidity/analysis/GlobalContext.h index 81ffa2109d45..b84e3a026229 100644 --- a/libsolidity/analysis/GlobalContext.h +++ b/libsolidity/analysis/GlobalContext.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/ImmutableValidator.cpp b/libsolidity/analysis/ImmutableValidator.cpp index e4fcfadcf366..5af640e58537 100644 --- a/libsolidity/analysis/ImmutableValidator.cpp +++ b/libsolidity/analysis/ImmutableValidator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/ImmutableValidator.h b/libsolidity/analysis/ImmutableValidator.h index 5845ba011afd..ffa45e74cb51 100644 --- a/libsolidity/analysis/ImmutableValidator.h +++ b/libsolidity/analysis/ImmutableValidator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 9fbd219f91b9..c7be364a3e0c 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h index efb4040380e0..d72822653044 100644 --- a/libsolidity/analysis/NameAndTypeResolver.h +++ b/libsolidity/analysis/NameAndTypeResolver.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 6a2ccc83aa41..42a6230a221e 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that verifies overloads, abstract contracts, function clashes and others * checks at contract or function level. diff --git a/libsolidity/analysis/OverrideChecker.h b/libsolidity/analysis/OverrideChecker.h index d47b89f3dd4f..564100453cb6 100644 --- a/libsolidity/analysis/OverrideChecker.h +++ b/libsolidity/analysis/OverrideChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that verifies override properties. */ diff --git a/libsolidity/analysis/PostTypeChecker.cpp b/libsolidity/analysis/PostTypeChecker.cpp index 1b5b5b7c351c..cb04eec6f825 100644 --- a/libsolidity/analysis/PostTypeChecker.cpp +++ b/libsolidity/analysis/PostTypeChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/PostTypeChecker.h b/libsolidity/analysis/PostTypeChecker.h index 0a335855393d..d3f23918c6db 100644 --- a/libsolidity/analysis/PostTypeChecker.h +++ b/libsolidity/analysis/PostTypeChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 408a7ff83782..10ad415c114d 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 7da745cc5e4c..710f388cbf17 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index 62a1861d16c7..68f52ac26b6c 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Federico Bond * @date 2016 diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h index 7886b428859a..dc6263d7e583 100644 --- a/libsolidity/analysis/StaticAnalyzer.h +++ b/libsolidity/analysis/StaticAnalyzer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Federico Bond * @date 2016 diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 267d5764fd66..26d90f4f1dda 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h index 78aa6b82f55e..1ace2f36a0b7 100644 --- a/libsolidity/analysis/SyntaxChecker.h +++ b/libsolidity/analysis/SyntaxChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index a81520b05d6a..92abc11e6849 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 9e5f9470f556..e34c9e9d06a0 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index 09c8a34b3c59..d2e1b3e43d72 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libsolidity/analysis/ViewPureChecker.h b/libsolidity/analysis/ViewPureChecker.h index 10e60f05183c..87135b4f762c 100644 --- a/libsolidity/analysis/ViewPureChecker.h +++ b/libsolidity/analysis/ViewPureChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index cba5bccc39e4..7c1ed2aa8b32 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 34fefeb0a042..eb2b4f87d2b1 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/ASTAnnotations.cpp b/libsolidity/ast/ASTAnnotations.cpp index eb3caf721fbe..3556041d849c 100644 --- a/libsolidity/ast/ASTAnnotations.cpp +++ b/libsolidity/ast/ASTAnnotations.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 507559ca6ceb..d4df9d0cf91c 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/ast/ASTEnums.h b/libsolidity/ast/ASTEnums.h index 19279c6b7947..e167e7d49069 100644 --- a/libsolidity/ast/ASTEnums.h +++ b/libsolidity/ast/ASTEnums.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Enums for AST classes. diff --git a/libsolidity/ast/ASTForward.h b/libsolidity/ast/ASTForward.h index 38da35218ebe..3f082d975bf0 100644 --- a/libsolidity/ast/ASTForward.h +++ b/libsolidity/ast/ASTForward.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 219151f89286..39b92bbb45db 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Converts the AST into json format diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index a1d3cd4ad843..bb5d9651c199 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @date 2015 diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index ccf9af5a74df..33975d8caca1 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author julius * @date 2019 diff --git a/libsolidity/ast/ASTJsonImporter.h b/libsolidity/ast/ASTJsonImporter.h index ebcbd660c108..0bfb111bf4ea 100644 --- a/libsolidity/ast/ASTJsonImporter.h +++ b/libsolidity/ast/ASTJsonImporter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author julius * @date 2019 diff --git a/libsolidity/ast/ASTUtils.cpp b/libsolidity/ast/ASTUtils.cpp index 483b75301ac3..54db7002e59a 100644 --- a/libsolidity/ast/ASTUtils.cpp +++ b/libsolidity/ast/ASTUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libsolidity/ast/ASTUtils.h b/libsolidity/ast/ASTUtils.h index af77b60f11a6..38465d8d53d5 100644 --- a/libsolidity/ast/ASTUtils.h +++ b/libsolidity/ast/ASTUtils.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/ast/ASTVisitor.h b/libsolidity/ast/ASTVisitor.h index 52e90b0d75b1..c5aeba402f30 100644 --- a/libsolidity/ast/ASTVisitor.h +++ b/libsolidity/ast/ASTVisitor.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/AST_accept.h b/libsolidity/ast/AST_accept.h index e597ce46b305..2105e369da4d 100644 --- a/libsolidity/ast/AST_accept.h +++ b/libsolidity/ast/AST_accept.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/AsmJsonImporter.cpp b/libsolidity/ast/AsmJsonImporter.cpp index 3023888414ac..3ff280f5455f 100644 --- a/libsolidity/ast/AsmJsonImporter.cpp +++ b/libsolidity/ast/AsmJsonImporter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author julius * @date 2019 diff --git a/libsolidity/ast/AsmJsonImporter.h b/libsolidity/ast/AsmJsonImporter.h index 498b4e489bc8..b4e8cfe7b7f5 100644 --- a/libsolidity/ast/AsmJsonImporter.h +++ b/libsolidity/ast/AsmJsonImporter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author julius * @date 2019 diff --git a/libsolidity/ast/ExperimentalFeatures.h b/libsolidity/ast/ExperimentalFeatures.h index 6fdc6897b04b..772bc4e083a8 100644 --- a/libsolidity/ast/ExperimentalFeatures.h +++ b/libsolidity/ast/ExperimentalFeatures.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * List of experimental features. */ diff --git a/libsolidity/ast/TypeProvider.cpp b/libsolidity/ast/TypeProvider.cpp index 6fd7784031f3..c7ef3cfbd93b 100644 --- a/libsolidity/ast/TypeProvider.cpp +++ b/libsolidity/ast/TypeProvider.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libsolidity/ast/TypeProvider.h b/libsolidity/ast/TypeProvider.h index a86542d1688a..1f9ba4329f07 100644 --- a/libsolidity/ast/TypeProvider.h +++ b/libsolidity/ast/TypeProvider.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 825fc8d0c27f..b382e9803103 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 155fa7f14009..02f5c9f5f1a9 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 9f244fdb15dd..ef5948069c5b 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2017 diff --git a/libsolidity/codegen/ABIFunctions.h b/libsolidity/codegen/ABIFunctions.h index a66b1284e931..e3a7e6f187d7 100644 --- a/libsolidity/codegen/ABIFunctions.h +++ b/libsolidity/codegen/ABIFunctions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2017 diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index 409c16cd7ffd..ef94b6bf241f 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/codegen/ArrayUtils.h b/libsolidity/codegen/ArrayUtils.h index 2ee0879741e3..7cc01dd26c62 100644 --- a/libsolidity/codegen/ArrayUtils.h +++ b/libsolidity/codegen/ArrayUtils.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp index f343f2377596..a64a3400986c 100644 --- a/libsolidity/codegen/Compiler.cpp +++ b/libsolidity/codegen/Compiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/Compiler.h b/libsolidity/codegen/Compiler.h index e12332015ff1..11d5c2abd9d8 100644 --- a/libsolidity/codegen/Compiler.h +++ b/libsolidity/codegen/Compiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 2f3659010a51..9fde94e8a40a 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index c32b5140627f..f82c705d8847 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 2d7b38b259ad..f2db905691ca 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index a65edb8f2acd..64ab84fe78f9 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index ad9c97474bc6..225628a6cf5c 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/ContractCompiler.h b/libsolidity/codegen/ContractCompiler.h index 0916da281a2b..d4badc1974a2 100644 --- a/libsolidity/codegen/ContractCompiler.h +++ b/libsolidity/codegen/ContractCompiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 694ea8fa6fe4..566db8517eab 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/codegen/ExpressionCompiler.h b/libsolidity/codegen/ExpressionCompiler.h index 0216b260bfed..c0a703d783f2 100644 --- a/libsolidity/codegen/ExpressionCompiler.h +++ b/libsolidity/codegen/ExpressionCompiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @author Gav Wood diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 798428098a1c..77719676759d 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/codegen/LValue.h b/libsolidity/codegen/LValue.h index cd72f37e00a3..9bf0d1c05c0c 100644 --- a/libsolidity/codegen/LValue.h +++ b/libsolidity/codegen/LValue.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/codegen/MultiUseYulFunctionCollector.cpp b/libsolidity/codegen/MultiUseYulFunctionCollector.cpp index f49f3083d37a..0049deb780f8 100644 --- a/libsolidity/codegen/MultiUseYulFunctionCollector.cpp +++ b/libsolidity/codegen/MultiUseYulFunctionCollector.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Container of (unparsed) Yul functions identified by name which are meant to be generated * only once. diff --git a/libsolidity/codegen/MultiUseYulFunctionCollector.h b/libsolidity/codegen/MultiUseYulFunctionCollector.h index 031d08bdef36..428a0c9a3cc2 100644 --- a/libsolidity/codegen/MultiUseYulFunctionCollector.h +++ b/libsolidity/codegen/MultiUseYulFunctionCollector.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Container of (unparsed) Yul functions identified by name which are meant to be generated * only once. diff --git a/libsolidity/codegen/ReturnInfo.cpp b/libsolidity/codegen/ReturnInfo.cpp index b522addd4d25..f0828befd9a8 100644 --- a/libsolidity/codegen/ReturnInfo.cpp +++ b/libsolidity/codegen/ReturnInfo.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/codegen/ReturnInfo.h b/libsolidity/codegen/ReturnInfo.h index 01aa308620ff..e1e5719ef461 100644 --- a/libsolidity/codegen/ReturnInfo.h +++ b/libsolidity/codegen/ReturnInfo.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that computes information relevant during decoding an external function * call's return values. diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 7678a0befe92..cab908c18680 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that can generate various useful Yul functions. */ diff --git a/libsolidity/codegen/YulUtilFunctions.h b/libsolidity/codegen/YulUtilFunctions.h index c1d98cfe48ec..5d9ec805f474 100644 --- a/libsolidity/codegen/YulUtilFunctions.h +++ b/libsolidity/codegen/YulUtilFunctions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that can generate various useful Yul functions. */ diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index 2bf4a36cfabf..42a4650dbbf3 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 3f4ea64f4f67..da6c61a7f1b6 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Miscellaneous utilities for use in IR generator. */ diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index b85e2f7d3ed1..7476dd90e6f9 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Class that contains contextual information during IR generation. */ diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index d6d8022dfbe7..469beea2fe92 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Class that contains contextual information during IR generation. */ diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index 92df1ba83e73..f7f66b4f58a1 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2017 diff --git a/libsolidity/codegen/ir/IRGenerator.h b/libsolidity/codegen/ir/IRGenerator.h index 6bf94e575b1d..e57b8535e6eb 100644 --- a/libsolidity/codegen/ir/IRGenerator.h +++ b/libsolidity/codegen/ir/IRGenerator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2017 diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index a8d657b028c9..51679571e393 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that translates Solidity code into Yul at statement level and below. */ diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.h b/libsolidity/codegen/ir/IRGeneratorForStatements.h index bdf21f783e0b..09c9c7d278bf 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.h +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that translates Solidity code into Yul at statement level and below. */ diff --git a/libsolidity/codegen/ir/IRLValue.h b/libsolidity/codegen/ir/IRLValue.h index c5eadc9b2753..fef390d4cb89 100644 --- a/libsolidity/codegen/ir/IRLValue.h +++ b/libsolidity/codegen/ir/IRLValue.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Classes that store locations of lvalues. */ diff --git a/libsolidity/codegen/ir/IRVariable.cpp b/libsolidity/codegen/ir/IRVariable.cpp index 8cb1896a6f12..3fce5288a159 100644 --- a/libsolidity/codegen/ir/IRVariable.cpp +++ b/libsolidity/codegen/ir/IRVariable.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libsolidity/codegen/ir/IRVariable.h b/libsolidity/codegen/ir/IRVariable.h index dbf37704c070..71413cc38907 100644 --- a/libsolidity/codegen/ir/IRVariable.h +++ b/libsolidity/codegen/ir/IRVariable.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index 921c71ccf3f6..363910edd1e5 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/BMC.h b/libsolidity/formal/BMC.h index 2eed58101233..324595bbaf6c 100644 --- a/libsolidity/formal/BMC.h +++ b/libsolidity/formal/BMC.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Class that implements an SMT-based Bounded Model Checker (BMC). * Traverses the AST such that: diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 5dd8c958ccfe..f68872d5c816 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 5e518a130e35..d025e31d30d3 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Model checker based on Constrained Horn Clauses. diff --git a/libsolidity/formal/EncodingContext.cpp b/libsolidity/formal/EncodingContext.cpp index b581602303ff..422eb44eeab5 100644 --- a/libsolidity/formal/EncodingContext.cpp +++ b/libsolidity/formal/EncodingContext.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/EncodingContext.h b/libsolidity/formal/EncodingContext.h index 09316709a423..e188792d8130 100644 --- a/libsolidity/formal/EncodingContext.h +++ b/libsolidity/formal/EncodingContext.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/formal/ModelChecker.cpp b/libsolidity/formal/ModelChecker.cpp index 718a41ae17df..9465dd34200d 100644 --- a/libsolidity/formal/ModelChecker.cpp +++ b/libsolidity/formal/ModelChecker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/ModelChecker.h b/libsolidity/formal/ModelChecker.h index b4378e629073..42d116b28556 100644 --- a/libsolidity/formal/ModelChecker.h +++ b/libsolidity/formal/ModelChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Entry point to the model checking engines. * The goal of this class is to make different diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index ac87bade1067..e3f16b2efecf 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 86ed21ef97d8..92ef0601afff 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Encodes Solidity into SMT expressions without creating * any verification targets. diff --git a/libsolidity/formal/SSAVariable.cpp b/libsolidity/formal/SSAVariable.cpp index 5569d8f36219..bb599c35a883 100644 --- a/libsolidity/formal/SSAVariable.cpp +++ b/libsolidity/formal/SSAVariable.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/SSAVariable.h b/libsolidity/formal/SSAVariable.h index bad6fa80cce6..7db69d1fdf53 100644 --- a/libsolidity/formal/SSAVariable.h +++ b/libsolidity/formal/SSAVariable.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/formal/SymbolicState.cpp b/libsolidity/formal/SymbolicState.cpp index 1ab6e18608f0..06fe1bd2aa51 100644 --- a/libsolidity/formal/SymbolicState.cpp +++ b/libsolidity/formal/SymbolicState.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/SymbolicState.h b/libsolidity/formal/SymbolicState.h index 2b234466dde9..aaf6971fa975 100644 --- a/libsolidity/formal/SymbolicState.h +++ b/libsolidity/formal/SymbolicState.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/formal/SymbolicTypes.cpp b/libsolidity/formal/SymbolicTypes.cpp index 096f496c4acd..b149cb69c340 100644 --- a/libsolidity/formal/SymbolicTypes.cpp +++ b/libsolidity/formal/SymbolicTypes.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/SymbolicTypes.h b/libsolidity/formal/SymbolicTypes.h index 226bd5f94697..401c9f0b6788 100644 --- a/libsolidity/formal/SymbolicTypes.h +++ b/libsolidity/formal/SymbolicTypes.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index 3f86b48d901c..b09938e63082 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/SymbolicVariables.h b/libsolidity/formal/SymbolicVariables.h index 65dce43f02f8..bdf36afd06c4 100644 --- a/libsolidity/formal/SymbolicVariables.h +++ b/libsolidity/formal/SymbolicVariables.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/formal/VariableUsage.cpp b/libsolidity/formal/VariableUsage.cpp index 11ca44ff3be0..1634b3b58f4c 100644 --- a/libsolidity/formal/VariableUsage.cpp +++ b/libsolidity/formal/VariableUsage.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/formal/VariableUsage.h b/libsolidity/formal/VariableUsage.h index 7b55998d25d1..508efbc604a9 100644 --- a/libsolidity/formal/VariableUsage.h +++ b/libsolidity/formal/VariableUsage.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/interface/ABI.cpp b/libsolidity/interface/ABI.cpp index c00c2f83cd47..512bf9b13684 100644 --- a/libsolidity/interface/ABI.cpp +++ b/libsolidity/interface/ABI.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Utilities to handle the Contract ABI (https://solidity.readthedocs.io/en/develop/abi-spec.html) */ diff --git a/libsolidity/interface/ABI.h b/libsolidity/interface/ABI.h index 1dd578cebf6b..76b1a4a7594f 100644 --- a/libsolidity/interface/ABI.h +++ b/libsolidity/interface/ABI.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Utilities to handle the Contract ABI (https://solidity.readthedocs.io/en/develop/abi-spec.html) */ diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 164938c60e27..f8164bc9f3d3 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @author Gav Wood diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 509623cc1b03..ce0f949b9ef5 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @author Gav Wood diff --git a/libsolidity/interface/DebugSettings.h b/libsolidity/interface/DebugSettings.h index 34818889c953..e0dab05bb234 100644 --- a/libsolidity/interface/DebugSettings.h +++ b/libsolidity/interface/DebugSettings.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Settings to aid debugging. */ diff --git a/libsolidity/interface/GasEstimator.cpp b/libsolidity/interface/GasEstimator.cpp index 1a86f36ceef3..2b56977ff848 100644 --- a/libsolidity/interface/GasEstimator.cpp +++ b/libsolidity/interface/GasEstimator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/interface/GasEstimator.h b/libsolidity/interface/GasEstimator.h index 1cfcec9a7586..f814c8b8d2bf 100644 --- a/libsolidity/interface/GasEstimator.h +++ b/libsolidity/interface/GasEstimator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index a292c7a3d05c..1f5c4807af4d 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @date 2014 diff --git a/libsolidity/interface/Natspec.h b/libsolidity/interface/Natspec.h index 8d414e71a4ca..9dab62625ebd 100644 --- a/libsolidity/interface/Natspec.h +++ b/libsolidity/interface/Natspec.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @date 2014 diff --git a/libsolidity/interface/OptimiserSettings.h b/libsolidity/interface/OptimiserSettings.h index cd82290af073..67007fc4c54c 100644 --- a/libsolidity/interface/OptimiserSettings.h +++ b/libsolidity/interface/OptimiserSettings.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2017 diff --git a/libsolidity/interface/ReadFile.h b/libsolidity/interface/ReadFile.h index 232d39be43e6..b21e8634a157 100644 --- a/libsolidity/interface/ReadFile.h +++ b/libsolidity/interface/ReadFile.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 7293f94bc8fb..b1e355fabfbc 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2016 diff --git a/libsolidity/interface/StandardCompiler.h b/libsolidity/interface/StandardCompiler.h index d1a1489c3df9..cf5be94a01e7 100644 --- a/libsolidity/interface/StandardCompiler.h +++ b/libsolidity/interface/StandardCompiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2016 diff --git a/libsolidity/interface/StorageLayout.cpp b/libsolidity/interface/StorageLayout.cpp index 806652cfe1b8..d23344bc8add 100644 --- a/libsolidity/interface/StorageLayout.cpp +++ b/libsolidity/interface/StorageLayout.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/interface/StorageLayout.h b/libsolidity/interface/StorageLayout.h index 331a85d4644b..4cfee73a9b4c 100644 --- a/libsolidity/interface/StorageLayout.h +++ b/libsolidity/interface/StorageLayout.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Generates the storage layout of a contract. */ diff --git a/libsolidity/interface/Version.cpp b/libsolidity/interface/Version.cpp index 412750bc8b46..297333b6bf0b 100644 --- a/libsolidity/interface/Version.cpp +++ b/libsolidity/interface/Version.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/interface/Version.h b/libsolidity/interface/Version.h index f2b1ad4292aa..a5965d42edb2 100644 --- a/libsolidity/interface/Version.h +++ b/libsolidity/interface/Version.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index 9f6f13f945d7..314f04201282 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index d5ebd2383814..4b6d6b512d3a 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @date 2014, 2015 diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 4b63cbc58073..ce08bef60208 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index f66754045585..f84cb7041788 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h index 0e8f1f85b3c7..0382aba0eb34 100644 --- a/libsolidity/parsing/Token.h +++ b/libsolidity/parsing/Token.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Solidity and Yul both share the same Token (and Scanner) API. * diff --git a/libsolutil/Algorithms.h b/libsolutil/Algorithms.h index 3897d65d2498..88e034bf4985 100644 --- a/libsolutil/Algorithms.h +++ b/libsolutil/Algorithms.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/AnsiColorized.h b/libsolutil/AnsiColorized.h index 4f7ea577b098..69d10d727640 100644 --- a/libsolutil/AnsiColorized.h +++ b/libsolutil/AnsiColorized.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/Assertions.h b/libsolutil/Assertions.h index 1c5a14008a93..b143e6ed7c12 100644 --- a/libsolutil/Assertions.h +++ b/libsolutil/Assertions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @file Assertions.h * @author Christian diff --git a/libsolutil/Common.h b/libsolutil/Common.h index f2d9c1d84371..aae2fa8590cd 100644 --- a/libsolutil/Common.h +++ b/libsolutil/Common.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Common.h * @author Gav Wood * @date 2014 diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index 2896804ca601..1dc6168369d9 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file CommonData.cpp * @author Gav Wood * @date 2014 diff --git a/libsolutil/CommonData.h b/libsolutil/CommonData.h index a5c045646d4b..b61ba82a2c3c 100644 --- a/libsolutil/CommonData.h +++ b/libsolutil/CommonData.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file CommonData.h * @author Gav Wood * @date 2014 diff --git a/libsolutil/CommonIO.cpp b/libsolutil/CommonIO.cpp index cbe68f0d143a..43886264b2b2 100644 --- a/libsolutil/CommonIO.cpp +++ b/libsolutil/CommonIO.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file CommonIO.cpp * @author Gav Wood * @date 2014 diff --git a/libsolutil/CommonIO.h b/libsolutil/CommonIO.h index 38c8f564a43b..2a811387bdb9 100644 --- a/libsolutil/CommonIO.h +++ b/libsolutil/CommonIO.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file CommonIO.h * @author Gav Wood * @date 2014 diff --git a/libsolutil/Exceptions.cpp b/libsolutil/Exceptions.cpp index 94b40f63491c..fa4021d3be7b 100644 --- a/libsolutil/Exceptions.cpp +++ b/libsolutil/Exceptions.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolutil/Exceptions.h b/libsolutil/Exceptions.h index 971b9306f9c5..9c84c8f71e2b 100644 --- a/libsolutil/Exceptions.h +++ b/libsolutil/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/FixedHash.h b/libsolutil/FixedHash.h index 7fbb8eec9757..84d6afba3a19 100644 --- a/libsolutil/FixedHash.h +++ b/libsolutil/FixedHash.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file FixedHash.h * @author Gav Wood * @date 2014 diff --git a/libsolutil/IndentedWriter.cpp b/libsolutil/IndentedWriter.cpp index 884b50e9c5cb..0e0aded3ccb2 100644 --- a/libsolutil/IndentedWriter.cpp +++ b/libsolutil/IndentedWriter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Indented text writer. diff --git a/libsolutil/IndentedWriter.h b/libsolutil/IndentedWriter.h index 29ecc4f6dd7c..47e2817fa969 100644 --- a/libsolutil/IndentedWriter.h +++ b/libsolutil/IndentedWriter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Indented text writer. diff --git a/libsolutil/InvertibleMap.h b/libsolutil/InvertibleMap.h index 4448d03d7512..3c6f3238af6d 100644 --- a/libsolutil/InvertibleMap.h +++ b/libsolutil/InvertibleMap.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/IpfsHash.cpp b/libsolutil/IpfsHash.cpp index 6913d42f0808..c034ce5ba7e6 100644 --- a/libsolutil/IpfsHash.cpp +++ b/libsolutil/IpfsHash.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libsolutil/IpfsHash.h b/libsolutil/IpfsHash.h index 555b3596173e..977fb9836ba7 100644 --- a/libsolutil/IpfsHash.h +++ b/libsolutil/IpfsHash.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/JSON.cpp b/libsolutil/JSON.cpp index 609b9bb04558..b3635c877991 100644 --- a/libsolutil/JSON.cpp +++ b/libsolutil/JSON.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file JSON.cpp * @author Alexander Arlt * @date 2018 diff --git a/libsolutil/JSON.h b/libsolutil/JSON.h index 17633ea0775e..5328a3fafdc8 100644 --- a/libsolutil/JSON.h +++ b/libsolutil/JSON.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file JSON.h * @date 2016 * diff --git a/libsolutil/Keccak256.cpp b/libsolutil/Keccak256.cpp index 2a7a241c739f..50e849352bc4 100644 --- a/libsolutil/Keccak256.cpp +++ b/libsolutil/Keccak256.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file SHA3.cpp * @author Gav Wood * @date 2014 diff --git a/libsolutil/Keccak256.h b/libsolutil/Keccak256.h index 7135e55c0d2b..7fb7c7501a7b 100644 --- a/libsolutil/Keccak256.h +++ b/libsolutil/Keccak256.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file SHA3.h * @author Gav Wood * @date 2014 diff --git a/libsolutil/LazyInit.h b/libsolutil/LazyInit.h index fe2f6a916d22..b242484df688 100644 --- a/libsolutil/LazyInit.h +++ b/libsolutil/LazyInit.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libsolutil/Result.h b/libsolutil/Result.h index a2c471097f90..ca9563947729 100644 --- a/libsolutil/Result.h +++ b/libsolutil/Result.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libsolutil/StringUtils.cpp b/libsolutil/StringUtils.cpp index a5b0149c27da..35804c60a165 100644 --- a/libsolutil/StringUtils.cpp +++ b/libsolutil/StringUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file StringUtils.h * @author Balajiganapathi S * @date 2017 diff --git a/libsolutil/StringUtils.h b/libsolutil/StringUtils.h index caea637a2325..e7a68cedcec2 100644 --- a/libsolutil/StringUtils.h +++ b/libsolutil/StringUtils.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file StringUtils.h * @author Balajiganapathi S * @date 2017 diff --git a/libsolutil/SwarmHash.cpp b/libsolutil/SwarmHash.cpp index 4cfc0fe664bd..f35a74bd1d3f 100644 --- a/libsolutil/SwarmHash.cpp +++ b/libsolutil/SwarmHash.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file SwarmHash.cpp */ diff --git a/libsolutil/SwarmHash.h b/libsolutil/SwarmHash.h index 3905b2f5f9dc..ed7a52292d39 100644 --- a/libsolutil/SwarmHash.h +++ b/libsolutil/SwarmHash.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file SwarmHash.h */ diff --git a/libsolutil/UTF8.cpp b/libsolutil/UTF8.cpp index a7d55af6c382..4acf7a8ea9f2 100644 --- a/libsolutil/UTF8.cpp +++ b/libsolutil/UTF8.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file UTF8.cpp * @author Alex Beregszaszi * @date 2016 diff --git a/libsolutil/UTF8.h b/libsolutil/UTF8.h index cd84c3982590..59e2d41455e0 100644 --- a/libsolutil/UTF8.h +++ b/libsolutil/UTF8.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file UTF8.h * @author Alex Beregszaszi * @date 2016 diff --git a/libsolutil/Visitor.h b/libsolutil/Visitor.h index 6d771cd861df..497ed2f29253 100644 --- a/libsolutil/Visitor.h +++ b/libsolutil/Visitor.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Visitor templates. */ diff --git a/libsolutil/Whiskers.cpp b/libsolutil/Whiskers.cpp index aebe55c69c4c..3049af5c4ce6 100644 --- a/libsolutil/Whiskers.cpp +++ b/libsolutil/Whiskers.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Whiskers.cpp * @author Chris * @date 2017 diff --git a/libsolutil/Whiskers.h b/libsolutil/Whiskers.h index 5eb00dce556c..5ddb7a884016 100644 --- a/libsolutil/Whiskers.h +++ b/libsolutil/Whiskers.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file Whiskers.h * @author Chris * @date 2017 diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 315699153fb5..e85ecd876e9a 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Analyzer part of inline assembly. */ diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index e0a751b1343a..8d8db59abcfb 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Analysis part of inline assembly. */ diff --git a/libyul/AsmAnalysisInfo.h b/libyul/AsmAnalysisInfo.h index d094ee510582..9ac179ad8508 100644 --- a/libyul/AsmAnalysisInfo.h +++ b/libyul/AsmAnalysisInfo.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Information generated during analyzer part of inline assembly. */ diff --git a/libyul/AsmData.h b/libyul/AsmData.h index f870536affab..c4040f320c7e 100644 --- a/libyul/AsmData.h +++ b/libyul/AsmData.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/libyul/AsmDataForward.h b/libyul/AsmDataForward.h index b21f46f82d5c..02216fd0140b 100644 --- a/libyul/AsmDataForward.h +++ b/libyul/AsmDataForward.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index d2b905ecef43..58b11338d49a 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2019 * Converts inline assembly AST to JSON format diff --git a/libyul/AsmJsonConverter.h b/libyul/AsmJsonConverter.h index b350689fc515..3436523b7977 100644 --- a/libyul/AsmJsonConverter.h +++ b/libyul/AsmJsonConverter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2019 * @author julius diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 8dcb9a83259f..6c5d97e36d3f 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/libyul/AsmParser.h b/libyul/AsmParser.h index 4c1d6980f3ad..ecd62228afa5 100644 --- a/libyul/AsmParser.h +++ b/libyul/AsmParser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/libyul/AsmPrinter.cpp b/libyul/AsmPrinter.cpp index 97a7dc3ade61..c5982afc9b9d 100644 --- a/libyul/AsmPrinter.cpp +++ b/libyul/AsmPrinter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2017 diff --git a/libyul/AsmPrinter.h b/libyul/AsmPrinter.h index f7ee9ff54b86..648181cbf576 100644 --- a/libyul/AsmPrinter.h +++ b/libyul/AsmPrinter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2017 diff --git a/libyul/AsmScope.cpp b/libyul/AsmScope.cpp index 86dbce48365d..1237cba8d053 100644 --- a/libyul/AsmScope.cpp +++ b/libyul/AsmScope.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Scopes for identifiers. */ diff --git a/libyul/AsmScope.h b/libyul/AsmScope.h index 6da1ff1e059a..0857b604be07 100644 --- a/libyul/AsmScope.h +++ b/libyul/AsmScope.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Scopes for identifiers. */ diff --git a/libyul/AsmScopeFiller.cpp b/libyul/AsmScopeFiller.cpp index 90143ba4dd44..0e06954106dd 100644 --- a/libyul/AsmScopeFiller.cpp +++ b/libyul/AsmScopeFiller.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module responsible for registering identifiers inside their scopes. */ diff --git a/libyul/AsmScopeFiller.h b/libyul/AsmScopeFiller.h index f3b7a1b8f8b0..f2c35118b7db 100644 --- a/libyul/AsmScopeFiller.h +++ b/libyul/AsmScopeFiller.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module responsible for registering identifiers inside their scopes. */ diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index 4598d6d2b90b..b8824740d58e 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and * Ewasm as output. diff --git a/libyul/AssemblyStack.h b/libyul/AssemblyStack.h index f9d23550563e..70325208d263 100644 --- a/libyul/AssemblyStack.h +++ b/libyul/AssemblyStack.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and * Ewasm as output. diff --git a/libyul/CompilabilityChecker.h b/libyul/CompilabilityChecker.h index d92f1977ecf1..1267640bf16f 100644 --- a/libyul/CompilabilityChecker.h +++ b/libyul/CompilabilityChecker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that checks whether all variables are reachable on the stack. */ diff --git a/libyul/ControlFlowSideEffects.h b/libyul/ControlFlowSideEffects.h index 5621a122b1df..5e22ad862b2b 100644 --- a/libyul/ControlFlowSideEffects.h +++ b/libyul/ControlFlowSideEffects.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libyul/Dialect.cpp b/libyul/Dialect.cpp index 407fdea2fc4f..1003c8e44a40 100644 --- a/libyul/Dialect.cpp +++ b/libyul/Dialect.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul dialect. */ diff --git a/libyul/Dialect.h b/libyul/Dialect.h index 870205833659..553f9049abdc 100644 --- a/libyul/Dialect.h +++ b/libyul/Dialect.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul dialect. */ diff --git a/libyul/Exceptions.h b/libyul/Exceptions.h index 9bb6a5d0499e..2fe155030c05 100644 --- a/libyul/Exceptions.h +++ b/libyul/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Exceptions in Yul. */ diff --git a/libyul/Object.cpp b/libyul/Object.cpp index 13ad9f8caf48..1086e38cf1a3 100644 --- a/libyul/Object.cpp +++ b/libyul/Object.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul code and data object container. */ diff --git a/libyul/Object.h b/libyul/Object.h index 6ae79ed42cf1..3602e717751a 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul code and data object container. */ diff --git a/libyul/ObjectParser.cpp b/libyul/ObjectParser.cpp index 7e50fa88e6c6..f1d38ad730be 100644 --- a/libyul/ObjectParser.cpp +++ b/libyul/ObjectParser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Parser for Yul code and data object container. */ diff --git a/libyul/ObjectParser.h b/libyul/ObjectParser.h index 1bd9d956fd3f..6c6f527cd159 100644 --- a/libyul/ObjectParser.h +++ b/libyul/ObjectParser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Parser for Yul code and data object container. */ diff --git a/libyul/SideEffects.h b/libyul/SideEffects.h index 2a0232973545..e9c12d9c8720 100644 --- a/libyul/SideEffects.h +++ b/libyul/SideEffects.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libyul/Utilities.cpp b/libyul/Utilities.cpp index 59e0adce3afd..af72888fa42d 100644 --- a/libyul/Utilities.cpp +++ b/libyul/Utilities.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Some useful snippets for the optimiser. */ diff --git a/libyul/Utilities.h b/libyul/Utilities.h index 8b4547be3e31..53913e6fd477 100644 --- a/libyul/Utilities.h +++ b/libyul/Utilities.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Small useful snippets for the optimiser. */ diff --git a/libyul/YulString.h b/libyul/YulString.h index 0abe1f38ddf5..6985794ecbab 100644 --- a/libyul/YulString.h +++ b/libyul/YulString.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * String abstraction that avoids copies. */ diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index 42622272cd87..0c01a71d5968 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Abstract assembly interface, subclasses of which are to be used with the generic diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 327ce8895518..55e73feb1dea 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Adaptor between the abstract assembly and eth assembly. */ diff --git a/libyul/backends/evm/AsmCodeGen.h b/libyul/backends/evm/AsmCodeGen.h index 6ff02009c6b9..d40b41fcd73d 100644 --- a/libyul/backends/evm/AsmCodeGen.h +++ b/libyul/backends/evm/AsmCodeGen.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Adaptor between the abstract assembly and eth assembly. */ diff --git a/libyul/backends/evm/ConstantOptimiser.cpp b/libyul/backends/evm/ConstantOptimiser.cpp index d8399d095f4c..9148b0793677 100644 --- a/libyul/backends/evm/ConstantOptimiser.cpp +++ b/libyul/backends/evm/ConstantOptimiser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces constants by expressions that compute them. */ diff --git a/libyul/backends/evm/ConstantOptimiser.h b/libyul/backends/evm/ConstantOptimiser.h index 7423b5270046..d6844bbe6dcb 100644 --- a/libyul/backends/evm/ConstantOptimiser.h +++ b/libyul/backends/evm/ConstantOptimiser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces constants by expressions that compute them. */ diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index 7cf3d0662c1a..06288e562baa 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Assembly interface for EVM and EVM1.5. */ diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index 9ee974bbb890..6bf92e985492 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Assembly interface for EVM and EVM1.5. */ diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 041e0038019c..51efbbe3320c 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Common code generator for translating Yul / inline assembly to EVM and EVM1.5. */ diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 1cfa6afd7ebb..c344b834d83a 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Common code generator for translating Yul / inline assembly to EVM and EVM1.5. */ diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index bf0c63bfa50c..4b9acb0c7153 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul dialects for EVM. */ diff --git a/libyul/backends/evm/EVMDialect.h b/libyul/backends/evm/EVMDialect.h index 68f0b7046fd7..fe1c67a4a5a2 100644 --- a/libyul/backends/evm/EVMDialect.h +++ b/libyul/backends/evm/EVMDialect.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul dialects for EVM. */ diff --git a/libyul/backends/evm/EVMMetrics.cpp b/libyul/backends/evm/EVMMetrics.cpp index f3508afb34d9..5fb6d863a0fb 100644 --- a/libyul/backends/evm/EVMMetrics.cpp +++ b/libyul/backends/evm/EVMMetrics.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module providing metrics for the EVM optimizer. */ diff --git a/libyul/backends/evm/EVMMetrics.h b/libyul/backends/evm/EVMMetrics.h index b6a23e3c877c..63e0d3c8fc49 100644 --- a/libyul/backends/evm/EVMMetrics.h +++ b/libyul/backends/evm/EVMMetrics.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module providing metrics for the optimizer. */ diff --git a/libyul/backends/evm/EVMObjectCompiler.cpp b/libyul/backends/evm/EVMObjectCompiler.cpp index 6463b4a46ca6..98c209bf2614 100644 --- a/libyul/backends/evm/EVMObjectCompiler.cpp +++ b/libyul/backends/evm/EVMObjectCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Compiler that transforms Yul Objects to EVM bytecode objects. */ diff --git a/libyul/backends/evm/EVMObjectCompiler.h b/libyul/backends/evm/EVMObjectCompiler.h index fb40ac7395e4..74ea71ac6ced 100644 --- a/libyul/backends/evm/EVMObjectCompiler.h +++ b/libyul/backends/evm/EVMObjectCompiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Compiler that transforms Yul Objects to EVM bytecode objects. */ diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index ee280338d8b3..0d840ef669a8 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Assembly interface that ignores everything. Can be used as a backend for a compilation dry-run. */ diff --git a/libyul/backends/evm/NoOutputAssembly.h b/libyul/backends/evm/NoOutputAssembly.h index ec7e5f2ecead..0ba4cf67be0d 100644 --- a/libyul/backends/evm/NoOutputAssembly.h +++ b/libyul/backends/evm/NoOutputAssembly.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Assembly interface that ignores everything. Can be used as a backend for a compilation dry-run. */ diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index 38438e12eb73..5746dfaafe86 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that transforms internal Wasm representation to binary. */ diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h index c505fe2dc1b5..348250546785 100644 --- a/libyul/backends/wasm/BinaryTransform.h +++ b/libyul/backends/wasm/BinaryTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that transforms internal Wasm representation to binary. */ diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.cpp b/libyul/backends/wasm/EVMToEwasmTranslator.cpp index ebcdd961b98c..abb898828a81 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.cpp +++ b/libyul/backends/wasm/EVMToEwasmTranslator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Translates Yul code from EVM dialect to Ewasm dialect. */ diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.h b/libyul/backends/wasm/EVMToEwasmTranslator.h index 0bd86a317e73..ecb34ec1120b 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.h +++ b/libyul/backends/wasm/EVMToEwasmTranslator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Translates Yul code from EVM dialect to Ewasm dialect. */ diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index ee2aa86e471d..059f8960021a 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that transforms internal Wasm representation to text. */ diff --git a/libyul/backends/wasm/TextTransform.h b/libyul/backends/wasm/TextTransform.h index b8b21f7f2e6d..eb14da65d971 100644 --- a/libyul/backends/wasm/TextTransform.h +++ b/libyul/backends/wasm/TextTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that transforms internal Wasm representation to text. */ diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h index b22b0db84430..ced3b7bc6492 100644 --- a/libyul/backends/wasm/WasmAST.h +++ b/libyul/backends/wasm/WasmAST.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Simplified in-memory representation of a Wasm AST. */ diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 5171db1b1331..de87028a9864 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Common code generator for translating Yul / inline assembly to Wasm. */ diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 326778b3de8d..79d3552c6474 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Common code generator for translating Yul / inline assembly to Wasm. */ diff --git a/libyul/backends/wasm/WasmDialect.cpp b/libyul/backends/wasm/WasmDialect.cpp index 9dddddd69256..edf113a13a5b 100644 --- a/libyul/backends/wasm/WasmDialect.cpp +++ b/libyul/backends/wasm/WasmDialect.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Dialects for Wasm. */ diff --git a/libyul/backends/wasm/WasmDialect.h b/libyul/backends/wasm/WasmDialect.h index e5f3c9fc4315..a718f0b743af 100644 --- a/libyul/backends/wasm/WasmDialect.h +++ b/libyul/backends/wasm/WasmDialect.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Dialects for Wasm. */ diff --git a/libyul/backends/wasm/WasmObjectCompiler.cpp b/libyul/backends/wasm/WasmObjectCompiler.cpp index 52d485a7fc77..2b4f0c3558e4 100644 --- a/libyul/backends/wasm/WasmObjectCompiler.cpp +++ b/libyul/backends/wasm/WasmObjectCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured). */ diff --git a/libyul/backends/wasm/WasmObjectCompiler.h b/libyul/backends/wasm/WasmObjectCompiler.h index c5932a976b4b..52e48a9d5ecf 100644 --- a/libyul/backends/wasm/WasmObjectCompiler.h +++ b/libyul/backends/wasm/WasmObjectCompiler.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured). */ diff --git a/libyul/backends/wasm/WordSizeTransform.cpp b/libyul/backends/wasm/WordSizeTransform.cpp index 473f7324f3d6..73dda9d0c663 100644 --- a/libyul/backends/wasm/WordSizeTransform.cpp +++ b/libyul/backends/wasm/WordSizeTransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/backends/wasm/WordSizeTransform.h b/libyul/backends/wasm/WordSizeTransform.h index 5771afea82ef..1bf7dcacaf0f 100644 --- a/libyul/backends/wasm/WordSizeTransform.h +++ b/libyul/backends/wasm/WordSizeTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Replace every u256 variable with four u64 variables. */ diff --git a/libyul/optimiser/ASTCopier.cpp b/libyul/optimiser/ASTCopier.cpp index 16f257818d0e..8dc08f6fa1d6 100644 --- a/libyul/optimiser/ASTCopier.cpp +++ b/libyul/optimiser/ASTCopier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Creates an independent copy of an AST, renaming identifiers to be unique. */ diff --git a/libyul/optimiser/ASTCopier.h b/libyul/optimiser/ASTCopier.h index 3a05d2ca3b8a..8afb50d97152 100644 --- a/libyul/optimiser/ASTCopier.h +++ b/libyul/optimiser/ASTCopier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Creates an independent copy of an AST, renaming identifiers to be unique. */ diff --git a/libyul/optimiser/ASTWalker.cpp b/libyul/optimiser/ASTWalker.cpp index 728949a4e695..057f94b88782 100644 --- a/libyul/optimiser/ASTWalker.cpp +++ b/libyul/optimiser/ASTWalker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Generic AST walker. */ diff --git a/libyul/optimiser/ASTWalker.h b/libyul/optimiser/ASTWalker.h index 20f7fb9b4cc7..c62be4844ba5 100644 --- a/libyul/optimiser/ASTWalker.h +++ b/libyul/optimiser/ASTWalker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Generic AST walker. */ diff --git a/libyul/optimiser/BlockFlattener.cpp b/libyul/optimiser/BlockFlattener.cpp index 02e4c42f55c9..24f57594c5d2 100644 --- a/libyul/optimiser/BlockFlattener.cpp +++ b/libyul/optimiser/BlockFlattener.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/BlockFlattener.h b/libyul/optimiser/BlockFlattener.h index 31d3307d15cd..87a1af7cf1a3 100644 --- a/libyul/optimiser/BlockFlattener.h +++ b/libyul/optimiser/BlockFlattener.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/BlockHasher.cpp b/libyul/optimiser/BlockHasher.cpp index 53d263f944ab..4fb199982e9b 100644 --- a/libyul/optimiser/BlockHasher.cpp +++ b/libyul/optimiser/BlockHasher.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that calculates hash values for block prefixes. */ diff --git a/libyul/optimiser/BlockHasher.h b/libyul/optimiser/BlockHasher.h index 3b90f0c4de7a..36826e1583be 100644 --- a/libyul/optimiser/BlockHasher.h +++ b/libyul/optimiser/BlockHasher.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that calculates hash values for blocks. */ diff --git a/libyul/optimiser/CallGraphGenerator.cpp b/libyul/optimiser/CallGraphGenerator.cpp index 565518af093b..85fb1c66c9c9 100644 --- a/libyul/optimiser/CallGraphGenerator.cpp +++ b/libyul/optimiser/CallGraphGenerator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walker that generates the call graph. */ diff --git a/libyul/optimiser/CallGraphGenerator.h b/libyul/optimiser/CallGraphGenerator.h index 2b57f8592fde..11224eeaaebb 100644 --- a/libyul/optimiser/CallGraphGenerator.h +++ b/libyul/optimiser/CallGraphGenerator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walker that generates the call graph. */ diff --git a/libyul/optimiser/CircularReferencesPruner.cpp b/libyul/optimiser/CircularReferencesPruner.cpp index f9c849568b3b..2fe6a1d80734 100644 --- a/libyul/optimiser/CircularReferencesPruner.cpp +++ b/libyul/optimiser/CircularReferencesPruner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/optimiser/CircularReferencesPruner.h b/libyul/optimiser/CircularReferencesPruner.h index 2a51045d12e7..0602445af4ab 100644 --- a/libyul/optimiser/CircularReferencesPruner.h +++ b/libyul/optimiser/CircularReferencesPruner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimization stage that removes functions that call each other but are * otherwise unreferenced. diff --git a/libyul/optimiser/CommonSubexpressionEliminator.h b/libyul/optimiser/CommonSubexpressionEliminator.h index 04fc36a8ca71..f11de51a4281 100644 --- a/libyul/optimiser/CommonSubexpressionEliminator.h +++ b/libyul/optimiser/CommonSubexpressionEliminator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces expressions known to be the current value of a variable * in scope by a reference to that variable. diff --git a/libyul/optimiser/ConditionalSimplifier.cpp b/libyul/optimiser/ConditionalSimplifier.cpp index 453d2d9ce6ef..f95ef830a726 100644 --- a/libyul/optimiser/ConditionalSimplifier.cpp +++ b/libyul/optimiser/ConditionalSimplifier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/ConditionalSimplifier.h b/libyul/optimiser/ConditionalSimplifier.h index 18f8a74b200c..9a48b813f90f 100644 --- a/libyul/optimiser/ConditionalSimplifier.h +++ b/libyul/optimiser/ConditionalSimplifier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/ConditionalUnsimplifier.cpp b/libyul/optimiser/ConditionalUnsimplifier.cpp index f11079032123..28bc11a0c0e2 100644 --- a/libyul/optimiser/ConditionalUnsimplifier.cpp +++ b/libyul/optimiser/ConditionalUnsimplifier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/ConditionalUnsimplifier.h b/libyul/optimiser/ConditionalUnsimplifier.h index 116ab2536406..975011b957a7 100644 --- a/libyul/optimiser/ConditionalUnsimplifier.h +++ b/libyul/optimiser/ConditionalUnsimplifier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/ControlFlowSimplifier.cpp b/libyul/optimiser/ControlFlowSimplifier.cpp index 1d6b096155fb..044061d9d077 100644 --- a/libyul/optimiser/ControlFlowSimplifier.cpp +++ b/libyul/optimiser/ControlFlowSimplifier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/ControlFlowSimplifier.h b/libyul/optimiser/ControlFlowSimplifier.h index f8ea1af1ec24..3ebbe7c9aeee 100644 --- a/libyul/optimiser/ControlFlowSimplifier.h +++ b/libyul/optimiser/ControlFlowSimplifier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/DataFlowAnalyzer.h b/libyul/optimiser/DataFlowAnalyzer.h index d3cb8d28048f..237b4859701d 100644 --- a/libyul/optimiser/DataFlowAnalyzer.h +++ b/libyul/optimiser/DataFlowAnalyzer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Base class to perform data flow analysis during AST walks. * Tracks assignments and is used as base class for both Rematerialiser and diff --git a/libyul/optimiser/DeadCodeEliminator.cpp b/libyul/optimiser/DeadCodeEliminator.cpp index 2416af514f58..1bb4f460d278 100644 --- a/libyul/optimiser/DeadCodeEliminator.cpp +++ b/libyul/optimiser/DeadCodeEliminator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that removes unreachable code. */ diff --git a/libyul/optimiser/DeadCodeEliminator.h b/libyul/optimiser/DeadCodeEliminator.h index d1607b49e671..d47bf86ea8f8 100644 --- a/libyul/optimiser/DeadCodeEliminator.h +++ b/libyul/optimiser/DeadCodeEliminator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that removes unused variables and functions. */ diff --git a/libyul/optimiser/Disambiguator.cpp b/libyul/optimiser/Disambiguator.cpp index 50aa93599aef..2e20d4be29ad 100644 --- a/libyul/optimiser/Disambiguator.cpp +++ b/libyul/optimiser/Disambiguator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that makes all identifiers unique. */ diff --git a/libyul/optimiser/Disambiguator.h b/libyul/optimiser/Disambiguator.h index 997a9cf2006e..6d8a3775cff4 100644 --- a/libyul/optimiser/Disambiguator.h +++ b/libyul/optimiser/Disambiguator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that makes all identifiers unique. */ diff --git a/libyul/optimiser/EquivalentFunctionCombiner.cpp b/libyul/optimiser/EquivalentFunctionCombiner.cpp index d62768a25bee..8cea5d63edda 100644 --- a/libyul/optimiser/EquivalentFunctionCombiner.cpp +++ b/libyul/optimiser/EquivalentFunctionCombiner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that combines syntactically equivalent functions. */ diff --git a/libyul/optimiser/EquivalentFunctionCombiner.h b/libyul/optimiser/EquivalentFunctionCombiner.h index 19ddbd71ff96..d43fa3986ed3 100644 --- a/libyul/optimiser/EquivalentFunctionCombiner.h +++ b/libyul/optimiser/EquivalentFunctionCombiner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that combines syntactically equivalent functions. */ diff --git a/libyul/optimiser/EquivalentFunctionDetector.cpp b/libyul/optimiser/EquivalentFunctionDetector.cpp index 6c617a4e4387..5c49ddb89fdf 100644 --- a/libyul/optimiser/EquivalentFunctionDetector.cpp +++ b/libyul/optimiser/EquivalentFunctionDetector.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that combines syntactically equivalent functions. */ diff --git a/libyul/optimiser/EquivalentFunctionDetector.h b/libyul/optimiser/EquivalentFunctionDetector.h index 62825bcfa4b3..107b355e6048 100644 --- a/libyul/optimiser/EquivalentFunctionDetector.h +++ b/libyul/optimiser/EquivalentFunctionDetector.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that combines syntactically equivalent functions. */ diff --git a/libyul/optimiser/ExpressionInliner.cpp b/libyul/optimiser/ExpressionInliner.cpp index f17b594f3d9f..ca29a58290e4 100644 --- a/libyul/optimiser/ExpressionInliner.cpp +++ b/libyul/optimiser/ExpressionInliner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that performs function inlining inside expressions. */ diff --git a/libyul/optimiser/ExpressionInliner.h b/libyul/optimiser/ExpressionInliner.h index 92bdebffc14c..f3a8833dfc34 100644 --- a/libyul/optimiser/ExpressionInliner.h +++ b/libyul/optimiser/ExpressionInliner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that performs function inlining. */ diff --git a/libyul/optimiser/ExpressionJoiner.cpp b/libyul/optimiser/ExpressionJoiner.cpp index 45c23dcc3022..fa9aac9ceb50 100644 --- a/libyul/optimiser/ExpressionJoiner.cpp +++ b/libyul/optimiser/ExpressionJoiner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that undoes what the ExpressionSplitter did, i.e. * it more or less inlines variable declarations. diff --git a/libyul/optimiser/ExpressionJoiner.h b/libyul/optimiser/ExpressionJoiner.h index 709a822e7dcf..db3217de0aee 100644 --- a/libyul/optimiser/ExpressionJoiner.h +++ b/libyul/optimiser/ExpressionJoiner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that undoes what the ExpressionSplitter did, i.e. * it more or less inlines variable declarations. diff --git a/libyul/optimiser/ExpressionSimplifier.cpp b/libyul/optimiser/ExpressionSimplifier.cpp index da30560575fe..ec3a6eb78ce1 100644 --- a/libyul/optimiser/ExpressionSimplifier.cpp +++ b/libyul/optimiser/ExpressionSimplifier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that uses the simplification rules to simplify expressions. */ diff --git a/libyul/optimiser/ExpressionSimplifier.h b/libyul/optimiser/ExpressionSimplifier.h index ce83b4e1eb39..b8703e2a27f3 100644 --- a/libyul/optimiser/ExpressionSimplifier.h +++ b/libyul/optimiser/ExpressionSimplifier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that uses the simplification rules to simplify expressions. */ diff --git a/libyul/optimiser/ExpressionSplitter.cpp b/libyul/optimiser/ExpressionSplitter.cpp index 30a5fd5e9e82..2c15b6eb528b 100644 --- a/libyul/optimiser/ExpressionSplitter.cpp +++ b/libyul/optimiser/ExpressionSplitter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that turns complex expressions into multiple variable * declarations. diff --git a/libyul/optimiser/ExpressionSplitter.h b/libyul/optimiser/ExpressionSplitter.h index 107be25905d4..ebcdd7f6d394 100644 --- a/libyul/optimiser/ExpressionSplitter.h +++ b/libyul/optimiser/ExpressionSplitter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that turns complex expressions into multiple variable * declarations. diff --git a/libyul/optimiser/ForLoopConditionIntoBody.cpp b/libyul/optimiser/ForLoopConditionIntoBody.cpp index 22c3e76dce08..a5b907ce71b8 100644 --- a/libyul/optimiser/ForLoopConditionIntoBody.cpp +++ b/libyul/optimiser/ForLoopConditionIntoBody.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/optimiser/ForLoopConditionIntoBody.h b/libyul/optimiser/ForLoopConditionIntoBody.h index 633403c967a9..2a9c92c23783 100644 --- a/libyul/optimiser/ForLoopConditionIntoBody.h +++ b/libyul/optimiser/ForLoopConditionIntoBody.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/ForLoopConditionOutOfBody.cpp b/libyul/optimiser/ForLoopConditionOutOfBody.cpp index fc7d48d6255d..f13b417e8b84 100644 --- a/libyul/optimiser/ForLoopConditionOutOfBody.cpp +++ b/libyul/optimiser/ForLoopConditionOutOfBody.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/optimiser/ForLoopConditionOutOfBody.h b/libyul/optimiser/ForLoopConditionOutOfBody.h index b5f8c8d023c6..ba3b7eb18309 100644 --- a/libyul/optimiser/ForLoopConditionOutOfBody.h +++ b/libyul/optimiser/ForLoopConditionOutOfBody.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/ForLoopInitRewriter.cpp b/libyul/optimiser/ForLoopInitRewriter.cpp index 163a999cd6ba..62d5201998de 100644 --- a/libyul/optimiser/ForLoopInitRewriter.cpp +++ b/libyul/optimiser/ForLoopInitRewriter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/ForLoopInitRewriter.h b/libyul/optimiser/ForLoopInitRewriter.h index e2143ca618c3..96ae0cca7e98 100644 --- a/libyul/optimiser/ForLoopInitRewriter.h +++ b/libyul/optimiser/ForLoopInitRewriter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp index a0c80533d139..2e9dd1e05044 100644 --- a/libyul/optimiser/FullInliner.cpp +++ b/libyul/optimiser/FullInliner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that performs function inlining for arbitrary functions. */ diff --git a/libyul/optimiser/FullInliner.h b/libyul/optimiser/FullInliner.h index 1c1ad0d95355..8092e478e57b 100644 --- a/libyul/optimiser/FullInliner.h +++ b/libyul/optimiser/FullInliner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that performs function inlining for arbitrary functions. */ diff --git a/libyul/optimiser/FunctionGrouper.cpp b/libyul/optimiser/FunctionGrouper.cpp index 60a1fa0130a8..86d59dd53455 100644 --- a/libyul/optimiser/FunctionGrouper.cpp +++ b/libyul/optimiser/FunctionGrouper.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that changes the code of a block so that all non-function definition * statements are moved to a block of their own followed by all function definitions. diff --git a/libyul/optimiser/FunctionGrouper.h b/libyul/optimiser/FunctionGrouper.h index ef36198936e7..0bfbb2f069f5 100644 --- a/libyul/optimiser/FunctionGrouper.h +++ b/libyul/optimiser/FunctionGrouper.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that changes the code of a black so that all non-function definition * instructions are moved to a block of their own followed by all function definitions. diff --git a/libyul/optimiser/FunctionHoister.cpp b/libyul/optimiser/FunctionHoister.cpp index 303cf1fb38a8..a02feeda8e4b 100644 --- a/libyul/optimiser/FunctionHoister.cpp +++ b/libyul/optimiser/FunctionHoister.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that changes the code so that it consists of a block starting with * a single block followed only by function definitions and with no functions defined diff --git a/libyul/optimiser/FunctionHoister.h b/libyul/optimiser/FunctionHoister.h index 7106c03a423e..39e692c8a516 100644 --- a/libyul/optimiser/FunctionHoister.h +++ b/libyul/optimiser/FunctionHoister.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that changes the code so that all function definitions are at the top * level block. diff --git a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp index c9a1f084b605..c7830d48098f 100644 --- a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp +++ b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that identifies functions to be inlined. */ diff --git a/libyul/optimiser/InlinableExpressionFunctionFinder.h b/libyul/optimiser/InlinableExpressionFunctionFinder.h index 0583107d1b30..3c0b768e67cf 100644 --- a/libyul/optimiser/InlinableExpressionFunctionFinder.h +++ b/libyul/optimiser/InlinableExpressionFunctionFinder.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that identifies functions to be inlined. */ diff --git a/libyul/optimiser/KnowledgeBase.cpp b/libyul/optimiser/KnowledgeBase.cpp index c68085420b4e..0692d0c0665a 100644 --- a/libyul/optimiser/KnowledgeBase.cpp +++ b/libyul/optimiser/KnowledgeBase.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Class that can answer questions about values of variables and their relations. */ diff --git a/libyul/optimiser/KnowledgeBase.h b/libyul/optimiser/KnowledgeBase.h index 8d7bcdd904ce..7d4cdfb6b860 100644 --- a/libyul/optimiser/KnowledgeBase.h +++ b/libyul/optimiser/KnowledgeBase.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Class that can answer questions about values of variables and their relations. */ diff --git a/libyul/optimiser/LoadResolver.cpp b/libyul/optimiser/LoadResolver.cpp index 4d40281ecebf..7635f9d61a11 100644 --- a/libyul/optimiser/LoadResolver.cpp +++ b/libyul/optimiser/LoadResolver.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces expressions of type ``sload(x)`` by the value * currently stored in storage, if known. diff --git a/libyul/optimiser/LoadResolver.h b/libyul/optimiser/LoadResolver.h index f2d11ed2a0f3..00579e95fb88 100644 --- a/libyul/optimiser/LoadResolver.h +++ b/libyul/optimiser/LoadResolver.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces expressions of type ``sload(x)`` by the value * currently stored in storage, if known. diff --git a/libyul/optimiser/LoopInvariantCodeMotion.cpp b/libyul/optimiser/LoopInvariantCodeMotion.cpp index b7d7874c28f4..9a81e5fc8d5e 100644 --- a/libyul/optimiser/LoopInvariantCodeMotion.cpp +++ b/libyul/optimiser/LoopInvariantCodeMotion.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/libyul/optimiser/LoopInvariantCodeMotion.h b/libyul/optimiser/LoopInvariantCodeMotion.h index 7b7bd6c88b7f..a3bf1784f822 100644 --- a/libyul/optimiser/LoopInvariantCodeMotion.h +++ b/libyul/optimiser/LoopInvariantCodeMotion.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/MainFunction.cpp b/libyul/optimiser/MainFunction.cpp index e91cadb4d036..83968651d174 100644 --- a/libyul/optimiser/MainFunction.cpp +++ b/libyul/optimiser/MainFunction.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Changes the topmost block to be a function with a specific name ("main") which has no * inputs nor outputs. diff --git a/libyul/optimiser/MainFunction.h b/libyul/optimiser/MainFunction.h index 771624bef85f..92781f81ccd7 100644 --- a/libyul/optimiser/MainFunction.h +++ b/libyul/optimiser/MainFunction.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Changes the topmost block to be a function with a specific name ("main") which has no * inputs nor outputs. diff --git a/libyul/optimiser/Metrics.h b/libyul/optimiser/Metrics.h index 19ca5616f0fb..5aa8dbe4b921 100644 --- a/libyul/optimiser/Metrics.h +++ b/libyul/optimiser/Metrics.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module providing metrics for the optimizer. */ diff --git a/libyul/optimiser/NameCollector.cpp b/libyul/optimiser/NameCollector.cpp index f9bb40bf491e..5c6f2ab79fc6 100644 --- a/libyul/optimiser/NameCollector.cpp +++ b/libyul/optimiser/NameCollector.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walker that collects all defined names. */ diff --git a/libyul/optimiser/NameCollector.h b/libyul/optimiser/NameCollector.h index a48aa1a3bdda..0bedab3f8ad4 100644 --- a/libyul/optimiser/NameCollector.h +++ b/libyul/optimiser/NameCollector.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walkers that collect facts about identifiers and definitions. */ diff --git a/libyul/optimiser/NameDispenser.cpp b/libyul/optimiser/NameDispenser.cpp index fb1c1dd1c997..cfc7fdcb961d 100644 --- a/libyul/optimiser/NameDispenser.cpp +++ b/libyul/optimiser/NameDispenser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that can create new unique names. */ diff --git a/libyul/optimiser/NameDispenser.h b/libyul/optimiser/NameDispenser.h index 372e4bd2c273..1ef8c92e7014 100644 --- a/libyul/optimiser/NameDispenser.h +++ b/libyul/optimiser/NameDispenser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that can create new unique names. */ diff --git a/libyul/optimiser/NameDisplacer.cpp b/libyul/optimiser/NameDisplacer.cpp index 052b011ef814..81248819cd3a 100644 --- a/libyul/optimiser/NameDisplacer.cpp +++ b/libyul/optimiser/NameDisplacer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that renames identifiers to free up certain names. */ diff --git a/libyul/optimiser/NameDisplacer.h b/libyul/optimiser/NameDisplacer.h index ba61cbf9d96d..d1b3e4363b07 100644 --- a/libyul/optimiser/NameDisplacer.h +++ b/libyul/optimiser/NameDisplacer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that renames identifiers to free up certain names. */ diff --git a/libyul/optimiser/OptimiserStep.h b/libyul/optimiser/OptimiserStep.h index ebad295515b4..3da161957d5d 100644 --- a/libyul/optimiser/OptimiserStep.h +++ b/libyul/optimiser/OptimiserStep.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libyul/optimiser/OptimizerUtilities.cpp b/libyul/optimiser/OptimizerUtilities.cpp index 132301696b98..3cb66d68930e 100644 --- a/libyul/optimiser/OptimizerUtilities.cpp +++ b/libyul/optimiser/OptimizerUtilities.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Some useful snippets for the optimiser. */ diff --git a/libyul/optimiser/OptimizerUtilities.h b/libyul/optimiser/OptimizerUtilities.h index 01bb7dae6d31..61d970877e72 100644 --- a/libyul/optimiser/OptimizerUtilities.h +++ b/libyul/optimiser/OptimizerUtilities.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Small useful snippets for the optimiser. */ diff --git a/libyul/optimiser/RedundantAssignEliminator.cpp b/libyul/optimiser/RedundantAssignEliminator.cpp index 5d1d0557b82b..170cf1d79772 100644 --- a/libyul/optimiser/RedundantAssignEliminator.cpp +++ b/libyul/optimiser/RedundantAssignEliminator.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that removes assignments to variables that are not used * until they go out of scope or are re-assigned. diff --git a/libyul/optimiser/RedundantAssignEliminator.h b/libyul/optimiser/RedundantAssignEliminator.h index 3d61e84fb254..81e977e8d2e5 100644 --- a/libyul/optimiser/RedundantAssignEliminator.h +++ b/libyul/optimiser/RedundantAssignEliminator.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that removes assignments to variables that are not used * until they go out of scope or are re-assigned. diff --git a/libyul/optimiser/Rematerialiser.h b/libyul/optimiser/Rematerialiser.h index 1316f0373bbc..b7e98a6b83d4 100644 --- a/libyul/optimiser/Rematerialiser.h +++ b/libyul/optimiser/Rematerialiser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that replaces variables by their most recently assigned expressions. */ diff --git a/libyul/optimiser/SSAReverser.cpp b/libyul/optimiser/SSAReverser.cpp index a4373fb667ab..decdc4ea4489 100644 --- a/libyul/optimiser/SSAReverser.cpp +++ b/libyul/optimiser/SSAReverser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/SSAReverser.h b/libyul/optimiser/SSAReverser.h index 0a6e0e1b01d0..bb6e98bc8ded 100644 --- a/libyul/optimiser/SSAReverser.h +++ b/libyul/optimiser/SSAReverser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/SSATransform.cpp b/libyul/optimiser/SSATransform.cpp index 21165cd47315..332b7af1dc87 100644 --- a/libyul/optimiser/SSATransform.cpp +++ b/libyul/optimiser/SSATransform.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that turns subsequent assignments to variable declarations * and assignments. diff --git a/libyul/optimiser/SSATransform.h b/libyul/optimiser/SSATransform.h index 201b1981a335..74e52b62ac92 100644 --- a/libyul/optimiser/SSATransform.h +++ b/libyul/optimiser/SSATransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser component that turns subsequent assignments to variable declarations * and assignments. diff --git a/libyul/optimiser/SSAValueTracker.cpp b/libyul/optimiser/SSAValueTracker.cpp index ec898ad3ce6f..452123447953 100644 --- a/libyul/optimiser/SSAValueTracker.cpp +++ b/libyul/optimiser/SSAValueTracker.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that collects variables that are never assigned to and their * initial values. diff --git a/libyul/optimiser/SSAValueTracker.h b/libyul/optimiser/SSAValueTracker.h index 24f4809478d5..f206cab5e89f 100644 --- a/libyul/optimiser/SSAValueTracker.h +++ b/libyul/optimiser/SSAValueTracker.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that collects variables that are never assigned to and their * initial values. diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 6100b1cdcf22..4a7b8db12875 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walkers that collect semantical facts. */ diff --git a/libyul/optimiser/Semantics.h b/libyul/optimiser/Semantics.h index 46d2984cab25..a4f7b810230a 100644 --- a/libyul/optimiser/Semantics.h +++ b/libyul/optimiser/Semantics.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST walkers that collect semantical facts. */ diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp index 7a9b6576a633..2fe5de3e546c 100644 --- a/libyul/optimiser/SimplificationRules.cpp +++ b/libyul/optimiser/SimplificationRules.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module for applying replacement rules against Expressions. */ diff --git a/libyul/optimiser/SimplificationRules.h b/libyul/optimiser/SimplificationRules.h index b897ed492b95..05e4e0d590bd 100644 --- a/libyul/optimiser/SimplificationRules.h +++ b/libyul/optimiser/SimplificationRules.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Module for applying replacement rules against Expressions. */ diff --git a/libyul/optimiser/StackCompressor.h b/libyul/optimiser/StackCompressor.h index 6c9f1ff9a148..f10a6ba1767b 100644 --- a/libyul/optimiser/StackCompressor.h +++ b/libyul/optimiser/StackCompressor.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that aggressively rematerializes certain variables ina a function to free * space on the stack until it is compilable. diff --git a/libyul/optimiser/StructuralSimplifier.cpp b/libyul/optimiser/StructuralSimplifier.cpp index 0d5da95c1c59..09fe9ca1fa16 100644 --- a/libyul/optimiser/StructuralSimplifier.cpp +++ b/libyul/optimiser/StructuralSimplifier.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include #include diff --git a/libyul/optimiser/StructuralSimplifier.h b/libyul/optimiser/StructuralSimplifier.h index 8b9df5beb17e..3fd59efde42c 100644 --- a/libyul/optimiser/StructuralSimplifier.h +++ b/libyul/optimiser/StructuralSimplifier.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/libyul/optimiser/Substitution.cpp b/libyul/optimiser/Substitution.cpp index 6a0dc4800f41..ee2323577954 100644 --- a/libyul/optimiser/Substitution.cpp +++ b/libyul/optimiser/Substitution.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST copier that replaces certain identifiers with expressions. */ diff --git a/libyul/optimiser/Substitution.h b/libyul/optimiser/Substitution.h index 369754fea2ee..f76dcc72ea47 100644 --- a/libyul/optimiser/Substitution.h +++ b/libyul/optimiser/Substitution.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Specific AST copier that replaces certain identifiers with expressions. */ diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index 9f2511e7232c..a12ecd194d96 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser suite that combines all steps and also provides the settings for the heuristics. */ diff --git a/libyul/optimiser/Suite.h b/libyul/optimiser/Suite.h index 790b2f9ad037..affbd37c0fd8 100644 --- a/libyul/optimiser/Suite.h +++ b/libyul/optimiser/Suite.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimiser suite that combines all steps and also provides the settings for the heuristics. */ diff --git a/libyul/optimiser/SyntacticalEquality.h b/libyul/optimiser/SyntacticalEquality.h index 7cf5dc24a37d..774a223cc3d3 100644 --- a/libyul/optimiser/SyntacticalEquality.h +++ b/libyul/optimiser/SyntacticalEquality.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Component that can compare ASTs for equality on a syntactic basis. */ diff --git a/libyul/optimiser/TypeInfo.cpp b/libyul/optimiser/TypeInfo.cpp index adb6e1ccef41..740856c72815 100644 --- a/libyul/optimiser/TypeInfo.cpp +++ b/libyul/optimiser/TypeInfo.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Helper class that keeps track of the types while performing optimizations. */ diff --git a/libyul/optimiser/TypeInfo.h b/libyul/optimiser/TypeInfo.h index 48c6c1fba820..f458cbe443e0 100644 --- a/libyul/optimiser/TypeInfo.h +++ b/libyul/optimiser/TypeInfo.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Helper class that keeps track of the types while performing optimizations. */ diff --git a/libyul/optimiser/UnusedPruner.h b/libyul/optimiser/UnusedPruner.h index 837088059db5..af77d911af85 100644 --- a/libyul/optimiser/UnusedPruner.h +++ b/libyul/optimiser/UnusedPruner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Optimisation stage that removes unused variables and functions. */ diff --git a/libyul/optimiser/VarDeclInitializer.cpp b/libyul/optimiser/VarDeclInitializer.cpp index 66c5b45056be..ca6c89feb7da 100644 --- a/libyul/optimiser/VarDeclInitializer.cpp +++ b/libyul/optimiser/VarDeclInitializer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/optimiser/VarDeclInitializer.h b/libyul/optimiser/VarDeclInitializer.h index 75bb1493c8ee..3d2d51c34df6 100644 --- a/libyul/optimiser/VarDeclInitializer.h +++ b/libyul/optimiser/VarDeclInitializer.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/libyul/optimiser/VarNameCleaner.cpp b/libyul/optimiser/VarNameCleaner.cpp index f9b9e7899048..15d215f2cf23 100644 --- a/libyul/optimiser/VarNameCleaner.cpp +++ b/libyul/optimiser/VarNameCleaner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/libyul/optimiser/VarNameCleaner.h b/libyul/optimiser/VarNameCleaner.h index 911f67ca66e4..2c26cc7a67bf 100644 --- a/libyul/optimiser/VarNameCleaner.h +++ b/libyul/optimiser/VarNameCleaner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 3bd374676e52..412d7f094e14 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @author Gav Wood diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 1aed728216f9..e79d8140688f 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris * @date 2014 diff --git a/solc/main.cpp b/solc/main.cpp index 5307e40ad0e0..ae56066edf92 100644 --- a/solc/main.cpp +++ b/solc/main.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/Common.cpp b/test/Common.cpp index 69bfd21ee447..b56cb3257734 100644 --- a/test/Common.cpp +++ b/test/Common.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/Common.h b/test/Common.h index 119050f393b6..eaad7f0bac64 100644 --- a/test/Common.h +++ b/test/Common.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/CommonSyntaxTest.cpp b/test/CommonSyntaxTest.cpp index ff99d6e24a62..34ddf719e403 100644 --- a/test/CommonSyntaxTest.cpp +++ b/test/CommonSyntaxTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/CommonSyntaxTest.h b/test/CommonSyntaxTest.h index df165ea1a3fc..db3a6e50c57e 100644 --- a/test/CommonSyntaxTest.h +++ b/test/CommonSyntaxTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/EVMHost.cpp b/test/EVMHost.cpp index 108dae4f1e43..51dc833521c9 100644 --- a/test/EVMHost.cpp +++ b/test/EVMHost.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * EVM execution host, i.e. component that implements a simulated Ethereum blockchain * for testing purposes. diff --git a/test/EVMHost.h b/test/EVMHost.h index 1e3540012834..af38426be19b 100644 --- a/test/EVMHost.h +++ b/test/EVMHost.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * EVM execution host, i.e. component that implements a simulated Ethereum blockchain * for testing purposes. diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index ebe63b2657c7..b3841f6b4d20 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index 6fea5310a7b8..56321a1190e3 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/InteractiveTests.h b/test/InteractiveTests.h index 4e836579653d..46d8a2973a79 100644 --- a/test/InteractiveTests.h +++ b/test/InteractiveTests.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/Metadata.cpp b/test/Metadata.cpp index cb5892b8af03..f70b8ea5f2dc 100644 --- a/test/Metadata.cpp +++ b/test/Metadata.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Metadata processing helpers. diff --git a/test/Metadata.h b/test/Metadata.h index f032f1d1f7cf..c91ceb559fa2 100644 --- a/test/Metadata.h +++ b/test/Metadata.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Metadata processing helpers. diff --git a/test/TestCase.cpp b/test/TestCase.cpp index e6f4b212aab5..7cf5c790eb09 100644 --- a/test/TestCase.cpp +++ b/test/TestCase.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/TestCase.h b/test/TestCase.h index f846b7f87f46..1815409fe018 100644 --- a/test/TestCase.h +++ b/test/TestCase.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/TestCaseReader.cpp b/test/TestCaseReader.cpp index 2f90678ed56e..7b3611d82f81 100644 --- a/test/TestCaseReader.cpp +++ b/test/TestCaseReader.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/TestCaseReader.h b/test/TestCaseReader.h index 9f94f898d642..720c26338c0a 100644 --- a/test/TestCaseReader.h +++ b/test/TestCaseReader.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 19cdfc423326..8f065a7bb5dd 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file boostTest.cpp * @author Marko Simovic * @date 2014 diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index 71e47aa0cd68..b3621238b63d 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/contracts/ContractInterface.h b/test/contracts/ContractInterface.h index 4d063947e99f..1bc1d9e39a74 100644 --- a/test/contracts/ContractInterface.h +++ b/test/contracts/ContractInterface.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index a2998379fb96..f953cda9a538 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 46800fa78522..503282094eef 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index cdb7046bef05..c2140ace6ae5 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Alex Beregszaszi * @date 2018 diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 4690ceddc0a3..741dc7523ff1 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/liblangutil/CharStream.cpp b/test/liblangutil/CharStream.cpp index 3b9d980c1fc8..d1189c3e99c7 100644 --- a/test/liblangutil/CharStream.cpp +++ b/test/liblangutil/CharStream.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Rocky Bernstein * @date 2019 diff --git a/test/liblangutil/SourceLocation.cpp b/test/liblangutil/SourceLocation.cpp index c5b47d0f682a..ff1664dfebe7 100644 --- a/test/liblangutil/SourceLocation.cpp +++ b/test/liblangutil/SourceLocation.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Yoichi Hirai * @date 2016 diff --git a/test/libsolidity/ABIDecoderTests.cpp b/test/libsolidity/ABIDecoderTests.cpp index 39bf7602c6ca..2c3711ea3b2d 100644 --- a/test/libsolidity/ABIDecoderTests.cpp +++ b/test/libsolidity/ABIDecoderTests.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for Solidity's ABI decoder. */ diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index 777f991a340c..b804a458df8b 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for Solidity's ABI encoder. */ diff --git a/test/libsolidity/ABIJsonTest.h b/test/libsolidity/ABIJsonTest.h index 702d36dbfe98..0cc7e674e796 100644 --- a/test/libsolidity/ABIJsonTest.h +++ b/test/libsolidity/ABIJsonTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the solidity compiler ABI JSON Interface output. */ diff --git a/test/libsolidity/ABITestsCommon.h b/test/libsolidity/ABITestsCommon.h index b2afcf125ce2..c5eea01ca4ea 100644 --- a/test/libsolidity/ABITestsCommon.h +++ b/test/libsolidity/ABITestsCommon.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp index 974e0f4863c9..979c79aa5c60 100644 --- a/test/libsolidity/ASTJSONTest.cpp +++ b/test/libsolidity/ASTJSONTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolidity/ASTJSONTest.h b/test/libsolidity/ASTJSONTest.h index 45d7a08b9c0b..4e74d79f376f 100644 --- a/test/libsolidity/ASTJSONTest.h +++ b/test/libsolidity/ASTJSONTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libsolidity/AnalysisFramework.cpp b/test/libsolidity/AnalysisFramework.cpp index 80c20c760733..bd28de2401cd 100644 --- a/test/libsolidity/AnalysisFramework.cpp +++ b/test/libsolidity/AnalysisFramework.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Framework for testing features from the analysis phase of compiler. */ diff --git a/test/libsolidity/AnalysisFramework.h b/test/libsolidity/AnalysisFramework.h index db75ad3017a1..293e0e17c562 100644 --- a/test/libsolidity/AnalysisFramework.h +++ b/test/libsolidity/AnalysisFramework.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Framework for testing features from the analysis phase of compiler. */ diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 23bf1a2f829a..12e088fac1d5 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Lefteris Karapetsas * @date 2015 diff --git a/test/libsolidity/ErrorCheck.cpp b/test/libsolidity/ErrorCheck.cpp index 1f51006ed74e..42b527e5bf82 100644 --- a/test/libsolidity/ErrorCheck.cpp +++ b/test/libsolidity/ErrorCheck.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file ErrorCheck.cpp * @author Yoichi Hirai * @date 2016 diff --git a/test/libsolidity/ErrorCheck.h b/test/libsolidity/ErrorCheck.h index 5deae56dc901..e01c2ca52484 100644 --- a/test/libsolidity/ErrorCheck.h +++ b/test/libsolidity/ErrorCheck.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file ErrorCheck.h * @author Yoichi Hirai * @date 2016 diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index 252b7759be17..2ad1368a6911 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Tests that check that the cost of certain operations stay within range. */ diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 09e257664546..c8296beb14ee 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/libsolidity/GasTest.cpp b/test/libsolidity/GasTest.cpp index d76979c9c7b6..f996f7352283 100644 --- a/test/libsolidity/GasTest.cpp +++ b/test/libsolidity/GasTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolidity/GasTest.h b/test/libsolidity/GasTest.h index d8bd0acadda0..da14e529286f 100644 --- a/test/libsolidity/GasTest.h +++ b/test/libsolidity/GasTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp index aa4cab9b8332..bbbefb33e9db 100644 --- a/test/libsolidity/Imports.cpp +++ b/test/libsolidity/Imports.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp index 9802e37c23d1..3375f8f92d7c 100644 --- a/test/libsolidity/LibSolc.cpp +++ b/test/libsolidity/LibSolc.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Unit tests for libsolc/libsolc.cpp. diff --git a/test/libsolidity/SMTCheckerJSONTest.cpp b/test/libsolidity/SMTCheckerJSONTest.cpp index e1b977cf5ecc..ca6608905d12 100644 --- a/test/libsolidity/SMTCheckerJSONTest.cpp +++ b/test/libsolidity/SMTCheckerJSONTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolidity/SMTCheckerJSONTest.h b/test/libsolidity/SMTCheckerJSONTest.h index b5d199e7ddbd..6de7f36c9573 100644 --- a/test/libsolidity/SMTCheckerJSONTest.h +++ b/test/libsolidity/SMTCheckerJSONTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libsolidity/SMTCheckerTest.cpp b/test/libsolidity/SMTCheckerTest.cpp index ac858747da16..51d1e7b364a4 100644 --- a/test/libsolidity/SMTCheckerTest.cpp +++ b/test/libsolidity/SMTCheckerTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolidity/SMTCheckerTest.h b/test/libsolidity/SMTCheckerTest.h index b710cde45b54..522abb677106 100644 --- a/test/libsolidity/SMTCheckerTest.h +++ b/test/libsolidity/SMTCheckerTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libsolidity/SemVerMatcher.cpp b/test/libsolidity/SemVerMatcher.cpp index 36b9c82147a3..a3e1661ef8df 100644 --- a/test/libsolidity/SemVerMatcher.cpp +++ b/test/libsolidity/SemVerMatcher.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index d449cd27e321..59f01096d4e6 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @author Gav Wood diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 2d0ae44dadca..d0f4227cc1e7 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2016 diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 5be310c87760..9efe22b2096e 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 10083b8274ae..a1db40747783 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index c4f7a2e71481..952eac9402bc 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2014 diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index bc9f169046ac..b837b3878af8 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @author Christian * @date 2015 diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 0b2098097616..570350466356 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Unit tests for interface/StandardCompiler.h. diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 48a293b65446..c554366e955a 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolidity/SyntaxTest.h b/test/libsolidity/SyntaxTest.h index dbc5d68b3440..b71691bea121 100644 --- a/test/libsolidity/SyntaxTest.h +++ b/test/libsolidity/SyntaxTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index 7416ca9a2874..d095a0a7647c 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libsolidity/util/ContractABIUtils.cpp b/test/libsolidity/util/ContractABIUtils.cpp index 2e600e4c181d..a3a19e6e5129 100644 --- a/test/libsolidity/util/ContractABIUtils.cpp +++ b/test/libsolidity/util/ContractABIUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libsolidity/util/TestFileParser.cpp b/test/libsolidity/util/TestFileParser.cpp index 52e4156aabfe..046193d39112 100644 --- a/test/libsolidity/util/TestFileParser.cpp +++ b/test/libsolidity/util/TestFileParser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libsolidity/util/TestFileParserTests.cpp b/test/libsolidity/util/TestFileParserTests.cpp index 4fb44d7cdd07..6b3ba2d7a67f 100644 --- a/test/libsolidity/util/TestFileParserTests.cpp +++ b/test/libsolidity/util/TestFileParserTests.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for Solidity's test expectation parser. */ diff --git a/test/libsolidity/util/TestFunctionCallTests.cpp b/test/libsolidity/util/TestFunctionCallTests.cpp index 7b34cbe8ecd5..dc3030384f54 100644 --- a/test/libsolidity/util/TestFunctionCallTests.cpp +++ b/test/libsolidity/util/TestFunctionCallTests.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libsolutil/Checksum.cpp b/test/libsolutil/Checksum.cpp index 159c55efc858..ab7ccf631a01 100644 --- a/test/libsolutil/Checksum.cpp +++ b/test/libsolutil/Checksum.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the address checksum. */ diff --git a/test/libsolutil/CommonData.cpp b/test/libsolutil/CommonData.cpp index d8434c79d16c..670a71d14c71 100644 --- a/test/libsolutil/CommonData.cpp +++ b/test/libsolutil/CommonData.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the StringUtils routines. */ diff --git a/test/libsolutil/IndentedWriter.cpp b/test/libsolutil/IndentedWriter.cpp index 3d0963e9ff23..0938f9617592 100644 --- a/test/libsolutil/IndentedWriter.cpp +++ b/test/libsolutil/IndentedWriter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for IndentedWriter. */ diff --git a/test/libsolutil/IpfsHash.cpp b/test/libsolutil/IpfsHash.cpp index 40385d43f7e7..c99650a4b06d 100644 --- a/test/libsolutil/IpfsHash.cpp +++ b/test/libsolutil/IpfsHash.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the ipfs hash computation routine. */ diff --git a/test/libsolutil/IterateReplacing.cpp b/test/libsolutil/IterateReplacing.cpp index e28091c7601a..a54841560960 100644 --- a/test/libsolutil/IterateReplacing.cpp +++ b/test/libsolutil/IterateReplacing.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the iterateReplacing function */ diff --git a/test/libsolutil/JSON.cpp b/test/libsolutil/JSON.cpp index d0e86c3c7501..6663978774f1 100644 --- a/test/libsolutil/JSON.cpp +++ b/test/libsolutil/JSON.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2018 * Unit tests for JSON.h. diff --git a/test/libsolutil/Keccak256.cpp b/test/libsolutil/Keccak256.cpp index bad8510c5e78..17de6c885273 100644 --- a/test/libsolutil/Keccak256.cpp +++ b/test/libsolutil/Keccak256.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for keccak256. */ diff --git a/test/libsolutil/LazyInit.cpp b/test/libsolutil/LazyInit.cpp index ec170946de4c..51ee3ee1e720 100644 --- a/test/libsolutil/LazyInit.cpp +++ b/test/libsolutil/LazyInit.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libsolutil/StringUtils.cpp b/test/libsolutil/StringUtils.cpp index a9c03acd9d34..f678c0da7716 100644 --- a/test/libsolutil/StringUtils.cpp +++ b/test/libsolutil/StringUtils.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the StringUtils routines. */ diff --git a/test/libsolutil/SwarmHash.cpp b/test/libsolutil/SwarmHash.cpp index cacb04adfac3..3b13cd38213b 100644 --- a/test/libsolutil/SwarmHash.cpp +++ b/test/libsolutil/SwarmHash.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the swarm hash computation routine. */ diff --git a/test/libsolutil/UTF8.cpp b/test/libsolutil/UTF8.cpp index 94ec6c6d7886..d6a14bcff804 100644 --- a/test/libsolutil/UTF8.cpp +++ b/test/libsolutil/UTF8.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for UTF-8 validation. */ diff --git a/test/libsolutil/Whiskers.cpp b/test/libsolutil/Whiskers.cpp index 3ed87acb9a35..1cc889127797 100644 --- a/test/libsolutil/Whiskers.cpp +++ b/test/libsolutil/Whiskers.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Unit tests for the mini moustache class. */ diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index 9ef203dd0ead..dd732f9a8c8e 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libyul/EwasmTranslationTest.h b/test/libyul/EwasmTranslationTest.h index e0a90482bc46..f6307bdbc5c4 100644 --- a/test/libyul/EwasmTranslationTest.h +++ b/test/libyul/EwasmTranslationTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libyul/FunctionSideEffects.cpp b/test/libyul/FunctionSideEffects.cpp index aa7d1e503927..56051ffddc66 100644 --- a/test/libyul/FunctionSideEffects.cpp +++ b/test/libyul/FunctionSideEffects.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libyul/FunctionSideEffects.h b/test/libyul/FunctionSideEffects.h index 23bebebcc846..ac0653733f03 100644 --- a/test/libyul/FunctionSideEffects.h +++ b/test/libyul/FunctionSideEffects.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index de47f48854db..f44d86618f82 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * @date 2017 * Unit tests for the Yul function inliner. diff --git a/test/libyul/ObjectCompilerTest.cpp b/test/libyul/ObjectCompilerTest.cpp index 4b34da7b11bd..950c0210f04e 100644 --- a/test/libyul/ObjectCompilerTest.cpp +++ b/test/libyul/ObjectCompilerTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libyul/ObjectCompilerTest.h b/test/libyul/ObjectCompilerTest.h index 4a1c75486b1e..85a46a1cf3df 100644 --- a/test/libyul/ObjectCompilerTest.h +++ b/test/libyul/ObjectCompilerTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libyul/SyntaxTest.cpp b/test/libyul/SyntaxTest.cpp index 944ceaf33bb7..bb0751b828df 100644 --- a/test/libyul/SyntaxTest.cpp +++ b/test/libyul/SyntaxTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/libyul/SyntaxTest.h b/test/libyul/SyntaxTest.h index 342aa28458c0..7234e1f2c6bf 100644 --- a/test/libyul/SyntaxTest.h +++ b/test/libyul/SyntaxTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libyul/YulInterpreterTest.cpp b/test/libyul/YulInterpreterTest.cpp index fa84c0869997..78e81578569b 100644 --- a/test/libyul/YulInterpreterTest.cpp +++ b/test/libyul/YulInterpreterTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libyul/YulInterpreterTest.h b/test/libyul/YulInterpreterTest.h index ee60abe17671..88e535fb0138 100644 --- a/test/libyul/YulInterpreterTest.h +++ b/test/libyul/YulInterpreterTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 95d7bee64c0c..436c46a656ac 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/libyul/YulOptimizerTest.h b/test/libyul/YulOptimizerTest.h index 3d351c3a2c06..5bba65682cef 100644 --- a/test/libyul/YulOptimizerTest.h +++ b/test/libyul/YulOptimizerTest.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/test/tools/IsolTestOptions.cpp b/test/tools/IsolTestOptions.cpp index 28552a86ad45..84e2babe921e 100644 --- a/test/tools/IsolTestOptions.cpp +++ b/test/tools/IsolTestOptions.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file IsolTestOptions.cpp * @date 2019 */ diff --git a/test/tools/IsolTestOptions.h b/test/tools/IsolTestOptions.h index 93d365191500..118ac95d3ec2 100644 --- a/test/tools/IsolTestOptions.h +++ b/test/tools/IsolTestOptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** @file IsolTestOptions.h */ diff --git a/test/tools/afl_fuzzer.cpp b/test/tools/afl_fuzzer.cpp index 81c3a2bfca1a..ea4a5a8283b1 100644 --- a/test/tools/afl_fuzzer.cpp +++ b/test/tools/afl_fuzzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Executable for use with AFL . */ diff --git a/test/tools/fuzzer_common.cpp b/test/tools/fuzzer_common.cpp index ac2e13775f34..437ab5d2299b 100644 --- a/test/tools/fuzzer_common.cpp +++ b/test/tools/fuzzer_common.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/fuzzer_common.h b/test/tools/fuzzer_common.h index 801c8c1c18bd..c8749d9b1c97 100644 --- a/test/tools/fuzzer_common.h +++ b/test/tools/fuzzer_common.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 07802edf12f9..3bdb16b0f4e9 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/abiV2Proto.proto b/test/tools/ossfuzz/abiV2Proto.proto index b581c9904bd3..b6640bbe977c 100644 --- a/test/tools/ossfuzz/abiV2Proto.proto +++ b/test/tools/ossfuzz/abiV2Proto.proto @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 syntax = "proto2"; diff --git a/test/tools/ossfuzz/abiV2ProtoFuzzer.cpp b/test/tools/ossfuzz/abiV2ProtoFuzzer.cpp index 89d5a35660b9..8c529630f8c4 100644 --- a/test/tools/ossfuzz/abiV2ProtoFuzzer.cpp +++ b/test/tools/ossfuzz/abiV2ProtoFuzzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/const_opt_ossfuzz.cpp b/test/tools/ossfuzz/const_opt_ossfuzz.cpp index 13ceb840851b..60b1febbc52c 100644 --- a/test/tools/ossfuzz/const_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/const_opt_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/ossfuzz/protoToSol.cpp b/test/tools/ossfuzz/protoToSol.cpp index aefbb41b9b5a..73ed34b0d352 100644 --- a/test/tools/ossfuzz/protoToSol.cpp +++ b/test/tools/ossfuzz/protoToSol.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/ossfuzz/protoToSol.h b/test/tools/ossfuzz/protoToSol.h index de2220752210..39f830528c8e 100644 --- a/test/tools/ossfuzz/protoToSol.h +++ b/test/tools/ossfuzz/protoToSol.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 5d19d470c0a0..1d78dc8020a7 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 950dd97a94cd..9b8de148057d 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/solProto.proto b/test/tools/ossfuzz/solProto.proto index 86e938c7c806..59d989cf903b 100644 --- a/test/tools/ossfuzz/solProto.proto +++ b/test/tools/ossfuzz/solProto.proto @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 syntax = "proto2"; diff --git a/test/tools/ossfuzz/solProtoFuzzer.cpp b/test/tools/ossfuzz/solProtoFuzzer.cpp index 663a94d36fd9..e9e77dcc4fe0 100644 --- a/test/tools/ossfuzz/solProtoFuzzer.cpp +++ b/test/tools/ossfuzz/solProtoFuzzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp index efed3769f58e..e2f3a294f442 100644 --- a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp index fc431ffe56d0..bff19407fedb 100644 --- a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp index b9373a3010b7..458bde745996 100644 --- a/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp index b4211dfc9f92..bd6d249b3523 100644 --- a/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp index a8378f72e995..646e6ea6a5a2 100644 --- a/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/yulFuzzerCommon.cpp b/test/tools/ossfuzz/yulFuzzerCommon.cpp index 3682eef48520..86cea8327f97 100644 --- a/test/tools/ossfuzz/yulFuzzerCommon.cpp +++ b/test/tools/ossfuzz/yulFuzzerCommon.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include using namespace std; diff --git a/test/tools/ossfuzz/yulFuzzerCommon.h b/test/tools/ossfuzz/yulFuzzerCommon.h index 08e17e3817af..cc20d6163ab6 100644 --- a/test/tools/ossfuzz/yulFuzzerCommon.h +++ b/test/tools/ossfuzz/yulFuzzerCommon.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/tools/ossfuzz/yulProto.proto b/test/tools/ossfuzz/yulProto.proto index 3180b421a0ce..d87d067f2677 100644 --- a/test/tools/ossfuzz/yulProto.proto +++ b/test/tools/ossfuzz/yulProto.proto @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 syntax = "proto2"; diff --git a/test/tools/ossfuzz/yulProtoFuzzer.cpp b/test/tools/ossfuzz/yulProtoFuzzer.cpp index cc0205d168e2..1095994bf13a 100644 --- a/test/tools/ossfuzz/yulProtoFuzzer.cpp +++ b/test/tools/ossfuzz/yulProtoFuzzer.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp index e5e6b203f790..4c8ddb94f18b 100644 --- a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 956db124f7fa..cda99f1de57f 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter module that evaluates EVM instructions. */ diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.h b/test/tools/yulInterpreter/EVMInstructionInterpreter.h index 02104178b5d7..05d27df9616e 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.h +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter module that evaluates EVM instructions. */ diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index 0f6524df6536..61c7b4817c04 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter module that evaluates Ewasm builtins. */ diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h index 62b6bc0245ab..78cf9216e0e7 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter module that evaluates Ewasm builtins. */ diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index cd4fa5d692cf..ba946e732d56 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter. */ diff --git a/test/tools/yulInterpreter/Interpreter.h b/test/tools/yulInterpreter/Interpreter.h index 3c9619d21675..a52c098ede50 100644 --- a/test/tools/yulInterpreter/Interpreter.h +++ b/test/tools/yulInterpreter/Interpreter.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter. */ diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index 9f5d560852e5..e4605d10f896 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Interactive yul optimizer */ diff --git a/test/tools/yulrun.cpp b/test/tools/yulrun.cpp index 494115540707..e682e98bac85 100644 --- a/test/tools/yulrun.cpp +++ b/test/tools/yulrun.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Yul interpreter. */ diff --git a/test/yulPhaser/AlgorithmRunner.cpp b/test/yulPhaser/AlgorithmRunner.cpp index 0cd731aefe49..cb8f7633ed0b 100644 --- a/test/yulPhaser/AlgorithmRunner.cpp +++ b/test/yulPhaser/AlgorithmRunner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Chromosome.cpp b/test/yulPhaser/Chromosome.cpp index 94b95d82c2c6..ecf754e8e7d4 100644 --- a/test/yulPhaser/Chromosome.cpp +++ b/test/yulPhaser/Chromosome.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Common.cpp b/test/yulPhaser/Common.cpp index b24143a94748..417b9ce3c2be 100644 --- a/test/yulPhaser/Common.cpp +++ b/test/yulPhaser/Common.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/FitnessMetrics.cpp b/test/yulPhaser/FitnessMetrics.cpp index 73a92fb40978..7c1ae2d96b33 100644 --- a/test/yulPhaser/FitnessMetrics.cpp +++ b/test/yulPhaser/FitnessMetrics.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/GeneticAlgorithms.cpp b/test/yulPhaser/GeneticAlgorithms.cpp index 473a6c0099c6..cfac86db04f7 100644 --- a/test/yulPhaser/GeneticAlgorithms.cpp +++ b/test/yulPhaser/GeneticAlgorithms.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Mutations.cpp b/test/yulPhaser/Mutations.cpp index 2d6b65c88c4c..dfdd600a3f3c 100644 --- a/test/yulPhaser/Mutations.cpp +++ b/test/yulPhaser/Mutations.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/PairSelections.cpp b/test/yulPhaser/PairSelections.cpp index a63704cf55f0..f3d13a5b3b27 100644 --- a/test/yulPhaser/PairSelections.cpp +++ b/test/yulPhaser/PairSelections.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Phaser.cpp b/test/yulPhaser/Phaser.cpp index f1e0fd96a389..673c43824a75 100644 --- a/test/yulPhaser/Phaser.cpp +++ b/test/yulPhaser/Phaser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Population.cpp b/test/yulPhaser/Population.cpp index fb6d45940dd3..955ccc49bd65 100644 --- a/test/yulPhaser/Population.cpp +++ b/test/yulPhaser/Population.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/Program.cpp b/test/yulPhaser/Program.cpp index d951c4e4e697..b7dd1f8edce9 100644 --- a/test/yulPhaser/Program.cpp +++ b/test/yulPhaser/Program.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/ProgramCache.cpp b/test/yulPhaser/ProgramCache.cpp index da4b7c18cd06..7fb74fca9ef6 100644 --- a/test/yulPhaser/ProgramCache.cpp +++ b/test/yulPhaser/ProgramCache.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/test/yulPhaser/Selections.cpp b/test/yulPhaser/Selections.cpp index 7fdea619234a..e5ef00327c82 100644 --- a/test/yulPhaser/Selections.cpp +++ b/test/yulPhaser/Selections.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/SimulationRNG.cpp b/test/yulPhaser/SimulationRNG.cpp index 306074b3c191..36a04612e310 100644 --- a/test/yulPhaser/SimulationRNG.cpp +++ b/test/yulPhaser/SimulationRNG.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/TestHelpers.cpp b/test/yulPhaser/TestHelpers.cpp index 2f4b40b02bbe..348973a48a24 100644 --- a/test/yulPhaser/TestHelpers.cpp +++ b/test/yulPhaser/TestHelpers.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/test/yulPhaser/TestHelpers.h b/test/yulPhaser/TestHelpers.h index 514d2eda76bd..732e4ec7a71d 100644 --- a/test/yulPhaser/TestHelpers.h +++ b/test/yulPhaser/TestHelpers.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Miscellaneous utilities for use in yul-phaser's test cases. * diff --git a/test/yulPhaser/TestHelpersTest.cpp b/test/yulPhaser/TestHelpersTest.cpp index 09b722517315..b90d65f5e75c 100644 --- a/test/yulPhaser/TestHelpersTest.cpp +++ b/test/yulPhaser/TestHelpersTest.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/solidityUpgrade/SourceTransform.h b/tools/solidityUpgrade/SourceTransform.h index a33a1d97ed15..57181198390d 100644 --- a/tools/solidityUpgrade/SourceTransform.h +++ b/tools/solidityUpgrade/SourceTransform.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/solidityUpgrade/SourceUpgrade.cpp b/tools/solidityUpgrade/SourceUpgrade.cpp index 7005fd336155..5379f4b705a0 100644 --- a/tools/solidityUpgrade/SourceUpgrade.cpp +++ b/tools/solidityUpgrade/SourceUpgrade.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/solidityUpgrade/SourceUpgrade.h b/tools/solidityUpgrade/SourceUpgrade.h index 9ace60e575af..e5ad378b3326 100644 --- a/tools/solidityUpgrade/SourceUpgrade.h +++ b/tools/solidityUpgrade/SourceUpgrade.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/tools/solidityUpgrade/Upgrade050.cpp b/tools/solidityUpgrade/Upgrade050.cpp index 18a495080819..8e1a2f0273ff 100644 --- a/tools/solidityUpgrade/Upgrade050.cpp +++ b/tools/solidityUpgrade/Upgrade050.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/solidityUpgrade/Upgrade050.h b/tools/solidityUpgrade/Upgrade050.h index 58670e7b2096..a678b04e5a6e 100644 --- a/tools/solidityUpgrade/Upgrade050.h +++ b/tools/solidityUpgrade/Upgrade050.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/tools/solidityUpgrade/Upgrade060.cpp b/tools/solidityUpgrade/Upgrade060.cpp index 30214ddfccfd..58aa94d15fbd 100644 --- a/tools/solidityUpgrade/Upgrade060.cpp +++ b/tools/solidityUpgrade/Upgrade060.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/solidityUpgrade/Upgrade060.h b/tools/solidityUpgrade/Upgrade060.h index e2386d104b66..9a8880b9628c 100644 --- a/tools/solidityUpgrade/Upgrade060.h +++ b/tools/solidityUpgrade/Upgrade060.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/tools/solidityUpgrade/UpgradeChange.cpp b/tools/solidityUpgrade/UpgradeChange.cpp index a897a4e130dc..a4036f77535e 100644 --- a/tools/solidityUpgrade/UpgradeChange.cpp +++ b/tools/solidityUpgrade/UpgradeChange.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/solidityUpgrade/UpgradeSuite.h b/tools/solidityUpgrade/UpgradeSuite.h index b9b094e70e43..33aeb40ebab9 100644 --- a/tools/solidityUpgrade/UpgradeSuite.h +++ b/tools/solidityUpgrade/UpgradeSuite.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once #include diff --git a/tools/solidityUpgrade/main.cpp b/tools/solidityUpgrade/main.cpp index 0f2b7a473500..d13639b9af85 100644 --- a/tools/solidityUpgrade/main.cpp +++ b/tools/solidityUpgrade/main.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/yulPhaser/AlgorithmRunner.cpp b/tools/yulPhaser/AlgorithmRunner.cpp index 402735e0d2c3..d5ad75575c54 100644 --- a/tools/yulPhaser/AlgorithmRunner.cpp +++ b/tools/yulPhaser/AlgorithmRunner.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/AlgorithmRunner.h b/tools/yulPhaser/AlgorithmRunner.h index 4326ce227b5e..71f71bb3d1b7 100644 --- a/tools/yulPhaser/AlgorithmRunner.h +++ b/tools/yulPhaser/AlgorithmRunner.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains the implementation of a class that manages the execution of a genetic algorithm. */ diff --git a/tools/yulPhaser/Chromosome.cpp b/tools/yulPhaser/Chromosome.cpp index 832c2cf804b8..453c62d39a30 100644 --- a/tools/yulPhaser/Chromosome.cpp +++ b/tools/yulPhaser/Chromosome.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Chromosome.h b/tools/yulPhaser/Chromosome.h index 7d8f1b912dfa..95f3ae58e656 100644 --- a/tools/yulPhaser/Chromosome.h +++ b/tools/yulPhaser/Chromosome.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/Common.cpp b/tools/yulPhaser/Common.cpp index aa7ba85b5c26..a23210172d49 100644 --- a/tools/yulPhaser/Common.cpp +++ b/tools/yulPhaser/Common.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Common.h b/tools/yulPhaser/Common.h index c37afa2fbd22..b2164cc9ee3d 100644 --- a/tools/yulPhaser/Common.h +++ b/tools/yulPhaser/Common.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Miscellaneous utilities for use in yul-phaser. */ diff --git a/tools/yulPhaser/Exceptions.h b/tools/yulPhaser/Exceptions.h index 6807d7180c1c..e4aa19b52736 100644 --- a/tools/yulPhaser/Exceptions.h +++ b/tools/yulPhaser/Exceptions.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/FitnessMetrics.cpp b/tools/yulPhaser/FitnessMetrics.cpp index 134c13dfcef7..66c79fda2223 100644 --- a/tools/yulPhaser/FitnessMetrics.cpp +++ b/tools/yulPhaser/FitnessMetrics.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/FitnessMetrics.h b/tools/yulPhaser/FitnessMetrics.h index 50f4c896feb8..f881df7a583a 100644 --- a/tools/yulPhaser/FitnessMetrics.h +++ b/tools/yulPhaser/FitnessMetrics.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains an abstract base class representing a fitness metric and its concrete implementations. */ diff --git a/tools/yulPhaser/GeneticAlgorithms.cpp b/tools/yulPhaser/GeneticAlgorithms.cpp index 4a90503aa1fd..907703738ad2 100644 --- a/tools/yulPhaser/GeneticAlgorithms.cpp +++ b/tools/yulPhaser/GeneticAlgorithms.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include diff --git a/tools/yulPhaser/GeneticAlgorithms.h b/tools/yulPhaser/GeneticAlgorithms.h index f6c809a8b6de..58dc83b95deb 100644 --- a/tools/yulPhaser/GeneticAlgorithms.h +++ b/tools/yulPhaser/GeneticAlgorithms.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains an abstract base class representing a genetic algorithm and its concrete implementations. */ diff --git a/tools/yulPhaser/Mutations.cpp b/tools/yulPhaser/Mutations.cpp index f2876e395ab9..f9d51744eac4 100644 --- a/tools/yulPhaser/Mutations.cpp +++ b/tools/yulPhaser/Mutations.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Mutations.h b/tools/yulPhaser/Mutations.h index 04e7050afda5..abdc4b10c753 100644 --- a/tools/yulPhaser/Mutations.h +++ b/tools/yulPhaser/Mutations.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Mutation and crossover operators for use in genetic algorithms. */ diff --git a/tools/yulPhaser/PairSelections.cpp b/tools/yulPhaser/PairSelections.cpp index 8934c3e1789c..cce99cef5c6d 100644 --- a/tools/yulPhaser/PairSelections.cpp +++ b/tools/yulPhaser/PairSelections.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/PairSelections.h b/tools/yulPhaser/PairSelections.h index a80fff8972be..2a4144bcb71a 100644 --- a/tools/yulPhaser/PairSelections.h +++ b/tools/yulPhaser/PairSelections.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains an abstract base class representing a selection of pairs of elements from a collection * and its concrete implementations. diff --git a/tools/yulPhaser/Phaser.cpp b/tools/yulPhaser/Phaser.cpp index 731560fe6162..589ff93a80f4 100644 --- a/tools/yulPhaser/Phaser.cpp +++ b/tools/yulPhaser/Phaser.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Phaser.h b/tools/yulPhaser/Phaser.h index 8ba5fc938367..20a47a3a56a5 100644 --- a/tools/yulPhaser/Phaser.h +++ b/tools/yulPhaser/Phaser.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains the main class that controls yul-phaser based on command-line parameters and * associated factories for building instances of phaser's components. diff --git a/tools/yulPhaser/Population.cpp b/tools/yulPhaser/Population.cpp index 1b846122e34f..c4b50636991a 100644 --- a/tools/yulPhaser/Population.cpp +++ b/tools/yulPhaser/Population.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Population.h b/tools/yulPhaser/Population.h index c405f702ce9a..b8cde75cc377 100644 --- a/tools/yulPhaser/Population.h +++ b/tools/yulPhaser/Population.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/Program.cpp b/tools/yulPhaser/Program.cpp index 2fd29f51a516..a1d79f75aa87 100644 --- a/tools/yulPhaser/Program.cpp +++ b/tools/yulPhaser/Program.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Program.h b/tools/yulPhaser/Program.h index b96843ee4c27..12026805b217 100644 --- a/tools/yulPhaser/Program.h +++ b/tools/yulPhaser/Program.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/ProgramCache.cpp b/tools/yulPhaser/ProgramCache.cpp index b174ad07f397..351532aa74fa 100644 --- a/tools/yulPhaser/ProgramCache.cpp +++ b/tools/yulPhaser/ProgramCache.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/ProgramCache.h b/tools/yulPhaser/ProgramCache.h index 25c796a3d241..d0e51a37ef4f 100644 --- a/tools/yulPhaser/ProgramCache.h +++ b/tools/yulPhaser/ProgramCache.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/Selections.cpp b/tools/yulPhaser/Selections.cpp index 920a7d7f1af2..e34c80eaf2a8 100644 --- a/tools/yulPhaser/Selections.cpp +++ b/tools/yulPhaser/Selections.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/Selections.h b/tools/yulPhaser/Selections.h index a0ed2657f0c1..a643b9a220de 100644 --- a/tools/yulPhaser/Selections.h +++ b/tools/yulPhaser/Selections.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 /** * Contains an abstract base class representing a selection of elements from a collection * and its concrete implementations. diff --git a/tools/yulPhaser/SimulationRNG.cpp b/tools/yulPhaser/SimulationRNG.cpp index 26f438909718..7a73f81ad962 100644 --- a/tools/yulPhaser/SimulationRNG.cpp +++ b/tools/yulPhaser/SimulationRNG.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include diff --git a/tools/yulPhaser/SimulationRNG.h b/tools/yulPhaser/SimulationRNG.h index d16189f9ebca..7e5cc14422f4 100644 --- a/tools/yulPhaser/SimulationRNG.h +++ b/tools/yulPhaser/SimulationRNG.h @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #pragma once diff --git a/tools/yulPhaser/main.cpp b/tools/yulPhaser/main.cpp index d0c00fcdace1..1ec936dd4397 100644 --- a/tools/yulPhaser/main.cpp +++ b/tools/yulPhaser/main.cpp @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with solidity. If not, see . */ +// SPDX-License-Identifier: GPL-3.0 #include #include From deffb7ffc8ea251184c091d3e4279a8820ecea07 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Mon, 13 Jul 2020 14:23:43 +0200 Subject: [PATCH 405/479] Yul interpreter: Return addresses of type u160 for create and create2 calls --- test/libyul/yulInterpreterTests/and_create.yul | 13 +++++++++++++ test/libyul/yulInterpreterTests/and_create2.yul | 15 +++++++++++++++ .../yulInterpreter/EVMInstructionInterpreter.cpp | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/libyul/yulInterpreterTests/and_create.yul create mode 100644 test/libyul/yulInterpreterTests/and_create2.yul diff --git a/test/libyul/yulInterpreterTests/and_create.yul b/test/libyul/yulInterpreterTests/and_create.yul new file mode 100644 index 000000000000..8907081506bf --- /dev/null +++ b/test/libyul/yulInterpreterTests/and_create.yul @@ -0,0 +1,13 @@ +{ + let u160max := 0xffffffffffffffffffffffffffffffffffffffff + let a := create(0, u160max, 0) + let b := and(u160max, create(0, u160max, 0)) + mstore(0, eq(a, b)) +} +// ---- +// Trace: +// CREATE(0, 0xffffffffffffffffffffffffffffffffffffffff, 0) +// CREATE(0, 0xffffffffffffffffffffffffffffffffffffffff, 0) +// Memory dump: +// 0: 0000000000000000000000000000000000000000000000000000000000000001 +// Storage dump: diff --git a/test/libyul/yulInterpreterTests/and_create2.yul b/test/libyul/yulInterpreterTests/and_create2.yul new file mode 100644 index 000000000000..46df2a9caece --- /dev/null +++ b/test/libyul/yulInterpreterTests/and_create2.yul @@ -0,0 +1,15 @@ +{ + let u160max := 0xffffffffffffffffffffffffffffffffffffffff + let a := create2(0, u160max, 0, 0) + let b := and(u160max, create2(0, u160max, 0, 0)) + mstore(0, eq(a, b)) +} +// ==== +// EVMVersion: >=constantinople +// ---- +// Trace: +// CREATE2(0, 0xffffffffffffffffffffffffffffffffffffffff, 0, 0) +// CREATE2(0, 0xffffffffffffffffffffffffffffffffffffffff, 0, 0) +// Memory dump: +// 0: 0000000000000000000000000000000000000000000000000000000000000001 +// Storage dump: diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 956db124f7fa..b3cf78bab263 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -303,11 +303,11 @@ u256 EVMInstructionInterpreter::eval( case Instruction::CREATE: accessMemory(arg[1], arg[2]); logTrace(_instruction, arg); - return 0xcccccc + arg[1]; + return u160(0xcccccc + arg[1]); case Instruction::CREATE2: accessMemory(arg[2], arg[3]); logTrace(_instruction, arg); - return 0xdddddd + arg[1]; + return u160(0xdddddd + arg[1]); case Instruction::CALL: case Instruction::CALLCODE: // TODO assign returndata From 53bc0ff18e8daa82a3bfb096b48cb019e3fb5aa5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 14:52:10 +0200 Subject: [PATCH 406/479] Fix "enforce via yul". --- test/libsolidity/SemanticTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index e3b40f1e4695..180e49bd7ceb 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -46,7 +46,7 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer m_lineOffset(m_reader.lineNumber()), m_enforceViaYul(enforceViaYul) { - string choice = m_reader.stringSetting("compileViaYul", "false"); + string choice = m_reader.stringSetting("compileViaYul", "default"); if (choice == "also") { m_runWithYul = true; @@ -64,6 +64,11 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer // Do not try to run via yul if explicitly denied. m_enforceViaYul = false; } + else if (choice == "default") + { + m_runWithYul = false; + m_runWithoutYul = true; + } else BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + choice + ".")); From d3647b13e4362a17e72fe6d36b53f152230d77d4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2020 20:11:01 +0200 Subject: [PATCH 407/479] Disallow public state variables overriding pure functions. --- Changelog.md | 1 + docs/contracts/inheritance.rst | 2 +- libsolidity/analysis/OverrideChecker.cpp | 52 +++++++++---------- .../override/public_var_overrides_pure.sol | 8 +++ 4 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_pure.sol diff --git a/Changelog.md b/Changelog.md index 1195fee1af53..c2aa865bc9a8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -29,6 +29,7 @@ Compiler Features: Bugfixes: * NatSpec: Constructors and functions have consistent userdoc output. + * Inheritance: Disallow public state variables overwriting ``pure`` functions. ### 0.6.12 (unreleased) diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index 343604a345a3..f628d49fbe35 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -310,7 +310,7 @@ of the variable: contract A { - function f() external pure virtual returns(uint) { return 5; } + function f() external view virtual returns(uint) { return 5; } } contract B is A diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index c58fd2c8500a..b5fe33aded66 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -584,35 +584,35 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr "Overridden " + _overriding.astNodeName() + " is here:" ); - // This is only relevant for a function overriding a function. - if (_overriding.isFunction()) - { - // Stricter mutability is always okay except when super is Payable - if (( + // Stricter mutability is always okay except when super is Payable + if ( + (_overriding.isFunction() || _overriding.isVariable()) && + ( _overriding.stateMutability() > _super.stateMutability() || _super.stateMutability() == StateMutability::Payable - ) && - _overriding.stateMutability() != _super.stateMutability() - ) - overrideError( - _overriding, - _super, - 6959_error, - "Overriding function changes state mutability from \"" + - stateMutabilityToString(_super.stateMutability()) + - "\" to \"" + - stateMutabilityToString(_overriding.stateMutability()) + - "\"." - ); + ) && + _overriding.stateMutability() != _super.stateMutability() + ) + overrideError( + _overriding, + _super, + 6959_error, + "Overriding " + + _overriding.astNodeName() + + " changes state mutability from \"" + + stateMutabilityToString(_super.stateMutability()) + + "\" to \"" + + stateMutabilityToString(_overriding.stateMutability()) + + "\"." + ); - if (_overriding.unimplemented() && !_super.unimplemented()) - overrideError( - _overriding, - _super, - 4593_error, - "Overriding an implemented function with an unimplemented function is not allowed." - ); - } + if (_overriding.unimplemented() && !_super.unimplemented()) + overrideError( + _overriding, + _super, + 4593_error, + "Overriding an implemented function with an unimplemented function is not allowed." + ); } } diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_pure.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_pure.sol new file mode 100644 index 000000000000..835351b3df12 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_overrides_pure.sol @@ -0,0 +1,8 @@ +abstract contract C { + function foo() external pure virtual returns (uint); +} +contract X is C { + uint public override foo; +} +// ---- +// TypeError 6959: (100-124): Overriding public state variable changes state mutability from "pure" to "view". From c8772a54c3df569494ca3cf85425ae8174a815d2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2020 20:18:34 +0200 Subject: [PATCH 408/479] Constants are considered pure. --- Changelog.md | 1 + libsolidity/analysis/OverrideChecker.cpp | 2 +- .../override/public_constant_var_overrides_pure.sol | 7 +++++++ .../override/public_immutable_var_overrides_pure.sol | 8 ++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/inheritance/override/public_constant_var_overrides_pure.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol diff --git a/Changelog.md b/Changelog.md index c2aa865bc9a8..442139b52f42 100644 --- a/Changelog.md +++ b/Changelog.md @@ -30,6 +30,7 @@ Compiler Features: Bugfixes: * NatSpec: Constructors and functions have consistent userdoc output. * Inheritance: Disallow public state variables overwriting ``pure`` functions. + * State Mutability: Constant public state variables are considered ``pure`` functions. ### 0.6.12 (unreleased) diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index b5fe33aded66..abff464523cb 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -289,7 +289,7 @@ StateMutability OverrideProxy::stateMutability() const return std::visit(GenericVisitor{ [&](FunctionDefinition const* _item) { return _item->stateMutability(); }, [&](ModifierDefinition const*) { solAssert(false, "Requested state mutability from modifier."); return StateMutability{}; }, - [&](VariableDeclaration const*) { return StateMutability::View; } + [&](VariableDeclaration const* _var) { return _var->isConstant() ? StateMutability::Pure : StateMutability::View; } }, m_item); } diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_constant_var_overrides_pure.sol b/test/libsolidity/syntaxTests/inheritance/override/public_constant_var_overrides_pure.sol new file mode 100644 index 000000000000..92f83a01f92e --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/public_constant_var_overrides_pure.sol @@ -0,0 +1,7 @@ +abstract contract C { + function foo() external pure virtual returns (uint); +} +contract X is C { + uint public constant override foo = 7; +} +// ---- diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol b/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol new file mode 100644 index 000000000000..1966db260d04 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol @@ -0,0 +1,8 @@ +abstract contract C { + function foo() external pure virtual returns (uint); +} +contract X is C { + uint public immutable override foo = 7; +} +// ---- +// TypeError 6959: (100-124): Overriding public state variable changes state mutability from "pure" to "view". From 446d15488c36ab4a26514a0254cdd25f8ca9eb33 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 20 Jul 2020 14:45:49 +0200 Subject: [PATCH 409/479] Update tests for new public var override rules --- ...nted_intermediate_empty_bottom_public_state_variable.sol | 3 ++- ...ented_intermediate_implemented_public_state_variable.sol | 2 +- ...d_top_implemented_intermediate_public_state_variable.sol | 2 +- .../override/public_immutable_var_overrides_pure.sol | 2 +- .../override/public_var_no_override_but_function.sol | 2 +- .../inheritance/override/public_vars_multiple.sol | 4 ++-- .../inheritance/override/public_vars_multiple1.sol | 2 +- .../inheritance/override/public_vars_multiple2.sol | 6 +++--- .../inheritance/override/public_vars_multiple3.sol | 6 +++--- .../inheritance/override/public_vars_multiple_diamond.sol | 6 +++--- .../inheritance/override/public_vars_multiple_diamond1.sol | 4 ++-- .../inheritance/override/public_vars_multiple_diamond2.sol | 4 ++-- .../override/public_vars_multiple_explicit_override.sol | 4 ++-- 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_empty_bottom_public_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_empty_bottom_public_state_variable.sol index 3af8fd6e16b2..61c159b082d4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_empty_bottom_public_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_empty_bottom_public_state_variable.sol @@ -1,5 +1,5 @@ contract I { - function f() external pure virtual returns (uint) { return 1; } + function f() external view virtual returns (uint) { return 1; } } contract A is I { @@ -11,3 +11,4 @@ contract C is A, B { uint public override f; } +// ---- diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol index d59dade35cb4..392b6640bcd0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_implemented_public_state_variable.sol @@ -1,5 +1,5 @@ contract I { - function f() external pure virtual returns (uint) { return 1; } + function f() external view virtual returns (uint) { return 1; } } contract A is I { diff --git a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol index 390e763e86b9..5e7052a6234c 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/diamond_top_implemented_intermediate_public_state_variable.sol @@ -1,5 +1,5 @@ contract I { - function f() external pure virtual returns (uint) { return 1; } + function f() external view virtual returns (uint) { return 1; } } contract A is I { diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol b/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol index 1966db260d04..53f7170f46ae 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_immutable_var_overrides_pure.sol @@ -5,4 +5,4 @@ contract X is C { uint public immutable override foo = 7; } // ---- -// TypeError 6959: (100-124): Overriding public state variable changes state mutability from "pure" to "view". +// TypeError 6959: (100-138): Overriding public state variable changes state mutability from "pure" to "view". diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol b/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol index 059450fe62cf..15b6e7b5d7fb 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_var_no_override_but_function.sol @@ -1,5 +1,5 @@ contract A { - function foo() internal virtual pure returns(uint) { return 5; } + function foo() internal virtual view returns(uint) { return 5; } } contract X is A { uint public foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol index f0a79beb2666..0222db63b34a 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple.sol @@ -1,8 +1,8 @@ contract A { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract B { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract X is A, B { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol index 719c917c7c03..7cba6cf0a965 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple1.sol @@ -2,7 +2,7 @@ contract A { uint public foo; } contract B { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract X is A, B { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple2.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple2.sol index fa0c17880971..42c0a97f1d7b 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple2.sol @@ -1,7 +1,7 @@ contract A { - function foo() external virtual pure returns(uint) { return 4; } - function foo(uint ) external virtual pure returns(uint) { return 4; } - function foo(uint , uint ) external pure virtual returns(A) { } + function foo() external virtual view returns(uint) { return 4; } + function foo(uint ) external virtual view returns(uint) { return 4; } + function foo(uint , uint ) external view virtual returns(A) { } } contract X is A { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol index 1ef6cf296602..35e3e78ac0de 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple3.sol @@ -1,7 +1,7 @@ contract A { - function foo() external virtual pure returns(A) { } - function foo(uint ) external virtual pure returns(uint) { return 4; } - function foo(uint , uint ) external pure virtual returns(A) { } + function foo() external virtual view returns(A) { } + function foo(uint ) external virtual view returns(uint) { return 4; } + function foo(uint , uint ) external view virtual returns(A) { } } contract X is A { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol index ffac63dc8303..67e95e129980 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond.sol @@ -1,11 +1,11 @@ contract A { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract B is A { - function foo() external virtual override pure returns(uint) { return 5; } + function foo() external virtual override view returns(uint) { return 5; } } contract C is A { - function foo() external virtual override pure returns(uint) { return 5; } + function foo() external virtual override view returns(uint) { return 5; } } contract X is B, C { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol index b0b4d22fc5cb..9830bfce7aa4 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond1.sol @@ -1,11 +1,11 @@ contract A { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract B is A { uint public override foo; } contract C is A { - function foo() external virtual override pure returns(uint) { return 5; } + function foo() external virtual override view returns(uint) { return 5; } } contract X is B, C { uint public override foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol index f303b82cd4e4..0ce74dc6bb67 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_diamond2.sol @@ -1,11 +1,11 @@ contract A { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract B is A { uint public override foo; } contract C is A { - function foo() external virtual override pure returns(uint) { return 5; } + function foo() external virtual override view returns(uint) { return 5; } } contract X is B, C { uint public override(A, C) foo; diff --git a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_explicit_override.sol b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_explicit_override.sol index caf3f9ea8dce..b0579b3075d8 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_explicit_override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/public_vars_multiple_explicit_override.sol @@ -1,8 +1,8 @@ contract A { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract B { - function foo() external virtual pure returns(uint) { return 5; } + function foo() external virtual view returns(uint) { return 5; } } contract X is A, B { uint public override(A, B) foo; From 50dc17350cc22fe518e3b710e3b855c785698996 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 15:37:53 +0200 Subject: [PATCH 410/479] Remove leftover of code-generator for ``now``. --- libsolidity/codegen/ExpressionCompiler.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 694ea8fa6fe4..d5a575a7dbe3 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1914,10 +1914,6 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier) if (!dynamic_cast(*magicVar->type()).isSuper()) m_context << Instruction::ADDRESS; break; - case Type::Category::Integer: - // "now" - m_context << Instruction::TIMESTAMP; - break; default: break; } From 0a25370eebf603531f92ee15e5156fbdf7c941f3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 15:06:45 +0200 Subject: [PATCH 411/479] Update tests. --- test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol | 2 ++ .../semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol | 2 ++ test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol | 2 ++ .../abiEncoderV2/calldata_struct_member_offset.sol | 2 ++ .../semanticTests/array/calldata_array_of_struct.sol | 2 ++ .../semanticTests/array/fixed_arrays_in_storage.sol | 2 ++ .../semanticTests/calldata/calldata_bytes_external.sol | 1 + .../semanticTests/calldata/calldata_struct_cleaning.sol | 2 ++ .../semanticTests/calldata/calldata_struct_internal.sol | 2 ++ test/libsolidity/semanticTests/dirty_calldata_bytes.sol | 4 +++- .../semanticTests/dirty_calldata_dynamic_array.sol | 4 +++- .../semanticTests/functionCall/call_options_overload.sol | 2 ++ .../libraries/internal_library_function_bound.sol | 2 ++ .../libraries/internal_library_function_return_var_size.sol | 2 ++ test/libsolidity/semanticTests/multiSource/import.sol | 2 ++ test/libsolidity/semanticTests/smoke/structs.sol | 2 ++ .../semanticTests/storage/packed_storage_structs_bytes.sol | 2 ++ .../semanticTests/storage/packed_storage_structs_enum.sol | 2 ++ .../semanticTests/storage/packed_storage_structs_uint.sol | 2 ++ test/libsolidity/semanticTests/strings/unicode_escapes.sol | 2 ++ test/libsolidity/semanticTests/strings/unicode_string.sol | 2 ++ .../semanticTests/structs/calldata/calldata_struct.sol | 2 ++ .../structs/calldata/calldata_struct_and_ints.sol | 2 ++ .../semanticTests/structs/calldata/calldata_structs.sol | 2 ++ .../semanticTests/structs/calldata/dynamic_nested.sol | 2 ++ .../semanticTests/structs/calldata/dynamically_encoded.sol | 2 ++ .../semanticTests/various/cross_contract_types.sol | 2 ++ test/libsolidity/semanticTests/various/memory_overwrite.sol | 2 ++ .../semanticTests/various/negative_stack_height.sol | 3 ++- 29 files changed, 59 insertions(+), 3 deletions(-) diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol index 1dbf320bd534..6d7b27f58efb 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol @@ -18,5 +18,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol index a5e7a9af8913..9ed9ada784e9 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol @@ -12,5 +12,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol index f6510b53da59..bfa7507120d1 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol @@ -45,6 +45,8 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f0() -> 0x20, 0x0 // f1() -> 0x20, 0x40, 0x1, 0x2 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_member_offset.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_member_offset.sol index fb8e6c3c5d43..196967a441aa 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_member_offset.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_member_offset.sol @@ -19,5 +19,7 @@ contract C { return (b.b, this.g(b)); } } +// ==== +// compileViaYul: also // ---- // f() -> 11, 11 diff --git a/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol b/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol index 33311226500a..170dee6ee556 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol @@ -20,5 +20,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol b/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol index b65a3d254d54..3f5c0d5dd8dc 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol @@ -33,6 +33,8 @@ contract c { l2 = ids.length; } } +// ==== +// compileViaYul: also // ---- // setIDStatic(uint256): 0xb -> // getID(uint256): 0x2 -> 0xb diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol index 9917e736a945..9be9e8eab650 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_external.sol @@ -7,6 +7,7 @@ contract CalldataTest { } } // ==== +// compileViaYul: also // EVMVersion: >=byzantium // ---- // tester(bytes): 0x20, 0x08, "abcdefgh" -> "c" diff --git a/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol b/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol index dbf6e44405e2..6b4eb2f07ff1 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol @@ -16,6 +16,8 @@ contract C { } } } +// ==== +// compileViaYul: also // ---- // f((uint8,bytes1)): 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" -> 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" # double check that the valid case goes through # // f((uint8,bytes1)): 0x1234, hex"5678000000000000000000000000000000000000000000000000000000000000" -> FAILURE diff --git a/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol b/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol index a463b5d33960..810900dd67ff 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_struct_internal.sol @@ -13,5 +13,7 @@ contract C { return f(s); } } +// ==== +// compileViaYul: also // ---- // f(uint256,(uint256,uint256),uint256): 7, 1, 2, 4 -> 1, 2 diff --git a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol index 05a3793f60b7..f3cd7b912466 100644 --- a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol +++ b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol @@ -8,5 +8,7 @@ contract C { correct = r == (0x64 << 248); } } +// ==== +// compileViaYul: also // ---- -// f(bytes): 0x20, 0x04, "dead" -> true \ No newline at end of file +// f(bytes): 0x20, 0x04, "dead" -> true diff --git a/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol b/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol index 1c9d7db3022b..df5c672d1040 100644 --- a/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol +++ b/test/libsolidity/semanticTests/dirty_calldata_dynamic_array.sol @@ -8,5 +8,7 @@ contract C { correct = r == 0x7fff; } } +// ==== +// compileViaYul: also // ---- -// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true \ No newline at end of file +// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true diff --git a/test/libsolidity/semanticTests/functionCall/call_options_overload.sol b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol index 27e8e4127fdb..8938d8f0c318 100644 --- a/test/libsolidity/semanticTests/functionCall/call_options_overload.sol +++ b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol @@ -9,6 +9,8 @@ contract C { } receive() external payable {} } +// ==== +// compileViaYul: also // ---- // (), 1 ether // call() -> 1, 2, 2, 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_bound.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_bound.sol index f59ec9440dff..a6ea94fedbf6 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_bound.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_bound.sol @@ -22,5 +22,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol index 21417b599b43..1406e0117473 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol @@ -22,5 +22,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/multiSource/import.sol b/test/libsolidity/semanticTests/multiSource/import.sol index 2a0f43d53978..d3f5ed301997 100644 --- a/test/libsolidity/semanticTests/multiSource/import.sol +++ b/test/libsolidity/semanticTests/multiSource/import.sol @@ -7,6 +7,8 @@ import "A"; contract B is A { function f(uint256 x) public view returns(uint256) { return x; } } +// ==== +// compileViaYul: also // ---- // f(uint256): 1337 -> 1337 // g(uint256): 1337 -> 1338 diff --git a/test/libsolidity/semanticTests/smoke/structs.sol b/test/libsolidity/semanticTests/smoke/structs.sol index 979dbdcc003d..6a7286e57459 100644 --- a/test/libsolidity/semanticTests/smoke/structs.sol +++ b/test/libsolidity/semanticTests/smoke/structs.sol @@ -17,6 +17,8 @@ contract C { return T(23, 42, "any"); } } +// ==== +// compileViaYul: also // ---- // s() -> 23, 42 // t() -> 0x20, 23, 42, 0x60, 3, "any" diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol index daeee6ba6f4d..50a0d68f7725 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol @@ -41,5 +41,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // test() -> true diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol index 9c9f778f0f85..3f2983f46236 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol @@ -29,5 +29,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // test() -> 1 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol index 8c91576f5003..611fda3ccf57 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol @@ -26,5 +26,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // test() -> 1 diff --git a/test/libsolidity/semanticTests/strings/unicode_escapes.sol b/test/libsolidity/semanticTests/strings/unicode_escapes.sol index 401d8b61e4ec..fc57aa48ed74 100644 --- a/test/libsolidity/semanticTests/strings/unicode_escapes.sol +++ b/test/libsolidity/semanticTests/strings/unicode_escapes.sol @@ -15,6 +15,8 @@ contract C { return "\u0024\u00A2\u20AC"; } } +// ==== +// compileViaYul: also // ---- // oneByteUTF8() -> 0x20, 7, "aaa$aaa" // twoBytesUTF8() -> 0x20, 8, "aaa\xc2\xa2aaa" diff --git a/test/libsolidity/semanticTests/strings/unicode_string.sol b/test/libsolidity/semanticTests/strings/unicode_string.sol index c139d6b8b9cf..73616e479434 100644 --- a/test/libsolidity/semanticTests/strings/unicode_string.sol +++ b/test/libsolidity/semanticTests/strings/unicode_string.sol @@ -3,5 +3,7 @@ contract C { return "😃, 😭, and 😈"; } } +// ==== +// compileViaYul: also // ---- // f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol index a7ecf2bd02d6..d3a79a181e23 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol @@ -13,5 +13,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f((uint256,uint256)): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol index c3b8249e8f61..21fada9c232c 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol @@ -16,5 +16,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(uint256,(uint256,uint256),uint256): 1, 2, 3, 4 -> 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol index 4139c1073b65..0e62ee4ef319 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol @@ -23,5 +23,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f((uint256,uint256),(uint256),(uint256,uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5 diff --git a/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol b/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol index 59cde317189a..8d6b7310300b 100644 --- a/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol +++ b/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol @@ -7,5 +7,7 @@ contract C { return (s.children.length, s.a, s.children[0].b, s.children[1].b); } } +// ==== +// compileViaYul: also // ---- // f((uint256,(uint256)[])): 32, 17, 64, 2, 23, 42 -> 2, 17, 23, 42 diff --git a/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol b/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol index 3acea52e7fa5..815de9a28574 100644 --- a/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol +++ b/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol @@ -6,5 +6,7 @@ contract C { return (s.a.length, s.a[0], s.a[1]); } } +// ==== +// compileViaYul: also // ---- // f((uint256[])): 32, 32, 2, 42, 23 -> 2, 42, 23 diff --git a/test/libsolidity/semanticTests/various/cross_contract_types.sol b/test/libsolidity/semanticTests/various/cross_contract_types.sol index 47842cc030bb..88528ce07633 100644 --- a/test/libsolidity/semanticTests/various/cross_contract_types.sol +++ b/test/libsolidity/semanticTests/various/cross_contract_types.sol @@ -13,5 +13,7 @@ contract Test { } } +// ==== +// compileViaYul: also // ---- // f() -> 3 diff --git a/test/libsolidity/semanticTests/various/memory_overwrite.sol b/test/libsolidity/semanticTests/various/memory_overwrite.sol index 7312509e2ff0..3ab0a2aa2e63 100644 --- a/test/libsolidity/semanticTests/various/memory_overwrite.sol +++ b/test/libsolidity/semanticTests/various/memory_overwrite.sol @@ -6,5 +6,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 0x20, 5, "b23a5" diff --git a/test/libsolidity/semanticTests/various/negative_stack_height.sol b/test/libsolidity/semanticTests/various/negative_stack_height.sol index d5074dc911fc..8f36538e47e9 100644 --- a/test/libsolidity/semanticTests/various/negative_stack_height.sol +++ b/test/libsolidity/semanticTests/various/negative_stack_height.sol @@ -58,6 +58,7 @@ contract C { ) {} } - +// ==== +// compileViaYul: false // ---- // constructor() -> From f5d8636d281577c44da3c0a3f4fb2f15415ef500 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 15:43:52 +0200 Subject: [PATCH 412/479] Document variableHeightDiff. --- libyul/backends/evm/EVMCodeTransform.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 1cfa6afd7ebb..b194676eea67 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -201,6 +201,8 @@ class CodeTransform /// Determines the stack height difference to the given variables. Throws /// if it is not yet in scope or the height difference is too large. Returns /// the (positive) stack height difference otherwise. + /// @param _forSwap if true, produces stack error if the difference is invalid for a swap + /// opcode, otherwise checks for validity for a dup opcode. size_t variableHeightDiff(Scope::Variable const& _var, YulString _name, bool _forSwap); void expectDeposit(int _deposit, int _oldHeight) const; From 50a54fa8aaf9c0e06ef7bbde0ae93717583ac339 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 14:37:19 +0200 Subject: [PATCH 413/479] Implement inline arrays. --- libsolidity/codegen/YulUtilFunctions.cpp | 29 +++++++++++++++---- libsolidity/codegen/YulUtilFunctions.h | 6 ++++ .../codegen/ir/IRGeneratorForStatements.cpp | 26 ++++++++++++++++- .../array/inline_array_singleton.sol | 3 +- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index cab908c18680..0bd6b0d3a37b 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1620,26 +1620,45 @@ string YulUtilFunctions::zeroComplexMemoryArrayFunction(ArrayType const& _type) }); } -string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type) +string YulUtilFunctions::allocateMemoryArrayFunction(ArrayType const& _type) { - string functionName = "allocate_and_zero_memory_array_" + _type.identifier(); + string functionName = "allocate_memory_array_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( function (length) -> memPtr { let allocSize := (length) memPtr := (allocSize) + + mstore(memPtr, length) + + } + )") + ("functionName", functionName) + ("alloc", allocationFunction()) + ("allocSize", arrayAllocationSizeFunction(_type)) + ("dynamic", _type.isDynamicallySized()) + .render(); + }); +} + +string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type) +{ + string functionName = "allocate_and_zero_memory_array_" + _type.identifier(); + return m_functionCollector.createFunction(functionName, [&]() { + return Whiskers(R"( + function (length) -> memPtr { + memPtr := (length) let dataStart := memPtr - let dataSize := allocSize + let dataSize := (length) dataStart := add(dataStart, 32) dataSize := sub(dataSize, 32) - mstore(memPtr, length) (dataStart, dataSize) } )") ("functionName", functionName) - ("alloc", allocationFunction()) + ("allocArray", allocateMemoryArrayFunction(_type)) ("allocSize", arrayAllocationSizeFunction(_type)) ("zeroArrayFunction", zeroMemoryArrayFunction(_type)) ("dynamic", _type.isDynamicallySized()) diff --git a/libsolidity/codegen/YulUtilFunctions.h b/libsolidity/codegen/YulUtilFunctions.h index 5d9ec805f474..19ca72dd0073 100644 --- a/libsolidity/codegen/YulUtilFunctions.h +++ b/libsolidity/codegen/YulUtilFunctions.h @@ -282,6 +282,12 @@ class YulUtilFunctions /// signature: (dataStart, dataSizeInBytes) -> std::string zeroComplexMemoryArrayFunction(ArrayType const& _type); + /// @returns the name of a function that allocates a memory array. + /// For dynamic arrays it adds space for length and stores it. + /// The contents of the data area are unspecified. + /// signature: (length) -> memPtr + std::string allocateMemoryArrayFunction(ArrayType const& _type); + /// @returns the name of a function that allocates and zeroes a memory array. /// For dynamic arrays it adds space for length and stores it. /// signature: (length) -> memPtr diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 51679571e393..0489f3f680d3 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -311,7 +311,31 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment) bool IRGeneratorForStatements::visit(TupleExpression const& _tuple) { if (_tuple.isInlineArray()) - solUnimplementedAssert(false, ""); + { + auto const& arrayType = dynamic_cast(*_tuple.annotation().type); + solAssert(!arrayType.isDynamicallySized(), "Cannot create dynamically sized inline array."); + define(_tuple) << + m_utils.allocateMemoryArrayFunction(arrayType) << + "(" << + _tuple.components().size() << + ")\n"; + + string mpos = IRVariable(_tuple).part("mpos").name(); + Type const& baseType = *arrayType.baseType(); + for (size_t i = 0; i < _tuple.components().size(); i++) + { + Expression const& component = *_tuple.components()[i]; + component.accept(*this); + IRVariable converted = convert(component, baseType); + m_code << + m_utils.writeToMemoryFunction(baseType) << + "(" << + ("add(" + mpos + ", " + to_string(i * arrayType.memoryStride()) + ")") << + ", " << + converted.name() << + ")\n"; + } + } else { bool willBeWrittenTo = _tuple.annotation().willBeWrittenTo; diff --git a/test/libsolidity/semanticTests/array/inline_array_singleton.sol b/test/libsolidity/semanticTests/array/inline_array_singleton.sol index 5925aba0f28e..e8373854de7f 100644 --- a/test/libsolidity/semanticTests/array/inline_array_singleton.sol +++ b/test/libsolidity/semanticTests/array/inline_array_singleton.sol @@ -4,6 +4,7 @@ contract C { return [4][0]; } } - +// ==== +// compileViaYul: also // ---- // f() -> 4 From 8bdd93f4b8516911341eda0e0cefd0b675dadccb Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 20 Jul 2020 17:17:19 +0200 Subject: [PATCH 414/479] Update tests. --- .../semanticTests/array/inline_array_index_access_ints.sol | 2 ++ .../array/inline_array_storage_to_memory_conversion_ints.sol | 2 ++ .../semanticTests/calldata/calldata_array_dynamic_bytes.sol | 2 ++ test/libsolidity/semanticTests/isoltestFormatting.sol | 2 ++ test/libsolidity/semanticTests/snark.sol | 1 + .../various/inline_tuple_with_rational_numbers.sol | 2 ++ 6 files changed, 11 insertions(+) diff --git a/test/libsolidity/semanticTests/array/inline_array_index_access_ints.sol b/test/libsolidity/semanticTests/array/inline_array_index_access_ints.sol index 8dc5a7451b9f..fc7c85438609 100644 --- a/test/libsolidity/semanticTests/array/inline_array_index_access_ints.sol +++ b/test/libsolidity/semanticTests/array/inline_array_index_access_ints.sol @@ -4,5 +4,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 3 diff --git a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol index f3f37ea20edb..960b7fdb5d34 100644 --- a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol +++ b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol @@ -7,5 +7,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> 3, 6 diff --git a/test/libsolidity/semanticTests/calldata/calldata_array_dynamic_bytes.sol b/test/libsolidity/semanticTests/calldata/calldata_array_dynamic_bytes.sol index c2c2fa70a678..b59885de88b7 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_array_dynamic_bytes.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_array_dynamic_bytes.sol @@ -66,6 +66,8 @@ contract C { // found expectation comments: // same offset for both arrays @ ABI_CHECK( +// ==== +// compileViaYul: false // ---- // f1(bytes[1]): 0x20, 0x20, 0x3, hex"0102030000000000000000000000000000000000000000000000000000000000" -> 0x3, 0x1, 0x2, 0x3 // f2(bytes[1],bytes[1]): 0x40, 0xa0, 0x20, 0x3, hex"0102030000000000000000000000000000000000000000000000000000000000", 0x20, 0x2, hex"0102000000000000000000000000000000000000000000000000000000000000" -> 0x3, 0x1, 0x2, 0x3, 0x2, 0x1, 0x2 diff --git a/test/libsolidity/semanticTests/isoltestFormatting.sol b/test/libsolidity/semanticTests/isoltestFormatting.sol index 9380dc01588e..a6e25172e9d1 100644 --- a/test/libsolidity/semanticTests/isoltestFormatting.sol +++ b/test/libsolidity/semanticTests/isoltestFormatting.sol @@ -8,6 +8,8 @@ contract C { return a; } } +// ==== +// compileViaYul: also // ---- // f() -> 4, 11, 0x0111, 0x333333, 2222222222222222222 // g() -> 0x10, 0x0100, 0x0101, 0x333333, 2222222222222222222 diff --git a/test/libsolidity/semanticTests/snark.sol b/test/libsolidity/semanticTests/snark.sol index 83f16f091cff..4ab6a61fc605 100644 --- a/test/libsolidity/semanticTests/snark.sol +++ b/test/libsolidity/semanticTests/snark.sol @@ -288,6 +288,7 @@ contract Test { /// testMul() -> true // // ==== +// compileViaYul: also // EVMVersion: >=constantinople // ---- // library: Pairing diff --git a/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol b/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol index e350a11d3f51..477d14740c30 100644 --- a/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol +++ b/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol @@ -5,5 +5,7 @@ contract c { } } +// ==== +// compileViaYul: also // ---- // f() -> 1 From 2c93278719d31f248ba4833f6dc1cc7829327b27 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 17 Jul 2020 10:00:25 +0200 Subject: [PATCH 415/479] Fix push().push() --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 24 ++++++++++++++++++- .../array_members/push_push_no_args_1.sol | 9 +++++++ .../push_push_no_args_1_fail.sol | 12 ++++++++++ .../array_members/push_push_no_args_2.sol | 11 +++++++++ .../push_push_no_args_2_fail.sol | 15 ++++++++++++ .../array_members/storage_pointer_push_1.sol | 18 ++++++++++++++ .../storage_pointer_push_1_safe.sol | 15 ++++++++++++ 8 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol create mode 100644 test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1_safe.sol diff --git a/Changelog.md b/Changelog.md index e0987a9195b9..134bd5df8f43 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches. * SMTChecker: Fix error in events with indices of type static array. + * SMTChecker: Fix internal error in sequential storage array pushes (``push().push()`). * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. * Code Generator: Avoid double cleanup when copying to memory. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index e3f16b2efecf..417a169211f1 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1077,7 +1077,7 @@ void SMTEncoder::arrayPush(FunctionCall const& _funCall) m_context.addAssertion(symbArray->length() == oldLength + 1); if (arguments.empty()) - defineExpr(_funCall, element); + defineExpr(_funCall, smtutil::Expression::select(symbArray->elements(), oldLength)); arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); } @@ -1119,6 +1119,28 @@ void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression } else if (auto const* indexAccess = dynamic_cast(&_expr)) arrayIndexAssignment(*indexAccess, _array); + else if (auto const* funCall = dynamic_cast(&_expr)) + { + FunctionType const& funType = dynamic_cast(*funCall->expression().annotation().type); + if (funType.kind() == FunctionType::Kind::ArrayPush) + { + auto memberAccess = dynamic_cast(&funCall->expression()); + solAssert(memberAccess, ""); + auto symbArray = dynamic_pointer_cast(m_context.expression(memberAccess->expression())); + solAssert(symbArray, ""); + + auto oldLength = symbArray->length(); + auto store = smtutil::Expression::store( + symbArray->elements(), + symbArray->length() - 1, + _array + ); + symbArray->increaseIndex(); + m_context.addAssertion(symbArray->elements() == store); + m_context.addAssertion(symbArray->length() == oldLength); + arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); + } + } else if (dynamic_cast(&_expr)) m_errorReporter.warning( 9599_error, diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1.sol new file mode 100644 index 000000000000..8acd7998a2c1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1.sol @@ -0,0 +1,9 @@ +pragma experimental SMTChecker; +contract C { + int[][] array2d; + function l() public { + array2d.push().push(); + assert(array2d.length > 0); + assert(array2d[array2d.length - 1].length > 0); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol new file mode 100644 index 000000000000..a85638189d8c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol @@ -0,0 +1,12 @@ +pragma experimental SMTChecker; +contract C { + int[][] array2d; + function l() public { + array2d.push().push(); + assert(array2d.length > 2); + assert(array2d[array2d.length - 1].length > 3); + } +} +// ---- +// Warning 4661: (113-139): Assertion violation happens here +// Warning 4661: (143-189): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2.sol new file mode 100644 index 000000000000..b6fd8e8c9b57 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2.sol @@ -0,0 +1,11 @@ +pragma experimental SMTChecker; +contract C { + int[][][] array2d; + function l() public { + array2d.push().push().push(); + assert(array2d.length > 0); + uint last = array2d[array2d.length - 1].length; + assert(last > 0); + assert(array2d[array2d.length - 1][last - 1].length > 0); + } +} diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol new file mode 100644 index 000000000000..3d22b862a543 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol @@ -0,0 +1,15 @@ +pragma experimental SMTChecker; +contract C { + int[][][] array2d; + function l() public { + array2d.push().push().push(); + assert(array2d.length > 2); + uint last = array2d[array2d.length - 1].length; + assert(last > 3); + assert(array2d[array2d.length - 1][last - 1].length > 4); + } +} +// ---- +// Warning 4661: (122-148): Assertion violation happens here +// Warning 4661: (202-218): Assertion violation happens here +// Warning 4661: (222-278): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol new file mode 100644 index 000000000000..527d06534bdd --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol @@ -0,0 +1,18 @@ +pragma experimental SMTChecker; +contract C { + int[][] array2d; + function l() public { + s().push(); + // False positive. + // Knowledge is erased because `s()` is a storage pointer. + assert(array2d[2].length > 0); + } + function s() internal returns (int[] storage) { + array2d.push(); + array2d.push(); + array2d.push(); + return array2d[2]; + } +} +// ---- +// Warning 4661: (184-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1_safe.sol b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1_safe.sol new file mode 100644 index 000000000000..843b46b16a64 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1_safe.sol @@ -0,0 +1,15 @@ +pragma experimental SMTChecker; +contract C { + int[][] array2d; + function l() public { + s(); + array2d[2].push(); + assert(array2d[2].length > 0); + } + function s() internal returns (int[] storage) { + array2d.push(); + array2d.push(); + array2d.push(); + return array2d[2]; + } +} From 93c792c696b2929da2b6e2eea31a4c5f60e9188c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 15 Jul 2020 19:50:59 +0200 Subject: [PATCH 416/479] Remove special treatment of ``var``. --- Changelog.md | 1 + liblangutil/Token.h | 2 +- .../analysis/DeclarationTypeChecker.cpp | 11 +- libsolidity/analysis/TypeChecker.cpp | 215 ++++-------------- libsolidity/ast/AST.cpp | 23 +- libsolidity/ast/AST.h | 9 +- libsolidity/ast/ASTJsonConverter.cpp | 2 +- libsolidity/parsing/Parser.cpp | 97 ++------ libsolidity/parsing/Parser.h | 3 +- test/libsolidity/ASTJSON/non_utf8.json | 54 +++-- test/libsolidity/ASTJSON/non_utf8.sol | 2 +- test/libsolidity/ASTJSON/non_utf8_legacy.json | 56 +++-- test/libsolidity/ASTJSON/source_location.json | 78 ++++--- test/libsolidity/ASTJSON/source_location.sol | 2 +- .../ASTJSON/source_location_legacy.json | 74 +++--- test/libsolidity/SolidityParser.cpp | 12 +- .../functionCalls/int_not_callable.sol | 4 +- .../memory_mapping_array.sol | 2 +- .../iceRegressionTests/oversized_var.sol | 9 +- .../207_no_mappings_in_memory_array.sol | 2 +- .../creating_struct_members_skipped.sol | 4 +- .../parsing/location_specifiers_with_var.sol | 2 +- .../parsing/new_invalid_type_name.sol | 2 +- .../syntaxTests/parsing/return_var.sol | 25 -- .../parsing/tuples_without_commas.sol | 4 +- .../syntaxTests/parsing/var_array.sol | 2 +- .../parsing/var_in_function_arguments.sol | 25 -- .../syntaxTests/structs/struct_var_member.sol | 7 - .../mapping_data_location_calldata.sol | 2 +- .../mapping/mapping_data_location_default.sol | 2 +- .../mapping/mapping_data_location_memory.sol | 2 +- .../syntaxTests/types/unnamed_tuple_decl.sol | 10 +- .../types/var_decl_val_mismatch.sol | 9 +- .../syntaxTests/types/var_empty_decl_0.sol | 9 - .../syntaxTests/types/var_empty_decl_1.sol | 2 +- .../syntaxTests/types/var_empty_decl_2.sol | 2 +- .../syntaxTests/types/var_empty_decl_3.sol | 2 +- .../types/var_type_invalid_rational.sol | 6 +- .../syntaxTests/types/var_type_suggest.sol | 30 --- 39 files changed, 271 insertions(+), 534 deletions(-) delete mode 100644 test/libsolidity/syntaxTests/parsing/return_var.sol delete mode 100644 test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol delete mode 100644 test/libsolidity/syntaxTests/structs/struct_var_member.sol delete mode 100644 test/libsolidity/syntaxTests/types/var_empty_decl_0.sol delete mode 100644 test/libsolidity/syntaxTests/types/var_type_suggest.sol diff --git a/Changelog.md b/Changelog.md index dbdd34448292..6810875edb63 100644 --- a/Changelog.md +++ b/Changelog.md @@ -23,6 +23,7 @@ Language Features: * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. Compiler Features: + * Variable declarations using the ``var`` keyword are not recognized anymore. Bugfixes: diff --git a/liblangutil/Token.h b/liblangutil/Token.h index 47b7985d6862..ab4eba8bab73 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -189,7 +189,6 @@ namespace solidity::langutil K(Throw, "throw", 0) \ K(Type, "type", 0) \ K(Using, "using", 0) \ - K(Var, "var", 0) \ K(View, "view", 0) \ K(Virtual, "virtual", 0) \ K(While, "while", 0) \ @@ -265,6 +264,7 @@ namespace solidity::langutil K(Typedef, "typedef", 0) \ K(TypeOf, "typeof", 0) \ K(Unchecked, "unchecked", 0) \ + K(Var, "var", 0) \ \ /* Illegal token - not able to scan. */ \ T(Illegal, "ILLEGAL", 0) \ diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index f8dbc1d2dd95..30387066b453 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -293,15 +293,6 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) "The \"immutable\" keyword can only be used for state variables." ); - if (!_variable.typeName()) - { - // This can still happen in very unusual cases where a developer uses constructs, such as - // `var a;`, however, such code will have generated errors already. - // However, we cannot blindingly solAssert() for that here, as the TypeChecker (which is - // invoking ReferencesResolver) is generating it, so the error is most likely(!) generated - // after this step. - return; - } using Location = VariableDeclaration::Location; Location varLoc = _variable.referenceLocation(); DataLocation typeLoc = DataLocation::Memory; @@ -382,7 +373,7 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) solAssert(!_variable.hasReferenceOrMappingType(), "Data location not properly set."); } - TypePointer type = _variable.typeName()->annotation().type; + TypePointer type = _variable.typeName().annotation().type; if (auto ref = dynamic_cast(type)) { bool isPointer = !_variable.isStateVariable(); diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6176c29af2a4..ab908004e9d9 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -466,8 +466,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) bool TypeChecker::visit(VariableDeclaration const& _variable) { - if (_variable.typeName()) - _variable.typeName()->accept(*this); + _variable.typeName().accept(*this); // type is filled either by ReferencesResolver directly from the type name or by // TypeChecker at the VariableDeclarationStatement level. @@ -591,15 +590,11 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (_variable.isStateVariable()) m_errorReporter.warning(3408_error, _variable.location(), collisionMessage(_variable.name(), true)); else - m_errorReporter.warning( - 2332_error, - _variable.typeName() ? _variable.typeName()->location() : _variable.location(), - collisionMessage(varType->canonicalName(), false) - ); + m_errorReporter.warning(2332_error, _variable.typeName().location(), collisionMessage(varType->canonicalName(), false)); } vector oversizedSubtypes = frontend::oversizedSubtypes(*varType); for (Type const* subtype: oversizedSubtypes) - m_errorReporter.warning(7325_error, _variable.typeName()->location(), collisionMessage(subtype->canonicalName(), false)); + m_errorReporter.warning(7325_error, _variable.typeName().location(), collisionMessage(subtype->canonicalName(), false)); } return false; @@ -1106,81 +1101,23 @@ void TypeChecker::endVisit(EmitStatement const& _emit) m_errorReporter.typeError(9292_error, _emit.eventCall().expression().location(), "Expression has to be an event invocation."); } -namespace -{ -/** - * @returns a suggested left-hand-side of a multi-variable declaration contairing - * the variable declarations given in @a _decls. - */ -string createTupleDecl(vector> const& _decls) -{ - vector components; - for (ASTPointer const& decl: _decls) - if (decl) - { - solAssert(decl->annotation().type, ""); - components.emplace_back(decl->annotation().type->toString(false) + " " + decl->name()); - } - else - components.emplace_back(); - - if (_decls.size() == 1) - return components.front(); - else - return "(" + boost::algorithm::join(components, ", ") + ")"; -} - -bool typeCanBeExpressed(vector> const& decls) -{ - for (ASTPointer const& decl: decls) - { - // skip empty tuples (they can be expressed of course) - if (!decl) - continue; - - if (!decl->annotation().type) - return false; - - if (auto functionType = dynamic_cast(decl->annotation().type)) - if ( - functionType->kind() != FunctionType::Kind::Internal && - functionType->kind() != FunctionType::Kind::External - ) - return false; - } - - return true; -} -} - bool TypeChecker::visit(VariableDeclarationStatement const& _statement) { if (!_statement.initialValue()) { // No initial value is only permitted for single variables with specified type. + // This usually already results in a parser error. if (_statement.declarations().size() != 1 || !_statement.declarations().front()) { - if (std::all_of( - _statement.declarations().begin(), - _statement.declarations().end(), - [](ASTPointer const& declaration) { return declaration == nullptr; } - )) - { - // The syntax checker has already generated an error for this case (empty LHS tuple). - solAssert(m_errorReporter.hasErrors(), ""); + solAssert(m_errorReporter.hasErrors(), ""); - // It is okay to return here, as there are no named components on the - // left-hand-side that could cause any damage later. - return false; - } - else - // Bailing out *fatal* here, as those (untyped) vars may be used later, and diagnostics wouldn't be helpful then. - m_errorReporter.fatalTypeError(4626_error, _statement.location(), "Use of the \"var\" keyword is disallowed."); + // It is okay to return here, as there are no named components on the + // left-hand-side that could cause any damage later. + return false; } VariableDeclaration const& varDecl = *_statement.declarations().front(); - if (!varDecl.annotation().type) - m_errorReporter.fatalTypeError(6983_error, _statement.location(), "Use of the \"var\" keyword is disallowed."); + solAssert(varDecl.annotation().type, ""); if (dynamic_cast(type(varDecl))) m_errorReporter.typeError( @@ -1217,8 +1154,6 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) ")." ); - bool autoTypeDeductionNeeded = false; - for (size_t i = 0; i < min(variables.size(), valueTypes.size()); ++i) { if (!variables[i]) @@ -1227,95 +1162,45 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) solAssert(!var.value(), "Value has to be tied to statement."); TypePointer const& valueComponentType = valueTypes[i]; solAssert(!!valueComponentType, ""); - if (!var.annotation().type) - { - autoTypeDeductionNeeded = true; - - // Infer type from value. - solAssert(!var.typeName(), ""); - var.annotation().type = valueComponentType->mobileType(); - if (!var.annotation().type) - { - if (valueComponentType->category() == Type::Category::RationalNumber) - m_errorReporter.fatalTypeError( - 6963_error, - _statement.initialValue()->location(), - "Invalid rational " + - valueComponentType->toString() + - " (absolute value too large or division by zero)." - ); - else - solAssert(false, ""); - } - else if (*var.annotation().type == *TypeProvider::emptyTuple()) - solAssert(false, "Cannot declare variable with void (empty tuple) type."); - else if (valueComponentType->category() == Type::Category::RationalNumber) - { - string typeName = var.annotation().type->toString(true); - string extension; - if (auto type = dynamic_cast(var.annotation().type)) - { - unsigned numBits = type->numBits(); - bool isSigned = type->isSigned(); - solAssert(numBits > 0, ""); - string minValue; - string maxValue; - if (isSigned) - { - numBits--; - minValue = "-" + bigint(bigint(1) << numBits).str(); - } - else - minValue = "0"; - maxValue = bigint((bigint(1) << numBits) - 1).str(); - extension = ", which can hold values between " + minValue + " and " + maxValue; - } - else - solAssert(dynamic_cast(var.annotation().type), "Unknown type."); - } + solAssert(var.annotation().type, ""); - var.accept(*this); - } - else + var.accept(*this); + BoolResult result = valueComponentType->isImplicitlyConvertibleTo(*var.annotation().type); + if (!result) { - var.accept(*this); - BoolResult result = valueComponentType->isImplicitlyConvertibleTo(*var.annotation().type); - if (!result) + auto errorMsg = "Type " + + valueComponentType->toString() + + " is not implicitly convertible to expected type " + + var.annotation().type->toString(); + if ( + valueComponentType->category() == Type::Category::RationalNumber && + dynamic_cast(*valueComponentType).isFractional() && + valueComponentType->mobileType() + ) { - auto errorMsg = "Type " + - valueComponentType->toString() + - " is not implicitly convertible to expected type " + - var.annotation().type->toString(); - if ( - valueComponentType->category() == Type::Category::RationalNumber && - dynamic_cast(*valueComponentType).isFractional() && - valueComponentType->mobileType() - ) - { - if (var.annotation().type->operator==(*valueComponentType->mobileType())) - m_errorReporter.typeError( - 5107_error, - _statement.location(), - errorMsg + ", but it can be explicitly converted." - ); - else - m_errorReporter.typeError( - 4486_error, - _statement.location(), - errorMsg + - ". Try converting to type " + - valueComponentType->mobileType()->toString() + - " or use an explicit conversion." - ); - } + if (var.annotation().type->operator==(*valueComponentType->mobileType())) + m_errorReporter.typeError( + 5107_error, + _statement.location(), + errorMsg + ", but it can be explicitly converted." + ); else - m_errorReporter.typeErrorConcatenateDescriptions( - 9574_error, + m_errorReporter.typeError( + 4486_error, _statement.location(), - errorMsg + ".", - result.message() + errorMsg + + ". Try converting to type " + + valueComponentType->mobileType()->toString() + + " or use an explicit conversion." ); } + else + m_errorReporter.typeErrorConcatenateDescriptions( + 9574_error, + _statement.location(), + errorMsg + ".", + result.message() + ); } } @@ -1327,24 +1212,6 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) BOOST_THROW_EXCEPTION(FatalError()); } - if (autoTypeDeductionNeeded) - { - if (!typeCanBeExpressed(variables)) - m_errorReporter.syntaxError( - 3478_error, - _statement.location(), - "Use of the \"var\" keyword is disallowed. " - "Type cannot be expressed in syntax." - ); - else - m_errorReporter.syntaxError( - 1719_error, - _statement.location(), - "Use of the \"var\" keyword is disallowed. " - "Use explicit declaration `" + createTupleDecl(variables) + " = ...´ instead." - ); - } - return false; } diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 83cf70a929ab..d36f830398b8 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -614,9 +614,8 @@ bool VariableDeclaration::isEventParameter() const bool VariableDeclaration::hasReferenceOrMappingType() const { - solAssert(typeName(), ""); - solAssert(typeName()->annotation().type, "Can only be called after reference resolution"); - Type const* type = typeName()->annotation().type; + solAssert(typeName().annotation().type, "Can only be called after reference resolution"); + Type const* type = typeName().annotation().type; return type->category() == Type::Category::Mapping || dynamic_cast(type); } @@ -642,22 +641,8 @@ set VariableDeclaration::allowedDataLocations() c return locations; } else if (isLocalVariable()) - { - solAssert(typeName(), ""); - auto dataLocations = [](TypePointer _type, auto&& _recursion) -> set { - solAssert(_type, "Can only be called after reference resolution"); - switch (_type->category()) - { - case Type::Category::Array: - return _recursion(dynamic_cast(_type)->baseType(), _recursion); - case Type::Category::Mapping: - return set{ Location::Storage }; - default: - return set{ Location::Memory, Location::Storage, Location::CallData }; - } - }; - return dataLocations(typeName()->annotation().type, dataLocations); - } + // Further restrictions will be imposed later on. + return set{ Location::Memory, Location::Storage, Location::CallData }; else // Struct members etc. return set{ Location::Unspecified }; diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index ec37044a414c..dd2626417fb8 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -895,13 +895,16 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented m_isIndexed(_isIndexed), m_mutability(_mutability), m_overrides(std::move(_overrides)), - m_location(_referenceLocation) {} + m_location(_referenceLocation) + { + solAssert(m_typeName, ""); + } void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; - TypeName* typeName() const { return m_typeName.get(); } + TypeName const& typeName() const { return *m_typeName; } ASTPointer const& value() const { return m_value; } bool isLValue() const override; @@ -964,7 +967,7 @@ class VariableDeclaration: public Declaration, public StructurallyDocumented Visibility defaultVisibility() const override { return Visibility::Internal; } private: - ASTPointer m_typeName; ///< can be empty ("var") + ASTPointer m_typeName; /// Initially assigned value, can be missing. For local variables, this is stored inside /// VariableDeclarationStatement and not here. ASTPointer m_value; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index b289ef34bf61..32d0e16e87fd 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -386,7 +386,7 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node) { std::vector> attributes = { make_pair("name", _node.name()), - make_pair("typeName", toJsonOrNull(_node.typeName())), + make_pair("typeName", toJson(_node.typeName())), make_pair("constant", _node.isConstant()), make_pair("mutability", VariableDeclaration::mutabilityToString(_node.mutability())), make_pair("stateVariable", _node.isStateVariable()), diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 977741cd05c3..8e27cdba3cde 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -677,16 +677,10 @@ ASTPointer Parser::parseVariableDeclaration( RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory = _lookAheadArrayType ? ASTNodeFactory(*this, _lookAheadArrayType) : ASTNodeFactory(*this); - ASTPointer type; + ASTPointer const documentation = parseStructuredDocumentation(); - if (_lookAheadArrayType) - type = _lookAheadArrayType; - else - { - type = parseTypeName(_options.allowVar); - if (type != nullptr) - nodeFactory.setEndPositionFromNode(type); - } + ASTPointer type = _lookAheadArrayType ? _lookAheadArrayType : parseTypeName(); + nodeFactory.setEndPositionFromNode(type); if (!_options.isStateVariable && documentation != nullptr) parserError(2837_error, "Only state variables can have a docstring."); @@ -753,8 +747,6 @@ ASTPointer Parser::parseVariableDeclaration( { if (location != VariableDeclaration::Location::Unspecified) parserError(3548_error, "Location already specified."); - else if (!type) - parserError(7439_error, "Location specifier needs explicit type name."); else { switch (token) @@ -781,10 +773,7 @@ ASTPointer Parser::parseVariableDeclaration( } if (_options.allowEmptyName && m_scanner->currentToken() != Token::Identifier) - { identifier = make_shared(""); - solAssert(!_options.allowVar, ""); // allowEmptyName && allowVar makes no sense - } else { nodeFactory.markEndPosition(); @@ -908,7 +897,7 @@ ASTPointer Parser::parseUsingDirective() if (m_scanner->currentToken() == Token::Mul) m_scanner->next(); else - typeName = parseTypeName(false); + typeName = parseTypeName(); nodeFactory.markEndPosition(); expectToken(Token::Semicolon); return nodeFactory.createNode(library, typeName); @@ -971,7 +960,7 @@ ASTPointer Parser::parseTypeNameSuffix(ASTPointer type, ASTN return type; } -ASTPointer Parser::parseTypeName(bool _allowVar) +ASTPointer Parser::parseTypeName() { RecursionGuard recursionGuard(*this); ASTNodeFactory nodeFactory(*this); @@ -1004,12 +993,6 @@ ASTPointer Parser::parseTypeName(bool _allowVar) } type = nodeFactory.createNode(elemTypeName, stateMutability); } - else if (token == Token::Var) - { - if (!_allowVar) - parserError(7059_error, "Expected explicit type name."); - m_scanner->next(); - } else if (token == Token::Function) type = parseFunctionType(); else if (token == Token::Mapping) @@ -1019,9 +1002,10 @@ ASTPointer Parser::parseTypeName(bool _allowVar) else fatalParserError(3546_error, "Expected type name"); - if (type) - // Parse "[...]" postfixes for arrays. - type = parseTypeNameSuffix(type, nodeFactory); + solAssert(type, ""); + // Parse "[...]" postfixes for arrays. + type = parseTypeNameSuffix(type, nodeFactory); + return type; } @@ -1062,8 +1046,7 @@ ASTPointer Parser::parseMapping() else fatalParserError(1005_error, "Expected elementary type name or identifier for mapping key type"); expectToken(Token::Arrow); - bool const allowVar = false; - ASTPointer valueType = parseTypeName(allowVar); + ASTPointer valueType = parseTypeName(); nodeFactory.markEndPosition(); expectToken(Token::RParen); return nodeFactory.createNode(keyType, valueType); @@ -1544,53 +1527,14 @@ ASTPointer Parser::parseVariableDeclarationStateme ASTNodeFactory nodeFactory(*this); if (_lookAheadArrayType) nodeFactory.setLocation(_lookAheadArrayType->location()); + + VarDeclParserOptions options; + options.allowLocationSpecifier = true; vector> variables; + variables.emplace_back(parseVariableDeclaration(options, _lookAheadArrayType)); + nodeFactory.setEndPositionFromNode(variables.back()); + ASTPointer value; - if ( - !_lookAheadArrayType && - m_scanner->currentToken() == Token::Var && - m_scanner->peekNextToken() == Token::LParen - ) - { - // Parse `var (a, b, ,, c) = ...` into a single VariableDeclarationStatement with multiple variables. - m_scanner->next(); - m_scanner->next(); - if (m_scanner->currentToken() != Token::RParen) - while (true) - { - ASTPointer var; - if ( - m_scanner->currentToken() != Token::Comma && - m_scanner->currentToken() != Token::RParen - ) - { - ASTNodeFactory varDeclNodeFactory(*this); - varDeclNodeFactory.markEndPosition(); - ASTPointer name = expectIdentifierToken(); - var = varDeclNodeFactory.createNode( - ASTPointer(), - name, - ASTPointer(), - Visibility::Default - ); - } - variables.push_back(var); - if (m_scanner->currentToken() == Token::RParen) - break; - else - expectToken(Token::Comma); - } - nodeFactory.markEndPosition(); - m_scanner->next(); - } - else - { - VarDeclParserOptions options; - options.allowVar = true; - options.allowLocationSpecifier = true; - variables.push_back(parseVariableDeclaration(options, _lookAheadArrayType)); - nodeFactory.setEndPositionFromNode(variables.back()); - } if (m_scanner->currentToken() == Token::Assign) { m_scanner->next(); @@ -1704,11 +1648,8 @@ ASTPointer Parser::parseLeftHandSideExpression( else if (m_scanner->currentToken() == Token::New) { expectToken(Token::New); - ASTPointer typeName(parseTypeName(false)); - if (typeName) - nodeFactory.setEndPositionFromNode(typeName); - else - nodeFactory.markEndPosition(); + ASTPointer typeName(parseTypeName()); + nodeFactory.setEndPositionFromNode(typeName); expression = nodeFactory.createNode(typeName); } else if (m_scanner->currentToken() == Token::Payable) @@ -2048,7 +1989,7 @@ Parser::LookAheadInfo Parser::peekStatementType() const Token token(m_scanner->currentToken()); bool mightBeTypeName = (TokenTraits::isElementaryTypeName(token) || token == Token::Identifier); - if (token == Token::Mapping || token == Token::Function || token == Token::Var) + if (token == Token::Mapping || token == Token::Function) return LookAheadInfo::VariableDeclaration; if (mightBeTypeName) { diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index f66754045585..09bec9d6a859 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -57,7 +57,6 @@ class Parser: public langutil::ParserBase // https://stackoverflow.com/questions/17430377 VarDeclParserOptions() {} - bool allowVar = false; bool isStateVariable = false; bool allowIndexed = false; bool allowEmptyName = false; @@ -107,7 +106,7 @@ class Parser: public langutil::ParserBase ASTPointer parseIdentifier(); ASTPointer parseUserDefinedTypeName(); ASTPointer parseTypeNameSuffix(ASTPointer type, ASTNodeFactory& nodeFactory); - ASTPointer parseTypeName(bool _allowVar); + ASTPointer parseTypeName(); ASTPointer parseFunctionType(); ASTPointer parseMapping(); ASTPointer parseParameterList( diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json index 49118d4b8238..5fff3241708f 100644 --- a/test/libsolidity/ASTJSON/non_utf8.json +++ b/test/libsolidity/ASTJSON/non_utf8.json @@ -4,10 +4,10 @@ { "C": [ - 8 + 9 ] }, - "id": 9, + "id": 10, "nodeType": "SourceUnit", "nodes": [ @@ -17,10 +17,10 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 8, + "id": 9, "linearizedBaseContracts": [ - 8 + 9 ], "name": "C", "nodeType": "ContractDefinition", @@ -29,48 +29,60 @@ { "body": { - "id": 6, + "id": 7, "nodeType": "Block", - "src": "33:20:1", + "src": "33:30:1", "statements": [ { "assignments": [ - 3 + 4 ], "declarations": [ { "constant": false, - "id": 3, + "id": 4, "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "scope": 6, - "src": "35:5:1", + "scope": 7, + "src": "35:15:1", "stateVariable": false, - "storageLocation": "default", + "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, "visibility": "internal" } ], - "id": 5, + "id": 6, "initialValue": { "hexValue": "ff", - "id": 4, + "id": 5, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "43:7:1", + "src": "53:7:1", "typeDescriptions": { "typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9", @@ -78,12 +90,12 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "35:15:1" + "src": "35:25:1" } ] }, "functionSelector": "26121ff0", - "id": 7, + "id": 8, "implemented": true, "kind": "function", "modifiers": [], @@ -103,16 +115,16 @@ "parameters": [], "src": "33:0:1" }, - "scope": 8, - "src": "13:40:1", + "scope": 9, + "src": "13:50:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 9, - "src": "0:55:1" + "scope": 10, + "src": "0:65:1" } ], - "src": "0:56:1" + "src": "0:66:1" } diff --git a/test/libsolidity/ASTJSON/non_utf8.sol b/test/libsolidity/ASTJSON/non_utf8.sol index f9a79d2fa6de..3651a05fd62e 100644 --- a/test/libsolidity/ASTJSON/non_utf8.sol +++ b/test/libsolidity/ASTJSON/non_utf8.sol @@ -1,3 +1,3 @@ -contract C { function f() public { var x = hex"ff"; } } +contract C { function f() public { string memory x = hex"ff"; } } // ---- diff --git a/test/libsolidity/ASTJSON/non_utf8_legacy.json b/test/libsolidity/ASTJSON/non_utf8_legacy.json index e2e0bcacf003..e8d795efd88b 100644 --- a/test/libsolidity/ASTJSON/non_utf8_legacy.json +++ b/test/libsolidity/ASTJSON/non_utf8_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 8 + 9 ] } }, @@ -28,10 +28,10 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 8 + 9 ], "name": "C", - "scope": 9 + "scope": 10 }, "children": [ @@ -47,7 +47,7 @@ null ], "name": "f", - "scope": 8, + "scope": 9, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -88,7 +88,7 @@ { "assignments": [ - 3 + 4 ] }, "children": @@ -99,16 +99,28 @@ "constant": false, "mutability": "mutable", "name": "x", - "scope": 6, + "scope": 7, "stateVariable": false, - "storageLocation": "default", + "storageLocation": "memory", "type": "string", "visibility": "internal" }, - "children": [], - "id": 3, + "children": + [ + { + "attributes": + { + "name": "string", + "type": "string" + }, + "id": 3, + "name": "ElementaryTypeName", + "src": "35:6:1" + } + ], + "id": 4, "name": "VariableDeclaration", - "src": "35:5:1" + "src": "35:15:1" }, { "attributes": @@ -121,32 +133,32 @@ "token": "string", "type": "literal_string (contains invalid UTF-8 sequence at position 0)" }, - "id": 4, + "id": 5, "name": "Literal", - "src": "43:7:1" + "src": "53:7:1" } ], - "id": 5, + "id": 6, "name": "VariableDeclarationStatement", - "src": "35:15:1" + "src": "35:25:1" } ], - "id": 6, + "id": 7, "name": "Block", - "src": "33:20:1" + "src": "33:30:1" } ], - "id": 7, + "id": 8, "name": "FunctionDefinition", - "src": "13:40:1" + "src": "13:50:1" } ], - "id": 8, + "id": 9, "name": "ContractDefinition", - "src": "0:55:1" + "src": "0:65:1" } ], - "id": 9, + "id": 10, "name": "SourceUnit", - "src": "0:56:1" + "src": "0:66:1" } diff --git a/test/libsolidity/ASTJSON/source_location.json b/test/libsolidity/ASTJSON/source_location.json index a13b2546994c..f56231ed73a4 100644 --- a/test/libsolidity/ASTJSON/source_location.json +++ b/test/libsolidity/ASTJSON/source_location.json @@ -4,10 +4,10 @@ { "C": [ - 11 + 12 ] }, - "id": 12, + "id": 13, "nodeType": "SourceUnit", "nodes": [ @@ -17,10 +17,10 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 11, + "id": 12, "linearizedBaseContracts": [ - 11 + 12 ], "name": "C", "nodeType": "ContractDefinition", @@ -29,48 +29,60 @@ { "body": { - "id": 9, + "id": 10, "nodeType": "Block", - "src": "26:19:1", + "src": "26:20:1", "statements": [ { "assignments": [ - 3 + 4 ], "declarations": [ { "constant": false, - "id": 3, + "id": 4, "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", - "scope": 9, - "src": "28:5:1", + "scope": 10, + "src": "28:6:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 3, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "28:4:1", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, "visibility": "internal" } ], - "id": 5, + "id": 6, "initialValue": { "hexValue": "32", - "id": 4, + "id": 5, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "36:1:1", + "src": "37:1:1", "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", @@ -79,12 +91,12 @@ "value": "2" }, "nodeType": "VariableDeclarationStatement", - "src": "28:9:1" + "src": "28:10:1" }, { "expression": { - "id": 7, + "id": 8, "isConstant": false, "isLValue": false, "isPure": false, @@ -92,35 +104,35 @@ "nodeType": "UnaryOperation", "operator": "++", "prefix": false, - "src": "39:3:1", + "src": "40:3:1", "subExpression": { - "id": 6, + "id": 7, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "39:1:1", + "referencedDeclaration": 4, + "src": "40:1:1", "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 8, + "id": 9, "nodeType": "ExpressionStatement", - "src": "39:3:1" + "src": "40:3:1" } ] }, "functionSelector": "26121ff0", - "id": 10, + "id": 11, "implemented": true, "kind": "function", "modifiers": [], @@ -140,16 +152,16 @@ "parameters": [], "src": "26:0:1" }, - "scope": 11, - "src": "13:32:1", + "scope": 12, + "src": "13:33:1", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], - "scope": 12, - "src": "0:47:1" + "scope": 13, + "src": "0:48:1" } ], - "src": "0:48:1" + "src": "0:49:1" } diff --git a/test/libsolidity/ASTJSON/source_location.sol b/test/libsolidity/ASTJSON/source_location.sol index 1b763646dc45..0960bcde6b49 100644 --- a/test/libsolidity/ASTJSON/source_location.sol +++ b/test/libsolidity/ASTJSON/source_location.sol @@ -1,3 +1,3 @@ -contract C { function f() { var x = 2; x++; } } +contract C { function f() { uint x = 2; x++; } } // ---- diff --git a/test/libsolidity/ASTJSON/source_location_legacy.json b/test/libsolidity/ASTJSON/source_location_legacy.json index 5d55cfe57fd0..bf3dfaedd468 100644 --- a/test/libsolidity/ASTJSON/source_location_legacy.json +++ b/test/libsolidity/ASTJSON/source_location_legacy.json @@ -6,7 +6,7 @@ { "C": [ - 11 + 12 ] } }, @@ -28,10 +28,10 @@ "fullyImplemented": true, "linearizedBaseContracts": [ - 11 + 12 ], "name": "C", - "scope": 12 + "scope": 13 }, "children": [ @@ -47,7 +47,7 @@ null ], "name": "f", - "scope": 11, + "scope": 12, "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -88,7 +88,7 @@ { "assignments": [ - 3 + 4 ] }, "children": @@ -99,16 +99,28 @@ "constant": false, "mutability": "mutable", "name": "x", - "scope": 9, + "scope": 10, "stateVariable": false, "storageLocation": "default", - "type": "uint8", + "type": "uint256", "visibility": "internal" }, - "children": [], - "id": 3, + "children": + [ + { + "attributes": + { + "name": "uint", + "type": "uint256" + }, + "id": 3, + "name": "ElementaryTypeName", + "src": "28:4:1" + } + ], + "id": 4, "name": "VariableDeclaration", - "src": "28:5:1" + "src": "28:6:1" }, { "attributes": @@ -122,14 +134,14 @@ "type": "int_const 2", "value": "2" }, - "id": 4, + "id": 5, "name": "Literal", - "src": "36:1:1" + "src": "37:1:1" } ], - "id": 5, + "id": 6, "name": "VariableDeclarationStatement", - "src": "28:9:1" + "src": "28:10:1" }, { "children": @@ -143,7 +155,7 @@ "lValueRequested": false, "operator": "++", "prefix": false, - "type": "uint8" + "type": "uint256" }, "children": [ @@ -154,41 +166,41 @@ [ null ], - "referencedDeclaration": 3, - "type": "uint8", + "referencedDeclaration": 4, + "type": "uint256", "value": "x" }, - "id": 6, + "id": 7, "name": "Identifier", - "src": "39:1:1" + "src": "40:1:1" } ], - "id": 7, + "id": 8, "name": "UnaryOperation", - "src": "39:3:1" + "src": "40:3:1" } ], - "id": 8, + "id": 9, "name": "ExpressionStatement", - "src": "39:3:1" + "src": "40:3:1" } ], - "id": 9, + "id": 10, "name": "Block", - "src": "26:19:1" + "src": "26:20:1" } ], - "id": 10, + "id": 11, "name": "FunctionDefinition", - "src": "13:32:1" + "src": "13:33:1" } ], - "id": 11, + "id": 12, "name": "ContractDefinition", - "src": "0:47:1" + "src": "0:48:1" } ], - "id": 12, + "id": 13, "name": "SourceUnit", - "src": "0:48:1" + "src": "0:49:1" } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index da17f79a432e..1aea3bf96037 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body) contract test { /// fun1 description function fun1(uint256 a) { - var b; + uint b; // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; @@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature) uint256 stateVar; function ///I am in the wrong place fun1(uint256 a) { - var b; + uint b; // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; @@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature) uint256 stateVar; function fun1(uint256 a) { // I should have been above the function signature (natspec comments on local variables not allowed anymore) - var b; + uint b; // I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore) uint256 c; mapping(address=>bytes32) d; @@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(variable_definition) char const* text = R"( contract test { function fun(uint256 a) { - var b; + uint b; uint256 c; mapping(address=>bytes32) d; customtype varname; @@ -349,7 +349,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization) char const* text = R"( contract test { function fun(uint256 a) { - var b = 2; + uint b = 2; uint256 c = 0x87; mapping(address=>bytes32) d; bytes7 name = "Solidity"; @@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_to_dynamic_array) char const* text = R"( contract test { function fun() { - var x = uint64[](3); + uint x = uint64[](3); } } )"; diff --git a/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol b/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol index feb4a9ed0684..5c7260f36fd0 100644 --- a/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol +++ b/test/libsolidity/syntaxTests/functionCalls/int_not_callable.sol @@ -1,8 +1,8 @@ contract C { function f ( ) public { - var i = ( ( 1 ( 3 ) ) , 2 ); + ( ( 1 ( 3 ) ) , 2 ); } } // ---- -// TypeError 5704: (61-68): Type is not callable +// TypeError 5704: (53-60): Type is not callable diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol b/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol index dda35f8ce88d..aa1f63e4ce0c 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/memory_mapping_array.sol @@ -4,4 +4,4 @@ } } // ---- -// TypeError 6651: (91-136): Data location must be "storage" for variable, but "memory" was given. +// TypeError 4061: (91-136): Type mapping(string => uint24)[1] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol index 0e50ae138dfe..15118322fa48 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol @@ -4,12 +4,11 @@ contract b { } c d; - function e() public { - var d = d; + function e() public view { + c storage x = d; + x.a[0]; } } // ---- -// Warning 2519: (105-110): This declaration shadows an existing declaration. // Warning 3408: (66-69): Variable "d" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// Warning 2332: (105-110): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// SyntaxError 1719: (105-114): Use of the "var" keyword is disallowed. Use explicit declaration `struct b.c storage pointer d = ...´ instead. +// Warning 2332: (110-111): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol index b60ba189646c..d9e929da2af1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/207_no_mappings_in_memory_array.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 6651: (47-77): Data location must be "storage" for variable, but "memory" was given. +// TypeError 4061: (47-77): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol index 74764ed30dcc..cbcb02f6fbbc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/invalidArgs/creating_struct_members_skipped.sol @@ -2,8 +2,8 @@ contract C { struct S { uint a; uint b; mapping(uint=>uint) c; } function f() public { - S memory s = S({a: 1}); + S({a: 1}); } } // ---- -// TypeError 9515: (117-126): Struct containing a (nested) mapping cannot be constructed. +// TypeError 9515: (104-113): Struct containing a (nested) mapping cannot be constructed. diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol index 35d145a3b86a..19af8c2c7400 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var memory x; } } // ---- -// ParserError 7439: (35-41): Location specifier needs explicit type name. +// ParserError 6933: (31-34): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol index 5d3e6acaa5cd..fb3855c885cd 100644 --- a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol +++ b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError 7059: (35-38): Expected explicit type name. +// ParserError 3546: (35-38): Expected type name diff --git a/test/libsolidity/syntaxTests/parsing/return_var.sol b/test/libsolidity/syntaxTests/parsing/return_var.sol deleted file mode 100644 index 87c706d5837a..000000000000 --- a/test/libsolidity/syntaxTests/parsing/return_var.sol +++ /dev/null @@ -1,25 +0,0 @@ -contract C { - function f() returns(var) {} - function f() returns(var x) {} - function f() returns(var x, uint y) {} - function f() returns(uint x, var y) {} - function f() returns(var x, var y) {} - function f() public pure returns (var storage) {} - function f() public pure returns (var storage x) {} - function f() public pure returns (var storage x, var storage y) {} -} -// ---- -// ParserError 7059: (38-41): Expected explicit type name. -// ParserError 7059: (71-74): Expected explicit type name. -// ParserError 7059: (106-109): Expected explicit type name. -// ParserError 7059: (157-160): Expected explicit type name. -// ParserError 7059: (192-195): Expected explicit type name. -// ParserError 7059: (199-202): Expected explicit type name. -// ParserError 7059: (247-250): Expected explicit type name. -// ParserError 7439: (251-258): Location specifier needs explicit type name. -// ParserError 7059: (301-304): Expected explicit type name. -// ParserError 7439: (305-312): Location specifier needs explicit type name. -// ParserError 7059: (357-360): Expected explicit type name. -// ParserError 7439: (361-368): Location specifier needs explicit type name. -// ParserError 7059: (372-375): Expected explicit type name. -// ParserError 7439: (376-383): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol index 4ed1afe9307f..45c529a7770e 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -1,7 +1,7 @@ contract C { function f() { - var a = (2 2); + uint a = (2 2); } } // ---- -// ParserError 2314: (42-43): Expected ',' but got 'Number' +// ParserError 2314: (43-44): Expected ',' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index 132d234c442a..160b073a489b 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError 2314: (34-35): Expected identifier but got '[' +// ParserError 6933: (31-34): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol deleted file mode 100644 index 85d78441d7d8..000000000000 --- a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol +++ /dev/null @@ -1,25 +0,0 @@ -contract C { - function f(var) public pure {} - function f(var x) public pure {} - function f(var x, var y) public pure {} - function f(uint x, var y) public pure {} - function f(var x, uint y) public pure {} - function f(var storage) public pure {} - function f(var storage x) public pure {} - function f(var storage x, var storage y) public pure {} -} -// ---- -// ParserError 7059: (28-31): Expected explicit type name. -// ParserError 7059: (63-66): Expected explicit type name. -// ParserError 7059: (100-103): Expected explicit type name. -// ParserError 7059: (107-110): Expected explicit type name. -// ParserError 7059: (152-155): Expected explicit type name. -// ParserError 7059: (189-192): Expected explicit type name. -// ParserError 7059: (234-237): Expected explicit type name. -// ParserError 7439: (238-245): Location specifier needs explicit type name. -// ParserError 7059: (277-280): Expected explicit type name. -// ParserError 7439: (281-288): Location specifier needs explicit type name. -// ParserError 7059: (322-325): Expected explicit type name. -// ParserError 7439: (326-333): Location specifier needs explicit type name. -// ParserError 7059: (337-340): Expected explicit type name. -// ParserError 7439: (341-348): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/structs/struct_var_member.sol b/test/libsolidity/syntaxTests/structs/struct_var_member.sol deleted file mode 100644 index 8d42459ae8c3..000000000000 --- a/test/libsolidity/syntaxTests/structs/struct_var_member.sol +++ /dev/null @@ -1,7 +0,0 @@ -contract C { - struct S { - var x; - } -} -// ---- -// ParserError 7059: (27-30): Expected explicit type name. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol index 3652aebe2b3d..86f971d38f37 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError 6651: (81-113): Data location must be "storage" for variable, but "calldata" was given. +// TypeError 4061: (81-113): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol index 490d987ad268..6874deb88946 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError 6651: (81-104): Data location must be "storage" for variable, but none was given. +// TypeError 6651: (81-104): Data location must be "storage", "memory" or "calldata" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol index 1b04b63fd1b6..f31c79315757 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError 6651: (81-111): Data location must be "storage" for variable, but "memory" was given. +// TypeError 4061: (81-111): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping. diff --git a/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol index 5c67ae5e8c07..00301cde0aa2 100644 --- a/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol +++ b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol @@ -4,13 +4,11 @@ contract C { function h() internal pure returns (uint, uint) { return (1, 2); } function test() internal pure { - var () = f(); - var () = g(); - var (,) = h(); + () = f(); + () = g(); + (,) = h(); } } // ---- -// SyntaxError 3299: (223-235): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError 3299: (245-257): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError 3299: (267-280): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. +// ParserError 6933: (224-225): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol b/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol index 8561b1cba330..314d2bb73ce5 100644 --- a/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol +++ b/test/libsolidity/syntaxTests/types/var_decl_val_mismatch.sol @@ -3,13 +3,14 @@ contract n fallback() external { // Used to cause a segfault - var (x,y) = (1); - var (z) = (); + (uint x, ) = (1); + (uint z) = (); assembly { - mstore(y, z) + mstore(x, z) } } } // ---- -// TypeError 7364: (69-84): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (69-85): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError 7364: (89-102): Different number of components on the left hand side (1) than on the right hand side (0). diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol deleted file mode 100644 index 0106fd92c8c8..000000000000 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract C { - function f() public pure { - var (); - var (,); - } -} -// ---- -// SyntaxError 3299: (52-58): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. -// SyntaxError 3299: (68-75): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol index 09572cb08b44..7f55029c2157 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError 6983: (52-57): Use of the "var" keyword is disallowed. +// ParserError 6933: (52-55): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol index 179d63533750..dad288d79f15 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol @@ -6,4 +6,4 @@ contract C { } } // ---- -// TypeError 4626: (52-62): Use of the "var" keyword is disallowed. +// ParserError 6933: (52-55): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol index 8166f5284d7c..caf1787616aa 100644 --- a/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol +++ b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 4626: (52-63): Use of the "var" keyword is disallowed. +// ParserError 6933: (52-55): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol b/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol index 893d49637d74..c56e50b62eb9 100644 --- a/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol +++ b/test/libsolidity/syntaxTests/types/var_type_invalid_rational.sol @@ -1,8 +1,8 @@ contract C { function f() internal pure { - var i = 31415999999999999999999999999999999999999999999999999999999999999999933**3; - var unreachable = 123; + uint i = 31415999999999999999999999999999999999999999999999999999999999999999933**3; + uint unreachable = 123; } } // ---- -// TypeError 6963: (62-136): Invalid rational int_const 3100...(204 digits omitted)...9237 (absolute value too large or division by zero). +// TypeError 9574: (54-137): Type int_const 3100...(204 digits omitted)...9237 is not implicitly convertible to expected type uint256. Literal is too large to fit in uint256. diff --git a/test/libsolidity/syntaxTests/types/var_type_suggest.sol b/test/libsolidity/syntaxTests/types/var_type_suggest.sol deleted file mode 100644 index 65d91cd1e159..000000000000 --- a/test/libsolidity/syntaxTests/types/var_type_suggest.sol +++ /dev/null @@ -1,30 +0,0 @@ -contract C { - function h() internal pure returns (uint, uint, uint) { - return (1, 2, 4); - } - function g(uint x) internal pure returns (uint) { - return x; - } - function f() internal pure { - var s = -31415; - var i = 31415; - var t = "string"; - var g2 = g; - var myblockhash = block.blockhash; - var (a, b) = (2, "troi"); - var (x,, z) = h(); - var (c, d) = (""); - var (k, l) = (2); - var (m, n) = 1; - var (o, p) = ""; - } -} -// ---- -// SyntaxError 1719: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...´ instead. -// SyntaxError 1719: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead. -// SyntaxError 1719: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead. -// SyntaxError 1719: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead. -// SyntaxError 3478: (317-350): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax. -// SyntaxError 1719: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead. -// SyntaxError 1719: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead. -// TypeError 7364: (421-438): Different number of components on the left hand side (2) than on the right hand side (1). From ba0a4de50d11602dcde83a2648a96a7b1590e6eb Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 29 Jun 2020 14:30:09 +0200 Subject: [PATCH 417/479] NatSpec: Implement ``@inheritdoc`` --- Changelog.md | 1 + docs/natspec-format.rst | 50 +- libsolidity/CMakeLists.txt | 2 + libsolidity/analysis/DocStringAnalyser.cpp | 184 ++---- libsolidity/analysis/DocStringAnalyser.h | 32 +- libsolidity/analysis/DocStringTagParser.cpp | 227 +++++++ libsolidity/analysis/DocStringTagParser.h | 76 +++ libsolidity/analysis/ReferencesResolver.cpp | 68 ++- libsolidity/analysis/ReferencesResolver.h | 3 + libsolidity/ast/ASTAnnotations.h | 2 + libsolidity/interface/CompilerStack.cpp | 7 + libsolidity/interface/Natspec.cpp | 30 +- test/libsolidity/SolidityNatspecJSON.cpp | 562 +++++++++++++++++- .../natspec/invalid/docstring_inheritdoc.sol | 7 + .../natspec/invalid/docstring_inheritdoc2.sol | 10 + .../natspec/invalid/docstring_inheritdoc3.sol | 11 + .../docstring_inheritdoc_wrong_type.sol | 8 + .../natspec/invalid/inherit_doc_events.sol | 17 + 18 files changed, 1080 insertions(+), 217 deletions(-) create mode 100644 libsolidity/analysis/DocStringTagParser.cpp create mode 100644 libsolidity/analysis/DocStringTagParser.h create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc.sol create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc2.sol create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc3.sol create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_wrong_type.sol create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/inherit_doc_events.sol diff --git a/Changelog.md b/Changelog.md index e0987a9195b9..abfdb3a79cdb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Compiler Features: * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. * Peephole Optimizer: Remove unnecessary masking of tags. * Yul EVM Code Transform: Free stack slots directly after visiting the right-hand-side of variable declarations instead of at the end of the statement only. + * NatSpec: Implement tag ``@inheritdoc`` to copy documentation from a specific contract. Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst index ec774014bb6b..c566d54078b3 100644 --- a/docs/natspec-format.rst +++ b/docs/natspec-format.rst @@ -49,7 +49,7 @@ The following example shows a contract and a function using all available tags. .. code:: solidity // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.7.0; + pragma solidity >0.6.10 <0.7.0; /// @title A simulator for trees /// @author Larry A. Gardner @@ -60,9 +60,33 @@ The following example shows a contract and a function using all available tags. /// @dev The Alexandr N. Tetearing algorithm could increase precision /// @param rings The number of rings from dendrochronological sample /// @return age in years, rounded up for partial years - function age(uint256 rings) external pure returns (uint256) { + function age(uint256 rings) external virtual pure returns (uint256) { return rings + 1; } + + /// @notice Returns the amount of leaves the tree has. + /// @dev Returns only a fixed number. + function leaves() external virtual pure returns(uint256) { + return 2; + } + } + + contract Plant { + function leaves() external virtual pure returns(uint256) { + return 3; + } + } + + contract KumquatTree is Tree, Plant { + function age(uint256 rings) external override pure returns (uint256) { + return rings + 2; + } + + /// Return the amount of leaves that this specific kind of tree has + /// @inheritdoc Tree + function leaves() external override(Tree, Plant) pure returns(uint256) { + return 3; + } } .. _header-tags: @@ -75,16 +99,17 @@ NatSpec tag and where it may be used. As a special case, if no tags are used then the Solidity compiler will interpret a ``///`` or ``/**`` comment in the same way as if it were tagged with ``@notice``. -=========== =============================================================================== ============================= -Tag Context -=========== =============================================================================== ============================= -``@title`` A title that should describe the contract/interface contract, interface -``@author`` The name of the author contract, interface -``@notice`` Explain to an end user what this does contract, interface, function, public state variable, event -``@dev`` Explain to a developer any extra details contract, interface, function, state variable, event -``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function, event -``@return`` Documents the return variables of a contract's function function, public state variable -=========== =============================================================================== ============================= +=============== ====================================================================================== ============================= +Tag Context +=============== ====================================================================================== ============================= +``@title`` A title that should describe the contract/interface contract, interface +``@author`` The name of the author contract, interface +``@notice`` Explain to an end user what this does contract, interface, function, public state variable, event +``@dev`` Explain to a developer any extra details contract, interface, function, state variable, event +``@param`` Documents a parameter just like in doxygen (must be followed by parameter name) function, event +``@return`` Documents the return variables of a contract's function function, public state variable +``@inheritdoc`` Copies all missing tags from the base function (must be followed by the contract name) function, public state variable +=============== ====================================================================================== ============================= If your function returns multiple values, like ``(int quotient, int remainder)`` then use multiple ``@return`` statements in the same format as the @@ -127,6 +152,7 @@ base function. Exceptions to this are: * When the parameter names are different. * When there is more than one base function. + * When there is an explicit ``@inheritdoc`` tag which specifies which contract should be used to inherit. .. _header-output: diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 8e930b6ab9b5..74f4a9a21e02 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -16,6 +16,8 @@ set(sources analysis/DeclarationTypeChecker.h analysis/DocStringAnalyser.cpp analysis/DocStringAnalyser.h + analysis/DocStringTagParser.cpp + analysis/DocStringTagParser.h analysis/ImmutableValidator.cpp analysis/ImmutableValidator.h analysis/GlobalContext.cpp diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 96fde8550292..94a841e00e81 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -53,6 +53,17 @@ void copyMissingTags(StructurallyDocumentedAnnotation& _target, set const& _baseFunctions, int64_t _contractId) +{ + for (CallableDeclaration const* baseFuncCandidate: _baseFunctions) + if (baseFuncCandidate->annotation().contract->id() == _contractId) + return baseFuncCandidate; + else if (auto callable = findBaseCallable(baseFuncCandidate->annotation().baseFunctions, _contractId)) + return callable; + + return nullptr; +} + bool parameterNamesEqual(CallableDeclaration const& _a, CallableDeclaration const& _b) { return boost::range::equal(_a.parameters(), _b.parameters(), [](auto const& pa, auto const& pb) { return pa->name() == pb->name(); }); @@ -67,50 +78,23 @@ bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit) return errorWatcher.ok(); } -bool DocStringAnalyser::visit(ContractDefinition const& _contract) -{ - static set const validTags = set{"author", "title", "dev", "notice"}; - parseDocStrings(_contract, _contract.annotation(), validTags, "contracts"); - - return true; -} - bool DocStringAnalyser::visit(FunctionDefinition const& _function) { - if (_function.isConstructor()) - handleConstructor(_function, _function, _function.annotation()); - else + if (!_function.isConstructor()) handleCallable(_function, _function, _function.annotation()); return true; } bool DocStringAnalyser::visit(VariableDeclaration const& _variable) { - if (_variable.isStateVariable()) - { - static set const validPublicTags = set{"dev", "notice", "return", "title", "author"}; - if (_variable.isPublic()) - parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); - else - { - parseDocStrings(_variable, _variable.annotation(), validPublicTags, "non-public state variables"); - if (_variable.annotation().docTags.count("notice") > 0) - m_errorReporter.warning( - 7816_error, _variable.documentation()->location(), - "Documentation tag on non-public state variables will be disallowed in 0.7.0. " - "You will need to use the @dev tag explicitly." - ); - } - if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) - m_errorReporter.warning( - 8532_error, _variable.documentation()->location(), - "Documentation tag @title and @author is only allowed on contract definitions. " - "It will be disallowed in 0.7.0." - ); + if (!_variable.isStateVariable()) + return false; + + if (CallableDeclaration const* baseFunction = resolveInheritDoc(_variable.annotation().baseFunctions, _variable, _variable.annotation())) + copyMissingTags(_variable.annotation(), {baseFunction}); + else if (_variable.annotation().docTags.empty()) + copyMissingTags(_variable.annotation(), _variable.annotation().baseFunctions); - if (_variable.annotation().docTags.empty()) - copyMissingTags(_variable.annotation(), _variable.annotation().baseFunctions); - } return false; } @@ -128,133 +112,41 @@ bool DocStringAnalyser::visit(EventDefinition const& _event) return true; } -void DocStringAnalyser::checkParameters( - CallableDeclaration const& _callable, - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation -) -{ - set validParams; - for (auto const& p: _callable.parameters()) - validParams.insert(p->name()); - if (_callable.returnParameterList()) - for (auto const& p: _callable.returnParameterList()->parameters()) - validParams.insert(p->name()); - auto paramRange = _annotation.docTags.equal_range("param"); - for (auto i = paramRange.first; i != paramRange.second; ++i) - if (!validParams.count(i->second.paramName)) - m_errorReporter.docstringParsingError( - 3881_error, - _node.documentation()->location(), - "Documented parameter \"" + - i->second.paramName + - "\" not found in the parameter list of the function." - ); - -} - -void DocStringAnalyser::handleConstructor( - CallableDeclaration const& _callable, - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation -) -{ - static set const validTags = set{"author", "dev", "notice", "param"}; - parseDocStrings(_node, _annotation, validTags, "constructor"); - checkParameters(_callable, _node, _annotation); -} - void DocStringAnalyser::handleCallable( CallableDeclaration const& _callable, StructurallyDocumented const& _node, StructurallyDocumentedAnnotation& _annotation ) { - static set const validTags = set{"author", "dev", "notice", "return", "param"}; - parseDocStrings(_node, _annotation, validTags, "functions"); - checkParameters(_callable, _node, _annotation); - - if ( + if (CallableDeclaration const* baseFunction = resolveInheritDoc(_callable.annotation().baseFunctions, _node, _annotation)) + copyMissingTags(_annotation, {baseFunction}); + else if ( _annotation.docTags.empty() && _callable.annotation().baseFunctions.size() == 1 && parameterNamesEqual(_callable, **_callable.annotation().baseFunctions.begin()) ) copyMissingTags(_annotation, _callable.annotation().baseFunctions); - - if (_node.documentation() && _annotation.docTags.count("author") > 0) - m_errorReporter.warning( - 9843_error, _node.documentation()->location(), - "Documentation tag @author is only allowed on contract definitions. " - "It will be disallowed in 0.7.0." - ); } -void DocStringAnalyser::parseDocStrings( +CallableDeclaration const* DocStringAnalyser::resolveInheritDoc( + set const& _baseFuncs, StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation, - set const& _validTags, - string const& _nodeName + StructurallyDocumentedAnnotation& _annotation ) { - DocStringParser parser; - if (_node.documentation() && !_node.documentation()->text()->empty()) - { - parser.parse(*_node.documentation()->text(), m_errorReporter); - _annotation.docTags = parser.tags(); - } + if (_annotation.inheritdocReference == nullptr) + return nullptr; + + if (auto const callable = findBaseCallable(_baseFuncs, _annotation.inheritdocReference->id())) + return callable; - size_t returnTagsVisited = 0; - for (auto const& docTag: _annotation.docTags) - { - if (!_validTags.count(docTag.first)) - m_errorReporter.docstringParsingError( - 6546_error, - _node.documentation()->location(), - "Documentation tag @" + docTag.first + " not valid for " + _nodeName + "." - ); - else - if (docTag.first == "return") - { - returnTagsVisited++; - if (auto* varDecl = dynamic_cast(&_node)) - { - if (!varDecl->isPublic()) - m_errorReporter.docstringParsingError( - 9440_error, - _node.documentation()->location(), - "Documentation tag \"@" + docTag.first + "\" is only allowed on public state-variables." - ); - if (returnTagsVisited > 1) - m_errorReporter.docstringParsingError( - 5256_error, - _node.documentation()->location(), - "Documentation tag \"@" + docTag.first + "\" is only allowed once on state-variables." - ); - } - else if (auto* function = dynamic_cast(&_node)) - { - string content = docTag.second.content; - string firstWord = content.substr(0, content.find_first_of(" \t")); + m_errorReporter.docstringParsingError( + 4682_error, + _node.documentation()->location(), + "Documentation tag @inheritdoc references contract \"" + + _annotation.inheritdocReference->name() + + "\", but the contract does not contain a function that is overridden by this function." + ); - if (returnTagsVisited > function->returnParameters().size()) - m_errorReporter.docstringParsingError( - 2604_error, - _node.documentation()->location(), - "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + - " exceeds the number of return parameters." - ); - else - { - auto parameter = function->returnParameters().at(returnTagsVisited - 1); - if (!parameter->name().empty() && parameter->name() != firstWord) - m_errorReporter.docstringParsingError( - 5856_error, - _node.documentation()->location(), - "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + - " does not contain the name of its return parameter." - ); - } - } - } - } + return nullptr; } diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index ee79cd9f7719..e13cab8985a4 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -15,12 +15,6 @@ along with solidity. If not, see . */ // SPDX-License-Identifier: GPL-3.0 -/** - * @author Christian - * @date 2015 - * Parses and analyses the doc strings. - * Stores the parsing results in the AST annotations and reports errors. - */ #pragma once @@ -35,7 +29,7 @@ namespace solidity::frontend { /** - * Parses and analyses the doc strings. + * Analyses and validates the doc strings. * Stores the parsing results in the AST annotations and reports errors. */ class DocStringAnalyser: private ASTConstVisitor @@ -45,20 +39,13 @@ class DocStringAnalyser: private ASTConstVisitor bool analyseDocStrings(SourceUnit const& _sourceUnit); private: - bool visit(ContractDefinition const& _contract) override; bool visit(FunctionDefinition const& _function) override; bool visit(VariableDeclaration const& _variable) override; bool visit(ModifierDefinition const& _modifier) override; bool visit(EventDefinition const& _event) override; - void checkParameters( - CallableDeclaration const& _callable, - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation - ); - - void handleConstructor( - CallableDeclaration const& _callable, + CallableDeclaration const* resolveInheritDoc( + std::set const& _baseFunctions, StructurallyDocumented const& _node, StructurallyDocumentedAnnotation& _annotation ); @@ -69,19 +56,6 @@ class DocStringAnalyser: private ASTConstVisitor StructurallyDocumentedAnnotation& _annotation ); - void handleDeclaration( - Declaration const& _declaration, - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation - ); - - void parseDocStrings( - StructurallyDocumented const& _node, - StructurallyDocumentedAnnotation& _annotation, - std::set const& _validTags, - std::string const& _nodeName - ); - langutil::ErrorReporter& m_errorReporter; }; diff --git a/libsolidity/analysis/DocStringTagParser.cpp b/libsolidity/analysis/DocStringTagParser.cpp new file mode 100644 index 000000000000..36fec2f2cabc --- /dev/null +++ b/libsolidity/analysis/DocStringTagParser.cpp @@ -0,0 +1,227 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +/** + * @author Christian + * @date 2015 + * Parses and analyses the doc strings. + * Stores the parsing results in the AST annotations and reports errors. + */ + +#include + +#include +#include +#include +#include + +using namespace std; +using namespace solidity; +using namespace solidity::langutil; +using namespace solidity::frontend; + +bool DocStringTagParser::parseDocStrings(SourceUnit const& _sourceUnit) +{ + auto errorWatcher = m_errorReporter.errorWatcher(); + _sourceUnit.accept(*this); + return errorWatcher.ok(); +} + +bool DocStringTagParser::visit(ContractDefinition const& _contract) +{ + static set const validTags = set{"author", "title", "dev", "notice"}; + parseDocStrings(_contract, _contract.annotation(), validTags, "contracts"); + + return true; +} + +bool DocStringTagParser::visit(FunctionDefinition const& _function) +{ + if (_function.isConstructor()) + handleConstructor(_function, _function, _function.annotation()); + else + handleCallable(_function, _function, _function.annotation()); + return true; +} + +bool DocStringTagParser::visit(VariableDeclaration const& _variable) +{ + if (_variable.isStateVariable()) + { + static set const validPublicTags = set{"dev", "notice", "return", "title", "author", "inheritdoc"}; + if (_variable.isPublic()) + parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); + else + { + parseDocStrings(_variable, _variable.annotation(), validPublicTags, "non-public state variables"); + if (_variable.annotation().docTags.count("notice") > 0) + m_errorReporter.warning( + 7816_error, _variable.documentation()->location(), + "Documentation tag on non-public state variables will be disallowed in 0.7.0. " + "You will need to use the @dev tag explicitly." + ); + } + if (_variable.annotation().docTags.count("title") > 0 || _variable.annotation().docTags.count("author") > 0) + m_errorReporter.warning( + 8532_error, _variable.documentation()->location(), + "Documentation tag @title and @author is only allowed on contract definitions. " + "It will be disallowed in 0.7.0." + ); + } + return false; +} + +bool DocStringTagParser::visit(ModifierDefinition const& _modifier) +{ + handleCallable(_modifier, _modifier, _modifier.annotation()); + + return true; +} + +bool DocStringTagParser::visit(EventDefinition const& _event) +{ + handleCallable(_event, _event, _event.annotation()); + + return true; +} + +void DocStringTagParser::checkParameters( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation +) +{ + set validParams; + for (auto const& p: _callable.parameters()) + validParams.insert(p->name()); + if (_callable.returnParameterList()) + for (auto const& p: _callable.returnParameterList()->parameters()) + validParams.insert(p->name()); + auto paramRange = _annotation.docTags.equal_range("param"); + for (auto i = paramRange.first; i != paramRange.second; ++i) + if (!validParams.count(i->second.paramName)) + m_errorReporter.docstringParsingError( + 3881_error, + _node.documentation()->location(), + "Documented parameter \"" + + i->second.paramName + + "\" not found in the parameter list of the function." + ); +} + +void DocStringTagParser::handleConstructor( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation +) +{ + static set const validTags = set{"author", "dev", "notice", "param"}; + parseDocStrings(_node, _annotation, validTags, "constructor"); + checkParameters(_callable, _node, _annotation); +} + +void DocStringTagParser::handleCallable( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation +) +{ + static set const validEventTags = set{"author", "dev", "notice", "return", "param"}; + static set const validTags = set{"author", "dev", "notice", "return", "param", "inheritdoc"}; + + if (dynamic_cast(&_callable)) + parseDocStrings(_node, _annotation, validEventTags, "events"); + else + parseDocStrings(_node, _annotation, validTags, "functions"); + + checkParameters(_callable, _node, _annotation); + + if (_node.documentation() && _annotation.docTags.count("author") > 0) + m_errorReporter.warning( + 9843_error, _node.documentation()->location(), + "Documentation tag @author is only allowed on contract definitions. " + "It will be disallowed in 0.7.0." + ); +} + +void DocStringTagParser::parseDocStrings( + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation, + set const& _validTags, + string const& _nodeName +) +{ + DocStringParser parser; + if (_node.documentation() && !_node.documentation()->text()->empty()) + { + parser.parse(*_node.documentation()->text(), m_errorReporter); + _annotation.docTags = parser.tags(); + } + + size_t returnTagsVisited = 0; + for (auto const& docTag: _annotation.docTags) + { + if (!_validTags.count(docTag.first)) + m_errorReporter.docstringParsingError( + 6546_error, + _node.documentation()->location(), + "Documentation tag @" + docTag.first + " not valid for " + _nodeName + "." + ); + else if (docTag.first == "return") + { + returnTagsVisited++; + if (auto const* varDecl = dynamic_cast(&_node)) + { + if (!varDecl->isPublic()) + m_errorReporter.docstringParsingError( + 9440_error, + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + "\" is only allowed on public state-variables." + ); + if (returnTagsVisited > 1) + m_errorReporter.docstringParsingError( + 5256_error, + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + "\" is only allowed once on state-variables." + ); + } + else if (auto const* function = dynamic_cast(&_node)) + { + string content = docTag.second.content; + string firstWord = content.substr(0, content.find_first_of(" \t")); + + if (returnTagsVisited > function->returnParameters().size()) + m_errorReporter.docstringParsingError( + 2604_error, + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + + " exceeds the number of return parameters." + ); + else + { + auto parameter = function->returnParameters().at(returnTagsVisited - 1); + if (!parameter->name().empty() && parameter->name() != firstWord) + m_errorReporter.docstringParsingError( + 5856_error, + _node.documentation()->location(), + "Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" + + " does not contain the name of its return parameter." + ); + } + } + } + } +} diff --git a/libsolidity/analysis/DocStringTagParser.h b/libsolidity/analysis/DocStringTagParser.h new file mode 100644 index 000000000000..41dcca5dfcd1 --- /dev/null +++ b/libsolidity/analysis/DocStringTagParser.h @@ -0,0 +1,76 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +// SPDX-License-Identifier: GPL-3.0 + +#pragma once + +#include + +namespace solidity::langutil +{ +class ErrorReporter; +} + +namespace solidity::frontend +{ + +/** + * Parses the doc tags and does basic validity checks. + * Stores the parsing results in the AST annotations and reports errors. + */ +class DocStringTagParser: private ASTConstVisitor +{ +public: + explicit DocStringTagParser(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {} + bool parseDocStrings(SourceUnit const& _sourceUnit); + +private: + bool visit(ContractDefinition const& _contract) override; + bool visit(FunctionDefinition const& _function) override; + bool visit(VariableDeclaration const& _variable) override; + bool visit(ModifierDefinition const& _modifier) override; + bool visit(EventDefinition const& _event) override; + + void checkParameters( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation + ); + + void handleConstructor( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation + ); + + void handleCallable( + CallableDeclaration const& _callable, + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation + ); + + void parseDocStrings( + StructurallyDocumented const& _node, + StructurallyDocumentedAnnotation& _annotation, + std::set const& _validTags, + std::string const& _nodeName + ); + + langutil::ErrorReporter& m_errorReporter; +}; + +} diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 10ad415c114d..4d26f1888326 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -36,6 +36,7 @@ #include #include +#include using namespace std; using namespace solidity::langutil; @@ -106,6 +107,14 @@ void ReferencesResolver::endVisit(VariableDeclarationStatement const& _varDeclSt m_resolver.activateVariable(var->name()); } +bool ReferencesResolver::visit(VariableDeclaration const& _varDecl) +{ + if (_varDecl.documentation()) + resolveInheritDoc(*_varDecl.documentation(), _varDecl.annotation()); + + return true; +} + bool ReferencesResolver::visit(Identifier const& _identifier) { auto declarations = m_resolver.nameFromCurrentScope(_identifier.name()); @@ -132,6 +141,10 @@ bool ReferencesResolver::visit(Identifier const& _identifier) bool ReferencesResolver::visit(FunctionDefinition const& _functionDefinition) { m_returnParameters.push_back(_functionDefinition.returnParameterList().get()); + + if (_functionDefinition.documentation()) + resolveInheritDoc(*_functionDefinition.documentation(), _functionDefinition.annotation()); + return true; } @@ -141,9 +154,13 @@ void ReferencesResolver::endVisit(FunctionDefinition const&) m_returnParameters.pop_back(); } -bool ReferencesResolver::visit(ModifierDefinition const&) +bool ReferencesResolver::visit(ModifierDefinition const& _modifierDefinition) { m_returnParameters.push_back(nullptr); + + if (_modifierDefinition.documentation()) + resolveInheritDoc(*_modifierDefinition.documentation(), _modifierDefinition.annotation()); + return true; } @@ -284,4 +301,53 @@ void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl) visit(*_varDecl.value); } +void ReferencesResolver::resolveInheritDoc(StructuredDocumentation const& _documentation, StructurallyDocumentedAnnotation& _annotation) +{ + switch (_annotation.docTags.count("inheritdoc")) + { + case 0: + break; + case 1: + { + string const& name = _annotation.docTags.find("inheritdoc")->second.content; + vector path; + boost::split(path, name, boost::is_any_of(".")); + Declaration const* result = m_resolver.pathFromCurrentScope(path); + + if (result == nullptr) + { + m_errorReporter.docstringParsingError( + 9397_error, + _documentation.location(), + "Documentation tag @inheritdoc references inexistent contract \"" + + name + + "\"." + ); + return; + } + else + { + _annotation.inheritdocReference = dynamic_cast(result); + + if (!_annotation.inheritdocReference) + m_errorReporter.docstringParsingError( + 1430_error, + _documentation.location(), + "Documentation tag @inheritdoc reference \"" + + name + + "\" is not a contract." + ); + } + break; + } + default: + m_errorReporter.docstringParsingError( + 5142_error, + _documentation.location(), + "Documentation tag @inheritdoc can only be given once." + ); + break; + } +} + } diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index 710f388cbf17..fc71b4d4edac 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -76,6 +76,7 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker bool visit(ForStatement const& _for) override; void endVisit(ForStatement const& _for) override; void endVisit(VariableDeclarationStatement const& _varDeclStatement) override; + bool visit(VariableDeclaration const& _varDecl) override; bool visit(Identifier const& _identifier) override; bool visit(FunctionDefinition const& _functionDefinition) override; void endVisit(FunctionDefinition const& _functionDefinition) override; @@ -89,6 +90,8 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker void operator()(yul::Identifier const& _identifier) override; void operator()(yul::VariableDeclaration const& _varDecl) override; + void resolveInheritDoc(StructuredDocumentation const& _documentation, StructurallyDocumentedAnnotation& _annotation); + langutil::ErrorReporter& m_errorReporter; NameAndTypeResolver& m_resolver; langutil::EVMVersion m_evmVersion; diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index d4df9d0cf91c..272bf6440e15 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -79,6 +79,8 @@ struct StructurallyDocumentedAnnotation /// Mapping docstring tag name -> content. std::multimap docTags; + /// contract that @inheritdoc references if it exists + ContractDefinition const* inheritdocReference = nullptr; }; struct SourceUnitAnnotation: ASTAnnotation diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index f8164bc9f3d3..27a51552e3bd 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -308,6 +309,11 @@ bool CompilerStack::analyze() if (source->ast && !syntaxChecker.checkSyntax(*source->ast)) noErrors = false; + DocStringTagParser DocStringTagParser(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (source->ast && !DocStringTagParser.parseDocStrings(*source->ast)) + noErrors = false; + m_globalContext = make_shared(); // We need to keep the same resolver during the whole process. NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter); @@ -363,6 +369,7 @@ bool CompilerStack::analyze() if (!contractLevelChecker.check(*contract)) noErrors = false; + // Requires ContractLevelChecker DocStringAnalyser docStringAnalyser(m_errorReporter); for (Source const* source: m_sourceOrder) if (source->ast && !docStringAnalyser.analyseDocStrings(*source->ast)) diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 1f5c4807af4d..67ef6f17f2f9 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -58,28 +58,22 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef) for (auto const& it: _contractDef.interfaceFunctions()) if (it.second->hasDeclaration()) { + string value; + if (auto const* f = dynamic_cast(&it.second->declaration())) - { - string value = extractDoc(f->annotation().docTags, "notice"); - if (!value.empty()) - { - Json::Value user; - // since @notice is the only user tag if missing function should not appear - user["notice"] = Json::Value(value); - methods[it.second->externalSignature()] = user; - } - } + value = extractDoc(f->annotation().docTags, "notice"); else if (auto var = dynamic_cast(&it.second->declaration())) { solAssert(var->isStateVariable() && var->isPublic(), ""); - string value = extractDoc(var->annotation().docTags, "notice"); - if (!value.empty()) - { - Json::Value user; - // since @notice is the only user tag if missing function should not appear - user["notice"] = Json::Value(value); - methods[it.second->externalSignature()] = user; - } + value = extractDoc(var->annotation().docTags, "notice"); + } + + if (!value.empty()) + { + Json::Value user; + // since @notice is the only user tag if missing function should not appear + user["notice"] = Json::Value(value); + methods[it.second->externalSignature()] = user; } } diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 8edf470f406c..26e293b68b7b 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -77,7 +77,7 @@ class DocumentationChecker BOOST_REQUIRE(Error::containsErrorOfType(m_compilerStack.errors(), Error::Type::DocstringParsingError)); } -private: +protected: CompilerStack m_compilerStack; }; @@ -1277,13 +1277,7 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit_variable) )"; char const *natspec = R"ABCDEF({ - "methods": - { - "x()": - { - "details": "test" - } - } + "methods": { "x()": { "details": "test" } } })ABCDEF"; char const *natspec1 = R"ABCDEF({ @@ -1318,15 +1312,82 @@ BOOST_AUTO_TEST_CASE(user_default_inherit_variable) )"; char const *natspec = R"ABCDEF({ - "methods": + "methods": { "x()": { "notice": "Hello world" } } + })ABCDEF"; + + checkNatspec(sourceCode, "C", natspec, true); + checkNatspec(sourceCode, "D", natspec, true); +} + +BOOST_AUTO_TEST_CASE(dev_explicit_inherit_variable) +{ + char const *sourceCode = R"( + contract B { + function x() virtual external returns (uint) { + return 1; + } + } + + contract C { + /// @notice Hello world + /// @dev test + function x() virtual external returns (uint) { + return 1; + } + } + + contract D is C, B { + /// @inheritdoc C + uint public override(C, B) x; + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": { "x()": { "details": "test" } } + })ABCDEF"; + + char const *natspec1 = R"ABCDEF({ + "methods" : {}, + "stateVariables" : { - "x()": + "x" : { - "notice": "Hello world" + "details" : "test" } } })ABCDEF"; + checkNatspec(sourceCode, "C", natspec, false); + checkNatspec(sourceCode, "D", natspec1, false); +} + +BOOST_AUTO_TEST_CASE(user_explicit_inherit_variable) +{ + char const *sourceCode = R"( + contract B { + function x() virtual external returns (uint) { + return 1; + } + } + + contract C { + /// @notice Hello world + /// @dev test + function x() virtual external returns (uint) { + return 1; + } + } + + contract D is C, B { + /// @inheritdoc C + uint public override(C, B) x; + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": { "x()": { "notice": "Hello world" } } + })ABCDEF"; + checkNatspec(sourceCode, "C", natspec, true); checkNatspec(sourceCode, "D", natspec, true); } @@ -1423,6 +1484,411 @@ BOOST_AUTO_TEST_CASE(user_default_inherit) checkNatspec(sourceCode, "Token", natspec, true); } +BOOST_AUTO_TEST_CASE(dev_explicit_inherit) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 { + function transfer(address to, uint amount) virtual external returns (bool) { + return false; + } + } + + contract Token is ERC21, ERC20 { + /// @inheritdoc ERC20 + function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "Token", natspec, false); +} + +BOOST_AUTO_TEST_CASE(user_explicit_inherit) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 { + function transfer(address to, uint amount) virtual external returns (bool) { + return false; + } + } + + contract Token is ERC21, ERC20 { + /// @inheritdoc ERC20 + function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``." + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "Token", natspec, true); +} + +BOOST_AUTO_TEST_CASE(dev_explicit_inherit2) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 is ERC20 { + function transfer(address to, uint amount) virtual override external returns (bool) { + return false; + } + } + + contract Token is ERC20 { + /// @inheritdoc ERC20 + function transfer(address to, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "ERC21", natspec, false); + checkNatspec(sourceCode, "Token", natspec, false); +} + +BOOST_AUTO_TEST_CASE(user_explicit_inherit2) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 is ERC20 { + function transfer(address to, uint amount) virtual override external returns (bool) { + return false; + } + } + + contract Token is ERC20 { + /// @inheritdoc ERC20 + function transfer(address to, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``." + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "ERC21", natspec, true); + checkNatspec(sourceCode, "Token", natspec, true); +} + +BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial2) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 is ERC20 { + /// @inheritdoc ERC20 + /// @dev override dev comment + /// @notice override notice + function transfer(address to, uint amount) virtual override external returns (bool) { + return false; + } + } + + contract Token is ERC21 { + function transfer(address to, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "override dev comment", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "Token", natspec2, false); +} + +BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial2) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 is ERC20 { + /// @inheritdoc ERC20 + /// @dev override dev comment + /// @notice override notice + function transfer(address to, uint amount) virtual override external returns (bool) { + return false; + } + } + + contract Token is ERC21 { + function transfer(address to, uint amount) override external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``." + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "override notice" + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "Token", natspec2, true); +} +BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 { + function transfer(address to, uint amount) virtual external returns (bool) { + return false; + } + } + + contract Token is ERC21, ERC20 { + /// @inheritdoc ERC20 + /// @dev override dev comment + /// @notice override notice + function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "override dev comment", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, false); + checkNatspec(sourceCode, "Token", natspec2, false); +} + +BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial) +{ + char const *sourceCode = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + contract ERC21 { + function transfer(address to, uint amount) virtual external returns (bool) { + return false; + } + } + + contract Token is ERC21, ERC20 { + /// @inheritdoc ERC20 + /// @dev override dev comment + /// @notice override notice + function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "Transfer ``amount`` from ``msg.sender`` to ``to``." + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "notice": "override notice" + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "ERC20", natspec, true); + checkNatspec(sourceCode, "Token", natspec2, true); +} + BOOST_AUTO_TEST_CASE(dev_inherit_parameter_mismatch) { char const *sourceCode = R"( @@ -1517,6 +1983,80 @@ BOOST_AUTO_TEST_CASE(user_inherit_parameter_mismatch) checkNatspec(sourceCode, "Token", natspec2, true); } +BOOST_AUTO_TEST_CASE(dev_explicit_inehrit_complex) +{ + char const *sourceCode1 = R"( + interface ERC20 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer + /// @dev test + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + + interface ERC21 { + /// Transfer ``amount`` from ``msg.sender`` to ``to``. + /// @author Programmer2 + /// @dev test2 + /// @param to address to transfer to + /// @param amount amount to transfer + function transfer(address to, uint amount) external returns (bool); + } + )"; + + char const *sourceCode2 = R"( + import "Interfaces.sol" as myInterfaces; + + contract Token is myInterfaces.ERC20, myInterfaces.ERC21 { + /// @inheritdoc myInterfaces.ERC20 + function transfer(address too, uint amount) + override(myInterfaces.ERC20, myInterfaces.ERC21) external returns (bool) { + return false; + } + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "transfer(address,uint256)": + { + "author": "Programmer", + "details": "test", + "params": + { + "amount": "amount to transfer", + "to": "address to transfer to" + } + } + } + })ABCDEF"; + + m_compilerStack.reset(); + m_compilerStack.setSources({ + {"Interfaces.sol", "pragma solidity >=0.0;\n" + std::string(sourceCode1)}, + {"Testfile.sol", "pragma solidity >=0.0;\n" + std::string(sourceCode2)} + }); + + m_compilerStack.setEVMVersion(solidity::test::CommonOptions::get().evmVersion()); + + BOOST_REQUIRE_MESSAGE(m_compilerStack.parseAndAnalyze(), "Parsing contract failed"); + + Json::Value generatedDocumentation = m_compilerStack.natspecDev("Token"); + Json::Value expectedDocumentation; + util::jsonParseStrict(natspec, expectedDocumentation); + + expectedDocumentation["version"] = Json::Value(Natspec::c_natspecVersion); + expectedDocumentation["kind"] = Json::Value("dev"); + + BOOST_CHECK_MESSAGE( + expectedDocumentation == generatedDocumentation, + "Expected:\n" << expectedDocumentation.toStyledString() << + "\n but got:\n" << generatedDocumentation.toStyledString() + ); +} + } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc.sol new file mode 100644 index 000000000000..678872d7a00f --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc.sol @@ -0,0 +1,7 @@ +contract C { + /// @inheritdoc X + function f() internal { + } +} +// ---- +// DocstringParsingError 9397: (17-34): Documentation tag @inheritdoc references inexistent contract "X". diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc2.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc2.sol new file mode 100644 index 000000000000..4d97ff93d43c --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc2.sol @@ -0,0 +1,10 @@ +contract D { +} + +contract C is D { + /// @inheritdoc D + function f() internal { + } +} +// ---- +// DocstringParsingError 4682: (38-55): Documentation tag @inheritdoc references contract "D", but the contract does not contain a function that is overridden by this function. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc3.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc3.sol new file mode 100644 index 000000000000..d00e1e7ea1ac --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc3.sol @@ -0,0 +1,11 @@ +contract D { + struct S { uint a; } +} + +contract C is D { + /// @inheritdoc D.S + function f() internal { + } +} +// ---- +// DocstringParsingError 1430: (63-82): Documentation tag @inheritdoc reference "D.S" is not a contract. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_wrong_type.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_wrong_type.sol new file mode 100644 index 000000000000..510f6622fdca --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_wrong_type.sol @@ -0,0 +1,8 @@ +contract C { + struct S { uint a; } + /// @inheritdoc S + function f() internal { + } +} +// ---- +// DocstringParsingError 1430: (42-59): Documentation tag @inheritdoc reference "S" is not a contract. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/inherit_doc_events.sol b/test/libsolidity/syntaxTests/natspec/invalid/inherit_doc_events.sol new file mode 100644 index 000000000000..e7fb1a822fc9 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/inherit_doc_events.sol @@ -0,0 +1,17 @@ +contract ERC20 { + /// @notice This event is emitted when a transfer occurs. + /// @param from The source account. + /// @param to The destination account. + /// @param amount The amount. + /// @dev A test case! + event Transfer(address indexed from, address indexed to, uint amount); +} + +contract A is ERC20 { + /// @inheritdoc ERC20 + event Transfer(); +} + + +// ---- +// DocstringParsingError 6546: (305-326): Documentation tag @inheritdoc not valid for events. From ecdfef1b308330b1c672a8e73565676e2f8d2f75 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 21 Jul 2020 00:18:47 +0200 Subject: [PATCH 418/479] Replace grave accent with acute accent --- libsolidity/analysis/TypeChecker.cpp | 2 +- .../syntaxTests/iceRegressionTests/oversized_var.sol | 2 +- .../syntaxTests/types/var_type_suggest.sol | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 92abc11e6849..0a14d5cc9a6f 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1306,7 +1306,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) 1719_error, _statement.location(), "Use of the \"var\" keyword is disallowed. " - "Use explicit declaration `" + createTupleDecl(variables) + " = ...´ instead." + "Use explicit declaration `" + createTupleDecl(variables) + " = ...` instead." ); } diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol index 0e50ae138dfe..45e2779c5e0b 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/oversized_var.sol @@ -12,4 +12,4 @@ contract b { // Warning 2519: (105-110): This declaration shadows an existing declaration. // Warning 3408: (66-69): Variable "d" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. // Warning 2332: (105-110): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. -// SyntaxError 1719: (105-114): Use of the "var" keyword is disallowed. Use explicit declaration `struct b.c storage pointer d = ...´ instead. +// SyntaxError 1719: (105-114): Use of the "var" keyword is disallowed. Use explicit declaration `struct b.c storage pointer d = ...` instead. diff --git a/test/libsolidity/syntaxTests/types/var_type_suggest.sol b/test/libsolidity/syntaxTests/types/var_type_suggest.sol index 65d91cd1e159..61ee7d317cb4 100644 --- a/test/libsolidity/syntaxTests/types/var_type_suggest.sol +++ b/test/libsolidity/syntaxTests/types/var_type_suggest.sol @@ -20,11 +20,11 @@ contract C { } } // ---- -// SyntaxError 1719: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...´ instead. -// SyntaxError 1719: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead. -// SyntaxError 1719: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead. -// SyntaxError 1719: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead. +// SyntaxError 1719: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...` instead. +// SyntaxError 1719: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...` instead. +// SyntaxError 1719: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...` instead. +// SyntaxError 1719: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...` instead. // SyntaxError 3478: (317-350): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax. -// SyntaxError 1719: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead. -// SyntaxError 1719: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead. +// SyntaxError 1719: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...` instead. +// SyntaxError 1719: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...` instead. // TypeError 7364: (421-438): Different number of components on the left hand side (2) than on the right hand side (1). From 1b95a5e1fcb8c8e506b0cc09fcb48cbbb1aec724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiny=E7=86=8A?= Date: Tue, 21 Jul 2020 16:28:13 +0800 Subject: [PATCH 419/479] Update simplified chinese translation link. The implified chinese translation version now host on https://learnblockchain.cn/docs/solidity/ . This url will be keep updating . --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 89976a8d4e91..d616d6e881c2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -77,7 +77,7 @@ version stands as a reference. * `Japanese `_ * `Korean `_ (in progress) * `Russian `_ (rather outdated) -* `Simplified Chinese `_ (in progress) +* `Simplified Chinese `_ (in progress) * `Spanish `_ * `Turkish `_ (partial) From fbc0cc52e4729931c98febb5ccb54f9b3fb665a6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2020 18:36:49 +0200 Subject: [PATCH 420/479] Document 0.7.0 changes. --- docs/070-breaking-changes.rst | 104 +++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 9c2d43e417cd..2954e21563a1 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -8,13 +8,113 @@ affected code. For the full list check `the release changelog `_. + +Silent Changes of the Semantics +=============================== + + * Exponentiation and shifts of literals by non-literals (e.g. ``1 << x`` or ``2 ** x``) + will always use either the type ``uint256`` (for non-negative literals) or + ``int256`` (for negative literals) to perform the operation. + Previously, the operation was performed in the type of the shift amount / the + exponent which can be misleading. + + +Changes to the Syntax +===================== + + * In external function and contract creation calls, Ether and gas is now specified using a new syntax: + ``x.f{gas: 10000, value: 2 ether}(arg1, arg2)``. + The old syntax -- ``x.f.gas(10000).value(2 ether)(arg1, arg2)`` -- will cause an error. + * The global variable ``now`` is deprecated, ``block.timestamp`` should be used instead. + The single identifier ``now`` is too generic for a global variable and could give the impression + that it changes during transaction processing, whereas ``block.timestamp`` correctly + reflects the fact that it is just a property of the block. + * NatSpec comments on variables are only allowed for public state variables and not + for local or internal variables. + + * The token ``gwei`` is a keyword now (used to specify, e.g. ``2 gwei`` as a number) + and cannot be used as an identifier. + + * State Mutability: The state mutability of functions can now be restricted during inheritance: + Functions with default state mutability can be overridden by ``pure`` and ``view`` functions + while ``view`` functions can be overridden by ``pure`` functions. + At the same time, public state variables are considered ``view`` and even ``pure`` + if they are constants. + + + +Inline Assembly +--------------- + + * Disallow ``.`` in user-defined function and variable names in inline assembly. + It is still valid if you use Solidity in Yul-only mode. + + * Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` + and ``x.offset`` instead of ``x_slot`` and ``x_offset``. + +Removal of Unused or Unsafe Features +==================================== + +Mappings outside Storage +------------------------ + + * If a struct or array contains a mapping, it can only be used in storage. + Previously, mapping members were silently skipped in memory, which + is confusing and error-prone. + + * Assignments to structs or arrays in storage does not work if they contain + mappings. + Previously, mappings were silently skipped during the copy operation, which + is misleading and error-prone. + +Functions and Events +-------------------- + + * Visibility (``public`` / ``external``) is not needed for constructors anymore: + To prevent a contract from being created, it can be marked ``abstract``. + This makes the visibility concept for constructors obsolete. + + * Type Checker: Disallow ``virtual`` for library functions: + Since libraries cannot be inherited from, library functions should not be virtual. + + * Multiple events with the same name and parameter types in the same + inheritance hierarchy are disallowed. + + * ``using A for B`` only affects the contract it is mentioned in. + Previously, the effect was inherited. Now, you have to repeat the ``using`` + statement in all derived contracts that make use of the feature. + +Expressions +----------- + + * Shifts by signed types are disallowed. + Previously, shifts by negative amounts were allowed, but reverted at runtime. + + * The ``finney`` and ``szabo`` denominations are removed. + They are rarely used and do not make the actual amount readily visible. Instead, explicit + values like ``1e20`` or the very common ``gwei`` can be used. + +Declarations +------------ + + * The keyword ``var`` cannot be used anymore. + Previously, this keyword would parse but result in a type error and + a suggestion about which type to use. Now, it results in a parser error. + +Interface Changes +================= + + * JSON AST: Members with value ``null`` are removed from JSON output. + * NatSpec: Constructors and functions have consistent userdoc output. + + How to update your code ======================= This section gives detailed instructions on how to update prior code for every breaking change. -* Change ``f.value(...)()`` to ``f{value: ...}()``. Similarly ``(new C).value(...)()`` to - ``(new C){value: ...}()`` and ``f.gas(...)()`` to ``f{gas: ...}()``. +* Change ``x.f.value(...)()`` to ``x.f{value: ...}()``. Similarly ``(new C).value(...)()`` to + ``new C{value: ...}()`` and ``x.f.gas(...).value(...)()`` to ``x.f{gas: ..., value: ...}()``. * Change ``now`` to ``block.timestamp``. * Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to ``x >> uint(256 - y)``. From 952101996cb6a198e493e253a07e7184e8359bbf Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Tue, 16 Jun 2020 17:13:46 +0200 Subject: [PATCH 421/479] Removing expectDeposit() from AsmAnalysis as unused function --- libyul/AsmAnalysis.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 8d8db59abcfb..552191c4d86d 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -102,7 +102,6 @@ class AsmAnalyzer /// Vists the expression and expects it to return a single boolean value. /// Reports an error otherwise. void expectBoolExpression(Expression const& _expr); - bool expectDeposit(int _deposit, int _oldHeight, langutil::SourceLocation const& _location); /// Verifies that a variable to be assigned to exists, can be assigned to /// and has the same type as the value. From c11bb24a514fc303b61c15658005b78261aca093 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 21 Jul 2020 12:10:33 +0200 Subject: [PATCH 422/479] Add example about array literals. --- docs/types/reference-types.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 5bd242f06b99..17a52f43b616 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -237,6 +237,23 @@ memory arrays, i.e. the following is not possible: It is planned to remove this restriction in the future, but it creates some complications because of how arrays are passed in the ABI. +If you want to initialize dynamically-sized arrays, you have to assign the +individual elements: + +:: + + // SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.4.0 <0.7.0; + + contract C { + function f() public pure { + uint[] memory x = new uint[](3); + x[0] = 1; + x[1] = 3; + x[2] = 4; + } + } + .. index:: ! array;length, length, push, pop, !array;push, !array;pop .. _array-members: From 4067bab7ddac83818916aed840dd6d43396fb723 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Mon, 6 Jul 2020 19:32:48 +0200 Subject: [PATCH 423/479] Add corpus based multi source fuzzer Co-authored-by: Leonardo --- test/TestCaseReader.cpp | 7 +++++++ test/TestCaseReader.h | 1 + test/tools/fuzzer_common.cpp | 6 +++--- test/tools/fuzzer_common.h | 9 ++++++++- test/tools/ossfuzz/CMakeLists.txt | 4 ++-- test/tools/ossfuzz/solc_noopt_ossfuzz.cpp | 17 ++++++++++++++++- test/tools/ossfuzz/solc_opt_ossfuzz.cpp | 19 +++++++++++++++++-- 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/test/TestCaseReader.cpp b/test/TestCaseReader.cpp index 7b3611d82f81..d38e883ea567 100644 --- a/test/TestCaseReader.cpp +++ b/test/TestCaseReader.cpp @@ -38,6 +38,13 @@ TestCaseReader::TestCaseReader(string const& _filename): m_unreadSettings = m_settings; } +TestCaseReader::TestCaseReader(istringstream const& _str) +{ + tie(m_sources, m_lineNumber) = parseSourcesAndSettingsWithLineNumber( + static_cast(const_cast(_str)) + ); +} + string const& TestCaseReader::source() const { if (m_sources.sources.size() != 1) diff --git a/test/TestCaseReader.h b/test/TestCaseReader.h index 720c26338c0a..620565aee3e6 100644 --- a/test/TestCaseReader.h +++ b/test/TestCaseReader.h @@ -42,6 +42,7 @@ class TestCaseReader public: TestCaseReader() = default; explicit TestCaseReader(std::string const& _filename); + explicit TestCaseReader(std::istringstream const& _testCode); SourceMap const& sources() const { return m_sources; } std::string const& source() const; diff --git a/test/tools/fuzzer_common.cpp b/test/tools/fuzzer_common.cpp index 437ab5d2299b..cb153e0e8b2a 100644 --- a/test/tools/fuzzer_common.cpp +++ b/test/tools/fuzzer_common.cpp @@ -72,16 +72,16 @@ void FuzzerUtil::testCompilerJsonInterface(string const& _input, bool _optimize, runCompiler(jsonCompactPrint(config), _quiet); } -void FuzzerUtil::testCompiler(string const& _input, bool _optimize) +void FuzzerUtil::testCompiler(StringMap const& _input, bool _optimize, unsigned _rand) { frontend::CompilerStack compiler; - EVMVersion evmVersion = s_evmVersions[_input.size() % s_evmVersions.size()]; + EVMVersion evmVersion = s_evmVersions[_rand % s_evmVersions.size()]; frontend::OptimiserSettings optimiserSettings; if (_optimize) optimiserSettings = frontend::OptimiserSettings::standard(); else optimiserSettings = frontend::OptimiserSettings::minimal(); - compiler.setSources({{"", _input}}); + compiler.setSources(_input); compiler.setEVMVersion(evmVersion); compiler.setOptimiserSettings(optimiserSettings); try diff --git a/test/tools/fuzzer_common.h b/test/tools/fuzzer_common.h index c8749d9b1c97..cd30adc970dc 100644 --- a/test/tools/fuzzer_common.h +++ b/test/tools/fuzzer_common.h @@ -16,6 +16,9 @@ */ // SPDX-License-Identifier: GPL-3.0 +#include + +#include #include /** @@ -28,5 +31,9 @@ struct FuzzerUtil static void testCompilerJsonInterface(std::string const& _input, bool _optimize, bool _quiet); static void testConstantOptimizer(std::string const& _input, bool _quiet); static void testStandardCompiler(std::string const& _input, bool _quiet); - static void testCompiler(std::string const& _input, bool _optimize); + /// Compiles @param _input which is a map of input file name to source code + /// string with optimisation turned on if @param _optimize is true + /// (off otherwise) and a pseudo-random @param _rand that selects the EVM + /// version to be compiled for. + static void testCompiler(solidity::StringMap const& _input, bool _optimize, unsigned _rand); }; diff --git a/test/tools/ossfuzz/CMakeLists.txt b/test/tools/ossfuzz/CMakeLists.txt index 9ad7b9c80e3d..a799bd736e03 100644 --- a/test/tools/ossfuzz/CMakeLists.txt +++ b/test/tools/ossfuzz/CMakeLists.txt @@ -23,11 +23,11 @@ if (OSSFUZZ) endif() if (OSSFUZZ) - add_executable(solc_opt_ossfuzz solc_opt_ossfuzz.cpp ../fuzzer_common.cpp) + add_executable(solc_opt_ossfuzz solc_opt_ossfuzz.cpp ../fuzzer_common.cpp ../../TestCaseReader.cpp) target_link_libraries(solc_opt_ossfuzz PRIVATE libsolc evmasm) set_target_properties(solc_opt_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) - add_executable(solc_noopt_ossfuzz solc_noopt_ossfuzz.cpp ../fuzzer_common.cpp) + add_executable(solc_noopt_ossfuzz solc_noopt_ossfuzz.cpp ../fuzzer_common.cpp ../../TestCaseReader.cpp) target_link_libraries(solc_noopt_ossfuzz PRIVATE libsolc evmasm) set_target_properties(solc_noopt_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) diff --git a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp index e2f3a294f442..8d615c0bde4d 100644 --- a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp @@ -18,6 +18,11 @@ #include +#include + +#include + +using namespace solidity::frontend::test; using namespace std; extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) @@ -25,7 +30,17 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) if (_size <= 600) { string input(reinterpret_cast(_data), _size); - FuzzerUtil::testCompiler(input, /*optimize=*/false); + map sourceCode; + try + { + TestCaseReader t = TestCaseReader(std::istringstream(input)); + sourceCode = t.sources().sources; + } + catch (runtime_error const&) + { + return 0; + } + FuzzerUtil::testCompiler(sourceCode, /*optimize=*/false, /*_rand=*/_size); } return 0; } diff --git a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp index bff19407fedb..0d9c7f44e754 100644 --- a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp @@ -18,14 +18,29 @@ #include +#include + +#include + +using namespace solidity::frontend::test; using namespace std; extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) { if (_size <= 600) { - string input(reinterpret_cast(_data), _size); - FuzzerUtil::testCompiler(input, /*optimize=*/true); + string input(reinterpret_cast(_data), _size); + map sourceCode; + try + { + TestCaseReader t = TestCaseReader(std::istringstream(input)); + sourceCode = t.sources().sources; + } + catch (runtime_error const&) + { + return 0; + } + FuzzerUtil::testCompiler(sourceCode, /*optimize=*/true, /*rand=*/_size); } return 0; } From 8b7567f963e00ef15fd5ae97c310064658612ae9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 21 Jul 2020 11:39:25 +0200 Subject: [PATCH 424/479] Fix merge conflicts. --- libsolidity/analysis/DocStringTagParser.cpp | 15 ++----- test/libsolidity/SolidityNatspecJSON.cpp | 41 +------------------ .../natspec/docstring_author_function.sol | 2 +- 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/libsolidity/analysis/DocStringTagParser.cpp b/libsolidity/analysis/DocStringTagParser.cpp index c953e7cc229e..70f677c6a7ec 100644 --- a/libsolidity/analysis/DocStringTagParser.cpp +++ b/libsolidity/analysis/DocStringTagParser.cpp @@ -61,8 +61,8 @@ bool DocStringTagParser::visit(VariableDeclaration const& _variable) { if (_variable.isStateVariable()) { - static set const validPublicTags = set{"dev", "notice", "return"}; - static set const validNonPublicTags = set{"dev"}; + static set const validPublicTags = set{"dev", "notice", "return", "inheritdoc"}; + static set const validNonPublicTags = set{"dev", "inheritdoc"}; if (_variable.isPublic()) parseDocStrings(_variable, _variable.annotation(), validPublicTags, "public state variables"); else @@ -126,8 +126,8 @@ void DocStringTagParser::handleCallable( StructurallyDocumentedAnnotation& _annotation ) { - static set const validEventTags = set{"author", "dev", "notice", "return", "param"}; - static set const validTags = set{"author", "dev", "notice", "return", "param", "inheritdoc"}; + static set const validEventTags = set{"dev", "notice", "return", "param"}; + static set const validTags = set{"dev", "notice", "return", "param", "inheritdoc"}; if (dynamic_cast(&_callable)) parseDocStrings(_node, _annotation, validEventTags, "events"); @@ -135,13 +135,6 @@ void DocStringTagParser::handleCallable( parseDocStrings(_node, _annotation, validTags, "functions"); checkParameters(_callable, _node, _annotation); - - if (_node.documentation() && _annotation.docTags.count("author") > 0) - m_errorReporter.warning( - 9843_error, _node.documentation()->location(), - "Documentation tag @author is only allowed on contract definitions. " - "It will be disallowed in 0.7.0." - ); } void DocStringTagParser::parseDocStrings( diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 802589d2a62c..fa1e7903d487 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -918,18 +918,7 @@ BOOST_AUTO_TEST_CASE(dev_author_at_function) } )"; - char const* natspec = "{" - " \"author\": \"Lefteris\"," - " \"title\": \"Just a test contract\"," - " \"methods\":{" - " \"mul(uint256,uint256)\":{ \n" - " \"details\": \"Mul function\",\n" - " \"author\": \"John Doe\",\n" - " }\n" - " }\n" - "}"; - - checkNatspec(sourceCode, "test", natspec, false); + expectNatspecError(sourceCode); } BOOST_AUTO_TEST_CASE(natspec_notice_without_tag) @@ -1114,7 +1103,6 @@ BOOST_AUTO_TEST_CASE(dev_constructor) { char const *sourceCode = R"( contract test { - /// @author Alex /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion constructor(uint a, uint second) { } @@ -1124,7 +1112,6 @@ BOOST_AUTO_TEST_CASE(dev_constructor) char const *natspec = R"ABCDEF({ "methods" : { "constructor" : { - "author" : "Alex", "params" : { "a" : "the parameter a is really nice and very useful", "second" : "the second parameter is not very useful, it just provides additional confusion" @@ -1140,7 +1127,6 @@ BOOST_AUTO_TEST_CASE(dev_constructor_return) { char const* sourceCode = R"( contract test { - /// @author Alex /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion /// @return return should not work within constructors @@ -1155,7 +1141,6 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function) { char const *sourceCode = R"( contract test { - /// @author Alex /// @param a the parameter a is really nice and very useful /// @param second the second parameter is not very useful, it just provides additional confusion constructor(uint a, uint second) { } @@ -1184,7 +1169,6 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function) } }, "constructor" : { - "author" : "Alex", "params" : { "a" : "the parameter a is really nice and very useful", "second" : "the second parameter is not very useful, it just provides additional confusion" @@ -1402,7 +1386,6 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit) interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. /// Second line. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1429,7 +1412,6 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1451,7 +1433,6 @@ BOOST_AUTO_TEST_CASE(user_default_inherit) interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. /// Second line. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1493,7 +1474,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1519,7 +1499,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1539,7 +1518,6 @@ BOOST_AUTO_TEST_CASE(user_explicit_inherit) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1579,7 +1557,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit2) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1605,7 +1582,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit2) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1626,7 +1602,6 @@ BOOST_AUTO_TEST_CASE(user_explicit_inherit2) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1667,7 +1642,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial2) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1695,7 +1669,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial2) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1711,7 +1684,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial2) { "transfer(address,uint256)": { - "author": "Programmer", "details": "override dev comment", "params": { @@ -1731,7 +1703,6 @@ BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial2) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1782,7 +1753,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1810,7 +1780,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1826,7 +1795,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial) { "transfer(address,uint256)": { - "author": "Programmer", "details": "override dev comment", "params": { @@ -1846,7 +1814,6 @@ BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1898,7 +1865,6 @@ BOOST_AUTO_TEST_CASE(dev_inherit_parameter_mismatch) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1923,7 +1889,6 @@ BOOST_AUTO_TEST_CASE(dev_inherit_parameter_mismatch) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { @@ -1948,7 +1913,6 @@ BOOST_AUTO_TEST_CASE(user_inherit_parameter_mismatch) char const *sourceCode = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -1992,7 +1956,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inehrit_complex) char const *sourceCode1 = R"( interface ERC20 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer /// @dev test /// @param to address to transfer to /// @param amount amount to transfer @@ -2001,7 +1964,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inehrit_complex) interface ERC21 { /// Transfer ``amount`` from ``msg.sender`` to ``to``. - /// @author Programmer2 /// @dev test2 /// @param to address to transfer to /// @param amount amount to transfer @@ -2026,7 +1988,6 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inehrit_complex) { "transfer(address,uint256)": { - "author": "Programmer", "details": "test", "params": { diff --git a/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol b/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol index 7b6ca862bfdc..71db9907bbe0 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_author_function.sol @@ -3,4 +3,4 @@ contract C { function iHaveAuthor() public pure {} } // ---- -// Warning 9843: (17-35): Documentation tag @author is only allowed on contract definitions. It will be disallowed in 0.7.0. +// DocstringParsingError 6546: (17-35): Documentation tag @author not valid for functions. From 0a3c9ec358573d601ae6f101bc85bb92df2bcc7c Mon Sep 17 00:00:00 2001 From: a3d4 Date: Thu, 16 Jul 2020 22:06:55 +0200 Subject: [PATCH 425/479] Print source file names for uncovered error codes. Use more consistent naming. --- scripts/error_codes.py | 121 ++++++++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 45 deletions(-) diff --git a/scripts/error_codes.py b/scripts/error_codes.py index da317d45c959..8ab9b04dc679 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -36,24 +36,26 @@ def in_comment(source, pos): return slash_star_pos > star_slash_pos -def find_ids_in_source_file(file_name, ids): +def find_ids_in_source_file(file_name, id_to_file_names): source = read_file(file_name) for m in re.finditer(SOURCE_FILE_PATTERN, source): if in_comment(source, m.start()): continue underscore_pos = m.group(0).index("_") id = m.group(0)[0:underscore_pos] - if id in ids: - ids[id] += 1 + if id in id_to_file_names: + id_to_file_names[id].append(file_name) else: - ids[id] = 1 + id_to_file_names[id] = [file_name] -def get_used_ids(file_names): - used_ids = {} +def find_ids_in_source_files(file_names): + """Returns a dictionary with list of source files for every appearance of every id""" + + id_to_file_names = {} for file_name in file_names: - find_ids_in_source_file(file_name, used_ids) - return used_ids + find_ids_in_source_file(file_name, id_to_file_names) + return id_to_file_names def get_next_id(available_ids): @@ -63,7 +65,7 @@ def get_next_id(available_ids): return next_id -def fix_ids_in_file(file_name, available_ids, used_ids): +def fix_ids_in_source_file(file_name, id_to_count, available_ids): source = read_file(file_name) k = 0 @@ -75,11 +77,11 @@ def fix_ids_in_file(file_name, available_ids, used_ids): id = m.group(0)[0:underscore_pos] # incorrect id or id has a duplicate somewhere - if not in_comment(source, m.start()) and (len(id) != 4 or id[0] == "0" or used_ids[id] > 1): - assert id in used_ids + if not in_comment(source, m.start()) and (len(id) != 4 or id[0] == "0" or id_to_count[id] > 1): + assert id in id_to_count new_id = get_next_id(available_ids) - assert new_id not in used_ids - used_ids[id] -= 1 + assert new_id not in id_to_count + id_to_count[id] -= 1 else: new_id = id @@ -94,10 +96,15 @@ def fix_ids_in_file(file_name, available_ids, used_ids): print(f"Fixed file: {file_name}") -def fix_ids(used_ids, file_names): - available_ids = {str(id) for id in range(1000, 10000)} - used_ids.keys() +def fix_ids_in_source_files(file_names, id_to_count): + """ + Fixes ids in given source files; + id_to_count contains number of appearances of every id in sources + """ + + available_ids = {str(id) for id in range(1000, 10000)} - id_to_count.keys() for file_name in file_names: - fix_ids_in_file(file_name, available_ids, used_ids) + fix_ids_in_source_file(file_name, id_to_count, available_ids) def find_files(top_dir, sub_dirs, extensions): @@ -121,10 +128,12 @@ def find_ids_in_test_file(file_name): def find_ids_in_test_files(file_names): - used_ids = set() + """Returns a set containing all ids in tests""" + + ids = set() for file_name in file_names: - used_ids |= find_ids_in_test_file(file_name) - return used_ids + ids |= find_ids_in_test_file(file_name) + return ids def find_ids_in_cmdline_test_err(file_name): @@ -142,7 +151,23 @@ def print_ids(ids): print(id, end="") -def examine_id_coverage(top_dir, used_ids): +def print_ids_per_file(ids, id_to_file_names, top_dir): + file_name_to_ids = {} + for id in ids: + for file_name in id_to_file_names[id]: + relpath = path.relpath(file_name, top_dir) + if relpath not in file_name_to_ids: + file_name_to_ids[relpath] = [] + file_name_to_ids[relpath].append(id) + + for file_name in sorted(file_name_to_ids): + print(file_name) + for id in sorted(file_name_to_ids[file_name]): + print(f" {id}", end="") + print() + + +def examine_id_coverage(top_dir, source_id_to_file_names): test_sub_dirs = [ path.join("test", "libsolidity", "errorRecoveryTests"), path.join("test", "libsolidity", "smtCheckerTests"), @@ -153,27 +178,28 @@ def examine_id_coverage(top_dir, used_ids): test_sub_dirs, [".sol"] ) - covered_ids = find_ids_in_test_files(test_file_names) + source_ids = source_id_to_file_names.keys() + test_ids = find_ids_in_test_files(test_file_names) # special case, we are interested in warnings which are ignored by regular tests: # Warning (1878): SPDX license identifier not provided in source file. .... # Warning (3420): Source file does not specify required compiler version! - covered_ids |= find_ids_in_cmdline_test_err(path.join(top_dir, "test", "cmdlineTests", "error_codes", "err")) + test_ids |= find_ids_in_cmdline_test_err(path.join(top_dir, "test", "cmdlineTests", "error_codes", "err")) - print(f"IDs in source files: {len(used_ids)}") - print(f"IDs in test files : {len(covered_ids)} ({len(covered_ids) - len(used_ids)})") + print(f"IDs in source files: {len(source_ids)}") + print(f"IDs in test files : {len(test_ids)} ({len(test_ids) - len(source_ids)})") print() - unused_covered_ids = covered_ids - used_ids - if len(unused_covered_ids) != 0: + test_only_ids = test_ids - source_ids + if len(test_only_ids) != 0: print("Error. The following error codes found in tests, but not in sources:") - print_ids(unused_covered_ids) + print_ids(test_only_ids) return 1 - used_uncovered_ids = used_ids - covered_ids - if len(used_uncovered_ids) != 0: + source_only_ids = source_ids - test_ids + if len(source_only_ids) != 0: print("The following error codes found in sources, but not in tests:") - print_ids(used_uncovered_ids) + print_ids_per_file(source_only_ids, source_id_to_file_names, top_dir) print("\n\nPlease make sure to add appropriate tests.") return 1 @@ -187,22 +213,22 @@ def main(argv): fix = False no_confirm = False examine_coverage = False - next = False + next_id = False opts, args = getopt.getopt(argv, "", ["check", "fix", "no-confirm", "examine-coverage", "next"]) for opt, arg in opts: - if opt == '--check': + if opt == "--check": check = True elif opt == "--fix": fix = True - elif opt == '--no-confirm': + elif opt == "--no-confirm": no_confirm = True - elif opt == '--examine-coverage': + elif opt == "--examine-coverage": examine_coverage = True - elif opt == '--next': - next = True + elif opt == "--next": + next_id = True - if [check, fix, examine_coverage, next].count(True) != 1: + if [check, fix, examine_coverage, next_id].count(True) != 1: print("usage: python error_codes.py --check | --fix [--no-confirm] | --examine-coverage | --next") exit(1) @@ -213,32 +239,34 @@ def main(argv): ["libevmasm", "liblangutil", "libsolc", "libsolidity", "libsolutil", "libyul", "solc"], [".h", ".cpp"] ) - used_ids = get_used_ids(source_file_names) + source_id_to_file_names = find_ids_in_source_files(source_file_names) ok = True - for id in sorted(used_ids): + for id in sorted(source_id_to_file_names): if len(id) != 4: print(f"ID {id} length != 4") ok = False if id[0] == "0": print(f"ID {id} starts with zero") ok = False - if used_ids[id] > 1: - print(f"ID {id} appears {used_ids[id]} times") + if len(source_id_to_file_names[id]) > 1: + print(f"ID {id} appears {len(source_id_to_file_names[id])} times") ok = False if examine_coverage: if not ok: print("Incorrect IDs have to be fixed before applying --examine-coverage") - res = examine_id_coverage(cwd, used_ids.keys()) + exit(1) + res = examine_id_coverage(cwd, source_id_to_file_names) exit(res) random.seed() - if next: + if next_id: if not ok: print("Incorrect IDs have to be fixed before applying --next") - available_ids = {str(id) for id in range(1000, 10000)} - used_ids.keys() + exit(1) + available_ids = {str(id) for id in range(1000, 10000)} - source_id_to_file_names.keys() next_id = get_next_id(available_ids) print(f"Next ID: {next_id}") exit(0) @@ -263,7 +291,10 @@ def main(argv): if answer not in "yY": exit(1) - fix_ids(used_ids, source_file_names) + # number of appearances for every id + source_id_to_count = { id: len(file_names) for id, file_names in source_id_to_file_names.items() } + + fix_ids_in_source_files(source_file_names, source_id_to_count) print("Fixing completed") exit(2) From 18fbbfa5ca4e62e6d371123de215e065c15e16e2 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 21 Jul 2020 14:37:22 +0200 Subject: [PATCH 426/479] Fuzzer: Count step by number of interpreted statements Co-authored-by: chriseth --- test/libyul/EwasmTranslationTest.cpp | 2 +- test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp | 10 +++++---- test/tools/yulInterpreter/Interpreter.cpp | 22 ++++++++++++++------ test/tools/yulInterpreter/Interpreter.h | 4 ++++ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index dd732f9a8c8e..be9ed77d957b 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -99,7 +99,7 @@ string EwasmTranslationTest::interpret() { InterpreterState state; state.maxTraceSize = 10000; - state.maxSteps = 100000; + state.maxSteps = 1000000; try { Interpreter::run(state, WasmDialect{}, *m_object->code); diff --git a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp index 4c8ddb94f18b..c95b4db7ff0f 100644 --- a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp @@ -97,15 +97,17 @@ DEFINE_PROTO_FUZZER(Program const& _input) EVMDialect::strictAssemblyForEVMObjects(version) ); - if (termReason == yulFuzzerUtil::TerminationReason::StepLimitReached) + if ( + termReason == yulFuzzerUtil::TerminationReason::StepLimitReached || + termReason == yulFuzzerUtil::TerminationReason::TraceLimitReached + ) return; stack.optimize(); - termReason = yulFuzzerUtil::interpret( + yulFuzzerUtil::interpret( os2, stack.parserResult()->code, - EVMDialect::strictAssemblyForEVMObjects(version), - (yul::test::yul_fuzzer::yulFuzzerUtil::maxSteps * 4) + EVMDialect::strictAssemblyForEVMObjects(version) ); bool isTraceEq = (os1.str() == os2.str()); diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index ba946e732d56..a8496793fff1 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -145,6 +145,11 @@ void Interpreter::operator()(ForLoop const& _forLoop) } while (evaluate(*_forLoop.condition) != 0) { + // Increment step for each loop iteration for loops with + // an empty body and post blocks to prevent a deadlock. + if (_forLoop.body.statements.size() == 0 && _forLoop.post.statements.size() == 0) + incrementStep(); + m_state.controlFlowState = ControlFlowState::Default; (*this)(_forLoop.body); if (m_state.controlFlowState == ControlFlowState::Break || m_state.controlFlowState == ControlFlowState::Leave) @@ -176,12 +181,6 @@ void Interpreter::operator()(Leave const&) void Interpreter::operator()(Block const& _block) { - m_state.numSteps++; - if (m_state.maxSteps > 0 && m_state.numSteps >= m_state.maxSteps) - { - m_state.trace.emplace_back("Interpreter execution step limit reached."); - throw StepLimitReached(); - } enterScope(_block); // Register functions. for (auto const& statement: _block.statements) @@ -193,6 +192,7 @@ void Interpreter::operator()(Block const& _block) for (auto const& statement: _block.statements) { + incrementStep(); visit(statement); if (m_state.controlFlowState != ControlFlowState::Default) break; @@ -235,6 +235,16 @@ void Interpreter::leaveScope() yulAssert(m_scope, ""); } +void Interpreter::incrementStep() +{ + m_state.numSteps++; + if (m_state.maxSteps > 0 && m_state.numSteps >= m_state.maxSteps) + { + m_state.trace.emplace_back("Interpreter execution step limit reached."); + throw StepLimitReached(); + } +} + void ExpressionEvaluator::operator()(Literal const& _literal) { static YulString const trueString("true"); diff --git a/test/tools/yulInterpreter/Interpreter.h b/test/tools/yulInterpreter/Interpreter.h index a52c098ede50..00e02f6e222f 100644 --- a/test/tools/yulInterpreter/Interpreter.h +++ b/test/tools/yulInterpreter/Interpreter.h @@ -154,6 +154,10 @@ class Interpreter: public ASTWalker void enterScope(Block const& _block); void leaveScope(); + /// Increment interpreter step count, throwing exception if step limit + /// is reached. + void incrementStep(); + Dialect const& m_dialect; InterpreterState& m_state; /// Values of variables. From e02878329dd3b73ad7a8dad039815793631f9ffe Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 21 Jul 2020 15:53:00 +0200 Subject: [PATCH 427/479] Prepare for 0.6.12 release. --- Changelog.md | 23 +++++++++++++---------- docs/bugs_by_version.json | 4 ++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 990b78e2b616..79cbf3e109cc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,27 +1,30 @@ -### 0.6.12 (unreleased) +### 0.6.12 (2020-07-22) Language Features: + * NatSpec: Implement tag ``@inheritdoc`` to copy documentation from a specific base contract. * Wasm backend: Add ``i32.ctz``, ``i64.ctz``, ``i32.popcnt``, and ``i64.popcnt``. + Compiler Features: + * Code Generator: Avoid double cleanup when copying to memory. * Code Generator: Evaluate ``keccak256`` of string literals at compile-time. + * Optimizer: Add rule to remove shifts inside the byte opcode. + * Peephole Optimizer: Add rule to remove swap after dup. * Peephole Optimizer: Remove unnecessary masking of tags. * Yul EVM Code Transform: Free stack slots directly after visiting the right-hand-side of variable declarations instead of at the end of the statement only. - * NatSpec: Implement tag ``@inheritdoc`` to copy documentation from a specific contract. + Bugfixes: + * SMTChecker: Fix error in events with indices of type static array. + * SMTChecker: Fix internal error in sequential storage array pushes (``push().push()``). * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches. - * SMTChecker: Fix error in events with indices of type static array. - * SMTChecker: Fix internal error in sequential storage array pushes (``push().push()`). - * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. - * Code Generator: Avoid double cleanup when copying to memory. + * Type Checker: Fix overload resolution in combination with ``{value: ...}``. -Compiler Features: - * Build System: Update internal dependency of jsoncpp to 1.9.3. - * Optimizer: Add rule to remove shifts inside the byte opcode. - * Peephole Optimizer: Add rule to remove swap after dup. + +Build System: + * Update internal dependency of jsoncpp to 1.9.3. ### 0.6.11 (2020-07-07) diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 000ab3ef8c13..fc9782c47177 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1113,6 +1113,10 @@ "bugs": [], "released": "2020-07-07" }, + "0.6.12": { + "bugs": [], + "released": "2020-07-22" + }, "0.6.2": { "bugs": [ "MissingEscapingInFormatting", From 6f97e6153c57f879de93f39590293d794f10b391 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 17 Jun 2020 11:17:35 +0200 Subject: [PATCH 428/479] [yul] Adding support for accessing subobjects via `.` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kamil Śliwak --- libevmasm/Assembly.cpp | 80 +++++++++++--- libevmasm/Assembly.h | 10 ++ libevmasm/AssemblyItem.cpp | 18 ++- libevmasm/AssemblyItem.h | 2 +- libyul/AsmAnalysis.cpp | 2 +- libyul/AssemblyStack.cpp | 2 +- libyul/CompilabilityChecker.cpp | 8 +- libyul/Object.cpp | 60 ++++++++-- libyul/Object.h | 21 +++- libyul/backends/evm/AbstractAssembly.h | 4 +- libyul/backends/evm/AsmCodeGen.cpp | 26 +++-- libyul/backends/evm/AsmCodeGen.h | 4 +- libyul/backends/evm/EVMAssembly.cpp | 4 +- libyul/backends/evm/EVMAssembly.h | 4 +- libyul/backends/evm/EVMDialect.cpp | 26 +++-- libyul/backends/evm/EVMObjectCompiler.cpp | 6 +- libyul/backends/evm/NoOutputAssembly.cpp | 4 +- libyul/backends/evm/NoOutputAssembly.h | 4 +- libyul/backends/wasm/EVMToEwasmTranslator.cpp | 2 +- .../input.json | 17 +++ .../output.json | 4 + test/libevmasm/Assembler.cpp | 19 ++++ test/libyul/Common.cpp | 2 +- .../libyul/objectCompiler/subObjectAccess.yul | 104 ++++++++++++++++++ 24 files changed, 357 insertions(+), 76 deletions(-) create mode 100644 test/cmdlineTests/standard_yul_object_invalid_sub/input.json create mode 100644 test/cmdlineTests/standard_yul_object_invalid_sub/output.json create mode 100644 test/libyul/objectCompiler/subObjectAccess.yul diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index b3a0dbde03d1..b1de71e3b488 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -92,8 +92,8 @@ string locationFromSources(StringMap const& _sourceCodes, SourceLocation const& class Functionalizer { public: - Functionalizer (ostream& _out, string const& _prefix, StringMap const& _sourceCodes): - m_out(_out), m_prefix(_prefix), m_sourceCodes(_sourceCodes) + Functionalizer (ostream& _out, string const& _prefix, StringMap const& _sourceCodes, Assembly const& _assembly): + m_out(_out), m_prefix(_prefix), m_sourceCodes(_sourceCodes), m_assembly(_assembly) {} void feed(AssemblyItem const& _item) @@ -104,6 +104,9 @@ class Functionalizer m_location = _item.location(); printLocation(); } + + string expression = _item.toAssemblyText(m_assembly); + if (!( _item.canBeFunctional() && _item.returnValues() <= 1 && @@ -111,10 +114,9 @@ class Functionalizer )) { flush(); - m_out << m_prefix << (_item.type() == Tag ? "" : " ") << _item.toAssemblyText() << endl; + m_out << m_prefix << (_item.type() == Tag ? "" : " ") << expression << endl; return; } - string expression = _item.toAssemblyText(); if (_item.arguments() > 0) { expression += "("; @@ -160,13 +162,14 @@ class Functionalizer ostream& m_out; string const& m_prefix; StringMap const& m_sourceCodes; + Assembly const& m_assembly; }; } void Assembly::assemblyStream(ostream& _out, string const& _prefix, StringMap const& _sourceCodes) const { - Functionalizer f(_out, _prefix, _sourceCodes); + Functionalizer f(_out, _prefix, _sourceCodes, *this); for (auto const& i: m_items) f.feed(i); @@ -639,7 +642,7 @@ LinkerObject const& Assembly::assemble() const case PushSubSize: { assertThrow(i.data() <= numeric_limits::max(), AssemblyException, ""); - auto s = m_subs.at(static_cast(i.data()))->assemble().bytecode.size(); + auto s = subAssemblyById(static_cast(i.data()))->assemble().bytecode.size(); i.setPushedValue(u256(s)); uint8_t b = max(1, util::bytesRequired(s)); ret.bytecode.push_back((uint8_t)Instruction::PUSH1 - 1 + b); @@ -707,25 +710,20 @@ LinkerObject const& Assembly::assemble() const // Append an INVALID here to help tests find miscompilation. ret.bytecode.push_back(uint8_t(Instruction::INVALID)); - for (size_t i = 0; i < m_subs.size(); ++i) + for (auto const& [subIdPath, bytecodeOffset]: subRef) { - auto references = subRef.equal_range(i); - if (references.first == references.second) - continue; - for (auto ref = references.first; ref != references.second; ++ref) - { - bytesRef r(ret.bytecode.data() + ref->second, bytesPerDataRef); - toBigEndian(ret.bytecode.size(), r); - } - ret.append(m_subs[i]->assemble()); + bytesRef r(ret.bytecode.data() + bytecodeOffset, bytesPerDataRef); + toBigEndian(ret.bytecode.size(), r); + ret.append(subAssemblyById(subIdPath)->assemble()); } + for (auto const& i: tagRef) { size_t subId; size_t tagId; tie(subId, tagId) = i.second; assertThrow(subId == numeric_limits::max() || subId < m_subs.size(), AssemblyException, "Invalid sub id"); - std::vector const& tagPositions = + vector const& tagPositions = subId == numeric_limits::max() ? m_tagPositionsInBytecode : m_subs[subId]->m_tagPositionsInBytecode; @@ -758,3 +756,51 @@ LinkerObject const& Assembly::assemble() const } return ret; } + +vector Assembly::decodeSubPath(size_t _subObjectId) const +{ + if (_subObjectId < m_subs.size()) + return {_subObjectId}; + + auto subIdPathIt = find_if( + m_subPaths.begin(), + m_subPaths.end(), + [_subObjectId](auto const& subId) { return subId.second == _subObjectId; } + ); + + assertThrow(subIdPathIt != m_subPaths.end(), AssemblyException, ""); + return subIdPathIt->first; +} + +size_t Assembly::encodeSubPath(vector const& _subPath) +{ + assertThrow(!_subPath.empty(), AssemblyException, ""); + if (_subPath.size() == 1) + { + assertThrow(_subPath[0] < m_subs.size(), AssemblyException, ""); + return _subPath[0]; + } + + if (m_subPaths.find(_subPath) == m_subPaths.end()) + { + size_t objectId = numeric_limits::max() - m_subPaths.size(); + assertThrow(objectId >= m_subs.size(), AssemblyException, ""); + m_subPaths[_subPath] = objectId; + } + + return m_subPaths[_subPath]; +} + +Assembly const* Assembly::subAssemblyById(size_t _subId) const +{ + vector subIds = decodeSubPath(_subId); + Assembly const* currentAssembly = this; + for (size_t currentSubId: subIds) + { + currentAssembly = currentAssembly->m_subs.at(currentSubId).get(); + assertThrow(currentAssembly, AssemblyException, ""); + } + + assertThrow(currentAssembly != this, AssemblyException, ""); + return currentAssembly; +} diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index 312521b714de..354304dcbafd 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -146,6 +146,9 @@ class Assembly /// Mark this assembly as invalid. Calling ``assemble`` on it will throw. void markAsInvalid() { m_invalid = true; } + std::vector decodeSubPath(size_t _subObjectId) const; + size_t encodeSubPath(std::vector const& _subPath); + protected: /// Does the same operations as @a optimise, but should only be applied to a sub and /// returns the replaced tags. Also takes an argument containing the tags of this assembly @@ -166,6 +169,9 @@ class Assembly static std::string toStringInHex(u256 _value); bool m_invalid = false; + + Assembly const* subAssemblyById(size_t _subId) const; + protected: /// 0 is reserved for exception unsigned m_usedTags = 1; @@ -179,6 +185,10 @@ class Assembly std::map m_libraries; ///< Identifiers of libraries to be linked. std::map m_immutables; ///< Identifiers of immutables. + /// Map from a vector representing a path to a particular sub assembly to sub assembly id. + /// This map is used only for sub-assemblies which are not direct sub-assemblies (where path is having more than one value). + std::map, size_t> m_subPaths; + mutable LinkerObject m_assembledObject; mutable std::vector m_tagPositionsInBytecode; diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index 80d34f57caa6..e70e844d6d63 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -18,7 +18,10 @@ #include +#include + #include +#include #include #include @@ -170,7 +173,7 @@ string AssemblyItem::getJumpTypeAsString() const } } -string AssemblyItem::toAssemblyText() const +string AssemblyItem::toAssemblyText(Assembly const& _assembly) const { string text; switch (type()) @@ -208,11 +211,18 @@ string AssemblyItem::toAssemblyText() const text = string("data_") + util::toHex(data()); break; case PushSub: - text = string("dataOffset(sub_") + to_string(static_cast(data())) + ")"; - break; case PushSubSize: - text = string("dataSize(sub_") + to_string(static_cast(data())) + ")"; + { + vector subPathComponents; + for (size_t subPathComponentId: _assembly.decodeSubPath(static_cast(data()))) + subPathComponents.emplace_back("sub_" + to_string(subPathComponentId)); + text = + (type() == PushSub ? "dataOffset"s : "dataSize"s) + + "(" + + solidity::util::joinHumanReadable(subPathComponents, ".") + + ")"; break; + } case PushProgramSize: text = string("bytecodeSize"); break; diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index dd65b109f4aa..ac3a2c9d81a1 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -152,7 +152,7 @@ class AssemblyItem void setPushedValue(u256 const& _value) const { m_pushedValue = std::make_shared(_value); } u256 const* pushedValue() const { return m_pushedValue.get(); } - std::string toAssemblyText() const; + std::string toAssemblyText(Assembly const& _assembly) const; size_t m_modifierDepth = 0; diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index e85ecd876e9a..934cff0a446c 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -72,7 +72,7 @@ AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(Dialect const& _dialect, errors, _dialect, {}, - _object.dataNames() + _object.qualifiedDataNames() ).analyze(*_object.code); yulAssert(success && !errors.hasErrors(), "Invalid assembly/yul code."); return analysisInfo; diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index b8824740d58e..542de51d95b9 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -138,7 +138,7 @@ bool AssemblyStack::analyzeParsed(Object& _object) m_errorReporter, languageToDialect(m_language, m_evmVersion), {}, - _object.dataNames() + _object.qualifiedDataNames() ); bool success = analyzer.analyze(*_object.code); for (auto& subNode: _object.subObjects) diff --git a/libyul/CompilabilityChecker.cpp b/libyul/CompilabilityChecker.cpp index 0d80a510f8aa..2a99e3c7934e 100644 --- a/libyul/CompilabilityChecker.cpp +++ b/libyul/CompilabilityChecker.cpp @@ -39,7 +39,7 @@ map CompilabilityChecker::run( bool _optimizeStackAllocation ) { - if (EVMDialect const* evmDialect = dynamic_cast(&_dialect)) + if (auto const* evmDialect = dynamic_cast(&_dialect)) { NoOutputEVMDialect noOutputDialect(*evmDialect); @@ -48,8 +48,10 @@ map CompilabilityChecker::run( BuiltinContext builtinContext; builtinContext.currentObject = &_object; - for (auto name: _object.dataNames()) - builtinContext.subIDs[name] = 1; + if (!_object.name.empty()) + builtinContext.subIDs[_object.name] = 1; + for (auto const& subNode: _object.subObjects) + builtinContext.subIDs[subNode->name] = 1; NoOutputAssembly assembly; CodeTransform transform( assembly, diff --git a/libyul/Object.cpp b/libyul/Object.cpp index 1086e38cf1a3..72206c4b6f6a 100644 --- a/libyul/Object.cpp +++ b/libyul/Object.cpp @@ -24,9 +24,10 @@ #include #include -#include #include +#include +#include #include using namespace std; @@ -62,13 +63,54 @@ string Object::toString(Dialect const* _dialect) const return "object \"" + name.str() + "\" {\n" + indent(inner) + "\n}"; } -set Object::dataNames() const +set Object::qualifiedDataNames() const { - set names; - names.insert(name); - for (auto const& subObject: subIndexByName) - names.insert(subObject.first); - // The empty name is not valid - names.erase(YulString{}); - return names; + set qualifiedNames = name.empty() ? set{} : set{name}; + for (shared_ptr const& subObjectNode: subObjects) + { + yulAssert(qualifiedNames.count(subObjectNode->name) == 0, ""); + qualifiedNames.insert(subObjectNode->name); + if (auto const* subObject = dynamic_cast(subObjectNode.get())) + for (YulString const& subSubObj: subObject->qualifiedDataNames()) + if (subObject->name != subSubObj) + { + yulAssert(qualifiedNames.count(YulString{subObject->name.str() + "." + subSubObj.str()}) == 0, ""); + qualifiedNames.insert(YulString{subObject->name.str() + "." + subSubObj.str()}); + } + } + + yulAssert(qualifiedNames.count(YulString{}) == 0, ""); + qualifiedNames.erase(YulString{}); + return qualifiedNames; +} + +vector Object::pathToSubObject(YulString _qualifiedName) const +{ + yulAssert(_qualifiedName != name, ""); + yulAssert(subIndexByName.count(name) == 0, ""); + + if (boost::algorithm::starts_with(_qualifiedName.str(), name.str() + ".")) + _qualifiedName = YulString{_qualifiedName.str().substr(name.str().length() + 1)}; + yulAssert(!_qualifiedName.empty(), ""); + + vector subObjectPathComponents; + boost::algorithm::split(subObjectPathComponents, _qualifiedName.str(), boost::is_any_of(".")); + + vector path; + Object const* object = this; + for (string const& currentSubObjectName: subObjectPathComponents) + { + yulAssert(!currentSubObjectName.empty(), ""); + auto subIndexIt = object->subIndexByName.find(YulString{currentSubObjectName}); + yulAssert( + subIndexIt != object->subIndexByName.end(), + "Assembly object <" + _qualifiedName.str() + "> not found or does not contain code." + ); + object = dynamic_cast(object->subObjects[subIndexIt->second].get()); + yulAssert(object, "Assembly object <" + _qualifiedName.str() + "> not found or does not contain code."); + yulAssert(object->subId != numeric_limits::max(), ""); + path.push_back({object->subId}); + } + + return path; } diff --git a/libyul/Object.h b/libyul/Object.h index 3602e717751a..deb52eb25f04 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -44,6 +44,8 @@ struct ObjectNode virtual std::string toString(Dialect const* _dialect) const = 0; std::string toString() { return toString(nullptr); } + /// Name of the object. + /// Can be empty since .yul files can also just contain code, without explicitly placing it in an object. YulString name; }; @@ -68,8 +70,23 @@ struct Object: ObjectNode std::string toString(Dialect const* _dialect) const override; /// @returns the set of names of data objects accessible from within the code of - /// this object. - std::set dataNames() const; + /// this object, including the name of object itself + std::set qualifiedDataNames() const; + + /// @returns vector of subIDs if possible to reach subobject with @a _qualifiedName, throws otherwise + /// For "B.C" should return vector of two values if success (subId of B and subId of C in B). + /// In object "A" if called for "A.B" will return only one value (subId for B) + /// will return empty vector for @a _qualifiedName that equals to object name. + /// Example: + /// A1{ B2{ C3, D3 }, E2{ F3{ G4, K4, H4{ I5 } } } } + /// pathToSubObject("A1.E2.F3.H4") == {1, 0, 2} + /// pathToSubObject("E2.F3.H4") == {1, 0, 2} + /// pathToSubObject("A1.E2") == {1} + /// The path must not lead to a @a Data object (will throw in that case). + std::vector pathToSubObject(YulString _qualifiedName) const; + + /// sub id for object if it is subobject of another object, max value if it is not subobject + size_t subId = std::numeric_limits::max(); std::shared_ptr code; std::vector> subObjects; diff --git a/libyul/backends/evm/AbstractAssembly.h b/libyul/backends/evm/AbstractAssembly.h index 9ff0c3846f8d..a8327c346e10 100644 --- a/libyul/backends/evm/AbstractAssembly.h +++ b/libyul/backends/evm/AbstractAssembly.h @@ -102,9 +102,9 @@ class AbstractAssembly /// Creates a new sub-assembly, which can be referenced using dataSize and dataOffset. virtual std::pair, SubID> createSubAssembly() = 0; /// Appends the offset of the given sub-assembly or data. - virtual void appendDataOffset(SubID _sub) = 0; + virtual void appendDataOffset(std::vector const& _subPath) = 0; /// Appends the size of the given sub-assembly or data. - virtual void appendDataSize(SubID _sub) = 0; + virtual void appendDataSize(std::vector const& _subPath) = 0; /// Appends the given data to the assembly and returns its ID. virtual SubID appendData(bytes const& _data) = 0; diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index c2204ab95e51..15d646755306 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -147,22 +147,28 @@ pair, AbstractAssembly::SubID> EthAssemblyAdapter:: return {make_shared(*assembly), static_cast(sub.data())}; } -void EthAssemblyAdapter::appendDataOffset(AbstractAssembly::SubID _sub) +void EthAssemblyAdapter::appendDataOffset(vector const& _subPath) { - auto it = m_dataHashBySubId.find(_sub); - if (it == m_dataHashBySubId.end()) - m_assembly.pushSubroutineOffset(_sub); - else + if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end()) + { + yulAssert(_subPath.size() == 1, ""); m_assembly << evmasm::AssemblyItem(evmasm::PushData, it->second); + return; + } + + m_assembly.pushSubroutineOffset(m_assembly.encodeSubPath(_subPath)); } -void EthAssemblyAdapter::appendDataSize(AbstractAssembly::SubID _sub) +void EthAssemblyAdapter::appendDataSize(vector const& _subPath) { - auto it = m_dataHashBySubId.find(_sub); - if (it == m_dataHashBySubId.end()) - m_assembly.pushSubroutineSize(static_cast(_sub)); - else + if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end()) + { + yulAssert(_subPath.size() == 1, ""); m_assembly << u256(m_assembly.data(h256(it->second)).size()); + return; + } + + m_assembly.pushSubroutineSize(m_assembly.encodeSubPath(_subPath)); } AbstractAssembly::SubID EthAssemblyAdapter::appendData(bytes const& _data) diff --git a/libyul/backends/evm/AsmCodeGen.h b/libyul/backends/evm/AsmCodeGen.h index 3192a9133d23..ee56f7fcb972 100644 --- a/libyul/backends/evm/AsmCodeGen.h +++ b/libyul/backends/evm/AsmCodeGen.h @@ -58,8 +58,8 @@ class EthAssemblyAdapter: public AbstractAssembly void appendReturnsub(int, int) override; void appendAssemblySize() override; std::pair, SubID> createSubAssembly() override; - void appendDataOffset(SubID _sub) override; - void appendDataSize(SubID _sub) override; + void appendDataOffset(std::vector const& _subPath) override; + void appendDataSize(std::vector const& _subPath) override; SubID appendData(bytes const& _data) override; void appendImmutable(std::string const& _identifier) override; diff --git a/libyul/backends/evm/EVMAssembly.cpp b/libyul/backends/evm/EVMAssembly.cpp index a4a1d0a27f17..99945383e528 100644 --- a/libyul/backends/evm/EVMAssembly.cpp +++ b/libyul/backends/evm/EVMAssembly.cpp @@ -202,12 +202,12 @@ pair, AbstractAssembly::SubID> EVMAssembly::createS return {}; } -void EVMAssembly::appendDataOffset(AbstractAssembly::SubID) +void EVMAssembly::appendDataOffset(vector const&) { yulAssert(false, "Data not implemented."); } -void EVMAssembly::appendDataSize(AbstractAssembly::SubID) +void EVMAssembly::appendDataSize(vector const&) { yulAssert(false, "Data not implemented."); } diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index f67aad8b8487..6e6878476db7 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -80,8 +80,8 @@ class EVMAssembly: public AbstractAssembly /// Append the assembled size as a constant. void appendAssemblySize() override; std::pair, SubID> createSubAssembly() override; - void appendDataOffset(SubID _sub) override; - void appendDataSize(SubID _sub) override; + void appendDataOffset(std::vector const& _subPath) override; + void appendDataSize(std::vector const& _subPath) override; SubID appendData(bytes const& _data) override; void appendImmutable(std::string const& _identifier) override; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 4b9acb0c7153..c552b6e220d9 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -144,7 +144,7 @@ map createBuiltins(langutil::EVMVersion _evmVe FunctionCall const& _call, AbstractAssembly& _assembly, BuiltinContext& _context, - std::function + std::function const& ) { yulAssert(_context.currentObject, "No object available."); yulAssert(_call.arguments.size() == 1, ""); @@ -154,18 +154,19 @@ map createBuiltins(langutil::EVMVersion _evmVe _assembly.appendAssemblySize(); else { - yulAssert( - _context.subIDs.count(dataName) != 0, - "Could not find assembly object <" + dataName.str() + ">." - ); - _assembly.appendDataSize(_context.subIDs.at(dataName)); + vector subIdPath = + _context.subIDs.count(dataName) == 0 ? + _context.currentObject->pathToSubObject(dataName) : + vector{_context.subIDs.at(dataName)}; + yulAssert(!subIdPath.empty(), "Could not find assembly object <" + dataName.str() + ">."); + _assembly.appendDataSize(subIdPath); } })); builtins.emplace(createFunction("dataoffset", 1, 1, SideEffects{}, {true}, []( FunctionCall const& _call, AbstractAssembly& _assembly, BuiltinContext& _context, - std::function + std::function const& ) { yulAssert(_context.currentObject, "No object available."); yulAssert(_call.arguments.size() == 1, ""); @@ -175,11 +176,12 @@ map createBuiltins(langutil::EVMVersion _evmVe _assembly.appendConstant(0); else { - yulAssert( - _context.subIDs.count(dataName) != 0, - "Could not find assembly object <" + dataName.str() + ">." - ); - _assembly.appendDataOffset(_context.subIDs.at(dataName)); + vector subIdPath = + _context.subIDs.count(dataName) == 0 ? + _context.currentObject->pathToSubObject(dataName) : + vector{_context.subIDs.at(dataName)}; + yulAssert(!subIdPath.empty(), "Could not find assembly object <" + dataName.str() + ">."); + _assembly.appendDataOffset(subIdPath); } })); builtins.emplace(createFunction( diff --git a/libyul/backends/evm/EVMObjectCompiler.cpp b/libyul/backends/evm/EVMObjectCompiler.cpp index 91f23b59691e..5eb83a6a8f9d 100644 --- a/libyul/backends/evm/EVMObjectCompiler.cpp +++ b/libyul/backends/evm/EVMObjectCompiler.cpp @@ -26,6 +26,7 @@ #include #include +#include using namespace solidity::yul; using namespace std; @@ -41,11 +42,12 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize) BuiltinContext context; context.currentObject = &_object; - for (auto& subNode: _object.subObjects) - if (Object* subObject = dynamic_cast(subNode.get())) + for (auto const& subNode: _object.subObjects) + if (auto* subObject = dynamic_cast(subNode.get())) { auto subAssemblyAndID = m_assembly.createSubAssembly(); context.subIDs[subObject->name] = subAssemblyAndID.second; + subObject->subId = subAssemblyAndID.second; compile(*subObject, *subAssemblyAndID.first, m_dialect, m_evm15, _optimize); } else diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index 0d840ef669a8..733795523202 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -132,12 +132,12 @@ pair, AbstractAssembly::SubID> NoOutputAssembly::cr return {}; } -void NoOutputAssembly::appendDataOffset(AbstractAssembly::SubID) +void NoOutputAssembly::appendDataOffset(std::vector const&) { appendInstruction(evmasm::Instruction::PUSH1); } -void NoOutputAssembly::appendDataSize(AbstractAssembly::SubID) +void NoOutputAssembly::appendDataSize(std::vector const&) { appendInstruction(evmasm::Instruction::PUSH1); } diff --git a/libyul/backends/evm/NoOutputAssembly.h b/libyul/backends/evm/NoOutputAssembly.h index 9f853032be7c..b2153e42a7a3 100644 --- a/libyul/backends/evm/NoOutputAssembly.h +++ b/libyul/backends/evm/NoOutputAssembly.h @@ -68,8 +68,8 @@ class NoOutputAssembly: public AbstractAssembly void appendAssemblySize() override; std::pair, SubID> createSubAssembly() override; - void appendDataOffset(SubID _sub) override; - void appendDataSize(SubID _sub) override; + void appendDataOffset(std::vector const& _subPath) override; + void appendDataSize(std::vector const& _subPath) override; SubID appendData(bytes const& _data) override; void appendImmutable(std::string const& _identifier) override; diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.cpp b/libyul/backends/wasm/EVMToEwasmTranslator.cpp index abb898828a81..dc180b24094c 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.cpp +++ b/libyul/backends/wasm/EVMToEwasmTranslator.cpp @@ -1249,7 +1249,7 @@ Object EVMToEwasmTranslator::run(Object const& _object) ErrorList errors; ErrorReporter errorReporter(errors); - AsmAnalyzer analyzer(*ret.analysisInfo, errorReporter, WasmDialect::instance(), {}, _object.dataNames()); + AsmAnalyzer analyzer(*ret.analysisInfo, errorReporter, WasmDialect::instance(), {}, _object.qualifiedDataNames()); if (!analyzer.analyze(*ret.code)) { string message = "Invalid code generated after EVM to wasm translation.\n"; diff --git a/test/cmdlineTests/standard_yul_object_invalid_sub/input.json b/test/cmdlineTests/standard_yul_object_invalid_sub/input.json new file mode 100644 index 000000000000..ccc142d254c1 --- /dev/null +++ b/test/cmdlineTests/standard_yul_object_invalid_sub/input.json @@ -0,0 +1,17 @@ +{ + "language": "Yul", + "sources": + { + "A": + { + "content": "object \"NamedObject\" { code { let x := dataoffset(\"NamedObject.\") sstore(add(x, 0), 0) } object \"OtherObject\" { code { revert(0, 0) } } }" + } + }, + "settings": + { + "outputSelection": + { + "*": { "*": ["*"], "": [ "*" ] } + } + } +} \ No newline at end of file diff --git a/test/cmdlineTests/standard_yul_object_invalid_sub/output.json b/test/cmdlineTests/standard_yul_object_invalid_sub/output.json new file mode 100644 index 000000000000..5008d4916c23 --- /dev/null +++ b/test/cmdlineTests/standard_yul_object_invalid_sub/output.json @@ -0,0 +1,4 @@ +{"errors":[{"component":"general","formattedMessage":"A:1:40: TypeError: Unknown data object \"NamedObject.\". +object \"NamedObject\" { code { let x := dataoffset(\"NamedObject.\") sstore(add(x, 0), 0) } object \"OtherObject\" { code { revert(0, 0) } } } + ^--------^ +","message":"Unknown data object \"NamedObject.\".","severity":"error","sourceLocation":{"end":49,"file":"A","start":39},"type":"TypeError"}]} diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index c2140ace6ae5..c93d7b58d35a 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace std; using namespace solidity::langutil; @@ -254,6 +255,24 @@ BOOST_AUTO_TEST_CASE(immutable) ); } +BOOST_AUTO_TEST_CASE(subobject_encode_decode) +{ + Assembly assembly; + + shared_ptr subAsmPtr = make_shared(); + shared_ptr subSubAsmPtr = make_shared(); + + assembly.appendSubroutine(subAsmPtr); + subAsmPtr->appendSubroutine(subSubAsmPtr); + + BOOST_CHECK(assembly.encodeSubPath({0}) == 0); + BOOST_REQUIRE_THROW(assembly.encodeSubPath({1}), solidity::evmasm::AssemblyException); + BOOST_REQUIRE_THROW(assembly.decodeSubPath(1), solidity::evmasm::AssemblyException); + + vector subPath{0, 0}; + BOOST_CHECK(assembly.decodeSubPath(assembly.encodeSubPath(subPath)) == subPath); +} + BOOST_AUTO_TEST_SUITE_END() } // end namespaces diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index 57ee7ffa619b..b0b07a8fb8ef 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -90,7 +90,7 @@ pair, shared_ptr> yul::test::parse( if (!parserResult->code || errorReporter.hasErrors()) return {}; shared_ptr analysisInfo = make_shared(); - AsmAnalyzer analyzer(*analysisInfo, errorReporter, _dialect, {}, parserResult->dataNames()); + AsmAnalyzer analyzer(*analysisInfo, errorReporter, _dialect, {}, parserResult->qualifiedDataNames()); // TODO this should be done recursively. if (!analyzer.analyze(*parserResult->code) || errorReporter.hasErrors()) return {}; diff --git a/test/libyul/objectCompiler/subObjectAccess.yul b/test/libyul/objectCompiler/subObjectAccess.yul new file mode 100644 index 000000000000..4fddc2483f07 --- /dev/null +++ b/test/libyul/objectCompiler/subObjectAccess.yul @@ -0,0 +1,104 @@ +object "A" { + code { + pop(dataoffset("A")) + pop(datasize("A")) + pop(dataoffset("B")) + pop(datasize("B")) + pop(dataoffset("B.C")) + pop(datasize("B.C")) + pop(dataoffset("B.E")) + pop(datasize("B.E")) + pop(dataoffset("B.C.D")) + pop(datasize("B.C.D")) + } + + data "data1" "Hello, World!" + + object "B" { + code { + pop(dataoffset("C")) + pop(datasize("C")) + pop(dataoffset("E")) + pop(datasize("E")) + pop(dataoffset("C.D")) + pop(datasize("C.D")) + } + object "C" { + code { + pop(dataoffset("D")) + pop(datasize("D")) + } + object "D" { + code { + invalid() + } + } + } + object "E" { + code { + invalid() + } + } + } +} +// ---- +// Assembly: +// /* "source":26:46 */ +// pop(0x00) +// /* "source":51:69 */ +// pop(bytecodeSize) +// /* "source":74:94 */ +// pop(dataOffset(sub_0)) +// /* "source":99:117 */ +// pop(dataSize(sub_0)) +// /* "source":122:144 */ +// pop(dataOffset(sub_0.sub_0)) +// /* "source":149:169 */ +// pop(dataSize(sub_0.sub_0)) +// /* "source":174:196 */ +// pop(dataOffset(sub_0.sub_1)) +// /* "source":201:221 */ +// pop(dataSize(sub_0.sub_1)) +// /* "source":226:250 */ +// pop(dataOffset(sub_0.sub_0.sub_0)) +// /* "source":255:277 */ +// pop(dataSize(sub_0.sub_0.sub_0)) +// stop +// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 +// +// sub_0: assembly { +// /* "source":347:367 */ +// pop(dataOffset(sub_0)) +// /* "source":374:392 */ +// pop(dataSize(sub_0)) +// /* "source":399:419 */ +// pop(dataOffset(sub_1)) +// /* "source":426:444 */ +// pop(dataSize(sub_1)) +// /* "source":451:473 */ +// pop(dataOffset(sub_0.sub_0)) +// /* "source":480:500 */ +// pop(dataSize(sub_0.sub_0)) +// stop +// +// sub_0: assembly { +// /* "source":545:565 */ +// pop(dataOffset(sub_0)) +// /* "source":574:592 */ +// pop(dataSize(sub_0)) +// stop +// +// sub_0: assembly { +// /* "source":645:654 */ +// invalid +// } +// } +// +// sub_1: assembly { +// /* "source":717:726 */ +// invalid +// } +// } +// Bytecode: 600050604650601f50601d50603e50600850603d50600150603c50600150fe601350600850601b50600150601c50600150fe600750600150fefefefefefe600750600150fefe +// Opcodes: PUSH1 0x0 POP PUSH1 0x46 POP PUSH1 0x1F POP PUSH1 0x1D POP PUSH1 0x3E POP PUSH1 0x8 POP PUSH1 0x3D POP PUSH1 0x1 POP PUSH1 0x3C POP PUSH1 0x1 POP INVALID PUSH1 0x13 POP PUSH1 0x8 POP PUSH1 0x1B POP PUSH1 0x1 POP PUSH1 0x1C POP PUSH1 0x1 POP INVALID PUSH1 0x7 POP PUSH1 0x1 POP INVALID INVALID INVALID INVALID INVALID INVALID PUSH1 0x7 POP PUSH1 0x1 POP INVALID INVALID +// SourceMappings: 26:20:0:-:0;;51:18;;74:20;;99:18;;122:22;;149:20;;174:22;;201:20;;226:24;;255:22; From 546e9af24dd6b6bda046a3903124960deb532e17 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 15 Jul 2020 17:26:51 +0200 Subject: [PATCH 429/479] [Sol->Yul] Supporting .runtimeCode --- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 3 +-- .../semanticTests/various/code_access_content.sol | 3 ++- .../semanticTests/various/code_access_runtime.sol | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 0489f3f680d3..d28ee2e9c396 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1491,7 +1491,6 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) solAssert(false, "Blockhash has been removed."); else if (member == "creationCode" || member == "runtimeCode") { - solUnimplementedAssert(member != "runtimeCode", ""); TypePointer arg = dynamic_cast(*_memberAccess.expression().annotation().type).typeArgument(); ContractDefinition const& contract = dynamic_cast(*arg).contractDefinition(); m_context.subObjectsCreated().insert(&contract); @@ -1503,7 +1502,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) )") ("allocationFunction", m_utils.allocationFunction()) ("size", m_context.newYulVariable()) - ("objectName", IRNames::creationObject(contract)) + ("objectName", IRNames::creationObject(contract) + (member == "runtimeCode" ? "." + IRNames::runtimeObject(contract) : "")) ("result", IRVariable(_memberAccess).commaSeparatedList()).render(); } else if (member == "name") diff --git a/test/libsolidity/semanticTests/various/code_access_content.sol b/test/libsolidity/semanticTests/various/code_access_content.sol index 2c115d6c8dae..c0a74fe1a354 100644 --- a/test/libsolidity/semanticTests/various/code_access_content.sol +++ b/test/libsolidity/semanticTests/various/code_access_content.sol @@ -36,7 +36,8 @@ contract C { return true; } } - +// ==== +// compileViaYul: also // ---- // testRuntime() -> true // testCreation() -> true diff --git a/test/libsolidity/semanticTests/various/code_access_runtime.sol b/test/libsolidity/semanticTests/various/code_access_runtime.sol index cc1401c6f1bc..36264f84dd81 100644 --- a/test/libsolidity/semanticTests/various/code_access_runtime.sol +++ b/test/libsolidity/semanticTests/various/code_access_runtime.sol @@ -10,18 +10,18 @@ contract D { } } - contract C { function test() public returns (uint256) { - D d = new D(); - bytes32 hash; - assembly { hash := extcodehash(d) } - assert(hash == keccak256(type(D).runtimeCode)); - return 42; + D d = new D(); + bytes32 hash; + assembly { hash := extcodehash(d) } + assert(hash == keccak256(type(D).runtimeCode)); + return 42; } } // ==== // EVMVersion: >=constantinople +// compileViaYul: also // ---- // test() -> 42 From 9eed519faab7ed24fd0f562b05405af7734e8072 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Wed, 22 Jul 2020 03:57:18 +0200 Subject: [PATCH 430/479] Introduce white list of error codes, which are not covered by tests --- scripts/error_codes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 8ab9b04dc679..eaf401cb0749 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -186,6 +186,16 @@ def examine_id_coverage(top_dir, source_id_to_file_names): # Warning (3420): Source file does not specify required compiler version! test_ids |= find_ids_in_cmdline_test_err(path.join(top_dir, "test", "cmdlineTests", "error_codes", "err")) + # white list of ids which are not covered by tests + white_ids = { + "3805", # "This is a pre-release compiler version, please do not use it in production." + # The warning may or may not exist in a compiler build. + "4591" # "There are more than 256 warnings. Ignoring the rest." + # Due to 3805, the warning lists look different for different compiler builds. + } + assert len(test_ids & white_ids) == 0, "The sets are not supposed to intersect" + test_ids |= white_ids + print(f"IDs in source files: {len(source_ids)}") print(f"IDs in test files : {len(test_ids)} ({len(test_ids) - len(source_ids)})") print() From 7e0a291fac680fc9af269b4f7d8f3f4c51a4caee Mon Sep 17 00:00:00 2001 From: a3d4 Date: Fri, 17 Jul 2020 00:37:16 +0200 Subject: [PATCH 431/479] Add "Only one receive function is allowed"-error to syntax tests --- .../fallback_function_twice.sol} | 0 .../duplicateFunctions/receive_function_thrice.sol | 8 ++++++++ 2 files changed, 8 insertions(+) rename test/libsolidity/syntaxTests/{nameAndTypeResolution/078_fallback_function_twice.sol => duplicateFunctions/fallback_function_twice.sol} (100%) create mode 100644 test/libsolidity/syntaxTests/duplicateFunctions/receive_function_thrice.sol diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol b/test/libsolidity/syntaxTests/duplicateFunctions/fallback_function_twice.sol similarity index 100% rename from test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol rename to test/libsolidity/syntaxTests/duplicateFunctions/fallback_function_twice.sol diff --git a/test/libsolidity/syntaxTests/duplicateFunctions/receive_function_thrice.sol b/test/libsolidity/syntaxTests/duplicateFunctions/receive_function_thrice.sol new file mode 100644 index 000000000000..2160dc05518d --- /dev/null +++ b/test/libsolidity/syntaxTests/duplicateFunctions/receive_function_thrice.sol @@ -0,0 +1,8 @@ +contract C { + receive() external payable { } + receive() external payable { } + receive() external payable { } +} +// ---- +// DeclarationError 4046: (52-82): Only one receive function is allowed. +// DeclarationError 4046: (87-117): Only one receive function is allowed. From 115380ca76624f553e7ba41958d5dbafd67e0082 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 22 Jul 2020 12:24:11 +0200 Subject: [PATCH 432/479] Yul fuzzer: Enable nested object references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Đorđe Mijović --- test/tools/ossfuzz/protoToYul.cpp | 38 ++++++++++++++++++------------- test/tools/ossfuzz/protoToYul.h | 4 ++-- test/tools/ossfuzz/yulProto.proto | 2 +- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 1d78dc8020a7..6c229c164313 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -1848,8 +1848,12 @@ void ProtoConverter::visit(LeaveStmt const&) string ProtoConverter::getObjectIdentifier(unsigned _x) { unsigned currentId = currentObjectId(); - yulAssert(m_objectScopeTree.size() > currentId, "Proto fuzzer: Error referencing object"); - std::vector objectIdsInScope = m_objectScopeTree[currentId]; + string currentObjName = "object" + to_string(currentId); + yulAssert( + m_objectScope.count(currentObjName) && m_objectScope.at(currentObjName).size() > 0, + "Yul proto fuzzer: Error referencing object" + ); + vector objectIdsInScope = m_objectScope.at(currentObjName); return objectIdsInScope[_x % objectIdsInScope.size()]; } @@ -1875,31 +1879,33 @@ void ProtoConverter::visit(Object const& _x) visit(_x.code()); if (_x.has_data()) visit(_x.data()); - if (_x.has_sub_obj()) - visit(_x.sub_obj()); + for (auto const& subObj: _x.sub_obj()) + visit(subObj); m_output << "}\n"; } void ProtoConverter::buildObjectScopeTree(Object const& _x) { // Identifies object being visited - string objectId = newObjectId(false); - vector node{objectId}; + string objectName = newObjectId(false); + vector node{objectName}; if (_x.has_data()) node.push_back(s_dataIdentifier); - if (_x.has_sub_obj()) + for (auto const& subObj: _x.sub_obj()) { // Identifies sub object whose numeric suffix is // m_objectId - string subObjectId = "object" + to_string(m_objectId); - node.push_back(subObjectId); - // TODO: Add sub-object to object's ancestors once - // nested access is implemented. - m_objectScopeTree.push_back(node); - buildObjectScopeTree(_x.sub_obj()); - } - else - m_objectScopeTree.push_back(node); + unsigned subObjectId = m_objectId; + string subObjectName = "object" + to_string(subObjectId); + node.push_back(subObjectName); + buildObjectScopeTree(subObj); + // Add sub-object to object's ancestors + yulAssert(m_objectScope.count(subObjectName), "Yul proto fuzzer: Invalid object hierarchy"); + for (string const& item: m_objectScope.at(subObjectName)) + if (item != subObjectName) + node.push_back(subObjectName + "." + item); + } + m_objectScope.emplace(objectName, node); } void ProtoConverter::visit(Program const& _x) diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 9b8de148057d..bf9963726ac2 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -352,8 +352,8 @@ class ProtoConverter std::stack> m_switchLiteralSetPerScope; // Look-up table per function type that holds the number of input (output) function parameters std::map> m_functionSigMap; - /// Tree of objects and their scopes - std::vector> m_objectScopeTree; + /// Map of object name to list of sub-object namespace(s) in scope + std::map> m_objectScope; // mod input/output parameters impose an upper bound on the number of input/output parameters a function may have. static unsigned constexpr s_modInputParams = 5; static unsigned constexpr s_modOutputParams = 5; diff --git a/test/tools/ossfuzz/yulProto.proto b/test/tools/ossfuzz/yulProto.proto index d87d067f2677..7146b9a496c9 100644 --- a/test/tools/ossfuzz/yulProto.proto +++ b/test/tools/ossfuzz/yulProto.proto @@ -389,7 +389,7 @@ message Block { message Object { required Code code = 1; optional Data data = 2; - optional Object sub_obj = 3; + repeated Object sub_obj = 3; } message Code { From 945dfb8392362227320601500995b8b4a85e5e43 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 22 Jul 2020 16:53:05 +0200 Subject: [PATCH 433/479] Unindent. --- docs/070-breaking-changes.rst | 104 +++++++++++++++++----------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 2954e21563a1..df06692de3ad 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -12,45 +12,45 @@ For the full list check Silent Changes of the Semantics =============================== - * Exponentiation and shifts of literals by non-literals (e.g. ``1 << x`` or ``2 ** x``) - will always use either the type ``uint256`` (for non-negative literals) or - ``int256`` (for negative literals) to perform the operation. - Previously, the operation was performed in the type of the shift amount / the - exponent which can be misleading. +* Exponentiation and shifts of literals by non-literals (e.g. ``1 << x`` or ``2 ** x``) + will always use either the type ``uint256`` (for non-negative literals) or + ``int256`` (for negative literals) to perform the operation. + Previously, the operation was performed in the type of the shift amount / the + exponent which can be misleading. Changes to the Syntax ===================== - * In external function and contract creation calls, Ether and gas is now specified using a new syntax: - ``x.f{gas: 10000, value: 2 ether}(arg1, arg2)``. - The old syntax -- ``x.f.gas(10000).value(2 ether)(arg1, arg2)`` -- will cause an error. - * The global variable ``now`` is deprecated, ``block.timestamp`` should be used instead. - The single identifier ``now`` is too generic for a global variable and could give the impression - that it changes during transaction processing, whereas ``block.timestamp`` correctly - reflects the fact that it is just a property of the block. - * NatSpec comments on variables are only allowed for public state variables and not - for local or internal variables. +* In external function and contract creation calls, Ether and gas is now specified using a new syntax: + ``x.f{gas: 10000, value: 2 ether}(arg1, arg2)``. + The old syntax -- ``x.f.gas(10000).value(2 ether)(arg1, arg2)`` -- will cause an error. +* The global variable ``now`` is deprecated, ``block.timestamp`` should be used instead. + The single identifier ``now`` is too generic for a global variable and could give the impression + that it changes during transaction processing, whereas ``block.timestamp`` correctly + reflects the fact that it is just a property of the block. +* NatSpec comments on variables are only allowed for public state variables and not + for local or internal variables. - * The token ``gwei`` is a keyword now (used to specify, e.g. ``2 gwei`` as a number) - and cannot be used as an identifier. +* The token ``gwei`` is a keyword now (used to specify, e.g. ``2 gwei`` as a number) + and cannot be used as an identifier. - * State Mutability: The state mutability of functions can now be restricted during inheritance: - Functions with default state mutability can be overridden by ``pure`` and ``view`` functions - while ``view`` functions can be overridden by ``pure`` functions. - At the same time, public state variables are considered ``view`` and even ``pure`` - if they are constants. +* State Mutability: The state mutability of functions can now be restricted during inheritance: + Functions with default state mutability can be overridden by ``pure`` and ``view`` functions + while ``view`` functions can be overridden by ``pure`` functions. + At the same time, public state variables are considered ``view`` and even ``pure`` + if they are constants. Inline Assembly --------------- - * Disallow ``.`` in user-defined function and variable names in inline assembly. - It is still valid if you use Solidity in Yul-only mode. +* Disallow ``.`` in user-defined function and variable names in inline assembly. + It is still valid if you use Solidity in Yul-only mode. - * Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` - and ``x.offset`` instead of ``x_slot`` and ``x_offset``. +* Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` + and ``x.offset`` instead of ``x_slot`` and ``x_offset``. Removal of Unused or Unsafe Features ==================================== @@ -58,54 +58,54 @@ Removal of Unused or Unsafe Features Mappings outside Storage ------------------------ - * If a struct or array contains a mapping, it can only be used in storage. - Previously, mapping members were silently skipped in memory, which - is confusing and error-prone. +* If a struct or array contains a mapping, it can only be used in storage. + Previously, mapping members were silently skipped in memory, which + is confusing and error-prone. - * Assignments to structs or arrays in storage does not work if they contain - mappings. - Previously, mappings were silently skipped during the copy operation, which - is misleading and error-prone. +* Assignments to structs or arrays in storage does not work if they contain + mappings. + Previously, mappings were silently skipped during the copy operation, which + is misleading and error-prone. Functions and Events -------------------- - * Visibility (``public`` / ``external``) is not needed for constructors anymore: - To prevent a contract from being created, it can be marked ``abstract``. - This makes the visibility concept for constructors obsolete. +* Visibility (``public`` / ``external``) is not needed for constructors anymore: + To prevent a contract from being created, it can be marked ``abstract``. + This makes the visibility concept for constructors obsolete. - * Type Checker: Disallow ``virtual`` for library functions: - Since libraries cannot be inherited from, library functions should not be virtual. +* Type Checker: Disallow ``virtual`` for library functions: + Since libraries cannot be inherited from, library functions should not be virtual. - * Multiple events with the same name and parameter types in the same - inheritance hierarchy are disallowed. +* Multiple events with the same name and parameter types in the same + inheritance hierarchy are disallowed. - * ``using A for B`` only affects the contract it is mentioned in. - Previously, the effect was inherited. Now, you have to repeat the ``using`` - statement in all derived contracts that make use of the feature. +* ``using A for B`` only affects the contract it is mentioned in. + Previously, the effect was inherited. Now, you have to repeat the ``using`` + statement in all derived contracts that make use of the feature. Expressions ----------- - * Shifts by signed types are disallowed. - Previously, shifts by negative amounts were allowed, but reverted at runtime. +* Shifts by signed types are disallowed. + Previously, shifts by negative amounts were allowed, but reverted at runtime. - * The ``finney`` and ``szabo`` denominations are removed. - They are rarely used and do not make the actual amount readily visible. Instead, explicit - values like ``1e20`` or the very common ``gwei`` can be used. +* The ``finney`` and ``szabo`` denominations are removed. + They are rarely used and do not make the actual amount readily visible. Instead, explicit + values like ``1e20`` or the very common ``gwei`` can be used. Declarations ------------ - * The keyword ``var`` cannot be used anymore. - Previously, this keyword would parse but result in a type error and - a suggestion about which type to use. Now, it results in a parser error. +* The keyword ``var`` cannot be used anymore. + Previously, this keyword would parse but result in a type error and + a suggestion about which type to use. Now, it results in a parser error. Interface Changes ================= - * JSON AST: Members with value ``null`` are removed from JSON output. - * NatSpec: Constructors and functions have consistent userdoc output. +* JSON AST: Members with value ``null`` are removed from JSON output. +* NatSpec: Constructors and functions have consistent userdoc output. How to update your code From cbe9a2d240b0227169792736d3b60fdcf463f6ce Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 22 Jul 2020 06:03:54 -0500 Subject: [PATCH 434/479] Add Hera to buildpacks. --- .../Dockerfile.ubuntu1604.clang.ossfuzz | 14 +++++++++++++- .../docker/buildpack-deps/Dockerfile.ubuntu1804 | 15 ++++++++++++++- .../docker/buildpack-deps/Dockerfile.ubuntu2004 | 14 +++++++++++++- .../buildpack-deps/Dockerfile.ubuntu2004.clang | 14 +++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz index ceea17d8180c..32f84573cf39 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM gcr.io/oss-fuzz-base/base-clang as base -LABEL version="1" +LABEL version="2" ARG DEBIAN_FRONTEND=noninteractive @@ -96,6 +96,18 @@ RUN set -ex; \ ninja install/strip; \ rm -rf /usr/src/evmone +# HERA +RUN set -ex; \ + cd /usr/src; \ + git clone --branch="v0.3.0" --recurse-submodules https://github.com/ewasm/hera.git; \ + cd hera; \ + mkdir build; \ + cd build; \ + cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="/usr" ..; \ + ninja; \ + ninja install/strip; \ + rm -rf /usr/src/hera + FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 index 51eed0a9e4ed..b8ce7c50646d 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu1804 @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:bionic AS base -LABEL version="1" +LABEL version="2" ARG DEBIAN_FRONTEND=noninteractive @@ -88,6 +88,19 @@ RUN set -ex; \ tar xzpf $TGZFILE -C /usr; \ rm -f $TGZFILE; +# HERA +ARG HERA_HASH="622663cb3bc1fa07213c6e1fe8070c5c259096e75039a46d014b2a3448b5cf44" +ARG HERA_MAJOR="0" +ARG HERA_MINOR="3" +ARG HERA_MICRO="0" +RUN set -ex; \ + HERA_VERSION="$HERA_MAJOR.$HERA_MINOR.$HERA_MICRO"; \ + TGZFILE="hera-$HERA_VERSION-linux-x86_64.tar.gz"; \ + wget https://github.com/ewasm/hera/releases/download/v$HERA_VERSION/$TGZFILE; \ + sha256sum $TGZFILE; \ + tar xzpf $TGZFILE -C /usr; \ + rm -f $TGZFILE; + FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 index 591e430af77a..78a14651d220 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004 @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base -LABEL version="1" +LABEL version="2" ARG DEBIAN_FRONTEND=noninteractive @@ -57,6 +57,18 @@ RUN set -ex; \ ninja install/strip; \ rm -rf /usr/src/evmone +# HERA +RUN set -ex; \ + cd /usr/src; \ + git clone --branch="v0.3.0" --recurse-submodules https://github.com/ewasm/hera.git; \ + cd hera; \ + mkdir build; \ + cd build; \ + cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="/usr" ..; \ + ninja; \ + ninja install/strip; \ + rm -rf /usr/src/hera + FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin diff --git a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang index c1663fdba7a9..05429eb3902c 100644 --- a/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang +++ b/scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang @@ -22,7 +22,7 @@ # (c) 2016-2019 solidity contributors. #------------------------------------------------------------------------------ FROM buildpack-deps:focal AS base -LABEL version="1" +LABEL version="2" ARG DEBIAN_FRONTEND=noninteractive @@ -59,6 +59,18 @@ RUN set -ex; \ ninja install/strip; \ rm -rf /usr/src/evmone +# HERA +RUN set -ex; \ + cd /usr/src; \ + git clone --branch="v0.3.0" --recurse-submodules https://github.com/ewasm/hera.git; \ + cd hera; \ + mkdir build; \ + cd build; \ + cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="/usr" ..; \ + ninja; \ + ninja install/strip; \ + rm -rf /usr/src/hera + FROM base COPY --from=libraries /usr/lib /usr/lib COPY --from=libraries /usr/bin /usr/bin From 69ff92db2b59aef8c1eb10ef8f34b37cfa6b7a16 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 22 Jul 2020 19:22:45 +0200 Subject: [PATCH 435/479] Switch to new ppa key. --- scripts/release_ppa.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index d15f8d221bb4..3017692cce63 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -51,7 +51,7 @@ is_release() { [[ "${branch}" = "release" ]] || [[ "${branch}" =~ ^v[0-9]+(\.[0-9])*$ ]] } -keyid=70D110489D66E2F6 +keyid=379F4801D622CDCF email=builds@ethereum.org packagename=solc From c4ba2e1956ca0749913ea2278b8feeeee7d407dd Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 11:28:42 +0200 Subject: [PATCH 436/479] Fix pragma in documentation. --- docs/types/reference-types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 2b46bae68a9e..336cf5b2edb3 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -243,7 +243,7 @@ individual elements: :: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.4.0 <0.7.0; + pragma solidity >=0.4.0 <0.8.0; contract C { function f() public pure { From 1e6cf6e92c0f7828ef3405d82fa053c3fba5c06c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 22 Jul 2020 19:02:43 +0200 Subject: [PATCH 437/479] Update release checklist. --- ReleaseChecklist.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ReleaseChecklist.md b/ReleaseChecklist.md index 116b3dbe9e39..8cdc00591906 100644 --- a/ReleaseChecklist.md +++ b/ReleaseChecklist.md @@ -26,15 +26,26 @@ - [ ] Run ``scripts/create_source_tarball.sh`` while being on the tag to create the source tarball. Make sure to create ``prerelease.txt`` before: (``echo -n > prerelease.txt``). This will create the tarball in a directory called ``upload``. - [ ] Take the tarball from the upload directory (its name should be ``solidity_x.x.x.tar.gz``, otherwise ``prerelease.txt`` was missing in the step before) and upload the source tarball to the release page. +### Homebrew and MacOS + - [ ] Update the version and the hash (``sha256sum solidity_x.x.x.tar.gz``) in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb + - [ ] Take the binary from the ``b_osx`` run of the released commit in circle-ci and add it to the release page as ``solc-macos``. + +### Update solc-bin + - [ ] Copy ``soljson.js`` from the release page to ``solc-bin/bin/soljson-v+commit..js`` + - [ ] Copy ``solc-static-linux`` from the release page to ``solc-bin/linux-amd64/solc-linux-amd64-v+commit.`` + - [ ] Copy ``solc-macos`` from the release page to ``solc-bin/macos-amd64/solc-macos-amd64-v+commit.`` + - [ ] Copy ``solc-windows.zip`` from the release page to ``solc-bin/windows-amd64/solc-windows-amd64-v+commit..zip`` + - [ ] Make the linux and the macos binaries executable. + - [ ] Run ``./update`` in ``solc-bin`` and verify that the script has updated ``list.js``, ``list.txt`` and ``list.json`` files correctly and that symlinks to the new release have been added in ``solc-bin/wasm/`` and ``solc-bin/emscripten-wasm32/``. + - [ ] Create a pull request and merge. + ### PPA - [ ] Change ``scripts/release_ppa.sh`` to match your key's email and key id. - [ ] Run ``scripts/release_ppa.sh release`` to create the PPA release (you need the relevant openssl key). - [ ] Wait for the ``~ethereum/ubuntu/ethereum-static`` PPA build to be finished and published for *all platforms*. SERIOUSLY: DO NOT PROCEED EARLIER!!! *After* the static builds are *published*, copy the static package to the ``~ethereum/ubuntu/ethereum`` PPA for the destination series ``Trusty`` and ``Xenial`` while selecting ``Copy existing binaries``. - - [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh v0.x.x``). -### Homebrew and MacOS - - [ ] Update the version and the hash (``sha256sum solidity_x.x.x.tar.gz``) in https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb - - [ ] Take the binary from the ``b_osx`` run of the released commit in circle-ci and add it to the release page as ``solc-macos``. +### Docker + - [ ] Check that the Docker release was pushed to Docker Hub (this still seems to have problems, run ``./scripts/docker_deploy_manual.sh v0.x.x``). ### Documentation - [ ] Build the new version on https://readthedocs.org/projects/solidity/ (select `latest` on the bottom of the page and click `BUILD`) @@ -46,6 +57,7 @@ - [ ] Make sure to push the tag ``npm publish`` created with ``git push --tags``. ### Post-release + - [ ] Publish the blog post. - [ ] Create a commit to increase the version number on ``develop`` in ``CMakeLists.txt`` and add a new skeleton changelog entry. - [ ] Merge ``release`` back into ``develop``. - [ ] Announce on Twitter and Reddit. From 9d2a0947e92cbc8c2f705b65956c8e270b7fd6fa Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Wed, 15 Jul 2020 18:56:28 +0200 Subject: [PATCH 438/479] Fix 1-tuple chain --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 49 +++++++++++-------- libsolidity/formal/SMTEncoder.h | 3 ++ .../complex/slither/data_dependency.sol | 1 + .../loops/for_1_false_positive.sol | 3 +- .../operators/delete_struct.sol | 1 + .../smtCheckerTests/types/tuple_1_chain_1.sol | 10 ++++ .../smtCheckerTests/types/tuple_1_chain_2.sol | 10 ++++ .../smtCheckerTests/types/tuple_1_chain_n.sol | 10 ++++ .../types/tuple_return_branch.sol | 1 + 10 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_1_chain_1.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_1_chain_2.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_1_chain_n.sol diff --git a/Changelog.md b/Changelog.md index 467bca127f38..627dfc436cf3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -31,6 +31,7 @@ Compiler Features: Bugfixes: * NatSpec: Constructors and functions have consistent userdoc output. * Inheritance: Disallow public state variables overwriting ``pure`` functions. + * SMTChecker: Fix internal error when assigning to a 1-tuple. * State Mutability: Constant public state variables are considered ``pure`` functions. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 417a169211f1..d690b2b3c2fd 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -425,17 +425,13 @@ void SMTEncoder::endVisit(TupleExpression const& _tuple) auto const& symbTuple = dynamic_pointer_cast(m_context.expression(_tuple)); solAssert(symbTuple, ""); auto const& symbComponents = symbTuple->components(); - auto const* tupleComponents = &_tuple.components(); - while (tupleComponents->size() == 1) - { - auto innerTuple = dynamic_pointer_cast(tupleComponents->front()); - solAssert(innerTuple, ""); - tupleComponents = &innerTuple->components(); - } - solAssert(symbComponents.size() == tupleComponents->size(), ""); + auto const* tuple = dynamic_cast(innermostTuple(_tuple)); + solAssert(tuple, ""); + auto const& tupleComponents = tuple->components(); + solAssert(symbComponents.size() == tupleComponents.size(), ""); for (unsigned i = 0; i < symbComponents.size(); ++i) { - auto tComponent = tupleComponents->at(i); + auto tComponent = tupleComponents.at(i); if (tComponent) { if (auto varDecl = identifierToVariable(*tComponent)) @@ -454,8 +450,7 @@ void SMTEncoder::endVisit(TupleExpression const& _tuple) /// Parenthesized expressions are also TupleExpression regardless their type. auto const& components = _tuple.components(); solAssert(components.size() == 1, ""); - if (smt::isSupportedType(components.front()->annotation().type->category())) - defineExpr(_tuple, expr(*components.front())); + defineExpr(_tuple, expr(*components.front())); } } @@ -729,11 +724,7 @@ void SMTEncoder::visitGasLeft(FunctionCall const& _funCall) void SMTEncoder::endVisit(Identifier const& _identifier) { - if (_identifier.annotation().willBeWrittenTo) - { - // Will be translated as part of the node that requested the lvalue. - } - else if (auto decl = identifierToVariable(_identifier)) + if (auto decl = identifierToVariable(_identifier)) defineExpr(_identifier, currentValue(*decl)); else if (_identifier.annotation().type->category() == Type::Category::Function) visitFunctionIdentifier(_identifier); @@ -1449,10 +1440,14 @@ void SMTEncoder::assignment( "Tuple assignments should be handled by tupleAssignment." ); + Expression const* left = &_left; + if (auto const* tuple = dynamic_cast(left)) + left = innermostTuple(*tuple); + if (!smt::isSupportedType(_type->category())) { // Give it a new index anyway to keep the SSA scheme sound. - if (auto varDecl = identifierToVariable(_left)) + if (auto varDecl = identifierToVariable(*left)) m_context.newValue(*varDecl); m_errorReporter.warning( @@ -1461,10 +1456,10 @@ void SMTEncoder::assignment( "Assertion checker does not yet implement type " + _type->toString() ); } - else if (auto varDecl = identifierToVariable(_left)) + else if (auto varDecl = identifierToVariable(*left)) assignment(*varDecl, _right); - else if (dynamic_cast(&_left)) - arrayIndexAssignment(_left, _right); + else if (dynamic_cast(left)) + arrayIndexAssignment(*left, _right); else m_errorReporter.warning( 8182_error, @@ -1901,6 +1896,20 @@ Expression const* SMTEncoder::leftmostBase(IndexAccess const& _indexAccess) return base; } +Expression const* SMTEncoder::innermostTuple(TupleExpression const& _tuple) +{ + solAssert(!_tuple.isInlineArray(), ""); + TupleExpression const* tuple = &_tuple; + Expression const* expr = tuple; + while (tuple && !tuple->isInlineArray() && tuple->components().size() == 1) + { + expr = tuple->components().front().get(); + tuple = dynamic_cast(expr); + } + solAssert(expr, ""); + return expr; +} + set SMTEncoder::touchedVariables(ASTNode const& _node) { vector callStack; diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index 92ef0601afff..ec097a2c976e 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -54,6 +54,9 @@ class SMTEncoder: public ASTConstVisitor /// @returns the leftmost identifier in a multi-d IndexAccess. static Expression const* leftmostBase(IndexAccess const& _indexAccess); + /// @returns the innermost element in a chain of 1-tuples. + static Expression const* innermostTuple(TupleExpression const& _tuple); + /// @returns the FunctionDefinition of a FunctionCall /// if possible or nullptr. static FunctionDefinition const* functionCallToDefinition(FunctionCall const& _funCall); diff --git a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol index d88e553b7fc3..6fc041fb115e 100644 --- a/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol +++ b/test/libsolidity/smtCheckerTests/complex/slither/data_dependency.sol @@ -132,6 +132,7 @@ contract PropagateThroughReturnValue { // Warning 8182: (539-567): Assertion checker does not yet implement such assignments. // Warning 8115: (629-643): Assertion checker does not yet support the type of this variable. // Warning 8364: (646-668): Assertion checker does not yet implement type struct Reference.St storage ref +// Warning 8364: (700-703): Assertion checker does not yet implement type struct Reference.St storage pointer // Warning 8364: (706-728): Assertion checker does not yet implement type struct Reference.St storage ref // Warning 8364: (700-728): Assertion checker does not yet implement type struct Reference.St storage pointer // Warning 7650: (748-755): Assertion checker does not yet support this expression. diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol index ee6933d17e64..ff3d584e6aa8 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol @@ -13,7 +13,8 @@ contract C assert(x > 0); } } +// ==== +// SMTSolvers: cvc4 // ---- -// Warning 1218: (296-309): Error trying to invoke SMT solver. // Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 4661: (296-309): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol index 748fc59adb1a..e55601219cbb 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol @@ -22,6 +22,7 @@ contract C // Warning 7650: (117-120): Assertion checker does not yet support this expression. // Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S memory // Warning 8182: (117-124): Assertion checker does not yet implement such assignments. +// Warning 8364: (145-146): Assertion checker does not yet implement type struct C.S memory // Warning 7650: (165-168): Assertion checker does not yet support this expression. // Warning 8364: (165-166): Assertion checker does not yet implement type struct C.S memory // Warning 2683: (158-168): Assertion checker does not yet implement "delete" for this expression. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_1_chain_1.sol b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_1.sol new file mode 100644 index 000000000000..eded54d2e30a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_1.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; +contract C { + function i() public pure returns (uint d) { + if (0==0) + (d) = 13; + assert(d == 13); + } +} +// ---- +// Warning 6838: (96-100): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_1_chain_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_2.sol new file mode 100644 index 000000000000..e35dff70666e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_2.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; +contract C { + function i() public pure returns (uint d) { + if (0==0) + ((d)) = 13; + assert(d == 13); + } +} +// ---- +// Warning 6838: (96-100): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_1_chain_n.sol b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_n.sol new file mode 100644 index 000000000000..5166ed1b622d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_1_chain_n.sol @@ -0,0 +1,10 @@ +pragma experimental SMTChecker; +contract C { + function i() public pure returns (uint d) { + if (0==0) + (((((d))))) = 13; + assert(d == 13); + } +} +// ---- +// Warning 6838: (96-100): Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol b/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol index 19b53cc3b0c8..1489eb87f20b 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_return_branch.sol @@ -19,5 +19,6 @@ contract C { // Warning 8364: (137-141): Assertion checker does not yet implement type struct C.S memory // Warning 4639: (137-141): Assertion checker does not yet implement this expression. // Warning 8115: (193-203): Assertion checker does not yet support the type of this variable. +// Warning 8364: (227-228): Assertion checker does not yet implement type struct C.S memory // Warning 4639: (137-141): Assertion checker does not yet implement this expression. // Warning 6191: (227-228): Assertion checker does not yet implement type struct C.S memory From fc34c81f4c67970aff1e242573b21c93d417ee10 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 13:59:16 +0200 Subject: [PATCH 439/479] Test for long object names in optimizer. --- .../objectCompiler/long_object_name.yul | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/libyul/objectCompiler/long_object_name.yul diff --git a/test/libyul/objectCompiler/long_object_name.yul b/test/libyul/objectCompiler/long_object_name.yul new file mode 100644 index 000000000000..322079928559 --- /dev/null +++ b/test/libyul/objectCompiler/long_object_name.yul @@ -0,0 +1,25 @@ +object "t" { + code { + sstore(0, datasize("name_that_is_longer_than_32_bytes_name_that_is_longer_than_32_bytes_name_that_is_longer_than_32_bytes")) + } + object "name_that_is_longer_than_32_bytes_name_that_is_longer_than_32_bytes_name_that_is_longer_than_32_bytes" { + code {} + } +} +// ==== +// optimize: true +// ---- +// Assembly: +// /* "source":23:147 */ +// dataSize(sub_0) +// /* "source":30:31 */ +// 0x00 +// /* "source":23:147 */ +// sstore +// stop +// +// sub_0: assembly { +// } +// Bytecode: 6000600055fe +// Opcodes: PUSH1 0x0 PUSH1 0x0 SSTORE INVALID +// SourceMappings: 23:124:0:-:0;30:1;23:124 From b1f79072dfa5e51a68ba597009c55fd8ad4ea65f Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 13:55:17 +0200 Subject: [PATCH 440/479] Fix stack compressor wrt literal arguments. --- libyul/backends/evm/NoOutputAssembly.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index 733795523202..ced32af6a0ae 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -163,14 +163,21 @@ NoOutputEVMDialect::NoOutputEVMDialect(EVMDialect const& _copyFrom): { for (auto& fun: m_functions) { - size_t parameters = fun.second.parameters.size(); size_t returns = fun.second.returns.size(); fun.second.generateCode = [=](FunctionCall const& _call, AbstractAssembly& _assembly, BuiltinContext&, std::function _visitExpression) { - for (auto const& arg: _call.arguments | boost::adaptors::reversed) - _visitExpression(arg); - - for (size_t i = 0; i < parameters; i++) + size_t visited = 0; + for (size_t j = 0; j < _call.arguments.size(); j++) + { + size_t const i = _call.arguments.size() - j - 1; + if (!(fun.second.literalArguments && (*fun.second.literalArguments)[i])) + { + _visitExpression(_call.arguments[i]); + visited++; + } + } + + for (size_t i = 0; i < visited; i++) _assembly.appendInstruction(evmasm::Instruction::POP); for (size_t i = 0; i < returns; i++) From 147a80aa24c370beb278fb065e96905a8864e4d5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 14:19:15 +0200 Subject: [PATCH 441/479] Rename external function slot to selector. --- libsolidity/ast/Types.cpp | 2 +- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 2c0889dfa693..3f05852e8b31 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3241,7 +3241,7 @@ vector> FunctionType::makeStackItems() const case Kind::DelegateCall: slots = { make_tuple("address", TypeProvider::address()), - make_tuple("functionIdentifier", TypeProvider::uint(32)) + make_tuple("functionSelector", TypeProvider::uint(32)) }; break; case Kind::BareCall: diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index d28ee2e9c396..a7ef82784fbf 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1395,7 +1395,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) solAssert(false, "Contract member is neither variable nor function."); define(IRVariable(_memberAccess).part("address"), _memberAccess.expression()); - define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(identifier) << "\n"; + define(IRVariable(_memberAccess).part("functionSelector")) << formatNumber(identifier) << "\n"; } else solAssert(false, "Invalid member access in contract"); @@ -1431,7 +1431,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) *_memberAccess.expression().annotation().type ); if (functionType.kind() == FunctionType::Kind::External) - define(IRVariable{_memberAccess}, IRVariable(_memberAccess.expression()).part("functionIdentifier")); + define(IRVariable{_memberAccess}, IRVariable(_memberAccess.expression()).part("functionSelector")); else if (functionType.kind() == FunctionType::Kind::Declaration) { solAssert(functionType.hasDeclaration(), ""); @@ -1683,7 +1683,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) break; case FunctionType::Kind::DelegateCall: define(IRVariable(_memberAccess).part("address"), _memberAccess.expression()); - define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(memberFunctionType->externalIdentifier()) << "\n"; + define(IRVariable(_memberAccess).part("functionSelector")) << formatNumber(memberFunctionType->externalIdentifier()) << "\n"; break; case FunctionType::Kind::External: case FunctionType::Kind::Creation: @@ -2077,7 +2077,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall( // storage for arguments and returned data let := - mstore(, ()) + mstore(, ()) let := (add(, 4) ) let := (,
, , , sub(, ), , ) @@ -2107,7 +2107,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall( templ("freeMemory", freeMemory()); templ("shl28", m_utils.shiftLeftFunction(8 * (32 - 4))); - templ("funId", IRVariable(_functionCall.expression()).part("functionIdentifier").name()); + templ("funSel", IRVariable(_functionCall.expression()).part("functionSelector").name()); templ("address", IRVariable(_functionCall.expression()).part("address").name()); // Always use the actual return length, and not our calculated expected length, if returndatacopy is supported. From 8cfbe02cc0ba8d1ce7a47b46afa75d9a818628b8 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 22 Jul 2020 10:39:42 +0200 Subject: [PATCH 442/479] Fix token list. --- liblangutil/Token.h | 4 ++-- test/libsolidity/SolidityParser.cpp | 2 -- test/libsolidity/syntaxTests/tryCatch/no_catch.sol | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/liblangutil/Token.h b/liblangutil/Token.h index ab4eba8bab73..0daceb68d143 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -148,6 +148,7 @@ namespace solidity::langutil K(As, "as", 0) \ K(Assembly, "assembly", 0) \ K(Break, "break", 0) \ + K(Catch, "catch", 0) \ K(Constant, "constant", 0) \ K(Constructor, "constructor", 0) \ K(Continue, "continue", 0) \ @@ -187,6 +188,7 @@ namespace solidity::langutil K(CallData, "calldata", 0) \ K(Struct, "struct", 0) \ K(Throw, "throw", 0) \ + K(Try, "try", 0) \ K(Type, "type", 0) \ K(Using, "using", 0) \ K(View, "view", 0) \ @@ -237,7 +239,6 @@ namespace solidity::langutil K(Apply, "apply", 0) \ K(Auto, "auto", 0) \ K(Case, "case", 0) \ - K(Catch, "catch", 0) \ K(CopyOf, "copyof", 0) \ K(Default, "default", 0) \ K(Define, "define", 0) \ @@ -260,7 +261,6 @@ namespace solidity::langutil K(Static, "static", 0) \ K(Supports, "supports", 0) \ K(Switch, "switch", 0) \ - K(Try, "try", 0) \ K(Typedef, "typedef", 0) \ K(TypeOf, "typeof", 0) \ K(Unchecked, "unchecked", 0) \ diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 1aea3bf96037..6ad68d85bb9a 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -535,7 +535,6 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved) "apply", "auto", "case", - "catch", "copyof", "default", "define", @@ -558,7 +557,6 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved) "static", "supports", "switch", - "try", "typedef", "typeof", "unchecked" diff --git a/test/libsolidity/syntaxTests/tryCatch/no_catch.sol b/test/libsolidity/syntaxTests/tryCatch/no_catch.sol index b6f0e9187ee5..1563b227d334 100644 --- a/test/libsolidity/syntaxTests/tryCatch/no_catch.sol +++ b/test/libsolidity/syntaxTests/tryCatch/no_catch.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError 2314: (97-98): Expected reserved keyword 'catch' but got '}' +// ParserError 2314: (97-98): Expected 'catch' but got '}' From e7d5a7da1061cd78867815156bc9b40d86567a8e Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Wed, 15 Jul 2020 16:27:38 +0200 Subject: [PATCH 443/479] [TypeChecker] Remove function input and return parameter names from mobileType --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 6 ++--- libsolidity/ast/Types.cpp | 22 +++++++++++++++++++ libsolidity/ast/Types.h | 1 + .../conditional_with_arguments.sol | 10 +++++++++ .../invalid_named_arguments_conditional.sol | 14 ++++++++++++ 6 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol create mode 100644 test/libsolidity/syntaxTests/functionCalls/invalid_named_arguments_conditional.sol diff --git a/Changelog.md b/Changelog.md index 467bca127f38..76add95783de 100644 --- a/Changelog.md +++ b/Changelog.md @@ -32,6 +32,7 @@ Bugfixes: * NatSpec: Constructors and functions have consistent userdoc output. * Inheritance: Disallow public state variables overwriting ``pure`` functions. * State Mutability: Constant public state variables are considered ``pure`` functions. + * Type Checker: Fixing deduction issues on function types when function call has named arguments. ### 0.6.12 (2020-07-22) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8b8ceadd5c8b..f0b174d192e9 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1293,9 +1293,9 @@ bool TypeChecker::visit(Conditional const& _conditional) if (_conditional.annotation().willBeWrittenTo) m_errorReporter.typeError( - 2212_error, - _conditional.location(), - "Conditional expression as left value is not supported yet." + 2212_error, + _conditional.location(), + "Conditional expression as left value is not supported yet." ); return false; diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 2c0889dfa693..967aa19d47dd 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3425,6 +3425,28 @@ TypeResult FunctionType::interfaceType(bool /*_inLibrary*/) const return TypeResult::err("Internal type is not allowed for public or external functions."); } +TypePointer FunctionType::mobileType() const +{ + if (m_valueSet || m_gasSet || m_saltSet || m_bound) + return nullptr; + + // return function without parameter names + return TypeProvider::function( + m_parameterTypes, + m_returnParameterTypes, + strings(m_parameterTypes.size()), + strings(m_returnParameterNames.size()), + m_kind, + m_arbitraryParameters, + m_stateMutability, + m_declaration, + m_gasSet, + m_valueSet, + m_bound, + m_saltSet + ); +} + bool FunctionType::canTakeArguments( FuncCallArguments const& _arguments, Type const* _selfType diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 5983fe9416b6..938b3f886587 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1234,6 +1234,7 @@ class FunctionType: public Type MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; TypePointer encodingType() const override; TypeResult interfaceType(bool _inLibrary) const override; + TypePointer mobileType() const override; /// @returns TypePointer of a new FunctionType object. All input/return parameters are an /// appropriate external types (i.e. the interfaceType()s) of input/return parameters of diff --git a/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol new file mode 100644 index 000000000000..f5996d32ca9d --- /dev/null +++ b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol @@ -0,0 +1,10 @@ +contract C { + function g(int x, int y) public pure returns (int) { return x - y; } + function h(int y, int x) public pure returns (int) { return y - x; } + + function f() public pure returns (int) { + return (false ? g : h)(2, 1); + } +} +// ---- +// f() -> 1 diff --git a/test/libsolidity/syntaxTests/functionCalls/invalid_named_arguments_conditional.sol b/test/libsolidity/syntaxTests/functionCalls/invalid_named_arguments_conditional.sol new file mode 100644 index 000000000000..0893c0ea6b8c --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/invalid_named_arguments_conditional.sol @@ -0,0 +1,14 @@ +contract C { + function g(int x, int y) public pure returns (int) { return x - y; } + function h(int y, int x) public pure returns (int) { return y - x; } + + function f() public pure { + (true ? g : h)({x : 1, y : 2}); + [g, h][1]({x : 1, y : 2}); + } +} +// ---- +// TypeError 4974: (199-229): Named argument "x" does not match function declaration. +// TypeError 4974: (199-229): Named argument "y" does not match function declaration. +// TypeError 4974: (239-264): Named argument "x" does not match function declaration. +// TypeError 4974: (239-264): Named argument "y" does not match function declaration. From a1da90d14bb92210e32bd806974b6ba72675f8a7 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 17 Jul 2020 10:22:30 +0200 Subject: [PATCH 444/479] Adding more tests for function types --- .../functionCall/conditional_with_arguments.sol | 2 ++ .../inline_array_with_value_call_option.sol | 10 ++++++++++ .../functionTypes/function_type_named_call.sol | 9 +++++++++ .../inline_array_with_bound_function.sol | 13 +++++++++++++ .../inline_array_with_bound_function_mixed.sol | 13 +++++++++++++ .../inline_array_with_payable_function.sol | 13 +++++++++++++ .../functionTypes/ternary_with_bound_functions.sol | 14 ++++++++++++++ 7 files changed, 74 insertions(+) create mode 100644 test/libsolidity/semanticTests/functionTypes/inline_array_with_value_call_option.sol create mode 100644 test/libsolidity/syntaxTests/functionTypes/function_type_named_call.sol create mode 100644 test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function.sol create mode 100644 test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function_mixed.sol create mode 100644 test/libsolidity/syntaxTests/functionTypes/inline_array_with_payable_function.sol create mode 100644 test/libsolidity/syntaxTests/functionTypes/ternary_with_bound_functions.sol diff --git a/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol index f5996d32ca9d..f5e2957c9bc2 100644 --- a/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol +++ b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol @@ -6,5 +6,7 @@ contract C { return (false ? g : h)(2, 1); } } +// ==== +// compileViaYul: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/functionTypes/inline_array_with_value_call_option.sol b/test/libsolidity/semanticTests/functionTypes/inline_array_with_value_call_option.sol new file mode 100644 index 000000000000..e65da6e1e76f --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/inline_array_with_value_call_option.sol @@ -0,0 +1,10 @@ +contract C { + function f() external payable returns (uint) { assert(msg.value > 0); return 1; } + function g() external payable returns (uint) { assert(msg.value > 0); return 2; } + + function h() public payable returns (uint) { + return [this.f, this.g][0]{value: 1}(); + } +} +// ---- +// h(), 1 ether -> 1 diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_named_call.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_named_call.sol new file mode 100644 index 000000000000..ca337904ac72 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_named_call.sol @@ -0,0 +1,9 @@ +contract C { + function f() pure public { + function(uint a) returns (uint) x; + x({a:2}); + } +} +// ---- +// Warning 6162: (61-67): Naming function type parameters is deprecated. +// TypeError 4974: (95-103): Named argument "a" does not match function declaration. diff --git a/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function.sol b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function.sol new file mode 100644 index 000000000000..4e5ae7613677 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function.sol @@ -0,0 +1,13 @@ +library L { + function f(uint a) internal pure {} + function g(uint a) internal pure {} +} +contract C { + using L for *; + function f() pure public { + uint t = 8; + [t.f, t.g][0](); + } +} +// ---- +// TypeError 9563: (186-189): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function_mixed.sol b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function_mixed.sol new file mode 100644 index 000000000000..be98f2be5b7f --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_bound_function_mixed.sol @@ -0,0 +1,13 @@ +library L { + function f(uint a) internal pure {} +} +contract C { + using L for *; + function f() pure public { + uint t; + function() pure x; + [t.f, x][0]({a: 8}); + } +} +// ---- +// TypeError 9563: (169-172): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/functionTypes/inline_array_with_payable_function.sol b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_payable_function.sol new file mode 100644 index 000000000000..195287d55776 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/inline_array_with_payable_function.sol @@ -0,0 +1,13 @@ +contract D { + function f(uint a) external payable {} + function g(uint a) external {} +} + +contract C { + function f() public { + D d; + [d.f{value: 1}, d.g][0](8); + } +} +// ---- +// TypeError 9563: (155-168): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/functionTypes/ternary_with_bound_functions.sol b/test/libsolidity/syntaxTests/functionTypes/ternary_with_bound_functions.sol new file mode 100644 index 000000000000..2e12e4d2a8f2 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/ternary_with_bound_functions.sol @@ -0,0 +1,14 @@ +library L { + function f(uint a) internal pure {} + function g(uint a) internal pure {} +} +contract C { + using L for *; + function f(bool x) pure public { + uint t = 8; + (x ? t.f : t.g)(); + } +} +// ---- +// TypeError 9717: (196-199): Invalid mobile type in true expression. +// TypeError 3703: (202-205): Invalid mobile type in false expression. From 4f611fbf17d7f60794bb24f4f1215127a40c8d66 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 14:57:41 +0200 Subject: [PATCH 445/479] Some more tests for value. --- .../error_deprecate_value_constructor_nonpayable.sol | 11 +++++++++++ .../call_option_value_on_library_function.sol | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol diff --git a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol new file mode 100644 index 000000000000..4cc674570e63 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol @@ -0,0 +1,11 @@ +contract C { + constructor() {} +} +contract D { + function createC() public returns (C) { + C c = (new C).value(2)(); + return c; + } +} +// ---- +// TypeError 8827: (107-120): Constructor for contract C must be payable for member "value" to be available. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol new file mode 100644 index 000000000000..a5b57253a35b --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol @@ -0,0 +1,8 @@ +library L { function l() public {} } +contract test { + function f() public { + L.l{value: 1}(); + } +} +// ---- +// TypeError 2193: (87-100): Function call options can only be set on external function calls or contract creations. From bde0728b9bce0092708d49148f1d1f5440124981 Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Thu, 23 Jul 2020 19:16:57 +0530 Subject: [PATCH 446/479] Force upgrade package-lock --- test/externalTests/gnosis.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 436942d2d6bf..07c34ca46add 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -24,7 +24,7 @@ source test/externalTests/common.sh verify_input "$1" SOLJSON="$1" -function install_fn { npm install; } +function install_fn { npm install --package-lock; } function compile_fn { npx truffle compile; } function test_fn { npm test; } @@ -37,6 +37,8 @@ function gnosis_safe_test force_truffle_version sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json + rm -f package-lock.json + rm -rf node_modules/ run_install install_fn replace_libsolc_call From 5b54cfbed3547bdab84b0675d48421001a45271b Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 21 Jul 2020 15:20:05 +0200 Subject: [PATCH 447/479] Report an error if immutables not assigned --- Changelog.md | 1 + libevmasm/Assembly.cpp | 12 ++++++------ liblangutil/Exceptions.cpp | 3 +++ liblangutil/Exceptions.h | 1 + libsolidity/interface/CompilerStack.cpp | 12 +++++++++++- test/libsolidity/SyntaxTest.cpp | 14 +++++++++++++- .../syntaxTests/immutable/no_assignments.sol | 13 +++++++++++++ 7 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 test/libsolidity/syntaxTests/immutable/no_assignments.sol diff --git a/Changelog.md b/Changelog.md index 30bb9474256f..567c13b1bd74 100644 --- a/Changelog.md +++ b/Changelog.md @@ -34,6 +34,7 @@ Bugfixes: * SMTChecker: Fix internal error when assigning to a 1-tuple. * State Mutability: Constant public state variables are considered ``pure`` functions. * Type Checker: Fixing deduction issues on function types when function call has named arguments. + * Immutables: Fix internal compiler error when immutables are not assigned. ### 0.6.12 (2020-07-22) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index b1de71e3b488..c729a4eb4004 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include #include @@ -699,12 +701,10 @@ LinkerObject const& Assembly::assemble() const } } - assertThrow( - immutableReferencesBySub.empty(), - AssemblyException, - "Some immutables were read from but never assigned." - ); - + if (!immutableReferencesBySub.empty()) + throw + langutil::Error(1284_error, langutil::Error::Type::CodeGenerationError) << + util::errinfo_comment("Some immutables were read from but never assigned, possibly because of optimization."); if (!m_subs.empty() || !m_data.empty() || !m_auxiliaryData.empty()) // Append an INVALID here to help tests find miscompilation. diff --git a/liblangutil/Exceptions.cpp b/liblangutil/Exceptions.cpp index 2e9d22b418cf..0661d5ce50c7 100644 --- a/liblangutil/Exceptions.cpp +++ b/liblangutil/Exceptions.cpp @@ -33,6 +33,9 @@ Error::Error(ErrorId _errorId, Type _type, SourceLocation const& _location, stri { switch (m_type) { + case Type::CodeGenerationError: + m_typeName = "CodeGenerationError"; + break; case Type::DeclarationError: m_typeName = "DeclarationError"; break; diff --git a/liblangutil/Exceptions.h b/liblangutil/Exceptions.h index 69745a2fc0df..29acb7ee47a4 100644 --- a/liblangutil/Exceptions.h +++ b/liblangutil/Exceptions.h @@ -78,6 +78,7 @@ class Error: virtual public util::Exception public: enum class Type { + CodeGenerationError, DeclarationError, DocstringParsingError, ParserError, diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 27a51552e3bd..41a9040c4900 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -516,7 +516,17 @@ bool CompilerStack::compile() if (auto contract = dynamic_cast(node.get())) if (isRequestedContract(*contract)) { - compileContract(*contract, otherCompilers); + try + { + compileContract(*contract, otherCompilers); + } + catch (Error const& _error) + { + if (_error.type() != Error::Type::CodeGenerationError) + throw; + m_errorReporter.error(_error.errorId(), _error.type(), SourceLocation(), _error.what()); + return false; + } if (m_generateIR || m_generateEwasm) generateIR(*contract); if (m_generateEwasm) diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index c554366e955a..92b246b348db 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -74,7 +74,19 @@ void SyntaxTest::parseAndAnalyze() try { if (!compiler().compile()) - BOOST_THROW_EXCEPTION(runtime_error("Compilation failed even though analysis was successful.")); + { + ErrorList const& errors = compiler().errors(); + auto codeGeneretionErrorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) { + return error->type() == Error::Type::CodeGenerationError; + }); + auto errorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) { + return error->type() != Error::Type::Warning; + }); + // failing compilation after successful analysis is a rare case, + // it assumes that errors contain exactly one error, and the error is of type Error::Type::CodeGenerationError + if (codeGeneretionErrorCount != 1 || errorCount != 1) + BOOST_THROW_EXCEPTION(runtime_error("Compilation failed even though analysis was successful.")); + } } catch (UnimplementedFeatureError const& _e) { diff --git a/test/libsolidity/syntaxTests/immutable/no_assignments.sol b/test/libsolidity/syntaxTests/immutable/no_assignments.sol new file mode 100644 index 000000000000..7357d174a8d5 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/no_assignments.sol @@ -0,0 +1,13 @@ +contract C { + uint immutable x; + constructor() { + x = 0; + while (true) + {} + } + function f() external view returns(uint) { return x; } +} +// ==== +// optimize-yul: true +// ---- +// CodeGenerationError 1284: Some immutables were read from but never assigned, possibly because of optimization. From 1b810d4a0a1fb335dbcd35930e86b7977c623e76 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 16:45:16 +0200 Subject: [PATCH 448/479] Remove handling of signed shift amounts. --- libsolidity/codegen/ExpressionCompiler.cpp | 10 +--------- libsolidity/codegen/YulUtilFunctions.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 428f59993004..f702f5cdb69f 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -2117,7 +2117,6 @@ void ExpressionCompiler::appendShiftOperatorCode(Token _operator, Type const& _v solAssert(dynamic_cast(&_valueType), "Only integer and fixed bytes type supported for shifts."); // The amount can be a RationalNumberType too. - bool c_amountSigned = false; if (auto amountType = dynamic_cast(&_shiftAmountType)) { // This should be handled by the type checker. @@ -2125,17 +2124,10 @@ void ExpressionCompiler::appendShiftOperatorCode(Token _operator, Type const& _v solAssert(!amountType->integerType()->isSigned(), ""); } else if (auto amountType = dynamic_cast(&_shiftAmountType)) - c_amountSigned = amountType->isSigned(); + solAssert(!amountType->isSigned(), ""); else solAssert(false, "Invalid shift amount type."); - // shift by negative amount throws exception - if (c_amountSigned) - { - m_context << u256(0) << Instruction::DUP3 << Instruction::SLT; - m_context.appendConditionalInvalid(); - } - m_context << Instruction::SWAP1; // stack: value_to_shift shift_amount diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 0bd6b0d3a37b..7457f9c6bb8c 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -347,20 +347,17 @@ string YulUtilFunctions::typedShiftLeftFunction(Type const& _type, Type const& _ { solAssert(_type.category() == Type::Category::FixedBytes || _type.category() == Type::Category::Integer, ""); solAssert(_amountType.category() == Type::Category::Integer, ""); + solAssert(!dynamic_cast(_amountType).isSigned(), ""); string const functionName = "shift_left_" + _type.identifier() + "_" + _amountType.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( function (value, bits) -> result { bits := (bits) - - if slt(bits, 0) { invalid() } - result := ((bits, value)) } )") ("functionName", functionName) - ("amountSigned", dynamic_cast(_amountType).isSigned()) ("cleanAmount", cleanupFunction(_amountType)) ("shift", shiftLeftFunctionDynamic()) ("cleanup", cleanupFunction(_type)) @@ -372,6 +369,7 @@ string YulUtilFunctions::typedShiftRightFunction(Type const& _type, Type const& { solAssert(_type.category() == Type::Category::FixedBytes || _type.category() == Type::Category::Integer, ""); solAssert(_amountType.category() == Type::Category::Integer, ""); + solAssert(!dynamic_cast(_amountType).isSigned(), ""); IntegerType const* integerType = dynamic_cast(&_type); bool valueSigned = integerType && integerType->isSigned(); @@ -381,14 +379,10 @@ string YulUtilFunctions::typedShiftRightFunction(Type const& _type, Type const& Whiskers(R"( function (value, bits) -> result { bits := (bits) - - if slt(bits, 0) { invalid() } - result := ((bits, (value))) } )") ("functionName", functionName) - ("amountSigned", dynamic_cast(_amountType).isSigned()) ("cleanAmount", cleanupFunction(_amountType)) ("shift", valueSigned ? shiftRightSignedFunctionDynamic() : shiftRightFunctionDynamic()) ("cleanup", cleanupFunction(_type)) From 436cf4cf1268fb43a246d22ba9700cfeb5d5162d Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 14:48:56 +0200 Subject: [PATCH 449/479] Clean up changelog. --- Changelog.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Changelog.md b/Changelog.md index 567c13b1bd74..e1e1a05d028b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,36 +1,38 @@ ### 0.7.0 (unreleased) Breaking changes: - * Type Checker: Disallow virtual for library functions. - * Constructors should not have visibility. - * Deprecated dot syntax for `value` and `gas`. - * Deprecated the identifier `now`. - * Disallow `gwei` as identifier. - * JSON AST: Removes members with ``null`` value from JSON output. + * Inline Assembly: Disallow ``.`` in user-defined function and variable names. + * Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``. + * JSON AST: Remove members with ``null`` value from JSON output. + * Parser: Disallow ``gwei`` as identifier. + * Parser: Disallow dot syntax for ``value`` and ``gas``. * Parser: NatSpec comments on variables are only allowed for public state variables. - * Type Checker: Disallow shifts by signed types. - * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. - * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. + * Parser: Remove the ``finney`` and ``szabo`` denominations. + * Parser: Remove the identifier ``now`` (replaced by ``block.timestamp``). + * Reference Resolver: ``using A for B`` only affects the contract it is mentioned in and not all derived contracts + * Type Checker: Disallow ``virtual`` for library functions. * Type Checker: Disallow assignments to state variables that contain nested mappings. * Type checker: Disallow events with same name and parameter types in inheritance hierarchy. - * ``using A for B`` only affects the contract it is mentioned in and not all derived contracts - * Inline Assembly: Disallow `.` in user-defined function and variable names. - * Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``. - * Remove the finney and szabo denominations. + * Type Checker: Disallow shifts by signed types. + * Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings. + * Type Checker: Exponentiation and shifts of literals by non-literals will always use ``uint256`` or ``int256`` as a type. + * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. + * Yul: Disallow EVM instruction `pc()`. + Language Features: - * State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override. - * Yul: Disallow EVM instruction `pc()`. - * Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed. * Inheritance: Allow overrides to have stricter state mutability: ``view`` can override ``nonpayable`` and ``pure`` can override ``view``. + * Parser: Deprecate visibility for constructors. + * State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override. + Compiler Features: * Variable declarations using the ``var`` keyword are not recognized anymore. Bugfixes: - * NatSpec: Constructors and functions have consistent userdoc output. * Inheritance: Disallow public state variables overwriting ``pure`` functions. + * NatSpec: Constructors and functions have consistent userdoc output. * SMTChecker: Fix internal error when assigning to a 1-tuple. * State Mutability: Constant public state variables are considered ``pure`` functions. * Type Checker: Fixing deduction issues on function types when function call has named arguments. From a7a069c74a5d536cbe8344a4fa76cf47a4ec1b03 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 13 Jul 2020 21:10:30 +0200 Subject: [PATCH 450/479] Refactor constructor exit --- libsolidity/formal/CHC.cpp | 49 ++++++++++++++++++++++++++++++-------- libsolidity/formal/CHC.h | 3 +++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index f68872d5c816..821da26a1539 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -142,12 +142,11 @@ void CHC::endVisit(ContractDefinition const& _contract) else inlineConstructorHierarchy(_contract); - auto summary = predicate(*m_constructorSummaryPredicate, vector{m_error.currentValue()} + currentStateVariables()); - connectBlocks(m_currentBlock, summary); + connectBlocks(m_currentBlock, summary(_contract), m_error.currentValue() == 0); clearIndices(m_currentContract, nullptr); - auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); - setCurrentBlock(*m_constructorSummaryPredicate, &stateExprs); + vector symbArgs = currentFunctionVariables(*m_currentContract); + setCurrentBlock(*m_constructorSummaryPredicate, &symbArgs); addAssertVerificationTarget(m_currentContract, m_currentBlock, smtutil::Expression(true), m_error.currentValue()); connectBlocks(m_currentBlock, interface(), m_error.currentValue() == 0); @@ -209,6 +208,8 @@ void CHC::endVisit(FunctionDefinition const& _function) if (!_function.isImplemented()) return; + solAssert(m_currentFunction && m_currentContract, ""); + // This is the case for base constructor inlining. if (m_currentFunction != &_function) { @@ -228,10 +229,10 @@ void CHC::endVisit(FunctionDefinition const& _function) { string suffix = m_currentContract->name() + "_" + to_string(m_currentContract->id()); auto constructorExit = createSymbolicBlock(constructorSort(), "constructor_exit_" + suffix); - connectBlocks(m_currentBlock, predicate(*constructorExit, vector{m_error.currentValue()} + currentStateVariables())); + connectBlocks(m_currentBlock, predicate(*constructorExit, currentFunctionVariables(*m_currentContract))); clearIndices(m_currentContract, m_currentFunction); - auto stateExprs = vector{m_error.currentValue()} + currentStateVariables(); + auto stateExprs = currentFunctionVariables(*m_currentContract); setCurrentBlock(*constructorExit, &stateExprs); } else @@ -693,6 +694,10 @@ vector CHC::stateSorts(ContractDefinition const& _contract smtutil::SortPointer CHC::constructorSort() { + solAssert(m_currentContract, ""); + if (auto const* constructor = m_currentContract->constructor()) + return sort(*constructor); + return make_shared( vector{smtutil::SortProvider::uintSort} + m_stateSorts, smtutil::SortProvider::boolSort @@ -835,7 +840,12 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source) m_summaries[contract].emplace(function, createSummaryBlock(*function, *contract)); - if (!base->isLibrary() && !base->isInterface() && !function->isConstructor()) + if ( + function->isPublic() && + !base->isLibrary() && + !base->isInterface() && + !function->isConstructor() + ) { auto state1 = stateVariablesAtIndex(1, *base); auto state2 = stateVariablesAtIndex(2, *base); @@ -880,8 +890,13 @@ smtutil::Expression CHC::error(unsigned _idx) return m_errorPredicate->functionValueAtIndex(_idx)({}); } -smtutil::Expression CHC::summary(ContractDefinition const&) +smtutil::Expression CHC::summary(ContractDefinition const& _contract) { + if (auto const* constructor = _contract.constructor()) + return (*m_constructorSummaryPredicate)( + currentFunctionVariables(*constructor) + ); + return (*m_constructorSummaryPredicate)( vector{m_error.currentValue()} + currentStateVariables() @@ -977,15 +992,21 @@ vector CHC::currentStateVariables(ContractDefinition const& } vector CHC::currentFunctionVariables() +{ + solAssert(m_currentFunction, ""); + return currentFunctionVariables(*m_currentFunction); +} + +vector CHC::currentFunctionVariables(FunctionDefinition const& _function) { vector initInputExprs; vector mutableInputExprs; - for (auto const& var: m_currentFunction->parameters()) + for (auto const& var: _function.parameters()) { initInputExprs.push_back(m_context.variable(*var)->valueAtIndex(0)); mutableInputExprs.push_back(m_context.variable(*var)->currentValue()); } - auto returnExprs = applyMap(m_currentFunction->returnParameters(), [this](auto _var) { return currentValue(*_var); }); + auto returnExprs = applyMap(_function.returnParameters(), [this](auto _var) { return currentValue(*_var); }); return vector{m_error.currentValue()} + initialStateVariables() + initInputExprs + @@ -994,6 +1015,14 @@ vector CHC::currentFunctionVariables() returnExprs; } +vector CHC::currentFunctionVariables(ContractDefinition const& _contract) +{ + if (auto const* constructor = _contract.constructor()) + return currentFunctionVariables(*constructor); + + return vector{m_error.currentValue()} + currentStateVariables(); +} + vector CHC::currentBlockVariables() { if (m_currentFunction) diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index d025e31d30d3..d634672f1d15 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -164,6 +164,9 @@ class CHC: public SMTEncoder /// @returns the current symbolic values of the current function's /// input and output parameters. std::vector currentFunctionVariables(); + std::vector currentFunctionVariables(FunctionDefinition const& _function); + std::vector currentFunctionVariables(ContractDefinition const& _contract); + /// @returns the same as currentFunctionVariables plus /// local variables. std::vector currentBlockVariables(); From 744905525fe66c6410043622bc8011874fb42508 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 7 Jul 2020 16:22:51 +0200 Subject: [PATCH 451/479] Convert z3 cex graph into STL --- libsmtutil/CHCSmtLib2Interface.cpp | 4 +- libsmtutil/CHCSmtLib2Interface.h | 2 +- libsmtutil/CHCSolverInterface.h | 18 +++++- libsmtutil/Z3CHCInterface.cpp | 98 ++++++++++++++++++++++++++++-- libsmtutil/Z3CHCInterface.h | 13 +++- libsolidity/formal/CHC.cpp | 8 +-- libsolidity/formal/CHC.h | 2 +- 7 files changed, 127 insertions(+), 18 deletions(-) diff --git a/libsmtutil/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp index c6c5a4cac1aa..cc30c127bb51 100644 --- a/libsmtutil/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -83,7 +83,7 @@ void CHCSmtLib2Interface::addRule(Expression const& _expr, std::string const& _n ); } -pair> CHCSmtLib2Interface::query(Expression const& _block) +pair CHCSmtLib2Interface::query(Expression const& _block) { string accumulated{}; swap(m_accumulatedOutput, accumulated); @@ -108,7 +108,7 @@ pair> CHCSmtLib2Interface::query(Expression const& _ result = CheckResult::ERROR; // TODO collect invariants or counterexamples. - return make_pair(result, vector{}); + return {result, {}}; } void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const& _sort) diff --git a/libsmtutil/CHCSmtLib2Interface.h b/libsmtutil/CHCSmtLib2Interface.h index 5a74bacbe997..7039431c41c5 100644 --- a/libsmtutil/CHCSmtLib2Interface.h +++ b/libsmtutil/CHCSmtLib2Interface.h @@ -43,7 +43,7 @@ class CHCSmtLib2Interface: public CHCSolverInterface void addRule(Expression const& _expr, std::string const& _name) override; - std::pair> query(Expression const& _expr) override; + std::pair query(Expression const& _expr) override; void declareVariable(std::string const& _name, SortPointer const& _sort) override; diff --git a/libsmtutil/CHCSolverInterface.h b/libsmtutil/CHCSolverInterface.h index bf8b6a4ccce7..1fe279a8b082 100644 --- a/libsmtutil/CHCSolverInterface.h +++ b/libsmtutil/CHCSolverInterface.h @@ -24,6 +24,9 @@ #include +#include +#include + namespace solidity::smtutil { @@ -41,9 +44,18 @@ class CHCSolverInterface /// Needs to bound all vars as universally quantified. virtual void addRule(Expression const& _expr, std::string const& _name) = 0; - /// Takes a function application and checks - /// for reachability. - virtual std::pair> query( + /// first: predicate name + /// second: predicate arguments + using CexNode = std::pair>; + struct CexGraph + { + std::map nodes; + std::map> edges; + }; + + /// Takes a function application _expr and checks for reachability. + /// @returns solving result and a counterexample graph, if possible. + virtual std::pair query( Expression const& _expr ) = 0; }; diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index 262e72e1a947..6381aaa54ec2 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -20,6 +20,9 @@ #include +#include +#include + using namespace std; using namespace solidity; using namespace solidity::smtutil; @@ -43,6 +46,7 @@ Z3CHCInterface::Z3CHCInterface(): p.set("fp.spacer.mbqi", false); // Ground pobs by using values from a model. p.set("fp.spacer.ground_pobs", false); + m_solver.set(p); } @@ -72,10 +76,10 @@ void Z3CHCInterface::addRule(Expression const& _expr, string const& _name) } } -pair> Z3CHCInterface::query(Expression const& _expr) +pair Z3CHCInterface::query(Expression const& _expr) { CheckResult result; - vector values; + CHCSolverInterface::CexGraph cex; try { z3::expr z3Expr = m_z3Interface->toZ3Expr(_expr); @@ -84,8 +88,9 @@ pair> Z3CHCInterface::query(Expression const& _expr) case z3::check_result::sat: { result = CheckResult::SATISFIABLE; - // TODO retrieve model. - break; + auto proof = m_solver.get_answer(); + auto cex = cexGraph(proof); + return {result, cex}; } case z3::check_result::unsat: { @@ -104,8 +109,89 @@ pair> Z3CHCInterface::query(Expression const& _expr) catch (z3::exception const&) { result = CheckResult::ERROR; - values.clear(); + cex = {}; } - return make_pair(result, values); + return {result, cex}; +} + +/** +Convert a ground refutation into a linear or nonlinear counterexample. +The counterexample is given as an implication graph of the form +`premises => conclusion` where `premises` are the predicates +from the body of nonlinear clauses, representing the proof graph. +*/ +CHCSolverInterface::CexGraph Z3CHCInterface::cexGraph(z3::expr const& _proof) +{ + CexGraph graph; + + /// The root fact of the refutation proof is `false`. + /// The node itself is not a hyper resolution, so we need to + /// extract the `query` hyper resolution node from the + /// `false` node (the first child). + smtAssert(_proof.is_app(), ""); + smtAssert(fact(_proof).decl().decl_kind() == Z3_OP_FALSE, ""); + + stack proofStack; + proofStack.push(_proof.arg(0)); + + auto const& root = proofStack.top(); + graph.nodes[root.id()] = {name(fact(root)), arguments(fact(root))}; + + set visited; + visited.insert(root.id()); + + while (!proofStack.empty()) + { + z3::expr proofNode = proofStack.top(); + smtAssert(graph.nodes.count(proofNode.id()), ""); + proofStack.pop(); + + if (proofNode.is_app() && proofNode.decl().decl_kind() == Z3_OP_PR_HYPER_RESOLVE) + { + smtAssert(proofNode.num_args() > 0, ""); + for (unsigned i = 1; i < proofNode.num_args() - 1; ++i) + { + z3::expr child = proofNode.arg(i); + if (!visited.count(child.id())) + { + visited.insert(child.id()); + proofStack.push(child); + } + + if (!graph.nodes.count(child.id())) + { + graph.nodes[child.id()] = {name(fact(child)), arguments(fact(child))}; + graph.edges[child.id()] = {}; + } + + graph.edges[proofNode.id()].push_back(child.id()); + } + } + } + + return graph; +} + +z3::expr Z3CHCInterface::fact(z3::expr const& _node) +{ + smtAssert(_node.is_app(), ""); + if (_node.num_args() == 0) + return _node; + return _node.arg(_node.num_args() - 1); +} + +string Z3CHCInterface::name(z3::expr const& _predicate) +{ + smtAssert(_predicate.is_app(), ""); + return _predicate.decl().name().str(); +} + +vector Z3CHCInterface::arguments(z3::expr const& _predicate) +{ + smtAssert(_predicate.is_app(), ""); + vector args; + for (unsigned i = 0; i < _predicate.num_args(); ++i) + args.emplace_back(_predicate.arg(i).to_string()); + return args; } diff --git a/libsmtutil/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h index 7fe9e66537f6..679902b926b3 100644 --- a/libsmtutil/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -25,6 +25,8 @@ #include #include +#include + namespace solidity::smtutil { @@ -40,11 +42,20 @@ class Z3CHCInterface: public CHCSolverInterface void addRule(Expression const& _expr, std::string const& _name) override; - std::pair> query(Expression const& _expr) override; + std::pair query(Expression const& _expr) override; Z3Interface* z3Interface() const { return m_z3Interface.get(); } private: + /// Constructs a nonlinear counterexample graph from the refutation. + CHCSolverInterface::CexGraph cexGraph(z3::expr const& _proof); + /// @returns the fact from a proof node. + z3::expr fact(z3::expr const& _node); + /// @returns @a _predicate's name. + std::string name(z3::expr const& _predicate); + /// @returns the arguments of @a _predicate. + std::vector arguments(z3::expr const& _predicate); + // Used to handle variables. std::unique_ptr m_z3Interface; diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 821da26a1539..79d42555dc8d 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -1103,11 +1103,11 @@ void CHC::addRule(smtutil::Expression const& _rule, string const& _ruleName) m_interface->addRule(_rule, _ruleName); } -pair> CHC::query(smtutil::Expression const& _query, langutil::SourceLocation const& _location) +pair CHC::query(smtutil::Expression const& _query, langutil::SourceLocation const& _location) { smtutil::CheckResult result; - vector values; - tie(result, values) = m_interface->query(_query); + CHCSolverInterface::CexGraph cex; + tie(result, cex) = m_interface->query(_query); switch (result) { case smtutil::CheckResult::SATISFIABLE: @@ -1123,7 +1123,7 @@ pair> CHC::query(smtutil::Expression const& m_outerErrorReporter.warning(1218_error, _location, "Error trying to invoke SMT solver."); break; } - return {result, values}; + return {result, cex}; } void CHC::addVerificationTarget( diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index d634672f1d15..ca29d046b884 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -192,7 +192,7 @@ class CHC: public SMTEncoder void addRule(smtutil::Expression const& _rule, std::string const& _ruleName); /// @returns if query is unsatisfiable (safe). /// @returns otherwise. - std::pair> query(smtutil::Expression const& _query, langutil::SourceLocation const& _location); + std::pair query(smtutil::Expression const& _query, langutil::SourceLocation const& _location); void addVerificationTarget(ASTNode const* _scope, VerificationTarget::Type _type, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); void addAssertVerificationTarget(ASTNode const* _scope, smtutil::Expression _from, smtutil::Expression _constraints, smtutil::Expression _errorId); From 694ec92688617a876d1f1d97beba6ca1b52e6906 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 13 Jul 2020 21:10:44 +0200 Subject: [PATCH 452/479] Generate counterexample message based on cex graph --- libsolidity/formal/CHC.cpp | 250 +++++++++++++++++++++++++++++++++---- libsolidity/formal/CHC.h | 19 ++- 2 files changed, 246 insertions(+), 23 deletions(-) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 79d42555dc8d..130d239b2e07 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -29,6 +29,9 @@ #include #include +#include +#include + using namespace std; using namespace solidity; using namespace solidity::util; @@ -122,6 +125,7 @@ bool CHC::visit(ContractDefinition const& _contract) string suffix = _contract.name() + "_" + to_string(_contract.id()); m_errorPredicate = createSymbolicBlock(arity0FunctionSort(), "error_" + suffix); m_constructorSummaryPredicate = createSymbolicBlock(constructorSort(), "summary_constructor_" + suffix); + m_symbolFunction[m_constructorSummaryPredicate->currentFunctionValue().name] = &_contract; m_implicitConstructorPredicate = createSymbolicBlock(arity0FunctionSort(), "implicit_constructor_" + suffix); auto stateExprs = currentStateVariables(); setCurrentBlock(*m_interfaces.at(m_currentContract), &stateExprs); @@ -614,6 +618,7 @@ void CHC::resetSourceAnalysis() m_errorIds.clear(); m_callGraph.clear(); m_summaries.clear(); + m_symbolFunction.clear(); } void CHC::resetContractAnalysis() @@ -684,6 +689,11 @@ vector CHC::stateVariablesIncludingInheritedAndPriva ); } +vector CHC::stateVariablesIncludingInheritedAndPrivate(FunctionDefinition const& _function) +{ + return stateVariablesIncludingInheritedAndPrivate(dynamic_cast(*_function.scope())); +} + vector CHC::stateSorts(ContractDefinition const& _contract) { return applyMap( @@ -841,10 +851,10 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source) m_summaries[contract].emplace(function, createSummaryBlock(*function, *contract)); if ( + !function->isConstructor() && function->isPublic() && !base->isLibrary() && - !base->isInterface() && - !function->isConstructor() + !base->isInterface() ) { auto state1 = stateVariablesAtIndex(1, *base); @@ -923,21 +933,28 @@ smtutil::Expression CHC::summary(FunctionDefinition const& _function) unique_ptr CHC::createBlock(ASTNode const* _node, string const& _prefix) { - return createSymbolicBlock(sort(_node), + auto block = createSymbolicBlock(sort(_node), "block_" + uniquePrefix() + "_" + _prefix + predicateName(_node)); + + solAssert(m_currentFunction, ""); + m_symbolFunction[block->currentFunctionValue().name] = m_currentFunction; + return block; } unique_ptr CHC::createSummaryBlock(FunctionDefinition const& _function, ContractDefinition const& _contract) { - return createSymbolicBlock(summarySort(_function, _contract), + auto block = createSymbolicBlock(summarySort(_function, _contract), "summary_" + uniquePrefix() + "_" + predicateName(&_function, &_contract)); + + m_symbolFunction[block->currentFunctionValue().name] = &_function; + return block; } void CHC::createErrorBlock() @@ -1167,19 +1184,21 @@ void CHC::checkVerificationTargets() { string satMsg; string unknownMsg; + ErrorId errorReporterId; if (target.type == VerificationTarget::Type::PopEmptyArray) { solAssert(dynamic_cast(scope), ""); - satMsg = "Empty array \"pop\" detected here."; + satMsg = "Empty array \"pop\" detected here"; unknownMsg = "Empty array \"pop\" might happen here."; + errorReporterId = 2529_error; } else solAssert(false, ""); auto it = m_errorIds.find(scope->id()); solAssert(it != m_errorIds.end(), ""); - checkAndReportTarget(scope, target, it->second, satMsg, unknownMsg); + checkAndReportTarget(scope, target, it->second, errorReporterId, satMsg, unknownMsg); } } } @@ -1194,13 +1213,7 @@ void CHC::checkAssertTarget(ASTNode const* _scope, CHCVerificationTarget const& solAssert(it != m_errorIds.end(), ""); unsigned errorId = it->second; - createErrorBlock(); - connectBlocks(_target.value, error(), _target.constraints && (_target.errorId == errorId)); - auto [result, model] = query(error(), assertion->location()); - // This should be fine but it's a bug in the old compiler - (void)model; - if (result == smtutil::CheckResult::UNSATISFIABLE) - m_safeTargets[assertion].insert(_target.type); + checkAndReportTarget(assertion, _target, errorId, 6328_error, "Assertion violation happens here"); } } @@ -1208,35 +1221,228 @@ void CHC::checkAndReportTarget( ASTNode const* _scope, CHCVerificationTarget const& _target, unsigned _errorId, + ErrorId _errorReporterId, string _satMsg, string _unknownMsg ) { + if (m_unsafeTargets.count(_scope) && m_unsafeTargets.at(_scope).count(_target.type)) + return; + createErrorBlock(); connectBlocks(_target.value, error(), _target.constraints && (_target.errorId == _errorId)); - auto [result, model] = query(error(), _scope->location()); - // This should be fine but it's a bug in the old compiler - (void)model; + auto const& [result, model] = query(error(), _scope->location()); if (result == smtutil::CheckResult::UNSATISFIABLE) m_safeTargets[_scope].insert(_target.type); else if (result == smtutil::CheckResult::SATISFIABLE) { solAssert(!_satMsg.empty(), ""); m_unsafeTargets[_scope].insert(_target.type); - m_outerErrorReporter.warning( - 2529_error, - _scope->location(), - _satMsg - ); + auto cex = generateCounterexample(model, error().name); + if (cex) + m_outerErrorReporter.warning( + _errorReporterId, + _scope->location(), + _satMsg, + SecondarySourceLocation().append(" for:\n" + *cex, SourceLocation{}) + ); + else + m_outerErrorReporter.warning( + _errorReporterId, + _scope->location(), + _satMsg + "." + ); } else if (!_unknownMsg.empty()) m_outerErrorReporter.warning( - 1147_error, + _errorReporterId, _scope->location(), _unknownMsg ); } +/** +The counterexample DAG has the following properties: +1) The root node represents the reachable error predicate. +2) The root node has 1 or 2 children: + - One of them is the summary of the function that was called and led to that node. + If this is the only child, this function must be the constructor. + - If it has 2 children, the function is not the constructor and the other child is the interface node, + that is, it represents the state of the contract before the function described above was called. +3) Interface nodes also have property 2. + +The following algorithm starts collecting function summaries at the root node and repeats +for each interface node seen. +Each function summary collected represents a transaction, and the final order is reversed. + +The first function summary seen contains the values for the state, input and output variables at the +error point. +*/ +optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& _graph, string const& _root) +{ + optional rootId; + for (auto const& [id, node]: _graph.nodes) + if (node.first == _root) + { + rootId = id; + break; + } + if (!rootId) + return {}; + + vector path; + string localState; + + unsigned node = *rootId; + optional lastTxSeen; + while (_graph.edges.at(node).size() >= 1) + { + auto const& edges = _graph.edges.at(node); + solAssert(edges.size() <= 2, ""); + + unsigned summaryId = edges.at(0); + + optional interfaceId; + if (edges.size() == 2) + { + interfaceId = edges.at(1); + if (_graph.nodes.at(summaryId).first.rfind("summary", 0) != 0) + swap(summaryId, *interfaceId); + solAssert(_graph.nodes.at(*interfaceId).first.rfind("interface", 0) == 0, ""); + } + + solAssert(_graph.nodes.at(summaryId).first.rfind("summary", 0) == 0, ""); + /// At this point property 2 from the function description is verified for this node. + + auto const& summaryNode = _graph.nodes.at(summaryId); + solAssert(m_symbolFunction.count(summaryNode.first), ""); + + FunctionDefinition const* calledFun = nullptr; + ContractDefinition const* calledContract = nullptr; + if (auto const* contract = dynamic_cast(m_symbolFunction.at(summaryNode.first))) + { + if (auto const* constructor = contract->constructor()) + calledFun = constructor; + else + calledContract = contract; + } + else if (auto const* fun = dynamic_cast(m_symbolFunction.at(summaryNode.first))) + calledFun = fun; + else + solAssert(false, ""); + + solAssert((calledFun && !calledContract) || (!calledFun && calledContract), ""); + auto const& stateVars = calledFun ? stateVariablesIncludingInheritedAndPrivate(*calledFun) : stateVariablesIncludingInheritedAndPrivate(*calledContract); + /// calledContract != nullptr implies that the constructor of the analyzed contract is implicit and + /// therefore takes no parameters. + + /// This summary node is the end of a tx. + /// If it is the first summary node seen in this loop, it is the summary + /// of the public/external function that was called when the error was reached, + /// but not necessarily the summary of the function that contains the error. + if (!lastTxSeen) + { + lastTxSeen = summaryNode.first; + /// Generate counterexample message local to the failed target. + localState = generatePostStateCounterexample(stateVars, calledFun, summaryNode.second) + "\n"; + if (calledFun) + { + /// The signature of a summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). + auto const& inParams = calledFun->parameters(); + unsigned initLocals = stateVars.size() * 2 + 1 + inParams.size(); + /// In this loop we are interested in postInputVars. + for (unsigned i = initLocals; i < initLocals + inParams.size(); ++i) + { + auto param = inParams.at(i - initLocals); + if (param->type()->isValueType()) + localState += param->name() + " = " + summaryNode.second.at(i) + "\n"; + } + auto const& outParams = calledFun->returnParameters(); + initLocals += inParams.size(); + /// In this loop we are interested in outputVars. + for (unsigned i = initLocals; i < initLocals + outParams.size(); ++i) + { + auto param = outParams.at(i - initLocals); + if (param->type()->isValueType()) + localState += param->name() + " = " + summaryNode.second.at(i) + "\n"; + } + } + } + else + /// We report the state after every tx in the trace except for the last, which is reported + /// first in the code above. + path.emplace_back("State: " + generatePostStateCounterexample(stateVars, calledFun, summaryNode.second)); + + string txCex = calledContract ? "constructor()" : generatePreTxCounterexample(stateVars, *calledFun, summaryNode.second); + path.emplace_back(txCex); + + /// Recurse on the next interface node which represents the previous transaction + /// or stop. + if (interfaceId) + node = *interfaceId; + else + break; + } + + return localState + "\nTransaction trace:\n" + boost::algorithm::join(boost::adaptors::reverse(path), "\n"); +} + +string CHC::generatePostStateCounterexample(vector const& _stateVars, FunctionDefinition const* _function, vector const& _summaryValues) +{ + /// The signature of a function summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). + /// The signature of an implicit constructor summary predicate is: summary(error, postStateVars). + /// Here we are interested in postStateVars. + vector::const_iterator stateFirst; + vector::const_iterator stateLast; + if (_function) + { + stateFirst = _summaryValues.begin() + 1 + static_cast(_stateVars.size()) + static_cast(_function->parameters().size()); + stateLast = stateFirst + static_cast(_stateVars.size()); + } + else + { + stateFirst = _summaryValues.begin() + 1; + stateLast = stateFirst + static_cast(_stateVars.size()); + } + + vector stateArgs(stateFirst, stateLast); + solAssert(stateArgs.size() == _stateVars.size(), ""); + + vector stateCex; + for (unsigned i = 0; i < stateArgs.size(); ++i) + { + auto var = _stateVars.at(i); + if (var->type()->isValueType()) + stateCex.emplace_back(var->name() + " = " + stateArgs.at(i)); + } + + return boost::algorithm::join(stateCex, ", "); +} + +string CHC::generatePreTxCounterexample(vector const& _stateVars, FunctionDefinition const& _function, vector const& _summaryValues) +{ + /// The signature of a function summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). + /// Here we are interested in preInputVars. + vector::const_iterator first = _summaryValues.begin() + static_cast(_stateVars.size()) + 1; + vector::const_iterator last = first + static_cast(_function.parameters().size()); + vector functionArgsCex(first, last); + vector functionArgs; + + auto const& params = _function.parameters(); + solAssert(params.size() == functionArgsCex.size(), ""); + for (unsigned i = 0; i < params.size(); ++i) + if (params[i]->type()->isValueType()) + functionArgs.emplace_back(functionArgsCex[i]); + else + functionArgs.emplace_back(params[i]->name()); + + string fName = _function.isConstructor() ? "constructor" : + _function.isFallback() ? "fallback" : + _function.isReceive() ? "receive" : + _function.name(); + return fName + "(" + boost::algorithm::join(functionArgs, ", ") + ")"; +} + string CHC::uniquePrefix() { return to_string(m_blockCounter++); diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index ca29d046b884..3334a45e4731 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -38,6 +38,7 @@ #include #include +#include #include namespace solidity::frontend @@ -102,6 +103,7 @@ class CHC: public SMTEncoder void setCurrentBlock(smt::SymbolicFunctionVariable const& _block, std::vector const* _arguments = nullptr); std::set transactionAssertions(ASTNode const* _txRoot); static std::vector stateVariablesIncludingInheritedAndPrivate(ContractDefinition const& _contract); + static std::vector stateVariablesIncludingInheritedAndPrivate(FunctionDefinition const& _function); //@} /// Sort helpers. @@ -206,9 +208,21 @@ class CHC: public SMTEncoder ASTNode const* _scope, CHCVerificationTarget const& _target, unsigned _errorId, + langutil::ErrorId _errorReporterId, std::string _satMsg, - std::string _unknownMsg + std::string _unknownMsg = "" ); + + std::optional generateCounterexample(smtutil::CHCSolverInterface::CexGraph const& _graph, std::string const& _root); + /// @returns values for the _stateVariables after a transaction calling + /// _function was executed. + /// _function = nullptr means the transaction was the deployment of a + /// contract without an explicit constructor. + std::string generatePostStateCounterexample(std::vector const& _stateVariables, FunctionDefinition const* _function, std::vector const& _summaryValues); + /// @returns a formatted text representing a call to _function + /// with the concrete values for value type parameters and + /// the parameter name for reference types. + std::string generatePreTxCounterexample(std::vector const& _stateVariables, FunctionDefinition const& _function, std::vector const& _summaryValues); //@} /// Misc. @@ -258,6 +272,9 @@ class CHC: public SMTEncoder "error", m_context }; + + /// Maps predicate names to the ASTNodes they came from. + std::map m_symbolFunction; //@} /// Variables. From 51721c308032fe67b7cd3dc391b3743ccb25e2ed Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 13 Jul 2020 20:56:12 +0200 Subject: [PATCH 453/479] Double SAT run for cex --- libsmtutil/Z3CHCInterface.cpp | 55 +++++++++++++++++++++++++++-------- libsmtutil/Z3CHCInterface.h | 3 ++ libsolidity/formal/CHC.cpp | 18 ++++++++++++ 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index 6381aaa54ec2..4baf3bd0a9c6 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -36,18 +36,7 @@ Z3CHCInterface::Z3CHCInterface(): z3::set_param("rewriter.pull_cheap_ite", true); z3::set_param("rlimit", Z3Interface::resourceLimit); - // Spacer options. - // These needs to be set in the solver. - // https://github.com/Z3Prover/z3/blob/master/src/muz/base/fp_params.pyg - z3::params p(*m_context); - // These are useful for solving problems with arrays and loops. - // Use quantified lemma generalizer. - p.set("fp.spacer.q3.use_qgen", true); - p.set("fp.spacer.mbqi", false); - // Ground pobs by using values from a model. - p.set("fp.spacer.ground_pobs", false); - - m_solver.set(p); + enablePreProcessing(); } void Z3CHCInterface::declareVariable(string const& _name, SortPointer const& _sort) @@ -115,6 +104,48 @@ pair Z3CHCInterface::query(Expression return {result, cex}; } +void Z3CHCInterface::enablePreProcessing() +{ + // Spacer options. + // These needs to be set in the solver. + // https://github.com/Z3Prover/z3/blob/master/src/muz/base/fp_params.pyg + z3::params p(*m_context); + // These are useful for solving problems with arrays and loops. + // Use quantified lemma generalizer. + p.set("fp.spacer.q3.use_qgen", true); + p.set("fp.spacer.mbqi", false); + // Ground pobs by using values from a model. + p.set("fp.spacer.ground_pobs", false); + + // Enable Spacer optimization for better solving. + p.set("fp.xform.slice", true); + p.set("fp.xform.inline_linear", true); + p.set("fp.xform.inline_eager", true); + + m_solver.set(p); +} + +void Z3CHCInterface::disablePreProcessing() +{ + // Spacer options. + // These needs to be set in the solver. + // https://github.com/Z3Prover/z3/blob/master/src/muz/base/fp_params.pyg + z3::params p(*m_context); + // These are useful for solving problems with arrays and loops. + // Use quantified lemma generalizer. + p.set("fp.spacer.q3.use_qgen", true); + p.set("fp.spacer.mbqi", false); + // Ground pobs by using values from a model. + p.set("fp.spacer.ground_pobs", false); + + // Disable Spacer optimization for counterexample generation. + p.set("fp.xform.slice", false); + p.set("fp.xform.inline_linear", false); + p.set("fp.xform.inline_eager", false); + + m_solver.set(p); +} + /** Convert a ground refutation into a linear or nonlinear counterexample. The counterexample is given as an implication graph of the form diff --git a/libsmtutil/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h index 679902b926b3..e30611f0f051 100644 --- a/libsmtutil/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -46,6 +46,9 @@ class Z3CHCInterface: public CHCSolverInterface Z3Interface* z3Interface() const { return m_z3Interface.get(); } + void enablePreProcessing(); + void disablePreProcessing(); + private: /// Constructs a nonlinear counterexample graph from the refutation. CHCSolverInterface::CexGraph cexGraph(z3::expr const& _proof); diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 130d239b2e07..e687dffecb58 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -1128,7 +1128,25 @@ pair CHC::query(smtutil::Exp switch (result) { case smtutil::CheckResult::SATISFIABLE: + { +#ifdef HAVE_Z3 + // Even though the problem is SAT, Spacer's pre processing makes counterexamples incomplete. + // We now disable those optimizations and check whether we can still solve the problem. + auto* spacer = dynamic_cast(m_interface.get()); + solAssert(spacer, ""); + spacer->disablePreProcessing(); + + smtutil::CheckResult resultNoOpt; + CHCSolverInterface::CexGraph cexNoOpt; + tie(resultNoOpt, cexNoOpt) = m_interface->query(_query); + + if (resultNoOpt == smtutil::CheckResult::SATISFIABLE) + cex = move(cexNoOpt); + + spacer->enablePreProcessing(); +#endif break; + } case smtutil::CheckResult::UNSATISFIABLE: break; case smtutil::CheckResult::UNKNOWN: From 003c9b9a5bd1c9dc7a16d83c5e9913b8082f699e Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 13 Jul 2020 20:48:00 +0200 Subject: [PATCH 454/479] Update tests --- .../array_members/length_1d_struct_array_1.sol | 2 +- .../array_members/length_1d_struct_array_2d_1.sol | 2 +- .../array_members/length_basic.sol | 2 +- .../length_same_after_assignment_2_fail.sol | 6 +++--- .../length_same_after_assignment_3_fail.sol | 8 ++++---- .../array_members/pop_1_unsafe.sol | 2 +- .../array_members/pop_2d_unsafe.sol | 2 +- .../array_members/pop_loop_unsafe.sol | 2 +- .../array_members/push_2d_arg_1_unsafe.sol | 2 +- .../push_storage_ref_safe_aliasing.sol | 2 +- .../push_storage_ref_unsafe_aliasing.sol | 2 +- .../push_storage_ref_unsafe_length.sol | 6 +++--- .../array_members/push_zero_2d_unsafe.sol | 2 +- .../array_members/push_zero_unsafe.sol | 2 +- .../control_flow/short_circuit_and_fail.sol | 2 +- .../short_circuit_and_inside_branch.sol | 4 ++-- .../short_circuit_and_need_both_fail.sol | 2 +- .../control_flow/short_circuit_or_fail.sol | 2 +- .../short_circuit_or_inside_branch.sol | 2 +- .../short_circuit_or_need_both_fail.sol | 2 +- .../control_flow/ways_to_merge_variables_1.sol | 2 +- .../control_flow/ways_to_merge_variables_2.sol | 2 +- .../control_flow/ways_to_merge_variables_3.sol | 2 +- .../smtCheckerTests/external_calls/external.sol | 2 +- ..._hash_known_code_state_reentrancy_indirect.sol | 2 ++ ...al_hash_known_code_state_reentrancy_unsafe.sol | 2 ++ .../external_calls/external_inc.sol | 2 +- .../external_calls/external_inc1_inc2.sol | 2 +- .../external_calls/external_single_inc.sol | 2 +- .../external_calls/mutex_f_no_guard.sol | 2 +- .../functions/function_call_state_var_init.sol | 3 +-- .../function_inside_branch_modify_state_var.sol | 2 +- .../function_inside_branch_modify_state_var_3.sol | 4 ++-- .../functions/functions_bound_1_fail.sol | 2 +- .../functions/functions_external_4.sol | 2 +- .../functions/functions_identity_1_fail.sol | 2 +- .../functions/functions_identity_2_fail.sol | 2 +- .../functions_identity_as_tuple_fail.sol | 2 +- .../functions/functions_library_1_fail.sol | 2 +- .../functions/functions_storage_var_1_fail.sol | 2 +- .../functions/functions_storage_var_2_fail.sol | 2 +- .../functions/internal_call_inheritance.sol | 2 +- .../functions/internal_call_inheritance_2.sol | 2 +- ...nal_call_with_assertion_inheritance_1_fail.sol | 5 +++-- .../functions/library_constant.sol | 2 +- .../functions/this_external_call.sol | 3 +++ .../functions/this_external_call_return.sol | 3 +++ .../smtCheckerTests/functions/this_fake.sol | 2 +- .../smtCheckerTests/functions/this_state.sol | 4 +++- .../smtCheckerTests/inheritance/fallback.sol | 7 +++---- .../inheritance/fallback_receive.sol | 8 +++----- .../smtCheckerTests/inheritance/functions_1.sol | 7 +++---- .../smtCheckerTests/inheritance/functions_2.sol | 7 +++---- .../smtCheckerTests/inheritance/functions_3.sol | 15 ++++++--------- .../smtCheckerTests/inheritance/receive.sol | 7 +++---- .../inheritance/receive_fallback.sol | 8 +++----- .../invariants/state_machine_1_fail.sol | 2 +- .../smtCheckerTests/loops/do_while_1_fail.sol | 2 +- .../loops/do_while_break_2_fail.sol | 2 +- .../smtCheckerTests/loops/do_while_break_fail.sol | 2 +- .../smtCheckerTests/loops/for_1_break_fail.sol | 2 +- .../smtCheckerTests/loops/for_1_continue_fail.sol | 2 +- .../smtCheckerTests/loops/for_1_fail.sol | 2 +- .../smtCheckerTests/loops/for_loop_4.sol | 2 +- .../smtCheckerTests/loops/for_loop_5.sol | 2 +- .../for_loop_array_assignment_memory_memory.sol | 6 +++--- .../for_loop_array_assignment_memory_storage.sol | 4 ++-- .../for_loop_array_assignment_storage_memory.sol | 2 +- .../for_loop_array_assignment_storage_storage.sol | 4 ++-- .../smtCheckerTests/loops/while_1_break_fail.sol | 2 +- .../loops/while_1_continue_fail.sol | 2 +- .../smtCheckerTests/loops/while_1_fail.sol | 2 +- .../smtCheckerTests/loops/while_2_break_fail.sol | 2 +- .../while_loop_array_assignment_memory_memory.sol | 6 +++--- ...while_loop_array_assignment_memory_storage.sol | 4 ++-- ...hile_loop_array_assignment_storage_storage.sol | 4 ++-- .../smtCheckerTests/loops/while_loop_simple_1.sol | 2 +- .../smtCheckerTests/loops/while_loop_simple_3.sol | 2 +- .../smtCheckerTests/loops/while_loop_simple_5.sol | 2 +- .../loops/while_nested_break_fail.sol | 4 ++-- .../loops/while_nested_continue_fail.sol | 4 ++-- .../modifiers/modifier_code_after_placeholder.sol | 2 +- .../modifiers/modifier_control_flow.sol | 2 +- .../modifier_inside_branch_assignment.sol | 2 +- ...er_inside_branch_assignment_multi_branches.sol | 5 ++++- .../smtCheckerTests/modifiers/modifier_multi.sol | 2 +- .../modifiers/modifier_multi_functions.sol | 2 +- .../modifiers/modifier_multi_parameters.sol | 2 +- .../modifiers/modifier_parameter_copy.sol | 2 +- .../modifiers/modifier_same_local_variables.sol | 2 +- .../modifiers/modifier_two_placeholders.sol | 2 +- .../smtCheckerTests/operators/bitwise_and_int.sol | 2 +- .../operators/bitwise_and_rational.sol | 2 +- .../operators/bitwise_and_uint.sol | 6 +++--- .../smtCheckerTests/operators/compound_add.sol | 2 +- .../operators/compound_add_array_index.sol | 2 +- .../operators/compound_add_mapping.sol | 2 +- .../operators/compound_bitwise_and_1.sol | 2 +- .../operators/compound_bitwise_xor_1.sol | 2 +- .../smtCheckerTests/operators/compound_mul.sol | 2 +- .../operators/compound_mul_array_index.sol | 2 +- .../operators/compound_mul_mapping.sol | 2 +- .../smtCheckerTests/operators/compound_shl_1.sol | 2 +- .../smtCheckerTests/operators/compound_shr_1.sol | 2 +- .../smtCheckerTests/operators/compound_sub.sol | 2 +- .../operators/compound_sub_array_index.sol | 2 +- .../operators/compound_sub_mapping.sol | 2 +- .../operators/delete_array_index_2d.sol | 2 +- .../operators/delete_multid_array.sol | 2 +- .../smtCheckerTests/operators/delete_struct.sol | 2 +- .../smtCheckerTests/operators/unary_add.sol | 2 +- .../smtCheckerTests/operators/unary_add_array.sol | 2 +- .../operators/unary_add_mapping.sol | 2 +- .../smtCheckerTests/operators/unary_sub.sol | 2 +- .../smtCheckerTests/operators/unary_sub_array.sol | 2 +- .../operators/unary_sub_mapping.sol | 2 +- .../special/abi_decode_memory_v2_value_types.sol | 2 +- .../smtCheckerTests/special/abi_decode_simple.sol | 4 ++-- .../smtCheckerTests/special/blockhash.sol | 5 +++-- .../smtCheckerTests/special/difficulty.sol | 2 +- .../smtCheckerTests/special/gasleft.sol | 4 ++-- test/libsolidity/smtCheckerTests/special/many.sol | 13 ++++++++----- .../smtCheckerTests/special/msg_data.sol | 2 +- .../smtCheckerTests/special/msg_sender_fail_1.sol | 2 +- .../smtCheckerTests/special/msg_sig.sol | 2 +- test/libsolidity/smtCheckerTests/special/this.sol | 2 +- .../typecast/cast_different_size_1.sol | 6 +++--- .../typecast/cast_larger_2_fail.sol | 2 +- .../smtCheckerTests/typecast/cast_larger_3.sol | 4 ++-- .../smtCheckerTests/typecast/cast_smaller_2.sol | 2 +- .../smtCheckerTests/typecast/cast_smaller_3.sol | 2 +- .../smtCheckerTests/typecast/enum_from_uint.sol | 2 +- .../function_type_to_function_type_external.sol | 2 +- .../function_type_to_function_type_internal.sol | 6 ++---- ...tring_literal_to_fixed_bytes_function_call.sol | 4 ++-- .../string_literal_to_fixed_bytes_modifier.sol | 2 +- .../string_literal_to_fixed_bytes_return.sol | 2 +- ...string_literal_to_fixed_bytes_return_multi.sol | 2 +- .../smtCheckerTests/types/address_balance.sol | 2 +- .../smtCheckerTests/types/address_call.sol | 8 ++++---- .../types/address_delegatecall.sol | 8 ++++---- .../smtCheckerTests/types/address_staticcall.sol | 2 +- .../smtCheckerTests/types/address_transfer.sol | 2 +- .../smtCheckerTests/types/address_transfer_2.sol | 2 +- .../types/address_transfer_insufficient.sol | 2 +- .../types/array_aliasing_memory_1.sol | 2 +- .../types/array_aliasing_memory_2.sol | 2 +- .../types/array_aliasing_memory_3.sol | 2 +- .../types/array_aliasing_storage_1.sol | 15 +++++---------- .../types/array_aliasing_storage_2.sol | 3 +-- .../types/array_aliasing_storage_3.sol | 6 ++---- .../types/array_aliasing_storage_4.sol | 6 ++---- .../types/array_aliasing_storage_5.sol | 6 ++---- .../smtCheckerTests/types/array_branch_1d.sol | 2 +- .../smtCheckerTests/types/array_branch_2d.sol | 2 +- .../smtCheckerTests/types/array_branch_3d.sol | 2 +- .../types/array_dynamic_1_fail.sol | 2 +- .../types/array_dynamic_2_fail.sol | 2 +- .../types/array_dynamic_3_fail.sol | 2 +- .../types/array_dynamic_parameter_1_fail.sol | 2 +- .../types/array_mapping_aliasing_1.sol | 6 ++---- .../types/array_mapping_aliasing_2.sol | 3 +-- .../smtCheckerTests/types/array_static_1_fail.sol | 2 +- .../smtCheckerTests/types/array_static_2_fail.sol | 2 +- .../smtCheckerTests/types/array_static_3_fail.sol | 2 +- .../types/array_static_aliasing_memory_5.sol | 4 ++-- .../types/array_static_aliasing_storage_5.sol | 4 +--- .../types/array_static_mapping_aliasing_1.sol | 6 ++---- .../types/array_static_mapping_aliasing_2.sol | 3 +-- .../types/array_struct_array_branches_2d.sol | 2 +- .../smtCheckerTests/types/bool_simple_1.sol | 2 +- .../smtCheckerTests/types/bool_simple_2.sol | 2 +- .../smtCheckerTests/types/bytes_2_fail.sol | 2 +- .../smtCheckerTests/types/contract.sol | 2 +- .../smtCheckerTests/types/contract_2.sol | 2 +- .../types/contract_address_conversion.sol | 2 +- .../types/enum_explicit_values_2.sol | 2 +- .../smtCheckerTests/types/enum_in_library_2.sol | 2 +- .../smtCheckerTests/types/enum_in_struct.sol | 2 +- .../smtCheckerTests/types/enum_storage_eq.sol | 2 +- .../smtCheckerTests/types/fixed_bytes_1.sol | 4 ++-- .../smtCheckerTests/types/fixed_bytes_2.sol | 2 +- .../smtCheckerTests/types/mapping_1_fail.sol | 2 +- .../smtCheckerTests/types/mapping_2.sol | 2 +- .../smtCheckerTests/types/mapping_2d_1_fail.sol | 2 +- .../smtCheckerTests/types/mapping_3d_1_fail.sol | 2 +- .../smtCheckerTests/types/mapping_5.sol | 2 +- .../smtCheckerTests/types/mapping_aliasing_1.sol | 2 +- .../smtCheckerTests/types/mapping_aliasing_2.sol | 12 +++--------- .../types/mapping_as_local_var_1.sol | 4 ++-- .../types/mapping_as_parameter_1.sol | 2 +- .../types/mapping_equal_keys_2.sol | 2 +- .../smtCheckerTests/types/rational_large_1.sol | 2 +- .../types/storage_value_vars_1.sol | 2 +- .../types/storage_value_vars_2.sol | 2 +- .../types/storage_value_vars_4.sol | 2 +- .../smtCheckerTests/types/string_1.sol | 2 +- .../types/string_literal_assignment_1.sol | 2 +- .../types/string_literal_assignment_2.sol | 2 +- .../types/string_literal_assignment_3.sol | 2 +- .../types/string_literal_assignment_4.sol | 2 +- .../types/string_literal_assignment_5.sol | 2 +- .../types/string_literal_comparison_1.sol | 2 +- .../types/string_literal_comparison_2.sol | 4 ++-- .../types/struct_array_branches_1d.sol | 2 +- .../types/struct_array_branches_2d.sol | 2 +- .../types/struct_array_branches_3d.sol | 2 +- .../types/tuple_assignment_array_empty.sol | 2 +- .../types/tuple_assignment_compound.sol | 2 +- .../types/tuple_assignment_empty.sol | 2 +- .../types/tuple_declarations_function_empty.sol | 2 +- .../smtCheckerTests/types/tuple_function.sol | 4 ++-- .../smtCheckerTests/types/tuple_function_2.sol | 2 +- .../smtCheckerTests/types/tuple_function_3.sol | 4 ++-- .../verification_target/simple_assert.sol | 2 +- 215 files changed, 305 insertions(+), 325 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol index 78693bcbb91b..3312aede366e 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_1.sol @@ -11,10 +11,10 @@ contract C { } } // ---- +// Warning 6328: (119-157): Assertion violation happens here // Warning 8115: (76-80): Assertion checker does not yet support the type of this variable. // Warning 8115: (83-87): Assertion checker does not yet support the type of this variable. // Warning 7650: (126-132): Assertion checker does not yet support this expression. // Warning 8364: (126-128): Assertion checker does not yet implement type struct C.S storage ref // Warning 7650: (143-149): Assertion checker does not yet support this expression. // Warning 8364: (143-145): Assertion checker does not yet implement type struct C.S storage ref -// Warning 4661: (119-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol index 2bb5caf02251..c07ab4aadd67 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_1d_struct_array_2d_1.sol @@ -11,6 +11,7 @@ contract C { } } // ---- +// Warning 6328: (121-165): Assertion violation happens here // Warning 8115: (78-82): Assertion checker does not yet support the type of this variable. // Warning 8115: (85-89): Assertion checker does not yet support the type of this variable. // Warning 7650: (128-134): Assertion checker does not yet support this expression. @@ -19,4 +20,3 @@ contract C { // Warning 7650: (148-154): Assertion checker does not yet support this expression. // Warning 8364: (148-150): Assertion checker does not yet implement type struct C.S storage ref // Warning 9118: (148-157): Assertion checker does not yet implement this expression. -// Warning 4661: (121-165): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_basic.sol b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol index 60abe98db133..b5f4a07d3701 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_basic.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_basic.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning 4661: (153-176): Assertion violation happens here +// Warning 6328: (153-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol index 4d4469ae85fe..741ecff3d062 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_2_fail.sol @@ -14,6 +14,6 @@ contract C { } } // ---- -// Warning 4661: (198-224): Assertion violation happens here -// Warning 4661: (228-254): Assertion violation happens here -// Warning 4661: (258-281): Assertion violation happens here +// Warning 6328: (198-224): Assertion violation happens here +// Warning 6328: (228-254): Assertion violation happens here +// Warning 6328: (258-281): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol index afdf1a8d832c..eff6b2fbd941 100644 --- a/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/length_same_after_assignment_3_fail.sol @@ -16,7 +16,7 @@ contract C { } } // ---- -// Warning 4661: (222-248): Assertion violation happens here -// Warning 4661: (252-278): Assertion violation happens here -// Warning 4661: (282-305): Assertion violation happens here -// Warning 4661: (309-335): Assertion violation happens here +// Warning 6328: (222-248): Assertion violation happens here +// Warning 6328: (252-278): Assertion violation happens here +// Warning 6328: (282-305): Assertion violation happens here +// Warning 6328: (309-335): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol index eb752828a96f..75e51df74d59 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_1_unsafe.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning 2529: (82-89): Empty array "pop" detected here. +// Warning 2529: (82-89): Empty array "pop" detected here diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol index 2795dfe51b8e..5d4bd3a97b8c 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_2d_unsafe.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 2529: (111-121): Empty array "pop" detected here. +// Warning 2529: (111-121): Empty array "pop" detected here diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol index 1564a2328a93..ed1f8fc659db 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning 2529: (150-157): Empty array "pop" detected here. +// Warning 2529: (150-157): Empty array "pop" detected here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol index 20adaca824c7..c409a0e098b8 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_2d_arg_1_unsafe.sol @@ -10,5 +10,5 @@ contract C { } } // ---- +// Warning 6328: (150-184): Assertion violation happens here // Warning 4144: (162-177): Underflow (resulting value less than 0) happens here -// Warning 4661: (150-184): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol index 113ff8fcae19..8192f673d05e 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol @@ -12,5 +12,5 @@ contract C { } } // ---- +// Warning 6328: (205-239): Assertion violation happens here // Warning 4144: (217-232): Underflow (resulting value less than 0) happens here -// Warning 4661: (205-239): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol index aa491d91cb49..89d89c108b99 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_aliasing.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// Warning 4661: (167-188): Assertion violation happens here +// Warning 6328: (167-188): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol index 5a996d875b95..61bdb3d5a15f 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_unsafe_length.sol @@ -18,6 +18,6 @@ contract C { } } // ---- -// Warning 4661: (193-217): Assertion violation happens here -// Warning 4661: (309-333): Assertion violation happens here -// Warning 4661: (419-436): Assertion violation happens here +// Warning 6328: (193-217): Assertion violation happens here +// Warning 6328: (309-333): Assertion violation happens here +// Warning 6328: (419-436): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol index 524baad380dd..ac278a22a287 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_2d_unsafe.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (111-144): Assertion violation happens here +// Warning 6328: (111-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol index b90b0c8726f8..504d5a95c4f1 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_zero_unsafe.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning 4661: (94-124): Assertion violation happens here +// Warning 6328: (94-124): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol index 1e3eb573360a..186a2e1a80e5 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- +// Warning 6328: (227-236): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (227-236): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol index 3bca1c268e5b..1dd387cc9439 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_inside_branch.sol @@ -17,6 +17,6 @@ contract c { } } // ---- +// Warning 6328: (202-218): Assertion violation happens here +// Warning 6328: (242-252): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (202-218): Assertion violation happens here -// Warning 4661: (242-252): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol index a4d60dd4928b..32fbccdd7c22 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_and_need_both_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- +// Warning 6328: (225-235): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol index c9c24a2fbab2..edada1444cb2 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- +// Warning 6328: (225-235): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol index 39d6f28cfe6d..eb54e2236d7e 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol @@ -24,5 +24,5 @@ contract c { } } // ---- +// Warning 6328: (360-370): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (360-370): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol index 9b26f8a1676c..1a055a9d7da0 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_need_both_fail.sol @@ -15,5 +15,5 @@ contract c { } } // ---- +// Warning 6328: (225-235): Assertion violation happens here // Warning 2661: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (225-235): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol index 6d5f7eaf499c..37adaa0d3f60 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_1.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (159-173): Assertion violation happens here +// Warning 6328: (159-173): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol index 951e168f8af7..44124a100f0f 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (159-173): Assertion violation happens here +// Warning 6328: (159-173): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol index b197c543277d..2369aa5a9be6 100644 --- a/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol +++ b/test/libsolidity/smtCheckerTests/control_flow/ways_to_merge_variables_3.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (161-175): Assertion violation happens here +// Warning 6328: (161-175): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external.sol b/test/libsolidity/smtCheckerTests/external_calls/external.sol index 9fbde057a7e5..7e14fa9278ed 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external.sol @@ -17,4 +17,4 @@ contract C { } } // ---- -// Warning 4661: (200-214): Assertion violation happens here +// Warning 6328: (200-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol index 46fae86b6af1..4b1ac0f33498 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol @@ -42,6 +42,8 @@ contract C { } } // ---- +// Warning 6328: (459-473): Assertion violation happens here +// Warning 6328: (477-503): Assertion violation happens here // Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives. // Warning 4661: (452-466): Assertion violation happens here // Warning 4661: (470-496): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol index 39e9f0749930..bc1673147c24 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol @@ -34,6 +34,8 @@ contract C { } } // ---- +// Warning 6328: (388-402): Assertion violation happens here +// Warning 6328: (406-432): Assertion violation happens here // Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives. // Warning 4661: (381-395): Assertion violation happens here // Warning 4661: (399-425): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol b/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol index d4d2489b05cc..38b588463572 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_inc.sol @@ -18,5 +18,5 @@ contract C { } } // ---- +// Warning 6328: (189-203): Assertion violation happens here // Warning 2661: (146-149): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (189-203): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol b/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol index 2787b41588c9..e96f8b279fbf 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_inc1_inc2.sol @@ -25,4 +25,4 @@ contract C { } } // ---- -// Warning 4661: (286-303): Assertion violation happens here +// Warning 6328: (286-303): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol b/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol index 247c45f32f7d..a6e4917ccc7c 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_single_inc.sol @@ -23,4 +23,4 @@ contract C { } } // ---- -// Warning 4661: (256-273): Assertion violation happens here +// Warning 6328: (256-273): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol b/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol index 08f3c7b76ee2..22e9d53f3b00 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/mutex_f_no_guard.sol @@ -27,4 +27,4 @@ contract C { } } // ---- -// Warning 4661: (307-321): Assertion violation happens here +// Warning 6328: (307-321): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol b/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol index f91a6b6634dd..ba8b2638eedf 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_call_state_var_init.sol @@ -9,5 +9,4 @@ contract C { } } // ---- -// Warning 4661: (116-132): Assertion violation happens here -// Warning 4661: (116-132): Assertion violation happens here +// Warning 6328: (116-132): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol index 6848b9ae7dc7..db3e7918c7d7 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning 4661: (209-223): Assertion violation happens here +// Warning 6328: (209-223): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol index 5c1fd38564a4..9a1aac540475 100644 --- a/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol @@ -24,5 +24,5 @@ contract C } // ---- -// Warning 4661: (209-223): Assertion violation happens here -// Warning 4661: (321-335): Assertion violation happens here +// Warning 6328: (209-223): Assertion violation happens here +// Warning 6328: (321-335): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol index 64bbcddbc7fd..5c4d16cfd945 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol @@ -18,4 +18,4 @@ contract C } } // ---- -// Warning 4661: (261-277): Assertion violation happens here +// Warning 6328: (261-277): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol index 02813f1d7adf..c75214b4fafe 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_4.sol @@ -16,4 +16,4 @@ contract D } } // ---- -// Warning 4661: (191-206): Assertion violation happens here +// Warning 6328: (191-206): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol index 6bdc8a0e88c9..4931b8fec3c9 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol @@ -12,4 +12,4 @@ contract C } // ---- -// Warning 4661: (161-174): Assertion violation happens here +// Warning 6328: (161-174): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol index 95e06b4c392a..29b422c7dce2 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol @@ -16,4 +16,4 @@ contract C } // ---- -// Warning 4661: (229-242): Assertion violation happens here +// Warning 6328: (229-242): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol index b057accde265..87a027a9cac1 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol @@ -12,4 +12,4 @@ contract C } // ---- -// Warning 4661: (163-176): Assertion violation happens here +// Warning 6328: (163-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol index 7182890f3474..3c35898a231f 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol @@ -17,5 +17,5 @@ contract C } } // ---- +// Warning 6328: (245-261): Assertion violation happens here // Warning 8364: (228-229): Assertion checker does not yet implement type type(library L) -// Warning 4661: (245-261): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol index d63f583a0eac..93fa49176e7c 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol @@ -13,4 +13,4 @@ contract C } // ---- -// Warning 4661: (144-157): Assertion violation happens here +// Warning 6328: (144-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol index 84319b4adb17..5a79201223ca 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol @@ -14,4 +14,4 @@ contract C } // ---- -// Warning 4661: (152-165): Assertion violation happens here +// Warning 6328: (152-165): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol index c395525a3bf0..fe2e882a0989 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance.sol @@ -17,4 +17,4 @@ contract A is B { } } // ---- -// Warning 4661: (254-268): Assertion violation happens here +// Warning 6328: (254-268): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol index af7d6d28fdcf..c57fd1073af3 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_inheritance_2.sol @@ -21,4 +21,4 @@ contract A is B { } } // ---- -// Warning 4661: (274-288): Assertion violation happens here +// Warning 6328: (274-288): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol index 3fd4a7477b9d..a4550dc614ba 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol @@ -17,9 +17,10 @@ contract C is A { } } // ---- -// Warning 4661: (82-96): Assertion violation happens here +// Warning 6328: (82-96): Assertion violation happens here +// Warning 6328: (155-169): Assertion violation happens here +// Warning 6328: (187-201): Assertion violation happens here // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here -// Warning 4661: (82-96): Assertion violation happens here // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here // Warning 4661: (148-162): Assertion violation happens here // Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/library_constant.sol b/test/libsolidity/smtCheckerTests/functions/library_constant.sol index 98518ee0b9dd..ee521a1810a1 100644 --- a/test/libsolidity/smtCheckerTests/functions/library_constant.sol +++ b/test/libsolidity/smtCheckerTests/functions/library_constant.sol @@ -19,7 +19,7 @@ contract C { } } // ---- -// Warning 4661: (136-155): Assertion violation happens here +// Warning 6328: (136-155): Assertion violation happens here // Warning 2661: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 8364: (300-302): Assertion checker does not yet implement type type(library l1) // Warning 2661: (229-234): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/this_external_call.sol b/test/libsolidity/smtCheckerTests/functions/this_external_call.sol index d7762fbea855..384281e8ed2d 100644 --- a/test/libsolidity/smtCheckerTests/functions/this_external_call.sol +++ b/test/libsolidity/smtCheckerTests/functions/this_external_call.sol @@ -9,6 +9,9 @@ contract C function g(uint y) public { require(y < 1000); this.f(y); + // Fails as false positive because CHC does not support `this`. assert(x < 1000); } } +// ---- +// Warning 6328: (227-243): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/this_external_call_return.sol b/test/libsolidity/smtCheckerTests/functions/this_external_call_return.sol index 4226bd68a58e..b43b95e7910d 100644 --- a/test/libsolidity/smtCheckerTests/functions/this_external_call_return.sol +++ b/test/libsolidity/smtCheckerTests/functions/this_external_call_return.sol @@ -10,6 +10,9 @@ contract C function g(uint y) public { require(y < 1000); uint z = this.f(y); + // Fails as false positive because CHC does not support `this`. assert(z < 1000); } } +// ---- +// Warning 6328: (263-279): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/this_fake.sol b/test/libsolidity/smtCheckerTests/functions/this_fake.sol index 057c95fb9110..2227e9b3fdf0 100644 --- a/test/libsolidity/smtCheckerTests/functions/this_fake.sol +++ b/test/libsolidity/smtCheckerTests/functions/this_fake.sol @@ -21,4 +21,4 @@ contract C } // ---- // Warning 2319: (160-166): This declaration shadows a builtin symbol. -// Warning 4661: (268-282): Assertion violation happens here +// Warning 6328: (268-282): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/this_state.sol b/test/libsolidity/smtCheckerTests/functions/this_state.sol index 6af349473b97..b21c71972e4a 100644 --- a/test/libsolidity/smtCheckerTests/functions/this_state.sol +++ b/test/libsolidity/smtCheckerTests/functions/this_state.sol @@ -6,10 +6,12 @@ contract C function g() public { x = 0; this.h(); - // Function call is inlined. + // Fails as false positive because CHC does not support `this`. assert(x == 2); } function h() public { x = 2; } } +// ---- +// Warning 6328: (186-200): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/fallback.sol b/test/libsolidity/smtCheckerTests/inheritance/fallback.sol index 76d1722d520d..1513f622f549 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/fallback.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/fallback.sol @@ -21,7 +21,6 @@ contract B is A { } } // ---- -// Warning 4661: (122-136): Assertion violation happens here -// Warning 4661: (171-185): Assertion violation happens here -// Warning 4661: (288-302): Assertion violation happens here -// Warning 4661: (171-185): Assertion violation happens here +// Warning 6328: (122-136): Assertion violation happens here +// Warning 6328: (171-185): Assertion violation happens here +// Warning 6328: (288-302): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol b/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol index cda56f068f2a..0fecccfb212e 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/fallback_receive.sol @@ -21,8 +21,6 @@ contract B is A { } } // ---- -// Warning 4661: (114-128): Assertion violation happens here -// Warning 4661: (163-177): Assertion violation happens here -// Warning 4661: (289-303): Assertion violation happens here -// Warning 4661: (114-128): Assertion violation happens here -// Warning 4661: (163-177): Assertion violation happens here +// Warning 6328: (114-128): Assertion violation happens here +// Warning 6328: (163-177): Assertion violation happens here +// Warning 6328: (289-303): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol index cbfac8b9340c..d8af4f292520 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_1.sol @@ -19,7 +19,6 @@ contract B is A { } } // ---- -// Warning 4661: (121-135): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here -// Warning 4661: (276-290): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here +// Warning 6328: (121-135): Assertion violation happens here +// Warning 6328: (170-184): Assertion violation happens here +// Warning 6328: (276-290): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol index a18adee825ff..e4b7d34b5318 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_2.sol @@ -21,7 +21,6 @@ contract B is A { } } // ---- -// Warning 4661: (121-135): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here -// Warning 4661: (286-300): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here +// Warning 6328: (121-135): Assertion violation happens here +// Warning 6328: (170-184): Assertion violation happens here +// Warning 6328: (286-300): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol b/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol index 3137dd18f7ad..6e8a4c2af65f 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/functions_3.sol @@ -36,12 +36,9 @@ contract C is B { } } // ---- -// Warning 4661: (121-135): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here -// Warning 4661: (296-310): Assertion violation happens here -// Warning 4661: (345-359): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here -// Warning 4661: (468-482): Assertion violation happens here -// Warning 4661: (517-531): Assertion violation happens here -// Warning 4661: (345-359): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here +// Warning 6328: (121-135): Assertion violation happens here +// Warning 6328: (170-184): Assertion violation happens here +// Warning 6328: (296-310): Assertion violation happens here +// Warning 6328: (345-359): Assertion violation happens here +// Warning 6328: (468-482): Assertion violation happens here +// Warning 6328: (517-531): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/receive.sol b/test/libsolidity/smtCheckerTests/inheritance/receive.sol index 88f50081d2eb..8a90512600e2 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/receive.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/receive.sol @@ -21,7 +21,6 @@ contract B is A { } } // ---- -// Warning 4661: (128-142): Assertion violation happens here -// Warning 4661: (177-191): Assertion violation happens here -// Warning 4661: (300-314): Assertion violation happens here -// Warning 4661: (177-191): Assertion violation happens here +// Warning 6328: (128-142): Assertion violation happens here +// Warning 6328: (177-191): Assertion violation happens here +// Warning 6328: (300-314): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol b/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol index f93e47abe631..d66d9354b8a2 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/receive_fallback.sol @@ -21,8 +21,6 @@ contract B is A { } } // ---- -// Warning 4661: (120-134): Assertion violation happens here -// Warning 4661: (169-183): Assertion violation happens here -// Warning 4661: (288-302): Assertion violation happens here -// Warning 4661: (120-134): Assertion violation happens here -// Warning 4661: (169-183): Assertion violation happens here +// Warning 6328: (120-134): Assertion violation happens here +// Warning 6328: (169-183): Assertion violation happens here +// Warning 6328: (288-302): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol b/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol index d2f492233043..65a9ec4079d7 100644 --- a/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol @@ -31,4 +31,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (311-324): Assertion violation happens here +// Warning 6328: (311-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol index f44013b5371c..b4d819887e98 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_1_fail.sol @@ -14,5 +14,5 @@ contract C // ==== // SMTSolvers: z3 // ---- +// Warning 6328: (179-193): Assertion violation happens here // Warning 2661: (150-155): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (179-193): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol index 2a80acd6bf56..dd57c91c5626 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break_2_fail.sol @@ -19,4 +19,4 @@ contract C { // ---- // Warning 5740: (128-133): Unreachable code. // Warning 5740: (147-151): Unreachable code. -// Warning 4661: (180-194): Assertion violation happens here +// Warning 6328: (180-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol index 3427a32aa2b0..e1c170606b67 100644 --- a/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/do_while_break_fail.sol @@ -15,4 +15,4 @@ contract C { // ---- // Warning 5740: (104-109): Unreachable code. // Warning 5740: (122-128): Unreachable code. -// Warning 4661: (133-147): Assertion violation happens here +// Warning 6328: (133-147): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol index 4c4aef38132d..77c1800c2565 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_break_fail.sol @@ -17,4 +17,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (201-216): Assertion violation happens here +// Warning 6328: (201-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol index 53e0e4ff53e7..bb5ec1ae3a13 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_continue_fail.sol @@ -14,4 +14,4 @@ contract C // SMTSolvers: z3 // ---- // Warning 5667: (66-72): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (142-156): Assertion violation happens here +// Warning 6328: (142-156): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol index 7d8692f6191b..de7fdf973e98 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol @@ -14,5 +14,5 @@ contract C // ==== // SMTSolvers: z3 // ---- +// Warning 6328: (189-203): Assertion violation happens here // Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (189-203): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol index 7030704d85df..f9cf1c50f3ad 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_4.sol @@ -9,4 +9,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (136-150): Assertion violation happens here +// Warning 6328: (136-150): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol index edef7a326d9b..26a9f04076de 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_5.sol @@ -11,4 +11,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (167-181): Assertion violation happens here +// Warning 6328: (167-181): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol index 61136c817204..1228e6d3d18e 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_memory.sol @@ -15,6 +15,6 @@ contract LoopFor2 { } } // ---- -// Warning 4661: (281-301): Assertion violation happens here -// Warning 4661: (305-324): Assertion violation happens here -// Warning 4661: (328-347): Assertion violation happens here +// Warning 6328: (281-301): Assertion violation happens here +// Warning 6328: (305-324): Assertion violation happens here +// Warning 6328: (328-347): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol index e66672c1522b..76cfa0569247 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_memory_storage.sol @@ -19,5 +19,5 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (274-294): Assertion violation happens here -// Warning 4661: (321-340): Assertion violation happens here +// Warning 6328: (274-294): Assertion violation happens here +// Warning 6328: (321-340): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol index 7b6ca1e68fd1..7f859ef82e84 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol @@ -19,4 +19,4 @@ contract LoopFor2 { } } // ---- -// Warning 4661: (363-382): Assertion violation happens here +// Warning 6328: (363-382): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index 0796baa78bec..b8cf6aef4d6a 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,5 +19,5 @@ contract LoopFor2 { } } // ---- -// Warning 4661: (341-360): Assertion violation happens here -// Warning 4661: (364-383): Assertion violation happens here +// Warning 6328: (341-360): Assertion violation happens here +// Warning 6328: (364-383): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol index 3803ea4cd90f..aafab6942f81 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_break_fail.sol @@ -18,4 +18,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (218-233): Assertion violation happens here +// Warning 6328: (218-233): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol index b1d8cb99f1fd..7bb08f68f0eb 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_continue_fail.sol @@ -21,4 +21,4 @@ contract C // SMTSolvers: z3 // ---- // Warning 5740: (169-176): Unreachable code. -// Warning 4661: (227-242): Assertion violation happens here +// Warning 6328: (227-242): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol index c108d4ce64ad..d5d3f78aca81 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_1_fail.sol @@ -13,4 +13,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (139-153): Assertion violation happens here +// Warning 6328: (139-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol index 4736ede49bb6..f203f38cb9a4 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol @@ -15,4 +15,4 @@ contract C // SMTSolvers: z3 // ---- // Warning 5740: (120-123): Unreachable code. -// Warning 4661: (131-145): Assertion violation happens here +// Warning 6328: (131-145): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol index b267ed373a56..ba6a6a8d29f0 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol @@ -19,6 +19,6 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (281-301): Assertion violation happens here -// Warning 4661: (305-324): Assertion violation happens here -// Warning 4661: (328-347): Assertion violation happens here +// Warning 6328: (281-301): Assertion violation happens here +// Warning 6328: (305-324): Assertion violation happens here +// Warning 6328: (328-347): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol index 20e1359b9f94..b977ed326807 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol @@ -23,5 +23,5 @@ contract LoopFor2 { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (362-382): Assertion violation happens here -// Warning 4661: (409-428): Assertion violation happens here +// Warning 6328: (362-382): Assertion violation happens here +// Warning 6328: (409-428): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol index b64a43b9ae75..de397d4d3bc1 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol @@ -21,5 +21,5 @@ contract LoopFor2 { } } // ---- -// Warning 4661: (320-339): Assertion violation happens here -// Warning 4661: (343-362): Assertion violation happens here +// Warning 6328: (320-339): Assertion violation happens here +// Warning 6328: (343-362): Assertion violation happens here. diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol index 29da40e6d6e8..026de24416d8 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_1.sol @@ -12,4 +12,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (194-208): Assertion violation happens here +// Warning 6328: (194-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol index cb06bf44adc8..7e11d2be1f0f 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_3.sol @@ -10,4 +10,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (187-201): Assertion violation happens here +// Warning 6328: (187-201): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol index 492a54839289..f2b8238eb023 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_simple_5.sol @@ -12,4 +12,4 @@ contract C { // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (224-238): Assertion violation happens here +// Warning 6328: (224-238): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol index 96bf7c534120..4b2186d13fd7 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_nested_break_fail.sol @@ -29,5 +29,5 @@ contract C } } // ---- -// Warning 4661: (329-344): Assertion violation happens here -// Warning 4661: (380-395): Assertion violation happens here +// Warning 6328: (329-344): Assertion violation happens here +// Warning 6328: (380-395): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol b/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol index d9d6bacfc05e..4e5faf90683f 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_nested_continue_fail.sol @@ -27,5 +27,5 @@ contract C } } // ---- -// Warning 4661: (323-338): Assertion violation happens here -// Warning 4661: (362-377): Assertion violation happens here +// Warning 6328: (323-338): Assertion violation happens here +// Warning 6328: (362-377): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol index 2633789a342d..5a2dbbcbae85 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_code_after_placeholder.sol @@ -21,5 +21,5 @@ contract C } } // ---- +// Warning 6328: (136-149): Assertion violation happens here // Warning 2661: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (136-149): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol index 3ee3933fe822..503d276e37e8 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_control_flow.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning 4661: (144-157): Assertion violation happens here +// Warning 6328: (144-157): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol index d31b515653a4..13679bfa49d6 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment.sol @@ -20,4 +20,4 @@ contract C { } } // ---- -// Warning 4661: (287-300): Assertion violation happens here +// Warning 6328: (287-300): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol index 214dbd5f5985..d1ef8639e003 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_multi_branches.sol @@ -25,6 +25,8 @@ contract C { x = y; if (y > 1) { f(); + // This now fails as a false positive because + // CHC does not propagate msg.sender throughout predicates. assert(x == y + 1); } // Fails for {y = 0, x = 0}. @@ -32,4 +34,5 @@ contract C { } } // ---- -// Warning 4661: (461-475): Assertion violation happens here +// Warning 6328: (516-534): Assertion violation happens here +// Warning 6328: (573-587): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol index d7134c2e9916..49fcac03b3d5 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi.sol @@ -26,4 +26,4 @@ contract C } } // ---- -// Warning 4661: (170-183): Assertion violation happens here +// Warning 6328: (170-183): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol index 3315656decae..185dd7ef7ad9 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_functions.sol @@ -22,4 +22,4 @@ contract C } } // ---- -// Warning 4661: (311-324): Assertion violation happens here +// Warning 6328: (311-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol index bf5c6201dacd..7f9c544b489c 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_multi_parameters.sol @@ -13,4 +13,4 @@ contract C } } // ---- -// Warning 4661: (164-177): Assertion violation happens here +// Warning 6328: (164-177): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol index 0546c4ac9420..bbf21a290eef 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_parameter_copy.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (128-142): Assertion violation happens here +// Warning 6328: (128-142): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol index 39927e3454af..ce69706f0d4b 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_same_local_variables.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (121-135): Assertion violation happens here +// Warning 6328: (121-135): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol b/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol index fba4d2a2cc63..3e2a645fc694 100644 --- a/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol +++ b/test/libsolidity/smtCheckerTests/modifiers/modifier_two_placeholders.sol @@ -23,4 +23,4 @@ contract C } } // ---- -// Warning 4661: (156-170): Assertion violation happens here +// Warning 6328: (156-170): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol index 9a14cd2431f1..51bd01e5c478 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_int.sol @@ -15,4 +15,4 @@ contract C { } } // ---- -// Warning 4661: (104-122): Assertion violation happens here +// Warning 6328: (104-122): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol index 3171240c0528..79e63a8d7f08 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_rational.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (76-94): Assertion violation happens here +// Warning 6328: (76-94): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol index 0f70434a026d..dbb3ab473004 100644 --- a/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol +++ b/test/libsolidity/smtCheckerTests/operators/bitwise_and_uint.sol @@ -13,6 +13,6 @@ contract C { } } // ---- -// Warning 4661: (107-125): Assertion violation happens here -// Warning 4661: (180-203): Assertion violation happens here -// Warning 4661: (207-230): Assertion violation happens here +// Warning 6328: (107-125): Assertion violation happens here +// Warning 6328: (180-203): Assertion violation happens here +// Warning 6328: (207-230): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add.sol b/test/libsolidity/smtCheckerTests/operators/compound_add.sol index c031ea6a0d32..43219d9c3324 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (151-166): Assertion violation happens here +// Warning 6328: (151-166): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol index 4d63e46bf1d8..5c989e31ee71 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (192-214): Assertion violation happens here +// Warning 6328: (192-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol index 70903e8ef39d..bf48a540a80f 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_add_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (198-218): Assertion violation happens here +// Warning 6328: (198-218): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol index b2fba57692f4..8ca1152e3512 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_and_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- +// Warning 6328: (116-130): Assertion violation happens here // Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol index 74466c9fd917..2e07a32f737d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_xor_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- +// Warning 6328: (116-130): Assertion violation happens here // Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator. -// Warning 4661: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul.sol index 7bc2d2b8875d..6723e5304c5f 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (150-164): Assertion violation happens here +// Warning 6328: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol index 4836db3431c7..663f0702baaf 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (191-212): Assertion violation happens here +// Warning 6328: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol index a933665ccd75..cdfc7500a9c4 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_mul_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (197-216): Assertion violation happens here +// Warning 6328: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol index cb5a8658338f..964c02b46a2e 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_shl_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- +// Warning 6328: (123-136): Assertion violation happens here // Warning 9149: (112-119): Assertion checker does not yet implement this assignment operator. -// Warning 4661: (123-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol index c415f9baf3bc..a42a1e3e675d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_shr_1.sol @@ -9,5 +9,5 @@ contract C { } } // ---- +// Warning 6328: (117-130): Assertion violation happens here // Warning 9149: (106-113): Assertion checker does not yet implement this assignment operator. -// Warning 4661: (117-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub.sol index 12149f345e8d..609dedd6909a 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (150-164): Assertion violation happens here +// Warning 6328: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol index 6f32145ed573..39ebd357bf1d 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub_array_index.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (191-212): Assertion violation happens here +// Warning 6328: (191-212): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol b/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol index 0a502f05d470..883105dd5800 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_sub_mapping.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (197-216): Assertion violation happens here +// Warning 6328: (197-216): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol index 2a5910c34996..5627953eb738 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol @@ -17,4 +17,4 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning 4661: (191-211): Assertion violation happens here +// Warning 6328: (191-211): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol index 3554f78882bb..91527b8c7f07 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol @@ -38,5 +38,5 @@ contract C { } } // ---- +// Warning 6328: (617-637): Assertion violation happens here. // Warning 4661: (372-392): Assertion violation happens here -// Warning 4661: (617-637): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol index e55601219cbb..5b7be5add4a7 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_struct.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_struct.sol @@ -18,6 +18,7 @@ contract C } // ---- // Warning 2018: (73-192): Function state mutability can be restricted to pure +// Warning 6328: (172-188): Assertion violation happens here // Warning 8115: (103-113): Assertion checker does not yet support the type of this variable. // Warning 7650: (117-120): Assertion checker does not yet support this expression. // Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S memory @@ -28,4 +29,3 @@ contract C // Warning 2683: (158-168): Assertion checker does not yet implement "delete" for this expression. // Warning 7650: (179-182): Assertion checker does not yet support this expression. // Warning 8364: (179-180): Assertion checker does not yet implement type struct C.S memory -// Warning 4661: (172-188): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add.sol b/test/libsolidity/smtCheckerTests/operators/unary_add.sol index 606b396dbddc..1a1ae611d678 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning 4661: (194-207): Assertion violation happens here +// Warning 6328: (194-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol b/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol index 6d08f3596bbc..96e43ff8f544 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add_array.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning 4661: (240-253): Assertion violation happens here +// Warning 6328: (240-253): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol b/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol index 925b74187780..cdf4cbdbd706 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning 4661: (244-257): Assertion violation happens here +// Warning 6328: (244-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub.sol index 9689d795a7b6..dba43ac8733e 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning 4661: (194-207): Assertion violation happens here +// Warning 6328: (194-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol index 82f01475b0e7..73393df91264 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning 4661: (240-253): Assertion violation happens here +// Warning 6328: (240-253): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol b/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol index c1735a6fa99e..22191a935c09 100644 --- a/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol +++ b/test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol @@ -15,4 +15,4 @@ contract C } } // ---- -// Warning 4661: (244-257): Assertion violation happens here +// Warning 6328: (244-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol index c1db0e0573a0..066a861e4d09 100644 --- a/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol +++ b/test/libsolidity/smtCheckerTests/special/abi_decode_memory_v2_value_types.sol @@ -12,8 +12,8 @@ contract C { // ---- // Warning 2072: (125-132): Unused local variable. // Warning 2072: (183-190): Unused local variable. +// Warning 6328: (303-319): Assertion violation happens here // Warning 8364: (136-139): Assertion checker does not yet implement type abi // Warning 4588: (136-167): Assertion checker does not yet implement this type of function call. // Warning 8364: (194-197): Assertion checker does not yet implement type abi // Warning 4588: (194-225): Assertion checker does not yet implement this type of function call. -// Warning 4661: (303-319): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol b/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol index 73e91f2689d1..1715fa4e0293 100644 --- a/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol +++ b/test/libsolidity/smtCheckerTests/special/abi_decode_simple.sol @@ -14,11 +14,11 @@ contract C { // Warning 2072: (100-104): Unused local variable. // Warning 2072: (161-171): Unused local variable. // Warning 2072: (173-177): Unused local variable. +// Warning 6328: (296-312): Assertion violation happens here +// Warning 6328: (315-331): Assertion violation happens here // Warning 8364: (108-111): Assertion checker does not yet implement type abi // Warning 8364: (142-143): Assertion checker does not yet implement type type(contract C) // Warning 4588: (108-145): Assertion checker does not yet implement this type of function call. // Warning 8364: (181-184): Assertion checker does not yet implement type abi // Warning 8364: (215-216): Assertion checker does not yet implement type type(contract C) // Warning 4588: (181-218): Assertion checker does not yet implement this type of function call. -// Warning 4661: (296-312): Assertion violation happens here -// Warning 4661: (315-331): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/blockhash.sol b/test/libsolidity/smtCheckerTests/special/blockhash.sol index 920bdfc46433..d08e056e7f31 100644 --- a/test/libsolidity/smtCheckerTests/special/blockhash.sol +++ b/test/libsolidity/smtCheckerTests/special/blockhash.sol @@ -10,5 +10,6 @@ contract C } } // ---- -// Warning 4661: (85-109): Assertion violation happens here -// Warning 4661: (113-137): Assertion violation happens here +// Warning 6328: (85-109): Assertion violation happens here +// Warning 6328: (113-137): Assertion violation happens here +// Warning 6328: (155-191): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/difficulty.sol b/test/libsolidity/smtCheckerTests/special/difficulty.sol index 4e7917504d16..90e43e2043b1 100644 --- a/test/libsolidity/smtCheckerTests/special/difficulty.sol +++ b/test/libsolidity/smtCheckerTests/special/difficulty.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (91-129): Assertion violation happens here +// Warning 6328: (91-129): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/gasleft.sol b/test/libsolidity/smtCheckerTests/special/gasleft.sol index 8f95f1e6736c..0b14ee4e7912 100644 --- a/test/libsolidity/smtCheckerTests/special/gasleft.sol +++ b/test/libsolidity/smtCheckerTests/special/gasleft.sol @@ -10,5 +10,5 @@ contract C } } // ---- -// Warning 4661: (76-97): Assertion violation happens here -// Warning 4661: (123-144): Assertion violation happens here +// Warning 6328: (76-97): Assertion violation happens here +// Warning 6328: (123-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol index 9e40708f01ab..53d8cd45d0df 100644 --- a/test/libsolidity/smtCheckerTests/special/many.sol +++ b/test/libsolidity/smtCheckerTests/special/many.sol @@ -15,11 +15,14 @@ contract C } } // ---- -// Warning 4661: (79-115): Assertion violation happens here -// Warning 4661: (119-161): Assertion violation happens here -// Warning 4661: (165-204): Assertion violation happens here -// Warning 4661: (208-240): Assertion violation happens here -// Warning 4661: (244-275): Assertion violation happens here +// Warning 6328: (79-115): Assertion violation happens here +// Warning 6328: (119-161): Assertion violation happens here +// Warning 6328: (165-204): Assertion violation happens here +// Warning 6328: (208-240): Assertion violation happens here +// Warning 6328: (244-275): Assertion violation happens here +// Warning 6328: (304-332): Assertion violation happens here +// Warning 6328: (336-352): Assertion violation happens here +// Warning 6328: (356-379): Assertion violation happens here // Warning 2661: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 4661: (304-332): Assertion violation happens here // Warning 4661: (336-364): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_data.sol b/test/libsolidity/smtCheckerTests/special/msg_data.sol index f1059fd2b472..3936af6dd32b 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_data.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_data.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (79-106): Assertion violation happens here +// Warning 6328: (79-106): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol index 055ca5c93951..91aa8d2c93cd 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (155-178): Assertion violation happens here +// Warning 6328: (155-178): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/msg_sig.sol b/test/libsolidity/smtCheckerTests/special/msg_sig.sol index 141c54f42fb7..e3c86f5aa401 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_sig.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_sig.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (79-108): Assertion violation happens here +// Warning 6328: (79-108): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/this.sol b/test/libsolidity/smtCheckerTests/special/this.sol index 4d1ade2f5fbc..59c5f2d96fbd 100644 --- a/test/libsolidity/smtCheckerTests/special/this.sol +++ b/test/libsolidity/smtCheckerTests/special/this.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (85-111): Assertion violation happens here +// Warning 6328: (85-111): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol b/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol index e31a01ada865..bde664225da9 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_different_size_1.sol @@ -18,9 +18,9 @@ contract C } } // ---- +// Warning 6328: (280-303): Assertion violation happens here +// Warning 6328: (414-431): Assertion violation happens here +// Warning 6328: (542-559): Assertion violation happens here // Warning 5084: (186-195): Type conversion is not yet fully supported and might yield false positives. // Warning 5084: (317-333): Type conversion is not yet fully supported and might yield false positives. // Warning 5084: (451-460): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (280-303): Assertion violation happens here -// Warning 4661: (414-431): Assertion violation happens here -// Warning 4661: (542-559): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol index 886063ee08e8..d5cf22e3f36b 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_2_fail.sol @@ -9,5 +9,5 @@ contract C } } // ---- +// Warning 6328: (149-163): Assertion violation happens here // Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (149-163): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol b/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol index 77bb74374420..1bb3b7463ce2 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_larger_3.sol @@ -12,6 +12,6 @@ contract C } } // ---- +// Warning 6328: (207-230): Assertion violation happens here +// Warning 6328: (273-287): Assertion violation happens here // Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (207-230): Assertion violation happens here -// Warning 4661: (273-287): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol index bbc8819b115d..f6adcf0cef0c 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_2.sol @@ -10,5 +10,5 @@ contract C } } // ---- +// Warning 6328: (208-227): Assertion violation happens here // Warning 5084: (112-121): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (208-227): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol index 1af3f58b2e94..2d6cbada48a1 100644 --- a/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol +++ b/test/libsolidity/smtCheckerTests/typecast/cast_smaller_3.sol @@ -10,5 +10,5 @@ contract C } } // ---- +// Warning 6328: (198-215): Assertion violation happens here // Warning 5084: (108-117): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (198-215): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol b/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol index d7e87b02cccb..28b845fb665d 100644 --- a/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol +++ b/test/libsolidity/smtCheckerTests/typecast/enum_from_uint.sol @@ -10,6 +10,6 @@ contract C } } // ---- +// Warning 6328: (140-160): Assertion violation happens here // Warning 8364: (132-133): Assertion checker does not yet implement type type(enum C.D) // Warning 5084: (132-136): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (140-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol index 1f2ee2a1f3d9..16eda02168e4 100644 --- a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol +++ b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_external.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning 4661: (155-175): Assertion violation happens here +// Warning 6328: (155-175): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol index fccf18dda7d0..1f6869a1c00f 100644 --- a/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol +++ b/test/libsolidity/smtCheckerTests/typecast/function_type_to_function_type_internal.sol @@ -11,13 +11,11 @@ contract C { } } // ---- +// Warning 6328: (207-227): Assertion violation happens here +// Warning 6328: (231-245): Assertion violation happens here // Warning 5729: (214-218): Assertion checker does not yet implement this type of function call. // Warning 5729: (222-226): Assertion checker does not yet implement this type of function call. // Warning 7229: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons -// Warning 4661: (207-227): Assertion violation happens here -// Warning 4661: (231-245): Assertion violation happens here // Warning 5729: (214-218): Assertion checker does not yet implement this type of function call. // Warning 5729: (222-226): Assertion checker does not yet implement this type of function call. // Warning 7229: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons -// Warning 4661: (207-227): Assertion violation happens here -// Warning 4661: (231-245): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol index 8867cba8b33a..3bfd2b7514d9 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_function_call.sol @@ -9,5 +9,5 @@ contract B { } } // ---- -// Warning 4661: (162-184): Assertion violation happens here -// Warning 4661: (162-184): Assertion violation happens here +// Warning 6328: (162-184): Assertion violation happens here +// Warning 6328: (136-158): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol index f42bc60d1a8e..b4a482437d40 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_modifier.sol @@ -8,4 +8,4 @@ contract B { } } // ---- -// Warning 4661: (152-174): Assertion violation happens here +// Warning 6328: (152-174): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol index 04c88481c227..3042084e6470 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (238-259): Assertion violation happens here +// Warning 6328: (238-259): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol index 0387b3fdaf7a..c29efb6f5bbb 100644 --- a/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol +++ b/test/libsolidity/smtCheckerTests/typecast/string_literal_to_fixed_bytes_return_multi.sol @@ -12,4 +12,4 @@ contract C { } } // ---- -// Warning 4661: (442-461): Assertion violation happens here +// Warning 6328: (442-461): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_balance.sol b/test/libsolidity/smtCheckerTests/types/address_balance.sol index e631479526bf..8edae0c8c6e4 100644 --- a/test/libsolidity/smtCheckerTests/types/address_balance.sol +++ b/test/libsolidity/smtCheckerTests/types/address_balance.sol @@ -9,5 +9,5 @@ contract C } // ---- // Warning 2072: (96-102): Unused local variable. +// Warning 6328: (131-160): Assertion violation happens here // Warning 2661: (105-127): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (131-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_call.sol b/test/libsolidity/smtCheckerTests/types/address_call.sol index f0da1a2cc46f..275f1b6cf311 100644 --- a/test/libsolidity/smtCheckerTests/types/address_call.sol +++ b/test/libsolidity/smtCheckerTests/types/address_call.sol @@ -19,7 +19,7 @@ contract C // EVMVersion: >spuriousDragon // ---- // Warning 2072: (224-240): Unused local variable. -// Warning 4661: (260-275): Assertion violation happens here -// Warning 4661: (279-293): Assertion violation happens here -// Warning 4661: (297-316): Assertion violation happens here -// Warning 4661: (320-344): Assertion violation happens here +// Warning 6328: (260-275): Assertion violation happens here +// Warning 6328: (279-293): Assertion violation happens here +// Warning 6328: (297-316): Assertion violation happens here +// Warning 6328: (320-344): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol b/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol index b93c0d8d6f36..3dd9e07cbe77 100644 --- a/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol +++ b/test/libsolidity/smtCheckerTests/types/address_delegatecall.sol @@ -19,7 +19,7 @@ contract C // EVMVersion: >spuriousDragon // ---- // Warning 2072: (224-240): Unused local variable. -// Warning 4661: (268-283): Assertion violation happens here -// Warning 4661: (287-301): Assertion violation happens here -// Warning 4661: (305-324): Assertion violation happens here -// Warning 4661: (328-352): Assertion violation happens here +// Warning 6328: (268-283): Assertion violation happens here +// Warning 6328: (287-301): Assertion violation happens here +// Warning 6328: (305-324): Assertion violation happens here +// Warning 6328: (328-352): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol index 55e0b7427242..05c10febc52e 100644 --- a/test/libsolidity/smtCheckerTests/types/address_staticcall.sol +++ b/test/libsolidity/smtCheckerTests/types/address_staticcall.sol @@ -19,4 +19,4 @@ contract C // EVMVersion: >spuriousDragon // ---- // Warning 2072: (224-240): Unused local variable. -// Warning 4661: (266-281): Assertion violation happens here +// Warning 6328: (266-281): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer.sol b/test/libsolidity/smtCheckerTests/types/address_transfer.sol index f369ec3ba589..ae435cec5812 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer.sol @@ -11,5 +11,5 @@ contract C } } // ---- +// Warning 6328: (195-219): Assertion violation happens here // Warning 1236: (131-146): Insufficient funds happens here -// Warning 4661: (195-219): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol b/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol index 6da8ace7977e..f6bc0ef6d953 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer_2.sol @@ -14,6 +14,6 @@ contract C } } // ---- +// Warning 6328: (295-324): Assertion violation happens here // Warning 1236: (217-232): Insufficient funds happens here // Warning 1236: (236-251): Insufficient funds happens here -// Warning 4661: (295-324): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol b/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol index 003d73aec8b6..8c4f37bf29e3 100644 --- a/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol +++ b/test/libsolidity/smtCheckerTests/types/address_transfer_insufficient.sol @@ -11,6 +11,6 @@ contract C } } // ---- +// Warning 6328: (213-237): Assertion violation happens here // Warning 1236: (134-149): Insufficient funds happens here // Warning 1236: (153-169): Insufficient funds happens here -// Warning 4661: (213-237): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol index 212e06526df6..6b09f780d9ca 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_1.sol @@ -26,4 +26,4 @@ contract C } } // ---- -// Warning 4661: (400-457): Assertion violation happens here +// Warning 6328: (400-457): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol index 30817e87cf58..2e46f6890d9f 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_2.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning 4661: (321-338): Assertion violation happens here +// Warning 6328: (321-338): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol index 90948eedf13f..5885053c5423 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_memory_3.sol @@ -20,4 +20,4 @@ contract C } } // ---- -// Warning 4661: (476-493): Assertion violation happens here +// Warning 6328: (476-493): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol index 4accc29df945..75b265284401 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_1.sol @@ -44,13 +44,8 @@ contract C } } // ---- -// Warning 4661: (468-485): Assertion violation happens here -// Warning 4661: (532-554): Assertion violation happens here -// Warning 4661: (606-633): Assertion violation happens here -// Warning 4661: (774-796): Assertion violation happens here -// Warning 4661: (936-962): Assertion violation happens here -// Warning 4661: (468-485): Assertion violation happens here -// Warning 4661: (532-554): Assertion violation happens here -// Warning 4661: (606-633): Assertion violation happens here -// Warning 4661: (774-796): Assertion violation happens here -// Warning 4661: (936-962): Assertion violation happens here +// Warning 6328: (468-485): Assertion violation happens here. +// Warning 6328: (532-554): Assertion violation happens here. +// Warning 6328: (606-633): Assertion violation happens here. +// Warning 6328: (774-796): Assertion violation happens here. +// Warning 6328: (936-962): Assertion violation happens here. diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol index 3caf62fa74db..75077c31acb1 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol @@ -20,5 +20,4 @@ contract C } } // ---- -// Warning 4661: (436-453): Assertion violation happens here -// Warning 4661: (436-453): Assertion violation happens here +// Warning 6328: (436-453): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol index 900d39463bf1..b59f340ad0a8 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_3.sol @@ -23,7 +23,5 @@ contract C } } // ---- -// Warning 4661: (524-542): Assertion violation happens here -// Warning 4661: (585-602): Assertion violation happens here -// Warning 4661: (524-542): Assertion violation happens here -// Warning 4661: (585-602): Assertion violation happens here +// Warning 6328: (524-542): Assertion violation happens here +// Warning 6328: (585-602): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol index c967d6509c68..d1440dd92122 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_4.sol @@ -19,7 +19,5 @@ contract C } } // ---- -// Warning 4661: (225-242): Assertion violation happens here -// Warning 4661: (289-307): Assertion violation happens here -// Warning 4661: (225-242): Assertion violation happens here -// Warning 4661: (289-307): Assertion violation happens here +// Warning 6328: (225-242): Assertion violation happens here +// Warning 6328: (289-307): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol index afe21ea3472b..8f592202f256 100644 --- a/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_5.sol @@ -26,7 +26,5 @@ contract C } } // ---- -// Warning 4661: (431-449): Assertion violation happens here -// Warning 4661: (504-521): Assertion violation happens here -// Warning 4661: (431-449): Assertion violation happens here -// Warning 4661: (504-521): Assertion violation happens here +// Warning 6328: (431-449): Assertion violation happens here +// Warning 6328: (504-521): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol index 9c10255d8d08..f518188ddeb4 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_1d.sol @@ -11,4 +11,4 @@ contract C } // ---- // Warning 2018: (47-148): Function state mutability can be restricted to pure -// Warning 4661: (128-144): Assertion violation happens here +// Warning 6328: (128-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol index c62b953c28f3..1c782058fdd0 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_2d.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (130-149): Assertion violation happens here +// Warning 6328: (130-149): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol b/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol index ff42ff18a560..f4606955319f 100644 --- a/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_branch_3d.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (138-160): Assertion violation happens here +// Warning 6328: (138-160): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol index dd0a81bb4c7e..4d0ab0b8bb98 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (137-159): Assertion violation happens here +// Warning 6328: (137-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol index 8f1cd0cf28cc..6111c724765d 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_2_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (243-268): Assertion violation happens here +// Warning 6328: (243-268): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol index 4a6f5ec9a620..5c44924cb1a3 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_3_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (274-302): Assertion violation happens here +// Warning 6328: (274-302): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol index 2b7cfc1638f3..b49c7d5e04c0 100644 --- a/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_dynamic_parameter_1_fail.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning 4661: (148-170): Assertion violation happens here +// Warning 6328: (148-170): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol index f9344a257f7c..82508ab21bb3 100644 --- a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_1.sol @@ -23,7 +23,5 @@ contract C } } // ---- -// Warning 4661: (421-452): Assertion violation happens here -// Warning 4661: (635-671): Assertion violation happens here -// Warning 4661: (421-452): Assertion violation happens here -// Warning 4661: (635-671): Assertion violation happens here +// Warning 6328: (421-452): Assertion violation happens here +// Warning 6328: (635-671): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol index 0c5dc7a1f104..7fa85234f902 100644 --- a/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_mapping_aliasing_2.sol @@ -26,5 +26,4 @@ contract C } } // ---- -// Warning 4661: (777-797): Assertion violation happens here -// Warning 4661: (777-797): Assertion violation happens here +// Warning 6328: (777-797): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol index 126aa16fcd6a..87d385190c5d 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (139-161): Assertion violation happens here +// Warning 6328: (139-161): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol index 433b5589a39a..3ef862bf8ac8 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_2_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (186-211): Assertion violation happens here +// Warning 6328: (186-211): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol b/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol index 684e665d8be2..2e6fc54c78fb 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_3_fail.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (280-308): Assertion violation happens here +// Warning 6328: (280-308): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol index 40b35b6d9c07..c2b2b9ab537c 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_memory_5.sol @@ -14,5 +14,5 @@ contract C } } // ---- -// Warning 4661: (228-246): Assertion violation happens here -// Warning 4661: (293-310): Assertion violation happens here +// Warning 6328: (228-246): Assertion violation happens here +// Warning 6328: (293-310): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol index 02072491f723..429e5428db2e 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol @@ -21,6 +21,4 @@ contract C } } // ---- -// Warning 4661: (338-355): Assertion violation happens here -// Warning 4661: (338-355): Assertion violation happens here -// Warning 4661: (338-355): Assertion violation happens here +// Warning 6328: (338-355): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol index b5e8d37e4547..185797d6919b 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_1.sol @@ -23,7 +23,5 @@ contract C } } // ---- -// Warning 4661: (425-456): Assertion violation happens here -// Warning 4661: (639-675): Assertion violation happens here -// Warning 4661: (425-456): Assertion violation happens here -// Warning 4661: (639-675): Assertion violation happens here +// Warning 6328: (425-456): Assertion violation happens here +// Warning 6328: (639-675): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol index 826065f6a512..c9ed4f34cd92 100644 --- a/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol @@ -26,5 +26,4 @@ contract C } } // ---- -// Warning 4661: (781-801): Assertion violation happens here -// Warning 4661: (781-801): Assertion violation happens here +// Warning 6328: (781-801): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol b/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol index 1363e4184aba..f7cb6f957bb5 100644 --- a/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/array_struct_array_branches_2d.sol @@ -14,6 +14,7 @@ contract C } } // ---- +// Warning 6328: (202-226): Assertion violation happens here // Warning 7650: (124-130): Assertion checker does not yet support this expression. // Warning 8364: (124-128): Assertion checker does not yet implement type struct C.S memory // Warning 9118: (124-133): Assertion checker does not yet implement this expression. @@ -29,4 +30,3 @@ contract C // Warning 7650: (209-215): Assertion checker does not yet support this expression. // Warning 8364: (209-213): Assertion checker does not yet implement type struct C.S memory // Warning 9118: (209-218): Assertion checker does not yet implement this expression. -// Warning 4661: (202-226): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol b/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol index a30121141695..f499d14fd39c 100644 --- a/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol +++ b/test/libsolidity/smtCheckerTests/types/bool_simple_1.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning 4661: (90-99): Assertion violation happens here +// Warning 6328: (90-99): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol b/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol index 9f6cacc75b0c..9905ca0ba0bb 100644 --- a/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol +++ b/test/libsolidity/smtCheckerTests/types/bool_simple_2.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning 4661: (98-112): Assertion violation happens here +// Warning 6328: (98-112): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol b/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol index 82a2f5497334..433125a63289 100644 --- a/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/bytes_2_fail.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning 4661: (119-141): Assertion violation happens here +// Warning 6328: (119-141): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract.sol b/test/libsolidity/smtCheckerTests/types/contract.sol index a346fad5f213..aca1a4613419 100644 --- a/test/libsolidity/smtCheckerTests/types/contract.sol +++ b/test/libsolidity/smtCheckerTests/types/contract.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (84-98): Assertion violation happens here +// Warning 6328: (84-98): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract_2.sol b/test/libsolidity/smtCheckerTests/types/contract_2.sol index 3302cc076fec..8d79761e5042 100644 --- a/test/libsolidity/smtCheckerTests/types/contract_2.sol +++ b/test/libsolidity/smtCheckerTests/types/contract_2.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (109-123): Assertion violation happens here +// Warning 6328: (109-123): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol b/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol index 0985fa180b51..ae1e407b7dbb 100644 --- a/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol +++ b/test/libsolidity/smtCheckerTests/types/contract_address_conversion.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (90-113): Assertion violation happens here +// Warning 6328: (90-113): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol b/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol index 343f22ad8936..787cb2807e22 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_explicit_values_2.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (144-159): Assertion violation happens here +// Warning 6328: (144-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol b/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol index 69aa61149d51..7e54307ed30d 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_in_library_2.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning 4661: (159-179): Assertion violation happens here +// Warning 6328: (159-179): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol b/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol index c5d107ab00d2..8c8636e59893 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_in_struct.sol @@ -11,10 +11,10 @@ contract C } } // ---- +// Warning 6328: (187-208): Assertion violation happens here // Warning 8115: (143-153): Assertion checker does not yet support the type of this variable. // Warning 7650: (171-174): Assertion checker does not yet support this expression. // Warning 8364: (171-172): Assertion checker does not yet implement type struct C.S memory // Warning 8182: (171-183): Assertion checker does not yet implement such assignments. // Warning 7650: (194-197): Assertion checker does not yet support this expression. // Warning 8364: (194-195): Assertion checker does not yet implement type struct C.S memory -// Warning 4661: (187-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol b/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol index b963e11e7b32..e434046005ce 100644 --- a/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol +++ b/test/libsolidity/smtCheckerTests/types/enum_storage_eq.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (115-130): Assertion violation happens here +// Warning 6328: (115-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol index c4c4b7cac1b8..55138482ccdf 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol @@ -12,5 +12,5 @@ contract C } } // ---- -// Warning 4661: (96-110): Assertion violation happens here -// Warning 4661: (114-130): Assertion violation happens here +// Warning 6328: (96-110): Assertion violation happens here +// Warning 6328: (114-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol index 688804153fa6..46409c1e6181 100644 --- a/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol +++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol @@ -12,4 +12,4 @@ contract C } } // ---- -// Warning 4661: (116-130): Assertion violation happens here +// Warning 6328: (116-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol index e76149e2742b..079e1eded6ef 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (134-153): Assertion violation happens here +// Warning 6328: (134-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_2.sol index 75d1e092d63c..b8e9ebe5b233 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_2.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning 4661: (111-130): Assertion violation happens here +// Warning 6328: (111-130): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol index 77f801c2c409..2156b469e20b 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_2d_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (154-178): Assertion violation happens here +// Warning 6328: (154-178): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol b/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol index 7fb8472a2375..9792df9056bc 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_3d_1_fail.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (176-204): Assertion violation happens here +// Warning 6328: (176-204): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_5.sol b/test/libsolidity/smtCheckerTests/types/mapping_5.sol index 190a736a03d0..6ebdf518b89c 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_5.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_5.sol @@ -8,4 +8,4 @@ contract C } } // ---- -// Warning 4661: (125-144): Assertion violation happens here +// Warning 6328: (125-144): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol index 0092e4b5b2dc..afe1ce6dc325 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_1.sol @@ -16,4 +16,4 @@ contract C } } // ---- -// Warning 4661: (266-286): Assertion violation happens here +// Warning 6328: (266-286): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol index e061b2fecc55..86f0623a63f3 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol @@ -30,12 +30,6 @@ contract C } } // ---- -// Warning 4661: (397-417): Assertion violation happens here -// Warning 4661: (463-481): Assertion violation happens here -// Warning 4661: (533-557): Assertion violation happens here -// Warning 4661: (397-417): Assertion violation happens here -// Warning 4661: (463-481): Assertion violation happens here -// Warning 4661: (533-557): Assertion violation happens here -// Warning 4661: (397-417): Assertion violation happens here -// Warning 4661: (463-481): Assertion violation happens here -// Warning 4661: (533-557): Assertion violation happens here +// Warning 6328: (397-417): Assertion violation happens here +// Warning 6328: (463-481): Assertion violation happens here +// Warning 6328: (533-557): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol index a32509d484b3..ec8c795a5311 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_as_local_var_1.sol @@ -16,6 +16,6 @@ contract c { } } // ---- +// Warning 6328: (288-324): Assertion violation happens here +// Warning 6328: (336-372): Assertion violation happens here // Warning 6031: (166-178): Internal error: Expression undefined for SMT solver. -// Warning 4661: (288-324): Assertion violation happens here -// Warning 4661: (336-372): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol b/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol index 22e3d3888ad2..cd2f34168b71 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_as_parameter_1.sol @@ -12,4 +12,4 @@ contract c { } } // ---- -// Warning 4661: (289-306): Assertion violation happens here +// Warning 6328: (289-306): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol index 92e15765c03d..f77baadef4c6 100644 --- a/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol +++ b/test/libsolidity/smtCheckerTests/types/mapping_equal_keys_2.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning 4661: (119-133): Assertion violation happens here +// Warning 6328: (119-133): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/rational_large_1.sol b/test/libsolidity/smtCheckerTests/types/rational_large_1.sol index fe057d0bdf66..5353ed6f8279 100644 --- a/test/libsolidity/smtCheckerTests/types/rational_large_1.sol +++ b/test/libsolidity/smtCheckerTests/types/rational_large_1.sol @@ -7,4 +7,4 @@ contract c { } } // ---- -// Warning 4661: (128-142): Assertion violation happens here +// Warning 6328: (128-142): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol index 273c43cbd978..4bb6409ca654 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_1.sol @@ -19,4 +19,4 @@ contract C } } // ---- -// Warning 4661: (362-421): Assertion violation happens here +// Warning 6328: (362-421): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol index 76e274a8bfc6..f18a466b1bd9 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_2.sol @@ -9,4 +9,4 @@ contract C } } // ---- -// Warning 4661: (123-136): Assertion violation happens here +// Warning 6328: (123-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol b/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol index 134a3958749d..776c2541ca19 100644 --- a/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol +++ b/test/libsolidity/smtCheckerTests/types/storage_value_vars_4.sol @@ -7,4 +7,4 @@ contract C uint c; } // ---- -// Warning 4661: (84-97): Assertion violation happens here +// Warning 6328: (84-97): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_1.sol b/test/libsolidity/smtCheckerTests/types/string_1.sol index a71420074376..19a7fa094fff 100644 --- a/test/libsolidity/smtCheckerTests/types/string_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_1.sol @@ -7,4 +7,4 @@ contract C } } // ---- -// Warning 4661: (110-154): Assertion violation happens here +// Warning 6328: (110-154): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol index 592ed1d0172a..834cce276daf 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_1.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning 4661: (175-190): Assertion violation happens here +// Warning 6328: (175-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol index 3d11c4e22f4d..c2b74b2fe113 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_2.sol @@ -9,4 +9,4 @@ contract C { } } // ---- -// Warning 4661: (176-191): Assertion violation happens here +// Warning 6328: (176-191): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol index e2a770305a0f..3fe3bf2d1e42 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_3.sol @@ -11,4 +11,4 @@ contract C { } } // ---- -// Warning 4661: (186-201): Assertion violation happens here +// Warning 6328: (186-201): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol index 70d922f0ef67..f72e6386f886 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_4.sol @@ -15,4 +15,4 @@ contract C { } } // ---- -// Warning 4661: (261-276): Assertion violation happens here +// Warning 6328: (261-276): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol index ee3418da4f92..ee49949139a1 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_assignment_5.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning 4661: (251-266): Assertion violation happens here +// Warning 6328: (251-266): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol index f3f57304eea7..92f3c7e41cd0 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_1.sol @@ -10,4 +10,4 @@ contract C { } } // ---- -// Warning 4661: (170-190): Assertion violation happens here +// Warning 6328: (170-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol index c54a8ce6a729..28f296addbe3 100644 --- a/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol +++ b/test/libsolidity/smtCheckerTests/types/string_literal_comparison_2.sol @@ -10,5 +10,5 @@ contract C { } } // ---- -// Warning 4661: (147-166): Assertion violation happens here -// Warning 4661: (170-190): Assertion violation happens here +// Warning 6328: (147-166): Assertion violation happens here +// Warning 6328: (170-190): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol index e20bdd6326e6..7d5752c2bbce 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_1d.sol @@ -15,6 +15,7 @@ contract C } // ---- // Warning 2018: (71-197): Function state mutability can be restricted to pure +// Warning 6328: (175-193): Assertion violation happens here // Warning 8115: (101-111): Assertion checker does not yet support the type of this variable. // Warning 7650: (115-118): Assertion checker does not yet support this expression. // Warning 8364: (115-116): Assertion checker does not yet implement type struct C.S memory @@ -31,4 +32,3 @@ contract C // Warning 7650: (182-185): Assertion checker does not yet support this expression. // Warning 8364: (182-183): Assertion checker does not yet implement type struct C.S memory // Warning 9118: (182-188): Assertion checker does not yet implement this expression. -// Warning 4661: (175-193): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol index 9d10d0f69cae..d5fa12ed4b22 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_2d.sol @@ -15,6 +15,7 @@ contract C } // ---- // Warning 2018: (73-211): Function state mutability can be restricted to pure +// Warning 6328: (186-207): Assertion violation happens here // Warning 8115: (103-113): Assertion checker does not yet support the type of this variable. // Warning 7650: (117-120): Assertion checker does not yet support this expression. // Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S memory @@ -31,4 +32,3 @@ contract C // Warning 7650: (193-196): Assertion checker does not yet support this expression. // Warning 8364: (193-194): Assertion checker does not yet implement type struct C.S memory // Warning 9118: (193-199): Assertion checker does not yet implement this expression. -// Warning 4661: (186-207): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol b/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol index f537d39df835..16b5fef4e101 100644 --- a/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol +++ b/test/libsolidity/smtCheckerTests/types/struct_array_branches_3d.sol @@ -14,6 +14,7 @@ contract C } } // ---- +// Warning 6328: (202-226): Assertion violation happens here // Warning 8115: (110-120): Assertion checker does not yet support the type of this variable. // Warning 7650: (124-127): Assertion checker does not yet support this expression. // Warning 8364: (124-125): Assertion checker does not yet implement type struct C.S memory @@ -30,4 +31,3 @@ contract C // Warning 7650: (209-212): Assertion checker does not yet support this expression. // Warning 8364: (209-210): Assertion checker does not yet implement type struct C.S memory // Warning 9118: (209-215): Assertion checker does not yet implement this expression. -// Warning 4661: (202-226): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol index c7b7cdc45589..cac79a17282b 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_array_empty.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (136-153): Assertion violation happens here +// Warning 6328: (136-153): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol index 06f9263f70f4..9620603029de 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_compound.sol @@ -10,4 +10,4 @@ contract C } } // ---- -// Warning 4661: (122-136): Assertion violation happens here +// Warning 6328: (122-136): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol index e17a1ff590ad..fd8d3485b42d 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_assignment_empty.sol @@ -11,4 +11,4 @@ contract C } } // ---- -// Warning 4661: (132-146): Assertion violation happens here +// Warning 6328: (132-146): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol index b6d5ea2f1a55..8c0b2f059aa1 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_declarations_function_empty.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning 4661: (224-234): Assertion violation happens here +// Warning 6328: (224-234): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function.sol b/test/libsolidity/smtCheckerTests/types/tuple_function.sol index 828c5514bae4..49ed1bb94a0c 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function.sol @@ -14,5 +14,5 @@ contract C } } // ---- -// Warning 4661: (182-196): Assertion violation happens here -// Warning 4661: (200-214): Assertion violation happens here +// Warning 6328: (182-196): Assertion violation happens here +// Warning 6328: (200-214): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol index aec7d059acd8..13dd7b10dffc 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function_2.sol @@ -14,4 +14,4 @@ contract C } } // ---- -// Warning 4661: (199-213): Assertion violation happens here +// Warning 6328: (199-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol b/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol index 0f58ec650c02..5d0dc71c7891 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_function_3.sol @@ -16,5 +16,5 @@ contract C } } // ---- -// Warning 4661: (205-219): Assertion violation happens here -// Warning 4661: (223-237): Assertion violation happens here +// Warning 6328: (205-219): Assertion violation happens here +// Warning 6328: (223-237): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol b/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol index 970a900dcad4..4226f85e8ee9 100644 --- a/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol +++ b/test/libsolidity/smtCheckerTests/verification_target/simple_assert.sol @@ -3,4 +3,4 @@ contract C { function f(uint a) public pure { assert(a == 2); } } // ---- -// Warning 4661: (82-96): Assertion violation happens here +// Warning 6328: (82-96): Assertion violation happens here From 5bb4e7369359658d8bc064fad98c930efacc3887 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 14 Jul 2020 17:41:19 +0200 Subject: [PATCH 455/479] Review 1 --- libsmtutil/Z3CHCInterface.cpp | 42 +++++++------------ libsmtutil/Z3CHCInterface.h | 3 +- libsolidity/formal/CHC.cpp | 28 +++++++++---- libsolidity/formal/CHC.h | 4 +- test/InteractiveTests.h | 1 - .../operators/delete_multid_array.sol | 4 +- .../smtCheckerTestsJSON/multi.json | 10 ----- .../libsolidity/smtCheckerTestsJSON/multi.sol | 14 ------- .../smtCheckerTestsJSON/simple.json | 9 ---- .../smtCheckerTestsJSON/simple.sol | 11 ----- 10 files changed, 40 insertions(+), 86 deletions(-) delete mode 100644 test/libsolidity/smtCheckerTestsJSON/multi.json delete mode 100644 test/libsolidity/smtCheckerTestsJSON/multi.sol delete mode 100644 test/libsolidity/smtCheckerTestsJSON/simple.json delete mode 100644 test/libsolidity/smtCheckerTestsJSON/simple.sol diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index 4baf3bd0a9c6..9ea15562124d 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -36,7 +36,7 @@ Z3CHCInterface::Z3CHCInterface(): z3::set_param("rewriter.pull_cheap_ite", true); z3::set_param("rlimit", Z3Interface::resourceLimit); - enablePreProcessing(); + setSpacerOptions(); } void Z3CHCInterface::declareVariable(string const& _name, SortPointer const& _sort) @@ -104,7 +104,7 @@ pair Z3CHCInterface::query(Expression return {result, cex}; } -void Z3CHCInterface::enablePreProcessing() +void Z3CHCInterface::setSpacerOptions(bool _preProcessing) { // Spacer options. // These needs to be set in the solver. @@ -117,31 +117,12 @@ void Z3CHCInterface::enablePreProcessing() // Ground pobs by using values from a model. p.set("fp.spacer.ground_pobs", false); - // Enable Spacer optimization for better solving. - p.set("fp.xform.slice", true); - p.set("fp.xform.inline_linear", true); - p.set("fp.xform.inline_eager", true); - - m_solver.set(p); -} - -void Z3CHCInterface::disablePreProcessing() -{ - // Spacer options. - // These needs to be set in the solver. - // https://github.com/Z3Prover/z3/blob/master/src/muz/base/fp_params.pyg - z3::params p(*m_context); - // These are useful for solving problems with arrays and loops. - // Use quantified lemma generalizer. - p.set("fp.spacer.q3.use_qgen", true); - p.set("fp.spacer.mbqi", false); - // Ground pobs by using values from a model. - p.set("fp.spacer.ground_pobs", false); - - // Disable Spacer optimization for counterexample generation. - p.set("fp.xform.slice", false); - p.set("fp.xform.inline_linear", false); - p.set("fp.xform.inline_eager", false); + // Spacer optimization should be + // - enabled for better solving (default) + // - disable for counterexample generation + p.set("fp.xform.slice", _preProcessing); + p.set("fp.xform.inline_linear", _preProcessing); + p.set("fp.xform.inline_eager", _preProcessing); m_solver.set(p); } @@ -151,6 +132,13 @@ Convert a ground refutation into a linear or nonlinear counterexample. The counterexample is given as an implication graph of the form `premises => conclusion` where `premises` are the predicates from the body of nonlinear clauses, representing the proof graph. + +This function is based on and similar to +https://github.com/Z3Prover/z3/blob/z3-4.8.8/src/muz/spacer/spacer_context.cpp#L2919 +(spacer::context::get_ground_sat_answer) +which generates linear counterexamples. +It is modified here to accept nonlinear CHCs as well, generating a DAG +instead of a path. */ CHCSolverInterface::CexGraph Z3CHCInterface::cexGraph(z3::expr const& _proof) { diff --git a/libsmtutil/Z3CHCInterface.h b/libsmtutil/Z3CHCInterface.h index e30611f0f051..00e4ca2852f8 100644 --- a/libsmtutil/Z3CHCInterface.h +++ b/libsmtutil/Z3CHCInterface.h @@ -46,8 +46,7 @@ class Z3CHCInterface: public CHCSolverInterface Z3Interface* z3Interface() const { return m_z3Interface.get(); } - void enablePreProcessing(); - void disablePreProcessing(); + void setSpacerOptions(bool _preProcessing = true); private: /// Constructs a nonlinear counterexample graph from the refutation. diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index e687dffecb58..3a865c4bc531 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -32,6 +32,8 @@ #include #include +#include + using namespace std; using namespace solidity; using namespace solidity::util; @@ -569,6 +571,7 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall) m_context.variable(*var)->increaseIndex(); auto nondet = (*m_nondetInterfaces.at(m_currentContract))(preCallState + currentStateVariables()); + m_symbolFunction[nondet.name] = &_funCall; m_context.addAssertion(nondet); m_context.addAssertion(m_error.currentValue() == 0); @@ -1134,7 +1137,7 @@ pair CHC::query(smtutil::Exp // We now disable those optimizations and check whether we can still solve the problem. auto* spacer = dynamic_cast(m_interface.get()); solAssert(spacer, ""); - spacer->disablePreProcessing(); + spacer->setSpacerOptions(false); smtutil::CheckResult resultNoOpt; CHCSolverInterface::CexGraph cexNoOpt; @@ -1143,7 +1146,7 @@ pair CHC::query(smtutil::Exp if (resultNoOpt == smtutil::CheckResult::SATISFIABLE) cex = move(cexNoOpt); - spacer->enablePreProcessing(); + spacer->setSpacerOptions(true); #endif break; } @@ -1312,7 +1315,8 @@ optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& string localState; unsigned node = *rootId; - optional lastTxSeen; + /// The first summary node seen in this loop represents the last transaction. + bool lastTxSeen = false; while (_graph.edges.at(node).size() >= 1) { auto const& edges = _graph.edges.at(node); @@ -1328,6 +1332,8 @@ optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& swap(summaryId, *interfaceId); solAssert(_graph.nodes.at(*interfaceId).first.rfind("interface", 0) == 0, ""); } + /// The children are unordered, so we need to check which is the summary and + /// which is the interface. solAssert(_graph.nodes.at(summaryId).first.rfind("summary", 0) == 0, ""); /// At this point property 2 from the function description is verified for this node. @@ -1360,9 +1366,9 @@ optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& /// but not necessarily the summary of the function that contains the error. if (!lastTxSeen) { - lastTxSeen = summaryNode.first; + lastTxSeen = true; /// Generate counterexample message local to the failed target. - localState = generatePostStateCounterexample(stateVars, calledFun, summaryNode.second) + "\n"; + localState = formatStateCounterexample(stateVars, calledFun, summaryNode.second) + "\n"; if (calledFun) { /// The signature of a summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). @@ -1389,9 +1395,9 @@ optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& else /// We report the state after every tx in the trace except for the last, which is reported /// first in the code above. - path.emplace_back("State: " + generatePostStateCounterexample(stateVars, calledFun, summaryNode.second)); + path.emplace_back("State: " + formatStateCounterexample(stateVars, calledFun, summaryNode.second)); - string txCex = calledContract ? "constructor()" : generatePreTxCounterexample(stateVars, *calledFun, summaryNode.second); + string txCex = calledContract ? "constructor()" : formatFunctionCallCounterexample(stateVars, *calledFun, summaryNode.second); path.emplace_back(txCex); /// Recurse on the next interface node which represents the previous transaction @@ -1405,7 +1411,7 @@ optional CHC::generateCounterexample(CHCSolverInterface::CexGraph const& return localState + "\nTransaction trace:\n" + boost::algorithm::join(boost::adaptors::reverse(path), "\n"); } -string CHC::generatePostStateCounterexample(vector const& _stateVars, FunctionDefinition const* _function, vector const& _summaryValues) +string CHC::formatStateCounterexample(vector const& _stateVars, FunctionDefinition const* _function, vector const& _summaryValues) { /// The signature of a function summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). /// The signature of an implicit constructor summary predicate is: summary(error, postStateVars). @@ -1423,6 +1429,8 @@ string CHC::generatePostStateCounterexample(vector c stateLast = stateFirst + static_cast(_stateVars.size()); } + solAssert(stateFirst >= _summaryValues.begin() && stateFirst <= _summaryValues.end(), ""); + solAssert(stateLast >= _summaryValues.begin() && stateLast <= _summaryValues.end(), ""); vector stateArgs(stateFirst, stateLast); solAssert(stateArgs.size() == _stateVars.size(), ""); @@ -1437,12 +1445,14 @@ string CHC::generatePostStateCounterexample(vector c return boost::algorithm::join(stateCex, ", "); } -string CHC::generatePreTxCounterexample(vector const& _stateVars, FunctionDefinition const& _function, vector const& _summaryValues) +string CHC::formatFunctionCallCounterexample(vector const& _stateVars, FunctionDefinition const& _function, vector const& _summaryValues) { /// The signature of a function summary predicate is: summary(error, preStateVars, preInputVars, postInputVars, outputVars). /// Here we are interested in preInputVars. vector::const_iterator first = _summaryValues.begin() + static_cast(_stateVars.size()) + 1; vector::const_iterator last = first + static_cast(_function.parameters().size()); + solAssert(first >= _summaryValues.begin() && first <= _summaryValues.end(), ""); + solAssert(last >= _summaryValues.begin() && last <= _summaryValues.end(), ""); vector functionArgsCex(first, last); vector functionArgs; diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 3334a45e4731..1b2ec493d480 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -218,11 +218,11 @@ class CHC: public SMTEncoder /// _function was executed. /// _function = nullptr means the transaction was the deployment of a /// contract without an explicit constructor. - std::string generatePostStateCounterexample(std::vector const& _stateVariables, FunctionDefinition const* _function, std::vector const& _summaryValues); + std::string formatStateCounterexample(std::vector const& _stateVariables, FunctionDefinition const* _function, std::vector const& _summaryValues); /// @returns a formatted text representing a call to _function /// with the concrete values for value type parameters and /// the parameter name for reference types. - std::string generatePreTxCounterexample(std::vector const& _stateVariables, FunctionDefinition const& _function, std::vector const& _summaryValues); + std::string formatFunctionCallCounterexample(std::vector const& _stateVariables, FunctionDefinition const& _function, std::vector const& _summaryValues); //@} /// Misc. diff --git a/test/InteractiveTests.h b/test/InteractiveTests.h index 46d8a2973a79..7ecc8de5e667 100644 --- a/test/InteractiveTests.h +++ b/test/InteractiveTests.h @@ -67,7 +67,6 @@ Testsuite const g_interactiveTestsuites[] = { {"JSON AST", "libsolidity", "ASTJSON", false, false, &ASTJSONTest::create}, {"JSON ABI", "libsolidity", "ABIJson", false, false, &ABIJsonTest::create}, {"SMT Checker", "libsolidity", "smtCheckerTests", true, false, &SMTCheckerTest::create, {"nooptions"}}, - {"SMT Checker JSON", "libsolidity", "smtCheckerTestsJSON", true, false, &SMTCheckerJSONTest::create, {"nooptions"}}, {"Gas Estimates", "libsolidity", "gasTests", false, false, &GasTest::create} }; diff --git a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol index 91527b8c7f07..f52da7a3dd4a 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_multid_array.sol @@ -37,6 +37,8 @@ contract C { b[x][y] = z; } } +// ==== +// SMTSolvers: cvc4 // ---- -// Warning 6328: (617-637): Assertion violation happens here. // Warning 4661: (372-392): Assertion violation happens here +// Warning 4661: (617-637): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTestsJSON/multi.json b/test/libsolidity/smtCheckerTestsJSON/multi.json deleted file mode 100644 index 986429dac200..000000000000 --- a/test/libsolidity/smtCheckerTestsJSON/multi.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "auxiliaryInput": - { - "smtlib2responses": - { - "0x45598870c7c0bc4c4f61acad7e0dd9399fb28aa3df198379dd36a95d70814ef8": "sat\n((|EVALEXPR_0| 1))\n", - "0xee335f8104fdb81b6e5fb418725923b81f7d78ffbd6bf95fb82e5593a1ac366a": "sat\n((|EVALEXPR_0| 0))\n" - } - } -} diff --git a/test/libsolidity/smtCheckerTestsJSON/multi.sol b/test/libsolidity/smtCheckerTestsJSON/multi.sol deleted file mode 100644 index d81d76cb0ff2..000000000000 --- a/test/libsolidity/smtCheckerTestsJSON/multi.sol +++ /dev/null @@ -1,14 +0,0 @@ -==== Source: A ==== -pragma experimental SMTChecker; - -contract C -{ - function f(uint x) public pure { - assert(x > 0); - assert(x > 100); - assert(x >= 0); - } -} -// ---- -// Warning: (82-95): Assertion violation happens here -// Warning: (99-114): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTestsJSON/simple.json b/test/libsolidity/smtCheckerTestsJSON/simple.json deleted file mode 100644 index 0b70ea24b2d9..000000000000 --- a/test/libsolidity/smtCheckerTestsJSON/simple.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "auxiliaryInput": - { - "smtlib2responses": - { - "0x535c76d6b87d14bd4b4bf1014d14b8e91b648f073a68f9f267c4fe1df570bc14": "sat\n((|EVALEXPR_0| 0))\n" - } - } -} diff --git a/test/libsolidity/smtCheckerTestsJSON/simple.sol b/test/libsolidity/smtCheckerTestsJSON/simple.sol deleted file mode 100644 index f93c8fd79044..000000000000 --- a/test/libsolidity/smtCheckerTestsJSON/simple.sol +++ /dev/null @@ -1,11 +0,0 @@ -==== Source: A ==== -pragma experimental SMTChecker; - -contract C -{ - function f(uint x) public pure { - assert(x > 0); - } -} -// ---- -// Warning: (82-95): Assertion violation happens here From d5f00842d984cca139fd74d2d3d37ca5f8c24014 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 17 Jul 2020 12:26:55 +0200 Subject: [PATCH 456/479] cex2dot debug --- libsolidity/formal/CHC.cpp | 16 ++++++++++++++++ libsolidity/formal/CHC.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index 3a865c4bc531..2615cf9d78bd 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -1471,6 +1471,22 @@ string CHC::formatFunctionCallCounterexample(vector return fName + "(" + boost::algorithm::join(functionArgs, ", ") + ")"; } +string CHC::cex2dot(smtutil::CHCSolverInterface::CexGraph const& _cex) +{ + string dot = "digraph {\n"; + + auto pred = [&](CHCSolverInterface::CexNode const& _node) { + return "\"" + _node.first + "(" + boost::algorithm::join(_node.second, ", ") + ")\""; + }; + + for (auto const& [u, vs]: _cex.edges) + for (auto v: vs) + dot += pred(_cex.nodes.at(v)) + " -> " + pred(_cex.nodes.at(u)) + "\n"; + + dot += "}"; + return dot; +} + string CHC::uniquePrefix() { return to_string(m_blockCounter++); diff --git a/libsolidity/formal/CHC.h b/libsolidity/formal/CHC.h index 1b2ec493d480..8342524bbfa2 100644 --- a/libsolidity/formal/CHC.h +++ b/libsolidity/formal/CHC.h @@ -223,6 +223,10 @@ class CHC: public SMTEncoder /// with the concrete values for value type parameters and /// the parameter name for reference types. std::string formatFunctionCallCounterexample(std::vector const& _stateVariables, FunctionDefinition const& _function, std::vector const& _summaryValues); + + /// @returns a DAG in the dot format. + /// Used for debugging purposes. + std::string cex2dot(smtutil::CHCSolverInterface::CexGraph const& _graph); //@} /// Misc. From d70ebbb62d613a9bcd0f7571f0510b3589595215 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 20 Jul 2020 16:33:21 +0200 Subject: [PATCH 457/479] Remove problematic test --- .../types/mapping_aliasing_2.sol | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol diff --git a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol b/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol deleted file mode 100644 index 86f0623a63f3..000000000000 --- a/test/libsolidity/smtCheckerTests/types/mapping_aliasing_2.sol +++ /dev/null @@ -1,35 +0,0 @@ -pragma experimental SMTChecker; - -contract C -{ - mapping (uint => uint) a; - mapping (uint => mapping (uint => uint)) maps; - mapping (uint => mapping (uint => uint8)) maps8; - function f(mapping (uint => uint) storage map1, mapping (uint => uint) storage map2) internal { - map1[0] = 2; - a[0] = 42; - maps[0][0] = 42; - maps8[0][0] = 42; - map2[0] = 1; - // Fails because map2 == map1 is possible. - assert(map1[0] == 2); - // Fails because map2 == a is possible. - assert(a[0] == 42); - // Fails because map2 == maps[0] is possible. - assert(maps[0][0] == 42); - // Should not fail since knowledge is erased only for mapping (uint => uint). - assert(maps8[0][0] == 42); - assert(map2[0] == 1); - } - - function g(bool b, uint x, uint y) public { - if (b) - f(a, maps[y]); - else - f(maps[x], maps[y]); - } -} -// ---- -// Warning 6328: (397-417): Assertion violation happens here -// Warning 6328: (463-481): Assertion violation happens here -// Warning 6328: (533-557): Assertion violation happens here From 95484d9969460bd8899e6ecbb2213ef0a9f27d22 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Thu, 23 Jul 2020 12:58:15 +0200 Subject: [PATCH 458/479] Fix tests after rebase --- .../array_members/pop_constructor_unsafe.sol | 2 +- .../array_members/push_push_no_args_1_fail.sol | 4 ++-- .../array_members/push_push_no_args_2_fail.sol | 6 +++--- .../array_members/storage_pointer_push_1.sol | 2 +- .../smtCheckerTests/external_calls/external_hash.sol | 2 +- .../external_calls/external_hash_known_code_pure.sol | 2 +- .../external_hash_known_code_state.sol | 2 +- .../external_hash_known_code_state_reentrancy.sol | 2 +- ...nal_hash_known_code_state_reentrancy_indirect.sol | 6 ++---- ...ernal_hash_known_code_state_reentrancy_unsafe.sol | 6 ++---- .../external_hash_known_code_state_unsafe.sol | 4 ++-- .../functions/constructor_hierarchy.sol | 2 +- .../functions/constructor_hierarchy_2.sol | 2 +- .../functions/constructor_hierarchy_3.sol | 2 +- .../functions/constructor_hierarchy_diamond.sol | 2 +- .../functions/constructor_hierarchy_diamond_2.sol | 2 +- .../functions/constructor_hierarchy_diamond_3.sol | 2 +- .../constructor_hierarchy_diamond_empty_middle.sol | 2 +- .../functions/constructor_hierarchy_empty_chain.sol | 2 +- .../functions/constructor_hierarchy_empty_middle.sol | 2 +- ...structor_hierarchy_empty_middle_no_invocation.sol | 2 +- .../functions/constructor_hierarchy_mixed_chain.sol | 2 +- .../constructor_hierarchy_mixed_chain_local_vars.sol | 2 +- ...constructor_hierarchy_mixed_chain_with_params.sol | 2 +- ...nstructor_hierarchy_mixed_chain_with_params_2.sol | 3 +-- .../functions/constructor_hierarchy_modifier.sol | 2 +- .../functions/constructor_hierarchy_same_var.sol | 4 ++-- .../smtCheckerTests/functions/constructor_simple.sol | 2 +- .../functions/constructor_state_value.sol | 2 +- .../functions/constructor_state_value_inherited.sol | 2 +- .../functions/constructor_state_value_parameter.sol | 2 +- .../internal_call_with_assertion_1_fail.sol | 12 +++++------- ...ternal_call_with_assertion_inheritance_1_fail.sol | 7 ++----- ...internal_multiple_calls_with_assertion_1_fail.sol | 6 +++--- ...constructor_hierarchy_mixed_chain_with_params.sol | 2 +- .../inheritance/constructor_state_variable_init.sol | 2 +- .../constructor_state_variable_init_base.sol | 2 +- .../constructor_state_variable_init_chain.sol | 2 +- ...nstructor_state_variable_init_chain_alternate.sol | 2 +- ...constructor_state_variable_init_chain_run_all.sol | 2 +- ...nstructor_state_variable_init_chain_run_all_2.sol | 2 +- .../constructor_state_variable_init_diamond.sol | 2 +- ...onstructor_state_variable_init_diamond_middle.sol | 2 +- test/libsolidity/smtCheckerTests/special/many.sol | 7 ++----- 44 files changed, 59 insertions(+), 72 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol index d7fc43fc44db..bb9d37c0fb8f 100644 --- a/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/pop_constructor_unsafe.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// Warning 2529: (76-83): Empty array "pop" detected here. +// Warning 2529: (76-83): Empty array "pop" detected here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol index a85638189d8c..7827950d1d45 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_1_fail.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning 4661: (113-139): Assertion violation happens here -// Warning 4661: (143-189): Assertion violation happens here +// Warning 6328: (113-139): Assertion violation happens here +// Warning 6328: (143-189): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol index 3d22b862a543..cfcbbfa68594 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_push_no_args_2_fail.sol @@ -10,6 +10,6 @@ contract C { } } // ---- -// Warning 4661: (122-148): Assertion violation happens here -// Warning 4661: (202-218): Assertion violation happens here -// Warning 4661: (222-278): Assertion violation happens here +// Warning 6328: (122-148): Assertion violation happens here +// Warning 6328: (202-218): Assertion violation happens here +// Warning 6328: (222-278): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol index 527d06534bdd..721c4a8ba66b 100644 --- a/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/storage_pointer_push_1.sol @@ -15,4 +15,4 @@ contract C { } } // ---- -// Warning 4661: (184-213): Assertion violation happens here +// Warning 6328: (184-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol index f98b1fc8e626..322af8129806 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash.sol @@ -26,4 +26,4 @@ contract C { } } // ---- -// Warning 4661: (423-445): Assertion violation happens here +// Warning 6328: (423-445): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol index 8e0adad374f3..510950f414e2 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_pure.sol @@ -28,4 +28,4 @@ contract C { } } // ---- -// Warning 4661: (431-453): Assertion violation happens here +// Warning 6328: (431-453): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol index 2a2e79328bd3..cd24a87fd2ba 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol @@ -34,5 +34,5 @@ contract C { } } // ---- +// Warning 6328: (528-565): Assertion violation happens here // Warning 5084: (544-554): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (528-565): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol index e862a8e9e8b9..fd2198fe5aa0 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy.sol @@ -29,4 +29,4 @@ contract C { } } // ---- -// Warning 4661: (299-313): Assertion violation happens here +// Warning 6328: (299-313): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol index 4b1ac0f33498..698a6c647219 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_indirect.sol @@ -42,8 +42,6 @@ contract C { } } // ---- -// Warning 6328: (459-473): Assertion violation happens here -// Warning 6328: (477-503): Assertion violation happens here +// Warning 6328: (452-466): Assertion violation happens here +// Warning 6328: (470-496): Assertion violation happens here // Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (452-466): Assertion violation happens here -// Warning 4661: (470-496): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol index bc1673147c24..74c71e398ac3 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_reentrancy_unsafe.sol @@ -34,8 +34,6 @@ contract C { } } // ---- -// Warning 6328: (388-402): Assertion violation happens here -// Warning 6328: (406-432): Assertion violation happens here +// Warning 6328: (381-395): Assertion violation happens here +// Warning 6328: (399-425): Assertion violation happens here // Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (381-395): Assertion violation happens here -// Warning 4661: (399-425): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol index 5465eb57b67b..c37614fd677b 100644 --- a/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol +++ b/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state_unsafe.sol @@ -38,6 +38,6 @@ contract C { } } // ---- -// Warning 4661: (435-461): Assertion violation happens here +// Warning 6328: (435-461): Assertion violation happens here +// Warning 6328: (594-631): Assertion violation happens here // Warning 5084: (610-620): Type conversion is not yet fully supported and might yield false positives. -// Warning 4661: (594-631): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol index fd7c9663bb0c..f2d408cd6354 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy.sol @@ -13,4 +13,4 @@ contract A is C { } } // ---- -// Warning 4661: (152-166): Assertion violation happens here +// Warning 6328: (152-166): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol index 126f5b745bd1..88c7722e4756 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_2.sol @@ -4,4 +4,4 @@ contract A is C { constructor() C(2) { assert(a == 2); } } contract B is C { constructor() C(3) { assert(a == 3); } } contract J is C { constructor() C(3) { assert(a == 4); } } // ---- -// Warning 4661: (243-257): Assertion violation happens here +// Warning 6328: (243-257): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol index 6b59b98297b7..b5017761947f 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_3.sol @@ -19,6 +19,6 @@ contract A is B { } } // ---- +// Warning 6328: (232-250): Assertion violation happens here // Warning 2661: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (244-249): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (232-250): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol index 1e3166920da0..29c2d41b2eef 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond.sol @@ -25,7 +25,7 @@ contract A is B2, B1 { } } // ---- +// Warning 6328: (302-320): Assertion violation happens here // Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (314-319): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (302-320): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol index 0ec12ffac84b..83cb5dc64c08 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_2.sol @@ -25,7 +25,7 @@ contract A is B2, B1 { } } // ---- +// Warning 6328: (302-320): Assertion violation happens here // Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (200-205): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (314-319): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (302-320): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol index 9f5d6d40254d..cdd479268fa7 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_3.sol @@ -27,6 +27,7 @@ contract A is B2, B1 { } } // ---- +// Warning 6328: (334-350): Assertion violation happens here // Warning 4144: (160-165): Underflow (resulting value less than 0) happens here // Warning 2661: (160-165): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (225-230): Overflow (resulting value larger than 2**256 - 1) happens here @@ -34,4 +35,3 @@ contract A is B2, B1 { // Warning 2661: (225-230): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (241-246): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (160-165): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (334-350): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol index 64acae43731f..64f0482f8e85 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_diamond_empty_middle.sol @@ -20,4 +20,4 @@ contract A is B, B2 { } // ---- // Warning 5667: (164-170): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (194-208): Assertion violation happens here +// Warning 6328: (194-208): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol index 6cb0cd8ab4b8..d694b191ae3e 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_chain.sol @@ -19,4 +19,4 @@ contract A is B { } // ---- // Warning 5667: (194-200): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (224-238): Assertion violation happens here +// Warning 6328: (224-238): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol index 40a67ce2fee1..c89cad884fb3 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle.sol @@ -17,4 +17,4 @@ contract A is B { } // ---- // Warning 5667: (138-144): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (172-186): Assertion violation happens here +// Warning 6328: (172-186): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol index a3891d3bd76a..a5ac97344587 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_empty_middle_no_invocation.sol @@ -16,4 +16,4 @@ contract A is B { } // ---- // Warning 5667: (138-144): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (150-164): Assertion violation happens here +// Warning 6328: (150-164): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol index ae93d962a502..a5962165abdc 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain.sol @@ -27,4 +27,4 @@ contract A is B { } // ---- // Warning 5667: (254-260): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (284-298): Assertion violation happens here +// Warning 6328: (284-298): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol index b595f795139f..72f849db3372 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_local_vars.sol @@ -32,4 +32,4 @@ contract A is B { } // ---- // Warning 5667: (296-302): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (357-372): Assertion violation happens here +// Warning 6328: (357-372): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol index 60c3ce9efc6a..223703be4607 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params.sol @@ -25,6 +25,6 @@ contract A is B { } } // ---- +// Warning 6328: (328-342): Assertion violation happens here // Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (328-342): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol index 291636786710..685be3b96ed8 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_mixed_chain_with_params_2.sol @@ -23,5 +23,4 @@ contract B is C { contract A is B { } // ---- -// Warning 4661: (266-280): Assertion violation happens here -// Warning 4661: (266-280): Assertion violation happens here +// Warning 6328: (266-280): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol index 6a15e4e93c97..8a67b7a8b151 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_modifier.sol @@ -14,4 +14,4 @@ contract A is C { } } // ---- -// Warning 4661: (188-202): Assertion violation happens here +// Warning 6328: (188-202): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol index daa89fe0a869..f91439b7775c 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_hierarchy_same_var.sol @@ -13,5 +13,5 @@ contract A is C { } } // ---- -// Warning 4661: (134-148): Assertion violation happens here -// Warning 4661: (152-168): Assertion violation happens here +// Warning 6328: (134-148): Assertion violation happens here +// Warning 6328: (152-168): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol index cb8e7b560127..79fbb271429a 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_simple.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning 4661: (141-155): Assertion violation happens here +// Warning 6328: (141-155): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol index f1657cddd1ab..e674dc70dd7c 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value.sol @@ -13,4 +13,4 @@ contract C { } } // ---- -// Warning 4661: (145-159): Assertion violation happens here +// Warning 6328: (145-159): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol index 5b0c2b11a79b..e3b765264925 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_inherited.sol @@ -15,4 +15,4 @@ contract C is B { } } // ---- -// Warning 4661: (165-179): Assertion violation happens here +// Warning 6328: (165-179): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol index 19a36a7c0f1a..106e60440960 100644 --- a/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol +++ b/test/libsolidity/smtCheckerTests/functions/constructor_state_value_parameter.sol @@ -13,5 +13,5 @@ contract C { } } // ---- -// Warning 4661: (162-176): Assertion violation happens here +// Warning 6328: (162-176): Assertion violation happens here // Warning 2661: (115-120): Overflow (resulting value larger than 2**256 - 1) happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol index f704de56caee..33fc53e4fc4b 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol @@ -21,12 +21,10 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (138-152): Assertion violation happens here +// Warning 6328: (138-152): Assertion violation happens here +// Warning 6328: (170-184): Assertion violation happens here +// Warning 6328: (220-234): Assertion violation happens here +// Warning 6328: (245-259): Assertion violation happens here +// Warning 6328: (82-96): Assertion violation happens here // Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (220-234): Assertion violation happens here -// Warning 4661: (245-259): Assertion violation happens here -// Warning 4661: (170-184): Assertion violation happens here -// Warning 4661: (220-234): Assertion violation happens here // Warning 4144: (238-241): Underflow (resulting value less than 0) happens here -// Warning 4661: (245-259): Assertion violation happens here -// Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol index a4550dc614ba..d07c1146566e 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol @@ -18,10 +18,7 @@ contract C is A { } // ---- // Warning 6328: (82-96): Assertion violation happens here -// Warning 6328: (155-169): Assertion violation happens here -// Warning 6328: (187-201): Assertion violation happens here +// Warning 6328: (148-162): Assertion violation happens here +// Warning 6328: (180-194): Assertion violation happens here // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here // Warning 4144: (100-103): Underflow (resulting value less than 0) happens here -// Warning 4661: (148-162): Assertion violation happens here -// Warning 4661: (82-96): Assertion violation happens here -// Warning 4661: (180-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol index f3fda1b8a070..2c86472897de 100644 --- a/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol @@ -21,10 +21,10 @@ contract C{ } // ---- // Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning 4661: (138-152): Assertion violation happens here +// Warning 6328: (138-152): Assertion violation happens here +// Warning 6328: (184-198): Assertion violation happens here +// Warning 6328: (82-96): Assertion violation happens here // Warning 2661: (156-159): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (234-237): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (184-198): Assertion violation happens here // Warning 4144: (234-237): Underflow (resulting value less than 0) happens here -// Warning 4661: (82-96): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol index 60c3ce9efc6a..223703be4607 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_hierarchy_mixed_chain_with_params.sol @@ -25,6 +25,6 @@ contract A is B { } } // ---- +// Warning 6328: (328-342): Assertion violation happens here // Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (247-252): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (328-342): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol index ccb9a93864f0..2cb40b5e9dc2 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning 4661: (97-111): Assertion violation happens here +// Warning 6328: (97-111): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol index 876616fa719a..26e2df7b15bb 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_base.sol @@ -11,4 +11,4 @@ contract D is C { } } // ---- -// Warning 4661: (117-131): Assertion violation happens here +// Warning 6328: (117-131): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol index fac5f2545400..2c43fb29de76 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain.sol @@ -19,4 +19,4 @@ contract D is C { } } // ---- -// Warning 4661: (211-225): Assertion violation happens here +// Warning 6328: (211-225): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol index bba7fc27b60a..fd04c33e96b3 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_alternate.sol @@ -18,4 +18,4 @@ contract D is C { } } // ---- -// Warning 4661: (185-199): Assertion violation happens here +// Warning 6328: (185-199): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol index 0f391dac3ef2..a9323fdbc40b 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all.sol @@ -22,6 +22,7 @@ contract A is B { } // ---- +// Warning 6328: (275-293): Assertion violation happens here // Warning 4144: (157-162): Underflow (resulting value less than 0) happens here // Warning 2661: (157-162): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (216-221): Overflow (resulting value larger than 2**256 - 1) happens here @@ -30,4 +31,3 @@ contract A is B { // Warning 2661: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (261-270): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (287-292): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (275-293): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol index 5912dd855901..c0ad1b0831d4 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_chain_run_all_2.sol @@ -22,10 +22,10 @@ contract A is B { } // ---- +// Warning 6328: (273-291): Assertion violation happens here // Warning 2661: (157-163): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (157-163): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (240-245): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (262-268): Overflow (resulting value larger than 2**256 - 1) happens here // Warning 2661: (285-290): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (273-291): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol index 4841d6fa2101..49f22bad707a 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond.sol @@ -17,4 +17,4 @@ contract D is B, C { } } // ---- -// Warning 4661: (162-176): Assertion violation happens here +// Warning 6328: (162-176): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol index ba2cb9549a60..8b54f27befdd 100644 --- a/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol +++ b/test/libsolidity/smtCheckerTests/inheritance/constructor_state_variable_init_diamond_middle.sol @@ -19,4 +19,4 @@ contract D is B, C { } } // ---- -// Warning 4661: (214-228): Assertion violation happens here +// Warning 6328: (214-228): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol index 53d8cd45d0df..1fbd2f905bf4 100644 --- a/test/libsolidity/smtCheckerTests/special/many.sol +++ b/test/libsolidity/smtCheckerTests/special/many.sol @@ -21,9 +21,6 @@ contract C // Warning 6328: (208-240): Assertion violation happens here // Warning 6328: (244-275): Assertion violation happens here // Warning 6328: (304-332): Assertion violation happens here -// Warning 6328: (336-352): Assertion violation happens here -// Warning 6328: (356-379): Assertion violation happens here +// Warning 6328: (336-364): Assertion violation happens here +// Warning 6328: (368-391): Assertion violation happens here // Warning 2661: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here -// Warning 4661: (304-332): Assertion violation happens here -// Warning 4661: (336-364): Assertion violation happens here -// Warning 4661: (368-391): Assertion violation happens here From 1596ccd25d9496b8432f37b45589e2d2b7537ecd Mon Sep 17 00:00:00 2001 From: franzihei Date: Mon, 13 Jul 2020 13:12:05 +0200 Subject: [PATCH 459/479] Adds brand guide and updates team calls info Co-authored-by: Alex Beregszaszi Co-authored-by: Alex Beregszaszi Co-authored-by: Leonardo Co-authored-by: Leonardo --- docs/brand-guide.rst | 84 +++++++++++++++++++++++++++++++++++++++++++ docs/contributing.rst | 6 ++-- docs/index.rst | 1 + 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 docs/brand-guide.rst diff --git a/docs/brand-guide.rst b/docs/brand-guide.rst new file mode 100644 index 000000000000..0e6400bede7c --- /dev/null +++ b/docs/brand-guide.rst @@ -0,0 +1,84 @@ +#################### +Solidity Brand Guide +#################### + +This brand guide features information on Solidity's brand policy and +logo usage guidelines. + +The Solidity Brand +================== + +The Solidity programming language is an open-source, community project +governed by a core team. The core team is sponsored by the `Ethereum +Foundation `_. + +This document aims to provide information about how to best use the +Solidity brand name and logo. + +We encourage you to read this document carefully before using the +brand name or the logo. Your cooperation is highly appreciated! + +Solidity Brand Name +=================== + +"Solidity" should be used to refer to the Solidity programming language +solely. + +Please do not use "Solidity": + +- To refer to any other programming language. + +- In a way that is misleading or may imply association of unrelated + modules, tools, documentation, or other resources with the Solidity + programming language. + +- In ways that confuse the community as to whether the Solidity + programming language is open-source and free to use. + +Solidity Logo License +===================== + +.. image:: https://i.creativecommons.org/l/by/4.0/88x31.png + :width: 88 + :alt: Creative Commons License + +The Solidity logo is distributed and licensed under a `Creative Commons +Attribution 4.0 International License `_. + +This is the most permissive Creative Commons license and allows reuse +and modifications for any purpose. + +You are free to: + +- **Share** — Copy and redistribute the material in any medium or format. + +- **Adapt** — Remix, transform, and build upon the material for any + purpose, even commercially. + +Under the following terms: + +- **Attribution** — You must give appropriate credit, provide a link to + the license, and indicate if changes were made. You may do so in any + reasonable manner, but not in any way that suggests the the Solidity + core team endorses you or your use. + +When using the Solidity logo, please respect the Solidity logo guidelines. + +Solidity Logo Guidelines +======================== + +.. image:: logo.svg + :width: 256 + +Please do not: + +- Change the ratio of the logo (do not stretch it or cut it). + +- Change the colors of the logo, unless it is absolutely necessary. + +Credits +======= + +This document was, in parts, derived from the `Python Software +Foundation Trademark Usage Policy `_ +and the `Rust Media Guide `_. diff --git a/docs/contributing.rst b/docs/contributing.rst index 5c9f90cbde29..ab5163e11c79 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -27,10 +27,10 @@ Team Calls If you have issues or pull requests to discuss, or are interested in hearing what the team and contributors are working on, you can join our public team calls: -- Monday at 12pm CET -- Wednesday at 3pm CET +- Mondays at 12pm CET/CEST +- Wednesdays at 2pm CET/CEST -Both calls take place on `Google Hangouts `_. +Both calls take place on `Google Meet `_. How to Report Issues ==================== diff --git a/docs/index.rst b/docs/index.rst index b81140fe172d..470fc56fe465 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -137,3 +137,4 @@ Contents common-patterns.rst bugs.rst contributing.rst + brand-guide.rst From 2c574af45be346946dcef210abfe7fe0ea50a1c6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 16:16:39 +0200 Subject: [PATCH 460/479] Fix conversion bug for exp operation. --- libsolidity/codegen/ExpressionCompiler.cpp | 19 +++++++++++++++---- libsolidity/codegen/ExpressionCompiler.h | 1 + .../cleanup/exp_cleanup_smaller_base.sol | 11 +++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index f702f5cdb69f..b43e0cf9feaf 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -286,6 +286,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) m_currentLValue->storeValue(*rightIntermediateType, _assignment.location()); else // compound assignment { + solAssert(binOp != Token::Exp, "Compound exp is not possible."); solAssert(leftType.isValueType(), "Compound operators only available for value types."); unsigned lvalueSize = m_currentLValue->sizeOnStack(); unsigned itemSize = _assignment.annotation().type->sizeOnStack(); @@ -452,7 +453,10 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) bool cleanupNeeded = cleanupNeededForOp(commonType->category(), c_op); TypePointer leftTargetType = commonType; - TypePointer rightTargetType = TokenTraits::isShiftOp(c_op) ? rightExpression.annotation().type->mobileType() : commonType; + TypePointer rightTargetType = + TokenTraits::isShiftOp(c_op) || c_op == Token::Exp ? + rightExpression.annotation().type->mobileType() : + commonType; solAssert(rightTargetType, ""); // for commutative operators, push the literal as late as possible to allow improved optimization @@ -474,6 +478,8 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) if (TokenTraits::isShiftOp(c_op)) // shift only cares about the signedness of both sides appendShiftOperatorCode(c_op, *leftTargetType, *rightTargetType); + else if (c_op == Token::Exp) + appendExpOperatorCode(*leftTargetType, *rightTargetType); else if (TokenTraits::isCompareOp(c_op)) appendCompareOperatorCode(c_op, *commonType); else @@ -2080,9 +2086,6 @@ void ExpressionCompiler::appendArithmeticOperatorCode(Token _operator, Type cons m_context << (c_isSigned ? Instruction::SMOD : Instruction::MOD); break; } - case Token::Exp: - m_context << Instruction::EXP; - break; default: solAssert(false, "Unknown arithmetic operator."); } @@ -2177,6 +2180,14 @@ void ExpressionCompiler::appendShiftOperatorCode(Token _operator, Type const& _v } } +void ExpressionCompiler::appendExpOperatorCode(Type const& _valueType, Type const& _exponentType) +{ + solAssert(_valueType.category() == Type::Category::Integer, ""); + solAssert(!dynamic_cast(_exponentType).isSigned(), ""); + + m_context << Instruction::EXP; +} + void ExpressionCompiler::appendExternalFunctionCall( FunctionType const& _functionType, vector> const& _arguments, diff --git a/libsolidity/codegen/ExpressionCompiler.h b/libsolidity/codegen/ExpressionCompiler.h index c0a703d783f2..7b574b59c135 100644 --- a/libsolidity/codegen/ExpressionCompiler.h +++ b/libsolidity/codegen/ExpressionCompiler.h @@ -101,6 +101,7 @@ class ExpressionCompiler: private ASTConstVisitor void appendArithmeticOperatorCode(Token _operator, Type const& _type); void appendBitOperatorCode(Token _operator); void appendShiftOperatorCode(Token _operator, Type const& _valueType, Type const& _shiftAmountType); + void appendExpOperatorCode(Type const& _valueType, Type const& _exponentType); /// @} /// Appends code to call a function of the given type with the given arguments. diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol new file mode 100644 index 000000000000..3ef61f219084 --- /dev/null +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure returns (uint16 x) { + // tests that ``e`` is not converted to uint8 + // right before the exp + uint16 e = 0x100; + uint8 b = 0x2; + return b**e; + } +} +// ---- +// f() -> 0x00 From 5ecc84e92e6d3fe31b0b1263a24a187ae24b7507 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 27 Jul 2020 09:52:36 +0100 Subject: [PATCH 461/479] Distinguish between stringLiteral and hexStringLiteral in the JSON AST --- Changelog.md | 1 + docs/070-breaking-changes.rst | 1 + libsolidity/ast/ASTJsonConverter.cpp | 3 ++- libsolidity/ast/ASTJsonImporter.cpp | 2 ++ test/libsolidity/ASTJSON/non_utf8.json | 2 +- test/libsolidity/ASTJSON/non_utf8_legacy.json | 2 +- 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index e1e1a05d028b..e884eb3803f7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ Breaking changes: * Inline Assembly: Disallow ``.`` in user-defined function and variable names. * Inline Assembly: Slot and offset of storage pointer variable ``x`` are accessed via ``x.slot`` and ``x.offset`` instead of ``x_slot`` and ``x_offset``. + * JSON AST: Mark hex string literals with ``kind: "hexString"``. * JSON AST: Remove members with ``null`` value from JSON output. * Parser: Disallow ``gwei`` as identifier. * Parser: Disallow dot syntax for ``value`` and ``gas``. diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index df06692de3ad..2b532cf71102 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -104,6 +104,7 @@ Declarations Interface Changes ================= +* JSON AST: Mark hex string literals with ``kind: "hexString"``. * JSON AST: Members with value ``null`` are removed from JSON output. * NatSpec: Constructors and functions have consistent userdoc output. diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index d04fcbe0bd22..193d6137517a 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -919,8 +919,9 @@ string ASTJsonConverter::literalTokenKind(Token _token) case Token::Number: return "number"; case Token::StringLiteral: - case Token::HexStringLiteral: return "string"; + case Token::HexStringLiteral: + return "hexString"; case Token::TrueLiteral: case Token::FalseLiteral: return "bool"; diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index e3cb8c6fa6ab..d3b54d687094 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -943,6 +943,8 @@ Token ASTJsonImporter::literalTokenKind(Json::Value const& _node) tok = Token::Number; else if (_node["kind"].asString() == "string") tok = Token::StringLiteral; + else if (_node["kind"].asString() == "hexString") + tok = Token::HexStringLiteral; else if (_node["kind"].asString() == "bool") tok = (member(_node, "value").asString() == "true") ? Token::TrueLiteral : Token::FalseLiteral; else diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json index 5fff3241708f..98db4273fdd5 100644 --- a/test/libsolidity/ASTJSON/non_utf8.json +++ b/test/libsolidity/ASTJSON/non_utf8.json @@ -79,7 +79,7 @@ "isConstant": false, "isLValue": false, "isPure": true, - "kind": "string", + "kind": "hexString", "lValueRequested": false, "nodeType": "Literal", "src": "53:7:1", diff --git a/test/libsolidity/ASTJSON/non_utf8_legacy.json b/test/libsolidity/ASTJSON/non_utf8_legacy.json index e8d795efd88b..d9430c82d30f 100644 --- a/test/libsolidity/ASTJSON/non_utf8_legacy.json +++ b/test/libsolidity/ASTJSON/non_utf8_legacy.json @@ -130,7 +130,7 @@ "isLValue": false, "isPure": true, "lValueRequested": false, - "token": "string", + "token": "hexString", "type": "literal_string (contains invalid UTF-8 sequence at position 0)" }, "id": 5, From 0caec9d28beea1297c22c8e4f5a72a804fadec15 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 27 Jul 2020 10:40:33 +0200 Subject: [PATCH 462/479] Explain gas implications of constant and immutable variables. --- docs/contracts/constant-state-variables.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst index c5c520d336ee..33204f58d7fa 100644 --- a/docs/contracts/constant-state-variables.rst +++ b/docs/contracts/constant-state-variables.rst @@ -12,6 +12,14 @@ for ``immutable``, it can still be assigned at construction time. The compiler does not reserve a storage slot for these variables, and every occurrence is replaced by the respective value. +Compared to regular state variables, the gas costs of constant and immutable variables +are much lower. For a constant variable, the expression assigned to it is copied to +all the places where it is accessed and also re-evaluated each time. This allows for local +optimizations. Immutable variables are evaluated once at construction time and their value +is copied to all the places in the code where they are accessed. For these values, +32 bytes are reserved, even if they would fit in fewer bytes. Due to this, constant values +can sometimes be cheaper than immutable values. + Not all types for constants and immutables are implemented at this time. The only supported types are `strings `_ (only for constants) and `value types `_. From de4ae301c4091bbfdfd87ac36967ce9e9807789d Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 27 Jul 2020 12:58:39 +0200 Subject: [PATCH 463/479] [SMTChecker] Fix ICE when tuples have extra effectless parens --- Changelog.md | 1 + libsolidity/formal/SMTEncoder.cpp | 2 +- .../smtCheckerTests/types/tuple_extra_parens_1.sol | 7 +++++++ .../smtCheckerTests/types/tuple_extra_parens_2.sol | 7 +++++++ .../smtCheckerTests/types/tuple_extra_parens_3.sol | 7 +++++++ .../smtCheckerTests/types/tuple_extra_parens_4.sol | 7 +++++++ .../smtCheckerTests/types/tuple_extra_parens_5.sol | 7 +++++++ .../smtCheckerTests/types/tuple_extra_parens_6.sol | 6 ++++++ 8 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_1.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_2.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_3.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_4.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_5.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_extra_parens_6.sol diff --git a/Changelog.md b/Changelog.md index e884eb3803f7..833487d223d8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -35,6 +35,7 @@ Bugfixes: * Inheritance: Disallow public state variables overwriting ``pure`` functions. * NatSpec: Constructors and functions have consistent userdoc output. * SMTChecker: Fix internal error when assigning to a 1-tuple. + * SMTChecker: Fix internal error when tuples have extra effectless parenthesis. * State Mutability: Constant public state variables are considered ``pure`` functions. * Type Checker: Fixing deduction issues on function types when function call has named arguments. * Immutables: Fix internal compiler error when immutables are not assigned. diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index d690b2b3c2fd..22780122bd9e 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1470,7 +1470,7 @@ void SMTEncoder::assignment( void SMTEncoder::tupleAssignment(Expression const& _left, Expression const& _right) { - auto lTuple = dynamic_cast(&_left); + auto lTuple = dynamic_cast(innermostTuple(dynamic_cast(_left))); solAssert(lTuple, ""); auto const& lComponents = lTuple->components(); diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_1.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_1.sol new file mode 100644 index 000000000000..e238bd62a085 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_1.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + function f2() public pure returns(int) { + int a; + ((, a)) = (1, 2); + } +} diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_2.sol new file mode 100644 index 000000000000..30cd2608f754 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_2.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + function f2() public pure returns(int) { + int a; + (((, a),)) = ((1, 2), 3); + } +} diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_3.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_3.sol new file mode 100644 index 000000000000..84ceb4e3666c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_3.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + function f2() public pure returns(int) { + int a; + (((((((, a),)))))) = ((1, 2), 3); + } +} diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_4.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_4.sol new file mode 100644 index 000000000000..8243e938e459 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_4.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + function f2() public pure returns(int) { + int a; + ((((((, a)))),)) = ((1, 2), 3); + } +} diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_5.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_5.sol new file mode 100644 index 000000000000..2288a94cab60 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_5.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + function f2() public pure returns(int) { + int a; + ((((((((((((, a))))))),))))) = ((1, 2), 3); + } +} diff --git a/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_6.sol b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_6.sol new file mode 100644 index 000000000000..83b2db4dfacd --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_extra_parens_6.sol @@ -0,0 +1,6 @@ +pragma experimental SMTChecker; +contract C { + function f() public pure { + (((,))) = ((2),3); + } +} From e0c55d65708f47345866b178bce921197accb2de Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Mon, 27 Jul 2020 07:28:15 -0500 Subject: [PATCH 464/479] [circleci] Use hera enabled docker images. --- .circleci/config.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a48caf546b3..15bca332451b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,16 +9,20 @@ version: 2.1 parameters: ubuntu-1804-docker-image: type: string - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:4484ac3da8fdc337cc77a7a7be1af71cd0f28f9c890d934f1d6ae7532beb66b1" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu1804-2 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:9ab317e583c395e50884ba82e9f99811c374344cea4c550725be8ec836e07acc" ubuntu-2004-docker-image: type: string - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:48b5bb6b91ac7dddfe9345c88876ebed126c652258800f114caed69db73b29bf" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-2 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:cbfa42d8ecbe94391ba8837e218869242666de7a0da6ccac065a856c85b6a6a0" ubuntu-2004-clang-docker-image: type: string - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d8775de58167db5a11690fdb6ef639317fe1e579ec5d46e9732d2d903b55d135" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu2004.clang-2 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:7a4d5271b5552139d9f2caefc50d42f401bf74132cf8f253e199e11c80ab42de" ubuntu-1604-clang-ossfuzz-docker-image: type: string - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:db52f3257396814215744a19904e42c07e040ab36b68be72a27ba71ad2f1083c" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu1604.clang.ossfuzz-2 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:efaabb3c143f64171be596932c62013bcfd7f73b1fbcb832025a34dd2b6e6922" emscripten-docker-image: type: string default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d557d015918c3cf68b0d22839bab41013f0757b651a7fef21595f89721dbebcc" From f24097c38d0d27852ced412a2e4704e49a555a8c Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 27 Jul 2020 12:33:03 +0200 Subject: [PATCH 465/479] Fix internal error for invalid data location in constructor. --- libsolidity/analysis/DeclarationTypeChecker.cpp | 4 +++- .../syntaxTests/constructor/calldata_constructor_args.sol | 2 +- .../syntaxTests/dataLocations/unspecified_constructor.sol | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/syntaxTests/dataLocations/unspecified_constructor.sol diff --git a/libsolidity/analysis/DeclarationTypeChecker.cpp b/libsolidity/analysis/DeclarationTypeChecker.cpp index d3408e379184..15cbc30bae10 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.cpp +++ b/libsolidity/analysis/DeclarationTypeChecker.cpp @@ -324,7 +324,9 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable) ", ", " or " ); - if (_variable.isCallableOrCatchParameter()) + if (_variable.isConstructorParameter()) + errorString += " for constructor parameter"; + else if (_variable.isCallableOrCatchParameter()) errorString += " for " + string(_variable.isReturnParameter() ? "return " : "") + diff --git a/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol index 5562117ce203..616fbe5a8504 100644 --- a/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol +++ b/test/libsolidity/syntaxTests/constructor/calldata_constructor_args.sol @@ -2,4 +2,4 @@ contract C { constructor(uint[] calldata) public {} } // ---- -// TypeError 6651: (29-44): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. +// TypeError 6651: (29-44): Data location must be "storage" or "memory" for constructor parameter, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/unspecified_constructor.sol b/test/libsolidity/syntaxTests/dataLocations/unspecified_constructor.sol new file mode 100644 index 000000000000..040fe5266396 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/unspecified_constructor.sol @@ -0,0 +1,6 @@ +contract C { + struct S {uint x;} + constructor(S) {} +} +// ---- +// TypeError 6651: (48-49): Data location must be "storage" or "memory" for constructor parameter, but none was given. From 96258c7e753cc4097f53e9e5d7a6280f3d1c669b Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Thu, 23 Jul 2020 12:54:13 +0200 Subject: [PATCH 466/479] [Sol->Yul] Implementing bytes copying from calldata to memory. --- libsolidity/codegen/YulUtilFunctions.cpp | 23 +++++++++++++++++++ .../calldata_array_dynamic_static_dynamic.sol | 1 + .../abiEncoderV2/cleanup/dynamic_array.sol | 1 + .../abiEncoderV2/cleanup/simple_struct.sol | 1 + .../abiEncoderV2/cleanup/static_array.sol | 1 + .../calldata_bytes_array_to_memory.sol | 2 ++ .../calldata/calldata_bytes_to_memory.sol | 9 ++++++++ .../calldata_bytes_to_memory_encode.sol | 9 ++++++++ .../calldata/calldata_string_array.sol | 2 ++ .../libraries/bound_returning_calldata.sol | 2 ++ .../libraries/bound_to_calldata.sol | 2 ++ 11 files changed, 53 insertions(+) create mode 100644 test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory.sol create mode 100644 test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory_encode.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 7457f9c6bb8c..69e8a713176a 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -2406,6 +2406,29 @@ string YulUtilFunctions::conversionFunctionSpecial(Type const& _from, Type const .render(); } + if (_from.category() == Type::Category::Array && _to.category() == Type::Category::Array) + { + auto const& fromArrayType = dynamic_cast(_from); + auto const& toArrayType = dynamic_cast(_to); + + solAssert(!fromArrayType.baseType()->isDynamicallyEncoded(), ""); + solUnimplementedAssert(fromArrayType.isByteArray() && toArrayType.isByteArray(), ""); + solUnimplementedAssert(toArrayType.location() == DataLocation::Memory, ""); + solUnimplementedAssert(fromArrayType.location() == DataLocation::CallData, ""); + solUnimplementedAssert(toArrayType.isDynamicallySized(), ""); + + Whiskers templ(R"( + function (offset, length) -> converted { + converted := (length) + (offset, add(converted, 0x20), length) + } + )"); + templ("functionName", functionName); + templ("allocateMemoryArray", allocateMemoryArrayFunction(toArrayType)); + templ("copyToMemory", copyToMemoryFunction(fromArrayType.location() == DataLocation::CallData)); + return templ.render(); + } + solUnimplementedAssert( _from.category() == Type::Category::StringLiteral, "Type conversion " + _from.toString() + " -> " + _to.toString() + " not yet implemented." diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_dynamic.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_dynamic.sol index 6bb10c143661..46d1122a951e 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_dynamic.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_dynamic.sol @@ -43,6 +43,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // g() -> 32, 196, hex"eccb829a", 32, 1, 32, 32, 1, 42, hex"00000000000000000000000000000000000000000000000000000000" diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/dynamic_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/dynamic_array.sol index 2302a3a3839f..e56ff257b4e7 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/dynamic_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/dynamic_array.sol @@ -14,6 +14,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // f(uint256[]): 0x20, 2, 1, 1 -> 0x20, 0x84, hex"304a4c23", 0x20, 2, 1, 1, hex"00000000000000000000000000000000000000000000000000000000" diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/simple_struct.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/simple_struct.sol index e36a600b2dd7..2a2327c082c0 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/simple_struct.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/simple_struct.sol @@ -16,6 +16,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // f(uint256,bytes32): 1, left(0x01) -> 0x20, 0x44, hex"b63240b0", 1, left(0x01), hex"00000000000000000000000000000000000000000000000000000000" diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/static_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/static_array.sol index 35a5ed9de75a..d353fda9570b 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/static_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/static_array.sol @@ -15,6 +15,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // f(uint256,uint256): 1, 1 -> 0x20, 0x44, hex"78b86ac6", 1, 1, hex"00000000000000000000000000000000000000000000000000000000" diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_array_to_memory.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_array_to_memory.sol index 04b2ed15d541..d67a24741ac9 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_bytes_array_to_memory.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_array_to_memory.sol @@ -10,6 +10,8 @@ contract C { return (a.length, m.length, m); } } +// ==== +// compileViaYul: also // ---- // f(bytes[]): 0x20, 0x1, 0x20, 0x2, hex"6162000000000000000000000000000000000000000000000000000000000000" -> 0x1, 0x2, 0x60, 0x2, hex"6162000000000000000000000000000000000000000000000000000000000000" // f(bytes[]): 0x20, 0x1, 0x20, 0x20, hex"7878787878787878787878787878787878787878787878787878787878787878" -> 0x1, 0x20, 0x60, 0x20, hex"7878787878787878787878787878787878787878787878787878787878787878" diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory.sol new file mode 100644 index 000000000000..ca6a444d8029 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory.sol @@ -0,0 +1,9 @@ +contract C { + function f(bytes calldata data) external returns (bytes32) { + return keccak256(bytes(data)); + } +} +// ==== +// compileViaYul: also +// ---- +// f(bytes): 0x20, 0x08, "abcdefgh" -> 0x48624fa43c68d5c552855a4e2919e74645f683f5384f72b5b051b71ea41d4f2d diff --git a/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory_encode.sol b/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory_encode.sol new file mode 100644 index 000000000000..4bb97779c940 --- /dev/null +++ b/test/libsolidity/semanticTests/calldata/calldata_bytes_to_memory_encode.sol @@ -0,0 +1,9 @@ +contract C { + function f(bytes calldata data) external returns (bytes memory) { + return abi.encode(bytes(data)); + } +} +// ==== +// compileViaYul: also +// ---- +// f(bytes): 0x20, 0x08, "abcdefgh" -> 0x20, 0x60, 0x20, 8, 44048183304486788309563647967830685498285570828042699209880294173606615711744 diff --git a/test/libsolidity/semanticTests/calldata/calldata_string_array.sol b/test/libsolidity/semanticTests/calldata/calldata_string_array.sol index ae7d1e2ef804..62459505b97d 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_string_array.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_string_array.sol @@ -11,5 +11,7 @@ contract C { return (a.length, m1.length, uint8(m1[0]), s1); } } +// ==== +// compileViaYul: also // ---- // f(string[]): 0x20, 0x1, 0x20, 0x2, hex"6162000000000000000000000000000000000000000000000000000000000000" -> 1, 2, 97, 0x80, 2, "ab" diff --git a/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol index 7451e9dc486d..867fb7e8c5ed 100644 --- a/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol +++ b/test/libsolidity/semanticTests/libraries/bound_returning_calldata.sol @@ -13,5 +13,7 @@ contract C { return (_x.f()[0], _x.g()[0]); } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol index 0e9bb811b3ac..300fa881246f 100644 --- a/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol +++ b/test/libsolidity/semanticTests/libraries/bound_to_calldata.sol @@ -13,5 +13,7 @@ contract C { return (_x.f(), _x.g()); } } +// ==== +// compileViaYul: also // ---- // f(bytes): 0x20, 4, "abcd" -> 0x6100000000000000000000000000000000000000000000000000000000000000, 0x6100000000000000000000000000000000000000000000000000000000000000 From b207222af784ce4968e178602a3924aabb13f463 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 27 Jul 2020 17:14:59 +0200 Subject: [PATCH 467/479] Fix extra parens --- libsolidity/formal/SMTEncoder.cpp | 12 ++++++++---- .../smtCheckerTests/types/tuple_array_pop_1.sol | 7 +++++++ .../smtCheckerTests/types/tuple_array_pop_2.sol | 7 +++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol create mode 100644 test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 22780122bd9e..b101a3147406 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1100,7 +1100,11 @@ void SMTEncoder::arrayPop(FunctionCall const& _funCall) void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression const& _array) { - if (auto const* id = dynamic_cast(&_expr)) + Expression const* expr = &_expr; + if (auto const* tupleExpr = dynamic_cast(expr)) + expr = innermostTuple(*tupleExpr); + + if (auto const* id = dynamic_cast(expr)) { auto varDecl = identifierToVariable(*id); solAssert(varDecl, ""); @@ -1108,9 +1112,9 @@ void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression resetReferences(*varDecl); m_context.addAssertion(m_context.newValue(*varDecl) == _array); } - else if (auto const* indexAccess = dynamic_cast(&_expr)) + else if (auto const* indexAccess = dynamic_cast(expr)) arrayIndexAssignment(*indexAccess, _array); - else if (auto const* funCall = dynamic_cast(&_expr)) + else if (auto const* funCall = dynamic_cast(expr)) { FunctionType const& funType = dynamic_cast(*funCall->expression().annotation().type); if (funType.kind() == FunctionType::Kind::ArrayPush) @@ -1132,7 +1136,7 @@ void SMTEncoder::arrayPushPopAssign(Expression const& _expr, smtutil::Expression arrayPushPopAssign(memberAccess->expression(), symbArray->currentValue()); } } - else if (dynamic_cast(&_expr)) + else if (dynamic_cast(expr)) m_errorReporter.warning( 9599_error, _expr.location(), diff --git a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol new file mode 100644 index 000000000000..e297cffd733e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + int[] a; + function f() public { (a).pop();} +} +// ---- +// Warning 2529: (78-87): Empty array "pop" detected here. diff --git a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol new file mode 100644 index 000000000000..76c8e3cb3312 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol @@ -0,0 +1,7 @@ +pragma experimental SMTChecker; +contract C { + int[] a; + function f() public { (((((a))))).pop();} +} +// ---- +// Warning 2529: (78-95): Empty array "pop" detected here. From 375cb1032a4bba24878a1da693fe1431331e6d91 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 27 Jul 2020 18:57:23 +0200 Subject: [PATCH 468/479] More parallelism for clang build. --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a48caf546b3..efc6e52df9d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -385,11 +385,13 @@ jobs: - run: *run_docs_pragma_min_version b_ubu_clang: &build_ubuntu2004_clang + resource_class: xlarge docker: - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> environment: CC: clang CXX: clang++ + MAKEFLAGS: -j 10 steps: - checkout - run: *run_build From 8abc1a686381c44afc5970b8e1d15fdd70f598d1 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 15 Jul 2020 15:06:43 +0100 Subject: [PATCH 469/479] Check for invalid ASCII in the scanner --- Changelog.md | 1 + liblangutil/Scanner.cpp | 9 +++++++++ liblangutil/Scanner.h | 1 + 3 files changed, 11 insertions(+) diff --git a/Changelog.md b/Changelog.md index 833487d223d8..5d78caeba8a8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Breaking changes: * JSON AST: Remove members with ``null`` value from JSON output. * Parser: Disallow ``gwei`` as identifier. * Parser: Disallow dot syntax for ``value`` and ``gas``. + * Parser: Disallow non-printable characters in string literals. * Parser: NatSpec comments on variables are only allowed for public state variables. * Parser: Remove the ``finney`` and ``szabo`` denominations. * Parser: Remove the identifier ``now`` (replaced by ``block.timestamp``). diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index 64821ecb514a..e526abb35877 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -73,6 +73,7 @@ string to_string(ScannerError _errorCode) case ScannerError::IllegalHexDigit: return "Hexadecimal digit missing or invalid."; case ScannerError::IllegalCommentTerminator: return "Expected multi-line comment-terminator."; case ScannerError::IllegalEscapeSequence: return "Invalid escape sequence."; + case ScannerError::IllegalCharacterInString: return "Invalid character in string."; case ScannerError::IllegalStringEndQuote: return "Expected string end-quote."; case ScannerError::IllegalNumberSeparator: return "Invalid use of number separator '_'."; case ScannerError::IllegalExponent: return "Invalid exponent."; @@ -789,7 +790,15 @@ Token Scanner::scanString() return setError(ScannerError::IllegalEscapeSequence); } else + { + // Report error on non-printable characters in string literals. + // + // We are using a manual range and not isprint() to avoid + // any potential complications with locale. + if (static_cast(c) <= 0x1f || static_cast(c) >= 0x7f) + return setError(ScannerError::IllegalCharacterInString); addLiteralChar(c); + } } if (m_char != quote) return setError(ScannerError::IllegalStringEndQuote); diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h index 5e613cfdff2c..e72ac3ba566c 100644 --- a/liblangutil/Scanner.h +++ b/liblangutil/Scanner.h @@ -77,6 +77,7 @@ enum class ScannerError IllegalHexDigit, IllegalCommentTerminator, IllegalEscapeSequence, + IllegalCharacterInString, IllegalStringEndQuote, IllegalNumberSeparator, IllegalExponent, From 5bfcc1ffccc5bff055f521aed81f3f740785fa34 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 20 Jul 2020 19:03:40 +0100 Subject: [PATCH 470/479] Update tests for string literals --- test/libsolidity/SolidityScanner.cpp | 39 +++++++++++++++++++ .../syntaxTests/string/string_unicode.sol | 1 + 2 files changed, 40 insertions(+) diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 5b83778bacbc..7d5480fb84c6 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -81,6 +81,45 @@ BOOST_AUTO_TEST_CASE(assembly_multiple_assign) BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } +BOOST_AUTO_TEST_CASE(string_printable) +{ + for (unsigned v = 0x20; v < 0x7e; v++) { + string lit{static_cast(v)}; + // Escape \ and " (since we are quoting with ") + if (v == '\\' || v == '"') + lit = string{'\\'} + lit; + Scanner scanner(CharStream(" { \"" + lit + "\"", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), string{static_cast(v)}); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); + } + // Special case of unescaped " for strings quoted with ' + Scanner scanner(CharStream(" { '\"'", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "\""); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); +} + +BOOST_AUTO_TEST_CASE(string_nonprintable) +{ + for (unsigned v = 0; v < 0xff; v++) { + // Skip the valid ones + if (v >= 0x20 && v <= 0x7e) + continue; + string lit{static_cast(v)}; + Scanner scanner(CharStream(" { \"" + lit + "\"", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal); + if (v == '\n' || v == '\v' || v == '\f' || v == '\r') + BOOST_CHECK_EQUAL(scanner.currentError(), ScannerError::IllegalStringEndQuote); + else + BOOST_CHECK_EQUAL(scanner.currentError(), ScannerError::IllegalCharacterInString); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), ""); + } +} + BOOST_AUTO_TEST_CASE(string_escapes) { Scanner scanner(CharStream(" { \"a\\x61\"", "")); diff --git a/test/libsolidity/syntaxTests/string/string_unicode.sol b/test/libsolidity/syntaxTests/string/string_unicode.sol index 380ad9e39d60..a204e84e5ecc 100644 --- a/test/libsolidity/syntaxTests/string/string_unicode.sol +++ b/test/libsolidity/syntaxTests/string/string_unicode.sol @@ -4,3 +4,4 @@ contract test { } } // ---- +// ParserError 8936: (86-88): Invalid character in string. From 6fe8e63eeef902c9811bda6c169e2322d08b54f9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 14 Jul 2020 15:08:23 +0100 Subject: [PATCH 471/479] Remove inconsistently used isValidUTF8 helper --- libsolidity/ast/Types.cpp | 7 +------ libsolidity/ast/Types.h | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 9dd3cd5e9568..ebe935502933 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1408,7 +1408,7 @@ BoolResult StringLiteralType::isImplicitlyConvertibleTo(Type const& _convertTo) return arrayType->isByteArray() && !(arrayType->dataStoredIn(DataLocation::Storage) && arrayType->isPointer()) && - !(arrayType->isString() && !isValidUTF8()); + !(arrayType->isString() && !util::validateUTF8(value())); else return false; } @@ -1442,11 +1442,6 @@ TypePointer StringLiteralType::mobileType() const return TypeProvider::stringMemory(); } -bool StringLiteralType::isValidUTF8() const -{ - return util::validateUTF8(m_value); -} - FixedBytesType::FixedBytesType(unsigned _bytes): m_bytes(_bytes) { solAssert( diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 938b3f886587..9b32475cab46 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -629,8 +629,6 @@ class StringLiteralType: public Type std::string toString(bool) const override; TypePointer mobileType() const override; - bool isValidUTF8() const; - std::string const& value() const { return m_value; } protected: From 6eb60bc8cd2178ef30698dbf2cc8276679ebbcd6 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 2 Jul 2020 17:39:04 +0100 Subject: [PATCH 472/479] Add check that regular and unicode string literals are well formatted --- Changelog.md | 1 + liblangutil/Scanner.cpp | 24 +++++++++++++++++++----- liblangutil/Scanner.h | 2 +- liblangutil/Token.h | 2 ++ libsolidity/analysis/SyntaxChecker.cpp | 11 ++++++++++- libsolidity/ast/ASTJsonConverter.cpp | 2 ++ libsolidity/ast/ASTJsonImporter.cpp | 2 ++ libsolidity/ast/TypeProvider.cpp | 1 + libsolidity/parsing/Parser.cpp | 1 + 9 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 5d78caeba8a8..7541aad9cdee 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Breaking changes: * Parser: Disallow ``gwei`` as identifier. * Parser: Disallow dot syntax for ``value`` and ``gas``. * Parser: Disallow non-printable characters in string literals. + * Parser: Introduce Unicode string literals: ``unicode"😃"``. * Parser: NatSpec comments on variables are only allowed for public state variables. * Parser: Remove the ``finney`` and ``szabo`` denominations. * Parser: Remove the identifier ``now`` (replaced by ``block.timestamp``). diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index e526abb35877..3e125f04e842 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -509,7 +509,7 @@ void Scanner::scanToken() { case '"': case '\'': - token = scanString(); + token = scanString(false); break; case '<': // < <= << <<= @@ -684,6 +684,18 @@ void Scanner::scanToken() else token = setError(ScannerError::IllegalToken); } + else if (token == Token::Unicode) + { + // reset + m = 0; + n = 0; + + // Special quoted hex string must follow + if (m_char == '"' || m_char == '\'') + token = scanString(true); + else + token = setError(ScannerError::IllegalToken); + } } else if (isDecimalDigit(m_char)) token = scanNumber(); @@ -775,7 +787,7 @@ bool Scanner::isUnicodeLinebreak() return false; } -Token Scanner::scanString() +Token Scanner::scanString(bool const _isUnicode) { char const quote = m_char; advance(); // consume quote @@ -791,11 +803,13 @@ Token Scanner::scanString() } else { - // Report error on non-printable characters in string literals. + // Report error on non-printable characters in string literals, however + // allow anything for unicode string literals, because their validity will + // be verified later (in the syntax checker). // // We are using a manual range and not isprint() to avoid // any potential complications with locale. - if (static_cast(c) <= 0x1f || static_cast(c) >= 0x7f) + if (!_isUnicode && (static_cast(c) <= 0x1f || static_cast(c) >= 0x7f)) return setError(ScannerError::IllegalCharacterInString); addLiteralChar(c); } @@ -804,7 +818,7 @@ Token Scanner::scanString() return setError(ScannerError::IllegalStringEndQuote); literal.complete(); advance(); // consume quote - return Token::StringLiteral; + return _isUnicode ? Token::UnicodeStringLiteral : Token::StringLiteral; } Token Scanner::scanHexString() diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h index e72ac3ba566c..24ec098abd89 100644 --- a/liblangutil/Scanner.h +++ b/liblangutil/Scanner.h @@ -229,7 +229,7 @@ class Scanner Token scanNumber(char _charSeen = 0); std::tuple scanIdentifierOrKeyword(); - Token scanString(); + Token scanString(bool const _isUnicode); Token scanHexString(); /// Scans a single line comment and returns its corrected end position. size_t scanSingleLineDocComment(); diff --git a/liblangutil/Token.h b/liblangutil/Token.h index 0daceb68d143..366c354cd73b 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -190,6 +190,7 @@ namespace solidity::langutil K(Throw, "throw", 0) \ K(Try, "try", 0) \ K(Type, "type", 0) \ + K(Unicode, "unicode", 0) \ K(Using, "using", 0) \ K(View, "view", 0) \ K(Virtual, "virtual", 0) \ @@ -227,6 +228,7 @@ namespace solidity::langutil K(FalseLiteral, "false", 0) \ T(Number, nullptr, 0) \ T(StringLiteral, nullptr, 0) \ + T(UnicodeStringLiteral, nullptr, 0) \ T(HexStringLiteral, nullptr, 0) \ T(CommentLiteral, nullptr, 0) \ \ diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 7f27e11ab547..c0380ffe56c9 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -28,6 +28,8 @@ #include #include +#include + #include #include @@ -37,7 +39,7 @@ using namespace std; using namespace solidity; using namespace solidity::langutil; using namespace solidity::frontend; - +using namespace solidity::util; bool SyntaxChecker::checkSyntax(ASTNode const& _astRoot) { @@ -217,6 +219,13 @@ bool SyntaxChecker::visit(Throw const& _throwStatement) bool SyntaxChecker::visit(Literal const& _literal) { + if ((_literal.token() == Token::UnicodeStringLiteral) && !validateUTF8(_literal.value())) + m_errorReporter.syntaxError( + 8452_error, + _literal.location(), + "Invalid UTF-8 sequence found" + ); + if (_literal.token() != Token::Number) return true; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 193d6137517a..5403b05c575e 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -920,6 +920,8 @@ string ASTJsonConverter::literalTokenKind(Token _token) return "number"; case Token::StringLiteral: return "string"; + case Token::UnicodeStringLiteral: + return "unicodeString"; case Token::HexStringLiteral: return "hexString"; case Token::TrueLiteral: diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index d3b54d687094..2d1fda322b64 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -943,6 +943,8 @@ Token ASTJsonImporter::literalTokenKind(Json::Value const& _node) tok = Token::Number; else if (_node["kind"].asString() == "string") tok = Token::StringLiteral; + else if (_node["kind"].asString() == "unicodeString") + tok = Token::UnicodeStringLiteral; else if (_node["kind"].asString() == "hexString") tok = Token::HexStringLiteral; else if (_node["kind"].asString() == "bool") diff --git a/libsolidity/ast/TypeProvider.cpp b/libsolidity/ast/TypeProvider.cpp index c7ef3cfbd93b..3a06b2339216 100644 --- a/libsolidity/ast/TypeProvider.cpp +++ b/libsolidity/ast/TypeProvider.cpp @@ -349,6 +349,7 @@ TypePointer TypeProvider::forLiteral(Literal const& _literal) case Token::Number: return rationalNumber(_literal); case Token::StringLiteral: + case Token::UnicodeStringLiteral: case Token::HexStringLiteral: return stringLiteral(_literal.value()); default: diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 16ed2ae375c5..cfb7de46eea1 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1782,6 +1782,7 @@ ASTPointer Parser::parsePrimaryExpression() } break; case Token::StringLiteral: + case Token::UnicodeStringLiteral: case Token::HexStringLiteral: { string literal = m_scanner->currentLiteral(); From f5f86779b8449644ddab4c25ecb238316b4cf9e3 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 13 Jul 2020 21:11:42 +0100 Subject: [PATCH 473/479] Update tests for unicode literals --- test/cmdlineTests/message_format_utf8/err | 17 +- .../message_format_utf8/input.sol | 8 +- test/libsolidity/ASTJSON/string.json | 131 ++++++++++++++ test/libsolidity/ASTJSON/string.sol | 3 + test/libsolidity/ASTJSON/string_legacy.json | 165 ++++++++++++++++++ test/libsolidity/ASTJSON/unicode.json | 131 ++++++++++++++ test/libsolidity/ASTJSON/unicode.sol | 3 + test/libsolidity/ASTJSON/unicode_legacy.json | 165 ++++++++++++++++++ test/libsolidity/SolidityScanner.cpp | 21 +++ .../semanticTests/strings/unicode_string.sol | 7 +- .../semanticTests/types/strings.sol | 4 + .../string/large_utf8_codepoint.sol | 1 + .../syntaxTests/string/string_ascii.sol | 9 + .../string/string_multipart_unicode.sol | 7 + .../string/string_multipart_unicode_mixed.sol | 8 + .../syntaxTests/string/string_unicode.sol | 3 +- .../string/string_unicode_without_prefix.sol | 7 + .../string/unicode_escape_literals.sol | 1 + 18 files changed, 676 insertions(+), 15 deletions(-) create mode 100644 test/libsolidity/ASTJSON/string.json create mode 100644 test/libsolidity/ASTJSON/string.sol create mode 100644 test/libsolidity/ASTJSON/string_legacy.json create mode 100644 test/libsolidity/ASTJSON/unicode.json create mode 100644 test/libsolidity/ASTJSON/unicode.sol create mode 100644 test/libsolidity/ASTJSON/unicode_legacy.json create mode 100644 test/libsolidity/syntaxTests/string/string_ascii.sol create mode 100644 test/libsolidity/syntaxTests/string/string_multipart_unicode.sol create mode 100644 test/libsolidity/syntaxTests/string/string_multipart_unicode_mixed.sol create mode 100644 test/libsolidity/syntaxTests/string/string_unicode_without_prefix.sol diff --git a/test/cmdlineTests/message_format_utf8/err b/test/cmdlineTests/message_format_utf8/err index c73ed714fe74..e14ed61e92d5 100644 --- a/test/cmdlineTests/message_format_utf8/err +++ b/test/cmdlineTests/message_format_utf8/err @@ -7,29 +7,30 @@ Warning: Source file does not specify required compiler version! Warning: Statement has no effect. --> message_format_utf8/input.sol:2:51: | -2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () { "©©©©ᄅ©©©©©" ; } - | ^^^^^^^^^^^^ +2 | /* ©©©©ᄅ©©©©© 2017 */ constructor () { unicode"©©©©ᄅ©©©©©" ; } + | ^^^^^^^^^^^^^^^^^^^ Warning: Statement has no effect. --> message_format_utf8/input.sol:6:25: | -6 | "S = π × r²"; - | ^^^^^^^^^^^^ +6 | unicode"S = π × r²"; + | ^^^^^^^^^^^^^^^^^^^ Warning: Statement has no effect. --> message_format_utf8/input.sol:7:39: | -7 | /* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ "∑ 1/n! ≈ 2.7"; // tabs in-between - | ^^^^^^^^^^^^^^ +7 | /* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ unicode"∑ 1/n! ≈ 2.7"; // tabs in-between + | ^^^^^^^^^^^^^^^^^^^^^ Warning: Statement has no effect. --> message_format_utf8/input.sol:8:30: | -8 | /* Ŀŏŗėɯ ïƥŝʉɱ */ "μὴ χεῖρον βέλτιστον"; // tabs in-between and inside - | ^^^ ^^^^^^ ^^^^^^^^^^ +8 | /* Ŀŏŗėɯ ïƥŝʉɱ */ unicode"μὴ χεῖρον βέλτιστον"; // tabs in-between and inside + | ^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^ Warning: Function state mutability can be restricted to pure --> message_format_utf8/input.sol:12:2: | 12 | function selector() public returns(uint) { // starts with tab | ^ (Relevant source part starts here and spans across multiple lines). + diff --git a/test/cmdlineTests/message_format_utf8/input.sol b/test/cmdlineTests/message_format_utf8/input.sol index dbeddfa01573..faf18f13970c 100644 --- a/test/cmdlineTests/message_format_utf8/input.sol +++ b/test/cmdlineTests/message_format_utf8/input.sol @@ -1,11 +1,11 @@ contract Foo { -/* ©©©©ᄅ©©©©© 2017 */ constructor () { "©©©©ᄅ©©©©©" ; } +/* ©©©©ᄅ©©©©© 2017 */ constructor () { unicode"©©©©ᄅ©©©©©" ; } function f() public pure { - "S = π × r²"; -/* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ "∑ 1/n! ≈ 2.7"; // tabs in-between -/* Ŀŏŗėɯ ïƥŝʉɱ */ "μὴ χεῖρον βέλτιστον"; // tabs in-between and inside + unicode"S = π × r²"; +/* ₀₁₂₃₄⁵⁶⁷⁸⁹ */ unicode"∑ 1/n! ≈ 2.7"; // tabs in-between +/* Ŀŏŗėɯ ïƥŝʉɱ */ unicode"μὴ χεῖρον βέλτιστον"; // tabs in-between and inside } diff --git a/test/libsolidity/ASTJSON/string.json b/test/libsolidity/ASTJSON/string.json new file mode 100644 index 000000000000..f47b41e47cfd --- /dev/null +++ b/test/libsolidity/ASTJSON/string.json @@ -0,0 +1,131 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "33:36:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 6, + "initialValue": + { + "hexValue": "48656c6c6f20576f726c64", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "53:13:1", + "typeDescriptions": + { + "typeIdentifier": "t_stringliteral_592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba", + "typeString": "literal_string \"Hello World\"" + }, + "value": "Hello World" + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:31:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 8, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 9, + "src": "13:56:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 10, + "src": "0:71:1" + } + ], + "src": "0:72:1" +} diff --git a/test/libsolidity/ASTJSON/string.sol b/test/libsolidity/ASTJSON/string.sol new file mode 100644 index 000000000000..a0a213475d7e --- /dev/null +++ b/test/libsolidity/ASTJSON/string.sol @@ -0,0 +1,3 @@ +contract C { function f() public { string memory x = "Hello World"; } } + +// ---- diff --git a/test/libsolidity/ASTJSON/string_legacy.json b/test/libsolidity/ASTJSON/string_legacy.json new file mode 100644 index 000000000000..96c984209237 --- /dev/null +++ b/test/libsolidity/ASTJSON/string_legacy.json @@ -0,0 +1,165 @@ +{ + "attributes": + { + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + } + }, + "children": + [ + { + "attributes": + { + "abstract": false, + "baseContracts": + [ + null + ], + "contractDependencies": + [ + null + ], + "contractKind": "contract", + "fullyImplemented": true, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "scope": 10 + }, + "children": + [ + { + "attributes": + { + "functionSelector": "26121ff0", + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": + [ + null + ], + "name": "f", + "scope": 9, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + "children": + [ + { + "attributes": + { + "parameters": + [ + null + ] + }, + "children": [], + "id": 1, + "name": "ParameterList", + "src": "23:2:1" + }, + { + "attributes": + { + "parameters": + [ + null + ] + }, + "children": [], + "id": 2, + "name": "ParameterList", + "src": "33:0:1" + }, + { + "children": + [ + { + "attributes": + { + "assignments": + [ + 4 + ] + }, + "children": + [ + { + "attributes": + { + "constant": false, + "mutability": "mutable", + "name": "x", + "scope": 7, + "stateVariable": false, + "storageLocation": "memory", + "type": "string", + "visibility": "internal" + }, + "children": + [ + { + "attributes": + { + "name": "string", + "type": "string" + }, + "id": 3, + "name": "ElementaryTypeName", + "src": "35:6:1" + } + ], + "id": 4, + "name": "VariableDeclaration", + "src": "35:15:1" + }, + { + "attributes": + { + "hexvalue": "48656c6c6f20576f726c64", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "token": "string", + "type": "literal_string \"Hello World\"", + "value": "Hello World" + }, + "id": 5, + "name": "Literal", + "src": "53:13:1" + } + ], + "id": 6, + "name": "VariableDeclarationStatement", + "src": "35:31:1" + } + ], + "id": 7, + "name": "Block", + "src": "33:36:1" + } + ], + "id": 8, + "name": "FunctionDefinition", + "src": "13:56:1" + } + ], + "id": 9, + "name": "ContractDefinition", + "src": "0:71:1" + } + ], + "id": 10, + "name": "SourceUnit", + "src": "0:72:1" +} diff --git a/test/libsolidity/ASTJSON/unicode.json b/test/libsolidity/ASTJSON/unicode.json new file mode 100644 index 000000000000..81c8ad0da52c --- /dev/null +++ b/test/libsolidity/ASTJSON/unicode.json @@ -0,0 +1,131 @@ +{ + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + }, + "id": 10, + "nodeType": "SourceUnit", + "nodes": + [ + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 9, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "body": + { + "id": 7, + "nodeType": "Block", + "src": "33:42:1", + "statements": + [ + { + "assignments": + [ + 4 + ], + "declarations": + [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 7, + "src": "35:15:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": + { + "id": 3, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "35:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 6, + "initialValue": + { + "hexValue": "48656c6c6f20f09f9883", + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "unicodeString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "53:19:1", + "typeDescriptions": + { + "typeIdentifier": "t_stringliteral_cd7a99177cebb3d14b8cc54e313dbf76867c71cd6fbb9a33ce3870dc80e9992b", + "typeString": "literal_string \"Hello \ud83d\ude03\"" + }, + "value": "Hello \ud83d\ude03" + }, + "nodeType": "VariableDeclarationStatement", + "src": "35:37:1" + } + ] + }, + "functionSelector": "26121ff0", + "id": 8, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "f", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 1, + "nodeType": "ParameterList", + "parameters": [], + "src": "23:2:1" + }, + "returnParameters": + { + "id": 2, + "nodeType": "ParameterList", + "parameters": [], + "src": "33:0:1" + }, + "scope": 9, + "src": "13:62:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 10, + "src": "0:77:1" + } + ], + "src": "0:78:1" +} diff --git a/test/libsolidity/ASTJSON/unicode.sol b/test/libsolidity/ASTJSON/unicode.sol new file mode 100644 index 000000000000..ca172bf25d11 --- /dev/null +++ b/test/libsolidity/ASTJSON/unicode.sol @@ -0,0 +1,3 @@ +contract C { function f() public { string memory x = unicode"Hello 😃"; } } + +// ---- diff --git a/test/libsolidity/ASTJSON/unicode_legacy.json b/test/libsolidity/ASTJSON/unicode_legacy.json new file mode 100644 index 000000000000..22976f6f9775 --- /dev/null +++ b/test/libsolidity/ASTJSON/unicode_legacy.json @@ -0,0 +1,165 @@ +{ + "attributes": + { + "absolutePath": "a", + "exportedSymbols": + { + "C": + [ + 9 + ] + } + }, + "children": + [ + { + "attributes": + { + "abstract": false, + "baseContracts": + [ + null + ], + "contractDependencies": + [ + null + ], + "contractKind": "contract", + "fullyImplemented": true, + "linearizedBaseContracts": + [ + 9 + ], + "name": "C", + "scope": 10 + }, + "children": + [ + { + "attributes": + { + "functionSelector": "26121ff0", + "implemented": true, + "isConstructor": false, + "kind": "function", + "modifiers": + [ + null + ], + "name": "f", + "scope": 9, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + "children": + [ + { + "attributes": + { + "parameters": + [ + null + ] + }, + "children": [], + "id": 1, + "name": "ParameterList", + "src": "23:2:1" + }, + { + "attributes": + { + "parameters": + [ + null + ] + }, + "children": [], + "id": 2, + "name": "ParameterList", + "src": "33:0:1" + }, + { + "children": + [ + { + "attributes": + { + "assignments": + [ + 4 + ] + }, + "children": + [ + { + "attributes": + { + "constant": false, + "mutability": "mutable", + "name": "x", + "scope": 7, + "stateVariable": false, + "storageLocation": "memory", + "type": "string", + "visibility": "internal" + }, + "children": + [ + { + "attributes": + { + "name": "string", + "type": "string" + }, + "id": 3, + "name": "ElementaryTypeName", + "src": "35:6:1" + } + ], + "id": 4, + "name": "VariableDeclaration", + "src": "35:15:1" + }, + { + "attributes": + { + "hexvalue": "48656c6c6f20f09f9883", + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "token": "unicodeString", + "type": "literal_string \"Hello \ud83d\ude03\"", + "value": "Hello \ud83d\ude03" + }, + "id": 5, + "name": "Literal", + "src": "53:19:1" + } + ], + "id": 6, + "name": "VariableDeclarationStatement", + "src": "35:37:1" + } + ], + "id": 7, + "name": "Block", + "src": "33:42:1" + } + ], + "id": 8, + "name": "FunctionDefinition", + "src": "13:62:1" + } + ], + "id": 9, + "name": "ContractDefinition", + "src": "0:77:1" + } + ], + "id": 10, + "name": "SourceUnit", + "src": "0:78:1" +} diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 7d5480fb84c6..531d98415e92 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -494,6 +494,8 @@ BOOST_AUTO_TEST_CASE(empty_comment) } +// Unicode string escapes + BOOST_AUTO_TEST_CASE(valid_unicode_string_escape) { Scanner scanner(CharStream("{ \"\\u00DAnicode\"", "")); @@ -533,6 +535,25 @@ BOOST_AUTO_TEST_CASE(invalid_short_unicode_string_escape) BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal); } +// Unicode string literal + +BOOST_AUTO_TEST_CASE(valid_unicode_literal) +{ + Scanner scanner(CharStream("{ unicode\"Hello 😃\"", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::UnicodeStringLiteral); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), std::string("Hello \xf0\x9f\x98\x83", 10)); +} + +BOOST_AUTO_TEST_CASE(valid_nonprintable_in_unicode_literal) +{ + // Non-printable characters are allowed in unicode strings... + Scanner scanner(CharStream("{ unicode\"Hello \007😃\"", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::UnicodeStringLiteral); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), std::string("Hello \x07\xf0\x9f\x98\x83", 11)); +} + // HEX STRING LITERAL BOOST_AUTO_TEST_CASE(valid_hex_literal) diff --git a/test/libsolidity/semanticTests/strings/unicode_string.sol b/test/libsolidity/semanticTests/strings/unicode_string.sol index 73616e479434..ceea9702ab64 100644 --- a/test/libsolidity/semanticTests/strings/unicode_string.sol +++ b/test/libsolidity/semanticTests/strings/unicode_string.sol @@ -1,9 +1,14 @@ contract C { function f() public pure returns (string memory) { - return "😃, 😭, and 😈"; + return unicode"😃, 😭, and 😈"; + } + function g() public pure returns (string memory) { + return unicode"😃, 😭,\ + and 😈"; } } // ==== // compileViaYul: also // ---- // f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" +// g() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" diff --git a/test/libsolidity/semanticTests/types/strings.sol b/test/libsolidity/semanticTests/types/strings.sol index 8e6f0943023a..0cc4565afae1 100644 --- a/test/libsolidity/semanticTests/types/strings.sol +++ b/test/libsolidity/semanticTests/types/strings.sol @@ -1,4 +1,7 @@ contract test { + function fixedBytesHex() public returns(bytes32 ret) { + return hex"aabb00ff"; + } function fixedBytes() public returns(bytes32 ret) { return "abc\x00\xff__"; } @@ -11,5 +14,6 @@ contract test { // ==== // compileViaYul: also // ---- +// fixedBytesHex() -> "\xaa\xbb\0\xff" // fixedBytes() -> "abc\0\xff__" // pipeThrough(bytes2, bool): "\0\x02", true -> "\0\x2", true diff --git a/test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol b/test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol index 5e406d0c6f7e..ea13293a2843 100644 --- a/test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol +++ b/test/libsolidity/syntaxTests/string/large_utf8_codepoint.sol @@ -1,3 +1,4 @@ contract C { string s = "\xf0\x9f\xa6\x84"; } +// ---- diff --git a/test/libsolidity/syntaxTests/string/string_ascii.sol b/test/libsolidity/syntaxTests/string/string_ascii.sol new file mode 100644 index 000000000000..47014df535e0 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/string_ascii.sol @@ -0,0 +1,9 @@ +contract test { + function f() public pure returns (string memory) { + return "hello world"; + } + function g() public pure returns (string memory) { + return unicode"hello world"; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/string/string_multipart_unicode.sol b/test/libsolidity/syntaxTests/string/string_multipart_unicode.sol new file mode 100644 index 000000000000..669413992952 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/string_multipart_unicode.sol @@ -0,0 +1,7 @@ +contract test { + function f() public pure returns (bytes32) { + bytes32 escapeCharacters = unicode"foo" unicode"😃, 😭, and 😈" unicode"!"; + return escapeCharacters; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/string/string_multipart_unicode_mixed.sol b/test/libsolidity/syntaxTests/string/string_multipart_unicode_mixed.sol new file mode 100644 index 000000000000..6264799bd2e4 --- /dev/null +++ b/test/libsolidity/syntaxTests/string/string_multipart_unicode_mixed.sol @@ -0,0 +1,8 @@ +contract test { + function f() public pure returns (bytes32) { + bytes32 escapeCharacters = "foo" hex"aa" unicode"😃, 😭, and 😈" "!" hex"00"; + return escapeCharacters; + } +} +// ---- +// ParserError 2314: (106-113): Expected ';' but got 'HexStringLiteral' diff --git a/test/libsolidity/syntaxTests/string/string_unicode.sol b/test/libsolidity/syntaxTests/string/string_unicode.sol index a204e84e5ecc..0f70121bec75 100644 --- a/test/libsolidity/syntaxTests/string/string_unicode.sol +++ b/test/libsolidity/syntaxTests/string/string_unicode.sol @@ -1,7 +1,6 @@ contract test { function f() public pure returns (string memory) { - return "😃, 😭, and 😈"; + return unicode"😃, 😭, and 😈"; } } // ---- -// ParserError 8936: (86-88): Invalid character in string. diff --git a/test/libsolidity/syntaxTests/string/string_unicode_without_prefix.sol b/test/libsolidity/syntaxTests/string/string_unicode_without_prefix.sol new file mode 100644 index 000000000000..a204e84e5ecc --- /dev/null +++ b/test/libsolidity/syntaxTests/string/string_unicode_without_prefix.sol @@ -0,0 +1,7 @@ +contract test { + function f() public pure returns (string memory) { + return "😃, 😭, and 😈"; + } +} +// ---- +// ParserError 8936: (86-88): Invalid character in string. diff --git a/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol b/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol index 011f58b409f6..c3e419265db2 100644 --- a/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol +++ b/test/libsolidity/syntaxTests/string/unicode_escape_literals.sol @@ -19,3 +19,4 @@ contract test { return res; } } +// ---- From 1f39640392b3349641745a20e99f8ed343ab71c6 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 23 Jul 2020 14:10:14 +0100 Subject: [PATCH 474/479] Update grammar for unicode literals --- docs/Solidity.g4 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/Solidity.g4 b/docs/Solidity.g4 index f86d95fc4945..91f59d78cb37 100644 --- a/docs/Solidity.g4 +++ b/docs/Solidity.g4 @@ -253,6 +253,7 @@ primaryExpression | numberLiteral | hexLiteral | stringLiteral + | unicodeStringLiteral | identifier ('[' ']')? | TypeKeyword | tupleExpression @@ -461,6 +462,13 @@ StringLiteralFragment : '"' DoubleQuotedStringCharacter* '"' | '\'' SingleQuotedStringCharacter* '\'' ; +unicodeStringLiteral + : UnicodeStringLiteralFragment+ ; + +UnicodeStringLiteralFragment + : 'unicode"' DoubleQuotedStringCharacter* '"' + | 'unicode\'' SingleQuotedStringCharacter* '\'' ; + fragment DoubleQuotedStringCharacter : ~["\r\n\\] | ('\\' .) ; From af22dfa5b4ee6a42c5f7fd3613c7799d83521769 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 27 Jul 2020 13:01:58 +0100 Subject: [PATCH 475/479] Document unicode string literals --- docs/070-breaking-changes.rst | 8 ++++++++ docs/types/value-types.rst | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index 2b532cf71102..19eaefcf298b 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -25,16 +25,24 @@ Changes to the Syntax * In external function and contract creation calls, Ether and gas is now specified using a new syntax: ``x.f{gas: 10000, value: 2 ether}(arg1, arg2)``. The old syntax -- ``x.f.gas(10000).value(2 ether)(arg1, arg2)`` -- will cause an error. + * The global variable ``now`` is deprecated, ``block.timestamp`` should be used instead. The single identifier ``now`` is too generic for a global variable and could give the impression that it changes during transaction processing, whereas ``block.timestamp`` correctly reflects the fact that it is just a property of the block. + * NatSpec comments on variables are only allowed for public state variables and not for local or internal variables. * The token ``gwei`` is a keyword now (used to specify, e.g. ``2 gwei`` as a number) and cannot be used as an identifier. +* String literals now can only contain printable ASCII characters and this also includes a variety of + escape sequences, such as hexadecimal (``\xff``) and unicode escapes (``\u20ac``). + +* Unicode string literals are supported now to accommodate valid UTF-8 sequences. They are identified + with the ``unicode`` prefix: ``unicode"Hello 😃"``. + * State Mutability: The state mutability of functions can now be restricted during inheritance: Functions with default state mutability can be overridden by ``pure`` and ``view`` functions while ``view`` functions can be overridden by ``pure`` functions. diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 16c371c1833f..7c149784e645 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -484,7 +484,9 @@ String literals are written with either double or single-quotes (``"foo"`` or `` For example, with ``bytes32 samevar = "stringliteral"`` the string literal is interpreted in its raw byte form when assigned to a ``bytes32`` type. -String literals support the following escape characters: +String literals can only contain printable ASCII characters, which means the characters between and including 0x1F .. 0x7E. + +Additionally, string literals also support the following escape characters: - ``\`` (escapes an actual newline) - ``\\`` (backslash) @@ -511,9 +513,19 @@ character sequence ``abcdef``. "\n\"\'\\abc\ def" -Any unicode line terminator which is not a newline (i.e. LF, VF, FF, CR, NEL, LS, PS) is considered to +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 ``\``. +Unicode Literals +---------------- + +While regular string literals can only contain ASCII, Unicode literals – prefixed with the keyword ``unicode`` – can contain any valid UTF-8 sequence. +They also support the very same escape sequences as regular string literals. + +:: + + string memory a = unicode"Hello 😃"; + .. index:: literal, bytes Hexadecimal Literals From 0102d30b0a69f2b1d62b30602991dfa6faa64ed1 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 27 Jul 2020 17:35:57 +0100 Subject: [PATCH 476/479] Add more tests to the scanner regarding dots in identifiers --- test/libsolidity/SolidityScanner.cpp | 53 +++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 5b83778bacbc..1585fa6614c2 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -166,7 +166,58 @@ BOOST_AUTO_TEST_CASE(scientific_notation) BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } -BOOST_AUTO_TEST_CASE(trailing_dot) +BOOST_AUTO_TEST_CASE(leading_dot_in_identifier) +{ + Scanner scanner(CharStream("function .a(", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Period); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); + scanner.reset(CharStream("function .a(", "")); + scanner.supportPeriodInIdentifier(true); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Period); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); +} + +BOOST_AUTO_TEST_CASE(middle_dot_in_identifier) +{ + Scanner scanner(CharStream("function a..a(", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::Period); + BOOST_CHECK_EQUAL(scanner.next(), Token::Period); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); + scanner.reset(CharStream("function a...a(", "")); + scanner.supportPeriodInIdentifier(true); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); +} + +BOOST_AUTO_TEST_CASE(trailing_dot_in_identifier) +{ + Scanner scanner(CharStream("function a.(", "")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::Period); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); + scanner.reset(CharStream("function a.(", "")); + scanner.supportPeriodInIdentifier(true); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.next(), Token::LParen); + BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); +} + +BOOST_AUTO_TEST_CASE(trailing_dot_in_numbers) { Scanner scanner(CharStream("2.5", "")); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Number); From a6df232fa32d2bd108be96fa8d6f56231e02ffa7 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 28 Jul 2020 10:55:38 +0200 Subject: [PATCH 477/479] Fix SMT tests --- test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol | 2 +- test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol index e297cffd733e..089dcc5c16a2 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_1.sol @@ -4,4 +4,4 @@ contract C { function f() public { (a).pop();} } // ---- -// Warning 2529: (78-87): Empty array "pop" detected here. +// Warning 2529: (78-87): Empty array "pop" detected here diff --git a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol index 76c8e3cb3312..70e00939b926 100644 --- a/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol +++ b/test/libsolidity/smtCheckerTests/types/tuple_array_pop_2.sol @@ -4,4 +4,4 @@ contract C { function f() public { (((((a))))).pop();} } // ---- -// Warning 2529: (78-95): Empty array "pop" detected here. +// Warning 2529: (78-95): Empty array "pop" detected here From 291c00c3decd89f3338777ce8836a974b216cd2a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 3 Jul 2020 12:26:55 +0100 Subject: [PATCH 478/479] Remove errenous error duplication and move some tests around --- libyul/AsmAnalysis.cpp | 2 -- .../inlineAssembly/{pc.sol => invalid/pc_disallowed.sol} | 0 2 files changed, 2 deletions(-) rename test/libsolidity/syntaxTests/inlineAssembly/{pc.sol => invalid/pc_disallowed.sol} (100%) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 2c7a4b9400f1..b8f0dd4e7a1e 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -646,8 +646,6 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio "PC instruction is a low-level EVM feature. " "Because of that PC is disallowed in strict assembly." ); - else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) - errorForVM(3672_error, "only available for Istanbul-compatible"); else return false; diff --git a/test/libsolidity/syntaxTests/inlineAssembly/pc.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol similarity index 100% rename from test/libsolidity/syntaxTests/inlineAssembly/pc.sol rename to test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol From ab0b2e1fe12073174f5ede6ac4184a688e709973 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 28 Jul 2020 11:47:14 +0200 Subject: [PATCH 479/479] Prepare changelog for 0.7.0. --- Changelog.md | 5 +++-- docs/bugs_by_version.json | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7541aad9cdee..2b72ccef7a70 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -### 0.7.0 (unreleased) +### 0.7.0 (2020-07-28) Breaking changes: * Inline Assembly: Disallow ``.`` in user-defined function and variable names. @@ -30,17 +30,18 @@ Language Features: Compiler Features: + * SMTChecker: Report multi-transaction counterexamples including the function calls that initiate the transactions. This does not include concrete values for reference types and reentrant calls. * Variable declarations using the ``var`` keyword are not recognized anymore. Bugfixes: + * Immutables: Fix internal compiler error when immutables are not assigned. * Inheritance: Disallow public state variables overwriting ``pure`` functions. * NatSpec: Constructors and functions have consistent userdoc output. * SMTChecker: Fix internal error when assigning to a 1-tuple. * SMTChecker: Fix internal error when tuples have extra effectless parenthesis. * State Mutability: Constant public state variables are considered ``pure`` functions. * Type Checker: Fixing deduction issues on function types when function call has named arguments. - * Immutables: Fix internal compiler error when immutables are not assigned. ### 0.6.12 (2020-07-22) diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index fc9782c47177..fc7191322ad0 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1181,5 +1181,9 @@ "UsingForCalldata" ], "released": "2020-06-04" + }, + "0.7.0": { + "bugs": [], + "released": "2020-07-28" } } \ No newline at end of file