Skip to content

Commit 69715eb

Browse files
committed
Fix #47 (anyVersion instead of noVersion as unit of intersection)
Also: let `--force` override the sanity check for the add-bound edit
1 parent da9c329 commit 69715eb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Main.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -872,9 +872,8 @@ parseGenericPackageDescription' bs =
872872
Right x -> x
873873

874874
extractRange :: LC.GenericPackageDescription -> C.PackageName -> C.VersionRange
875-
extractRange gpd pkgName = case vss of
876-
[] -> C.noVersion
877-
(v:vs) -> List.foldl' C.intersectVersionRanges v vs
875+
extractRange gpd pkgName =
876+
List.foldl' C.intersectVersionRanges C.anyVersion vss
878877
where
879878
vss = gpd ^.. LC.condLibrary . _Just . condTreeDataL . LC.targetBuildDepends . traverse . to ext . _Just
880879
ext (C.Dependency pkgName' vr _)
@@ -938,8 +937,9 @@ addBound AddBoundOptions{ optABPackageName, optABVersionRange, optForce, optABMe
938937
else do
939938
-- sanity check: did the addition have the intended outcome?
940939
unless (newSem == oldSem') $
941-
throwError $ unwords
942-
[ "Edit failed, version ranges don't match: "
940+
(if optForce then log . ("Ignoring check: " ++) else throwError . ("Edit failed, " ++)) $
941+
unwords
942+
[ "version ranges don't match: "
943943
, C.prettyShow oldRange
944944
, "&&"
945945
, C.prettyShow optABVersionRange

0 commit comments

Comments
 (0)