Disallow constructor in interfaces

This commit is contained in:
Alex Beregszaszi
2017-03-17 17:06:52 +00:00
parent 2c4bce2d62
commit d5102c1db7
3 changed files with 5 additions and 1 deletions
+3
View File
@@ -463,6 +463,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
typeError(_function.location(), "Functions in interfaces cannot have an implementation.");
_function.body().accept(*this);
}
if (_function.isConstructor())
if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
typeError(_function.location(), "Constructor cannot be defined in interfaces.");
return false;
}