[SMTChecker] Fix in abi handling - tuple expression of size 1 has the type of the member and not TupleType

This commit is contained in:
Martin Blicha 2021-01-14 11:47:23 +01:00
parent b4d2a71eec
commit 504e4c22b2

View File

@ -203,15 +203,20 @@ void SymbolicState::buildABIFunctions(set<FunctionCall const*> const& _abiFuncti
if (t->kind() == FunctionType::Kind::ABIDecode)
{
/// abi.decode : (bytes, tuple_of_types(return_types)) -> (return_types)
solAssert(args.size() == 2, "Unexpected number of arguments for abi.decode");
inTypes.emplace_back(TypeProvider::bytesMemory());
auto const* tupleType = dynamic_cast<TupleType const*>(args.at(1)->annotation().type);
solAssert(tupleType, "");
for (auto t: tupleType->components())
{
auto typeType = dynamic_cast<TypeType const*>(t);
solAssert(typeType, "");
auto argType = args.at(1)->annotation().type;
if (auto const* tupleType = dynamic_cast<TupleType const*>(argType))
for (auto componentType: tupleType->components())
{
auto typeType = dynamic_cast<TypeType const*>(componentType);
solAssert(typeType, "");
outTypes.emplace_back(typeType->actualType());
}
else if (auto const* typeType = dynamic_cast<TypeType const*>(argType))
outTypes.emplace_back(typeType->actualType());
}
else
solAssert(false, "Unexpected argument of abi.decode");
}
else
{