Disallow private or internal functions in interfaces

This commit is contained in:
Alex Beregszaszi
2017-03-17 17:07:18 +00:00
parent 5a71e4f1a7
commit 2067a00f22
2 changed files with 23 additions and 0 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.visibility() < FunctionDefinition::Visibility::Public)
if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
typeError(_function.location(), "Functions in interfaces cannot be internal or private.");
if (_function.isConstructor())
if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
typeError(_function.location(), "Constructor cannot be defined in interfaces.");