Skip to content

Commit cc598b5

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 560975d commit cc598b5

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
@@ -2219,14 +2219,12 @@ elaborateInstallPlan
22192219
pkgDependsOnSelfLib =
22202220
CD.fromList
22212221
[ (CD.componentNameToComponent cn, [()])
2222-
| Graph.N _ cn _ <- fromMaybe [] mb_closure
2222+
| Graph.N _ cn _ <- closure
22232223
]
22242224
where
2225-
mb_closure = Graph.revClosure compGraph [k | k <- Graph.keys compGraph, is_lib k]
2226-
-- NB: the sublib case should not occur, because sub-libraries
2227-
-- are not supported without per-component builds
2228-
is_lib (CLibName _) = True
2229-
is_lib _ = False
2225+
closure =
2226+
fromMaybe (error "elaborateSolverToPackage: internal error, no closure for main lib") $
2227+
Graph.revClosure compGraph [k | k@(CLibName LMainLibName) <- Graph.keys compGraph]
22302228

22312229
buildComponentDeps :: Monoid a => (ElaboratedComponent -> a) -> CD.ComponentDeps a
22322230
buildComponentDeps f =

0 commit comments

Comments
 (0)