[commit: ghc] master: fix -ddump-splices to parenthesize ((\x -> x) a) correctly (5cb236d)

git at git.haskell.org git at git.haskell.org
Sat Jan 9 18:27:03 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5cb236dd6b497da0b9072b20ca74c298477f7a61/ghc

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

commit 5cb236dd6b497da0b9072b20ca74c298477f7a61
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


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

5cb236dd6b497da0b9072b20ca74c298477f7a61
 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 398958d..251fa19 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -712,8 +712,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 1124360..8b38e3f 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