From ffdb0e37ff788afdf54ea1224a8c8184043322f9 Mon Sep 17 00:00:00 2001 From: a3d4 Date: Tue, 28 Jul 2020 01:37:51 +0200 Subject: [PATCH] Complete error coverage of ReferenceResolver --- libsolidity/analysis/ReferencesResolver.cpp | 10 +--------- .../natspec/invalid/docstring_inheritdoc_twice.sol | 9 +++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_twice.sol diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 82cb18937..e2e92a126 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -231,15 +231,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier) string(".slot").size() : string(".offset").size() )); - if (realName.empty()) - { - m_errorReporter.declarationError( - 4794_error, - _identifier.location, - "In variable names .slot and .offset can only be used as a suffix." - ); - return; - } + solAssert(!realName.empty(), "Empty name."); declarations = m_resolver.nameFromCurrentScope(realName); if (!declarations.empty()) // To support proper path resolution, we have to use pathFromCurrentScope. diff --git a/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_twice.sol b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_twice.sol new file mode 100644 index 000000000..d59dea299 --- /dev/null +++ b/test/libsolidity/syntaxTests/natspec/invalid/docstring_inheritdoc_twice.sol @@ -0,0 +1,9 @@ +contract B {} + +contract C { + /// @inheritdoc B + /// @inheritdoc B + function f() internal {} +} +// ---- +// DocstringParsingError 5142: (32-71): Documentation tag @inheritdoc can only be given once.