The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Made a distinction in the warnings between types and type variables

JJ : Replace "variable" by "alias"

samsa1 b2ae919d 93a3fbc3

+21 -9
+2 -2
testsuite/tests/typing-warnings/unused_types.ml
··· 679 679 Line 1, characters 19-27: 680 680 1 | let f (x1 : int as 'unused1) (x2 : int as 'unused2) 681 681 ^^^^^^^^ 682 - Warning 34 [unused-type-declaration]: unused type "'unused1". 682 + Warning 34 [unused-type-declaration]: unused type alias "'unused1". 683 683 684 684 Line 1, characters 42-50: 685 685 1 | let f (x1 : int as 'unused1) (x2 : int as 'unused2) 686 686 ^^^^^^^^ 687 - Warning 34 [unused-type-declaration]: unused type "'unused2". 687 + Warning 34 [unused-type-declaration]: unused type alias "'unused2". 688 688 689 689 val f : int -> int -> int -> int -> 'used2 -> int * int * int * int * 'used2 = 690 690 <fun>
+1 -1
typing/env.ml
··· 2004 2004 let loc = info.type_loc in 2005 2005 if check then 2006 2006 check_usage loc id info.type_uid 2007 - (fun s -> Warnings.Unused_type_declaration s) 2007 + (fun s -> Warnings.Unused_type_declaration (s, Warnings.Declaration)) 2008 2008 !type_declarations; 2009 2009 let descrs, env = 2010 2010 let path = Pident id in
+1 -1
typing/typedecl.ml
··· 1125 1125 (* Translate each declaration. *) 1126 1126 let current_slot = ref None in 1127 1127 let warn_unused = 1128 - Warnings.is_active (Warnings.Unused_type_declaration "") in 1128 + Warnings.(is_active (Unused_type_declaration ("", Declaration))) in 1129 1129 let ids_slots (id, _uid as ids) = 1130 1130 match rec_flag with 1131 1131 | Asttypes.Recursive when warn_unused ->
+3 -2
typing/typetexp.ml
··· 281 281 assert (not_generic v); 282 282 let unused = match check with 283 283 | Some check_loc 284 - when Warnings.is_active (Warnings.Unused_type_declaration "") -> 284 + when Warnings.(is_active (Unused_type_declaration ("", Alias))) -> 285 285 let unused = ref true in 286 286 !Env.add_delayed_check_forward begin fun () -> 287 - let warn = Warnings.Unused_type_declaration ("'" ^ name) in 287 + let warn = Warnings.(Unused_type_declaration ("'" ^ name, Alias)) 288 + in 288 289 if !unused && Warnings.is_active warn 289 290 then Location.prerr_warning check_loc warn 290 291 end;
+9 -2
utils/warnings.ml
··· 34 34 | Not_constructed 35 35 | Only_exported_private 36 36 37 + type type_declaration_usage_warning = 38 + | Declaration 39 + | Alias 40 + 37 41 type t = 38 42 | Comment_start (* 1 *) 39 43 | Comment_not_end (* 2 *) ··· 69 73 was turned into a hard error *) 70 74 | Unused_value_declaration of string (* 32 *) 71 75 | Unused_open of string (* 33 *) 72 - | Unused_type_declaration of string (* 34 *) 76 + | Unused_type_declaration of string * type_declaration_usage_warning (* 34 *) 73 77 | Unused_for_index of string (* 35 *) 74 78 | Unused_ancestor of string (* 36 *) 75 79 | Unused_constructor of string * constructor_usage_warning (* 37 *) ··· 1011 1015 msg "unused value %a." Style.inline_code v 1012 1016 | Unused_open s -> msg "unused open %a." Style.inline_code s 1013 1017 | Unused_open_bang s -> msg "unused open! %a." Style.inline_code s 1014 - | Unused_type_declaration s -> msg "unused type %a." Style.inline_code s 1018 + | Unused_type_declaration (s, Declaration) -> 1019 + msg "unused type %a." Style.inline_code s 1020 + | Unused_type_declaration (s, Alias) -> 1021 + msg "unused type alias %a." Style.inline_code s 1015 1022 | Unused_for_index s -> msg "unused for-loop index %a." Style.inline_code s 1016 1023 | Unused_ancestor s -> msg "unused ancestor variable %a." Style.inline_code s 1017 1024 | Unused_constructor (s, Unused) ->
+5 -1
utils/warnings.mli
··· 39 39 | Not_constructed 40 40 | Only_exported_private 41 41 42 + type type_declaration_usage_warning = 43 + | Declaration 44 + | Alias 45 + 42 46 type t = 43 47 | Comment_start (* 1 *) 44 48 | Comment_not_end (* 2 *) ··· 76 80 | Duplicate_definitions of string * string * string * string (* 30 *) 77 81 | Unused_value_declaration of string (* 32 *) 78 82 | Unused_open of string (* 33 *) 79 - | Unused_type_declaration of string (* 34 *) 83 + | Unused_type_declaration of string * type_declaration_usage_warning (* 34 *) 80 84 | Unused_for_index of string (* 35 *) 81 85 | Unused_ancestor of string (* 36 *) 82 86 | Unused_constructor of string * constructor_usage_warning (* 37 *)