summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface/Make.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/Make.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/Make.hs')
-rw-r--r--compiler/GHC/Iface/Make.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs
index 3fd0eaac29..941aa4083c 100644
--- a/compiler/GHC/Iface/Make.hs
+++ b/compiler/GHC/Iface/Make.hs
@@ -57,6 +57,7 @@ import GHC.Types.Avail
import GHC.Types.Name.Reader
import GHC.Types.Name.Env
import GHC.Types.Name.Set
+import GHC.Types.Unique.DSet
import GHC.Unit
import GHC.Utils.Error
import GHC.Utils.Outputable
@@ -220,7 +221,7 @@ mkIface_ hsc_env
md_anns = anns,
md_types = type_env,
md_exports = exports,
- md_complete_sigs = complete_sigs }
+ md_complete_matches = complete_matches }
-- NB: notice that mkIface does not look at the bindings
-- only at the TypeEnv. The previous Tidy phase has
-- put exactly the info into the TypeEnv that we want
@@ -256,7 +257,7 @@ mkIface_ hsc_env
iface_fam_insts = map famInstToIfaceFamInst fam_insts
trust_info = setSafeMode safe_mode
annotations = map mkIfaceAnnotation anns
- icomplete_sigs = map mkIfaceCompleteSig complete_sigs
+ icomplete_matches = map mkIfaceCompleteMatch complete_matches
ModIface {
mi_module = this_mod,
@@ -285,7 +286,7 @@ mkIface_ hsc_env
mi_hpc = isHpcUsed hpc_info,
mi_trust = trust_info,
mi_trust_pkg = pkg_trust_req,
- mi_complete_sigs = icomplete_sigs,
+ mi_complete_matches = icomplete_matches,
mi_doc_hdr = doc_hdr,
mi_decl_docs = decl_docs,
mi_arg_docs = arg_docs,
@@ -322,8 +323,9 @@ mkIface_ hsc_env
************************************************************************
-}
-mkIfaceCompleteSig :: CompleteMatch -> IfaceCompleteMatch
-mkIfaceCompleteSig (CompleteMatch cls tc) = IfaceCompleteMatch cls tc
+mkIfaceCompleteMatch :: CompleteMatch -> IfaceCompleteMatch
+mkIfaceCompleteMatch cls =
+ IfaceCompleteMatch (map conLikeName (uniqDSetToList cls))
{-