mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #9180 from ethereum/noVisibilityForConstructor
[BREAKING] No visibility for constructor
This commit is contained in:
		
						commit
						41e1e34211
					
				| @ -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. | ||||
|  | ||||
| @ -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). | ||||
|  | ||||
| @ -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); } | ||||
|  | ||||
| @ -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; | ||||
|         } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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`, | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 <abstract-contract>`. | ||||
| You can use internal parameters in a constructor (for example storage pointers). In this case, | ||||
| the contract has to be marked :ref:`abstract <abstract-contract>`, 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() {} | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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."); | ||||
|  | ||||
| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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<constructor>` is a special function run during the creation of the contract and | ||||
| The :ref:`constructor<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 <special-variables-functions>` that | ||||
|  | ||||
| @ -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; | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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; | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -301,7 +301,7 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract) | ||||
| 
 | ||||
| bool SyntaxChecker::visit(FunctionDefinition const& _function) | ||||
| { | ||||
| 	if (_function.noVisibilitySpecified()) | ||||
| 	if (!_function.isConstructor() && _function.noVisibilitySpecified()) | ||||
| 	{ | ||||
| 		string suggestedVisibility = _function.isFallback() || _function.isReceive() || m_isInterface ? "external" : "public"; | ||||
| 		m_errorReporter.syntaxError( | ||||
|  | ||||
| @ -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\"."); | ||||
| 	} | ||||
| 
 | ||||
| @ -338,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<VariableDeclaration const*> 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<VariableDeclaration> const& var: _function.parameters()) | ||||
| 	{ | ||||
| @ -378,6 +407,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) | ||||
| 		checkArgumentAndReturnParameter(*var); | ||||
| 		var->accept(*this); | ||||
| 	} | ||||
| 
 | ||||
| 	set<Declaration const*> modifiers; | ||||
| 	for (ASTPointer<ModifierInvocation> const& modifier: _function.modifiers()) | ||||
| 	{ | ||||
| @ -403,11 +433,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()) | ||||
| @ -529,7 +558,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) | ||||
| 	if (auto referenceType = dynamic_cast<ReferenceType const*>(varType)) | ||||
| 	{ | ||||
| 		auto result = referenceType->validForLocation(referenceType->location()); | ||||
| 		if (result && _variable.isPublicCallableParameter()) | ||||
| 		if (result && (_variable.isConstructorParameter() || _variable.isPublicCallableParameter())) | ||||
| 			result = referenceType->validForLocation(DataLocation::CallData); | ||||
| 		if (!result) | ||||
| 		{ | ||||
| @ -1881,8 +1910,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 +1922,30 @@ 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."); | ||||
| 	if (!_function.noVisibilitySpecified()) | ||||
| 	{ | ||||
| 		auto const& contract = dynamic_cast<ContractDefinition const&>(*_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( | ||||
| @ -2495,8 +2544,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."); | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
| @ -294,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) | ||||
| @ -629,7 +629,12 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c | ||||
| 	else if (isCallableOrCatchParameter()) | ||||
| 	{ | ||||
| 		set<Location> locations{ Location::Memory }; | ||||
| 		if (isInternalCallableParameter() || isLibraryFunctionParameter() || isTryCatchParameter()) | ||||
| 		if ( | ||||
| 			isConstructorParameter() || | ||||
| 			isInternalCallableParameter() || | ||||
| 			isLibraryFunctionParameter() || | ||||
| 			isTryCatchParameter() | ||||
| 		) | ||||
| 			locations.insert(Location::Storage); | ||||
| 		if (!isTryCatchParameter() && !isConstructorParameter()) | ||||
| 			locations.insert(Location::CallData); | ||||
|  | ||||
| @ -505,8 +505,6 @@ public: | ||||
| 
 | ||||
| 	/// 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.
 | ||||
| @ -808,15 +806,16 @@ public: | ||||
| 	bool isPayable() const { return m_stateMutability == StateMutability::Payable; } | ||||
| 	std::vector<ASTPointer<ModifierInvocation>> 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 visibility() >= Visibility::Public; | ||||
| 		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
 | ||||
| @ -928,6 +927,7 @@ public: | ||||
| 	/// @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; | ||||
|  | ||||
| @ -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<pair<string, Json::Value>> 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()) | ||||
|  | ||||
| @ -399,7 +399,7 @@ ASTPointer<FunctionDefinition> ASTJsonImporter::createFunctionDefinition(Json::V | ||||
| 	return createASTNode<FunctionDefinition>( | ||||
| 		_node, | ||||
| 		memberAsASTString(_node, "name"), | ||||
| 		visibility(_node), | ||||
| 		kind == Token::Constructor ? Visibility::Default : visibility(_node), | ||||
| 		stateMutability(_node), | ||||
| 		kind, | ||||
| 		memberAsBool(_node, "virtual"), | ||||
|  | ||||
| @ -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(); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| pragma solidity >=0.6.0; | ||||
| 
 | ||||
| contract C { | ||||
|     constructor() public {} | ||||
|     constructor() {} | ||||
| } | ||||
| contract D is C { | ||||
| } | ||||
| @ -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: | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| contract Foo { | ||||
| /* ©©©©ᄅ©©©©© 2017 */ constructor () public { "©©©©ᄅ©©©©©" ; } | ||||
| /* ©©©©ᄅ©©©©© 2017 */ constructor () { "©©©©ᄅ©©©©©" ; } | ||||
| 
 | ||||
|     function f() public pure { | ||||
| 
 | ||||
|  | ||||
| @ -3,7 +3,7 @@ pragma solidity >=0.0; | ||||
| 
 | ||||
| contract C | ||||
| { | ||||
| 	constructor() public payable | ||||
| 	constructor() payable | ||||
| 	{ | ||||
| 		int a; | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| pragma solidity >=0.0.0; | ||||
| 
 | ||||
| contract Error1 { | ||||
|   constructor() public { | ||||
|   constructor() { | ||||
|     balances[tx.origin] = ; // missing RHS. | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
| @ -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 {}" | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -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":{}} | ||||
|  | ||||
| @ -3,5 +3,5 @@ pragma solidity >=0.0; | ||||
| 
 | ||||
| contract C | ||||
| { | ||||
| 	constructor() public {} | ||||
| 	constructor() {} | ||||
| } | ||||
|  | ||||
| @ -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++) { | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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. | ||||
| 
 | ||||
|  | ||||
| @ -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. | ||||
|  | ||||
| @ -12,7 +12,7 @@ contract multiOwner is safeMath { | ||||
|     /* | ||||
|         Constructor | ||||
|     */ | ||||
|     constructor(address[] memory newOwners) public { | ||||
|     constructor(address[] memory newOwners) { | ||||
|         for ( uint256 a=0 ; a<newOwners.length ; a++ ) { | ||||
|             _addOwner(newOwners[a]); | ||||
|         } | ||||
|  | ||||
| @ -40,7 +40,7 @@ contract premium is module, safeMath { | ||||
| 
 | ||||
|     mapping(address => 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. | ||||
|  | ||||
| @ -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. | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
|  | ||||
| @ -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. | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
|  | ||||
| @ -18,7 +18,6 @@ contract CategoricalEvent is Event { | ||||
|         Oracle _oracle, | ||||
|         uint8 outcomeCount | ||||
|     ) | ||||
|         public | ||||
|         Event(_collateralToken, _oracle, outcomeCount) | ||||
|     { | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -34,7 +34,6 @@ contract ScalarEvent is Event { | ||||
|         int _lowerBound, | ||||
|         int _upperBound | ||||
|     ) | ||||
|         public | ||||
|         Event(_collateralToken, _oracle, 2) | ||||
|     { | ||||
|         // Validate bounds | ||||
|  | ||||
| @ -78,7 +78,6 @@ contract Campaign { | ||||
|         uint _funding, | ||||
|         uint _deadline | ||||
|     ) | ||||
|         public | ||||
|     { | ||||
|         // Validate input | ||||
|         require(   address(_eventContract) != address(0) | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -8,7 +8,7 @@ contract Migrations { | ||||
|     if (msg.sender == owner) _; | ||||
|   } | ||||
| 
 | ||||
|   constructor() public { | ||||
|   constructor() { | ||||
|     owner = msg.sender; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -68,7 +68,6 @@ contract FutarchyOracle is Oracle { | ||||
|         uint24 fee, | ||||
|         uint _deadline | ||||
|     ) | ||||
|         public | ||||
|     { | ||||
|         // Deadline is in the future | ||||
|         require(_deadline > block.timestamp); | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -54,7 +54,6 @@ contract UltimateOracle is Oracle { | ||||
|         uint _challengeAmount, | ||||
|         uint _frontRunnerPeriod | ||||
|     ) | ||||
|         public | ||||
|     { | ||||
|         // Validate inputs | ||||
|         require(   address(_forwardedOracle) != address(0) | ||||
|  | ||||
| @ -32,7 +32,6 @@ contract OutcomeToken is StandardToken { | ||||
|      */ | ||||
|     /// @dev Constructor sets events contract address | ||||
|     constructor() | ||||
|         public | ||||
|     { | ||||
|         eventContract = msg.sender; | ||||
|     } | ||||
|  | ||||
| @ -112,7 +112,7 @@ contract MilestoneTracker { | ||||
|         address _arbitrator, | ||||
|         address _donor, | ||||
|         address _recipient | ||||
|     ) public { | ||||
|     ) { | ||||
|         arbitrator = _arbitrator; | ||||
|         donor = _donor; | ||||
|         recipient = _recipient; | ||||
|  | ||||
| @ -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.
 | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -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) { | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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; } | ||||
| 		} | ||||
| 	)"; | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| contract test { | ||||
|     constructor(uint param1, test param2, bool param3) public {} | ||||
|     constructor(uint param1, test param2, bool param3) {} | ||||
| } | ||||
| // ---- | ||||
| //     :test | ||||
|  | ||||
| @ -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(); } | ||||
| } | ||||
| // ---- | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| contract test { | ||||
|     constructor(uint param1, test param2, bool param3) public payable {} | ||||
|     constructor(uint param1, test param2, bool param3) payable {} | ||||
| } | ||||
| // ---- | ||||
| //     :test | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| abstract contract C { | ||||
| 	constructor() public { | ||||
| 	constructor() { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| contract C { | ||||
| 	constructor() public { | ||||
| 	constructor() { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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; } | ||||
| 		} | ||||
| 	)"; | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); | ||||
|  | ||||
| @ -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
 | ||||
|  | ||||
| @ -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; } | ||||
|  | ||||
| @ -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 ';'. | ||||
|  | ||||
| @ -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 ';'. | ||||
|  | ||||
| @ -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 ';'. | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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]; | ||||
|     } | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| contract Helper { | ||||
|     uint256 public flag; | ||||
| 
 | ||||
|     constructor(uint256 x) public { | ||||
|     constructor(uint256 x) { | ||||
|         flag = x; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -7,7 +7,7 @@ contract Sample { | ||||
|     } | ||||
|     s[2] public p; | ||||
| 
 | ||||
|     constructor() public { | ||||
|     constructor() { | ||||
|         s memory m; | ||||
|         m.x = 0xbbbb; | ||||
|         m.y = 0xcccc; | ||||
|  | ||||
| @ -8,7 +8,7 @@ contract buggystruct { | ||||
|         string last; | ||||
|     } | ||||
| 
 | ||||
|     constructor() public { | ||||
|     constructor() { | ||||
|         bug = Buggy(10, 20, 30, "asdfghjkl"); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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]; | ||||
|     } | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| contract A { | ||||
|     constructor() public { | ||||
|     constructor() { | ||||
|         address(this).call("123"); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| contract BaseBase { | ||||
|     uint256 m_a; | ||||
| 
 | ||||
|     constructor(uint256 a) public { | ||||
|     constructor(uint256 a) { | ||||
|         m_a = a; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ contract Test { | ||||
|     bytes3 name; | ||||
|     bool flag; | ||||
| 
 | ||||
|     constructor() public { | ||||
|     constructor() { | ||||
|         setName("abc"); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| contract Test { | ||||
|     bytes6 name; | ||||
| 
 | ||||
|     constructor() public { | ||||
|     constructor() { | ||||
|         function (bytes6 _name) internal setter = setName; | ||||
|         setter("abcdef"); | ||||
| 
 | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue
	
	Block a user