Skip to content

Commit c877f69

Browse files
Error message for invalid constant argument type
1 parent 65e6014 commit c877f69

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

libsolidity/analysis/ConstantEvaluator.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,22 @@ void ConstantEvaluator::endVisit(FunctionCall const& _functionCall)
461461
8248_error,
462462
_functionCall.location(),
463463
fmt::format(
464-
"erc7201 builtin function expects 1 parameter, but {} were given.",
464+
"erc7201 function expects 1 parameter, but {} were given.",
465465
_functionCall.arguments().size()
466466
)
467467
);
468468
return;
469469
}
470470
auto stringArg = evaluate(*(_functionCall.arguments()[0].get()));
471471
if (!std::holds_alternative<std::string>(stringArg.value))
472+
{
473+
m_errorReporter.typeError(
474+
9796_error,
475+
_functionCall.arguments()[0]->location(),
476+
"Invalid argument type for erc7201 function. Expected literal or constant string."
477+
);
472478
return;
479+
}
473480

474481
h256 innerKeccak = keccak256(std::get<std::string>(stringArg.value));
475482
h256 outerKeccak = keccak256(h256(u256(innerKeccak) - 1));

0 commit comments

Comments
 (0)