Skip to content

Commit b18b749

Browse files
committed
Do not report empty modules when transitive reporting is off.
As the only way for a module to be dead would be for it to be empty.
1 parent 3a24e65 commit b18b749

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

analysis/reanalyze/src/DeadCommon.ml

+8-6
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ let emitWarning ~decl ~message deadWarning =
406406
WriteDeadAnnotations.addLineAnnotation ~decl
407407
else None
408408
in
409-
decl.path
410-
|> Path.toModuleName ~isType:(decl.declKind |> DeclKind.isType)
411-
|> DeadModules.checkModuleDead ~fileName:decl.pos.pos_fname;
409+
if Config.reportTransitive then
410+
decl.path
411+
|> Path.toModuleName ~isType:(decl.declKind |> DeclKind.isType)
412+
|> DeadModules.checkModuleDead ~fileName:decl.pos.pos_fname;
412413
Log_.warning ~loc
413414
(DeadWarning
414415
{
@@ -555,9 +556,10 @@ module Decl = struct
555556
&& (Config.reportTransitive || not (hasRefBelow ()))
556557
in
557558
if shouldEmitWarning then (
558-
decl.path
559-
|> Path.toModuleName ~isType:(decl.declKind |> DeclKind.isType)
560-
|> DeadModules.checkModuleDead ~fileName:decl.pos.pos_fname;
559+
if Config.reportTransitive then
560+
decl.path
561+
|> Path.toModuleName ~isType:(decl.declKind |> DeclKind.isType)
562+
|> DeadModules.checkModuleDead ~fileName:decl.pos.pos_fname;
561563
emitWarning ~decl ~message name)
562564
end
563565

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
DCE src/Dce.res
2-
issues:2
2+
issues:0
33

0 commit comments

Comments
 (0)