Special-case record fields ending with hash when deriving Read
Summary: In commit dbd81f7e, 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
Showing
- compiler/prelude/PrelNames.hs 2 additions, 1 deletioncompiler/prelude/PrelNames.hs
- compiler/typecheck/TcGenDeriv.hs 10 additions, 6 deletionscompiler/typecheck/TcGenDeriv.hs
- docs/users_guide/8.4.2-notes.rst 88 additions, 0 deletionsdocs/users_guide/8.4.2-notes.rst
- docs/users_guide/index.rst 2 additions, 2 deletionsdocs/users_guide/index.rst
- libraries/base/GHC/Read.hs 17 additions, 0 deletionslibraries/base/GHC/Read.hs
- libraries/base/changelog.md 4 additions, 0 deletionslibraries/base/changelog.md
- testsuite/tests/deriving/should_run/T14918.hs 18 additions, 0 deletionstestsuite/tests/deriving/should_run/T14918.hs
- testsuite/tests/deriving/should_run/T14918.stdout 2 additions, 0 deletionstestsuite/tests/deriving/should_run/T14918.stdout
- testsuite/tests/deriving/should_run/all.T 1 addition, 0 deletionstestsuite/tests/deriving/should_run/all.T
Loading
Please register or sign in to comment