-
-
Notifications
You must be signed in to change notification settings - Fork 96
"Remove Unused Requires" refactoring doesn't handle multi-in
forms correctly
#110
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
Comments
Related: Dr Racket will color the entire I actually first noticed this yesterday while consuming I wonder if it would be pragmatic and reasonable to change One the one hand drracket/check-syntax should ideally handle "everything". On the other hand if |
It looks like Using
(#%require
(just-meta 0 (rename racket/list filter-not filter-not))
(just-meta 0 (rename racket/list list-prefix? list-prefix?))
...
(just-meta 0 (rename racket/dict dict-set dict-set))
(just-meta 0 (rename racket/dict dict-value-contract dict-value-contract))
... ) My guess is that any unused module path, like I bet it would not happen with (#%require
(just-meta 0 (rename racket/list filter-not filter-not))
(just-meta 0 (rename racket/list list-prefix? list-prefix?))
...)
(#%require
(just-meta 0 (rename racket/dict dict-set dict-set))
(just-meta 0 (rename racket/dict dict-value-contract dict-value-contract))
... ) |
Or maybe |
Also, avoid generating very many duplicate add-open-require and unused-require annotations. This can happen when forms like combine-in expand to rename sub-forms for every imported item. This should make check-syntax quicker when used both by DrRacket and by things like Racket Mode. Caveats (i.e. please do review before merging): - I'm not 100% sure I understand the usage of `phase-to-requires` so I may have broken something else. - I moved the generation of add-open-require annotations inside the original-enough? test. It seems natural to handle dupe avoidance, for those, at the same time we're handling it, for phase-to-requires. I'm not sure how else to avoid those dupes, without introducing yet another data structure. So please do review. Even if my attempt to fix this, is poor, hopefully I helped by narrowing down the cause (or at least proximate cause) of the problem, and someone else could "fix it better".
Also, avoid generating very many duplicate add-open-require and unused-require annotations. This can happen when forms like combine-in expand to rename sub-forms for every imported item. This should make check-syntax quicker when used both by DrRacket and by things like Racket Mode. Caveats (i.e. please do review before merging): - I'm not 100% sure I understand the usage of `phase-to-requires` so I may have broken something else. - I moved the generation of add-open-require annotations inside the original-enough? test. It seems natural to handle dupe avoidance, for those, at the same time we're handling it, for phase-to-requires. I'm not sure how else to avoid those dupes, without introducing yet another data structure. So please do review. Even if my attempt to fix this, is poor, hopefully I helped by narrowing down the cause (or at least proximate cause) of the problem, and someone else could "fix it better".
I opened PR #362 with an effort to fix this within |
…r need the special case that solved issue #110 anymore
check that the symbolic name of a binder and its reference are the same Also, it appears that something changed along the way such that we no longer need the special case that solved issue #110 anymore
Running the "Remove Unused Requires" refactoring on this program:
produces:
Rather than just removing the
dict
part of themulti-in
form.The text was updated successfully, but these errors were encountered: