Skip to content

Commit 386daa9

Browse files
committed
Add a test reproducing the issue #1983.
1 parent d6fd03b commit 386daa9

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
The "document" command sometimes concatenates documentation for consecutive entries of variants or records.
2+
3+
$ document_pos () {
4+
> pos="$1"
5+
> ocamlmerlin single document -position "$pos" < test.ml | jq .value -r
6+
> }
7+
8+
$ cat > test.ml <<EOF
9+
> type variant =
10+
> | A (** A *)
11+
> | B (** B *)
12+
> | C (** C *)
13+
>
14+
> type record =
15+
> { e : int (** e *)
16+
> ; f : int (** f *)
17+
> ; g : int (** g *)
18+
> }
19+
>
20+
> let _ = A, B, C
21+
> let _f x = x.e, x.f, x.g
22+
> EOF
23+
24+
Get doc for A
25+
FIXME: this should just be "A"
26+
$ document_pos 12:9
27+
A
28+
B
29+
30+
Get doc for B
31+
FIXME: this should just be "B"
32+
$ document_pos 12:12
33+
B
34+
C
35+
36+
Get doc for C
37+
$ document_pos 12:15
38+
C
39+
40+
Get doc for e
41+
FIXME: this should just be "e"
42+
$ document_pos 13:14
43+
e
44+
f
45+
46+
Get doc for f
47+
FIXME: this should just be "f"
48+
$ document_pos 13:19
49+
e
50+
f
51+
g
52+
53+
Get doc for g
54+
FIXME: this should just be "g"
55+
$ document_pos 13:24
56+
f
57+
g
58+
59+
$ cat > test.ml <<EOF
60+
> type variant =
61+
> | A
62+
> (** A *)
63+
> | B
64+
> (** B *)
65+
> | C
66+
> (** C *)
67+
>
68+
> type record =
69+
> { e : int
70+
> (** e *)
71+
> ; f : int
72+
> (** f *)
73+
> ; g : int
74+
> (** g *)
75+
> }
76+
>
77+
> let _ = A, B, C
78+
> let _f x = x.e, x.f, x.g
79+
> EOF
80+
81+
Get doc for A
82+
$ document_pos 18:9
83+
A
84+
85+
Get doc for B
86+
$ document_pos 18:12
87+
B
88+
89+
Get doc for C
90+
$ document_pos 18:15
91+
C
92+
93+
Get doc for e
94+
$ document_pos 19:14
95+
e
96+
97+
Get doc for f
98+
FIXME: this should just be "f"
99+
$ document_pos 19:19
100+
e
101+
f
102+
103+
Get doc for g
104+
FIXME: this should just be "g"
105+
$ document_pos 19:24
106+
f
107+
g

0 commit comments

Comments
 (0)