From be7f10bb9486462247edb6aae9a3e5f46cfe4908 Mon Sep 17 00:00:00 2001 From: Edsko de Vries <edsko@well-typed.com> Date: Tue, 3 Sep 2013 12:51:10 +0100 Subject: [PATCH] Fix #7918 --- 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 0ef169085bd..23501e3e1aa 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 90a83d6a8e4..e7cecf8f3f8 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 a1c4bac25c8..c13ea336e4d 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) -- GitLab