mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Turn warning into error.
This commit is contained in:
parent
75a92b0ffd
commit
431c2fbcf3
@ -262,16 +262,18 @@ void ViewPureChecker::reportMutability(
|
||||
if (m_currentFunction->isPublic() && m_currentFunction->inContractKind() != ContractDefinition::ContractKind::Library)
|
||||
{
|
||||
if (_nestedLocation)
|
||||
m_errorReporter.warning(
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"This modifier uses \"msg.value\" and thus the function should be payable.",
|
||||
SecondarySourceLocation().append("\"msg.value\" appears here inside the modifier.", *_nestedLocation)
|
||||
SecondarySourceLocation().append("\"msg.value\" appears here inside the modifier.", *_nestedLocation),
|
||||
"This modifier uses \"msg.value\" and thus the function has to be payable or internal."
|
||||
);
|
||||
else
|
||||
m_errorReporter.warning(
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"\"msg.value\" used in non-payable function. Do you want to add the \"payable\" modifier to this function?"
|
||||
"\"msg.value\" can only be used in payable public functions. Make the function "
|
||||
"\"payable\" or use an internal function to avoid this error."
|
||||
);
|
||||
m_errors = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3,4 +3,4 @@ contract C {
|
||||
function f() costs(1 ether) public view {}
|
||||
}
|
||||
// ----
|
||||
// Warning: (101-115): This modifier uses "msg.value" and thus the function should be payable.
|
||||
// TypeError: (101-115): This modifier uses "msg.value" and thus the function has to be payable or internal.
|
||||
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (52-61): "msg.value" used in non-payable function. Do you want to add the "payable" modifier to this function?
|
||||
// TypeError: (52-61): "msg.value" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error.
|
||||
|
@ -3,4 +3,4 @@ contract C {
|
||||
function f() m(1 ether, msg.value) public view {}
|
||||
}
|
||||
// ----
|
||||
// Warning: (118-127): "msg.value" used in non-payable function. Do you want to add the "payable" modifier to this function?
|
||||
// TypeError: (118-127): "msg.value" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error.
|
||||
|
Loading…
Reference in New Issue
Block a user