Replace casting of external functions to address by a member named "address".

This commit is contained in:
Daniel Kirchner
2019-08-19 14:56:04 +02:00
committed by chriseth
parent d3ea86b052
commit 9f6fff2120
12 changed files with 72 additions and 51 deletions
@@ -1,5 +1,5 @@
contract C {
function f() public view returns (address) {
return address(this.f);
return this.f.address;
}
}
@@ -1,7 +1,7 @@
contract C {
function f() public view returns (address payable) {
return address(this.f);
return this.f.address;
}
}
// ----
// TypeError: (85-100): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
// TypeError: (85-99): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
@@ -0,0 +1,9 @@
contract C {
struct S { uint a; }
function f() public pure returns(address) {
S memory s = S(42);
return s.address;
}
}
// ----
// TypeError: (129-138): Member "address" not found or not visible after argument-dependent lookup in struct C.S memory.
@@ -0,0 +1,5 @@
contract C {
struct S { uint address; }
}
// ----
// ParserError: (33-40): Expected identifier but got 'address'