[commit: ghc] ghc-8.0: fix -ddump-splices to parenthesize ((\x -> x) a) correctly (707b2be)

git at git.haskell.org git at git.haskell.org
Sat Jan 9 18:26:57 UTC 2016


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

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

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

commit 707b2be97539b83efb91cd9f17f94c91397ad2b4
Author: Yuri de Wit <admin at rodlogic.net>
Date:   Sat Jan 9 18:58:30 2016 +0100

    fix -ddump-splices to parenthesize ((\x -> x) a) correctly
    
    Test Plan: ./validate
    
    Reviewers: goldfire, austin, bgamari
    
    Subscribers: goldfire, osa1, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1114
    
    GHC Trac Issues: #10603
    
    (cherry picked from commit a3ff934f5225d7a98b73f3c067b5feda44f28ad1)


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

707b2be97539b83efb91cd9f17f94c91397ad2b4
 compiler/hsSyn/Convert.hs        | 6 ++++--
 testsuite/tests/th/T10603.stderr | 6 ++----
 testsuite/tests/th/all.T         | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs
index 9e96e89..0b9295f 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -717,8 +717,10 @@ cvtl e = wrapL (cvt e)
     cvt (LitE l)
       | overloadedLit l = do { l' <- cvtOverLit l; return $ HsOverLit l' }
       | otherwise       = do { l' <- cvtLit l;     return $ HsLit l' }
-
-    cvt (AppE x y)     = do { x' <- cvtl x; y' <- cvtl y; return $ HsApp x' y' }
+    cvt (AppE x@(LamE _ _) y) = do { x' <- cvtl x; y' <- cvtl y
+                              ; return $ HsApp (mkLHsPar x') y' }
+    cvt (AppE x y)            = do { x' <- cvtl x; y' <- cvtl y
+                              ; return $ HsApp x' y' }
     cvt (LamE ps e)    = do { ps' <- cvtPats ps; e' <- cvtl e
                             ; return $ HsLam (mkMatchGroup FromSource [mkSimpleMatch ps' e']) }
     cvt (LamCaseE ms)  = do { ms' <- mapM cvtMatch ms
diff --git a/testsuite/tests/th/T10603.stderr b/testsuite/tests/th/T10603.stderr
index 47f2a7a..c294e74 100644
--- a/testsuite/tests/th/T10603.stderr
+++ b/testsuite/tests/th/T10603.stderr
@@ -1,6 +1,4 @@
 T10603.hs:5:18-68: Splicing expression
-    [| case Just 'a' of {
-         Just a_atn -> Just ((\ x_ato -> x_ato) a_atn) } |]
+    [| case Just 'a' of { Just a -> Just ((\ x -> x) a) } |]
   ======>
-    case Just 'a' of {
-      Just a_a4uM -> Just ((\ x_a4uN -> x_a4uN) a_a4uM) }
+    case Just 'a' of { Just a -> Just ((\ x -> x) a) }
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 39a0aa9..88b6a12 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -397,4 +397,4 @@ test('T11341', normal, compile, ['-v0 -dsuppress-uniques'])
 test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques'])
 
 test('TH_finalizer', normal, compile, ['-v0'])
-test('T10603', expect_broken(10603), compile, ['-ddump-splices'])
\ No newline at end of file
+test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques'])



More information about the ghc-commits mailing list