Skip to content

Commit 7cdcc44

Browse files
committed
test: similar for type-enclosing
1 parent 20c1c23 commit 7cdcc44

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
$ cat >main.ml <<EOF
2+
> module type T = sig
3+
> type 'a t
4+
> end
5+
>
6+
> module N = struct
7+
> module M (T : T) = struct
8+
> type t = int T.t
9+
> end
10+
> end
11+
>
12+
> module F = struct
13+
> module T = struct type 'a t end
14+
> end
15+
>
16+
> type u = N.M(F.T).t
17+
> EOF
18+
19+
This should return the type of `t` (line 7)
20+
$ $MERLIN single type-enclosing -position 15:18 -verbosity 1 \
21+
> -filename main.ml <main.ml
22+
{
23+
"class": "return",
24+
"value": [
25+
{
26+
"start": {
27+
"line": 15,
28+
"col": 9
29+
},
30+
"end": {
31+
"line": 15,
32+
"col": 19
33+
},
34+
"type": "int F.T.t",
35+
"tail": "no"
36+
},
37+
{
38+
"start": {
39+
"line": 15,
40+
"col": 0
41+
},
42+
"end": {
43+
"line": 15,
44+
"col": 19
45+
},
46+
"type": "type u = int F.T.t",
47+
"tail": "no"
48+
}
49+
],
50+
"notifications": []
51+
}
52+
53+
Type of T (line 12)
54+
$ $MERLIN single type-enclosing -position 15:15 \
55+
> -filename main.ml <main.ml | jq '.value[0].type'
56+
"sig type 'a t end"
57+
58+
Type of F (line 11)
59+
$ $MERLIN single type-enclosing -position 15:13 \
60+
> -filename main.ml <main.ml | jq '.value[0].type'
61+
"sig module T : sig type 'a t end end"
62+
63+
Type of M (line 6)
64+
$ $MERLIN single type-enclosing -position 15:11 \
65+
> -filename main.ml <main.ml | jq '.value[0].type'
66+
"functor (T : T) -> sig type t = int T.t end"
67+
68+
Type of N (line 5)
69+
$ $MERLIN single type-enclosing -position 15:9 \
70+
> -filename main.ml <main.ml | jq '.value[0].type'
71+
"sig module M : functor (T : T) -> sig type t = int T.t end end"

0 commit comments

Comments
 (0)