mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9411 from ethereum/private-payable-msg
Nicer error message for private payable functions
This commit is contained in:
commit
e970e58a9f
@ -337,7 +337,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
|||||||
if (_function.libraryFunction())
|
if (_function.libraryFunction())
|
||||||
m_errorReporter.typeError(7708_error, _function.location(), "Library functions cannot be payable.");
|
m_errorReporter.typeError(7708_error, _function.location(), "Library functions cannot be payable.");
|
||||||
if (_function.isOrdinary() && !_function.isPartOfExternalInterface())
|
if (_function.isOrdinary() && !_function.isPartOfExternalInterface())
|
||||||
m_errorReporter.typeError(5587_error, _function.location(), "Internal functions cannot be payable.");
|
m_errorReporter.typeError(5587_error, _function.location(), "\"internal\" and \"private\" functions cannot be payable.");
|
||||||
}
|
}
|
||||||
auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& var) {
|
auto checkArgumentAndReturnParameter = [&](VariableDeclaration const& var) {
|
||||||
if (type(var)->category() == Type::Category::Mapping)
|
if (type(var)->category() == Type::Category::Mapping)
|
||||||
|
@ -2,4 +2,4 @@ contract test {
|
|||||||
function f() payable internal {}
|
function f() payable internal {}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 5587: (20-52): Internal functions cannot be payable.
|
// TypeError 5587: (20-52): "internal" and "private" functions cannot be payable.
|
||||||
|
@ -2,4 +2,4 @@ contract test {
|
|||||||
function f() payable private {}
|
function f() payable private {}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 5587: (20-51): Internal functions cannot be payable.
|
// TypeError 5587: (20-51): "internal" and "private" functions cannot be payable.
|
||||||
|
Loading…
Reference in New Issue
Block a user