@@ -405768,8 +405768,8 @@ let flattern_tuple_pattern_vb
405768405768 let pvb_pat = self.pat self vb.pvb_pat in
405769405769 let pvb_expr = self.expr self vb.pvb_expr in
405770405770 let pvb_attributes = self.attributes self vb.pvb_attributes in
405771- match pvb_pat.ppat_desc with
405772- | Ppat_tuple xs when List.for_all is_simple_pattern xs ->
405771+ match pvb_pat.ppat_desc, pvb_expr.pexp_desc with
405772+ | Ppat_tuple xs, _ when List.for_all is_simple_pattern xs ->
405773405773 begin match Ast_open_cxt.destruct_open_tuple pvb_expr [] with
405774405774 | Some (wholes, es, tuple_attributes)
405775405775 when
@@ -405793,6 +405793,22 @@ let flattern_tuple_pattern_vb
405793405793 pvb_loc = vb.pvb_loc;
405794405794 pvb_attributes} :: acc
405795405795 end
405796+ | Ppat_record (lid_pats,_), Pexp_pack {pmod_desc= Pmod_ident id}
405797+ ->
405798+ Ext_list.map_append lid_pats acc (fun (lid,pat) ->
405799+ match lid.txt with
405800+ | Lident s ->
405801+ {
405802+ pvb_pat = pat;
405803+ pvb_expr =
405804+ Ast_helper.Exp.ident ~loc:lid.loc
405805+ ({lid with txt = Ldot(id.txt,s)});
405806+ pvb_attributes = [];
405807+ pvb_loc = pat.ppat_loc;
405808+ }
405809+ | _ ->
405810+ Location.raise_errorf ~loc:lid.loc "Not supported pattern match on modules"
405811+ )
405796405812 | _ ->
405797405813 {pvb_pat ;
405798405814 pvb_expr ;
@@ -406048,13 +406064,17 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
406048406064 pvb_attributes;
406049406065 pvb_loc = _}], body)
406050406066 ->
406051- default_expr_mapper self
406052- {e with
406053- pexp_desc = Pexp_match(pvb_expr,
406054- [{pc_lhs = p; pc_guard = None;
406055- pc_rhs = body}]);
406056- pexp_attributes = e.pexp_attributes @ pvb_attributes
406057- }
406067+ begin match pvb_expr.pexp_desc with
406068+ | Pexp_pack _ -> default_expr_mapper self e
406069+ | _ ->
406070+ default_expr_mapper self
406071+ {e with
406072+ pexp_desc = Pexp_match(pvb_expr,
406073+ [{pc_lhs = p; pc_guard = None;
406074+ pc_rhs = body}]);
406075+ pexp_attributes = e.pexp_attributes @ pvb_attributes
406076+ }
406077+ end
406058406078 (* let [@warning "a"] {a;b} = c in body
406059406079 The attribute is attached to value binding,
406060406080 after the transformation value binding does not exist so we attach
0 commit comments