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

Type class instances not picked up on reload #3812

Closed
georgefst opened this issue Sep 18, 2023 · 4 comments
Closed

Type class instances not picked up on reload #3812

georgefst opened this issue Sep 18, 2023 · 4 comments
Labels
component: ghcide multi-component Issues relating to multi-component support type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@georgefst
Copy link
Collaborator

When I make an edit to a cabal file, and HLS thus reloads the session, I often see spurious type class instance errors.

See here for a minimal example, where an instance C Bool in Lib.hs is used in Main.hs. If for example I remove -Wall from the cabal file (just saving it without editing is not enough), and only have Main.hs open in VSCode, I see No instance for (C Bool) once HLS is done reloading. It can take some serious kicking to get HLS to pick up the instance. Sometimes it's enough to make some non-trivial edit to Lib.hs, but other times I've had to delete the contents of Lib.hs, edit Main.hs, then restore Lib.hs to get the errors to go away. This has become quite painful in a larger project.

Note that this doesn't happen on initial load. I can restart the LSP server, only load Main.hs and get no error. Even with a completely fresh load, i.e. no entry in ~/.cache/hie-bios.

I haven't bisected, but I'm pretty sure this is a recent regression (2.1 or 2.2).

@georgefst georgefst added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs triage labels Sep 18, 2023
@fendor fendor added status: needs info Not actionable, because there's missing information and removed status: needs triage labels Oct 18, 2023
@fendor
Copy link
Collaborator

fendor commented Oct 18, 2023

Thanks for the bug report!

While this sounds like an issue with multiple home units, whether this is a known bug or not depends on the GHC version.
What GHC versions are you using to produce this bug?

@georgefst
Copy link
Collaborator Author

Ah, my bad. 9.4 and 9.6.

@fendor
Copy link
Collaborator

fendor commented Oct 18, 2023

Then this issue is most likely related by multiple home unit support #3738.

Your bug report might also be related to our reload logic when file dependencies (e.g. cabal file changes).

@fendor fendor added component: ghcide and removed status: needs info Not actionable, because there's missing information labels Oct 18, 2023
@michaelpj michaelpj added the multi-component Issues relating to multi-component support label Jan 17, 2024
@michaelpj
Copy link
Collaborator

I think this should be fixed by the proper multi-home-unit support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide multi-component Issues relating to multi-component support type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants