| 2395 | } |
| 2396 | |
| 2397 | void TypeChecker::typeCheckERC7201Builtin(FunctionCall const& _functionCall, FunctionType const* _functionType) |
| 2398 | { |
| 2399 | // erc7201 builtin accepts only 1 argument. Invalid cases with different number |
| 2400 | // of arguments are treated after by function `typeCheckFunctionGeneralChecks` |
| 2401 | if (_functionCall.arguments().size() > 0) |
| 2402 | { |
| 2403 | Type const* argumentType = _functionCall.arguments()[0].get()->annotation().type; |
| 2404 | solAssert(argumentType); |
| 2405 | auto const* arrayType = dynamic_cast<ArrayType const*>(argumentType); |
| 2406 | |
| 2407 | if ( |
| 2408 | !dynamic_cast<StringLiteralType const*>(argumentType) && |
| 2409 | (!arrayType || !arrayType->isString()) |
| 2410 | ) |
| 2411 | { |
| 2412 | std::string errorMsg = "The argument to erc7201 builtin must be a string."; |
| 2413 | if (arrayType && arrayType->isByteArray()) |
| 2414 | errorMsg += " The supplied argument has type bytes."; |
| 2415 | m_errorReporter.typeError( |
| 2416 | 6896_error, |
| 2417 | _functionCall.arguments()[0]->location(), |
| 2418 | errorMsg |
| 2419 | ); |
| 2420 | } |
| 2421 | } |
| 2422 | typeCheckFunctionGeneralChecks(_functionCall, _functionType); |
| 2423 | } |
| 2424 | |
| 2425 | void TypeChecker::typeCheckFunctionGeneralChecks( |
| 2426 | FunctionCall const& _functionCall, |