summaryrefslogtreecommitdiff
path: root/utils/check-exact/ExactPrint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils/check-exact/ExactPrint.hs')
-rw-r--r--utils/check-exact/ExactPrint.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index df7fdfda1e..a3332f5f19 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -63,6 +63,7 @@ import Data.Functor.Const
import qualified Data.Set as Set
import Data.Typeable
import Data.List ( partition, sort, sortBy)
+import qualified Data.List.NonEmpty as NE
import Data.Maybe ( isJust, mapMaybe )
import Data.Void
@@ -4548,6 +4549,7 @@ instance ExactPrint (Pat GhcPs) where
getAnnotationEntry (NPat an _ _ _) = fromAnn an
getAnnotationEntry (NPlusKPat an _ _ _ _ _) = fromAnn an
getAnnotationEntry (SigPat an _ _) = fromAnn an
+ getAnnotationEntry (OrPat an _) = fromAnn an
setAnnotationAnchor a@(WildPat _) _ _s = a
setAnnotationAnchor a@(VarPat _ _) _ _s = a
@@ -4565,6 +4567,7 @@ instance ExactPrint (Pat GhcPs) where
setAnnotationAnchor (NPat an a b c) anc cs = (NPat (setAnchorEpa an anc cs) a b c)
setAnnotationAnchor (NPlusKPat an a b c d e) anc cs = (NPlusKPat (setAnchorEpa an anc cs) a b c d e)
setAnnotationAnchor (SigPat an a b) anc cs = (SigPat (setAnchorEpa an anc cs) a b)
+ setAnnotationAnchor (OrPat an a) anc cs = (OrPat (setAnchorEpa an anc cs) a)
exact (WildPat w) = do
anchor <- getAnchorU
@@ -4654,6 +4657,12 @@ instance ExactPrint (Pat GhcPs) where
sig' <- markAnnotated sig
return (SigPat an0 pat' sig')
+ exact (OrPat an pats) = do
+ an0 <- markEpAnnL an lidl AnnOne
+ an1 <- markEpAnnL an0 lidl AnnOf
+ pats' <- markAnnotated (NE.toList pats)
+ return (OrPat an1 (NE.fromList pats'))
+
-- ---------------------------------------------------------------------
instance ExactPrint (HsPatSigType GhcPs) where