[commit: ghc] master: Fix parenthesisation in conversion from TH.Exp to HsExpr.HsExpr (3f5c0ad)

Simon Peyton Jones simonpj at microsoft.com
Thu Sep 29 18:23:21 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3f5c0ad5d33096f4a8cd33217c3be7c32a7943b3

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

commit 3f5c0ad5d33096f4a8cd33217c3be7c32a7943b3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Sep 29 16:57:16 2011 +0100

    Fix parenthesisation in conversion from TH.Exp to HsExpr.HsExpr
    
    We need to generate enough parens so that -ddump-splices is
    correct Haskell.  There is certainly further to go.

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

 compiler/hsSyn/Convert.lhs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index ff9aa85..b1fd047 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -504,7 +504,11 @@ cvtl e = wrapL (cvt e)
                                        -- Can I indicate this is an infix thing?
                                        -- Note [Dropping constructors]
 
-    cvt (UInfixE x s y)  = do { x' <- cvtl x; cvtOpApp x' s y } --  Note [Converting UInfix]
+    cvt (UInfixE x s y)  = do { x' <- cvtl x
+                              ; let x'' = case x' of 
+                                            L _ (OpApp {}) -> x'
+                                            _ -> mkLHsPar x'
+                              ; cvtOpApp x'' s y } --  Note [Converting UInfix]
 
     cvt (ParensE e)      = do { e' <- cvtl e; return $ HsPar e' }
     cvt (SigE e t)	 = do { e' <- cvtl e; t' <- cvtType t





More information about the Cvs-ghc mailing list