Open
Description
Description
Rules for deciding whether the code using .address
or .selector
on public functions is valid or not seem pretty random. It sometimes works without this
and sometimes doesn't. Behavior is different between for .selector
and for .address
. It also changes depending on whether the value is actually used or not.
Example
contract B {
function g() public {}
}
contract C is B {
function h() public {
address a1 = g.address; // Error: Member "address" not found or not visible after argument-dependent lookup in function ().
address a2 = this.g.address;
address a3 = h.address; // Error: Member "address" not found or not visible after argument-dependent lookup in function ().
address a4 = this.h.address;
g.address; // Error: Expected identifier but got 'address'
this.g.address; // Error: Expected identifier but got 'address'
h.address; // Error: Expected identifier but got 'address'
this.h.address; // Error: Expected identifier but got 'address'
bytes4 s1 = g.selector;
bytes4 s2 = this.g.selector;
bytes4 s3 = h.selector; // Error: Member "selector" not found or not visible after argument-dependent lookup in function ().
bytes4 s4 = this.h.selector;
g.selector;
this.g.selector;
h.selector; // Error: Member "selector" not found or not visible after argument-dependent lookup in function ().
this.h.selector;
}
}
Environment
- Compiler version: 0.8.1
- Operating system: Arch Linux