Skip to content

Conversation

@jakebailey
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 8, 2025 00:55
Copy link
Contributor

Copilot AI left a comment

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 several parser bugs discovered through fuzz testing, primarily related to edge cases in JSDoc comment parsing and improved await using declaration handling.

  • Adds bounds checking to prevent panics when parsing malformed or truncated input
  • Improves @overload and @satisfies JSDoc tag support for getter/setter accessors and shorthand properties
  • Fixes index tracking in list parsing to correctly handle reparsed elements
  • Enhances fuzz testing coverage by seeding with compiler test cases

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/parser/utilities.go Adds bounds checking to prevent out-of-bounds access when filtering JSDoc comment ranges for short comments
internal/parser/reparser.go Adds support for @overload tags on getter/setter accessors, fixes @type tag handling for expressions that may be nil, and properly handles @satisfies tags on shorthand property assignments
internal/parser/parser.go Improves await using declaration detection, adds bounds check to skipTo function, and fixes list element index tracking to account for reparsed items
internal/parser/jsdoc.go Prevents crash when parsing @typedef tags with no property tags by using fallback position
internal/ast/parseoptions.go Exports JSX and Force fields to make them accessible from test package
internal/parser/parser_test.go Converts to external test package, adds comprehensive fuzz test seeding from compiler test cases, and adds helper to parse multi-file test units
internal/parser/testdata/fuzz/FuzzParser/* Adds fuzz test corpus entries that triggered the fixed bugs

typeExpression = childTypeTag.TypeExpression
} else {
typeExpression = p.finishNode(jsdocTypeLiteral, jsdocPropertyTags[0].Pos())
// !!! This differs from Strada but prevents a crash
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

The comment "This differs from Strada" is unclear. "Strada" is not a term defined in this codebase. This should reference the TypeScript source or be more descriptive about why this differs from the reference implementation.

Suggested change
// !!! This differs from Strada but prevents a crash
// Note: This diverges from the TypeScript reference implementation (see src/compiler/parser.ts, parseTypedefTag).
// In TypeScript, the typeExpression is not always replaced with a JSDocTypeLiteral here, but in this Go port,
// we assign typeExpression to a new JSDocTypeLiteral to prevent a potential crash when jsdocPropertyTags are present.

Copilot uses AI. Check for mistakes.
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