Skip to content

Commit 1223a39

Browse files
committed
Make sanity check message more informative.
Signed-off-by: Edward Z. Yang <[email protected]>
1 parent 38a01d2 commit 1223a39

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

cabal-install/Distribution/Client/ProjectPlanning.hs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,37 +181,41 @@ import System.FilePath
181181
-- sense under some 'ElaboratedSharedConfig'.
182182
sanityCheckElaboratedConfiguredPackage :: ElaboratedSharedConfig
183183
-> ElaboratedConfiguredPackage
184-
-> Bool
184+
-> a
185+
-> a
185186
sanityCheckElaboratedConfiguredPackage sharedConfig
186-
pkg@ElaboratedConfiguredPackage{..} =
187+
pkg@ElaboratedConfiguredPackage{..}
188+
ret =
187189

188190
-- we should only have enabled stanzas that actually can be built
189191
-- (according to the solver)
190-
pkgStanzasEnabled `Set.isSubsetOf` pkgStanzasAvailable
192+
assert (pkgStanzasEnabled `Set.isSubsetOf` pkgStanzasAvailable)
191193

192194
-- the stanzas that the user explicitly requested should be
193195
-- enabled (by the previous test, they are also available)
194-
&& Map.keysSet (Map.filter id pkgStanzasRequested)
195-
`Set.isSubsetOf` pkgStanzasEnabled
196+
. assert (Map.keysSet (Map.filter id pkgStanzasRequested)
197+
`Set.isSubsetOf` pkgStanzasEnabled)
196198

197199
-- the stanzas explicitly disabled should not be available
198-
&& Set.null (Map.keysSet (Map.filter not pkgStanzasRequested)
199-
`Set.intersection` pkgStanzasAvailable)
200+
. assert (Set.null (Map.keysSet (Map.filter not pkgStanzasRequested)
201+
`Set.intersection` pkgStanzasAvailable))
200202

201203
-- either a package is being built inplace, or the
202204
-- 'installedPackageId' we assigned is consistent with
203205
-- the 'hashedInstalledPackageId' we would compute from
204206
-- the elaborated configured package
205-
&& (pkgBuildStyle == BuildInplaceOnly ||
207+
. assert (pkgBuildStyle == BuildInplaceOnly ||
206208
installedPackageId pkg == hashedInstalledPackageId
207209
(packageHashInputs sharedConfig pkg))
208210

209211
-- either a package is built inplace, or we are not attempting to
210212
-- build any test suites or benchmarks (we never build these
211213
-- for remote packages!)
212-
&& (pkgBuildStyle == BuildInplaceOnly ||
214+
. assert (pkgBuildStyle == BuildInplaceOnly ||
213215
Set.null pkgStanzasAvailable)
214216

217+
$ ret
218+
215219

216220
------------------------------------------------------------------------------
217221
-- * Deciding what to do: making an 'ElaboratedInstallPlan'
@@ -1857,8 +1861,8 @@ setupHsConfigureFlags (ReadyPackage
18571861
pkg@ElaboratedConfiguredPackage{..})
18581862
sharedConfig@ElaboratedSharedConfig{..}
18591863
verbosity builddir =
1860-
assert (sanityCheckElaboratedConfiguredPackage sharedConfig pkg)
1861-
Cabal.ConfigFlags {..}
1864+
sanityCheckElaboratedConfiguredPackage sharedConfig pkg
1865+
(Cabal.ConfigFlags {..})
18621866
where
18631867
configDistPref = toFlag builddir
18641868
configVerbosity = toFlag verbosity

0 commit comments

Comments
 (0)