Remove untriggerable errors on variadic calls (which have been removed)

This commit is contained in:
Alex Beregszaszi 2021-02-15 19:52:10 +00:00
parent 9d762f381f
commit fd9050614a
2 changed files with 14 additions and 7 deletions

View File

@ -2082,7 +2082,10 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
"."; ".";
if (isStructConstructorCall) if (isStructConstructorCall)
return { isVariadic ? 1123_error : 9755_error, msg }; {
solAssert(!isVariadic, "");
return { 9755_error, msg };
}
else if ( else if (
_functionType->kind() == FunctionType::Kind::BareCall || _functionType->kind() == FunctionType::Kind::BareCall ||
_functionType->kind() == FunctionType::Kind::BareCallCode || _functionType->kind() == FunctionType::Kind::BareCallCode ||
@ -2090,16 +2093,17 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
_functionType->kind() == FunctionType::Kind::BareStaticCall _functionType->kind() == FunctionType::Kind::BareStaticCall
) )
{ {
solAssert(!isVariadic, "");
if (arguments.empty()) if (arguments.empty())
return { return {
isVariadic ? 7653_error : 6138_error, 6138_error,
msg + msg +
" This function requires a single bytes argument." " This function requires a single bytes argument."
" Use \"\" as argument to provide empty calldata." " Use \"\" as argument to provide empty calldata."
}; };
else else
return { return {
isVariadic ? 9390_error : 8922_error, 8922_error,
msg + msg +
" This function requires a single bytes argument." " This function requires a single bytes argument."
" If all your arguments are value types, you can use" " If all your arguments are value types, you can use"
@ -2111,13 +2115,16 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
_functionType->kind() == FunctionType::Kind::SHA256 || _functionType->kind() == FunctionType::Kind::SHA256 ||
_functionType->kind() == FunctionType::Kind::RIPEMD160 _functionType->kind() == FunctionType::Kind::RIPEMD160
) )
{
solAssert(!isVariadic, "");
return { return {
isVariadic ? 1220_error : 4323_error, 4323_error,
msg + msg +
" This function requires a single bytes argument." " This function requires a single bytes argument."
" Use abi.encodePacked(...) to obtain the pre-0.5.0" " Use abi.encodePacked(...) to obtain the pre-0.5.0"
" behaviour or abi.encode(...) to use ABI encoding." " behaviour or abi.encode(...) to use ABI encoding."
}; };
}
else else
return { isVariadic ? 9308_error : 6160_error, msg }; return { isVariadic ? 9308_error : 6160_error, msg };
}(); }();

View File

@ -220,12 +220,12 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False):
return False return False
old_source_only_ids = { old_source_only_ids = {
"1123", "1220", "1584", "1823", "1584", "1823",
"1988", "2066", "2657", "2800", "3356", "1988", "2066", "2657", "2800", "3356",
"3893", "3996", "4010", "4802", "3893", "3996", "4010", "4802",
"5073", "5272", "5622", "7128", "5073", "5272", "5622", "7128",
"7589", "7593", "7653", "8065", "8084", "8140", "7589", "7593", "8065", "8084", "8140",
"8312", "8592", "9085", "9390", "9609", "8312", "8592", "9085", "9609",
} }
new_source_only_ids = source_only_ids - old_source_only_ids new_source_only_ids = source_only_ids - old_source_only_ids