Skip to content

Commit 5f3c033

Browse files
authored
Add __unsafe_cast to fix build dependency issue (#5388)
* Add __unsafe_cast to fix build dependency issue * ninja build
1 parent 4fb1a44 commit 5f3c033

11 files changed

+3179
-3173
lines changed

jscomp/frontend/ast_bs_open.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
let isCamlExceptionOrOpenVariant : Longident.t =
2626
Ldot (Ldot (Lident "Js", "Exn"), "isCamlExceptionOrOpenVariant")
2727

28-
let obj_magic : Longident.t = Ldot (Lident "Obj", "magic")
28+
let obj_magic : Longident.t = Lident "__unsafe_cast"
2929

3030
let rec checkCases (cases : Parsetree.case list) = List.iter check_case cases
3131

jscomp/frontend/ast_utf8_string_interp.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ let concat_exp a_loc x ~(lhs : Parsetree.expression) : Parsetree.expression =
357357
let loc = Bs_loc.merge a_loc lhs.pexp_loc in
358358
Ast_compatible.apply_simple ~loc
359359
(Exp.ident { txt = concat_ident; loc })
360-
[ lhs; aux loc x ~to_string_ident:(Longident.Ldot (Lident "Obj", "magic")) ]
360+
[ lhs; aux loc x ~to_string_ident:(Longident.Lident "__unsafe_cast") ]
361361

362362
(* Invariant: the [lhs] is always of type string *)
363363
let rec handle_segments loc (rev_segments : segment list) =

jscomp/main/builtin_cmi_datasets.ml

+43-43
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

+24-24
Large diffs are not rendered by default.

jscomp/stdlib-406/pervasives.ml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
(* type 'a option = None | Some of 'a *)
1717

18+
(* Internal *)
19+
external __unsafe_cast : 'a -> 'b = "%identity"
20+
1821
(* Exceptions *)
1922

2023
external raise : exn -> 'a = "%raise"

jscomp/stdlib-406/pervasives.mli

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*)
2626

2727

28+
(* Internal *)
29+
external __unsafe_cast : 'a -> 'b = "%identity"
30+
2831
(** {1 Exceptions} *)
2932

3033
external raise : exn -> 'a = "%raise"

0 commit comments

Comments
 (0)