Merge pull request #6906 from ethereum/delegatecall_value_msg

Improve error message for delegatecall.value
This commit is contained in:
Leonardo authored and GitHub committed 2019-06-12 21:14:54 +02:00
commit d2019f49ea
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -2065,6 +2065,11 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
{
if (funType->kind() == FunctionType::Kind::Creation)
errorMsg = "Constructor for " + t.front()->toString() + " must be payable for member \"value\" to be available.";
else if (
funType->kind() == FunctionType::Kind::DelegateCall ||
funType->kind() == FunctionType::Kind::BareDelegateCall
)
errorMsg = "Member \"value\" is not allowed in delegated calls due to \"msg.value\" persisting.";
else
errorMsg = "Member \"value\" is only available for payable functions.";
}
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
// TypeError: (87-96): Member "value" is only available for payable functions.
// TypeError: (87-96): Member "value" is not allowed in delegated calls due to "msg.value" persisting.