mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12544 from ethereum/natspec-ice-12528
Natspec: Fix ICE when overriding a struct getter with a Natspec-documented return value and the name in the struct is different.
This commit is contained in:
@@ -2482,7 +2482,7 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
||||
checkNatspec(sourceCode, "B", natspecB, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dev_different_amount_return_parameters)
|
||||
BOOST_AUTO_TEST_CASE(dev_struct_getter_override)
|
||||
{
|
||||
char const *sourceCode = R"(
|
||||
interface IThing {
|
||||
@@ -2534,6 +2534,58 @@ BOOST_AUTO_TEST_CASE(dev_different_amount_return_parameters)
|
||||
checkNatspec(sourceCode, "Thing", natspec2, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dev_struct_getter_override_different_return_parameter_names)
|
||||
{
|
||||
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 a;
|
||||
uint128 b;
|
||||
}
|
||||
|
||||
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":
|
||||
{
|
||||
"a": "a number",
|
||||
"b": "another number"
|
||||
}
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "IThing", natspec, false);
|
||||
checkNatspec(sourceCode, "Thing", natspec2, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user