Skip to content

Commit 86116e1

Browse files
committed
refactor(cabal-install): pkgDependsOnSelfLib should not hide failures
Exceptions are not nice but this is an obvious invariant. Graph should provide a better API to make this unnecessary.
1 parent 08f604f commit 86116e1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,14 +2228,12 @@ elaborateInstallPlan
22282228
pkgDependsOnSelfLib =
22292229
CD.fromList
22302230
[ (CD.componentNameToComponent cn, [()])
2231-
| Graph.N _ cn _ <- fromMaybe [] mb_closure
2231+
| Graph.N _ cn _ <- closure
22322232
]
22332233
where
2234-
mb_closure = Graph.revClosure compGraph [k | k <- Graph.keys compGraph, is_lib k]
2235-
-- NB: the sublib case should not occur, because sub-libraries
2236-
-- are not supported without per-component builds
2237-
is_lib (CLibName _) = True
2238-
is_lib _ = False
2234+
closure =
2235+
fromMaybe (error "elaborateSolverToPackage: internal error, no closure for main lib") $
2236+
Graph.revClosure compGraph [k | k@(CLibName LMainLibName) <- Graph.keys compGraph]
22392237

22402238
buildComponentDeps :: Monoid a => (ElaboratedComponent -> a) -> CD.ComponentDeps a
22412239
buildComponentDeps f =

0 commit comments

Comments
 (0)