Alan Zimmerman pushed to branch wip/az/epa-fix-transform-anchoreof at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • utils/check-exact/Main.hs
    ... ... @@ -646,7 +646,7 @@ addLocaLDecl3 :: Changer
    646 646
     addLocaLDecl3 libdir top = do
    
    647 647
       Right newDecl <- withDynFlags libdir (\df -> parseDecl df "decl" "nn = 2")
    
    648 648
       let
    
    649
    -      doAddLocal = replaceDecls (anchorEof lp) [parent',d2']
    
    649
    +      doAddLocal = replaceDecls (addModuleCommentOrigDeltas lp) [parent',d2']
    
    650 650
             where
    
    651 651
              lp = top
    
    652 652
              (de1:d2:_) = hsDecls lp
    
    ... ... @@ -667,7 +667,7 @@ addLocaLDecl4 libdir lp = do
    667 667
       Right newDecl <- withDynFlags libdir (\df -> parseDecl df "decl" "nn = 2")
    
    668 668
       Right newSig  <- withDynFlags libdir (\df -> parseDecl df "sig"  "nn :: Int")
    
    669 669
       let
    
    670
    -      doAddLocal = replaceDecls (anchorEof lp) (parent':ds)
    
    670
    +      doAddLocal = replaceDecls (addModuleCommentOrigDeltas lp) (parent':ds)
    
    671 671
             where
    
    672 672
               (parent:ds) = hsDecls (makeDeltaAst lp)
    
    673 673
     
    
    ... ... @@ -781,7 +781,7 @@ rmDecl3 _libdir lp = do
    781 781
     rmDecl4 :: Changer
    
    782 782
     rmDecl4 _libdir lp = do
    
    783 783
       let
    
    784
    -      doRmDecl = replaceDecls (anchorEof lp) [de1',sd1]
    
    784
    +      doRmDecl = replaceDecls (addModuleCommentOrigDeltas lp) [de1',sd1]
    
    785 785
             where
    
    786 786
              [de1] = hsDecls lp
    
    787 787
              (de1',Just sd1) = modifyValD (getLocA de1) de1 $ \_m [sd1a,sd2] ->
    

  • utils/check-exact/Transform.hs
    ... ... @@ -65,7 +65,7 @@ module Transform
    65 65
             , balanceComments
    
    66 66
             , balanceCommentsList
    
    67 67
             , balanceCommentsListA
    
    68
    -        , anchorEof
    
    68
    +        , addModuleCommentOrigDeltas
    
    69 69
     
    
    70 70
             -- ** Managing lists, pure functions
    
    71 71
             , captureOrderBinds
    
    ... ... @@ -724,8 +724,8 @@ balanceSameLineComments (L la (Match anm mctxt pats (GRHSs x grhss lb)))
    724 724
     
    
    725 725
     -- ---------------------------------------------------------------------
    
    726 726
     
    
    727
    -anchorEof :: ParsedSource -> ParsedSource
    
    728
    -anchorEof (L l m@(HsModule (XModulePs an _lo _ _) _mn _exps _imps _decls)) = L l (m { hsmodExt = (hsmodExt m){ hsmodAnn = an' } })
    
    727
    +addModuleCommentOrigDeltas :: ParsedSource -> ParsedSource
    
    728
    +addModuleCommentOrigDeltas (L l m@(HsModule (XModulePs an _lo _ _) _mn _exps _imps _decls)) = L l (m { hsmodExt = (hsmodExt m){ hsmodAnn = an' } })
    
    729 729
       where
    
    730 730
         an' = addCommentOrigDeltasAnn an
    
    731 731