Skip to content

Commit 91eef72

Browse files
panglesdjonludlam
authored andcommitted
Add test for class types
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 2ae10f6 commit 91eef72

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

test/occurrences/double_wrapped.t/a.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ type t = string
44

55
module type M = sig end
66

7-
let (||>) x y = x + y
7+
let ( ||> ) x y = x + y
88

99
let _ = x + x
10+
11+
class ct = object end

test/occurrences/double_wrapped.t/b.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ module type Y = A.M
1313
let _ =
1414
let open A in
1515
1 ||> 2
16+
17+
let ob = new A.ct
18+
19+
class ct : A.ct = A.ct

test/occurrences/double_wrapped.t/run.t

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ occurrences information.
1616
$ odoc compile --count-occurrences -I . main__A.cmt
1717
$ odoc compile --count-occurrences -I . main__C.cmt
1818
$ odoc compile --count-occurrences -I . main__B.cmt
19+
File "main__B.cmt":
20+
Warning: Failed to compile expansion for class (root Main__B).ct
1921
$ odoc compile --count-occurrences -I . main__.cmt
2022
$ odoc compile --count-occurrences -I . main.cmt
2123

@@ -68,10 +70,11 @@ A only uses "persistent" values: one it defines itself.
6870

6971
"Aliased" values are not counted since they become persistent
7072
$ occurrences_print occurrences-main__B.odoc | sort
71-
Main was used directly 0 times and indirectly 7 times
72-
Main.A was used directly 2 times and indirectly 5 times
73+
Main was used directly 0 times and indirectly 8 times
74+
Main.A was used directly 2 times and indirectly 6 times
7375
Main.A.(||>) was used directly 1 times and indirectly 0 times
7476
Main.A.M was used directly 2 times and indirectly 0 times
77+
Main.A.ct was used directly 1 times and indirectly 0 times
7578
Main.A.t was used directly 1 times and indirectly 0 times
7679
Main.A.x was used directly 1 times and indirectly 0 times
7780

@@ -92,10 +95,11 @@ Now we can merge all tables
9295

9396
$ occurrences_print occurrences-aggregated.odoc | sort > all_merged
9497
$ cat all_merged
95-
Main was used directly 0 times and indirectly 11 times
96-
Main.A was used directly 4 times and indirectly 6 times
98+
Main was used directly 0 times and indirectly 12 times
99+
Main.A was used directly 4 times and indirectly 7 times
97100
Main.A.(||>) was used directly 1 times and indirectly 0 times
98101
Main.A.M was used directly 2 times and indirectly 0 times
102+
Main.A.ct was used directly 1 times and indirectly 0 times
99103
Main.A.t was used directly 1 times and indirectly 0 times
100104
Main.A.x was used directly 2 times and indirectly 0 times
101105
Main.B was used directly 1 times and indirectly 0 times
@@ -110,10 +114,11 @@ We can also include hidden ids:
110114

111115
$ odoc count-occurrences -I main__B -o occurrences-b.odoc --include-hidden
112116
$ occurrences_print occurrences-b.odoc | sort
113-
Main was used directly 0 times and indirectly 7 times
114-
Main.A was used directly 2 times and indirectly 5 times
117+
Main was used directly 0 times and indirectly 8 times
118+
Main.A was used directly 2 times and indirectly 6 times
115119
Main.A.(||>) was used directly 1 times and indirectly 0 times
116120
Main.A.M was used directly 2 times and indirectly 0 times
121+
Main.A.ct was used directly 1 times and indirectly 0 times
117122
Main.A.t was used directly 1 times and indirectly 0 times
118123
Main.A.x was used directly 1 times and indirectly 0 times
119124
Main__ was used directly 0 times and indirectly 2 times
@@ -122,10 +127,11 @@ We can also include hidden ids:
122127

123128
$ odoc count-occurrences -I . -o occurrences-all.odoc --include-hidden
124129
$ occurrences_print occurrences-all.odoc | sort
125-
Main was used directly 0 times and indirectly 11 times
126-
Main.A was used directly 4 times and indirectly 6 times
130+
Main was used directly 0 times and indirectly 12 times
131+
Main.A was used directly 4 times and indirectly 7 times
127132
Main.A.(||>) was used directly 1 times and indirectly 0 times
128133
Main.A.M was used directly 2 times and indirectly 0 times
134+
Main.A.ct was used directly 1 times and indirectly 0 times
129135
Main.A.t was used directly 1 times and indirectly 0 times
130136
Main.A.x was used directly 2 times and indirectly 0 times
131137
Main.B was used directly 1 times and indirectly 0 times

0 commit comments

Comments
 (0)