Skip to content

Refactor to avoid incomplete record selection warning in cabal-install #11173

@ulysses4ever

Description

@ulysses4ever

It was noted before (#10402) that Cabal (the library) codebase isn't clean w.r.t. -Wincomplete-record-selectors, which was subsequently fixed in #10403. Sadly, the same wasn't done for cabal-install. Now, with GHC 9.14 (that moved the warning into -Wall) I'm getting:

2025-08-20T16:11:06.5311473Z src/Distribution/Client/ProjectPlanning.hs:1249:65: error: [GHC-17335] [-Wincomplete-record-selectors, Werror=incomplete-record-selectors]
2025-08-20T16:11:06.5314264Z ##[error]    Selecting the record field ‘repoRemote’ may fail for the following constructors:
2025-08-20T16:11:06.5315593Z       RepoLocalNoIndex
2025-08-20T16:11:06.5315898Z      |
2025-08-20T16:11:06.5316372Z 1249 |                       . NE.groupBy ((==) `on` (remoteRepoName . repoRemote . fst))
2025-08-20T16:11:06.5316944Z      |                                                                 ^^^^^^^^^^
2025-08-20T16:11:06.5317209Z 
2025-08-20T16:11:06.5319370Z src/Distribution/Client/ProjectPlanning.hs:1250:64: error: [GHC-17335] [-Wincomplete-record-selectors, Werror=incomplete-record-selectors]
2025-08-20T16:11:06.5322520Z ##[error]    Selecting the record field ‘repoRemote’ may fail for the following constructors:
2025-08-20T16:11:06.5324077Z       RepoLocalNoIndex
2025-08-20T16:11:06.5324395Z      |
2025-08-20T16:11:06.5324845Z 1250 |                       . sortBy (compare `on` (remoteRepoName . repoRemote . fst))
2025-08-20T16:11:06.5325672Z      |                                                                ^^^^^^^^^^

Shouldnt' be hard to fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions