Allow arrays of contract types as type expressions e.g. for abi.decode.

This commit is contained in:
Daniel Kirchner
2020-10-16 19:40:41 +02:00
parent eedd12ad1d
commit 909ce9164a
7 changed files with 18 additions and 11 deletions
+3 -2
View File
@@ -2915,8 +2915,9 @@ bool TypeChecker::visit(IndexAccess const& _access)
case Type::Category::TypeType:
{
TypeType const& typeType = dynamic_cast<TypeType const&>(*baseType);
if (dynamic_cast<ContractType const*>(typeType.actualType()))
m_errorReporter.typeError(2876_error, _access.location(), "Index access for contracts or libraries is not possible.");
if (auto const* contractType = dynamic_cast<ContractType const*>(typeType.actualType()))
if (contractType->contractDefinition().isLibrary())
m_errorReporter.typeError(2876_error, _access.location(), "Index access for library types and arrays of libraries are not possible.");
if (!index)
resultType = TypeProvider::typeType(TypeProvider::array(DataLocation::Memory, typeType.actualType()));
else