Skip to content

Commit e83596a

Browse files
committed
Add a test case for external with val signature
1 parent 1184a40 commit e83596a

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

jscomp/test/recursive_module.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var Caml_obj = require("../../lib/js/caml_obj.js");
77
var Caml_module = require("../../lib/js/caml_module.js");
88
var CamlinternalLazy = require("../../lib/js/camlinternalLazy.js");
99
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
10+
var Caml_external_polyfill = require("../../lib/js/caml_external_polyfill.js");
1011
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
1112

1213
var suites = /* record */[/* contents : [] */0];
@@ -37,23 +38,29 @@ Caml_module.update_mod([[
3738
0
3839
]], Int32, Int32);
3940

41+
var Xx = /* module */[/* hfiehi */(function (prim, prim$1) {
42+
return Caml_external_polyfill.resolve("hfiehi")(prim, prim$1);
43+
})];
44+
45+
var uuu = Xx[/* f */0];
46+
4047
var Int3 = Caml_module.init_mod([
4148
"recursive_module.ml",
42-
19,
49+
27,
4350
6
4451
], [[0]]);
4552

4653
Caml_module.update_mod([[0]], Int3, Int3);
4754

4855
var Inta = Caml_module.init_mod([
4956
"recursive_module.ml",
50-
23,
57+
31,
5158
6
5259
], [[1]]);
5360

5461
var Intb = Caml_module.init_mod([
5562
"recursive_module.ml",
56-
28,
63+
36,
5764
6
5865
], [[1]]);
5966

@@ -82,17 +89,17 @@ catch (exn){
8289
}
8390
}
8491

85-
eq("File \"recursive_module.ml\", line 33, characters 3-10", -1, tmp);
92+
eq("File \"recursive_module.ml\", line 41, characters 3-10", -1, tmp);
8693

8794
var Inta$1 = Caml_module.init_mod([
8895
"recursive_module.ml",
89-
40,
96+
48,
9097
8
9198
], [[1]]);
9299

93100
var Intb$1 = Caml_module.init_mod([
94101
"recursive_module.ml",
95-
45,
102+
53,
96103
8
97104
], [[1]]);
98105

@@ -109,7 +116,7 @@ var A = /* module */[
109116
/* Intb */Intb$1
110117
];
111118

112-
eq("File \"recursive_module.ml\", line 50, characters 6-13", CamlinternalLazy.force(Inta$1[/* a */0]), 3);
119+
eq("File \"recursive_module.ml\", line 58, characters 6-13", CamlinternalLazy.force(Inta$1[/* a */0]), 3);
113120

114121
var tmp$1;
115122

@@ -126,14 +133,16 @@ catch (raw_exn){
126133
}
127134
}
128135

129-
eq("File \"recursive_module.ml\", line 52, characters 6-13", 4, tmp$1);
136+
eq("File \"recursive_module.ml\", line 60, characters 6-13", 4, tmp$1);
130137

131138
Mt.from_pair_suites("Recursive_module", suites[0]);
132139

133140
exports.suites = suites;
134141
exports.test_id = test_id;
135142
exports.eq = eq;
136143
exports.Int32 = Int32;
144+
exports.Xx = Xx;
145+
exports.uuu = uuu;
137146
exports.Int3 = Int3;
138147
exports.Inta = Inta;
139148
exports.Intb = Intb;

jscomp/test/recursive_module.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ module rec Int32 : sig
1313
external of_buffer : buffer -> t = "Int32Array" [@@js.new]
1414
end = Int32
1515

16+
module Xx : sig
17+
val f : int -> int -> int
18+
end = struct
19+
external f : int -> int -> int = "hfiehi"
20+
end
21+
22+
let uuu = Xx.f
23+
1624

1725
module rec Int3 : sig
1826
val u : int -> int

0 commit comments

Comments
 (0)