Skip to content

Commit 3beb1fa

Browse files
committed
Make Texp_coerce compatible with old runtime representation.
By adding a unit argument to the payload.
1 parent 19abd9f commit 3beb1fa

8 files changed

+10
-10
lines changed

jscomp/ml/printtyped.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ and expression_extra i ppf x attrs =
270270
line i ppf "Texp_constraint\n";
271271
attributes i ppf attrs;
272272
core_type i ppf ct;
273-
| Texp_coerce cto2 ->
273+
| Texp_coerce ((), cto2) ->
274274
line i ppf "Texp_coerce\n";
275275
attributes i ppf attrs;
276276
core_type i ppf cto2;

jscomp/ml/tast_mapper.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ let expr sub x =
190190
let extra = function
191191
| Texp_constraint cty ->
192192
Texp_constraint (sub.typ sub cty)
193-
| Texp_coerce cty2 ->
194-
Texp_coerce (sub.typ sub cty2)
193+
| Texp_coerce ((), cty2) ->
194+
Texp_coerce ((), (sub.typ sub cty2))
195195
| Texp_open (ovf, path, loc, env) ->
196196
Texp_open (ovf, path, loc, sub.env sub env)
197197
| Texp_newtype _ as d -> d

jscomp/ml/typecore.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty
26262626
exp_type = ty';
26272627
exp_attributes = arg.exp_attributes;
26282628
exp_env = env;
2629-
exp_extra = (Texp_coerce cty', loc, sexp.pexp_attributes) ::
2629+
exp_extra = (Texp_coerce ((), cty'), loc, sexp.pexp_attributes) ::
26302630
arg.exp_extra;
26312631
}
26322632
| Pexp_send (e, {txt=met}) ->

jscomp/ml/typedtree.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ and expression =
6868

6969
and exp_extra =
7070
| Texp_constraint of core_type
71-
| Texp_coerce of core_type
71+
| Texp_coerce of unit * core_type
7272
| Texp_open of override_flag * Path.t * Longident.t loc * Env.t
7373
| Texp_poly of core_type option
7474
| Texp_newtype of string

jscomp/ml/typedtree.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ and expression =
119119
and exp_extra =
120120
| Texp_constraint of core_type
121121
(** E : T *)
122-
| Texp_coerce of core_type
122+
| Texp_coerce of unit * core_type
123123
(** E :> T [Texp_coerce T]
124124
*)
125125
| Texp_open of override_flag * Path.t * Longident.t loc * Env.t

jscomp/ml/typedtreeIter.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ module MakeIterator(Iter : IteratorArgument) : sig
236236
match cstr with
237237
Texp_constraint ct ->
238238
iter_core_type ct
239-
| Texp_coerce cty2 ->
239+
| Texp_coerce ((), cty2) ->
240240
iter_core_type cty2
241241
| Texp_open _ -> ()
242242
| Texp_poly cto -> option iter_core_type cto

jscomp/ml/typedtreeMap.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ module MakeMap(Map : MapArgument) = struct
362362
match desc with
363363
| Texp_constraint ct ->
364364
Texp_constraint (map_core_type ct), loc, attrs
365-
| Texp_coerce ct ->
366-
Texp_coerce (map_core_type ct), loc, attrs
365+
| Texp_coerce ((), ct) ->
366+
Texp_coerce ((), map_core_type ct), loc, attrs
367367
| Texp_poly (Some ct) ->
368368
Texp_poly (Some ( map_core_type ct )), loc, attrs
369369
| Texp_newtype _

jscomp/ml/untypeast.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ let exp_extra sub (extra, loc, attrs) sexp =
305305
let attrs = sub.attributes sub attrs in
306306
let desc =
307307
match extra with
308-
Texp_coerce cty2 ->
308+
Texp_coerce ((), cty2) ->
309309
Pexp_coerce (sexp,
310310
(),
311311
sub.typ sub cty2)

0 commit comments

Comments
 (0)