Skip to content

Conversation

@heathdutton
Copy link

Fixes #16355

Untagged documentation comments on file-level variables (like /** whatever... */ above a constant) were being implicitly converted to @notice, which then failed validation since @notice is not valid for file-level variables. Users would get an error for a tag they never explicitly used.

This fix passes the set of valid tags to the DocString parser so it can check whether @notice is valid before adding it implicitly. When it's not valid, the parser skips the untagged text and continues processing so any explicit valid tags like @dev still work.

Changes:

  • Pass valid tags to DocStringParser
  • Skip implicit @notice when not valid for the node type
  • Add syntax tests for the new behavior

@github-actions
Copy link

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.

@heathdutton heathdutton force-pushed the fix-docstring-global-scope-error branch from b68a8c8 to 77e2fec Compare December 22, 2025 21:07
Untagged documentation was implicitly converted to @notice, which failed validation for file-level variables. Now we only add implicit @notice when it's valid for the node type, and continue parsing so valid tags like @dev still work.
@heathdutton heathdutton force-pushed the fix-docstring-global-scope-error branch from 77e2fec to 024af1d Compare December 22, 2025 22:54
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.

DocstringParsingError incorrectly thrown for docstrings in global context in places where Natspec is not accepted

1 participant