Merge pull request #4219 from ethereum/functionTypeNamedArguments

Turn named return parameters in function types into an error.
This commit is contained in:
Alex Beregszaszi 2018-06-20 23:51:19 +02:00 committed by GitHub
commit 7e4bd3e346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View File

@ -21,6 +21,7 @@ Breaking Changes:
* Type Checker: Disallow arithmetic operations for boolean variables.
* Type Checker: Disallow conversions between ``bytesX`` and ``uintY`` of different size.
* Remove obsolete ``std`` directory from the Solidity repository. This means accessing ``https://github.com/ethereum/soldity/blob/develop/std/*.sol`` (or ``https://github.com/ethereum/solidity/std/*.sol`` in Remix) will not be possible.
* Syntax Checker: Named return values in function types are an error.
Language Features:
* General: Allow appending ``calldata`` keyword to types, to explicitly specify data location for arguments of external functions.

View File

@ -255,7 +255,7 @@ bool SyntaxChecker::visit(FunctionTypeName const& _node)
for (auto const& decl: _node.returnParameterTypeList()->parameters())
if (!decl->name().empty())
m_errorReporter.warning(decl->location(), "Naming function type return parameters is deprecated.");
m_errorReporter.syntaxError(decl->location(), "Return parameters in function types may not be named.");
return true;
}

View File

@ -0,0 +1,5 @@
contract C {
function(uint) returns (bool ret) f;
}
// ----
// SyntaxError: (41-49): Return parameters in function types may not be named.

View File

@ -1,5 +0,0 @@
contract C {
function(uint) returns (bool ret) f;
}
// ----
// Warning: (41-49): Naming function type return parameters is deprecated.

View File

@ -1,6 +1,6 @@
contract test {
struct S {
function (uint x, uint y) internal returns (uint a) f;
function (uint x, uint y) internal returns (uint) f;
function (uint, uint) external returns (uint) g;
uint d;
}
@ -8,4 +8,3 @@ contract test {
// ----
// Warning: (49-55): Naming function type parameters is deprecated.
// Warning: (57-63): Naming function type parameters is deprecated.
// Warning: (83-89): Naming function type return parameters is deprecated.