mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow empty return expressions in functions with non-empty return parameters.
This commit is contained in:
parent
d7756322c0
commit
cc83e69469
@ -46,6 +46,7 @@ Breaking Changes:
|
|||||||
* Type Checker: Disallow calling base constructors without parentheses. This was already the case in the experimental 0.5.0 mode.
|
* Type Checker: Disallow calling base constructors without parentheses. This was already the case in the experimental 0.5.0 mode.
|
||||||
* Type Checker: Disallow conversions between ``bytesX`` and ``uintY`` of different size.
|
* Type Checker: Disallow conversions between ``bytesX`` and ``uintY`` of different size.
|
||||||
* Type Checker: Disallow conversions between unrelated contract types. Explicit conversion via ``address`` can still achieve it.
|
* Type Checker: Disallow conversions between unrelated contract types. Explicit conversion via ``address`` can still achieve it.
|
||||||
|
* Type Checker: Disallow empty return statements for functions with one or more return values.
|
||||||
* Type Checker: Disallow empty tuple components. This was partly already the case in the experimental 0.5.0 mode.
|
* Type Checker: Disallow empty tuple components. This was partly already the case in the experimental 0.5.0 mode.
|
||||||
* Type Checker: Disallow multi-variable declarations with mismatching number of values. This was already the case in the experimental 0.5.0 mode.
|
* Type Checker: Disallow multi-variable declarations with mismatching number of values. This was already the case in the experimental 0.5.0 mode.
|
||||||
* Type Checker: Disallow specifying base constructor arguments multiple times in the same inheritance hierarchy. This was already the case in the experimental 0.5.0 mode.
|
* Type Checker: Disallow specifying base constructor arguments multiple times in the same inheritance hierarchy. This was already the case in the experimental 0.5.0 mode.
|
||||||
|
@ -979,9 +979,13 @@ bool TypeChecker::visit(ForStatement const& _forStatement)
|
|||||||
|
|
||||||
void TypeChecker::endVisit(Return const& _return)
|
void TypeChecker::endVisit(Return const& _return)
|
||||||
{
|
{
|
||||||
if (!_return.expression())
|
|
||||||
return;
|
|
||||||
ParameterList const* params = _return.annotation().functionReturnParameters;
|
ParameterList const* params = _return.annotation().functionReturnParameters;
|
||||||
|
if (!_return.expression())
|
||||||
|
{
|
||||||
|
if (params && !params->parameters().empty())
|
||||||
|
m_errorReporter.typeError(_return.location(), "Return arguments required.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!params)
|
if (!params)
|
||||||
{
|
{
|
||||||
m_errorReporter.typeError(_return.location(), "Return arguments not allowed.");
|
m_errorReporter.typeError(_return.location(), "Return arguments not allowed.");
|
||||||
|
Loading…
Reference in New Issue
Block a user