Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6086 Correct warning when allow-newer-deps but allow-newer is false #6087

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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