Skip to content

Commit 9d6b985

Browse files
committed
cleanup
1 parent c853515 commit 9d6b985

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

compiler/ext/warnings.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ let message = function
477477
"Ambiguous or-pattern variables under guard;\n\
478478
%s may match different arguments. (See manual section 8.5)"
479479
msg
480-
| Unused_module s ->
481-
(* TODO(actions) Remove module *)
482-
"unused module " ^ s ^ "."
480+
| Unused_module s -> "unused module " ^ s ^ "."
483481
| Constraint_on_gadt ->
484482
"Type constraints do not apply to GADT cases of variant types."
485483
| Bs_unused_attribute s ->

compiler/ml/cmt_utils.ml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,24 @@ let emit_possible_actions_from_warning loc w =
8383
| Unused_module _ ->
8484
add_possible_action
8585
{loc; action = RemoveUnusedModule; description = "Remove unused module"}
86-
| Unused_pat -> (* TODO: Remove full pattern. *) ()
87-
| Unused_argument ->
88-
(* TODO(actions) Remove unused argument or prefix with underscore *) ()
8986
| Unused_rec_flag ->
9087
add_possible_action
9188
{loc; action = RemoveRecFlag; description = "Remove rec flag"}
9289
| Open_shadow_identifier _ | Open_shadow_label_constructor _ ->
9390
add_possible_action {loc; action = ForceOpen; description = "Force open"}
91+
(*
92+
93+
=== TODO ===
94+
95+
*)
96+
| Fragile_literal_pattern ->
97+
(* Use explicit pattern matching instead of literal *) ()
98+
| Unused_pat -> (* Remove pattern *) ()
99+
| Unused_argument -> (* Remove unused argument or prefix with underscore *) ()
100+
| Useless_record_with -> (* Remove `...` spread *) ()
101+
| Nonoptional_label _ -> (* Add `?` to make argument optional *) ()
102+
| Bs_toplevel_expression_unit _ ->
103+
(* Assign to let _ = or pipe to ignore() *) ()
94104
| _ -> ()
95105

96106
let _ =

compiler/ml/env.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,6 @@ and store_type ~check id info env =
16601660
if not (ty = "" || ty.[0] = '_') then
16611661
Delayed_checks.add_delayed_check (fun () ->
16621662
if (not (is_in_signature env)) && not used.cu_positive then
1663-
(* TODO(actions) Remove unused constructor *)
16641663
Location.prerr_warning loc
16651664
(Warnings.Unused_constructor
16661665
(c, used.cu_pattern, used.cu_privatize)))))
@@ -1706,7 +1705,6 @@ and store_extension ~check id ext env =
17061705
Hashtbl.add used_constructors k (add_constructor_usage used);
17071706
Delayed_checks.add_delayed_check (fun () ->
17081707
if (not (is_in_signature env)) && not used.cu_positive then
1709-
(* TODO(actions) Remove unused extension *)
17101708
Location.prerr_warning loc
17111709
(Warnings.Unused_extension
17121710
(n, ext.ext_is_exception, used.cu_pattern, used.cu_privatize)))));

compiler/ml/typecore.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,6 @@ and type_pat_aux ~constrs ~labels ~no_existentials ~mode ~explode ~env sp
14051405
(match sargs with
14061406
| [({ppat_desc = Ppat_constant _} as sp)]
14071407
when Builtin_attributes.warn_on_literal_pattern constr.cstr_attributes ->
1408-
(* TODO(actions) Use explicit pattern matching instead of literal *)
14091408
Location.prerr_warning sp.ppat_loc Warnings.Fragile_literal_pattern
14101409
| _ -> ());
14111410
if List.length sargs <> constr.cstr_arity then
@@ -2779,7 +2778,6 @@ and type_expect_ ~context ?in_function ?(recarg = Rejected) env sexp ty_expected
27792778
in
27802779
let opt_exp =
27812780
if List.length lid_sexp_list = num_fields then (
2782-
(* TODO(actions) Remove `...` spread *)
27832781
Location.prerr_warning loc Warnings.Useless_record_with;
27842782
None)
27852783
else opt_exp
@@ -3718,7 +3716,6 @@ and type_application ~context total_app env funct (sargs : sargs) :
37183716
else (sargs, (l, ty, lv) :: omitted, None)
37193717
| Some (l', sarg0, sargs) ->
37203718
if (not optional) && is_optional_loc l' then
3721-
(* TODO(actions) Add ? to make argument optional *)
37223719
Location.prerr_warning sarg0.pexp_loc
37233720
(Warnings.Nonoptional_label (Printtyp.string_of_label l));
37243721
( sargs,
@@ -4309,7 +4306,6 @@ let type_expression ~context env sexp =
43094306
| Pexp_apply _ -> Some (return_type, FunctionCall)
43104307
| _ -> Some (return_type, Other)))
43114308
| Tags _ ->
4312-
(* TODO(actions) Assign to let _ = or pipe to ignore() *)
43134309
Location.prerr_warning sexp.pexp_loc (Bs_toplevel_expression_unit None));
43144310
end_def ();
43154311
if not (is_nonexpansive exp) then generalize_expansive env exp.exp_type;

compiler/ml/typetexp.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ let did_you_mean ppf choices : bool * string list =
731731
match choices () with
732732
| [] -> (false, [])
733733
| last :: rev_rest as choices ->
734-
(* TODO(actions) Rewrite ident *)
735734
Format.fprintf ppf "@[<v 2>@,@,@{<info>Hint: Did you mean %s%s%s?@}@]"
736735
(String.concat ", " (List.rev rev_rest))
737736
(if rev_rest = [] then "" else " or ")
@@ -778,7 +777,7 @@ let report_error env ppf = function
778777
Printtyp.longident lid;
779778
let has_candidate, _ = super_spellcheck ppf Env.fold_types env lid in
780779
if not has_candidate then
781-
(* TODO(actions) Add rec flag *)
780+
(* TODO(actions) Add rec flag by first checking the let bindings for matching name *)
782781
Format.fprintf ppf
783782
"If you wanted to write a recursive type, don't forget the `rec` in \
784783
`type rec`@]"

0 commit comments

Comments
 (0)