@@ -160,7 +160,7 @@ end = struct
160160 let pat_iter (type k ) (iter : I.iterator ) (pat : k Typedtree.general_pattern ) =
161161 match pat.pat_desc with
162162 | Tpat_var (id , { loc; _ } , _ ) -> paths := Loc.Map. set ! paths loc (Pident id)
163- | Tpat_alias (pat , id , { loc; _ } , _ ) ->
163+ | Tpat_alias (pat , id , { loc; _ } , _ , _ ) ->
164164 paths := Loc.Map. set ! paths loc (Pident id);
165165 I. default_iterator.pat iter pat
166166 | _ -> I. default_iterator.pat iter pat
@@ -217,9 +217,12 @@ let beta_reduce (paths : Paths.t) (app : Parsetree.expression) =
217217 if is_pure arg then body else with_let ()
218218 | Ppat_var param | Ppat_constraint ({ ppat_desc = Ppat_var param ; _ } , _ ) ->
219219 if is_pure arg then with_subst param else with_let ()
220- | Ppat_tuple pats ->
220+ | Ppat_tuple ( pats , _ ) ->
221+ let pats = List. map ~f: snd pats in
221222 (match arg.pexp_desc with
222- | Pexp_tuple args -> List. fold_left2 ~f: beta_reduce_arg ~init: body pats args
223+ | Pexp_tuple args ->
224+ let args = List. map ~f: snd args in
225+ List. fold_left2 ~f: beta_reduce_arg ~init: body pats args
223226 | _ -> with_let () )
224227 | _ -> with_let ()
225228 in
@@ -275,16 +278,16 @@ let inline_edits pipeline task =
275278 env
276279 (iter : I.iterator )
277280 (label : Asttypes.arg_label )
278- (m_arg_expr : Typedtree.expression option )
281+ (m_arg_expr : Typedtree.apply_arg )
279282 =
280283 match label, m_arg_expr with
281284 (* handle the labeled argument shorthand `f ~x` when inlining `x` *)
282- | Labelled name, Some { exp_desc = Texp_ident (Pident id, { loc; _ }, _); _ }
285+ | Labelled name, Arg { exp_desc = Texp_ident (Pident id, { loc; _ }, _); _ }
283286 (* inlining is allowed for optional arguments that are being passed a Some
284287 parameter, i.e. `x` may be inlined in `let x = 1 in (fun ?(x = 0) -> x)
285288 ~x` *)
286289 | ( Optional name
287- , Some
290+ , Arg
288291 { exp_desc =
289292 (* construct is part of desugaring, assumed to be Some *)
290293 Texp_construct
@@ -294,13 +297,14 @@ let inline_edits pipeline task =
294297 when Ident. same task.inlined_var id && not_shadowed env ->
295298 let newText = sprintf " %s:%s" name newText in
296299 insert_edit newText loc
297- | Optional _ , Some ({ exp_desc = Texp_construct _ ; _ } as arg_expr ) ->
300+ | Optional _ , Arg ({ exp_desc = Texp_construct _ ; _ } as arg_expr ) ->
298301 iter.expr iter arg_expr
299302 (* inlining is _not_ allowed for optional arguments that are being passed an
300303 optional parameter i.e. `x` may _not_ be inlined in `let x = Some 1 in
301304 (fun ?(x = 0) -> x) ?x` *)
302- | Optional _ , Some _ -> ()
303- | _ , _ -> Option. iter m_arg_expr ~f: (iter.expr iter)
305+ | Optional _ , Arg _ -> ()
306+ | _ , Arg arg -> iter.expr iter arg
307+ | _ , _ -> ()
304308 in
305309 let paths = Paths. of_typedtree task.inlined_expr in
306310 let inlined_pexpr = find_parsetree_loc_exn pipeline task.inlined_expr.exp_loc in
0 commit comments