If I have the following inheritance:
pragma solidity ^0.4.24;
interface A {
function foo(uint256 _x) external pure returns(uint256);
}
contract B1 is A {
function foo(uint256 _x) public pure returns(uint256) { return _x + 1; }
}
contract B2 is A {
}
contract C_OK is B1, B2 {
function foo(uint256 _x) public pure returns(uint256) { return super.foo(_x); }
}
contract C_NOT_OK is B1, A {
function foo(uint256 _x) public pure returns(uint256) { return super.foo(_x); }
}
contract C_OK compiles fine, but for contract C_NOT_OK I get a
TypeError: Linearization of inheritance graph impossible
contract C_NOT_OK is B1, A {
I don't really see why I get an error here but not for C_OK, since the only difference is that C_OK inherits from B2 instead of from A, but B2 is empty and directly inherits from A, so C_OK and C_NOT_OK should be equivalent.
What's going on here?