Skip to content

Conversation

@ahejlsberg
Copy link
Member

This PR fixes a crash that occurs when doing find-all-refs in a .js file:

exports.a = 1; // Find-all-refs on the exports identifier

}}
}
return nil
return []*SymbolAndEntries{}
Copy link
Member

Choose a reason for hiding this comment

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

What calling code depends on the difference? 😞

Copy link
Member Author

Choose a reason for hiding this comment

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

Two places in findallreferences.go. They specifically check for nil and branch accordingly. Ugly, but basically the same behavior with had in Strada (i.e. undefined vs possibly empty array).

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, only one place depends on seeing nil:

if moduleReferences != nil && symbol.Flags&ast.SymbolFlagsTransient == 0 {

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ahejlsberg ahejlsberg added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit 84d64f6 Nov 5, 2025
27 of 28 checks passed
@ahejlsberg ahejlsberg deleted the fix-find-all-refs-crash branch November 5, 2025 20:00
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.

3 participants