Skip to content

Allow delimiter defaults in optional JSDoc parameters - #4326

Draft
Pybsama wants to merge 1 commit into
google:masterfrom
Pybsama:codex/fix-jsdoc-default-delimiters
Draft

Allow delimiter defaults in optional JSDoc parameters#4326
Pybsama wants to merge 1 commit into
google:masterfrom
Pybsama:codex/fix-jsdoc-default-delimiters

Conversation

@Pybsama

@Pybsama Pybsama commented Jul 30, 2026

Copy link
Copy Markdown

Summary

  • allow single-token delimiter default values in bracketed optional JSDoc parameters
  • preserve the existing interpretation of ] as the closing bracket, including empty defaults such as [name=]
  • add regression coverage for parenthesis defaults and the empty-default compatibility case

Root cause

The compatibility parser discarded a JSDoc Toolkit default value only when the lexer classified it as STRING. Parentheses are emitted as distinct tokens, so the parser left them in place and then reported a false missing closing ] warning.

Validation

  • bazelisk test //:test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest --test_filter='JsDocInfoParserTest.testUnsupportedJsDocSyntax*' (OK (4 tests))
  • bazelisk test //:test/com/google/javascript/jscomp/parsing/JsDocInfoParserTest (OK (780 tests))
  • bazelisk test //:all (431 test targets passed)
  • git diff --check

Fixes #3767

Signed-off-by: Pybsama <294532706+Pybsama@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad type annotation when documenting an optional parameter value

1 participant