[GHC] #14918: GHC 8.4.1 regression: derived Read instances with field names containing # no longer parse

GHC ghc-devs at haskell.org
Wed Mar 14 01:41:23 UTC 2018


#14918: GHC 8.4.1 regression: derived Read instances with field names containing #
no longer parse
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.4.2
       Component:  Compiler          |              Version:  8.4.1
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14364            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * cc: tdammers (added)
 * related:   => #14364


Comment:

 Comparing the results of `-ddump-deriv` between GHC 8.2.1 and 8.4.1 is
 interesting. In GHC 8.2.1, we have:

 {{{
   instance GHC.Read.Read a => GHC.Read.Read (Bug.T a) where
     GHC.Read.readPrec
       = GHC.Read.parens
           (Text.ParserCombinators.ReadPrec.prec
              11
              (do GHC.Read.expectP (Text.Read.Lex.Ident "MkT")
                  GHC.Read.expectP (Text.Read.Lex.Punc "{")
                  GHC.Read.expectP (Text.Read.Lex.Ident "runT")
                  GHC.Read.expectP (Text.Read.Lex.Symbol "#")
                  GHC.Read.expectP (Text.Read.Lex.Punc "=")
                  a1_a2wO <- Text.ParserCombinators.ReadPrec.reset
 GHC.Read.readPrec
                  GHC.Read.expectP (Text.Read.Lex.Punc "}")
                  GHC.Base.return (Bug.MkT a1_a2wO)))
     GHC.Read.readList = GHC.Read.readListDefault
     GHC.Read.readListPrec = GHC.Read.readListPrecDefault
 }}}

 But in GHC 8.4.1, we have:

 {{{
   instance GHC.Read.Read a => GHC.Read.Read (Bug.T a) where
     GHC.Read.readPrec
       = GHC.Read.parens
           (Text.ParserCombinators.ReadPrec.prec
              11
              (do GHC.Read.expectP (Text.Read.Lex.Ident "MkT")
                  GHC.Read.expectP (Text.Read.Lex.Punc "{")
                  a1_a2Tm <- GHC.Read.readField
                               "runT#"
 (Text.ParserCombinators.ReadPrec.reset GHC.Read.readPrec)
                  GHC.Read.expectP (Text.Read.Lex.Punc "}")
                  GHC.Base.return (Bug.MkT a1_a2Tm)))
     GHC.Read.readList = GHC.Read.readListDefault
     GHC.Read.readListPrec = GHC.Read.readListPrecDefault
 }}}

 This likely has something to do with commit
 dbd81f7e86514498218572b9d978373b1699cc5b (Factor out readField (#14364)).
 tdammers, do you know what is going on here?

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


More information about the ghc-tickets mailing list