summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-05-09 15:19:45 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-11 05:36:02 -0400
commit32367cac4e586fb5aedaa021b257388392d976c4 (patch)
tree059b555f27488b9d80bcd2fb566bc1d8969f7579 /utils
parent087ac4ebee39bacd90529cab0e88af85a903448b (diff)
downloadhaskell-32367cac4e586fb5aedaa021b257388392d976c4.tar.gz
EPA: Use custom AnnsIf structure for HsIf and HsCmdIf
This clearly identifies the presence and location of optional semicolons in an if statement. Closes #19813
Diffstat (limited to 'utils')
-rw-r--r--utils/check-exact/ExactPrint.hs18
-rw-r--r--utils/check-exact/Main.hs3
2 files changed, 17 insertions, 4 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 3680405a0a..5047346111 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -1907,11 +1907,13 @@ instance ExactPrint (HsExpr GhcPs) where
-- exact x@(HsCase EpAnnNotUsed _ _) = withPpr x
exact (HsIf an e1 e2 e3) = do
- markEpAnn an AnnIf
+ markAnnKw an aiIf AnnIf
markAnnotated e1
- markEpAnn an AnnThen
+ markAnnKwM an aiThenSemi AnnSemi
+ markAnnKw an aiThen AnnThen
markAnnotated e2
- markEpAnn an AnnElse
+ markAnnKwM an aiElseSemi AnnSemi
+ markAnnKw an aiElse AnnElse
markAnnotated e3
exact (HsMultiIf an mg) = do
@@ -2399,6 +2401,16 @@ instance ExactPrint (HsCmd GhcPs) where
-- mark GHC.AnnElse
-- markLocated e3
+ exact (HsCmdIf an _ e1 e2 e3) = do
+ markAnnKw an aiIf AnnIf
+ markAnnotated e1
+ markAnnKwM an aiThenSemi AnnSemi
+ markAnnKw an aiThen AnnThen
+ markAnnotated e2
+ markAnnKwM an aiElseSemi AnnSemi
+ markAnnKw an aiElse AnnElse
+ markAnnotated e3
+
-- markAST _ (GHC.HsCmdLet _ (GHC.L _ binds) e) = do
-- mark GHC.AnnLet
-- markOptional GHC.AnnOpenC
diff --git a/utils/check-exact/Main.hs b/utils/check-exact/Main.hs
index 27a24f1804..8a2622edcd 100644
--- a/utils/check-exact/Main.hs
+++ b/utils/check-exact/Main.hs
@@ -173,7 +173,7 @@ _tt = testOneFile changers "/home/alanz/mysrc/git.haskell.org/worktree/exactprin
-- "../../testsuite/tests/printer/Test16236.hs" Nothing
-- "../../testsuite/tests/printer/Test17519.hs" Nothing
-- "../../testsuite/tests/printer/InTreeAnnotations1.hs" Nothing
- "../../testsuite/tests/printer/Test19798.hs" Nothing
+ -- "../../testsuite/tests/printer/Test19798.hs" Nothing
-- "../../testsuite/tests/qualifieddo/should_compile/qdocompile001.hs" Nothing
-- "../../testsuite/tests/typecheck/should_fail/StrictBinds.hs" Nothing
@@ -185,6 +185,7 @@ _tt = testOneFile changers "/home/alanz/mysrc/git.haskell.org/worktree/exactprin
-- "../../testsuite/tests/ghc-api/exactprint/WhereIn3a.hs" Nothing
-- "../../testsuite/tests/ghc-api/exactprint/Windows.hs" Nothing
-- "../../testsuite/tests/printer/Test19784.hs" Nothing
+ "../../testsuite/tests/printer/Test19813.hs" Nothing
-- cloneT does not need a test, function can be retired