Add test: operator_parameter_with_wrong_data_location

This commit is contained in:
wechman 2022-07-12 12:20:22 +02:00
parent 61075e28db
commit 8272da0aea
2 changed files with 10 additions and 1 deletions

View File

@ -403,7 +403,6 @@ FunctionDefinition const* Type::userDefinedOperator(Token _token, ASTNode const&
function.libraryFunction() ? function.typeViaContractName() : function.type()
);
solAssert(functionType && !functionType->parameterTypes().empty());
// TODO does this work (data location)?
solAssert(isImplicitlyConvertibleTo(*functionType->parameterTypes().front()));
if ((_unaryOperation && function.parameterList().parameters().size() == 1) ||
(!_unaryOperation && function.parameterList().parameters().size() == 2))

View File

@ -0,0 +1,10 @@
struct S { uint128 x; }
using {add as +} for S;
function add(S memory, S storage) returns (S memory) {
return S(0);
}
// ----
// TypeError 1884: (32-35): The function "add" needs to have two parameters of equal type to be used for the operator +.