Fixes named return natspec errors in compilation tests.

This commit is contained in:
Erik Kundt 2019-11-28 15:48:25 +01:00 committed by chriseth
parent e5cb0fe839
commit 19d466d6fb
5 changed files with 20 additions and 21 deletions

View File

@ -134,7 +134,7 @@ void DocStringAnalyser::parseDocStrings(
for (auto const& docTag: _annotation.docTags) for (auto const& docTag: _annotation.docTags)
{ {
if (!_validTags.count(docTag.first)) if (!_validTags.count(docTag.first))
appendError("Doc tag @" + docTag.first + " not valid for " + _nodeName + "."); appendError("Documentation tag @" + docTag.first + " not valid for " + _nodeName + ".");
else else
if (docTag.first == "return") if (docTag.first == "return")
{ {
@ -145,14 +145,14 @@ void DocStringAnalyser::parseDocStrings(
string firstWord = content.substr(0, content.find_first_of(" \t")); string firstWord = content.substr(0, content.find_first_of(" \t"));
if (returnTagsVisited > function->returnParameters().size()) if (returnTagsVisited > function->returnParameters().size())
appendError("Doc tag \"@" + docTag.first + " " + docTag.second.content + "\"" + appendError("Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" +
" exceedes the number of return parameters." " exceedes the number of return parameters."
); );
else else
{ {
auto parameter = function->returnParameters().at(returnTagsVisited - 1); auto parameter = function->returnParameters().at(returnTagsVisited - 1);
if (!parameter->name().empty() && parameter->name() != firstWord) if (!parameter->name().empty() && parameter->name() != firstWord)
appendError("Doc tag \"@" + docTag.first + " " + docTag.second.content + "\"" + appendError("Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" +
" does not contain the name of its return parameter." " does not contain the name of its return parameter."
); );
} }

View File

@ -146,7 +146,6 @@ contract Campaign {
} }
/// @dev Allows to withdraw fees from market contract to campaign contract /// @dev Allows to withdraw fees from market contract to campaign contract
/// @return Fee amount
function closeMarket() function closeMarket()
public public
atStage(Stages.MarketCreated) atStage(Stages.MarketCreated)

View File

@ -90,14 +90,14 @@ library RLP {
/// @dev Check if the RLP item is null. /// @dev Check if the RLP item is null.
/// @param self The RLP item. /// @param self The RLP item.
/// @return 'true' if the item is null. /// @return ret 'true' if the item is null.
function isNull(RLPItem memory self) internal view returns (bool ret) { function isNull(RLPItem memory self) internal view returns (bool ret) {
return self._unsafe_length == 0; return self._unsafe_length == 0;
} }
/// @dev Check if the RLP item is a list. /// @dev Check if the RLP item is a list.
/// @param self The RLP item. /// @param self The RLP item.
/// @return 'true' if the item is a list. /// @return ret 'true' if the item is a list.
function isList(RLPItem memory self) internal view returns (bool ret) { function isList(RLPItem memory self) internal view returns (bool ret) {
if (self._unsafe_length == 0) if (self._unsafe_length == 0)
return false; return false;
@ -109,7 +109,7 @@ library RLP {
/// @dev Check if the RLP item is data. /// @dev Check if the RLP item is data.
/// @param self The RLP item. /// @param self The RLP item.
/// @return 'true' if the item is data. /// @return ret 'true' if the item is data.
function isData(RLPItem memory self) internal view returns (bool ret) { function isData(RLPItem memory self) internal view returns (bool ret) {
if (self._unsafe_length == 0) if (self._unsafe_length == 0)
return false; return false;
@ -121,7 +121,7 @@ library RLP {
/// @dev Check if the RLP item is empty (string or list). /// @dev Check if the RLP item is empty (string or list).
/// @param self The RLP item. /// @param self The RLP item.
/// @return 'true' if the item is null. /// @return ret 'true' if the item is null.
function isEmpty(RLPItem memory self) internal view returns (bool ret) { function isEmpty(RLPItem memory self) internal view returns (bool ret) {
if(isNull(self)) if(isNull(self))
return false; return false;
@ -156,7 +156,7 @@ library RLP {
/// @dev Create an iterator. /// @dev Create an iterator.
/// @param self The RLP item. /// @param self The RLP item.
/// @return An 'Iterator' over the item. /// @return it An 'Iterator' over the item.
function iterator(RLPItem memory self) internal view returns (Iterator memory it) { function iterator(RLPItem memory self) internal view returns (Iterator memory it) {
if (!isList(self)) if (!isList(self))
revert(); revert();
@ -167,7 +167,7 @@ library RLP {
/// @dev Return the RLP encoded bytes. /// @dev Return the RLP encoded bytes.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The bytes. /// @return bts The bytes.
function toBytes(RLPItem memory self) internal returns (bytes memory bts) { function toBytes(RLPItem memory self) internal returns (bytes memory bts) {
uint len = self._unsafe_length; uint len = self._unsafe_length;
if (len != 0) if (len != 0)
@ -180,7 +180,7 @@ library RLP {
/// @dev Decode an RLPItem into bytes. This will not work if the /// @dev Decode an RLPItem into bytes. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return bts The decoded string.
function toData(RLPItem memory self) internal returns (bytes memory bts) { function toData(RLPItem memory self) internal returns (bytes memory bts) {
if(!isData(self)) if(!isData(self))
revert(); revert();
@ -192,7 +192,7 @@ library RLP {
/// @dev Get the list of sub-items from an RLP encoded list. /// @dev Get the list of sub-items from an RLP encoded list.
/// Warning: This is inefficient, as it requires that the list is read twice. /// Warning: This is inefficient, as it requires that the list is read twice.
/// @param self The RLP item. /// @param self The RLP item.
/// @return Array of RLPItems. /// @return list Array of RLPItems.
function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) { function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) {
if(!isList(self)) if(!isList(self))
revert(); revert();
@ -209,7 +209,7 @@ library RLP {
/// @dev Decode an RLPItem into an ascii string. This will not work if the /// @dev Decode an RLPItem into an ascii string. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return str The decoded string.
function toAscii(RLPItem memory self) internal returns (string memory str) { function toAscii(RLPItem memory self) internal returns (string memory str) {
if(!isData(self)) if(!isData(self))
revert(); revert();
@ -222,7 +222,7 @@ library RLP {
/// @dev Decode an RLPItem into a uint. This will not work if the /// @dev Decode an RLPItem into a uint. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toUint(RLPItem memory self) internal view returns (uint data) { function toUint(RLPItem memory self) internal view returns (uint data) {
if(!isData(self)) if(!isData(self))
revert(); revert();
@ -237,7 +237,7 @@ library RLP {
/// @dev Decode an RLPItem into a boolean. This will not work if the /// @dev Decode an RLPItem into a boolean. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toBool(RLPItem memory self) internal view returns (bool data) { function toBool(RLPItem memory self) internal view returns (bool data) {
if(!isData(self)) if(!isData(self))
revert(); revert();
@ -256,7 +256,7 @@ library RLP {
/// @dev Decode an RLPItem into a byte. This will not work if the /// @dev Decode an RLPItem into a byte. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toByte(RLPItem memory self) internal view returns (byte data) { function toByte(RLPItem memory self) internal view returns (byte data) {
if(!isData(self)) if(!isData(self))
revert(); revert();
@ -273,7 +273,7 @@ library RLP {
/// @dev Decode an RLPItem into an int. This will not work if the /// @dev Decode an RLPItem into an int. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toInt(RLPItem memory self) internal view returns (int data) { function toInt(RLPItem memory self) internal view returns (int data) {
return int(toUint(self)); return int(toUint(self));
} }
@ -281,7 +281,7 @@ library RLP {
/// @dev Decode an RLPItem into a bytes32. This will not work if the /// @dev Decode an RLPItem into a bytes32. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toBytes32(RLPItem memory self) internal view returns (bytes32 data) { function toBytes32(RLPItem memory self) internal view returns (bytes32 data) {
return bytes32(toUint(self)); return bytes32(toUint(self));
} }
@ -289,7 +289,7 @@ library RLP {
/// @dev Decode an RLPItem into an address. This will not work if the /// @dev Decode an RLPItem into an address. This will not work if the
/// RLPItem is a list. /// RLPItem is a list.
/// @param self The RLPItem. /// @param self The RLPItem.
/// @return The decoded string. /// @return data The decoded string.
function toAddress(RLPItem memory self) internal view returns (address data) { function toAddress(RLPItem memory self) internal view returns (address data) {
if(!isData(self)) if(!isData(self))
revert(); revert();

View File

@ -4,4 +4,4 @@ abstract contract C {
function vote(uint id) public virtual returns (uint value); function vote(uint id) public virtual returns (uint value);
} }
// ---- // ----
// DocstringParsingError: Doc tag "@return No value returned" does not contain the name of its return parameter. // DocstringParsingError: Documentation tag "@return No value returned" does not contain the name of its return parameter.

View File

@ -4,4 +4,4 @@ abstract contract C {
function vote(uint id) public virtual returns (uint value); function vote(uint id) public virtual returns (uint value);
} }
// ---- // ----
// DocstringParsingError: Doc tag "@return No value returned" does not contain the name of its return parameter. // DocstringParsingError: Documentation tag "@return No value returned" does not contain the name of its return parameter.