[commit: ghc] ghc-8.4: Special-case record fields ending with hash when deriving Read (32e1842)
git at git.haskell.org
git at git.haskell.org
Sun Mar 25 19:45:28 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.4
Link : http://ghc.haskell.org/trac/ghc/changeset/32e18420b328b1f939dd92333d3b7637c26ef3a8/ghc
>---------------------------------------------------------------
commit 32e18420b328b1f939dd92333d3b7637c26ef3a8
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
(cherry picked from commit d5577f44eaf3b9dfdfc77828038782bf818c176a)
>---------------------------------------------------------------
32e18420b328b1f939dd92333d3b7637c26ef3a8
compiler/prelude/PrelNames.hs | 3 +-
compiler/typecheck/TcGenDeriv.hs | 16 +++--
docs/users_guide/8.4.2-notes.rst | 88 +++++++++++++++++++++++
docs/users_guide/index.rst | 1 +
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, 143 insertions(+), 7 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 32e18420b328b1f939dd92333d3b7637c26ef3a8
More information about the ghc-commits
mailing list