summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2022-11-18 22:54:31 +0000
committerSimon Peyton Jones <simon.peytonjones@gmail.com>2022-11-19 22:12:38 +0000
commit458ba4b2934c82adeefdb75d6922d4563e8f4399 (patch)
tree20ad817fcfca41af08d4f901dcdcd6976761d16a
parente8f2b80da6429af05d5e8ef1a0937aae8c22f819 (diff)
downloadhaskell-wip/T22476.tar.gz
Buglet in GHC.Tc.Module.checkBootTyConwip/T22476
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