Skip to content
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

Mark jsxFactorySymbol as referenced for noUnusedLocals even in verbatimModuleSyntax #59193

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

andrewbranch
Copy link
Member

Fixes #59117

markJsxAliasReferenced itself checks canCollectSymbolAccessibilityInfo before marking the symbol as referenced for elision purposes (which is not necessary in verbatimModuleSyntax), but marks the symbol as isReferenced for unused locals checking purposes beforehand. That needs to happen unconditionally, but markLinkedReferences bails immediately if canCollectSymbolAccessibilityInfo is false.

I re-read all the changes in #58366 and tried and failed to break other features in combination with verbatimModuleSyntax.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 8, 2024
@andrewbranch andrewbranch force-pushed the bug/59117 branch 2 times, most recently from 7239f8d to 8697807 Compare July 8, 2024 23:12
@andrewbranch
Copy link
Member Author

@typescript-bot cherry-pick to release-5.5

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 10, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
cherry-pick to release-5.5 ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

Hey, @andrewbranch! I've created #59225 for you.

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

I think this is okay, though it does break the abstraction of markLinkedReferences...

When I was looking at this, what I had found was that the PR that refactored this also modified the behavior to return early from markLinkedReferences, but the old code did not for JSX and for others.

Maybe that early return is what needs to be modified, like jakebailey@29869a9 ?

(That and all of these functions could be moved inside of markLinkedReferences to not be directly callable)

@weswigham
Copy link
Member

I think this is okay, though it does break the abstraction of markLinkedReferences...

Yeah, personally, if we think the isReferenced setting behavior is needed independently of the .referenced setting behavior (because it's used for errors and not emit), we should probably pull it out of the whole markLinkedReferences tree of functions and just do it inline.

@weswigham
Copy link
Member

(That and all of these functions could be moved inside of markLinkedReferences to not be directly callable)

That had measurably worse performance last I tried, since they all become closures :(

DanielRosenwasser pushed a commit that referenced this pull request Jul 16, 2024
…e-5.5 (#59225)

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
@DanielRosenwasser DanielRosenwasser merged commit 0206f9f into microsoft:main Jul 16, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Regression issue with React import when using "jsx": "react" compiler
5 participants