Skip to content

Commit

Permalink
Fix #6086 Correct warning when allow-newer-deps but allow-newer is false
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Apr 6, 2023
1 parent 9faba78 commit 6912705
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Other enhancements:

Bug fixes:

* Fix incorrect warning if `allow-newer-deps` are specified but `allow-newer` is
`false`. See
[#6068](https://github.com/commercialhaskell/stack/issues/6086).
* `stack build` with `--file-watch` or `--file-watch-poll` outputs 'pretty'
error messages, as intended. See
[#5978](https://github.com/commercialhaskell/stack/issues/5978).
Expand Down
12 changes: 6 additions & 6 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -875,16 +875,16 @@ addPackageDeps package = do
inRange <- if adrVersion adr `withinRange` range
then pure True
else do
let warn_ reason = tell mempty { wWarnings = (msg:) }
let warn_ isIgnoring reason = tell mempty { wWarnings = (msg:) }
where
msg = T.concat
[ "WARNING: Ignoring "
[ if isIgnoring then "Ignoring " else "Not ignoring "
, T.pack $ packageNameString $ packageName package
, "'s bounds on "
, T.pack $ packageNameString depname
, " ("
, versionRangeText range
, "); using "
, ") and using "
, T.pack $ packageIdentifierString $
PackageIdentifier depname (adrVersion adr)
, ".\nReason: "
Expand All @@ -899,19 +899,19 @@ addPackageDeps package = do
y <- inSnapshot depname (adrVersion adr)
if x && y
then do
warn_ "trusting snapshot over Cabal file dependency information"
warn_ True "trusting snapshot over Cabal file dependency information"
pure True
else pure False
if allowNewer
then do
warn_ "allow-newer enabled"
warn_ True "allow-newer enabled"
case allowNewerDeps of
Nothing -> pure True
Just boundsIgnoredDeps ->
pure $ packageName package `elem` boundsIgnoredDeps
else do
when (isJust allowNewerDeps) $
warn_ "allow-newer-deps are specified but allow-newer isn't enabled"
warn_ False "although allow-newer-deps are specified, allow-newer is false"
inSnapshotCheck
if inRange
then case adr of
Expand Down

0 comments on commit 6912705

Please sign in to comment.