solidity
solidity copied to clipboard
Function selectors from inherited interfaces are not visible in parent interface
Description
The following code fails to compile with:
TypeError: Member "b" not found or not visible after argument-dependent lookup in type(contract I2).
pragma solidity 0.8.26;
interface I1 {
function b() external;
}
interface I2 is I1 {
function a() external;
}
// ✅ Test 1 -- passes
contract test_a {
function a() external view returns (bytes4) {
return I2.a.selector;
}
}
// ❌ Test 1 -- should pass
contract test_b {
function b() external view returns (bytes4) {
return I2.b.selector;
}
}
Why?
According to official v0.8.26 documentation,
Interfaces can inherit from other interfaces. This has the same rules as normal inheritance:
Thanks for the report @mnusurov.
Yeah just ran into this too, would be a good quality of life improvement
we ran into this for @0xTwyne contracts. Would be good to fix this.