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.
|
// Check if the operator is built-in or user-defined.
|
||||||
TypeResult builtinResult = operandType->unaryOperatorResult(op);
|
TypeResult builtinResult = operandType->unaryOperatorResult(op);
|
||||||
set<FunctionDefinition const*> matchingDefinitions = operandType->operatorDefinitions(
|
set<FunctionDefinition const*> matchingDefinitions = operandType->operatorDefinitions(
|
||||||
_operation.getOperator(),
|
op,
|
||||||
*currentDefinitionScope(),
|
*currentDefinitionScope(),
|
||||||
true // _unary
|
true // _unary
|
||||||
);
|
);
|
||||||
@ -1831,11 +1831,12 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
|||||||
commonType = builtinResult.get();
|
commonType = builtinResult.get();
|
||||||
else if (!matchingDefinitions.empty())
|
else if (!matchingDefinitions.empty())
|
||||||
{
|
{
|
||||||
SecondarySourceLocation secondaryLocation;
|
|
||||||
for (FunctionDefinition const* definition: matchingDefinitions)
|
|
||||||
secondaryLocation.append("Candidate definition:", definition->location());
|
|
||||||
|
|
||||||
if (matchingDefinitions.size() >= 2)
|
if (matchingDefinitions.size() >= 2)
|
||||||
|
{
|
||||||
|
SecondarySourceLocation secondaryLocation;
|
||||||
|
for (FunctionDefinition const* definition: matchingDefinitions)
|
||||||
|
secondaryLocation.append("Candidate definition:", definition->location());
|
||||||
|
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
5583_error,
|
5583_error,
|
||||||
_operation.location(),
|
_operation.location(),
|
||||||
@ -1845,6 +1846,7 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
|||||||
TokenTraits::toString(_operation.getOperator())
|
TokenTraits::toString(_operation.getOperator())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
operatorDefinition = *matchingDefinitions.begin();
|
operatorDefinition = *matchingDefinitions.begin();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user