mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
TypeChecker error when encoding functions with call options; tests
This commit is contained in:
parent
582c754598
commit
229587672f
@ -3112,6 +3112,8 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const* _sco
|
||||
|
||||
TypePointer FunctionType::encodingType() const
|
||||
{
|
||||
if (m_gasSet || m_valueSet)
|
||||
return nullptr;
|
||||
// Only external functions can be encoded, internal functions cannot leave code boundaries.
|
||||
if (m_kind == Kind::External)
|
||||
return this;
|
||||
|
@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
function f() public payable {
|
||||
abi.encode(this.f{value: 2});
|
||||
abi.encode(this.f{gas: 2});
|
||||
abi.encode(this.f{value: 2, gas: 1});
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (60-76): This type cannot be encoded.
|
||||
// TypeError: (92-106): This type cannot be encoded.
|
||||
// TypeError: (122-146): This type cannot be encoded.
|
@ -1,12 +1,11 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f.gas, blockhash));
|
||||
bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f{gas: 2}, blockhash));
|
||||
h;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (105-115): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
|
||||
// TypeError: (91-100): This type cannot be encoded.
|
||||
// TypeError: (102-103): This type cannot be encoded.
|
||||
// TypeError: (105-115): This type cannot be encoded.
|
||||
// TypeError: (117-126): This type cannot be encoded.
|
||||
// TypeError: (105-119): This type cannot be encoded.
|
||||
// TypeError: (121-130): This type cannot be encoded.
|
||||
|
Loading…
Reference in New Issue
Block a user