From 7fbf134ce3f40cd6f3248abffdaf3d14e4018a69 Mon Sep 17 00:00:00 2001 From: Marenz Date: Tue, 18 Jan 2022 13:36:54 +0100 Subject: [PATCH] Add test for fixed natspec ICE --- test/libsolidity/SolidityNatspecJSON.cpp | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index af04d0795..2b729205a 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -2534,6 +2534,55 @@ BOOST_AUTO_TEST_CASE(dev_struct_getter_override) checkNatspec(sourceCode, "Thing", natspec2, false); } +BOOST_AUTO_TEST_CASE(dev_struct_getter_override_no_return_name) +{ + char const *sourceCode = R"( + interface IThing { + ///@return + function value(uint) external returns (uint128,uint128); + } + + contract Thing is IThing { + struct Value { + uint128 x; + uint128 A; + } + mapping(uint=>Value) public override value; + } + )"; + + char const *natspec = R"ABCDEF({ + "methods": + { + "value(uint256)": + { + "returns": + { + "_0": "" + } + } + } + })ABCDEF"; + + char const *natspec2 = R"ABCDEF({ + "methods": {}, + "stateVariables": + { + "value": + { + "return": "x ", + "returns": + { + "x": "" + } + } + } + })ABCDEF"; + + checkNatspec(sourceCode, "IThing", natspec, false); + checkNatspec(sourceCode, "Thing", natspec2, false); +} + BOOST_AUTO_TEST_CASE(dev_struct_getter_override_different_return_parameter_names) { char const *sourceCode = R"(