summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2022-11-18 22:54:31 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-20 18:40:05 -0500
commitef511b235f10101f9923e3f098eeeb6a03a734d8 (patch)
tree9dffb338f7f6c859e06aabb003c4e74db4d21fc5
parentf2f9ef07f1491b72e96b5d1ba88284dee37a1d8f (diff)
downloadhaskell-ef511b235f10101f9923e3f098eeeb6a03a734d8.tar.gz
Buglet in GHC.Tc.Module.checkBootTyCon
This lurking bug used the wrong function to compare two types in GHC.Tc.Module.checkBootTyCon It's hard to trigger the bug, which only came up during !9343, so there's no regression test in this MR.
-rw-r--r--compiler/GHC/Tc/Module.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index beb4c64557..76c5f0fb66 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -1096,6 +1096,7 @@ checkBootTyCon is_boot tc1 tc2
-- Order of pattern matching matters.
subDM _ Nothing _ = True
subDM _ _ Nothing = False
+
-- If the hsig wrote:
--
-- f :: a -> a
@@ -1103,11 +1104,14 @@ checkBootTyCon is_boot tc1 tc2
--
-- this should be validly implementable using an old-fashioned
-- vanilla default method.
- subDM t1 (Just (_, GenericDM t2)) (Just (_, VanillaDM))
- = eqTypeX env t1 t2
+ subDM t1 (Just (_, GenericDM gdm_t1)) (Just (_, VanillaDM))
+ = eqType t1 gdm_t1 -- Take care (#22476). Both t1 and gdm_t1 come
+ -- from tc1, so use eqType, and /not/ eqTypeX
+
-- This case can occur when merging signatures
subDM t1 (Just (_, VanillaDM)) (Just (_, GenericDM t2))
= eqTypeX env t1 t2
+
subDM _ (Just (_, VanillaDM)) (Just (_, VanillaDM)) = True
subDM _ (Just (_, GenericDM t1)) (Just (_, GenericDM t2))
= eqTypeX env t1 t2