[commit: ghc] master: Udate hsSyn AST to use Trees that Grow (8e6ec0f)

git at git.haskell.org git at git.haskell.org
Mon Jun 5 22:16:42 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8e6ec0fa7431b0454b09c0011a615f0845df1198/ghc

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

commit 8e6ec0fa7431b0454b09c0011a615f0845df1198
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Fri May 19 14:56:09 2017 +0200

    Udate hsSyn AST to use Trees that Grow
    
    Summary:
    See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
    
    This commit prepares the ground for a full extensible AST, by replacing the type
    parameter for the hsSyn data types with a set of indices into type families,
    
        data GhcPs -- ^ Index for GHC parser output
        data GhcRn -- ^ Index for GHC renamer output
        data GhcTc -- ^ Index for GHC typechecker output
    
    These are now used instead of `RdrName`, `Name` and `Id`/`TcId`/`Var`
    
    Where the original name type is required in a polymorphic context, this is
    accessible via the IdP type family, defined as
    
        type family IdP p
        type instance IdP GhcPs = RdrName
        type instance IdP GhcRn = Name
        type instance IdP GhcTc = Id
    
    These types are declared in the new 'hsSyn/HsExtension.hs' module.
    
    To gain a better understanding of the extension mechanism, it has been applied
    to `HsLit` only, also replacing the `SourceText` fields in them with extension
    types.
    
    To preserve extension generality, a type class is introduced to capture the
    `SourceText` interface, which must be honoured by all of the extension points
    which originally had a `SourceText`.  The class is defined as
    
        class HasSourceText a where
          -- Provide setters to mimic existing constructors
          noSourceText  :: a
          sourceText    :: String -> a
    
          setSourceText :: SourceText -> a
          getSourceText :: a -> SourceText
    
    And the constraint is captured in `SourceTextX`, which is a constraint type
    listing all the extension points that make use of the class.
    
    Updating Haddock submodule to match.
    
    Test Plan: ./validate
    
    Reviewers: simonpj, shayan-najd, goldfire, austin, bgamari
    
    Subscribers: rwbarton, thomie, mpickering
    
    Differential Revision: https://phabricator.haskell.org/D3609


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

8e6ec0fa7431b0454b09c0011a615f0845df1198
 compiler/backpack/BkpSyn.hs                        |   3 +-
 compiler/backpack/DriverBkp.hs                     |   4 +-
 compiler/deSugar/Check.hs                          |  66 +--
 compiler/deSugar/Coverage.hs                       | 122 ++---
 compiler/deSugar/Desugar.hs                        |   7 +-
 compiler/deSugar/DsArrows.hs                       |  71 +--
 compiler/deSugar/DsBinds.hs                        |  16 +-
 compiler/deSugar/DsExpr.hs                         |  41 +-
 compiler/deSugar/DsExpr.hs-boot                    |  16 +-
 compiler/deSugar/DsForeign.hs                      |  10 +-
 compiler/deSugar/DsGRHSs.hs                        |  18 +-
 compiler/deSugar/DsListComp.hs                     |  59 +--
 compiler/deSugar/DsMeta.hs                         | 231 ++++-----
 compiler/deSugar/DsMonad.hs                        |   2 +-
 compiler/deSugar/DsUtils.hs                        |  29 +-
 compiler/deSugar/Match.hs                          |  43 +-
 compiler/deSugar/Match.hs-boot                     |   9 +-
 compiler/deSugar/MatchCon.hs                       |   8 +-
 compiler/deSugar/MatchLit.hs                       |  40 +-
 compiler/deSugar/PmExpr.hs                         |  12 +-
 compiler/ghc.cabal.in                              |   1 +
 compiler/ghc.mk                                    |   1 +
 compiler/hsSyn/Convert.hs                          | 149 +++---
 compiler/hsSyn/HsBinds.hs                          | 121 ++---
 compiler/hsSyn/HsDecls.hs                          | 531 +++++++++++----------
 compiler/hsSyn/HsDumpAst.hs                        |  28 +-
 compiler/hsSyn/HsExpr.hs                           | 461 +++++++++---------
 compiler/hsSyn/HsExpr.hs-boot                      |  40 +-
 compiler/hsSyn/HsExtension.hs                      | 289 +++++++++++
 compiler/hsSyn/HsImpExp.hs                         |  37 +-
 compiler/hsSyn/HsLit.hs                            | 132 +++--
 compiler/hsSyn/HsPat.hs                            | 183 +++----
 compiler/hsSyn/HsPat.hs-boot                       |   6 +-
 compiler/hsSyn/HsSyn.hs                            |   7 +-
 compiler/hsSyn/HsTypes.hs                          | 392 +++++++--------
 compiler/hsSyn/HsUtils.hs                          | 297 ++++++------
 compiler/hsSyn/PlaceHolder.hs                      |  50 --
 compiler/main/GHC.hs                               |   8 +-
 compiler/main/HeaderInfo.hs                        |   7 +-
 compiler/main/Hooks.hs                             |  28 +-
 compiler/main/HscMain.hs                           |  16 +-
 compiler/main/HscStats.hs                          |   3 +-
 compiler/main/HscTypes.hs                          |  34 +-
 compiler/main/InteractiveEval.hs                   |  10 +-
 compiler/parser/Parser.y                           | 373 ++++++++-------
 compiler/parser/RdrHsSyn.hs                        | 245 +++++-----
 compiler/rename/RnBinds.hs                         | 150 +++---
 compiler/rename/RnEnv.hs                           |  29 +-
 compiler/rename/RnExpr.hs                          | 226 ++++-----
 compiler/rename/RnExpr.hs-boot                     |  22 +-
 compiler/rename/RnFixity.hs                        |   2 +-
 compiler/rename/RnNames.hs                         |  87 ++--
 compiler/rename/RnPat.hs                           |  64 +--
 compiler/rename/RnSource.hs                        | 187 ++++----
 compiler/rename/RnSplice.hs                        |  63 +--
 compiler/rename/RnSplice.hs-boot                   |  12 +-
 compiler/rename/RnTypes.hs                         | 211 ++++----
 compiler/rename/RnUtils.hs                         |   2 +-
 compiler/typecheck/Inst.hs                         |  29 +-
 compiler/typecheck/TcAnnotations.hs                |  17 +-
 compiler/typecheck/TcArrows.hs                     |  19 +-
 compiler/typecheck/TcBackpack.hs                   |   1 +
 compiler/typecheck/TcBinds.hs                      |  96 ++--
 compiler/typecheck/TcClassDcl.hs                   |  41 +-
 compiler/typecheck/TcDefaults.hs                   |   8 +-
 compiler/typecheck/TcDeriv.hs                      |  39 +-
 compiler/typecheck/TcDerivUtils.hs                 |   8 +-
 compiler/typecheck/TcEnv.hs                        |  18 +-
 compiler/typecheck/TcEnv.hs-boot                   |   1 +
 compiler/typecheck/TcExpr.hs                       | 146 +++---
 compiler/typecheck/TcExpr.hs-boot                  |  31 +-
 compiler/typecheck/TcForeign.hs                    |  23 +-
 compiler/typecheck/TcGenDeriv.hs                   | 151 +++---
 compiler/typecheck/TcGenFunctor.hs                 |  99 ++--
 compiler/typecheck/TcGenGenerics.hs                |  32 +-
 compiler/typecheck/TcHsSyn.hs                      | 137 +++---
 compiler/typecheck/TcHsType.hs                     |  93 ++--
 compiler/typecheck/TcInstDcls.hs                   |  72 +--
 compiler/typecheck/TcInstDcls.hs-boot              |   5 +-
 compiler/typecheck/TcMatches.hs                    | 106 ++--
 compiler/typecheck/TcMatches.hs-boot               |  11 +-
 compiler/typecheck/TcPat.hs                        |  53 +-
 compiler/typecheck/TcPatSyn.hs                     |  86 ++--
 compiler/typecheck/TcPatSyn.hs-boot                |  13 +-
 compiler/typecheck/TcRnDriver.hs                   |  63 +--
 compiler/typecheck/TcRnExports.hs                  |  41 +-
 compiler/typecheck/TcRnTypes.hs                    |  73 +--
 compiler/typecheck/TcRules.hs                      |  10 +-
 compiler/typecheck/TcSigs.hs                       |  34 +-
 compiler/typecheck/TcSimplify.hs                   |  16 +-
 compiler/typecheck/TcSplice.hs                     |  53 +-
 compiler/typecheck/TcSplice.hs-boot                |  36 +-
 compiler/typecheck/TcTyClsDecls.hs                 | 112 ++---
 compiler/typecheck/TcTyDecls.hs                    |  11 +-
 compiler/typecheck/TcTypeable.hs                   |  55 +--
 compiler/typecheck/TcUnify.hs                      |  11 +-
 compiler/typecheck/TcUnify.hs-boot                 |  14 +-
 compiler/typecheck/TcValidity.hs                   |   2 +-
 docs/users_guide/8.4.1-notes.rst                   |  34 ++
 ghc/GHCi/UI.hs                                     |   6 +-
 ghc/GHCi/UI/Info.hs                                |   6 +-
 ghc/GHCi/UI/Monad.hs                               |   7 +-
 .../tests/ghc-api/annotations-literals/parsed.hs   |   6 +-
 testsuite/tests/ghc-api/annotations/parseTree.hs   |   2 +-
 .../tests/ghc-api/annotations/stringSource.hs      |   6 +-
 testsuite/tests/ghc-api/annotations/t11430.hs      |   4 +-
 .../tests/indexed-types/should_fail/T13784.hs      |   6 +-
 .../tests/indexed-types/should_fail/T13784.stderr  |  22 +-
 testsuite/tests/quasiquotation/T7918.hs            |   6 +-
 utils/ghctags/Main.hs                              |   5 +-
 utils/haddock                                      |   2 +-
 111 files changed, 3941 insertions(+), 3348 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 8e6ec0fa7431b0454b09c0011a615f0845df1198


More information about the ghc-commits mailing list