mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4439 from ethereum/address_members
[BREAKING] Enforce address members not accessible by contract instance
This commit is contained in:
-17
@@ -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.
|
||||
@@ -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.
|
||||
-17
@@ -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.
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-2
@@ -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.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
-8
@@ -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.
|
||||
-8
@@ -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.
|
||||
-8
@@ -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.
|
||||
-8
@@ -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.
|
||||
-8
@@ -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.
|
||||
-8
@@ -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.
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function transfer(uint) public;
|
||||
function f() public {
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user