Commit f227150 1 parent 3d20281 commit f227150 Copy full SHA for f227150
File tree 2 files changed +13
-6
lines changed
testsuite/tests/compiler-libs
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,14 @@ run {| fun x y z -> (function w -> x y z w) |};;
67
67
run {| let foo : 'a. 'a -> 'a = fun x -> x in foo | }
68
68
69
69
[%% expect{|
70
- - : string = " let ( foo : ('a : value) . 'a -> 'a) = fun x -> x in foo"
70
+ - : string = " let foo : ('a : value) . 'a -> 'a = fun x -> x in foo"
71
71
| }];;
72
72
73
73
run {| let foo : type a . a -> a = fun x -> x in foo | }
74
74
75
75
[%% expect{|
76
76
- : string =
77
- " let ( foo : ('a : value) . 'a -> 'a) = \n fun (type a) -> ( (fun x -> x : a -> a)) in\n foo"
77
+ " let foo : ('a : value) . 'a -> 'a = fun (type a) -> ( (fun x -> x : a -> a)) in\n foo"
78
78
| }];;
79
79
80
80
(* CR: untypeast/pprintast are totally busted on programs with modes in value
@@ -89,5 +89,5 @@ Exception: Misc.Fatal_error.
89
89
run {| let foo : 'a . 'a -> 'a @@ portable = fun x -> x in foo | }
90
90
91
91
[%% expect{|
92
- - : string = " let ( foo : ('a : value) . 'a -> 'a) = fun x -> x in foo"
92
+ - : string = " let foo : ('a : value) . 'a -> 'a = fun x -> x in foo"
93
93
| }];;
Original file line number Diff line number Diff line change @@ -437,9 +437,16 @@ let case : type k . mapper -> k case -> _ = fun sub {c_lhs; c_guard; c_rhs} ->
437
437
let value_binding sub vb =
438
438
let loc = sub.location sub vb.vb_loc in
439
439
let attrs = sub.attributes sub vb.vb_attributes in
440
- Vb. mk ~loc ~attrs
441
- (sub.pat sub vb.vb_pat)
442
- (sub.expr sub vb.vb_expr)
440
+ let pat = sub.pat sub vb.vb_pat in
441
+ let pat, value_constraint, modes =
442
+ match pat.ppat_desc with
443
+ | Ppat_constraint (pat, Some ({ ptyp_desc = Ptyp_poly _; _ } as cty),
444
+ modes) ->
445
+ let constr = Pvc_constraint {locally_abstract_univars = [] ; typ = cty } in
446
+ pat, Some constr, modes
447
+ | _ -> pat, None , []
448
+ in
449
+ Vb. mk ~loc ~attrs ?value_constraint ~modes pat (sub.expr sub vb.vb_expr)
443
450
444
451
let comprehension sub comp =
445
452
let iterator = function
You can’t perform that action at this time.
0 commit comments