[commit: ghc] ghc-8.0: Don't add ticks around type applications (#11329) (d56d11f)

git at git.haskell.org git at git.haskell.org
Mon Jan 25 15:57:48 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/d56d11ffff419875a1fc08e2ff470a5c8bd8785f/ghc

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

commit d56d11ffff419875a1fc08e2ff470a5c8bd8785f
Author: Reid Barton <rwbarton at gmail.com>
Date:   Sat Jan 23 15:30:04 2016 -0500

    Don't add ticks around type applications (#11329)
    
    Test Plan: validate --slow
    
    Reviewers: austin, bgamari, goldfire
    
    Reviewed By: goldfire
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1824
    
    (cherry picked from commit ec8778862aeb9c3f6b861bc732045db9f58b9b61)


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

d56d11ffff419875a1fc08e2ff470a5c8bd8785f
 compiler/deSugar/Coverage.hs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/deSugar/Coverage.hs b/compiler/deSugar/Coverage.hs
index a8281f5..ad232cb 100644
--- a/compiler/deSugar/Coverage.hs
+++ b/compiler/deSugar/Coverage.hs
@@ -515,7 +515,9 @@ addBinTickLHsExpr boxLabel (L pos e0)
 
 
 -- -----------------------------------------------------------------------------
--- Decoarate an HsExpr with ticks
+-- Decorate the body of an HsExpr with ticks.
+-- (Whether to put a tick around the whole expression was already decided,
+-- in the addTickLHsExpr family of functions.)
 
 addTickHsExpr :: HsExpr Id -> TM (HsExpr Id)
 addTickHsExpr e@(HsVar (L _ id)) = do freeVar id; return e
@@ -526,7 +528,13 @@ addTickHsExpr e@(HsOverLabel _)  = return e
 addTickHsExpr e@(HsLit _)        = return e
 addTickHsExpr (HsLam matchgroup) = liftM HsLam (addTickMatchGroup True matchgroup)
 addTickHsExpr (HsLamCase ty mgs) = liftM (HsLamCase ty) (addTickMatchGroup True mgs)
-addTickHsExpr (HsApp e1 e2)      = liftM2 HsApp (addTickLHsExprNever e1) (addTickLHsExpr e2)
+addTickHsExpr (HsApp e1 e2)      = liftM2 HsApp (addTickLHsExprNever e1) e2'
+  -- This might be a type application. Then don't put a tick around e2,
+  -- or dsExpr won't recognize it as a type application any more (#11329).
+  -- It doesn't make sense to put a tick on a type anyways.
+  where e2'
+          | isLHsTypeExpr e2 = return e2
+          | otherwise        = addTickLHsExpr e2
 
 addTickHsExpr (OpApp e1 e2 fix e3) =
         liftM4 OpApp
@@ -658,8 +666,6 @@ addTickHsExpr (ExprWithTySigOut e ty) =
                (addTickLHsExprNever e) -- No need to tick the inner expression
                (return ty)             -- for expressions with signatures
 
-addTickHsExpr e@(HsTypeOut _) = return e
-
 -- Others should never happen in expression content.
 addTickHsExpr e  = pprPanic "addTickHsExpr" (ppr e)
 



More information about the ghc-commits mailing list