Merge pull request #10963 from ethereum/test-variadic

Remove untriggerable errors on variadic calls (which have been removed)
This commit is contained in:
chriseth 2021-02-16 10:20:57 +01:00 committed by GitHub
commit 7f15be5549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -2082,7 +2082,10 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
".";
if (isStructConstructorCall)
return { isVariadic ? 1123_error : 9755_error, msg };
{
solAssert(!isVariadic, "");
return { 9755_error, msg };
}
else if (
_functionType->kind() == FunctionType::Kind::BareCall ||
_functionType->kind() == FunctionType::Kind::BareCallCode ||
@ -2090,16 +2093,17 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
_functionType->kind() == FunctionType::Kind::BareStaticCall
)
{
solAssert(!isVariadic, "");
if (arguments.empty())
return {
isVariadic ? 7653_error : 6138_error,
6138_error,
msg +
" This function requires a single bytes argument."
" Use \"\" as argument to provide empty calldata."
};
else
return {
isVariadic ? 9390_error : 8922_error,
8922_error,
msg +
" This function requires a single bytes argument."
" 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::RIPEMD160
)
{
solAssert(!isVariadic, "");
return {
isVariadic ? 1220_error : 4323_error,
4323_error,
msg +
" This function requires a single bytes argument."
" Use abi.encodePacked(...) to obtain the pre-0.5.0"
" behaviour or abi.encode(...) to use ABI encoding."
};
}
else
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
old_source_only_ids = {
"1123", "1220", "1584", "1823",
"1584", "1823",
"1988", "2066", "2657", "2800", "3356",
"3893", "3996", "4010", "4802",
"5073", "5272", "5622", "7128",
"7589", "7593", "7653", "8065", "8084", "8140",
"8312", "8592", "9085", "9390", "9609",
"7589", "7593", "8065", "8084", "8140",
"8312", "8592", "9085", "9609",
}
new_source_only_ids = source_only_ids - old_source_only_ids