Skip to content

Commit 500dc22

Browse files
committed
FIX CI
note for poly var -- jsConverter = newType in general does not make sense
1 parent 5f6da96 commit 500dc22

13 files changed

+115
-50
lines changed

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(* e7d9472fccec1704583121b3a6e0a867 *)
1+
(* eb200c1f2c43b3345ec9d60dfe47627b *)
22
let module_names : string array = Obj.magic (
33
"Gc" (* 220 *),
44
"Js" (* 23 *),
@@ -86,7 +86,7 @@ let module_names : string array = Obj.magic (
8686
"Belt_SetInt" (* 657 *),
8787
"BytesLabels" (* 772 *),
8888
"Dom_storage" (* 23 *),
89-
"Js_mapperRt" (* 61 *),
89+
"Js_mapperRt" (* 87 *),
9090
"Node_buffer" (* 23 *),
9191
"Node_module" (* 23 *),
9292
"Belt_HashMap" (* 617 *),
@@ -221,7 +221,7 @@ let module_data : string array = Obj.magic (
221221
(* Belt_SetInt *)"\132\149\166\190\000\000\002}\000\000\000\197\000\000\002\130\000\000\002Y\160\b\000\000\156\000\176\"eq\144\160\160B@@@\176#add\144\160\160B@@@\176#cmp\144\160\160B@@@\176#get\144\160\160B@@@\176#has\144\160\160B@@@\176$diff\144\160\160B@@@\176$keep\144\160\160B@@@\176$size\144\160\160A@@@\176$some\144\160\160B@@@\176%empty\144@\144\146A\176%every\144\160\160B@@@\176%keepU\144\160\160B@@@\176%someU\144\160\160B@@@\176%split\144\160\160B@@@\176%union\144\160\160B@@@\176&everyU\144\160\160B@@@\176&getExn\144\160\160B@@@\176&reduce\144\160\160C@@@\176&remove\144\160\160B@@@\176&subset\144\160\160B@@@\176&toList\144\160\160A@@@\176'forEach\144\160\160B@@@\176'isEmpty\144\160\160A@@@\176'maximum\144\160\160A@@@\176'minimum\144\160\160A@@@\176'reduceU\144\160\160C@@@\176'toArray\144\160\160A@@@\176(forEachU\144\160\160B@@@\176)fromArray\144\160\160A@@@\176)intersect\144\160\160B@@@\176)mergeMany\144\160\160B@@@\176)partition\144\160\160B@@@\176*partitionU\144\160\160B@@@\176*removeMany\144\160\160B@@@\176,getUndefined\144\160\160B@@@\176,maxUndefined\144\160\160A@@@\176,minUndefined\144\160\160A@@@\1765fromSortedArrayUnsafe\144\160\160A@@@\1766checkInvariantInternal\144\160\160A@@@A",
222222
(* BytesLabels *)"\132\149\166\190\000\000\002\240\000\000\000\212\000\000\002\199\000\000\002\149\160\b\000\000\168\000\176#cat\144\160\160B@@@\176#map\144\160\160B@@@\176#sub\144\160\160C@@@\176$blit\144\160\160E@@@\176$copy\144\160\160A@@@\176$fill\144\160\160D@@@\176$init\144\160\160B@@@\176$iter\144\160\160B@@@\176$make\144\160\160B@@@\176$mapi\144\160\160B@@@\176$trim\144\160\160A@@@\176%equal\144\160\160B@@@\176%index\144\160\160B@@@\176%iteri\144\160\160B@@@\176&concat\144\160\160B@@@\176&extend\144\160\160C@@@\176&rindex\144\160\160B@@@\176'compare\144\160\160B@@@\176'escaped\144\160\160A@@@\176(contains\144\160\160B@@@\176)index_opt\144\160\160B@@@\176)lowercase\144\160\160A@@@\176)of_string\144\160\160A@@@\176)to_string\144\160\160A@@@\176)uppercase\144\160\160A@@@\176*capitalize\144\160\160A@@@\176*index_from\144\160\160C@@@\176*rindex_opt\144\160\160B@@@\176*sub_string\144\160\160C@@@\176+blit_string\144\160\160E@@@\176+rindex_from\144\160\160C@@@\176,uncapitalize\144\160\160A@@@\176-contains_from\144\160\160C@@@\176.index_from_opt\144\160\160C@@@\176.rcontains_from\144\160\160C@@@\176/lowercase_ascii\144\160\160A@@@\176/rindex_from_opt\144\160\160C@@@\176/uppercase_ascii\144\160\160A@@@\1760capitalize_ascii\144\160\160A@@@\1760unsafe_of_string\144\160\160A@@@\1760unsafe_to_string\144\160\160A@@@\1762uncapitalize_ascii\144\160\160A@@@A",
223223
(* Dom_storage *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
224-
(* Js_mapperRt *)"\132\149\166\190\000\000\000)\000\000\000\012\000\000\000&\000\000\000#\160\160\176'fromInt\144\160\160C@@@\176-fromIntAssert\144\160\160C@@@A",
224+
(* Js_mapperRt *)"\132\149\166\190\000\000\000C\000\000\000\017\000\000\0009\000\000\0004\160\176\176'fromInt\144\160\160C@@@\176-fromIntAssert\144\160\160C@@@\1761raiseWhenNotFound\144\160\160A@@@A",
225225
(* Node_buffer *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
226226
(* Node_module *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
227227
(* Belt_HashMap *)"\132\149\166\190\000\000\002U\000\000\000\170\000\000\002/\000\000\002\r\160\b\000\000X\000\176#get\144\160\160B@@@\176#has\144\160\160B@@@\176#set\144\160\160C@@@\176$copy\144\160\160A@@@\176$make\144\160\160B@@\144\180B\160\176\001\005c(hintSize@\160\176\001\005d\"id@@\147\192\151\176\161A\146$make\160\145\176@8Belt_internalBucketsTypeA@\176\192&_none_A@\000\255\004\002A\160\151\176\161@\146$hash\160\144\004\024@\004\011\160\151\176\161A\146\"eq\160\004\b@\004\018\160\144\004$@\176\1926others/belt_HashMap.ml\001\000\201\001\025\018\001\025\020\192\004\002\001\000\201\001\025\018\001\025;@A\176$size\144\160\160A@@\144\180A\160\176\001\004I!h@@\151\176\161@\161$sizeA\160\144\004\t@\176\192\004\021]\001\004\255\001\005\012\192\004\022]\001\004\255\001\005\020@\176%clear\144\160\160A@@@\176&reduce\144\160\160C@@@\176&remove\144\160\160B@@@\176'forEach\144\160\160B@@@\176'isEmpty\144\160\160A@@@\176'reduceU\144\160\160C@@@\176'toArray\144\160\160A@@@\176(forEachU\144\160\160B@@@\176(logStats\144\160\160A@@@\176)fromArray\144\160\160B@@@\176)mergeMany\144\160\160B@@@\176+keysToArray\144\160\160A@@@\176-valuesToArray\144\160\160A@@@\176.keepMapInPlace\144\160\160B@@@\176/keepMapInPlaceU\144\160\160B@@@\1762getBucketHistogram\144\160\160A@@@A",

jscomp/others/js_mapperRt.ml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
26+
let raiseWhenNotFound x =
27+
if Js.testAny x then raise Not_found
28+
else x
29+
2730
let rec fromIntAux (enum : int) i len xs =
2831
if i = len then None
2932
else
@@ -35,11 +38,11 @@ let fromInt len (xs : int array) (enum : int ) : 'variant option =
3538
fromIntAux enum 0 len xs
3639

3740
let rec fromIntAssertAux len (enum : int) i xs =
38-
[%assert i < len];
39-
(*TODO: replaced by [%assert i < len ]*)
40-
let k = Js.Array2.unsafe_get xs i in
41-
if k = enum then i
42-
else fromIntAssertAux len enum (i + 1) xs
41+
if i = len then raise Not_found
42+
else
43+
let k = Js.Array2.unsafe_get xs i in
44+
if k = enum then i
45+
else fromIntAssertAux len enum (i + 1) xs
4346

4447
(** [length] is not relevant any more *)
4548
let fromIntAssert len (xs : int array) (enum : int )=

jscomp/others/js_mapperRt.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525

2626

27-
27+
val raiseWhenNotFound :
28+
'a -> 'a
29+
2830
(**
2931
[fromInt len array int]
3032
return the mapped [enum]

jscomp/syntax/ast_derive_js_mapper.ml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ let fromIntAssert len array exp =
157157
len
158158
array
159159
exp
160-
161-
160+
let raiseWhenNotFound x =
161+
app1
162+
(Exp.ident
163+
{loc = noloc;
164+
txt = Longident.Ldot (jsMapperRt,"raiseWhenNotFound")})
165+
x
162166
let assertExp e =
163167
Exp.extension
164168
({Asttypes.loc = noloc; txt = "assert"},
@@ -287,10 +291,14 @@ let init () =
287291
(Ast_compatible.fun_
288292
(Pat.var pat_param)
289293
(
294+
let result =
290295
app2
291296
unsafeIndexGetExp
292297
revExpMap
293-
exp_param
298+
exp_param in
299+
if createType then
300+
raiseWhenNotFound result
301+
else result
294302
)
295303
)
296304
] in

jscomp/test/ast_abstract_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function xToJs(param) {
6464
}
6565

6666
function xFromJs(param) {
67-
return _map[param];
67+
return Js_mapperRt.raiseWhenNotFound(_map[param]);
6868
}
6969

7070
function idx(v) {

jscomp/test/ast_js_mapper_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function bToJs(param) {
7474
}
7575

7676
function bFromJs(param) {
77-
return _map[param];
77+
return Js_mapperRt.raiseWhenNotFound(_map[param]);
7878
}
7979

8080
exports.tToJs = tToJs;

jscomp/test/ast_mapper_defensive_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function cToJs(param) {
6060
}
6161

6262
function cFromJs(param) {
63-
return _map[param];
63+
return Js_mapperRt.raiseWhenNotFound(_map[param]);
6464
}
6565

6666
$$throw("File \"ast_mapper_defensive_test.ml\", line 28, characters 16-23", (function (param) {

0 commit comments

Comments
 (0)