diff options
author | Cale Gibbard <cgibbard@gmail.com> | 2021-02-22 15:56:22 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-04 23:17:00 -0500 |
commit | 4cdf8b5ef923e4b860b2d7e61d034817cb81ddbc (patch) | |
tree | 46977b11ae67513e46db96b49cf0e30face75963 /compiler/GHC/Iface/Make.hs | |
parent | 1a52c53bb7bc5ef91e251306cf056fcee6a4e15c (diff) | |
download | haskell-4cdf8b5ef923e4b860b2d7e61d034817cb81ddbc.tar.gz |
Bring back COMPLETE sets filtered by result TyCon (#14422)
Commit 2a94228 dramatically simplified the implementation and improved
the performance of COMPLETE sets while making them applicable in more
scenarios at the same time.
But it turned out that there was a change in semantics that (to me
unexpectedly) broke users' expectations (see #14422): They relied on the
"type signature" of a COMPLETE pragma to restrict the scrutinee types of
a pattern match for which they are applicable.
This patch brings back that filtering, so the semantics is the same as
it was in GHC 9.0.
See the updated Note [Implementation of COMPLETE pragmas].
There are a few testsuite output changes (`completesig13`, `T14422`)
which assert this change.
Co-authored-by: Sebastian Graf <sebastian.graf@kit.edu>
Diffstat (limited to 'compiler/GHC/Iface/Make.hs')
-rw-r--r-- | compiler/GHC/Iface/Make.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs index 1c43e3e6e6..53f0032f28 100644 --- a/compiler/GHC/Iface/Make.hs +++ b/compiler/GHC/Iface/Make.hs @@ -73,6 +73,7 @@ import GHC.Types.TypeEnv import GHC.Types.SourceFile import GHC.Types.TyThing import GHC.Types.HpcInfo +import GHC.Types.CompleteMatch import GHC.Utils.Outputable import GHC.Utils.Panic @@ -347,8 +348,8 @@ mkIface_ hsc_env -} mkIfaceCompleteMatch :: CompleteMatch -> IfaceCompleteMatch -mkIfaceCompleteMatch cls = - IfaceCompleteMatch (map conLikeName (uniqDSetToList cls)) +mkIfaceCompleteMatch (CompleteMatch cls mtc) = + IfaceCompleteMatch (map conLikeName (uniqDSetToList cls)) (toIfaceTyCon <$> mtc) {- |