-
-
Notifications
You must be signed in to change notification settings - Fork 389
Hlint "Expected type not found at the location specified in the refact file." error in certain circumstances when refactoring #2612
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hi, thanks for the bug report, have you got the chance of checking if the standalone hlint executable (version 3.2.8 if possible) works? |
So running
This implies that hlint isn't installed properly (though the fact that it was working most of the time in VSC is a bit weird if that was the case), I tried to reinstall it with |
oh, sorry I did not mention vscode does not use the hint executable but hlint as a library so probably it was not available in your env |
Ok so that fails after it's installed most of the required libs with this error
As far as I can tell cabal is installing to |
to make available executables installed with cabal in the shell the PATH env var must include |
Both refactor suggestions show up correctly when using hlint in the command line, however the error still appears in VSC, so it might be a problem with how hlint is implemented in VSC or just a problem with VSC itself. |
Thanks for trying, yeah, the main goal was ensure the bug is in our side and it seems so |
It looks like the right refactorings are being sent to The Works:
Doesn't work:
the difference being the These examples also don't work
This example does work
So it seems to have something to do with not recognizing Don't really have an idea of why it works for hlint and not HLS. hlint seems to call the |
It might have to do with application of fixities because the error is due to the fact that the AST looks like
but we're trying to substitute |
Your environment
Which OS do you use:
- Windows
Which LSP client (editor/plugin) do you use:
- VS Code
Describe your project (alternative: link to the project):
- GHC 8.10.7, Cabal 3.6.2.0
Steps to reproduce
Create a new .hs file with this code:
Both functions will be highlighted by hlint telling you to avoid using the reverse
Use the quick fix feature (
Ctrl+.
in VS Code) to apply the refactor on each functionExpected behaviour
The error should not appear, and the
avoid reverse
refactor should produce the same code with either function:Actual behaviour
Using the quick fix while the cursor is on the body of
functionA
will refactor the code as expectedHowever using the Quick Fix while the cursor is on the body of
functionB
will produce the follwing error:Additonally the
redundant id
suggested refactor doesn't do anything at all in this circumstance.Include debug information
Extended error message from the logs:
The text was updated successfully, but these errors were encountered: