From ed8017253aa2b816d8594e4eb61343f9b0d26a1e Mon Sep 17 00:00:00 2001 From: Rodrigo Mesquita Date: Mon, 29 Apr 2024 20:41:12 +0100 Subject: [PATCH] priv deps: Fix long bad closure message We would previously include terminal nodes if these were not private. --- .../src/Distribution/Solver/Modular/PrivateScopeClosure.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs b/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs index 1f70972e6bf..513e9aa1d77 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs @@ -191,7 +191,9 @@ findBadPrivClosures pkg rdm = do | stopAtPkg && x == pkg = (M.insert x (dontLook x) s, path) | otherwise - = foldl go (M.insert x (dontLook x) s, x:path) $ neighbors x + = let nbs = neighbors x + in foldl go (M.insert x (dontLook x) s, if null nbs then path else x:path) nbs + -- \^ We don't add x to the path if this is a terminal node. dontLook x = error $ "We should only lookup privately-qualified pkgs, but instead " ++ show x ++ " was looked up -- it is only inserted in the map for de-duplication purposes."