Skip to content

Commit 4f4eee0

Browse files
authored
chore(compiler): Clean up duplicate Warnings.is_active checks (#2278)
1 parent 7d4fd44 commit 4f4eee0

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

compiler/src/parsing/well_formedness.re

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -850,18 +850,14 @@ let array_index_non_integer = (errs, super) => {
850850
switch (number_type) {
851851
| PConstNumberFloat({txt}) =>
852852
let warning = Warnings.ArrayIndexNonInteger(txt);
853-
if (Warnings.is_active(warning)) {
854-
Location.prerr_warning(loc, warning);
855-
};
853+
Location.prerr_warning(loc, warning);
856854
| PConstNumberRational({
857855
numerator: {txt: numerator},
858856
denominator: {txt: denominator},
859857
}) =>
860858
let warning =
861859
Warnings.ArrayIndexNonInteger(numerator ++ "/" ++ denominator);
862-
if (Grain_utils.Warnings.is_active(warning)) {
863-
Location.prerr_warning(loc, warning);
864-
};
860+
Location.prerr_warning(loc, warning);
865861
| _ => ()
866862
}
867863
| _ => ()

compiler/src/typed/parmatch.re

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,10 +2033,7 @@ let do_check_partial = (~pred, loc, casel: list(match_branch), pss) =>
20332033
*/
20342034
switch (casel) {
20352035
| [] => ()
2036-
| _ =>
2037-
if (Warnings.is_active(Warnings.AllClausesGuarded)) {
2038-
Location.prerr_warning(loc, Warnings.AllClausesGuarded);
2039-
}
2036+
| _ => Location.prerr_warning(loc, Warnings.AllClausesGuarded)
20402037
};
20412038
Partial;
20422039
| [ps, ..._] =>

compiler/src/typed/typed_well_formedness.re

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,7 @@ module WellFormednessArg: TypedtreeIter.IteratorArgument = {
273273
Printf.sprintf("%s.(%s)", typeName, func),
274274
typeName,
275275
);
276-
if (Grain_utils.Warnings.is_active(warning)) {
277-
Grain_parsing.Location.prerr_warning(exp_loc, warning);
278-
};
276+
Grain_parsing.Location.prerr_warning(exp_loc, warning);
279277
}
280278
// Check: Warn if using Pervasives print on WasmXX types
281279
| TExpApp(
@@ -296,9 +294,7 @@ module WellFormednessArg: TypedtreeIter.IteratorArgument = {
296294
| Some({arg_expr}) =>
297295
let typeName = resolve_unsafe_type(arg_expr);
298296
let warning = Grain_utils.Warnings.PrintUnsafe(typeName);
299-
if (Grain_utils.Warnings.is_active(warning)) {
300-
Grain_parsing.Location.prerr_warning(exp_loc, warning);
301-
};
297+
Grain_parsing.Location.prerr_warning(exp_loc, warning);
302298
| _ => ()
303299
}
304300
// Check: Warn if using Pervasives toString on WasmXX types
@@ -323,9 +319,7 @@ module WellFormednessArg: TypedtreeIter.IteratorArgument = {
323319
| Some({arg_expr}) =>
324320
let typeName = resolve_unsafe_type(arg_expr);
325321
let warning = Grain_utils.Warnings.ToStringUnsafe(typeName);
326-
if (Grain_utils.Warnings.is_active(warning)) {
327-
Grain_parsing.Location.prerr_warning(exp_loc, warning);
328-
};
322+
Grain_parsing.Location.prerr_warning(exp_loc, warning);
329323
| _ => ()
330324
}
331325
// Check: Warn if using XXXX.fromNumber(<literal>)
@@ -381,9 +375,7 @@ module WellFormednessArg: TypedtreeIter.IteratorArgument = {
381375
};
382376
let warning =
383377
Grain_utils.Warnings.FromNumberLiteral(mod_type, modname, n_str);
384-
if (Grain_utils.Warnings.is_active(warning)) {
385-
Grain_parsing.Location.prerr_warning(exp_loc, warning);
386-
};
378+
Grain_parsing.Location.prerr_warning(exp_loc, warning);
387379
| _ => ()
388380
};
389381
// Check: Forbid usage of WasmXX types outside of disableGC context

0 commit comments

Comments
 (0)