|  | 
| 1 | 1 | open Parsetree | 
| 2 | 2 | 
 | 
| 3 |  | -let attrs_string attrs = | 
| 4 |  | -  List.map (fun (attr, _) -> print_endline attr.Asttypes.txt) attrs | 
| 5 |  | - | 
| 6 |  | -let ident_string ident = | 
| 7 |  | -  match ident with | 
| 8 |  | -  | Longident.Lident v -> v | 
| 9 |  | -  | Longident.Ldot (_, v) -> v | 
| 10 |  | -  | Longident.Lapply _ -> "Lapply" | 
| 11 |  | - | 
| 12 |  | -let print_ct ct = | 
| 13 |  | -  match ct with | 
| 14 |  | -  | {ptyp_desc = Ptyp_constr (ident, _); ptyp_attributes = attrs} -> | 
| 15 |  | -    let _ = | 
| 16 |  | -      print_endline | 
| 17 |  | -        ("Ptyp_constr: " ^ ident_string ident.txt ^ " attrs: " | 
| 18 |  | -        ^ string_of_int (List.length attrs)) | 
| 19 |  | -    in | 
| 20 |  | -    let _ = attrs_string attrs in | 
| 21 |  | -    () | 
| 22 |  | -  | {ptyp_desc = Ptyp_arrow _; ptyp_attributes = attrs} -> | 
| 23 |  | -    print_endline | 
| 24 |  | -      ("Ptyp_arrow: " ^ " attrs: " ^ string_of_int (List.length attrs)) | 
| 25 |  | -  | {ptyp_desc = Ptyp_variant _} -> print_endline "Ptyp_variant" | 
| 26 |  | -  | _ -> print_endline "Something else" | 
| 27 |  | - | 
| 28 | 3 | let arrow_type ?(arity = max_int) ?(attrs = []) ct = | 
| 29 | 4 |   let has_as_attr attrs = | 
| 30 | 5 |     Ext_list.exists attrs (fun (x, _) -> x.Asttypes.txt = "as") | 
| @@ -72,7 +47,7 @@ let arrow_type ?(arity = max_int) ?(attrs = []) ct = | 
| 72 | 47 |   match ct with | 
| 73 | 48 |   | {ptyp_desc = Ptyp_arrow (Nolabel, _typ1, _typ2); ptyp_attributes = attrs1} | 
| 74 | 49 |     as typ -> | 
| 75 |  | -    let attrs = List.concat [attrs; attrs1] in | 
|  | 50 | +    let attrs = attrs @ attrs1 in | 
| 76 | 51 |     process attrs [] {typ with ptyp_attributes = []} arity | 
| 77 | 52 |   | typ -> process attrs [] typ arity | 
| 78 | 53 | 
 | 
|  | 
0 commit comments