Fix type check for nested arrays in abi.encode/decode functions in ABIEncoderV1

- Without this fix, nested arrays are not detected as unsupported and compiler fails on an UnimplementedError.
- Now it's consistent with how structs are handled in ABIEncoderV1.
This commit is contained in:
Kamil Śliwak
2020-09-17 17:29:16 +02:00
parent 7a5957512c
commit 1a4cc4e64d
10 changed files with 81 additions and 2 deletions
+8 -2
View File
@@ -404,10 +404,16 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c
return encodingType;
TypePointer baseType = encodingType;
while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType))
{
baseType = arrayType->baseType();
if (dynamic_cast<StructType const*>(baseType))
if (!_encoderV2)
auto const* baseArrayType = dynamic_cast<ArrayType const*>(baseType);
if (!_encoderV2 && baseArrayType && baseArrayType->isDynamicallySized())
return nullptr;
}
if (!_encoderV2 && dynamic_cast<StructType const*>(baseType))
return nullptr;
return encodingType;
}