mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
FunctionDefinition.resolveVirtual(): Skip unimplemented functions when lookup happens via super
This commit is contained in:
@@ -2,13 +2,17 @@ abstract contract I
|
||||
{
|
||||
function a() internal view virtual returns(uint256);
|
||||
}
|
||||
abstract contract V is I
|
||||
abstract contract J is I
|
||||
{
|
||||
function a() internal view virtual override returns(uint256);
|
||||
}
|
||||
abstract contract V is J
|
||||
{
|
||||
function b() public view returns(uint256) { return a(); }
|
||||
}
|
||||
contract C is V
|
||||
{
|
||||
function a() internal view override returns (uint256) { return 42;}
|
||||
function a() internal view override returns (uint256) { return 42; }
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
contract A {
|
||||
function f() public virtual returns (uint) {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
abstract contract I {
|
||||
function f() external virtual returns (uint);
|
||||
}
|
||||
|
||||
contract B is A, I {
|
||||
function f() override(A, I) public returns (uint) {
|
||||
// I.f() is before A.f() in the C3 linearized order
|
||||
// but it has no implementation.
|
||||
return super.f();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 42
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
contract A {
|
||||
function f() public virtual returns (uint) {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
interface I {
|
||||
function f() external returns (uint);
|
||||
}
|
||||
|
||||
contract B is A, I {
|
||||
function f() override(A, I) public returns (uint) {
|
||||
// I.f() is before A.f() in the C3 linearized order
|
||||
// but it has no implementation.
|
||||
return super.f();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 42
|
||||
Reference in New Issue
Block a user