driver: Fix recompilation checking for exported defaults and COMPLETE pragmas
9 unresolved threads
A {-# COMPLETE P, Q #-} pragma is associated with the pattern synonyms P
and Q during recompilation checking. Therefore, the existence of a
pattern synonym becomes part of the ABI hash for P and Q.
Then if a module uses these pattern synonyms and a complete pragma
changes, it will trigger recompilation in that module.
Fixes #25854
and
Since the exported defaults are not associated with any identifier from
the module, they are just added to the export hash rather than
the fine-grained recompilation logic.
Fixes #25855
Merge request reports
Activity
Filter activity
mentioned in merge request !14103 (closed)
assigned to @sheaf
1290 1290 1291 1291 -- the export list hash doesn't depend on the fingerprints of 1292 1292 -- the Names it mentions, only the Names themselves, hence putNameLiterally. 1293 1294 -- The export hash is for things which is anything changes, modules which depend on 1295 -- it will be recompiled. - Comment on lines +1294 to +1295
1295 -- The export hash is for things which is anything changes, modules which depend on 1296 -- it will be recompiled. 1295 -- The export hash is for things which require downstream modules to be recompiled 1296 -- whenever they change, e.g.: 1297 -- - a change in the export list (adding a new export might cause a name clash) 1298 -- - a change in exported instances (whether orphans or not)
489 489 490 490 mkIfaceCompleteMatch :: CompleteMatch -> IfaceCompleteMatch 491 491 mkIfaceCompleteMatch (CompleteMatch cls mtc) = 492 IfaceCompleteMatch (uniqDSetToList cls) mtc 492 -- NB: Sorting here means that COMPLETE {P, Q} and COMPLETE {Q, P} are identified 493 -- for recompilation checking. - Comment on lines +492 to +493
1453 1454 -- See Note [Orphans] in GHC.Core.InstEnv 1454 1455 [AnnPayload] -- Annotations of the type itself 1455 1456 [IfaceIdExtras] -- For each constructor: fixity, RULES and annotations 1457 [IfaceCompleteMatch] -- COMPLETE pragmas for the type 1472 1474 1473 1475 | IfaceFamilyExtras (Maybe Fixity) [IfaceInstABI] [AnnPayload] 1474 1476 1477 | IfacePatSynExtras (Maybe Fixity) [IfaceCompleteMatch] 1090 1090 (non_orph_insts, orph_insts) = mkOrphMap ifInstOrph insts 1091 1091 (non_orph_rules, orph_rules) = mkOrphMap ifRuleOrph rules 1092 1092 (non_orph_fis, orph_fis) = mkOrphMap ifFamInstOrph fam_insts 1093 non_complete_matches = mkIfaceCompleteMap complete 1100 1101 -- See also Note [Identity versus semantic module] 1101 1102 declABI decl = (this_mod, decl, extras) 1102 1103 where extras = declExtras fix_fn ann_fn non_orph_rules non_orph_insts 1103 non_orph_fis top_lvl_name_env decl 1104 non_orph_fis top_lvl_name_env non_complete_matches decl 1500 1504 freeNamesDeclExtras :: IfaceDeclExtras -> NameSet 1501 1505 freeNamesDeclExtras (IfaceIdExtras id_extras) 1502 1506 = freeNamesIdExtras id_extras 1503 freeNamesDeclExtras (IfaceDataExtras _ insts _ subs) 1504 = unionNameSets (mkNameSet insts : map freeNamesIdExtras subs) 1507 freeNamesDeclExtras (IfaceDataExtras _ insts _ subs complete) 1508 = unionNameSets (mkNameSet insts : map freeNamesIdExtras subs ++ map freeNamesIfCompleteMatch complete) This is the obvious implementation to write, but I find it quite difficult to think about.
Doesn't this logic amount to saying "the COMPLETE pragma
{-# COMPLETE P, Q, R #-}
depends on P, Q and R, so if P, Q or R change then the COMPLETE pragma needs to be recompiled"? That is not what we want, what we want is "anything that mentions P, Q or R also depends on this COMPLETE pragma".The tests are passing, so what you wrote is probably correct, but I don't understand it.
1716 1733 return $ snd (mi_hash_fn iface occ `orElse` 1717 1734 pprPanic "lookupVers1" (ppr mod <+> ppr occ)) 1718 1735 1736 mkIfaceCompleteMap :: [IfaceCompleteMatch] -> OccEnv [IfaceCompleteMatch] 1737 mkIfaceCompleteMap complete = mkOccEnv_C (++) $ concatMap (\m@(IfaceCompleteMatch syns _) -> [(getOccName syn, [m]) | syn <- syns] ) complete
Please register or sign in to reply