Override semantics for fallback function.

This commit is contained in:
chriseth
2020-11-23 14:22:37 +01:00
parent bb9688e0fe
commit 67ec5f6b17
4 changed files with 38 additions and 9 deletions
@@ -0,0 +1,6 @@
contract C {
fallback(bytes calldata _input) external returns (bytes memory _output) {}
fallback() external {}
}
// ----
// DeclarationError 7301: (96-118): Only one fallback function is allowed.
@@ -0,0 +1,9 @@
contract C {
fallback(bytes calldata _input) external returns (bytes memory _output) {}
}
contract D is C {
fallback() external {}
}
// ----
// TypeError 9456: (116-138): Overriding function is missing "override" specifier.
// TypeError 4334: (17-91): Trying to override non-virtual function. Did you forget to add "virtual"?
@@ -0,0 +1,7 @@
contract C {
fallback(bytes calldata _input) external virtual returns (bytes memory _output) {}
}
contract D is C {
fallback() external override {}
}
// ----