-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Bogus "Duplicate instance declarations:" error #3237
Comments
I've also hit this recently on ghc-9.4.2. My wild speculation is that it might be something like is described in this section, related to mishandling of multiple home units: https://well-typed.com/blog/2022/01/multiple-home-units/#closure-property-for-home-units |
I don't know - but I doubt that "multiple home units" is the cause, because in my case there are no such dependencies. |
It sounds an issue with our hacked up support for multiple home units indeed, we should revisit this after the proper support is merged. |
But I do not have multiple homes...? Or are you saying that "multiple home units" mistakenly triggers here? |
likewise; in my project i hit this in, there's no home unit depending on non home unit depending on home unit problem. A and B are both home units. dependency graph looks like A -> B, and the alleged duplicate instance was in B, from recollection. |
There is an ambiguity. We currently have some hacks to load multiple components together "as if" they were multiple home units. This is not 100% reliable and can result in this kind of issue. You typically see it when working on a test or exe component as that's a point where we need to load multiple components. "True" support for multiple home units is indeed not implemented yet. |
@michaelpj thank you, now I understand. In your opinion, how near are we to having this solved? |
I'm not actually sure where we are with that, @fendor do we have a tracking issue? |
Depends. |
I have another one which is off by a line?
also related to #3738? |
The problem does goes away, swtiching to cabal head, with cabal's multiple home unites feature enabled |
Just getting rid of most of these would be a benefit. Depending on which files I'm editing I can get hundreds of them, and real error messages are just buried. |
Is switching to cabal head help in your case? @PaulJohnson |
It did in my tests |
This should be fixed with the new multi-component support. |
Your environment
ghcup
vscode-haskell
(Haskell for VIsual Studio Code) v2.2.1Steps to reproduce and Actual behavior
At some point in time, HLS complains about "Duplicate instance declarations" which don't make sense because both refer to the same definition - same file and line number (aka, the same place).
Here's an example:
Expected behaviour
Understand that one entry in one file is not a duplicate of itself?
Debug information
This is an intermittent problem. Usually it clears up when I restart HLS within VS Code (don't even need to restart VS Code itself).
The text was updated successfully, but these errors were encountered: