Skip to content

Commit 5907823

Browse files
committed
WIP
1 parent 5a539f7 commit 5907823

File tree

4 files changed

+59
-18
lines changed

4 files changed

+59
-18
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ jobs:
4949
skip-test: false
5050
skip-doc: true
5151
- os: ubuntu-latest
52-
ocaml-compiler: "ocaml-variants.5.3.0+trunk"
52+
ocaml-compiler: "ocaml-variants.5.3.0~alpha1"
5353
skip-effects: false
5454
skip-test: false
5555
skip-doc: false
5656
- os: macos-latest
57-
ocaml-compiler: "ocaml-variants.5.3.0+trunk"
57+
ocaml-compiler: "ocaml-variants.5.3.0~alpha1"
5858
skip-effects: true
5959
skip-test: false
6060
skip-doc: true
6161
- os: windows-latest
62-
ocaml-compiler: "ocaml-variants.5.3.0+trunk"
62+
ocaml-compiler: "ocaml-variants.5.3.0~alpha1"
6363
skip-effects: false
6464
skip-test: false
6565
skip-doc: true
@@ -92,12 +92,10 @@ jobs:
9292
- run: opam install conf-pkg-config
9393
if: runner.os == 'Windows'
9494

95-
- run: opam pin add ppxlib git+https://github.com/NathanReb/ppxlib.git#trunk-support-503 --no-action
96-
if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0+trunk' }}
97-
- run: opam pin add base git+https://github.com/hhugo/base.git#trunk-support-503 --no-action
98-
if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0+trunk' }}
95+
- run: opam pin add ppxlib --dev --no-action
96+
if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0~alpha1' }}
9997
- run: opam pin add ppxlib_jane git+https://github.com/hhugo/ppxlib_jane.git#trunk-support-503 --no-action
100-
if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0+trunk' }}
98+
if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0~alpha1' }}
10199

102100
- run: opam pin add ./ --no-action
103101

compiler/lib/magic_number.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let v =
7979
| 5 :: 02 :: _ -> 34
8080
| 5 :: 03 :: _ -> 35
8181
| _ ->
82-
if Ocaml_version.compare current [ 4; 08 ] < 0
82+
if Ocaml_version.compare current [ 4; 8 ] < 0
8383
then failwith "OCaml version unsupported. Upgrade to OCaml 4.08 or newer."
8484
else (
8585
assert (Ocaml_version.compare current [ 5; 4 ] >= 0);

ppx/ppx_js/tests/ppx.mlt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fun (obj : int) -> obj##m
102102
[%%expect
103103
{|
104104
Line _, characters 19-22:
105-
Error: This expression has type int but an expression was expected of type
105+
Error: The value obj has type int but an expression was expected of type
106106
< .. > Js_of_ocaml.Js.t
107107
|}]
108108

@@ -122,7 +122,7 @@ fun (obj : < m : float Js.prop > Js.t) -> obj##m
122122
[%%expect
123123
{|
124124
Line _, characters 42-48:
125-
Error: This expression has type
125+
Error: The method call x#m has type
126126
float Js_of_ocaml.Js.prop =
127127
< get : float; set : float -> unit > Js_of_ocaml.Js.gen_prop
128128
but an expression was expected of type 'res Js_of_ocaml.Js.meth
@@ -144,7 +144,7 @@ fun (obj : < m : int -> int Js.meth > Js.t) -> obj##m + 1
144144
[%%expect
145145
{|
146146
Line _, characters 47-53:
147-
Error: This expression has type int -> int Js_of_ocaml.Js.meth
147+
Error: The method call x#m has type int -> int Js_of_ocaml.Js.meth
148148
but an expression was expected of type 'res Js_of_ocaml.Js.meth
149149
|}]
150150

@@ -154,7 +154,7 @@ fun (obj : < m : int Js.meth > Js.t) -> obj##m 1
154154
[%%expect
155155
{|
156156
Line _, characters 40-46:
157-
Error: This expression has type int Js_of_ocaml.Js.meth
157+
Error: The method call x#m has type int Js_of_ocaml.Js.meth
158158
but an expression was expected of type int -> 'res Js_of_ocaml.Js.meth
159159
|}]
160160

@@ -189,7 +189,7 @@ fun (obj : int) -> obj##.p
189189
[%%expect
190190
{|
191191
Line _, characters 19-22:
192-
Error: This expression has type int but an expression was expected of type
192+
Error: The value obj has type int but an expression was expected of type
193193
< .. > Js_of_ocaml.Js.t
194194
|}]
195195

@@ -209,7 +209,7 @@ fun (obj : < p : float Js.writeonly_prop > Js.t) -> obj##.p + 1
209209
[%%expect
210210
{|
211211
Line _, characters 58-59:
212-
Error: This expression has type
212+
Error: The method call x#p has type
213213
float Js_of_ocaml.Js.writeonly_prop =
214214
< set : float -> unit > Js_of_ocaml.Js.gen_prop
215215
but an expression was expected of type
@@ -235,7 +235,7 @@ fun (obj : int) -> obj##.p := 2
235235
[%%expect
236236
{|
237237
Line _, characters 19-22:
238-
Error: This expression has type int but an expression was expected of type
238+
Error: The value obj has type int but an expression was expected of type
239239
< .. > Js_of_ocaml.Js.t
240240
|}]
241241

@@ -255,7 +255,7 @@ fun (obj : < p : float Js.readonly_prop > Js.t) -> obj##.p := 1
255255
[%%expect
256256
{|
257257
Line _, characters 51-58:
258-
Error: This expression has type
258+
Error: The method call x#p has type
259259
float Js_of_ocaml.Js.readonly_prop =
260260
< get : float > Js_of_ocaml.Js.gen_prop
261261
but an expression was expected of type
@@ -269,7 +269,7 @@ fun (obj : < p : float Js.prop > Js.t) -> obj##.p := 1
269269
[%%expect
270270
{|
271271
Line _, characters 42-49:
272-
Error: This expression has type
272+
Error: The method call x#p has type
273273
float Js_of_ocaml.Js.prop =
274274
< get : float; set : float -> unit > Js_of_ocaml.Js.gen_prop
275275
but an expression was expected of type

runtime/array.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ function caml_array_sub(a, i, len) {
2727
return a2;
2828
}
2929

30+
//Provides: caml_floatarray_sub mutable
31+
//Version: >= 5.3
32+
function caml_floatarray_sub(a, i, len) {
33+
var a2 = new Array(len + 1);
34+
a2[0] = 0;
35+
for (var i2 = 1, i1 = i + 1; i2 <= len; i2++, i1++) {
36+
a2[i2] = a[i1];
37+
}
38+
return a2;
39+
}
40+
3041
//Provides: caml_array_append mutable
3142
function caml_array_append(a1, a2) {
3243
var l1 = a1.length,
@@ -41,6 +52,21 @@ function caml_array_append(a1, a2) {
4152
return a;
4253
}
4354

55+
//Provides: caml_floatarray_append mutable
56+
//Version: >= 5.3
57+
function caml_floatarray_append(a1, a2) {
58+
var l1 = a1.length,
59+
l2 = a2.length;
60+
var l = l1 + l2 - 1;
61+
var a = new Array(l);
62+
a[0] = 0;
63+
var i = 1,
64+
j = 1;
65+
for (; i < l1; i++) a[i] = a1[i];
66+
for (; i < l; i++, j++) a[i] = a2[j];
67+
return a;
68+
}
69+
4470
//Provides: caml_array_concat mutable
4571
function caml_array_concat(l) {
4672
var a = [0];
@@ -96,6 +122,15 @@ function caml_array_fill(array, ofs, len, v) {
96122
return 0;
97123
}
98124

125+
//Provides: caml_floatarray_fill
126+
//Version: >= 5.3
127+
function caml_floatarray_fill(array, ofs, len, v) {
128+
for (var i = 0; i < len; i++) {
129+
array[ofs + i + 1] = v;
130+
}
131+
return 0;
132+
}
133+
99134
//Provides: caml_check_bound (mutable, const)
100135
//Requires: caml_array_bound_error
101136
function caml_check_bound(array, index) {
@@ -133,6 +168,7 @@ function caml_array_create_float(len) {
133168
}
134169
//Provides: caml_floatarray_create const (const)
135170
//Requires: caml_array_bound_error
171+
//Version: >= 5.3
136172
function caml_floatarray_create(len) {
137173
if (len < 0) caml_array_bound_error();
138174
var len = (len + 1) | 0;
@@ -141,3 +177,10 @@ function caml_floatarray_create(len) {
141177
for (var i = 1; i < len; i++) b[i] = 0;
142178
return b;
143179
}
180+
181+
//Provides: caml_floatarray_make const (const)
182+
//Requires: caml_array_make
183+
//Version: >= 5.3
184+
function caml_floatarray_make(len,init) {
185+
return caml_array_make(len,init);
186+
}

0 commit comments

Comments
 (0)