Skip to content

Allow-newer conditional on GHC-version is not respected #9158

@jasagredo

Description

@jasagredo

Describe the bug

The allow-newer constraints don't get respected when enclosed in a conditional block.

To Reproduce
Checkout this commit: https://github.com/input-output-hk/ouroboros-consensus/tree/ed184183d048af6126f9e00e32862d669e705899. And maybe you need to install some dependencies, in particular pkg-config, libsodium and liblmdb-dev in Ubuntu.

cabal build all --with-compiler=ghc-9.6.2 --dry-run

succesfully creates a build plan. However, applying this diff:

allow-newer:
  , lens
  , cardano-ledger-core
  , cardano-ledger-alonzo
  , cardano-ledger-babbage
+if impl(ghc >= 9.6)
+  allow-newer:
+    , *:base
+    , *:ghc-prim
-  , *:base
-  , *:ghc-prim

results in cabal failing to create a build plan, by saying:

[__3] rejecting: base-4.18.0.0/installed-4.18.0.0 (conflict: small-steps-test => base>=4.12 && <4.17)

So the constraint allow-newer: *:base is not being respected.

Expected behavior

I expected cabal to produce a build plan.

System information

  • Ubuntu 23.04
  • cabal 3.10.1.0
  • ghc 9.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    re: conditionalAbout conditional declarations in cabal files(`if`)type: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions