Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3139,14 +3139,22 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
else if (auto const* addressType = dynamic_cast<AddressType const*>(exprType))
{
// Trigger error when using send or transfer with a non-payable fallback function.
if (memberName == "send" || memberName == "transfer" || memberName == "transferToken")
if (
memberName == "send" ||
memberName == "transfer" ||
memberName == "transferToken" ||
memberName == "freeze" ||
memberName == "unfreeze" ||
memberName == "delegateResource" ||
memberName == "unDelegateResource"
)
{
solAssert(
addressType->stateMutability() != StateMutability::Payable,
"Expected address not-payable as members were not found"
);

return { 9862_error, "\"send\", \"transfer\" and \"transferToken\" are only available for objects of type \"address payable\", not \"" + exprType->humanReadableName() + "\"." };
return { 9862_error, "\"send\", \"transfer\", \"transferToken\", \"freeze\", \"unfreeze\", \"delegateResource\" and \"unDelegateResource\" are only available for objects of type \"address payable\", not \"" + exprType->humanReadableName() + "\"." };
}
}

Expand Down
4 changes: 2 additions & 2 deletions libsolidity/analysis/ViewPureChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ void ViewPureChecker::reportMutability(
5887_error,
_location,
m_currentFunction->isConstructor() ?
"\"msg.value\" and \"callvalue()\" can only be used in payable constructors. Make the constructor \"payable\" to avoid this error."
: "\"msg.value\" and \"callvalue()\" can only be used in payable public functions. Make the function \"payable\" or use an internal function to avoid this error."
"\"msg.value\", \"msg.tokenid\", \"msg.tokenvalue\" and \"callvalue()\" can only be used in payable constructors. Make the constructor \"payable\" to avoid this error."
: "\"msg.value\", \"msg.tokenid\", \"msg.tokenvalue\" and \"callvalue()\" can only be used in payable public functions. Make the function \"payable\" or use an internal function to avoid this error."
);
m_errors = true;
}
Expand Down
2 changes: 1 addition & 1 deletion solc/CommandLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ void CommandLineParser::processArgs()
"The --" + g_strViaIR + " is currently experimental for TRON solidity compiler. Use --" + g_strExperimentalViaIR + " instead."
);
}
m_options.output.viaIR = (m_args.count(g_strExperimentalViaIR) > 0 || m_args.count(g_strViaIR) > 0);
m_options.output.viaIR = (m_args.count(g_strExperimentalViaIR) > 0);

solAssert(
m_options.input.mode == InputMode::Compiler ||
Expand Down