File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
cabal-install-solver/src/Distribution/Solver/Types
cabal-install/src/Distribution/Client/ProjectConfig Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,19 @@ cyclicalImportMsg path@(ProjectConfigPath (duplicate :| _)) =
73
73
, nest 2 (docProjectConfigPath path)
74
74
]
75
75
76
- -- | A message for a duplicate import.
76
+ -- | A message for a duplicate import. If a check for cyclical imports has
77
+ -- already been made then this would report a duplicate import by two different
78
+ -- paths.
77
79
duplicateImportMsg :: FilePath -> ProjectConfigPath -> [(FilePath , ProjectConfigPath )] -> Doc
78
- duplicateImportMsg duplicate path dupImportsBy =
80
+ duplicateImportMsg duplicate path seenImportsBy =
79
81
vcat
80
82
[ text " duplicate import of" <+> text duplicate <> semi
81
83
, nest 2 (docProjectConfigPath path)
82
- , nest 2 (vcat [docProjectConfigPath dib | (_, dib) <- dupImportsBy])
84
+ , nest 2 $
85
+ vcat
86
+ [ docProjectConfigPath dib
87
+ | (_, dib) <- filter ((duplicate == ) . fst ) seenImportsBy
88
+ ]
83
89
]
84
90
85
91
docProjectConfigPathFailReason :: VR -> ProjectConfigPath -> Doc
Original file line number Diff line number Diff line change @@ -284,8 +284,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity importsBy projectDir sourc
284
284
| isCyclicConfigPath normLocPath ->
285
285
pure . parseFail $ ParseUtils. FromString (render $ cyclicalImportMsg normLocPath) Nothing
286
286
| uniqueImport `elem` seenImports -> do
287
- let dupImportsBy = filter ((uniqueImport == ) . fst ) seenImportsBy
288
- pure . parseFail $ ParseUtils. FromString (render $ duplicateImportMsg uniqueImport normLocPath dupImportsBy) Nothing
287
+ pure . parseFail $ ParseUtils. FromString (render $ duplicateImportMsg uniqueImport normLocPath seenImportsBy) Nothing
289
288
| otherwise -> do
290
289
normSource <- canonicalizeConfigPath projectDir source
291
290
let fs = (\ z -> CondNode z [normLocPath] mempty ) <$> fieldsToConfig normSource (reverse acc)
You can’t perform that action at this time.
0 commit comments