mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user