Skip to content

Commit a2a6ae9

Browse files
committed
Only show a warning
1 parent 3a42c6d commit a2a6ae9

File tree

1 file changed

+8
-1
lines changed
  • cabal-install/src/Distribution/Client/ProjectConfig

1 file changed

+8
-1
lines changed

cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import Distribution.Simple.Utils
133133
( debug
134134
, lowercase
135135
, noticeDoc
136+
, warn
136137
)
137138
import Distribution.Types.CondTree
138139
( CondBranch (..)
@@ -310,7 +311,13 @@ parseProjectSkeleton cacheDir httpTransport verbosity importsBy projectDir sourc
310311
(noticeDoc verbosity $ untrimmedUriImportMsg (Disp.text "Warning:") importLocPath)
311312
let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc)
312313
res <- parseProjectSkeleton cacheDir httpTransport verbosity importsBy projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath
313-
rest <- go [] xs
314+
uniqueFields <-
315+
if uniqueImport `elem` seenImports
316+
then do
317+
warn verbosity . render $ duplicateImportMsg uniqueImport normLocPath seenImportsBy
318+
return []
319+
else return xs
320+
rest <- go [] uniqueFields
314321
pure . fmap mconcat . sequence $ [projectParse Nothing normSource fs, res, rest]
315322
(ParseUtils.Section l "if" p xs') -> do
316323
normSource <- canonicalizeConfigPath projectDir source

0 commit comments

Comments
 (0)