mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9838 from ethereum/fix-wrong-name-reported-for-invalid-named-argument
Fix wrong name reported for invalid named argument
This commit is contained in:
commit
8e77bb5bfc
@ -19,6 +19,7 @@ Compiler Features:
|
|||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Code generator: Fix internal error on stripping dynamic types from return parameters on EVM versions without ``RETURNDATACOPY``.
|
* Code generator: Fix internal error on stripping dynamic types from return parameters on EVM versions without ``RETURNDATACOPY``.
|
||||||
* Type Checker: Disallow ``virtual`` for modifiers in libraries.
|
* Type Checker: Disallow ``virtual`` for modifiers in libraries.
|
||||||
|
* Type Checker: Correct the error message for invalid named parameter in a call to refer to the right argument.
|
||||||
* Type Checker: Correct the warning for homonymous, but not shadowing declarations.
|
* Type Checker: Correct the warning for homonymous, but not shadowing declarations.
|
||||||
* ViewPureChecker: Prevent visibility check on constructors.
|
* ViewPureChecker: Prevent visibility check on constructors.
|
||||||
* Type system: Fix internal error on implicit conversion of contract instance to the type of its ``super``.
|
* Type system: Fix internal error on implicit conversion of contract instance to the type of its ``super``.
|
||||||
|
@ -2091,18 +2091,17 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
|||||||
{
|
{
|
||||||
bool not_all_mapped = false;
|
bool not_all_mapped = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < paramArgMap.size(); i++)
|
for (size_t i = 0; i < argumentNames.size(); i++)
|
||||||
{
|
{
|
||||||
size_t j;
|
size_t j;
|
||||||
for (j = 0; j < argumentNames.size(); j++)
|
for (j = 0; j < parameterNames.size(); j++)
|
||||||
if (parameterNames[i] == *argumentNames[j])
|
if (parameterNames[j] == *argumentNames[i])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (j < argumentNames.size())
|
if (j < parameterNames.size())
|
||||||
paramArgMap[i] = arguments[j].get();
|
paramArgMap[j] = arguments[i].get();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paramArgMap[i] = nullptr;
|
|
||||||
not_all_mapped = true;
|
not_all_mapped = true;
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
4974_error,
|
4974_error,
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
contract test {
|
||||||
|
function f(uint a, bool b, bytes memory c, uint d, bool e) public returns (uint r) {
|
||||||
|
if (b && !e)
|
||||||
|
r = a + d;
|
||||||
|
else
|
||||||
|
r = c.length;
|
||||||
|
}
|
||||||
|
function g() public returns (uint r) {
|
||||||
|
r = f({c: "abc", x: 1, e: 2, a: 11, b: 12});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 4974: (249-288): Named argument "x" does not match function declaration.
|
@ -1,11 +0,0 @@
|
|||||||
contract test {
|
|
||||||
function a(uint a, uint b) public returns (uint r) {
|
|
||||||
r = a + b;
|
|
||||||
}
|
|
||||||
function b() public returns (uint r) {
|
|
||||||
r = a({a: 1, c: 2});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ----
|
|
||||||
// Warning 2519: (31-37): This declaration shadows an existing declaration.
|
|
||||||
// TypeError 4974: (153-168): Named argument "c" does not match function declaration.
|
|
Loading…
Reference in New Issue
Block a user