Skip to content

Protect against a language service host mutating its underlying source for getScriptFileNames #49813

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

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

andrewbranch
Copy link
Member

Fixes a loose thread from #48980: constructing a HostCache used to effectively make a copy of this array; now that we no longer need a separate data structure, it seems like we can just use the array, but in fact we still need to make a copy in case the host wants to mutate what it passes as its state changes (I’m reading that mutation by the host is valid by the fact that it’s a string[], not a readonly string[]—plus, it’s a lot to ask of every language service consumer to think about this).

This fixes the twoslash/bisect runner, which has been telling us that all TypeScript code has started crashing at #48980 😄

@andrewbranch andrewbranch requested a review from amcasey July 6, 2022 17:14
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants