@@ -127,17 +127,18 @@ module UnusedOpens =
127127|> List.exists( fun modul ->
128128 symbolUsesInScope
129129|> Array.exists( fun symbolUse ->
130- match symbolUse.Symbolwith
131- | :? FSharpMemberOrFunctionOrValueas f->
132- match f.EnclosingEntitywith
133- | Some entwhen ent.IsNamespace|| ent.IsFSharpModule->
134- Some( ent.IsEffectivelySameAs modul.Entity)
135- | _ -> None
136- | _ -> None
137- |> Option.defaultWith( fun () ->
138- modul.ChildSymbols
139- |> Seq.exists( fun x -> x.IsEffectivelySameAs symbolUse.Symbol)
140- ))))
130+ let usedByEnclosingEntity =
131+ match symbolUse.Symbolwith
132+ | :? FSharpMemberOrFunctionOrValueas f->
133+ match f.EnclosingEntitywith
134+ | Some entwhen ent.IsNamespace|| ent.IsFSharpModule->
135+ Some( ent.IsEffectivelySameAs modul.Entity)
136+ | _ -> None
137+ | _ -> None
138+ match usedByEnclosingEntitywith
139+ | Some x-> x
140+ | None-> modul.ChildSymbols|> Seq.exists( fun x -> x.IsEffectivelySameAs symbolUse.Symbol)
141+ )))
141142|> List.collect( fun mg ->
142143 mg.Modules|> List.map( fun x -> { Module= x.Entity; AppliedScope= openStatement.AppliedScope}))
143144