Add test cases for assigning builtins/bound functions to function types

This commit is contained in:
Alex Beregszaszi 2020-07-08 18:23:44 +01:00
parent 9e4f3bad06
commit ff7e45f417
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,15 @@
library L {
function foo(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
}
contract C {
using L for uint256;
function bar() public {
uint256 x;
function (uint256, uint256) internal pure returns (uint256) ptr = x.foo;
}
}
// ----
// TypeError 9574: (209-280): Type function (uint256,uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256).

View File

@ -0,0 +1,7 @@
contract C {
function f() public {
function (uint) view returns (bytes32) _blockhash = blockhash;
}
}
// ----
// TypeError 9574: (42-103): Type function (uint256) view returns (bytes32) is not implicitly convertible to expected type function (uint256) view returns (bytes32).