mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6080 from ethereum/library-index-access
Disallow index access on contracts and libraries
This commit is contained in:
@@ -2208,6 +2208,8 @@ 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().get()))
|
||||
m_errorReporter.typeError(_access.location(), "Index access for contracts or libraries is not possible.");
|
||||
if (!index)
|
||||
resultType = make_shared<TypeType>(make_shared<ArrayType>(DataLocation::Memory, typeType.actualType()));
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user