-
-
Notifications
You must be signed in to change notification settings - Fork 412
Description
To reproduce the problem:
-
Clone https://github.com/mrBliss/ghcide-bug.
This repo consists of three packages:a,b, andc.bdepends ona, andcdepends on bothaandb.Each package contains a single module:
A.hs,B.hs, andC.hsrespectively.A.hsdefines and exportsdata Foo = FooB.hsre-exportsAC.hsimports bothAandBand defines a valuefoo :: Foo. Important: bothAandBexport this sameFootype.
This repo has a multi-component
hie.yamlthat uses cabal for building. -
Open
C.hsand startghcidefor the entireghcide-bugproject (not just theccabal package). -
Now open
A.hswhileC.hsis still open in your editor (and thusghcidesession). -
Now go back to
C.hs, suddenly you get an error:typecheck: Ambiguous occurrence ‘Foo’ It could refer to either ‘Foo’, imported from ‘A’ at C.hs:3:1-8 (and originally defined at A.hs:3:1-14) or ‘Foo’, imported from ‘B’ at C.hs:4:1-8 (and originally defined in ‘A’)It seems that by opening
A.hs,Fooappears to get reloaded in theghcidesession. However, thebpackage is somehow not properly reloaded, so that it still exports the old version ofFoo. Now two versions ofFooare in scope inC.hs.
This makes it impossible for me to use ghcide in a downstream package while at the same time opening a module from an upstream package.
My setup:
ghcide: haskell/ghcide@ceb9eb7- GHC 8.6.5
- Emacs 27.1 +
lsp-mode