mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixup! User-defined operators: Analysis
This commit is contained in:
parent
994304453e
commit
e4904cd608
@ -1735,7 +1735,7 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
|
||||
// Check if the operator is built-in or user-defined.
|
||||
TypeResult builtinResult = operandType->unaryOperatorResult(op);
|
||||
set<FunctionDefinition const*> matchingDefinitions = operandType->operatorDefinitions(
|
||||
_operation.getOperator(),
|
||||
op,
|
||||
*currentDefinitionScope(),
|
||||
true // _unary
|
||||
);
|
||||
@ -1830,12 +1830,13 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
if (builtinResult)
|
||||
commonType = builtinResult.get();
|
||||
else if (!matchingDefinitions.empty())
|
||||
{
|
||||
if (matchingDefinitions.size() >= 2)
|
||||
{
|
||||
SecondarySourceLocation secondaryLocation;
|
||||
for (FunctionDefinition const* definition: matchingDefinitions)
|
||||
secondaryLocation.append("Candidate definition:", definition->location());
|
||||
|
||||
if (matchingDefinitions.size() >= 2)
|
||||
m_errorReporter.typeError(
|
||||
5583_error,
|
||||
_operation.location(),
|
||||
@ -1845,6 +1846,7 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
TokenTraits::toString(_operation.getOperator())
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
operatorDefinition = *matchingDefinitions.begin();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user