Skip to content

Commit eb5c6e5

Browse files
committed
test: avoid creating abstract module type by shadowing
OCaml 5.4 forbids the creation of abstract module types because the creation of such module types never match the user intents.
1 parent b325c31 commit eb5c6e5

5 files changed

Lines changed: 36 additions & 14 deletions

File tree

test/xref2/shadow2.t/a.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ end
66

77
include B1
88

9-
module type B2 = sig
9+
module type B2 := sig
1010
module A : sig
1111
include module type of struct include A end
1212
type u
@@ -15,7 +15,7 @@ end
1515

1616
include B2
1717

18-
module type B3 = sig
18+
module type B3 := sig
1919
module A : sig
2020
include module type of struct include A end
2121
type v

test/xref2/shadow2.t/run.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
include B1
99

10-
module type B2 = sig
10+
module type B2 := sig
1111
module A : sig
1212
include module type of struct include A end
1313
type u
@@ -16,7 +16,7 @@
1616

1717
include B2
1818

19-
module type B3 = sig
19+
module type B3 := sig
2020
module A : sig
2121
include module type of struct include A end
2222
type v

test/xref2/shadow3.t/a.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ end
66

77
include B
88

9-
module type B1 = sig
9+
module type B1 := sig
1010
module A : sig
1111
include module type of struct include A end
1212
type a

test/xref2/shadow3.t/b.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ end
66

77
include B
88

9-
module type B1 = sig
9+
module type B1 := sig
1010
module A : sig
1111
include module type of struct include A end
1212
type b

test/xref2/shadow3.t/run.t

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Module `C` then includes them both, causing further shadowing.
66
$ ocamlc -c -bin-annot c.mli
77
$ ocamlc -i c.mli
88
module type B = B.B
9-
module type B1 = B.B1
109
module A : sig type t = B.A.t type b = B.A.b end
1110

1211
$ odoc compile a.cmti --unique-id AAAA
@@ -19,23 +18,46 @@ Module `C` then includes them both, causing further shadowing.
1918
module type {B}1/shadowed/(CCCC) = A.B
2019
include {B}1/shadowed/(CCCC)
2120
(sig : module {A}1/shadowed/(AAAA) = A.A end)
22-
module type {B1}2/shadowed/(CCCC) = A.B1
23-
include {B1}2/shadowed/(CCCC)
24-
(sig : module {A}3/shadowed/(CCCC) = A.A end)
21+
module type B1 :=
22+
sig
23+
module A :
24+
sig
25+
include module type of struct include {A}1/shadowed/(AAAA) end
26+
(sig :
27+
include module type of struct include A.{A}1/shadowed/(AAAA) end
28+
(sig : type t = {A}1/shadowed/(AAAA).t end)
29+
type a = A.A.a
30+
end)
31+
type a
32+
end
33+
end
34+
include B1 (sig : module {A}2/shadowed/(CCCC) = A.A end)
2535
end)
2636
include module type of struct include B end
2737
(sig :
2838
module type B = B.B
2939
include B (sig : module {A}1/shadowed/(BBBB) = B.A end)
30-
module type B1 = B.B1
31-
include B1 (sig : module {A}4/shadowed/(CCCC) = B.A end)
40+
module type B1 :=
41+
sig
42+
module A :
43+
sig
44+
include module type of struct include {A}1/shadowed/(BBBB) end
45+
(sig :
46+
include module type of struct include B.{A}1/shadowed/(BBBB) end
47+
(sig : type t = {A}1/shadowed/(BBBB).t end)
48+
type b = B.A.b
49+
end)
50+
type b
51+
end
52+
end
53+
include B1 (sig : module {A}3/shadowed/(CCCC) = B.A end)
3254
end)
3355
module A :
3456
sig
35-
include module type of struct include {A}4/shadowed/(CCCC) end
57+
include module type of struct include {A}3/shadowed/(CCCC) end
3658
(sig :
3759
include module type of struct include B.{A}1/shadowed/(BBBB) end
38-
(sig : type t = {A}4/shadowed/(CCCC).t end)
60+
(sig : type t = {A}3/shadowed/(CCCC).t end)
3961
type b = B.A.b
4062
end)
4163
end

0 commit comments

Comments
 (0)