Skip to content

Commit aa151ac

Browse files
committed
add missing reduction
1 parent 0fa024e commit aa151ac

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

ocaml/typing/mode.ml

+46
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,12 @@ module Lattices_mono = struct
851851
match m0, m1 with
852852
| Id, m -> Some m
853853
| m, Id -> Some m
854+
| Meet_with c0, Meet_with c1 -> Some (Meet_with (meet dst c0 c1))
855+
| Join_with c0, Join_with c1 -> Some (Join_with (join dst c0 c1))
856+
| Meet_with c0, m1 when (le dst (max dst) c0) ->
857+
Some m1
858+
| Join_with c0, m1 when (le dst c0 (min dst)) ->
859+
Some m1
854860
| Compose (f0, f1), g -> (
855861
let mid = src dst f0 in
856862
match maybe_compose mid f1 g with
@@ -882,6 +888,46 @@ module Lattices_mono = struct
882888
| Regional_to_local, Local_to_regional -> Some Id
883889
| Regional_to_local, Global_to_regional -> Some (Join_with Locality.Local)
884890
| Regional_to_local, Locality_as_regionality -> Some Id
891+
| Regional_to_local, Meet_with c ->
892+
Some (compose dst (Meet_with (regional_to_local c)) Regional_to_local)
893+
| Regional_to_local, Join_with c ->
894+
Some (compose dst (Join_with (regional_to_local c)) Regional_to_local)
895+
| Regional_to_global, Join_with c ->
896+
Some (compose dst (Join_with (regional_to_global c)) Regional_to_global)
897+
| Regional_to_global, Meet_with c ->
898+
Some (compose dst (Meet_with (regional_to_global c)) Regional_to_global)
899+
| Local_to_regional, Meet_with c ->
900+
Some (compose dst (Meet_with (local_to_regional c)) Local_to_regional)
901+
| Local_to_regional, Join_with c ->
902+
Some (compose dst (Join_with (local_to_regional c)) Local_to_regional)
903+
| Global_to_regional, Meet_with c ->
904+
Some (compose dst (Meet_with (global_to_regional c)) Global_to_regional)
905+
| Global_to_regional, Join_with c ->
906+
Some (compose dst (Join_with (global_to_regional c)) Global_to_regional)
907+
| Locality_as_regionality, Meet_with c ->
908+
Some (compose dst (Meet_with (locality_as_regionality c)) Locality_as_regionality)
909+
| Locality_as_regionality, Join_with c ->
910+
Some (compose dst (Join_with (locality_as_regionality c)) Locality_as_regionality)
911+
| Unique_to_linear, Meet_with c ->
912+
Some (compose dst (Meet_with (unique_to_linear c)) Unique_to_linear)
913+
| Unique_to_linear, Join_with c ->
914+
Some (compose dst (Join_with (unique_to_linear c)) Unique_to_linear)
915+
| Linear_to_unique, Meet_with c ->
916+
Some (compose dst (Meet_with (linear_to_unique c)) Linear_to_unique)
917+
| Linear_to_unique, Join_with c ->
918+
Some (compose dst (Join_with (linear_to_unique c)) Linear_to_unique)
919+
| Map_comonadic f, Join_with c ->
920+
let dst0 = proj_obj Areality dst in
921+
let areality, linearity = c in
922+
Some (compose dst (Join_with (min_with dst Linearity linearity))
923+
(Map_comonadic (compose dst0 f (Join_with areality)))
924+
)
925+
| Map_comonadic f, Meet_with c ->
926+
let dst0 = proj_obj Areality dst in
927+
let areality, linearity = c in
928+
Some (compose dst (Meet_with (max_with dst Linearity linearity))
929+
(Map_comonadic (compose dst0 f (Meet_with areality)))
930+
)
885931
| Regional_to_global, Locality_as_regionality -> Some Id
886932
| Regional_to_global, Local_to_regional -> Some (Meet_with Locality.Global)
887933
| Local_to_regional, Regional_to_local -> None

0 commit comments

Comments
 (0)