Recompilation issue with cabal test
I'm not sure if this is a bug in ghc or in cabal.
Given four files:
repro.cabal
cabal-version: 3.0
name: repro
version: 0.1.0.0
build-type: Simple
library
default-language: Haskell2010
exposed-modules:
Internal
Process
build-depends: base
hs-source-dirs: src
test-suite repro
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Repro.hs
build-depends: base, repro
Repro.hs
import Process (a)
import Internal (Unused)
main :: IO ()
main = a
src/Internal.hs
module Internal where
data Unused = Unused
b :: IO ()
b = return ()
src/Process.hs
module Process where
import Internal
a :: IO ()
a = b
- Run
cabal test
- Remove last two lines in
src/Internal.hs
- Run
cabal test
. It will fail becauseb
is no longer defined. - Restore the deleted lines in
src/Internal.hs
- Run
cabal test
. I expect this to succeed, but I get
Declaration for a
Unfolding of a:
b1 ErrorWithoutFlag
Can't find interface-file declaration for variable b1
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
<no location info>: error:
Cannot continue after interface file error
I've found this when looking at #24924 but it should be independent. Reproduced with 9.8.2 and 9.10.1. Doesn't happen if import Internal (Unused)
is removed.