mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Suggest the experimental ABI encoder if using structs as function parameters
This commit is contained in:
@@ -570,6 +570,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
||||
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.");
|
||||
if (
|
||||
_function.visibility() > FunctionDefinition::Visibility::Internal &&
|
||||
type(*var)->category() == Type::Category::Struct &&
|
||||
!_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2)
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
var->location(),
|
||||
"Structs are only supported in the new experimental ABI encoder. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
);
|
||||
|
||||
var->accept(*this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user