[GHC] #14681: More incorrect Template Haskell parenthesization

GHC ghc-devs at haskell.org
Thu Jan 18 18:02:53 UTC 2018


#14681: More incorrect Template Haskell parenthesization
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4323
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"575c009d9e4b25384ef984c09b2c54f909693e93/ghc"
 575c009d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="575c009d9e4b25384ef984c09b2c54f909693e93"
 Fix #14681 and #14682 with precision-aimed parentheses

 It turns out that `Convert` was recklessly leaving off
 parentheses in two places:

 * Negative numeric literals
 * Patterns in lambda position

 This patch fixes it by adding three new functions, `isCompoundHsLit`,
 `isCompoundHsOverLit`, and `isCompoundPat`, and using them in the
 right places in `Convert`. While I was in town, I also sprinkled
 `isCompoundPat` among some `Pat`-constructing functions in `HsUtils`
 to help avoid the likelihood of this problem happening in other
 places. One of these places is in `TcGenDeriv`, and sprinkling
 `isCompountPat` there fixes #14682

 Test Plan: make test TEST="T14681 T14682"

 Reviewers: alanz, goldfire, bgamari

 Reviewed By: bgamari

 Subscribers: rwbarton, thomie, carter

 GHC Trac Issues: #14681, #14682

 Differential Revision: https://phabricator.haskell.org/D4323
 }}}

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


More information about the ghc-tickets mailing list