File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
testsuite/tests/typing-local Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1090,6 +1090,13 @@ let foo x =
1090
1090
val foo : string -> unit = <fun>
1091
1091
|}]
1092
1092
1093
+ let foo x =
1094
+ let local_ f () = 42 in
1095
+ f () [@nontail]
1096
+ [%%expect{|
1097
+ val foo : 'a -> int = <fun>
1098
+ |}]
1099
+
1093
1100
(* Cannot call local values in tail calls *)
1094
1101
1095
1102
let foo x =
Original file line number Diff line number Diff line change @@ -3500,12 +3500,13 @@ and type_expect_
3500
3500
{ exp with exp_loc = loc }
3501
3501
| Pexp_apply (sfunct , sargs ) ->
3502
3502
assert (sargs <> [] );
3503
+ let position = apply_position env expected_mode sexp in
3503
3504
let funct_mode, funct_expected_mode =
3504
- match expected_mode. position with
3505
+ match position with
3505
3506
| Tail ->
3506
3507
let mode = Value_mode. local_to_regional (Value_mode. newvar () ) in
3507
3508
mode, mode_tailcall_function mode
3508
- | Nontail ->
3509
+ | Nontail | Default ->
3509
3510
let mode = Value_mode. newvar () in
3510
3511
mode, mode_nontail mode
3511
3512
in
@@ -3554,7 +3555,6 @@ and type_expect_
3554
3555
| _ ->
3555
3556
funct, sargs
3556
3557
in
3557
- let position = apply_position env expected_mode sexp in
3558
3558
begin_def () ;
3559
3559
let (args, ty_res, position) =
3560
3560
type_application env loc expected_mode position funct funct_mode sargs
You can’t perform that action at this time.
0 commit comments