Module Melange_compiler_libs.Warnings

Warning definitions

Warning: this module is unstable and part of compiler-libs.

type loc = Melange_wrapper.Warnings.loc = {
  1. loc_start: Stdlib.Lexing.position,
  2. loc_end: Stdlib.Lexing.position,
  3. loc_ghost: bool,
};
let ghost_loc_in_file: string => loc;

Return an empty ghost range located in a given file

type field_usage_warning =
  1. | Unused
  2. | Not_read
  3. | Not_mutated
;
type constructor_usage_warning =
  1. | Unused
  2. | Not_constructed
  3. | Only_exported_private
;
type t =
  1. | Comment_start
  2. | Comment_not_end
  3. | Fragile_match(string)
  4. | Ignored_partial_application
  5. | Labels_omitted(list(string))
  6. | Method_override(list(string))
  7. | Partial_match(string)
  8. | Missing_record_field_pattern(string)
  9. | Non_unit_statement
  10. | Redundant_case
  11. | Redundant_subpat
  12. | Instance_variable_override(list(string))
  13. | Illegal_backslash
  14. | Implicit_public_methods(list(string))
  15. | Unerasable_optional_argument
  16. | Undeclared_virtual_method(string)
  17. | Not_principal(string)
  18. | Non_principal_labels(string)
  19. | Ignored_extra_argument
  20. | Nonreturning_statement
  21. | Preprocessor(string)
  22. | Useless_record_with
  23. | Bad_module_name(string)
  24. | All_clauses_guarded
  25. | Unused_var(string)
  26. | Unused_var_strict(string)
  27. | Wildcard_arg_to_constant_constr
  28. | Eol_in_string
  29. | Duplicate_definitions(string, string, string, string)
  30. | Unused_value_declaration(string)
  31. | Unused_open(string)
  32. | Unused_type_declaration(string)
  33. | Unused_for_index(string)
  34. | Unused_ancestor(string)
  35. | Unused_constructor(string, constructor_usage_warning)
  36. | Unused_extension(string, bool, constructor_usage_warning)
  37. | Unused_rec_flag
  38. | Name_out_of_scope(string, list(string), bool)
  39. | Ambiguous_name(list(string), list(string), bool, string)
  40. | Disambiguated_name(string)
  41. | Nonoptional_label(string)
  42. | Open_shadow_identifier(string, string)
  43. | Open_shadow_label_constructor(string, string)
  44. | Bad_env_variable(string, string)
  45. | Attribute_payload(string, string)
  46. | Eliminated_optional_arguments(list(string))
  47. | No_cmi_file(string, option(string))
  48. | Unexpected_docstring(bool)
  49. | Fragile_literal_pattern
  50. | Misplaced_attribute(string)
  51. | Duplicated_attribute(string)
  52. | Inlining_impossible(string)
  53. | Unreachable_case
  54. | Ambiguous_var_in_pattern_guard(list(string))
  55. | Flambda_assignment_to_non_mutable_value
  56. | Unused_module(string)
  57. | Unboxable_type_in_prim_decl(string)
  58. | Constraint_on_gadt
  59. | Erroneous_printed_signature(string)
  60. | Unsafe_array_syntax_without_parsing
  61. | Redefining_unit(string)
  62. | Unused_open_bang(string)
  63. | Unused_functor_parameter(string)
  64. | Match_on_mutable_state_prevent_uncurry
  65. | Unused_field(string, field_usage_warning)
  66. | Missing_mli
  67. | Unused_tmc_attribute
  68. | Tmc_breaks_tailcall
  69. | Generative_application_expects_unit
  70. | Mel_unused_attribute(string)
  71. | Mel_polymorphic_comparison
  72. | Mel_ffi_warning(string)
  73. | Mel_derive_warning(string)
  74. | Mel_fragile_external(string)
  75. | Mel_unimplemented_primitive(string)
  76. | Mel_integer_literal_overflow
  77. | Mel_uninterpreted_delimiters(string)
  78. | Mel_toplevel_expression_unit
;
type alert = Melange_wrapper.Warnings.alert = {
  1. kind: string,
  2. message: string,
  3. def: loc,
  4. use: loc,
};
let parse_options: bool => string => option(alert);
let parse_alert_option: string => unit;

Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

let without_warnings: (unit => 'a) => 'a;

Run the thunk with all warnings and alerts disabled.

let is_active: t => bool;
let is_error: t => bool;
let defaults_w: string;
let defaults_warn_error: string;
type reporting_information = Melange_wrapper.Warnings.reporting_information = {
  1. id: string,
  2. message: string,
  3. is_error: bool,
  4. sub_locs: list((loc, string)),
};
let report: t => [ `Active(reporting_information) | `Inactive ];
let report_alert: alert => [ `Active(reporting_information) | `Inactive ];
exception Errors;
let check_fatal: unit => unit;
let reset_fatal: unit => unit;
let help_warnings: unit => unit;
type state;
let backup: unit => state;
let restore: state => unit;
let with_state: state => (unit => 'a) => 'a;
let mk_lazy: (unit => 'a) => Stdlib.Lazy.t('a);

Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

let nerrors: Stdlib.ref(int);
let message: t => string;
let number: t => int;
type description = {
  1. number: int,
  2. names: list(string),
  3. description: string,
  4. since: option(Stdlib.Sys.ocaml_release_info),
};
let descriptions: list(description);