• Adam Gundry's avatar
    Implement DuplicateRecordFields · b1884b0e
    Adam Gundry authored
    This implements DuplicateRecordFields, the first part of the
    OverloadedRecordFields extension, as described at
    This includes fairly wide-ranging changes in order to allow multiple
    records within the same module to use the same field names.  Note that
    it does *not* allow record selector functions to be used if they are
    ambiguous, and it does not have any form of type-based disambiguation
    for selectors (but it does for updates). Subsequent parts will make
    overloading selectors possible using orthogonal extensions, as
    described on the wiki pages.  This part touches quite a lot of the
    codebase, and requires changes to several GHC API datatypes in order
    to distinguish between field labels (which may be overloaded) and
    selector function names (which are always unique).
    The Haddock submodule has been adapted to compile with the GHC API
    changes, but it will need further work to properly support modules
    that use the DuplicateRecordFields extension.
    Test Plan: New tests added in testsuite/tests/overloadedrecflds; these
    will be extended once the other parts are implemented.
    Reviewers: goldfire, bgamari, simonpj, austin
    Subscribers: sjcjoosten, haggholm, mpickering, bgamari, tibbe, thomie,
    Differential Revision: https://phabricator.haskell.org/D761
RnTypes.hs 50.3 KB