[commit: ghc] master: Fix #7918 (be7f10b)

git at git.haskell.org git at git.haskell.org
Tue Sep 3 15:31:04 CEST 2013


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

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

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

commit be7f10bb9486462247edb6aae9a3e5f46cfe4908
Author: Edsko de Vries <edsko at well-typed.com>
Date:   Tue Sep 3 12:51:10 2013 +0100

    Fix #7918


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

be7f10bb9486462247edb6aae9a3e5f46cfe4908
 compiler/rename/RnExpr.lhs  |    6 ++++--
 compiler/rename/RnPat.lhs   |    5 +++--
 compiler/rename/RnTypes.lhs |    4 +++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs
index 0ef1690..23501e3 100644
--- a/compiler/rename/RnExpr.lhs
+++ b/compiler/rename/RnExpr.lhs
@@ -189,8 +189,10 @@ rnExpr (HsSpliceE splice)
 rnExpr e@(HsQuasiQuoteE _) = pprPanic "Cant do quasiquotation without GHCi" (ppr e)
 #else
 rnExpr (HsQuasiQuoteE qq)
-  = runQuasiQuoteExpr qq        `thenM` \ (L _ expr') ->
-    rnExpr expr'
+  = runQuasiQuoteExpr qq        `thenM` \ lexpr' ->
+    -- Wrap the result of the quasi-quoter in parens so that we don't
+    -- lose the outermost location set by runQuasiQuote (#7918) 
+    rnExpr (HsPar lexpr')
 #endif  /* GHCI */
 
 ---------------------------------------------
diff --git a/compiler/rename/RnPat.lhs b/compiler/rename/RnPat.lhs
index 90a83d6..e7cecf8 100644
--- a/compiler/rename/RnPat.lhs
+++ b/compiler/rename/RnPat.lhs
@@ -416,8 +416,9 @@ rnPatAndThen _ p@(QuasiQuotePat {})
 #else
 rnPatAndThen mk (QuasiQuotePat qq)
   = do { pat <- liftCps $ runQuasiQuotePat qq
-       ; L _ pat' <- rnLPatAndThen mk pat
-       ; return pat' }
+         -- Wrap the result of the quasi-quoter in parens so that we don't
+         -- lose the outermost location set by runQuasiQuote (#7918) 
+       ; rnPatAndThen mk (ParPat pat) }
 #endif  /* GHCI */
 
 rnPatAndThen _ pat = pprPanic "rnLPatAndThen" (ppr pat)
diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs
index a1c4bac..c13ea33 100644
--- a/compiler/rename/RnTypes.lhs
+++ b/compiler/rename/RnTypes.lhs
@@ -269,7 +269,9 @@ rnHsTyKi _ _ ty@(HsQuasiQuoteTy _) = pprPanic "Can't do quasiquotation without G
 rnHsTyKi isType doc (HsQuasiQuoteTy qq)
   = ASSERT( isType )
     do { ty <- runQuasiQuoteType qq
-       ; rnHsType doc (unLoc ty) }
+         -- Wrap the result of the quasi-quoter in parens so that we don't
+         -- lose the outermost location set by runQuasiQuote (#7918) 
+       ; rnHsType doc (HsParTy ty) }
 #endif
 
 rnHsTyKi isType _ (HsCoreTy ty)





More information about the ghc-commits mailing list