Disallow internal function types as parameters for public/external library function

This commit is contained in:
Mathias Baumann
2019-03-21 07:25:57 +01:00
parent 0fbea8a1a0
commit 8e899a0d32
22 changed files with 188 additions and 86 deletions
+10 -2
View File
@@ -355,8 +355,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
{
if (!type(var)->canLiveOutsideStorage() && _function.isPublic())
m_errorReporter.typeError(var.location(), "Type is required to live outside storage.");
if (_function.isPublic() && !(type(var)->interfaceType(isLibraryFunction).get()))
m_errorReporter.fatalTypeError(var.location(), "Internal or recursive type is not allowed for public or external functions.");
if (_function.isPublic())
{
auto iType = type(var)->interfaceType(isLibraryFunction);
if (!iType.get())
{
solAssert(!iType.message().empty(), "Expected detailed error message!");
m_errorReporter.fatalTypeError(var.location(), iType.message());
}
}
}
if (
_function.isPublic() &&