mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test cases for assigning builtins/bound functions to function types
This commit is contained in:
parent
9e4f3bad06
commit
ff7e45f417
15
test/libsolidity/syntaxTests/functionTypes/assign_bound.sol
Normal file
15
test/libsolidity/syntaxTests/functionTypes/assign_bound.sol
Normal 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).
|
@ -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).
|
Loading…
Reference in New Issue
Block a user