Skip to content

Commit 135f3b2

Browse files
authored
Remove warnings that no longer exist from Bsc_warnings.default_w (#7413)
* Remove warnings 40, 42 and 61 from the list of default warnings * Remove description for warning 61 as it no longer exists * Update descriptions of warnings in default list * Add CHANGELOG entry * Remove descriptions for removed warnings 51 and 6 * s/OCaml/ReScript * Format
1 parent 955b9ae commit 135f3b2

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#### :house: Internal
4444

4545
- Better representation of JSX in AST. https://github.com/rescript-lang/rescript/pull/7286
46+
- Clean up default warnings. https://github.com/rescript-lang/rescript/pull/7413
4647

4748
#### :nail_care: Polish
4849

compiler/ext/bsc_warnings.ml

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,31 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
(**
26-
See the meanings of the warning codes here: https://caml.inria.fr/pub/docs/manual-ocaml/comp.html#sec281
27-
28-
- 30 Two labels or constructors of the same name are defined in two mutually recursive types.
29-
- 40 Constructor or label name used out of scope.
30-
31-
- 6 Label omitted in function application.
32-
- 7 Method overridden.
33-
- 9 Missing fields in a record pattern. (*Not always desired, in some cases need [@@@warning "+9"] *)
34-
- 27 Innocuous unused variable: unused variable that is not bound with let nor as, and doesn’t start with an underscore (_) character.
35-
- 29 Unescaped end-of-line in a string constant (non-portable code).
36-
- 32 .. 39 Unused blabla
37-
- 44 Open statement shadows an already defined identifier.
38-
- 45 Open statement shadows an already defined label or constructor.
39-
- 48 Implicit elimination of optional arguments. https://caml.inria.fr/mantis/view.php?id=6352
40-
- 101 (bsb-specific) unsafe polymorphic comparison.
41-
*)
42-
4325
(*
44-
The purpose of default warning set is to make it strict while
45-
not annoy user too much
26+
The purpose of the default warning set is to make it strict while not annoying the user too much.
4627
47-
-4 Fragile pattern matching: matching that will remain complete even if additional con- structors are added to one of the variant types matched.
48-
We turn it off since common pattern
28+
- 4 Fragile pattern matching: matching that will remain complete even if additional constructors are added to one of the variant types matched.
29+
We turn it off since the following is a common pattern:
4930
{[
50-
match x with | A -> .. | _ -> false
31+
switch x { | A => .. | _ => false }
5132
]}
5233
53-
-9 Missing fields in a record pattern.
54-
only in some special cases that we need all fields being listed
34+
- 9 Missing fields in a record pattern.
35+
Only in some special cases that we need all fields being listed
5536
56-
We encourage people to write code based on type based disambigution
57-
40,41,42 are enabled for compatiblity reasons
58-
-40 Constructor or label name used out of scope
59-
This is intentional, we should never warn it
6037
- 41 Ambiguous constructor or label name.
6138
It is turned off since it prevents such cases below:
6239
{[
63-
type a = A |B
40+
type a = A | B
6441
type b = A | B | C
6542
]}
66-
- 42 Disambiguated constructor or label name (compatibility warning).
6743
6844
- 50 Unexpected documentation comment.
6945
70-
- 102 Bs_polymorphic_comparison
46+
- 102 Bs_polymorphic_comparison.
7147
*)
7248
(* If you change this, don't forget to adapt docs/docson/build-schema.json as well. *)
73-
let defaults_w = "+a-4-9-20-40-41-42-50-61-102"
49+
let defaults_w = "+a-4-9-20-41-50-102"
7450

7551
let defaults_warn_error = "-a+5+6+101+109"
7652
(*TODO: add +10*)

compiler/ext/warnings.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@ let descriptions =
583583
( 5,
584584
"Partially applied function: expression whose result has function\n\
585585
\ type and is ignored." );
586-
(6, "Label omitted in function application.");
587586
(7, "Method overridden.");
588587
(8, "Partial match: missing cases in pattern-matching.");
589588
(9, "Missing fields in a record pattern.");
@@ -604,8 +603,8 @@ let descriptions =
604603
(22, "Preprocessor warning.");
605604
(23, "Useless record \"with\" clause.");
606605
( 24,
607-
"Bad module name: the source file name is not a valid OCaml module name."
608-
);
606+
"Bad module name: the source file name is not a valid ReScript module \
607+
name." );
609608
(25, "Deprecated: now part of warning 8.");
610609
( 26,
611610
"Suspicious unused variable: unused variable that is bound\n\
@@ -638,7 +637,6 @@ let descriptions =
638637
(48, "Implicit elimination of optional arguments.");
639638
(49, "Absent cmi file when looking up module alias.");
640639
(50, "Unexpected documentation comment.");
641-
(51, "Warning on non-tail calls if @tailcall present.");
642640
(52, "Fragile constant pattern.");
643641
(53, "Attribute cannot appear in this context");
644642
(54, "Attribute used more than once on an expression");
@@ -647,7 +645,6 @@ let descriptions =
647645
(57, "Ambiguous or-pattern variables under guard");
648646
(59, "Assignment to non-mutable value");
649647
(60, "Unused module declaration");
650-
(61, "Unboxable type in primitive declaration");
651648
(62, "Type constraint on GADT type declaration");
652649
(101, "Unused bs attributes");
653650
(102, "Polymorphic comparison introduced (maybe unsafe)");

docs/docson/build-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440
"properties": {
441441
"number": {
442442
"type": "string",
443-
"description": "Default: \"+a-4-9-20-40-41-42-50-61-102\". Go [here](https://rescript-lang.org/docs/manual/latest/warning-numbers) for the meanings of the warning flags"
443+
"description": "Default: \"+a-4-9-20-41-50-102\". Go [here](https://rescript-lang.org/docs/manual/latest/warning-numbers) for the meanings of the warning flags"
444444
},
445445
"error": {
446446
"oneOf": [

0 commit comments

Comments
 (0)