mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow suffixes with zero or more than one return value.
This commit is contained in:
parent
2d7a031d47
commit
16f175d3b6
@ -3829,7 +3829,7 @@ void TypeChecker::endVisit(Literal const& _literal)
|
|||||||
|
|
||||||
optional<string> parameterTypeMessage;
|
optional<string> parameterTypeMessage;
|
||||||
if (parameterCountMessage.has_value())
|
if (parameterCountMessage.has_value())
|
||||||
m_errorReporter.typeError(4778_error, _literal.location(), parameterCountMessage.value());
|
m_errorReporter.typeError(9128_error, _literal.location(), parameterCountMessage.value());
|
||||||
else if (suffixFunctionType->parameterTypes().size() == 2)
|
else if (suffixFunctionType->parameterTypes().size() == 2)
|
||||||
{
|
{
|
||||||
solAssert(literalRationalType);
|
solAssert(literalRationalType);
|
||||||
@ -3854,8 +3854,13 @@ void TypeChecker::endVisit(Literal const& _literal)
|
|||||||
if (suffixFunctionType->returnParameterTypes().size() == 1)
|
if (suffixFunctionType->returnParameterTypes().size() == 1)
|
||||||
_literal.annotation().type = suffixFunctionType->returnParameterTypes().front();
|
_literal.annotation().type = suffixFunctionType->returnParameterTypes().front();
|
||||||
else
|
else
|
||||||
_literal.annotation().type = TypeProvider::tuple(suffixFunctionType->returnParameterTypes());
|
{
|
||||||
|
m_errorReporter.typeError(
|
||||||
|
7848_error,
|
||||||
|
_literal.location(),
|
||||||
|
"Function must return exactly one value to be used as literal suffix."
|
||||||
|
);
|
||||||
|
}
|
||||||
isCompileTimeConstant = suffixFunctionType->isPure();
|
isCompileTimeConstant = suffixFunctionType->isPure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user