Skip to content

Commit 0006b3e

Browse files
riaqnmshinwell
authored andcommitted
flambda-backend: Fix arrow printing when closing over unknown mode (#1744)
1 parent 226d6ac commit 0006b3e

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

testsuite/tests/typing-local/local.ml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,3 +2630,33 @@ Error: This local value escapes its region
26302630
Hint: This is a partial application
26312631
Adding 1 more argument will make the value non-local
26322632
|}]
2633+
2634+
(* Reported internal to Jane Street as COMPILERS-1504 *)
2635+
2636+
module M : sig
2637+
val f : string -> string -> local_ string
2638+
end = struct
2639+
let g x y = local_ "foo"
2640+
let f x = local_ g x
2641+
end;;
2642+
[%%expect{|
2643+
Lines 3-6, characters 6-3:
2644+
3 | ......struct
2645+
4 | let g x y = local_ "foo"
2646+
5 | let f x = local_ g x
2647+
6 | end..
2648+
Error: Signature mismatch:
2649+
Modules do not match:
2650+
sig
2651+
val g : 'a -> 'b -> local_ string
2652+
val f : 'a -> local_ ('b -> local_ string)
2653+
end
2654+
is not included in
2655+
sig val f : string -> string -> local_ string end
2656+
Values do not match:
2657+
val f : 'a -> local_ ('b -> local_ string)
2658+
is not included in
2659+
val f : string -> string -> local_ string
2660+
The type string -> local_ (string -> local_ string)
2661+
is not compatible with the type string -> string -> local_ string
2662+
|}]

typing/oprint.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,11 @@ and print_out_arg am ppf ty =
337337
and print_out_ret mode rm ppf ty =
338338
match mode, rm with
339339
| Oam_local, Oam_local
340-
| Oam_global, Oam_global
341-
| Oam_unknown, _
342-
| _, Oam_unknown -> print_out_type_1 rm ppf ty
340+
| Oam_global, Oam_global -> print_out_type_1 rm ppf ty
343341
| _, Oam_local ->
344342
print_out_type_local rm ppf ty
345343
| _, Oam_global -> print_out_type_2 rm ppf ty
344+
| _, Oam_unknown -> print_out_type_1 rm ppf ty
346345

347346
and print_out_type_local m ppf ty =
348347
if Language_extension.is_enabled Local then begin

0 commit comments

Comments
 (0)