[commit: ghc] master: Special-case record fields ending with hash when deriving Read (d5577f4)

git at git.haskell.org git at git.haskell.org
Fri Mar 23 16:06:39 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d5577f44eaf3b9dfdfc77828038782bf818c176a/ghc

>---------------------------------------------------------------

commit d5577f44eaf3b9dfdfc77828038782bf818c176a
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Fri Mar 23 11:40:02 2018 -0400

    Special-case record fields ending with hash when deriving Read
    
    Summary:
    In commit dbd81f7e86514498218572b9d978373b1699cc5b, a
    regression was inadvertently introduced which caused derived `Read`
    instances for record data types with fields ending in a `#` symbol
    (using `MagicHash`) would no longer parse on valid output. This
    is ultimately due to the same reasons as #5041, as we cannot parse
    a field name like `foo#` as a single identifier. We fix this issue
    by employing the same workaround as in #5041: first parse the
    identifier name `foo`, then then symbol `#`.
    
    This is accomplished by the new `readFieldHash` function in
    `GHC.Read`. This will likely warrant a `base-4.11.1.0` release.
    
    Test Plan: make test TEST=T14918
    
    Reviewers: tdammers, hvr, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #14918
    
    Differential Revision: https://phabricator.haskell.org/D4502


>---------------------------------------------------------------

d5577f44eaf3b9dfdfc77828038782bf818c176a
 compiler/prelude/PrelNames.hs                      |  3 +-
 compiler/typecheck/TcGenDeriv.hs                   | 16 ++++--
 .../{8.6.1-notes.rst => 8.4.2-notes.rst}           | 65 ++++------------------
 docs/users_guide/index.rst                         |  4 +-
 libraries/base/GHC/Read.hs                         | 17 ++++++
 libraries/base/changelog.md                        |  4 ++
 testsuite/tests/deriving/should_run/T14918.hs      | 18 ++++++
 testsuite/tests/deriving/should_run/T14918.stdout  |  2 +
 testsuite/tests/deriving/should_run/all.T          |  1 +
 9 files changed, 66 insertions(+), 64 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d5577f44eaf3b9dfdfc77828038782bf818c176a


More information about the ghc-commits mailing list