Disallows index access on contracts and libraries.

This commit is contained in:
Erik Kundt
2019-02-25 23:05:33 +00:00
committed by Alex Beregszaszi
parent 97d3b88f65
commit 2d0daae796
4 changed files with 17 additions and 0 deletions
+2
View File
@@ -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