summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface/Syntax.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-09-01 19:00:37 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-12 00:32:13 -0400
commit2a9422859e0c079aaa38bb9a760034f887501fce (patch)
tree571a816809930cf86fb302cd524fc050e9f045cc /compiler/GHC/Iface/Syntax.hs
parentfb6e29e8d19deaf7581fdef14adc88a02573c83e (diff)
downloadhaskell-2a9422859e0c079aaa38bb9a760034f887501fce.tar.gz
PmCheck: Disattach COMPLETE pragma lookup from TyCons
By not attaching COMPLETE pragmas with a particular TyCon and instead assume that every COMPLETE pragma is applicable everywhere, we can drastically simplify the logic that tries to initialise available COMPLETE sets of a variable during the pattern-match checking process, as well as fixing a few bugs. Of course, we have to make sure not to report any of the ill-typed/unrelated COMPLETE sets, which came up in a few regression tests. In doing so, we fix #17207, #18277 and #14422. There was a metric decrease in #18478 by ~20%. Metric Decrease: T18478
Diffstat (limited to 'compiler/GHC/Iface/Syntax.hs')
-rw-r--r--compiler/GHC/Iface/Syntax.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index b7d8f62401..3def579fb7 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -324,11 +324,11 @@ data IfaceAnnotation
type IfaceAnnTarget = AnnTarget OccName
-data IfaceCompleteMatch = IfaceCompleteMatch [IfExtName] IfExtName
+newtype IfaceCompleteMatch = IfaceCompleteMatch [IfExtName]
instance Outputable IfaceCompleteMatch where
- ppr (IfaceCompleteMatch cls ty) = text "COMPLETE" <> colon <+> ppr cls
- <+> dcolon <+> ppr ty
+ ppr (IfaceCompleteMatch cls) = text "COMPLETE" <> colon <+> ppr cls
+
@@ -2481,8 +2481,8 @@ instance Binary IfaceTyConParent where
return $ IfDataInstance ax pr ty
instance Binary IfaceCompleteMatch where
- put_ bh (IfaceCompleteMatch cs ts) = put_ bh cs >> put_ bh ts
- get bh = IfaceCompleteMatch <$> get bh <*> get bh
+ put_ bh (IfaceCompleteMatch cs) = put_ bh cs
+ get bh = IfaceCompleteMatch <$> get bh
{-
@@ -2638,7 +2638,7 @@ instance NFData IfaceConAlt where
IfaceLitAlt lit -> lit `seq` ()
instance NFData IfaceCompleteMatch where
- rnf (IfaceCompleteMatch f1 f2) = rnf f1 `seq` rnf f2
+ rnf (IfaceCompleteMatch f1) = rnf f1
instance NFData IfaceRule where
rnf (IfaceRule f1 f2 f3 f4 f5 f6 f7 f8) =