mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Natspec: Don't copy from base function if return parameters differ
This commit is contained in:
@@ -303,7 +303,11 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
||||
"state" :
|
||||
{
|
||||
"details" : "example of dev",
|
||||
"return" : "returns state"
|
||||
"return" : "returns state",
|
||||
"returns" :
|
||||
{
|
||||
"_0" : "returns state"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2411,6 +2415,58 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
||||
checkNatspec(sourceCode, "B", natspecB, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dev_different_amount_return_parameters)
|
||||
{
|
||||
char const *sourceCode = R"(
|
||||
interface IThing {
|
||||
/// @return x a number
|
||||
/// @return y another number
|
||||
function value() external view returns (uint128 x, uint128 y);
|
||||
}
|
||||
|
||||
contract Thing is IThing {
|
||||
struct Value {
|
||||
uint128 x;
|
||||
uint128 y;
|
||||
}
|
||||
|
||||
Value public override value;
|
||||
}
|
||||
)";
|
||||
|
||||
char const *natspec = R"ABCDEF({
|
||||
"methods":
|
||||
{
|
||||
"value()":
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
|
||||
char const *natspec2 = R"ABCDEF({
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"value":
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "IThing", natspec, false);
|
||||
checkNatspec(sourceCode, "Thing", natspec2, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
interface IThing {
|
||||
/// @return x a number
|
||||
/// @return y another number
|
||||
function value() external view returns (uint128 x, uint128 y);
|
||||
}
|
||||
|
||||
contract Thing is IThing {
|
||||
struct Value {
|
||||
uint128 x;
|
||||
uint128 y;
|
||||
}
|
||||
|
||||
Value public override value;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
interface IThing {
|
||||
/// @param v value to search for
|
||||
/// @return x a number
|
||||
/// @return y another number
|
||||
function value(uint256 v) external view returns (uint128 x, uint128 y);
|
||||
}
|
||||
|
||||
contract Thing is IThing {
|
||||
struct Value {
|
||||
uint128 x;
|
||||
uint128 y;
|
||||
}
|
||||
|
||||
mapping(uint256=>Value) public override value;
|
||||
}
|
||||
Reference in New Issue
Block a user