-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Keep stale lenses for module name #3570
Conversation
L (locA -> (RealSrcSpan l _)) m <- MaybeT . pure . hsmodName . unLoc $ pm_parsed_source pm | ||
pure (realSrcSpanToRange l, T.pack $ moduleNameString m) | ||
let range = realSrcSpanToRange l | ||
let range' = fromMaybe range (toCurrentRange mp range) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong, shouldn't we fail or give up somehow if we can't map the range to the current thing, not use the probably-wrong range we have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I can't have a counterexample that toCurrentRange
can fail, keep it unless we know how it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems risky to me 🤷 Why does it return a Maybe
if it can't happen? And if it does happen we'll just silently do the wrong thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it makes sense, I'll let them be failed if toCurrentRange
returns Nothing
. But I'm still curious about how it fails 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you find out, please add some Haddock! 🙃
Fix #1769