From 458ba4b2934c82adeefdb75d6922d4563e8f4399 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Fri, 18 Nov 2022 22:54:31 +0000 Subject: 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. --- compiler/GHC/Tc/Module.hs | 8 ++++++-- 1 file 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 -- cgit v1.2.1