mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use user defined function return type as user defined operator type
This commit is contained in:
@@ -1835,7 +1835,7 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
*userDefinedFunctionType->parameterTypes().at(0) ==
|
||||
*userDefinedFunctionType->parameterTypes().at(1)
|
||||
);
|
||||
commonType = userDefinedFunctionType->parameterTypes().at(0);
|
||||
commonType = userDefinedFunctionType->returnParameterTypes().at(0);
|
||||
}
|
||||
|
||||
_operation.annotation().commonType = commonType;
|
||||
|
||||
@@ -775,7 +775,7 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
|
||||
{
|
||||
setLocation(_binOp);
|
||||
|
||||
// TOOD make this nicer
|
||||
// TODO: make this nicer
|
||||
if (_binOp.annotation().userDefinedFunction)
|
||||
{
|
||||
_binOp.leftExpression().accept(*this);
|
||||
|
||||
@@ -990,7 +990,7 @@ ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
||||
};
|
||||
if (!util::contains(overridable, operator_))
|
||||
parserError(
|
||||
1885_error,
|
||||
4403_error,
|
||||
("The operator " + string{TokenTraits::toString(operator_)} + " cannot be user-implemented. This is only possible for the following operators: ") +
|
||||
util::joinHumanReadable(overridable | ranges::views::transform([](Token _t) { return string{TokenTraits::toString(_t)}; }))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user