Overloaded record fields meta-ticket
This is a meta-ticket covering the ongoing work on The Records Problem, in particular related to `DuplicateRecordFields`, `NoFieldSelectors` and `RecordDotSyntax`. See also issues labelled ~OverloadedRecordFields and the [overloaded-record-fields wiki page](https://gitlab.haskell.org/ghc/ghc/-/wikis/records/overloaded-record-fields). The following pieces have implementations in flight: * [ ] Adding `setField` to `GHC.Records` (#16232, [ghc-proposals#158](https://github.com/ghc-proposals/ghc-proposals/pull/158)). Implemented by @adamgundry (!3257) but stalled due to performance concerns. Planned next steps are documented at https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3257#note_312762. @adamgundry has opened a [GHC proposal to redesign `HasField`](https://github.com/ghc-proposals/ghc-proposals/pull/583), which is blocking this. * [ ] @sheaf is fixing many bugs with `DuplicateRecordFields` (!8686). The remainder of this ticket is historical, much of it may not be relevant once !8686 lands. ----------------------- Planned code cleanup: * Refactor `GHC.Types.Name.Reader` (#19116). * Remove `AmbiguousFieldOcc` and simplify field name resolution in accordance with [ghc-proposals#366](https://github.com/ghc-proposals/ghc-proposals/pull/366) (#19461). * ~~Issue https://gitlab.haskell.org/ghc/ghc/-/issues/19720 tracks progress on removal of `AmbiguousFieldOcc` from `HsRecFld` which is being worked on by @shayne-fletcher-da~~ done * Issue https://gitlab.haskell.org/ghc/ghc/-/issues/19891 tracks the need to update documentation in the Users Guide and release notes for whenever this is to get deployed * Simplify the representation of `RecordUpd` for `OverloadedRecordUpdate` following !4532. See Refactor `RecordUpd` syntax (#19463). * ~~Issue https://gitlab.haskell.org/ghc/ghc/-/issues/19783 tracks progress on changing representation of `HsGetField` and `HsProjection` which is being worked on by @shayne-fletcher-da~~ done * ~~Issue https://gitlab.haskell.org/ghc/ghc/-/issues/19848 tracks progress on renaming `HsRecField'` to `HsFieldBind` and various related changes which is being worked on by @shayne-fletcher-da~~ done Issues for the future: * Fix bugs in GHCi related to `DuplicateRecordFields` (#13438, #19314, #19322). * Resolve issues around representing `DuplicateRecordFields` in Template Haskell (#14848, #17381, #17551, #19664). This primarily requires investigation of the best way to represent field names in the TH AST, ideally a way that avoids losing information when it is known which datatype contains the field. * Continue improving dark corners of the renamer, i.e. the fact that mangled selector `Name`s are used to represent fields, so one must be very careful not to use the `Name`'s `OccName` as if it were meaningful to users). Avoid #13352, perhaps by reducing the reliance on name-mangling? * Warnings around partial fields (#18650). * Improve `HasField` error messages (#18776). * Improve `DuplicateRecordFields` error messages (#14892, #17420, #17469). * Refactor `RecordUpd` syntax (#19463) Already done: * [X] Resolve the interaction between `DuplicateRecordFields` and pattern synonyms (#11228, #14630, #17176, #18452), and simplify some dark corners of the renamer (in particular the unsatisfactory representation of `GlobalRdrElt`). Implemented by @adamgundry (!4467). In GHC 9.2. * [X] `NoFieldSelectors` (#5972, [ghc-proposals#160](https://github.com/ghc-proposals/ghc-proposals/pull/160)). Initially implemented by @reactormonk and @fumieval (!4017). Revised by @adamgundry (!4743) along with extending `DisambiguateRecordFields` to cover updates (#18999) and fixing some bugs (#18729, #19213). In GHC 9.2. * [X] Add `-Wambiguous-fields` (#18966, [ghc-proposals#366](https://github.com/ghc-proposals/ghc-proposals/pull/366)). Implemented by @adamgundry (!4770). In GHC 9.2. * [X] Record dot syntax (#18599, [ghc-proposals#282](https://github.com/ghc-proposals/ghc-proposals/pull/282)). This has been split into `OverloadedRecordDot` (which does not need `setField`) and `OverloadedRecordUpdate` (which will require `RebindableSyntax` until we have `setField` in `GHC.Records`); see [ghc-proposals#405](https://github.com/ghc-proposals/ghc-proposals/pull/405). Implemented by @shayne-fletcher-da (!4532). In GHC 9.2.
issue