diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index e3e85a65945..c4bef947e41 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -134,6 +134,8 @@ import Data.List ( deleteFirstsBy ) import System.FilePath ( () ) +import Control.Exception + ( assert ) globalCommand :: [Command action] -> CommandUI GlobalFlags globalCommand commands = CommandUI { @@ -497,16 +499,13 @@ filterConfigureFlags flags cabalLibVersion configConstraints = [] } - flags_3_11_0 = if not . null $ configPromisedDependencies flags then error $ - "--promised-dependencies was requested, likely through --enable-multi-repl,\n\ - \but some package setup-depends on Cabal " ++ prettyShow cabalLibVersion ++ ",\n\ - \which is too old to support --promised-dependencies. Use the flag\n\ - \--constraint='setup.Cabal >= 3.11' to constrain Cabal to an appropriate\n\ - \version or to see which package is requiring an older version.\n\ - \TODO: automate the constraint, see https://github.com/haskell/cabal/issues/8954" - else flags_latest { - configPromisedDependencies = [] - } + flags_3_11_0 = flags_latest { + -- It's too late to convert configPromisedDependencies to anything + -- meaningful, so we just assert that it's empty. + -- We add a Cabal>=3.11 constraint before solving when multi-repl is + -- enabled, so this should never trigger. + configPromisedDependencies = assert (null $ configPromisedDependencies flags) [] + } flags_3_7_0 = flags_3_11_0 { -- Cabal < 3.7 does not know about --extra-lib-dirs-static