Open
Description
Describe the bug
This is a weird one. What I'm observing is that this:
package foo
flags: +bar
package foo
flags: -bar
builds foo
with bar
disabled (correct), but that this:
-- Assume we're using GHC > 9 so this conditional is satisfied
if impl(ghc>9)
package foo
flags: +bar
pacakge foo
flags: -bar
builds foo
with bar
enabled (incorrect).
To Reproduce
- Checkout https://github.com/haskell/lsp/tree/mpj/cabal-bug
cabal build lsp
(with GHC > 9 so the conditional is satisfied)- Observe that cabal declares that it is going to build
exe:lsp-demo-simple-server
- Observe that cabal declares that it is going to build
- Remove the conditional around the flag setting in
cabal.project
cabal build lsp
- Observe that cabal does not declare that it is going to build
exe:lsp-demo-simple-server
- Observe that cabal does not declare that it is going to build
Expected behavior
The second flag setting should override the first regardless of whether the first one is conditional.
System information
- NixOS
- `cabal-3.10.1.01
ghc-9.2.7
Additional context
I don't think this is #8699, because:
- I can reproduce it even if I wipe out
dist-newstyle
before building; and - The problem is not the conditional section being ignored, but rather the later unconditional section being ignored.