[commit: ghc] wip/7.10-api-annots: ApiAnnotations : RdrHsSyn.isFunLhs discards parentheses (ec6c9ad)

git at git.haskell.org git at git.haskell.org
Fri May 8 17:02:24 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/7.10-api-annots
Link       : http://ghc.haskell.org/trac/ghc/changeset/ec6c9adf369eb705a4dbd45f8823d3d21556b5f9/ghc

>---------------------------------------------------------------

commit ec6c9adf369eb705a4dbd45f8823d3d21556b5f9
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Thu May 7 23:45:44 2015 +0200

    ApiAnnotations : RdrHsSyn.isFunLhs discards parentheses
    
    Summary:
    The RdrHsSyn.isFunLhs function has the following
    
      isFunLhs e = go e []
       where
         go (L loc (HsVar f)) es
              | not (isRdrDataCon f)   = return (Just (L loc f, False, es))
         go (L _ (HsApp f e)) es       = go f (e:es)
         go (L _ (HsPar e))   es@(_:_) = go e es
    
    The treatment of HsPar means that any parentheses around an infix function will be discarded.
    
    e.g.
    
      (f =*= g) sa i = f (toF sa i) =^= g (toG sa i)
    
    will lose the ( before f and the closing one after g
    
    Test Plan: ./validate
    
    Reviewers: hvr, austin
    
    Reviewed By: austin
    
    Subscribers: bgamari, thomie
    
    Differential Revision: https://phabricator.haskell.org/D832
    
    GHC Trac Issues: #10269
    
    (cherry picked from commit 5bde9f7c1834ab4da1fad1838afec1a578c26530)


>---------------------------------------------------------------

ec6c9adf369eb705a4dbd45f8823d3d21556b5f9
 compiler/parser/Parser.y                           |  4 +-
 compiler/parser/RdrHsSyn.hs                        | 46 ++++++++++++----------
 testsuite/tests/ghc-api/annotations/.gitignore     |  1 +
 testsuite/tests/ghc-api/annotations/Makefile       |  8 ++++
 testsuite/tests/ghc-api/annotations/T10269.stdout  | 36 +++++++++++++++++
 testsuite/tests/ghc-api/annotations/Test10269.hs   |  4 ++
 testsuite/tests/ghc-api/annotations/all.T          |  1 +
 .../ghc-api/annotations/{t10268.hs => t10269.hs}   |  2 +-
 8 files changed, 78 insertions(+), 24 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 ec6c9adf369eb705a4dbd45f8823d3d21556b5f9


More information about the ghc-commits mailing list