diff options
| author | Michael Sloan <mgsloan@gmail.com> | 2018-07-12 10:05:41 -0400 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2018-07-12 11:40:18 -0400 |
| commit | 234093cf1562d032b38382a5cc08be8dd71c4fe3 (patch) | |
| tree | 44aef0a8e5dcdfa8a5364a1cf8891e4278fe52e3 /compiler/rename | |
| parent | c4d983412dc8128ac85d3bce0c8e91718af38ed2 (diff) | |
| download | haskell-234093cf1562d032b38382a5cc08be8dd71c4fe3.tar.gz | |
Fix handling of ApplicativeDo in TH AST quotes
See https://ghc.haskell.org/trac/ghc/ticket/14471
Also fixes a parenthesization bug in pprStmt when ret_stripped is True
Test Plan: tests added to testsuite
Trac issues: #14471
Reviewers: goldfire, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4912
Diffstat (limited to 'compiler/rename')
| -rw-r--r-- | compiler/rename/RnExpr.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 937ffaf248..b9e097c4d8 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -26,6 +26,7 @@ import GhcPrelude import RnBinds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS, rnMatchGroup, rnGRHS, makeMiniFixityEnv) import HsSyn +import TcEnv ( isBrackStage ) import TcRnMonad import Module ( getModule ) import RnEnv @@ -731,7 +732,10 @@ postProcessStmtsForApplicativeDo ctxt stmts ado_is_on <- xoptM LangExt.ApplicativeDo ; let is_do_expr | DoExpr <- ctxt = True | otherwise = False - ; if ado_is_on && is_do_expr + -- don't apply the transformation inside TH brackets, because + -- DsMeta does not handle ApplicativeDo. + ; in_th_bracket <- isBrackStage <$> getStage + ; if ado_is_on && is_do_expr && not in_th_bracket then do { traceRn "ppsfa" (ppr stmts) ; rearrangeForApplicativeDo ctxt stmts } else noPostProcessStmts ctxt stmts } |
