Skip to content

Commit 8705ba6

Browse files
committed
Fix bug
1 parent 0c80bf1 commit 8705ba6

File tree

2 files changed

+136
-9
lines changed

2 files changed

+136
-9
lines changed

src/analysis/outline.ml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,18 @@ and get_mod_children ~include_types node =
179179

180180
and remove_mod_indir ~include_types node =
181181
match node.t_node with
182-
| Module_expr _ | Module_type _ ->
183-
List.concat_map
184-
(Lazy.force node.t_children)
185-
~f:(remove_mod_indir ~include_types)
182+
| Module_expr _ | Module_type _ -> get_mod_children ~include_types node
186183
| _ -> remove_top_indir ~include_types node
187184

188185
and remove_top_indir ~include_types t =
189186
match t.t_node with
190-
| Structure _ | Signature _ ->
191-
List.concat_map
192-
~f:(remove_top_indir ~include_types)
193-
(Lazy.force t.t_children)
187+
| Structure _ | Signature _ -> get_mod_children ~include_types t
194188
| Signature_item _ | Structure_item _ ->
195-
List.filter_map (Lazy.force t.t_children) ~f:(summarize ~include_types)
189+
List.concat_map (Lazy.force t.t_children) ~f:(fun child ->
190+
match child.t_node with
191+
| Include_declaration _ | Include_description _ ->
192+
get_mod_children ~include_types child
193+
| _ -> summarize ~include_types child |> Option.to_list)
196194
| _ -> []
197195

198196
let get ~include_types browses =

tests/test-dirs/outline.t/run.t

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,127 @@
1515
"name": "S",
1616
"kind": "Signature",
1717
"type": null,
18+
"children": [
19+
{
20+
"start": {
21+
"line": 45,
22+
"col": 6
23+
},
24+
"end": {
25+
"line": 45,
26+
"col": 20
27+
},
28+
"name": "y",
29+
"kind": "Value",
30+
"type": "string",
31+
"children": [],
32+
"deprecated": false
33+
},
34+
{
35+
"start": {
36+
"line": 44,
37+
"col": 6
38+
},
39+
"end": {
40+
"line": 44,
41+
"col": 12
42+
},
43+
"name": "u",
44+
"kind": "Type",
45+
"type": null,
46+
"children": [],
47+
"deprecated": false
48+
},
49+
{
50+
"start": {
51+
"line": 42,
52+
"col": 4
53+
},
54+
"end": {
55+
"line": 42,
56+
"col": 15
57+
},
58+
"name": "x",
59+
"kind": "Value",
60+
"type": "int",
61+
"children": [],
62+
"deprecated": false
63+
},
64+
{
65+
"start": {
66+
"line": 41,
67+
"col": 4
68+
},
69+
"end": {
70+
"line": 41,
71+
"col": 10
72+
},
73+
"name": "t",
74+
"kind": "Type",
75+
"type": null,
76+
"children": [],
77+
"deprecated": false
78+
}
79+
],
80+
"deprecated": false
81+
},
82+
{
83+
"start": {
84+
"line": 35,
85+
"col": 4
86+
},
87+
"end": {
88+
"line": 35,
89+
"col": 15
90+
},
91+
"name": "y",
92+
"kind": "Value",
93+
"type": "string",
94+
"children": [],
95+
"deprecated": false
96+
},
97+
{
98+
"start": {
99+
"line": 34,
100+
"col": 4
101+
},
102+
"end": {
103+
"line": 34,
104+
"col": 10
105+
},
106+
"name": "u",
107+
"kind": "Type",
108+
"type": null,
109+
"children": [],
110+
"deprecated": false
111+
},
112+
{
113+
"start": {
114+
"line": 32,
115+
"col": 2
116+
},
117+
"end": {
118+
"line": 32,
119+
"col": 11
120+
},
121+
"name": "x",
122+
"kind": "Value",
123+
"type": "int",
124+
"children": [],
125+
"deprecated": false
126+
},
127+
{
128+
"start": {
129+
"line": 31,
130+
"col": 2
131+
},
132+
"end": {
133+
"line": 31,
134+
"col": 8
135+
},
136+
"name": "t",
137+
"kind": "Type",
138+
"type": null,
18139
"children": [],
19140
"deprecated": false
20141
},
@@ -277,3 +398,11 @@ Check that when we pass "-include-types false", every "type" is null.
277398
null
278399
null
279400
null
401+
null
402+
null
403+
null
404+
null
405+
null
406+
null
407+
null
408+
null

0 commit comments

Comments
 (0)