Fix ICE caused by storage parameters with nested mappings in libraries

This commit is contained in:
a3d4
2020-10-07 22:07:57 +02:00
parent 93df3d43df
commit d7b4b4a7aa
5 changed files with 31 additions and 2 deletions
+7 -2
View File
@@ -599,8 +599,13 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
if (auto referenceType = dynamic_cast<ReferenceType const*>(varType))
{
auto result = referenceType->validForLocation(referenceType->location());
if (result && (_variable.isConstructorParameter() || _variable.isPublicCallableParameter()))
result = referenceType->validForLocation(DataLocation::CallData);
if (result)
{
bool isLibraryStorageParameter = (_variable.isLibraryFunctionParameter() && referenceType->location() == DataLocation::Storage);
bool callDataCheckRequired = ((_variable.isConstructorParameter() || _variable.isPublicCallableParameter()) && !isLibraryStorageParameter);
if (callDataCheckRequired)
result = referenceType->validForLocation(DataLocation::CallData);
}
if (!result)
{
solAssert(!result.message().empty(), "Expected detailed error message");