mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow mapping arguments and return values in internal library functions.
This commit is contained in:
@@ -629,7 +629,14 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
||||
}
|
||||
for (ASTPointer<VariableDeclaration> const& var: _function.parameters() + _function.returnParameters())
|
||||
{
|
||||
if (!type(*var)->canLiveOutsideStorage())
|
||||
if (
|
||||
!type(*var)->canLiveOutsideStorage() &&
|
||||
!(
|
||||
isLibraryFunction &&
|
||||
(_function.visibility() <= FunctionDefinition::Visibility::Internal) &&
|
||||
type(*var)->category() == Type::Category::Mapping
|
||||
)
|
||||
)
|
||||
m_errorReporter.typeError(var->location(), "Type is required to live outside storage.");
|
||||
if (_function.visibility() >= FunctionDefinition::Visibility::Public && !(type(*var)->interfaceType(isLibraryFunction)))
|
||||
m_errorReporter.fatalTypeError(var->location(), "Internal or recursive type is not allowed for public or external functions.");
|
||||
|
||||
Reference in New Issue
Block a user