mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
functions taking calldata args should be assignable to function pointers of same type
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function g(string calldata) external returns (bool) { return true; }
|
||||
|
||||
function main() external returns (bool) {
|
||||
function (string memory) external returns (bool) ptr = this.g;
|
||||
return ptr("testString");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// main() -> true
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
function f(function (string calldata) external) external {}
|
||||
function g(string calldata) external {}
|
||||
|
||||
function main() external {
|
||||
function (string calldata) external ptr = this.g;
|
||||
abi.encodeCall(this.f, (this.g));
|
||||
this.f(this.g);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (161-209): Type function (string memory) external is not implicitly convertible to expected type function (string calldata) external.
|
||||
// TypeError 5407: (242-250): Cannot implicitly convert component at position 0 from "function (string memory) external" to "function (string calldata) external".
|
||||
// TypeError 9553: (268-274): Invalid type for argument in function call. Invalid implicit conversion from function (string memory) external to function (string calldata) external requested.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function g(string calldata) external {}
|
||||
|
||||
function main() view external {
|
||||
function (string memory) external ptr = this.g;
|
||||
ptr;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function g(bytes calldata b) pure internal {}
|
||||
|
||||
function main() pure external {
|
||||
function (bytes calldata) internal ptr = g;
|
||||
ptr;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user