diff --git a/ocaml/testsuite/tests/typing-local/crossing.ml b/ocaml/testsuite/tests/typing-local/crossing.ml index 352dc723f42..c3c77a7429d 100644 --- a/ocaml/testsuite/tests/typing-local/crossing.ml +++ b/ocaml/testsuite/tests/typing-local/crossing.ml @@ -343,4 +343,4 @@ module M : sig type t [@@immediate] end type t2 = { x : int; } [@@unboxed] val f : local_ M.t -> M.t = val f : local_ t2 -> t2 = -|}] +|}] diff --git a/ocaml/testsuite/tests/typing-local/crossing_64.ml b/ocaml/testsuite/tests/typing-local/crossing_64.ml new file mode 100644 index 00000000000..e38011d1db1 --- /dev/null +++ b/ocaml/testsuite/tests/typing-local/crossing_64.ml @@ -0,0 +1,14 @@ +(* TEST + * arch64 + ** expect *) + +(* Mode crossing works on immediate64 types *) +module F (M : sig type t [@@immediate64] end) = struct + let f : local_ M.t -> _ = fun t -> t +end + +[%%expect{| +module F : + functor (M : sig type t [@@immediate64] end) -> + sig val f : local_ M.t -> M.t end +|}] diff --git a/ocaml/typing/typecore.ml b/ocaml/typing/typecore.ml index 352c0ae8704..6d2f7783376 100644 --- a/ocaml/typing/typecore.ml +++ b/ocaml/typing/typecore.ml @@ -559,7 +559,7 @@ let mode_cross env (ty : type_expr) mode = if is_principal ty then begin match immediacy env ty with | Type_immediacy.Always -> Value_mode.newvar () - | Type_immediacy.Always_on_64bits when !Clflags.native_code && Sys.word_size = 64 -> + | Type_immediacy.Always_on_64bits when Sys.word_size = 64 -> Value_mode.newvar () (* floating and relaxed *) | _ -> mode end