pretty-printer: Properly parenthesise LastStmt
After ApplicatveDo strips the last `return` during renaming, the pretty printer has to restore it. However, if the return was followed by `$`, the dollar was stripped too and not restored. For example, the last stamement in: ``` foo = do x <- ... ... return $ f x ``` would be printed as: ``` return f x ``` This commit preserved the dolar, so it becomes: ``` return $ f x ```
Showing
- compiler/GHC/Hs/Expr.hs 11 additions, 5 deletionscompiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Utils.hs 1 addition, 1 deletioncompiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/ListComp.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/Rename/Expr.hs 8 additions, 7 deletionscompiler/GHC/Rename/Expr.hs
- testsuite/tests/ado/ado009.hs 10 additions, 0 deletionstestsuite/tests/ado/ado009.hs
- testsuite/tests/ado/ado009.stderr 8 additions, 0 deletionstestsuite/tests/ado/ado009.stderr
- testsuite/tests/ado/all.T 1 addition, 0 deletionstestsuite/tests/ado/all.T
Loading
Please register or sign in to comment