Skip to content

Commit 2126a2b

Browse files
edsko23Skidoo
authored andcommitted
Document that qualification is flag independent
See #3268 (comment) (cherry picked from commit 4ff4e2b)
1 parent 95010cd commit 2126a2b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ data QualifyOptions = QO {
186186

187187
-- | Apply built-in rules for package qualifiers
188188
--
189+
-- Although the behaviour of 'qualifyDeps' depends on the 'QualifyOptions',
190+
-- it is important that these 'QualifyOptions' are _static_. Qualification
191+
-- does NOT depend on flag assignment; in other words, it behaves the same no
192+
-- matter which choices the solver makes (modulo the global 'QualifyOptions');
193+
-- we rely on this in 'linkDeps' (see comment there).
194+
--
189195
-- NOTE: It's the _dependencies_ of a package that may or may not be independent
190196
-- from the package itself. Package flag choices must of course be consistent.
191197
qualifyDeps :: QualifyOptions -> QPN -> FlaggedDeps Component PN -> FlaggedDeps Component QPN

cabal-install/Distribution/Client/Dependency/Modular/Linking.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ makeCanonical lg qpn@(Q pp _) i =
282282
-- as well, and cover their dependencies at that point.
283283
linkDeps :: QPN -> [Var QPN] -> FlaggedDeps Component QPN -> UpdateState ()
284284
linkDeps target = \blame deps -> do
285+
-- linkDeps is called in two places: when we first link one package to
286+
-- another, and when we discover more dependencies of an already linked
287+
-- package after doing some flag assignment. It is therefore important that
288+
-- flag assignments cannot influence _how_ dependencies are qualified;
289+
-- fortunately this is a documented property of 'qualifyDeps'.
285290
rdeps <- requalify deps
286291
go blame deps rdeps
287292
where

0 commit comments

Comments
 (0)