File tree Expand file tree Collapse file tree 2 files changed +35
-6
lines changed
Expand file tree Collapse file tree 2 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -75,13 +75,32 @@ let gen_binds e_loc l e =
7575 let loc = e_loc in
7676 match binding.pvb_constraint with
7777 | None -> [% expr (fun [%p binding .pvb_pat ] -> [% e aux (i+ 1 ) t])]
78- | Some (Pvc_constraint { locally_abstract_univars = [] ; typ } ) -> [% expr (fun ([%p binding .pvb_pat ] : [%t typ] ) -> [% e aux (i+ 1 ) t])]
79- (*
80- | Some (Pvc_constraint { locally_abstract_univars = _::_; typ= _}) -> failwith "what to do here"
81- | Some (Pvc_coercion { ground = None; coercion }) -> [%expr (fun ([%p binding.pvb_pat] :> [%t coercion]) -> [%e aux (i+1) t])]
82- | Some (Pvc_coercion { ground = Some ground; coercion }) -> [%expr (fun ([%p binding.pvb_pat] : [%t ground] :> [%t coercion]) -> [%e aux (i+1) t])]
78+ | Some (Pvc_constraint { locally_abstract_univars = [] ; typ } ) ->
79+ [% expr (fun ([%p binding .pvb_pat ] : [%t typ] ) -> [% e aux (i+ 1 ) t])]
80+ (* TODO: I don't know how to trigger this
81+ | Some constraint_ pv ->
82+ begin match binding.pvb_pat.ppat_desc with
83+ | Ppat_var pv ->
84+ let e =
85+ let open Ast_builder.Default in
86+ pexp_let ~loc
87+ Nonrecursive
88+ [
89+ Latest.value_binding ~constraint_
90+ ~loc
91+ ~pat:binding.pvb_pat
92+ ~expr:(pexp_ident ~loc {loc=pv.loc; txt=Lident pv.txt})
93+ ()
94+ ]
95+ (aux (i+1) t)
96+ in
97+ [%expr (fun [%p binding.pvb_pat] -> [%e e])]
98+ | _ ->
99+ Location.Error.(raise (make ~loc "unsupported value binding constraint" ~sub:[]))
100+ end
83101*)
84- | _ -> failwith " WIP: what to do here"
102+ | _ ->
103+ Location.Error. (raise (make ~loc " unsupported value binding constraint" ~sub: [] ))
85104 in
86105 let new_exp =
87106 let loc = e_loc in
Original file line number Diff line number Diff line change @@ -171,6 +171,16 @@ let suite = suite "ppx" [
171171 let % lwt (_ : int ) = Lwt. return 0 in
172172 Lwt. return_true
173173 ) ;
174+ test " 1085-int-again"
175+ (fun () ->
176+ let % lwt _ : int = Lwt. return 0 in
177+ Lwt. return_true
178+ ) ;
179+ test " 1085-any"
180+ (fun () ->
181+ let % lwt _ : _ = Lwt. return 0 in
182+ Lwt. return_true
183+ ) ;
174184]
175185
176186let _ = Test. run " ppx" [ suite ]
You can’t perform that action at this time.
0 commit comments