Cabal doesn't rebuild as much as it should after "mixins:" section is changed in .cabal file
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
A change in the `mixins:` section of a cabal file, that should trigger a compilation error when invoking `cabal build`, doesn't trigger the error.
**To Reproduce**
Clone this repo https://github.com/danidiaz/orphans/tree/a7818653c635cfd80dc481914713e1b28392b5fc
Invoke `cabal v2-build`. It should compile correctly.
Now, in the `mixins:` section of the executable, change the lines:
mixins:
foo (Foo as Foo1) requires (Foo.Sig as Foo.Sig1),
foo (Foo as Foo2) requires (Foo.Sig as Foo.Sig2)
into the lines:
mixins:
foo (Foo as Foo1) requires (Foo.Sig as Foo.Sig1),
foo (Foo as Foo2) requires (Foo.Sig as Foo.Sig1)
then invoke `cabal v2-build` again.
This second invocation doesn't give an error.
**Expected behavior**
The second invocation of `cabal v2-build` *should* fail, with an error like:
Main.hs:7:10: error:
Duplicate instance declarations:
instance Show Foo2.Foo -- Defined at Main.hs:7:10
instance Show Foo2.Foo -- Defined at Main.hs:10:10
|
7 | instance Show Foo1.Foo where
This is because the `foo` library has been instantiated twice in the exact same way, so `Foo1.Foo` and `Foo2.Foo` are the same type.
If between making the change in the .cabal file and running `cabal v2-build` for the second time we invoke `cabal v2-clean`, the error shows up as it should.
cabal v2-clean
cabal v2-build
**System information**
- Windows
- cabal-install version 3.2.0.0
- compiled using version 3.2.0.0 of the Cabal library
- The Glorious Glasgow Haskell Compilation System, version 8.10.1
Contributor guide
Assessment
This issue has not been assessed yet.