Skip to content

Commit 29e3d07

Browse files
authored
Remove constant flag from extension constructor (rescript-lang#6943)
1 parent 9a65856 commit 29e3d07

File tree

9 files changed

+11
-13
lines changed

9 files changed

+11
-13
lines changed

jscomp/ml/datarepr.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ let extension_descr path_ext ext =
201201
cstr_existentials = existentials;
202202
cstr_args;
203203
cstr_arity = List.length cstr_args;
204-
cstr_tag = Cstr_extension(path_ext, cstr_args = []);
204+
cstr_tag = Cstr_extension(path_ext);
205205
cstr_consts = -1;
206206
cstr_nonconsts = -1;
207207
cstr_private = ext.ext_private;

jscomp/ml/env.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ let is_ident = function
549549
| Pdot _ | Papply _ -> false
550550

551551
let is_local_ext = function
552-
| {cstr_tag = Cstr_extension(p, _)} -> is_ident p
552+
| {cstr_tag = Cstr_extension(p)} -> is_ident p
553553
| _ -> false
554554

555555
let diff env1 env2 =

jscomp/ml/matching.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ let get_extension_cases tag_lambda_list =
22792279
| (cstr, act) :: rem ->
22802280
let nonconsts = split_rec rem in
22812281
match cstr with
2282-
| Cstr_extension(path, _) -> ((path, act) :: nonconsts)
2282+
| Cstr_extension(path) -> ((path, act) :: nonconsts)
22832283
| _ -> assert false in
22842284
split_rec tag_lambda_list
22852285

jscomp/ml/rec_check.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ let rec expression : Env.env -> Typedtree.expression -> Use.t =
240240
| Texp_construct (_, desc, exprs) ->
241241
let access_constructor =
242242
match desc.cstr_tag with
243-
| Cstr_extension (pth, _) -> Use.inspect (path env pth)
243+
| Cstr_extension (pth) -> Use.inspect (path env pth)
244244
| _ -> Use.empty
245245
in
246246
let use =

jscomp/ml/translcore.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
905905
in
906906
try Lconst (Const_block (tag_info, List.map extract_constant ll))
907907
with Not_constant -> Lprim (Pmakeblock tag_info, ll, e.exp_loc))
908-
| Cstr_extension (path, _) ->
908+
| Cstr_extension (path) ->
909909
Lprim
910910
( Pmakeblock Blk_extension,
911911
transl_extension_path e.exp_env path :: ll,

jscomp/ml/typecore.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty
28392839
} ] ->
28402840
let path =
28412841
match (Typetexp.find_constructor env lid.loc lid.txt).cstr_tag with
2842-
| Cstr_extension (path, _) -> path
2842+
| Cstr_extension (path) -> path
28432843
| _ -> raise (Error (lid.loc, env, Not_an_extension_constructor))
28442844
in
28452845
rue {

jscomp/ml/typedecl.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ let transl_extension_constructor env type_path type_params
15311531
end;
15321532
let path =
15331533
match cdescr.cstr_tag with
1534-
Cstr_extension(path, _) -> path
1534+
Cstr_extension(path) -> path
15351535
| _ -> assert false
15361536
in
15371537
let args =

jscomp/ml/types.ml

+3-4
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,15 @@ and constructor_tag =
281281
Cstr_constant of int (* Constant constructor (an int) *)
282282
| Cstr_block of int (* Regular constructor (a block) *)
283283
| Cstr_unboxed (* Constructor of an unboxed type *)
284-
| Cstr_extension of Path.t * bool (* Extension constructor
285-
true if a constant false if a block*)
284+
| Cstr_extension of Path.t (* Extension constructor *)
286285

287286
let equal_tag t1 t2 =
288287
match (t1, t2) with
289288
| Cstr_constant i1, Cstr_constant i2 -> i2 = i1
290289
| Cstr_block i1, Cstr_block i2 -> i2 = i1
291290
| Cstr_unboxed, Cstr_unboxed -> true
292-
| Cstr_extension (path1, b1), Cstr_extension (path2, b2) ->
293-
Path.same path1 path2 && b1 = b2
291+
| Cstr_extension (path1), Cstr_extension (path2) ->
292+
Path.same path1 path2
294293
| (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false
295294

296295
let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with

jscomp/ml/types.mli

+1-2
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ and constructor_tag =
433433
Cstr_constant of int (* Constant constructor (an int) *)
434434
| Cstr_block of int (* Regular constructor (a block) *)
435435
| Cstr_unboxed (* Constructor of an unboxed type *)
436-
| Cstr_extension of Path.t * bool (* Extension constructor
437-
true if a constant false if a block*)
436+
| Cstr_extension of Path.t (* Extension constructor *)
438437

439438
(* Constructors are the same *)
440439
val equal_tag : constructor_tag -> constructor_tag -> bool

0 commit comments

Comments
 (0)