Make non-payable default for conversion to address.

This commit is contained in:
chriseth
2018-09-20 14:31:04 +02:00
parent 2150aea344
commit d0461c49fe
8 changed files with 43 additions and 5 deletions
@@ -0,0 +1,7 @@
contract C {
function f() public view returns (address payable) {
return address(this.f);
}
}
// ----
// TypeError: (85-100): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
@@ -0,0 +1,7 @@
contract C {
function f(address a) public pure returns (address payable) {
return address(address(a));
}
}
// ----
// TypeError: (94-113): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
@@ -0,0 +1,8 @@
contract C {
function f(bytes32 x) public pure returns (address payable) {
return address(x);
}
}
// ----
// TypeError: (94-104): Explicit type conversion not allowed from "bytes32" to "address".
// TypeError: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
@@ -0,0 +1,8 @@
contract C {
function f(bytes10 x) public pure returns (address payable) {
return address(x);
}
}
// ----
// TypeError: (94-104): Explicit type conversion not allowed from "bytes10" to "address".
// TypeError: (94-104): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
@@ -0,0 +1,5 @@
contract C {
function f(bytes20 x) public pure returns (address payable) {
return address(x);
}
}
@@ -0,0 +1,5 @@
contract C {
function f(uint x) public pure returns (address payable) {
return address(x);
}
}