Require inheritdoc tag to be non-empty.

This commit is contained in:
chriseth 2020-08-04 12:13:23 +02:00
parent f079efe28c
commit 0ea5aae9aa
2 changed files with 17 additions and 0 deletions

View File

@ -313,6 +313,16 @@ void ReferencesResolver::resolveInheritDoc(StructuredDocumentation const& _docum
case 1: case 1:
{ {
string const& name = _annotation.docTags.find("inheritdoc")->second.content; string const& name = _annotation.docTags.find("inheritdoc")->second.content;
if (name.empty())
{
m_errorReporter.docstringParsingError(
1933_error,
_documentation.location(),
"Expected contract name following documentation tag @inheritdoc."
);
return;
}
vector<string> path; vector<string> path;
boost::split(path, name, boost::is_any_of(".")); boost::split(path, name, boost::is_any_of("."));
Declaration const* result = m_resolver.pathFromCurrentScope(path); Declaration const* result = m_resolver.pathFromCurrentScope(path);

View File

@ -0,0 +1,7 @@
contract C {
/// @inheritdoc
function f() internal {
}
}
// ----
// DocstringParsingError 1933: (17-32): Expected contract name following documentation tag @inheritdoc.