Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Natspec format to correct devdoc return parameters #15187

Merged
merged 8 commits into from
Oct 11, 2024

Conversation

shoenseiwaso
Copy link
Contributor

Update the Natspec documentation to match what solc outputs for devdoc return parameters.

Consider the following minimal smart contract with documented Natspec devdoc return parameters:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract ReturnsDocs {
    /// @return A number
    function returnOne() public pure returns (uint) {
        return 1;
    }

    /// @return A number
    /// @return A string
    function returnTwo() public pure returns (uint, string memory) {
        return (2, "two");
    }
}

Compiling with devdoc output:

$ solc --combined-json devdoc ReturnDocs.sol | jq

{
  "contracts": {
    "ReturnDocs.sol:ReturnsDocs": {
      "devdoc": {
        "kind": "dev",
        "methods": {
          "returnOne()": {
            "returns": {
              "_0": "A number"
            }
          },
          "returnTwo()": {
            "returns": {
              "_0": "A number",
              "_1": "A string"
            }
          }
        },
        "version": 1
      }
    }
  },
  "version": "0.8.26+commit.8a97fa7a.Darwin.appleclang"
}

Copy link

github-actions bot commented Jun 7, 2024

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

@mehtavishwa30 mehtavishwa30 self-assigned this Oct 10, 2024
docs/natspec-format.rst Outdated Show resolved Hide resolved
docs/natspec-format.rst Outdated Show resolved Hide resolved
Changelog.md Outdated Show resolved Hide resolved
shoenseiwaso and others added 2 commits October 11, 2024 18:51
Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
@nikola-matic nikola-matic merged commit e8b5ca8 into ethereum:develop Oct 11, 2024
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants