[commit: ghc] wip/new-tree-one-param-2: Udate hsSyn AST to use Trees that Grow (e511e8e)

git at git.haskell.org git at git.haskell.org
Sun May 28 13:23:11 UTC 2017


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

On branch  : wip/new-tree-one-param-2
Link       : http://ghc.haskell.org/trac/ghc/changeset/e511e8e1dc4d74bfab6b9fa7acd327082f459119/ghc

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

commit e511e8e1dc4d74bfab6b9fa7acd327082f459119
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


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

e511e8e1dc4d74bfab6b9fa7acd327082f459119
 compiler/backpack/BkpSyn.hs                        |   3 +-
 compiler/backpack/DriverBkp.hs                     |   4 +-
 compiler/deSugar/Check.hs                          |  64 +--
 compiler/deSugar/Coverage.hs                       | 121 ++---
 compiler/deSugar/Desugar.hs                        |   7 +-
 compiler/deSugar/DsArrows.hs                       |  70 +--
 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                         | 226 ++++-----
 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                       |   7 +-
 compiler/deSugar/MatchLit.hs                       |  38 +-
 compiler/deSugar/PmExpr.hs                         |  12 +-
 compiler/ghc.cabal.in                              |   1 +
 compiler/ghc.mk                                    |   1 +
 compiler/hsSyn/Convert.hs                          | 147 +++---
 compiler/hsSyn/HsBinds.hs                          | 121 ++---
 compiler/hsSyn/HsDecls.hs                          | 513 +++++++++++----------
 compiler/hsSyn/HsDumpAst.hs                        |  28 +-
 compiler/hsSyn/HsExpr.hs                           | 458 +++++++++---------
 compiler/hsSyn/HsExpr.hs-boot                      |  40 +-
 compiler/hsSyn/HsExtension.hs                      | 303 ++++++++++++
 compiler/hsSyn/HsImpExp.hs                         |  37 +-
 compiler/hsSyn/HsLit.hs                            | 131 ++++--
 compiler/hsSyn/HsPat.hs                            | 168 +++----
 compiler/hsSyn/HsPat.hs-boot                       |   6 +-
 compiler/hsSyn/HsSyn.hs                            |   7 +-
 compiler/hsSyn/HsTypes.hs                          | 385 ++++++++--------
 compiler/hsSyn/HsUtils.hs                          | 296 ++++++------
 compiler/hsSyn/PlaceHolder.hs                      |  50 --
 compiler/main/GHC.hs                               |   8 +-
 compiler/main/HeaderInfo.hs                        |   7 +-
 compiler/main/Hooks.hs                             |  13 +-
 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                        | 243 +++++-----
 compiler/rename/RnBinds.hs                         | 147 +++---
 compiler/rename/RnEnv.hs                           |  29 +-
 compiler/rename/RnExpr.hs                          | 221 ++++-----
 compiler/rename/RnExpr.hs-boot                     |  22 +-
 compiler/rename/RnFixity.hs                        |   2 +-
 compiler/rename/RnNames.hs                         |  85 ++--
 compiler/rename/RnPat.hs                           |  63 +--
 compiler/rename/RnSource.hs                        | 181 ++++----
 compiler/rename/RnSplice.hs                        |  50 +-
 compiler/rename/RnSplice.hs-boot                   |  12 +-
 compiler/rename/RnTypes.hs                         | 209 ++++-----
 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                      |  94 ++--
 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                       | 142 +++---
 compiler/typecheck/TcExpr.hs-boot                  |  31 +-
 compiler/typecheck/TcForeign.hs                    |  19 +-
 compiler/typecheck/TcGenDeriv.hs                   | 144 +++---
 compiler/typecheck/TcGenFunctor.hs                 |  99 ++--
 compiler/typecheck/TcGenGenerics.hs                |  32 +-
 compiler/typecheck/TcHsSyn.hs                      | 135 +++---
 compiler/typecheck/TcHsType.hs                     |  92 ++--
 compiler/typecheck/TcInstDcls.hs                   |  70 +--
 compiler/typecheck/TcInstDcls.hs-boot              |   4 +-
 compiler/typecheck/TcMatches.hs                    |  95 ++--
 compiler/typecheck/TcMatches.hs-boot               |  11 +-
 compiler/typecheck/TcPat.hs                        |  53 +--
 compiler/typecheck/TcPatSyn.hs                     |  84 ++--
 compiler/typecheck/TcPatSyn.hs-boot                |  13 +-
 compiler/typecheck/TcRnDriver.hs                   |  59 +--
 compiler/typecheck/TcRnExports.hs                  |  41 +-
 compiler/typecheck/TcRnTypes.hs                    |  72 +--
 compiler/typecheck/TcRules.hs                      |  10 +-
 compiler/typecheck/TcSigs.hs                       |  34 +-
 compiler/typecheck/TcSplice.hs                     |  51 +-
 compiler/typecheck/TcSplice.hs-boot                |  36 +-
 compiler/typecheck/TcTyClsDecls.hs                 | 111 ++---
 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 +-
 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 +-
 testsuite/tests/quasiquotation/T7918.hs            |   6 +-
 utils/ghctags/Main.hs                              |   5 +-
 utils/haddock                                      |   2 +-
 107 files changed, 3778 insertions(+), 3295 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 e511e8e1dc4d74bfab6b9fa7acd327082f459119


More information about the ghc-commits mailing list