File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 12
12
13
13
# 12.0.0-alpha.14 (Unreleased)
14
14
15
+ #### :bug : Bug fix
16
+
17
+ - ` rescript-tools doc ` no longer includes shadowed bindings in its output. https://github.com/rescript-lang/rescript/pull/7497
18
+
15
19
# 12.0.0-alpha.13
16
20
17
21
#### :boom : Breaking Change
Original file line number Diff line number Diff line change 1
1
open Analysis
2
2
3
+ module StringSet = Set. Make (String )
4
+
3
5
type fieldDoc = {
4
6
fieldName : string ;
5
7
docstrings : string list ;
@@ -458,6 +460,7 @@ let extractDocs ~entryPointFile ~debug =
458
460
let env = QueryEnv. fromFile file in
459
461
let rec extractDocsForModule ?(modulePath = [env.file.moduleName])
460
462
(structure : Module.structure ) =
463
+ let valuesSeen = ref StringSet. empty in
461
464
{
462
465
id = modulePath |> List. rev |> ident;
463
466
docstring = structure.docstring |> List. map String. trim;
@@ -611,7 +614,18 @@ let extractDocs ~entryPointFile ~debug =
611
614
(makeId ~identifier: (Path. name p)
612
615
moduleTypeIdPath);
613
616
})
614
- | _ -> None );
617
+ | _ -> None )
618
+ (* Filter out shadowed bindings by keeping only the last value associated with an id *)
619
+ |> List. rev
620
+ |> List. filter_map (fun (docItem : docItem ) ->
621
+ match docItem with
622
+ | Value {id} ->
623
+ if StringSet. mem id ! valuesSeen then None
624
+ else (
625
+ valuesSeen := StringSet. add id ! valuesSeen;
626
+ Some docItem)
627
+ | _ -> Some docItem)
628
+ |> List. rev;
615
629
}
616
630
in
617
631
let docs = extractDocsForModule structure in
You can’t perform that action at this time.
0 commit comments