diff options
author | chriseth <chris@ethereum.org> | 2018-07-19 15:24:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 15:24:27 +0800 |
commit | e3c2f20f6e8c7919a6733fa736a3a222028f213c (patch) | |
tree | 8905905bc8c29b9fc3acc08ee4f876cd8fd4ff07 /test/libsolidity/syntaxTests | |
parent | ccb5fccee5f7eea8993f2cbc77217abbccae36ce (diff) | |
parent | faa9c221d41c45e12411c654919f318f6e7fc98f (diff) | |
download | dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.tar.gz dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.tar.zst dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.zip |
Merge pull request #4439 from ethereum/address_members
[BREAKING] Enforce address members not accessible by contract instance
Diffstat (limited to 'test/libsolidity/syntaxTests')
24 files changed, 19 insertions, 118 deletions
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol deleted file mode 100644 index 2b2ef39e..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol +++ /dev/null @@ -1,17 +0,0 @@ -// This used to be a test for a.transfer to generate a warning -// because A's fallback function is not payable. - -contract A { - function() external {} -} - -contract B { - A a; - - function() external { - a.transfer(100); - } -} -// ---- -// Warning: (213-223): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (213-223): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol deleted file mode 100644 index 67398de7..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol +++ /dev/null @@ -1,15 +0,0 @@ -// This used to be a test for a.transfer to generate a warning -// because A does not have a payable fallback function. - -contract A {} - -contract B { - A a; - - function() external { - a.transfer(100); - } -} -// ---- -// Warning: (192-202): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (192-202): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol deleted file mode 100644 index 1a4b2e81..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol +++ /dev/null @@ -1,17 +0,0 @@ -// This used to be a test for a.send to generate a warning -// because A does not have a payable fallback function. - -contract A { - function() external {} -} - -contract B { - A a; - - function() external { - require(a.send(100)); - } -} -// ---- -// Warning: (224-230): Using contract member "send" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).send" instead. -// TypeError: (224-230): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol index 2b7f8dae..c343995f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol @@ -9,8 +9,7 @@ contract B { A a; function() external { - a.transfer(100); + address(a).transfer(100); } } // ---- -// Warning: (228-238): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol index 4acb0dc2..39edaa2d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/541_warn_about_address_members_on_contract_balance.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-64): Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).balance" instead. +// TypeError: (52-64): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(this).balance" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol index 45ee1f5b..a44cc6d2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/542_warn_about_address_members_on_contract_transfer.sol @@ -4,5 +4,4 @@ contract C { } } // ---- -// Warning: (52-65): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (52-65): Value transfer to a contract without a payable fallback function. +// TypeError: (52-65): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(this).transfer" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol index 99b7b8b2..e9e26a00 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/543_warn_about_address_members_on_contract_send.sol @@ -4,5 +4,4 @@ contract C { } } // ---- -// Warning: (52-61): Using contract member "send" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).send" instead. -// TypeError: (52-61): Value transfer to a contract without a payable fallback function. +// TypeError: (52-61): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(this).send" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol index 446410ba..16da7578 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/544_warn_about_address_members_on_contract_call.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-61): Using contract member "call" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).call" instead. +// TypeError: (52-61): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(this).call" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol index 43ee4d88..9292f9c0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/545_warn_about_address_members_on_contract_callcode.sol @@ -4,5 +4,4 @@ contract C { } } // ---- -// Warning: (52-65): Using contract member "callcode" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).callcode" instead. -// TypeError: (52-65): "callcode" has been deprecated in favour of "delegatecall". +// TypeError: (52-65): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(this).callcode" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol index 7cbd832a..20354991 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/546_warn_about_address_members_on_contract_delegatecall.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// Warning: (52-69): Using contract member "delegatecall" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).delegatecall" instead. +// TypeError: (52-69): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(this).delegatecall" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol index 3ba59a9f..8a4734e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/547_warn_about_address_members_on_non_this_contract_balance.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (65-74): Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).balance" instead. +// TypeError: (65-74): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(c).balance" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol index 17455124..e617f540 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/548_warn_about_address_members_on_non_this_contract_transfer.sol @@ -5,5 +5,4 @@ contract C { } } // ---- -// Warning: (65-75): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (65-75): Value transfer to a contract without a payable fallback function. +// TypeError: (65-75): Member "transfer" not found or not visible after argument-dependent lookup in contract C. Use "address(c).transfer" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol index ca0630c4..54965d4b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/549_warn_about_address_members_on_non_this_contract_send.sol @@ -5,5 +5,4 @@ contract C { } } // ---- -// Warning: (65-71): Using contract member "send" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).send" instead. -// TypeError: (65-71): Value transfer to a contract without a payable fallback function. +// TypeError: (65-71): Member "send" not found or not visible after argument-dependent lookup in contract C. Use "address(c).send" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol index c06e0f61..940f383c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/550_warn_about_address_members_on_non_this_contract_call.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (65-71): Using contract member "call" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).call" instead. +// TypeError: (65-71): Member "call" not found or not visible after argument-dependent lookup in contract C. Use "address(c).call" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol index 3c1e0280..9d4725bd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/551_warn_about_address_members_on_non_this_contract_callcode.sol @@ -5,5 +5,4 @@ contract C { } } // ---- -// Warning: (65-75): Using contract member "callcode" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).callcode" instead. -// TypeError: (65-75): "callcode" has been deprecated in favour of "delegatecall". +// TypeError: (65-75): Member "callcode" not found or not visible after argument-dependent lookup in contract C. Use "address(c).callcode" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol index 8e286945..9941ce1f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/552_warn_about_address_members_on_non_this_contract_delegatecall.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (65-79): Using contract member "delegatecall" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).delegatecall" instead. +// TypeError: (65-79): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. Use "address(c).delegatecall" to access this address member. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/553_no_address_members_on_contract_balance_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/553_no_address_members_on_contract_balance_v050.sol deleted file mode 100644 index 1cd3e9b0..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/553_no_address_members_on_contract_balance_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.balance; - } -} -// ---- -// TypeError: (77-89): Member "balance" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/554_no_address_members_on_contract_transfer_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/554_no_address_members_on_contract_transfer_v050.sol deleted file mode 100644 index 8c3c1c23..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/554_no_address_members_on_contract_transfer_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.transfer; - } -} -// ---- -// TypeError: (77-90): Member "transfer" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/555_no_address_members_on_contract_send_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/555_no_address_members_on_contract_send_v050.sol deleted file mode 100644 index b7868a91..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/555_no_address_members_on_contract_send_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.send; - } -} -// ---- -// TypeError: (77-86): Member "send" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/556_no_address_members_on_contract_call_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/556_no_address_members_on_contract_call_v050.sol deleted file mode 100644 index 66fcda20..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/556_no_address_members_on_contract_call_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.call; - } -} -// ---- -// TypeError: (77-86): Member "call" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/557_no_address_members_on_contract_callcode_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/557_no_address_members_on_contract_callcode_v050.sol deleted file mode 100644 index 001083bf..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/557_no_address_members_on_contract_callcode_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.callcode; - } -} -// ---- -// TypeError: (77-90): Member "callcode" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/558_no_address_members_on_contract_delegatecall_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/558_no_address_members_on_contract_delegatecall_v050.sol deleted file mode 100644 index cb6d0735..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/558_no_address_members_on_contract_delegatecall_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() public { - this.delegatecall; - } -} -// ---- -// TypeError: (77-94): Member "delegatecall" not found or not visible after argument-dependent lookup in contract C. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol index 9355853a..4c1870f1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract C { function transfer(uint) public; function f() public { diff --git a/test/libsolidity/syntaxTests/types/address_members_in_contract.sol b/test/libsolidity/syntaxTests/types/address_members_in_contract.sol new file mode 100644 index 00000000..eafc8268 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/address_members_in_contract.sol @@ -0,0 +1,6 @@ +contract C { + function f() public returns (C) { return this; } + function g() public returns (uint) { return f().balance(); } +} +// ---- +// TypeError: (114-125): Member "balance" not found or not visible after argument-dependent lookup in contract C. Use "address(...).balance" to access this address member. |