Disallow indexed reference types in events when using ABIEncoderV2

This commit is contained in:
Leonardo Alt
2018-08-15 17:11:18 +02:00
parent 2ed793c4d3
commit b6c839e817
8 changed files with 52 additions and 0 deletions
+10
View File
@@ -895,7 +895,17 @@ bool TypeChecker::visit(EventDefinition const& _eventDef)
for (ASTPointer<VariableDeclaration> const& var: _eventDef.parameters())
{
if (var->isIndexed())
{
numIndexed++;
if (
_eventDef.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2)
&& dynamic_cast<ReferenceType const*>(type(*var).get())
)
m_errorReporter.typeError(
var->location(),
"Reference types cannot be indexed."
);
}
if (!type(*var)->canLiveOutsideStorage())
m_errorReporter.typeError(var->location(), "Type is required to live outside storage.");
if (!type(*var)->interfaceType(false))