Skip to content

Commit

Permalink
Fixed type check
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkovAlexander committed Sep 15, 2023
1 parent a8953b7 commit dd5d8e2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion compiler/libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3929,7 +3929,20 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
break;
}
case FunctionType::Kind::SHA1:
case FunctionType::Kind::KECCAK256:
case FunctionType::Kind::KECCAK256: {
if (arguments.size() != 1) {
m_errorReporter.fatalTypeError(228_error, _functionCall.location(), "Expected one argument.");
}

Type const* argType = arguments.at(0)->annotation().type->mobileType();
auto arrayType = dynamic_cast<ArrayType const *>(argType);
if (!(arrayType && arrayType->isByteArrayOrString())) {
m_errorReporter.fatalTypeError(228_error, arguments.at(0)->location(), "Expected bytes or string type.");
}
paramTypes.push_back(argType);
returnTypes.emplace_back(TypeProvider::uint256());
break;
}
case FunctionType::Kind::SHA256: {
if (arguments.size() != 1) {
m_errorReporter.fatalTypeError(228_error, _functionCall.location(), "Expected one argument.");
Expand Down

0 comments on commit dd5d8e2

Please sign in to comment.