-
Notifications
You must be signed in to change notification settings - Fork 13k
Don't set parent on non-transient symbols in mergeSymbolTable #61560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
There was a problem hiding this 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 an issue where mergeSymbolTable
was incorrectly setting the parent
property on non-transient symbols, which overwrites proper binder-created AST symbols. The change adds a guard to only set the parent on transient symbols.
if (merged.flags & SymbolFlags.Transient) { | ||
merged.parent = mergedParent; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition should use bitwise AND with proper parentheses for clarity. Consider writing if ((merged.flags & SymbolFlags.Transient) !== 0)
to make the intent more explicit that you're checking for the presence of the flag.
if (merged.flags & SymbolFlags.Transient) { | |
merged.parent = mergedParent; | |
} | |
if ((merged.flags & SymbolFlags.Transient) !== 0) { | |
merged.parent = mergedParent; | |
} |
Copilot uses AI. Check for mistakes.
This is functionally equivalent to the change made in microsoft/typescript-go#775; this line is stomping on real binder-created AST symbols, which is bad.