mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Improve failure message when generating getter.
This commit is contained in:
parent
8da9239c83
commit
ddd9a84141
@ -592,8 +592,15 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
);
|
||||
}
|
||||
if (!getter.interfaceFunctionType())
|
||||
{
|
||||
solAssert(getter.returnParameterNames().size() == getter.returnParameterTypes().size());
|
||||
solAssert(getter.parameterNames().size() == getter.parameterTypes().size());
|
||||
if (getter.returnParameterTypes().empty() && getter.parameterTypes().empty())
|
||||
m_errorReporter.typeError(5359_error, _variable.location(), "The struct has all its members omitted, therefore the getter cannot return any values.");
|
||||
else
|
||||
m_errorReporter.typeError(6744_error, _variable.location(), "Internal or recursive type is not allowed for public state variables.");
|
||||
}
|
||||
}
|
||||
|
||||
bool isStructMemberDeclaration = dynamic_cast<StructDefinition const*>(_variable.scope()) != nullptr;
|
||||
if (isStructMemberDeclaration)
|
||||
|
@ -3,4 +3,4 @@ contract test {
|
||||
Data public data;
|
||||
}
|
||||
// ----
|
||||
// TypeError 6744: (58-74): Internal or recursive type is not allowed for public state variables.
|
||||
// TypeError 5359: (58-74): The struct has all its members omitted, therefore the getter cannot return any values.
|
||||
|
Loading…
Reference in New Issue
Block a user