Some more tests.

This commit is contained in:
chriseth 2020-11-18 20:09:39 +01:00
parent 0326367b22
commit 19e9e8b550
5 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,19 @@
contract A {
fallback (bytes calldata _input) virtual external returns (bytes memory) {
return _input;
}
}
contract B is A {
fallback (bytes calldata _input) override external returns (bytes memory) {
return "xyz";
}
function f() public returns (bool, bytes memory) {
(bool success, bytes memory retval) = address(this).call("abc");
return (success, retval);
}
}
// ====
// EVMVersion: >=byzantium
// compileViaYul: also
// ----
// f() -> 0x01, 0x40, 0x03, 0x78797a0000000000000000000000000000000000000000000000000000000000

View File

@ -0,0 +1,18 @@
contract A {
fallback (bytes calldata _input) virtual external returns (bytes memory) {
return _input;
}
}
contract B is A {
fallback () override external {
}
function f() public returns (bool, bytes memory) {
(bool success, bytes memory retval) = address(this).call("abc");
return (success, retval);
}
}
// ====
// EVMVersion: >=byzantium
// compileViaYul: also
// ----
// f() -> 1, 0x40, 0x00

View File

@ -0,0 +1,22 @@
contract A {
fallback (bytes calldata _input) virtual external returns (bytes memory) {
return _input;
}
}
contract B {
fallback (bytes calldata _input) virtual external returns (bytes memory) {
return "xyz";
}
}
contract C is B, A {
fallback () external override (B, A) {}
function f() public returns (bool, bytes memory) {
(bool success, bytes memory retval) = address(this).call("abc");
return (success, retval);
}
}
// ====
// EVMVersion: >=byzantium
// compileViaYul: also
// ----
// f() -> 0x01, 0x40, 0x00

View File

@ -0,0 +1,13 @@
contract D {
fallback(bytes memory) external returns (bytes memory) {}
}
contract E {
fallback(bytes memory) external returns (bytes calldata) {}
}
contract F {
fallback(bytes calldata) external returns (bytes calldata) {}
}
// ----
// TypeError 5570: (57-71): Fallback function either has to have the signature "fallback()" or "fallback(bytes calldata) returns (bytes memory)".
// TypeError 5570: (134-150): Fallback function either has to have the signature "fallback()" or "fallback(bytes calldata) returns (bytes memory)".
// TypeError 5570: (215-231): Fallback function either has to have the signature "fallback()" or "fallback(bytes calldata) returns (bytes memory)".

View File

@ -0,0 +1,20 @@
contract A {
fallback (bytes calldata _input) external returns (bytes memory) {
return _input;
}
}
contract B {
fallback (bytes calldata _input) external returns (bytes memory) {
return "xyz";
}
}
contract C is B, A {
function f() public returns (bool, bytes memory) {
(bool success, bytes memory retval) = address(this).call("abc");
return (success, retval);
}
}
// ====
// EVMVersion: >=byzantium
// ----
// TypeError 6480: (229-420): Derived contract must override function "". Two or more base classes define function with same name and parameter types.