Skip to content

Fix stack overflow in inherited JSDoc resolution#4577

Open
johnfav03 wants to merge 1 commit into
microsoft:mainfrom
johnfav03:fix-getjsdocortag-overflow
Open

Fix stack overflow in inherited JSDoc resolution#4577
johnfav03 wants to merge 1 commit into
microsoft:mainfrom
johnfav03:fix-getjsdocortag-overflow

Conversation

@johnfav03

Copy link
Copy Markdown
Contributor

Fixes and issue uncovered in #4380 (comment) (nuxt); getJSDocOrTag() resolves an inherited JSDoc by recursing with no visited guard. This means that a circular or mutually referential class could recurse indefinitely and cause a stack overflow error.

Copilot AI review requested due to automatic review settings July 9, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a language-service stack overflow when resolving inherited JSDoc in the presence of circular/mutually referential inheritance (as seen in nuxt), by adding a visited-guard to the inherited-member walk in getJSDocOrTag() and covering the regression with a new fourslash hover test.

Changes:

  • Thread a seenSymbols set through getJSDocOrTag/getMatchingJSDocTag and use it to stop repeated inherited-member recursion.
  • Add a fourslash regression test that verifies hover quick info terminates for a self-extending interface scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/ls/hover.go Adds a seenSymbols recursion guard to prevent infinite inherited-JSDoc resolution loops.
internal/fourslash/tests/hoverCircularInheritedDocumentation_test.go New regression test reproducing the circular base-type scenario and asserting hover does not crash.

@johnfav03 johnfav03 requested a review from iisaduan July 9, 2026 17:46
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.

2 participants