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:
parent
58d19a51c6
commit
6482f5bb17
@ -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)}; }))
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ using {
|
||||
} for int256;
|
||||
|
||||
// ----
|
||||
// ParserError 1885: (22-24): The operator << cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 1885: (36-38): The operator >> cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 1885: (51-53): The operator ** cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 1885: (62-63): The operator ! cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 4403: (22-24): The operator << cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 4403: (36-38): The operator >> cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 4403: (51-53): The operator ** cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
// ParserError 4403: (62-63): The operator ! cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||
|
Loading…
Reference in New Issue
Block a user