Skip to content

Commit 61b4d39

Browse files
committed
Fix #6551 Use action getLatestApplicableVersionAndRev only when needed
1 parent afc4afa commit 61b4d39

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Bug fixes:
5656

5757
* The `config set snapshot` and `config set resolver` commands now respect the
5858
presence of a synoymous key.
59+
* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
60+
`stack build` to be slower than previously.
5961

6062
## v2.15.5 - 2024-03-28
6163

src/Stack/Build/ConstructPlan.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,6 @@ processDep ::
829829
MissingPresentDeps
830830
)
831831
processDep pkgId name value = do
832-
mLatestApplicable <- getLatestApplicableVersionAndRev name range
833832
eRes <- getCachedDepOrAddDep name
834833
let failure mLatestApp err =
835834
Left $ Map.singleton name (range, mLatestApp, err)
@@ -844,6 +843,7 @@ processDep pkgId name value = do
844843
-- spamming the user too much.
845844
DependencyPlanFailures _ _ ->
846845
Couldn'tResolveItsDependencies version
846+
mLatestApplicable <- getLatestApplicableVersionAndRev name range
847847
pure $ failure mLatestApplicable bd
848848
Right adr
849849
| isDepTypeLibrary value.depType && not (adrHasLibrary adr) ->
@@ -853,8 +853,9 @@ processDep pkgId name value = do
853853
inRange <- adrInRange pkgId name range adr
854854
pure $ if inRange
855855
then Right $ processAdr adr
856-
else failure mLatestApplicable (DependencyMismatch $ adrVersion adr)
857-
856+
else do
857+
mLatestApplicable <- getLatestApplicableVersionAndRev name range
858+
failure mLatestApplicable (DependencyMismatch $ adrVersion adr)
858859
where
859860
range = value.versionRange
860861
version = pkgVersion pkgId

0 commit comments

Comments
 (0)