@@ -24,6 +24,7 @@ import Distribution.Client.TargetProblem
2424import Distribution.Client.TargetSelector
2525 ( ComponentKind (.. )
2626 , ComponentKindFilter
27+ , SubComponentTarget (.. )
2728 , TargetSelector (.. )
2829 , componentKind
2930 , showTargetSelector
@@ -141,18 +142,28 @@ renderTargetSelector (TargetAllPackages (Just kfilter)) =
141142 " all the "
142143 ++ renderComponentKind Plural kfilter
143144 ++ " in the project"
144- renderTargetSelector (TargetComponent pkgid cname) =
145- " the "
145+ renderTargetSelector (TargetComponent pkgid cname subtarget) =
146+ renderSubComponentTarget subtarget
147+ ++ " the "
146148 ++ renderComponentName (packageName pkgid) cname
147- renderTargetSelector (TargetComponentUnknown pkgname (Left ucname)) =
148- " the component "
149+ renderTargetSelector (TargetComponentUnknown pkgname (Left ucname) subtarget) =
150+ renderSubComponentTarget subtarget
151+ ++ " the component "
149152 ++ prettyShow ucname
150153 ++ " in the package "
151154 ++ prettyShow pkgname
152- renderTargetSelector (TargetComponentUnknown pkgname (Right cname)) =
153- " the "
155+ renderTargetSelector (TargetComponentUnknown pkgname (Right cname) subtarget) =
156+ renderSubComponentTarget subtarget
157+ ++ " the "
154158 ++ renderComponentName pkgname cname
155159
160+ renderSubComponentTarget :: SubComponentTarget -> String
161+ renderSubComponentTarget WholeComponent = " "
162+ renderSubComponentTarget (FileTarget filename) =
163+ " the file " ++ filename ++ " in "
164+ renderSubComponentTarget (ModuleTarget modname) =
165+ " the module " ++ prettyShow modname ++ " in "
166+
156167renderOptionalStanza :: Plural -> OptionalStanza -> String
157168renderOptionalStanza Singular TestStanzas = " test suite"
158169renderOptionalStanza Plural TestStanzas = " test suites"
@@ -249,7 +260,7 @@ renderTargetProblem verb _ (TargetAvailableInIndex pkgname) =
249260 ++ " in this project (either directly or indirectly), but it is in the current "
250261 ++ " package index. If you want to add it to the project then edit the "
251262 ++ " cabal.project file."
252- renderTargetProblem verb _ (TargetComponentNotProjectLocal pkgid cname) =
263+ renderTargetProblem verb _ (TargetComponentNotProjectLocal pkgid cname _ ) =
253264 " Cannot "
254265 ++ verb
255266 ++ " the "
@@ -262,7 +273,7 @@ renderTargetProblem verb _ (TargetComponentNotProjectLocal pkgid cname) =
262273 ++ " non-local dependencies. To run test suites or benchmarks from "
263274 ++ " dependencies you can unpack the package locally and adjust the "
264275 ++ " cabal.project file to include that package directory."
265- renderTargetProblem verb _ (TargetComponentNotBuildable pkgid cname) =
276+ renderTargetProblem verb _ (TargetComponentNotBuildable pkgid cname _ ) =
266277 " Cannot "
267278 ++ verb
268279 ++ " the "
@@ -275,7 +286,7 @@ renderTargetProblem verb _ (TargetComponentNotBuildable pkgid cname) =
275286 ++ " property is conditional on flags. Alternatively you may simply have to "
276287 ++ " edit the .cabal file to declare it as buildable and fix any resulting "
277288 ++ " build problems."
278- renderTargetProblem verb _ (TargetOptionalStanzaDisabledByUser _ cname) =
289+ renderTargetProblem verb _ (TargetOptionalStanzaDisabledByUser _ cname _ ) =
279290 " Cannot "
280291 ++ verb
281292 ++ " the "
@@ -294,7 +305,7 @@ renderTargetProblem verb _ (TargetOptionalStanzaDisabledByUser _ cname) =
294305 ++ " explanation."
295306 where
296307 compkinds = renderComponentKind Plural (componentKind cname)
297- renderTargetProblem verb _ (TargetOptionalStanzaDisabledBySolver pkgid cname) =
308+ renderTargetProblem verb _ (TargetOptionalStanzaDisabledBySolver pkgid cname _ ) =
298309 " Cannot "
299310 ++ verb
300311 ++ " the "
0 commit comments