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

Fixed issue with programPath.scope.references not being registered back correctly after scope re-crawling #11323

Merged
merged 1 commit into from Mar 24, 2020

Conversation

Andarist
Copy link
Member

Q                       A
Fixed Issues? fixes #11320
Patch: Bug Fix? x
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? no
License MIT

References were not correctly registered back on subsequent crawls for cases when bindings were already registered on some inner scopes.

@nicolo-ribaudo nicolo-ribaudo added pkg: traverse (scope) PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Mar 23, 2020
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

@Andarist Would it be possible to also add a test using generateUid, which is how you found ths bug?

path.scope.crawl();
path.scope.crawl();

expect(path.scope.references.jsx).toBeTruthy();
Copy link
Member

Choose a reason for hiding this comment

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

Note: I have no idea of what references on the scope means since it's clearly not related to binding.referencePaths. However, this PR aligns the post-crawl state to the pre-crawl one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if this is the full story but those references seem to be a simple Record<name, true> of everything that could clash with generated identifiers (or other nodes), since it's not possible to just check some single scope to be sure if some name can be considered "sage", but it rather requires full knowledge about the module/script

@Andarist
Copy link
Member Author

@Andarist Would it be possible to also add a test using generateUid, which is how you found ths bug?

Sure, should I add it to the same file? Or is there a better place for a test like this?

@nicolo-ribaudo
Copy link
Member

It's ok in this file.

@nicolo-ribaudo nicolo-ribaudo merged commit 025e4ae into master Mar 24, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the fix/references-after-recrawling branch March 24, 2020 15:27
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: traverse (scope) PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inserted identifier clashes with existing identifier from the inner scope
3 participants