[commit: ghc] master: Make type import/export API Annotation friendly (0d1cb15)

git at git.haskell.org git at git.haskell.org
Thu Jan 26 13:20:30 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0d1cb1574dd58d1026cac812e2098135823fa419/ghc

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

commit 0d1cb1574dd58d1026cac812e2098135823fa419
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Mon Jan 23 20:23:28 2017 +0200

    Make type import/export API Annotation friendly
    
    Summary:
    At the moment an export of the form
    
       type C(..)
    
    is parsed by the rule
    
    ```
      |  'type' oqtycon           {% amms (mkTypeImpExp (sLL $1 $> (unLoc $2)))
                                         [mj AnnType $1,mj AnnVal $2] }
    ```
    
    This means that the origiinal oqtycon loses its location which is then retained
    in the AnnVal annotation.
    
    The problem is if the oqtycon has its own annotations, these get lost.
    
    e.g. in
    
      type (?)(..)
    
    the parens annotations for (?) get lost.
    
    This patch adds a wrapper around the name in the IE type to
    
    (a) provide a distinct location for the adornment annotation and
    
    (b) identify the specific adornment, for use in the pretty printer rather than
    occName magic.
    
    Updates haddock submodule
    
    Test Plan: ./validate
    
    Reviewers: mpickering, dfeuer, bgamari, austin
    
    Reviewed By: dfeuer
    
    Subscribers: dfeuer, thomie, mpickering
    
    Differential Revision: https://phabricator.haskell.org/D3016
    
    GHC Trac Issues: #13163


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

0d1cb1574dd58d1026cac812e2098135823fa419
 compiler/hsSyn/HsImpExp.hs                        | 108 +++++++++++++++-------
 compiler/parser/Parser.y                          |  25 ++---
 compiler/parser/RdrHsSyn.hs                       |  55 +++++++----
 compiler/rename/RnNames.hs                        | 108 ++++++++++++++--------
 compiler/typecheck/TcRnExports.hs                 |  40 ++++----
 testsuite/driver/extra_files.py                   |   1 +
 testsuite/tests/ghc-api/annotations/Makefile      |   4 +
 testsuite/tests/ghc-api/annotations/T13163.stdout |  78 ++++++++++++++++
 testsuite/tests/ghc-api/annotations/Test13163.hs  |  16 ++++
 testsuite/tests/ghc-api/annotations/all.T         |   1 +
 utils/check-ppr/README                            |   7 +-
 utils/haddock                                     |   2 +-
 12 files changed, 325 insertions(+), 120 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 0d1cb1574dd58d1026cac812e2098135823fa419


More information about the ghc-commits mailing list