[GHC] #5041: Incorrect Read deriving for MagicHash constructors

GHC ghc-devs at haskell.org
Fri Mar 23 16:06:31 UTC 2018


#5041: Incorrect Read deriving for MagicHash constructors
-------------------------------------+-------------------------------------
        Reporter:  dolio             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:  ⊥
       Component:  Compiler          |              Version:  7.0.2
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  deriving/should_run/T5041
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ryan Scott <ryan.gl.scott@…>):

 In [changeset:"d5577f44eaf3b9dfdfc77828038782bf818c176a/ghc"
 d5577f44/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="d5577f44eaf3b9dfdfc77828038782bf818c176a"
 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
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5041#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list