[m-rev.] diff: Include supertypes in unused modules computation.
Peter Wang
novalazy at gmail.com
Tue Apr 13 11:40:16 AEST 2021
compiler/unused_imports.m:
Take types that occur in the supertype part of a subtype definition
into account when computing used modules.
diff --git a/compiler/unused_imports.m b/compiler/unused_imports.m
index 480298924..d857bf497 100644
--- a/compiler/unused_imports.m
+++ b/compiler/unused_imports.m
@@ -437,9 +437,15 @@ type_used_modules(_TypeCtor, TypeDefn, !UsedModules) :-
DefinedInThisModule = yes,
Visibility = type_visibility(TypeStatus),
(
- TypeBody = hlds_du_type(Ctors, _, _, _, _),
+ TypeBody = hlds_du_type(Ctors, MaybeSuperType, _, _, _),
list.foldl(ctor_used_modules(Visibility),
- one_or_more_to_list(Ctors), !UsedModules)
+ one_or_more_to_list(Ctors), !UsedModules),
+ (
+ MaybeSuperType = yes(SuperType),
+ mer_type_used_modules(Visibility, SuperType, !UsedModules)
+ ;
+ MaybeSuperType = no
+ )
;
TypeBody = hlds_eqv_type(EqvType),
mer_type_used_modules(Visibility, EqvType, !UsedModules)
--
2.30.0
More information about the reviews
mailing list