Skip to content

Commit

Permalink
Fix arrow printing when closing over unknown mode (#1744)
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn authored Aug 15, 2023
1 parent a052e10 commit 8bdbcf9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
30 changes: 30 additions & 0 deletions ocaml/testsuite/tests/typing-local/local.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2630,3 +2630,33 @@ Error: This local value escapes its region
Hint: This is a partial application
Adding 1 more argument will make the value non-local
|}]
(* Reported internal to Jane Street as COMPILERS-1504 *)
module M : sig
val f : string -> string -> local_ string
end = struct
let g x y = local_ "foo"
let f x = local_ g x
end;;
[%%expect{|
Lines 3-6, characters 6-3:
3 | ......struct
4 | let g x y = local_ "foo"
5 | let f x = local_ g x
6 | end..
Error: Signature mismatch:
Modules do not match:
sig
val g : 'a -> 'b -> local_ string
val f : 'a -> local_ ('b -> local_ string)
end
is not included in
sig val f : string -> string -> local_ string end
Values do not match:
val f : 'a -> local_ ('b -> local_ string)
is not included in
val f : string -> string -> local_ string
The type string -> local_ (string -> local_ string)
is not compatible with the type string -> string -> local_ string
|}]
5 changes: 2 additions & 3 deletions ocaml/typing/oprint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,11 @@ and print_out_arg am ppf ty =
and print_out_ret mode rm ppf ty =
match mode, rm with
| Oam_local, Oam_local
| Oam_global, Oam_global
| Oam_unknown, _
| _, Oam_unknown -> print_out_type_1 rm ppf ty
| Oam_global, Oam_global -> print_out_type_1 rm ppf ty
| _, Oam_local ->
print_out_type_local rm ppf ty
| _, Oam_global -> print_out_type_2 rm ppf ty
| _, Oam_unknown -> print_out_type_1 rm ppf ty

and print_out_type_local m ppf ty =
if Language_extension.is_enabled Local then begin
Expand Down

0 comments on commit 8bdbcf9

Please sign in to comment.