Open
Description
Version: solidity ^0.6.3
Platform: http://remix.ethereum.org/#optimize=false&evmVersion=null&version=soljson-v0.6.3+commit.8dda9521.js
Issue: override(Two, One) doesn't seam to have the intended behavior. Instead, it retains the contract import inheritance.
Example:
pragma solidity ^0.6.3;
contract One {
uint256 public a;
event Hah(string message, uint a, uint b);
function foo() virtual public {
a = 1;
emit Hah("One::foo()", a, 0);
}
}
contract Two {
uint256 public b;
event Hah(string message, uint a, uint b);
function foo() virtual public {
b = 2;
emit Hah("Two::foo()", 0, b);
}
}
// Override contract One
contract OneAndTwo is One, Two {
event Hah(string message, uint a, uint b);
function foo() public override(One, Two) {
super.foo();
emit Hah("OneAndTwo::foo() after super.foo()", a, b);
}
}
// Calls Two.foo()
// Swap override contracts
contract OneAndTwoReversed is One, Two {
event Hah(string message, uint a, uint b);
function foo() public override(Two, One) {
super.foo();
emit Hah("OneAndTwoReversed::foo() after super.foo()", a, b);
}
}
// Still calls Two.foo()
// Swap import contracts
contract TwoAndOne is Two, One {
event Hah(string message, uint a, uint b);
function foo() public override(Two, One) {
super.foo();
emit Hah("TwoAndOne::foo() after super.foo()", a, b);
}
}
// Now calls One.foo()
Thanks to BokkyPooBah for workshopping this and providing the code examples
Metadata
Metadata
Assignees
Labels
There is not much implementation work to be done. The task is very easy or tiny.Changes are not very noticeable or potential benefits are limited.Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.The proposal is too vague to be implemented right away