Allow explicit conversion from address to address payable

This commit is contained in:
Leonardo Alt
2019-09-09 23:46:00 +02:00
parent b6b2a3b8be
commit 5cfe0b7670
23 changed files with 248 additions and 172 deletions
@@ -0,0 +1,11 @@
contract C {
function g(address payable _p) internal pure returns (uint) {
return 1;
}
function f(address _a) public pure {
uint x = g(payable(_a));
uint y = g(_a);
}
}
// ----
// TypeError: (169-171): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
@@ -0,0 +1,9 @@
contract C {
function f() public view {
address payable p = payable(msg.sender);
address payable q = payable(address(msg.sender));
}
}
// ----
// Warning: (43-60): Unused local variable.
// Warning: (86-103): Unused local variable.
@@ -0,0 +1,8 @@
contract C {
function f() public pure {
address payable p = payable(this);
address payable q = payable(address(this));
}
}
// ----
// TypeError: (63-76): Explicit type conversion not allowed from "contract C" to "address payable".
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
address payable q = payable;
}
}
// ----
// ParserError: (70-71): Expected '(' but got ';'