Skip to content

Commit 65e2665

Browse files
fix
1 parent 085e7b9 commit 65e2665

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

typing/ctype.ml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,19 +1664,20 @@ let instance_label ~fixed lbl =
16641664

16651665
(* CR dkalinichenko: we must vary yieldingness together with locality to get
16661666
sane behavior around [@local_opt]. Remove once we have mode polymorphism. *)
1667-
let prim_mode' mvar mvar' = function
1667+
let prim_mode' mvars = function
16681668
| Primitive.Prim_global, _ ->
16691669
Locality.allow_right Locality.global, None
16701670
| Primitive.Prim_local, _ ->
16711671
Locality.allow_right Locality.local, None
16721672
| Primitive.Prim_poly, _ ->
1673-
match mvar, mvar' with
1674-
| Some mvar, Some mvar' -> mvar, Some mvar'
1675-
| None, _ | _, None -> assert false
1673+
match mvars with
1674+
| Some (mvar_l, mvar_y) -> mvar_l, Some mvar_y
1675+
| None -> assert false
16761676

16771677
(* Exported version. *)
16781678
let prim_mode mvar prim =
1679-
fst (prim_mode' mvar (Some (Yielding.newvar ())) prim)
1679+
let mvars = Option.map (fun mvar_l -> mvar_l, Yielding.newvar ()) mvar in
1680+
fst (prim_mode' mvars prim)
16801681

16811682
(** Returns a new mode variable whose locality is the given locality and
16821683
whose yieldingness is the given yieldingness, while all other axes are
@@ -1723,7 +1724,7 @@ let rec instance_prim_locals locals mvar_l mvar_y macc (loc, yld) ty =
17231724
match locals, get_desc ty with
17241725
| l :: locals, Tarrow ((lbl,marg,mret),arg,ret,commu) ->
17251726
let marg = with_locality_and_yielding
1726-
(prim_mode' (Some mvar_l) (Some mvar_y) l) marg
1727+
(prim_mode' (Some (mvar_l, mvar_y)) l) marg
17271728
in
17281729
let macc =
17291730
Alloc.join [
@@ -1818,7 +1819,7 @@ let instance_prim_mode (desc : Primitive.description) ty =
18181819
List.exists is_poly desc.prim_native_repr_args then
18191820
let mode_l = Locality.newvar () in
18201821
let mode_y = Yielding.newvar () in
1821-
let finalret = prim_mode' (Some mode_l) (Some mode_y) desc.prim_native_repr_res in
1822+
let finalret = prim_mode' (Some (mode_l, mode_y)) desc.prim_native_repr_res in
18221823
instance_prim_locals desc.prim_native_repr_args
18231824
mode_l mode_y (Alloc.disallow_right Alloc.legacy) finalret ty,
18241825
Some mode_l, Some mode_y

0 commit comments

Comments
 (0)