Merged
Conversation
rhendric
approved these changes
May 11, 2021
src/Language/PureScript/Linter.hs
Outdated
| removeAndWarn ss newNames (used, errors) = | ||
| let filteredUsed = used `S.difference` newNames | ||
| removeAndWarn :: SourceSpan -> S.Set (SourceSpan, Ident) -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors) | ||
| removeAndWarn _ newNamesWithSpans (used, errors) = |
Contributor
Author
There was a problem hiding this comment.
Because I have a short attention span?
Contributor
Author
There was a problem hiding this comment.
Oh there is so much noise floating around due to this :)
rhendric
approved these changes
May 12, 2021
Member
rhendric
left a comment
There was a problem hiding this comment.
Some cosmetic fixes and then LGTM.
src/Language/PureScript/Linter.hs
Outdated
| allExprs = concatMap unguard gexprs | ||
| in | ||
| removeAndWarn ss bindNewNames $ mconcat $ map (go ss) allExprs | ||
| removeAndWarn bindNewNames $ mconcat $ map (go) allExprs |
Member
There was a problem hiding this comment.
Unneeded parens in (go). (I found four of these in total; they're easy to search for.)
Contributor
Author
There was a problem hiding this comment.
Oh dear, a little bit naive on the search and replace :)
src/Language/PureScript/Linter.hs
Outdated
| in removeAndWarn letNewNamesRec $ | ||
| mconcat (map underDecl ds) | ||
| <> removeAndWarn letNewNames (doElts rest v) | ||
| doElts (PositionedDoNotationElement _ _ e : rest) v = doElts (e : rest) v |
Member
|
Oh sorry, would you add a CHANGELOG.md entry for this too? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improvements to unused variable lint/warnings.
Fix a bad unused variable warning (fix #4083). The previous iteration was not distinguishing between variables bound recursively within the let binding, and those that are only bound inside the body.
Unchanged with this commit is that identifiers which are used recursively within a let binding will count as used (ie not warn), despite the fact that the binding could be removed - something more intelligent would be required to handle mutually recursive let blocks which may or may not be used externally.
Tighten the warning spans on unused variables (fix #4087).
This will scope to the identifier itself for binders, but a value declaration
let x = e in e2will scope to the entirex = easValueDecldoes not have a source span for the identifier alone.Checklist: