Propagate function call argument types across function call options.

This commit is contained in:
chriseth 2020-07-07 11:30:15 +02:00 committed by Alex Beregszaszi
parent 0c7e4cf16b
commit d4ecd33247
4 changed files with 18 additions and 9 deletions

View File

@ -3,6 +3,8 @@
Compiler Features:
* Code Generator: Evaluate ``keccak256`` of string literals at compile-time.
Bugfixes:
* Type Checker: Fix overload resolution in combination with ``{value: ...}``.
### 0.6.11 (2020-07-07)

View File

@ -2354,6 +2354,8 @@ bool TypeChecker::visit(FunctionCallOptions const& _functionCallOptions)
{
solAssert(_functionCallOptions.options().size() == _functionCallOptions.names().size(), "Lengths of name & value arrays differ!");
_functionCallOptions.expression().annotation().arguments = _functionCallOptions.annotation().arguments;
_functionCallOptions.expression().accept(*this);
auto expressionFunctionType = dynamic_cast<FunctionType const*>(type(_functionCallOptions.expression()));

View File

@ -0,0 +1,14 @@
contract C {
function f(uint x) external payable returns (uint) { return 1; }
function f(uint x, uint y) external payable returns (uint) { return 2; }
function call() public payable returns (uint v, uint x, uint y, uint z) {
v = this.f{value: 10}(2);
x = this.f{gas: 1000}(2, 3);
y = this.f{gas: 1000, value: 10}(2, 3);
z = this.f{gas: 1000}{value: 10}(2, 3);
}
receive() external payable {}
}
// ----
// (), 1 ether
// call() -> 1, 2, 2, 2

View File

@ -1,9 +0,0 @@
contract C {
function f(uint x) external payable { }
function f(uint x, uint y) external payable { }
function call() internal {
this.f{value: 10}(2);
}
}
// ----
// TypeError 6675: (148-154): Member "f" not unique after argument-dependent lookup in contract C.