Skip to content

Commit cb53311

Browse files
cknittclaude
andauthored
Remove OCaml leftovers (#8805)
* Remove warning numbers that no longer exist Drop their descriptions, letter mappings and mentions in the default warning settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1 Signed-off-by: Christoph Knittel <ck@cca.io> * Remove the unused Record_float_unused representation Every match on it was `assert false`. Removing it changes the binary layout of type declarations, so bump the .cmi and .cmt magic numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1 Signed-off-by: Christoph Knittel <ck@cca.io> * Stop decoding the legacy ns.braces attribute from PPX output It is the pre-res name of res.braces and nothing produces it anymore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1 Signed-off-by: Christoph Knittel <ck@cca.io> * Remove unused Ast_helper functions Const.int32/int64/char/float, the attr helpers and Te.decl/rebind came from OCaml and have no callers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1 Signed-off-by: Christoph Knittel <ck@cca.io> * Add CHANGELOG entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1 Signed-off-by: Christoph Knittel <ck@cca.io> --------- Signed-off-by: Christoph Knittel <ck@cca.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bbac536 commit cb53311

17 files changed

Lines changed: 18 additions & 88 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
#### :house: Internal
8484

85+
- Remove OCaml leftovers: unused warning numbers, the `Record_float_unused` representation, the `ns.braces` attribute name and unused `Ast_helper` functions. https://github.com/rescript-lang/rescript/pull/8805
8586
- Remove the S-expression parsetree printer (`res_parser -print sexp`). https://github.com/rescript-lang/rescript/pull/8803
8687
- Use one set of OCaml warning flags for the whole repository, including the editor analysis and tools. https://github.com/rescript-lang/rescript/pull/8796
8788
- Remove the unused `Packed` and `Partial_class_expr` constructors from the `.cmt` format and bump its magic number. https://github.com/rescript-lang/rescript/pull/8793

‎compiler/ext/bsc_warnings.ml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@
4141
type b = A | B | C
4242
]}
4343
44-
- 50 Unexpected documentation comment.
45-
4644
- 102 Bs_polymorphic_comparison.
4745
*)
4846
(* If you change this, don't forget to adapt docs/docson/build-schema.json as well. *)
49-
let defaults_w = "+a-4-9-20-41-50-102"
47+
let defaults_w = "+a-4-9-20-41-102"
5048

51-
let defaults_warn_error = "-a+5+6+101+109"
49+
let defaults_warn_error = "-a+5+101+109"
5250
(*TODO: add +10*)

‎compiler/ext/config.ml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let cmi_magic_number = "Caml1999I035"
1+
let cmi_magic_number = "Caml1999I036"
22

33
(* Magic numbers for marshaled values of the *current* parsetree, whose layout
44
changes across compiler versions. *)
@@ -13,6 +13,6 @@ and ast0_impl_magic_number = "Caml1999M022"
1313

1414
and ast0_intf_magic_number = "Caml1999N022"
1515

16-
and cmt_magic_number = "Caml1999T042"
16+
and cmt_magic_number = "Caml1999T043"
1717

1818
let load_path = ref ([] : string list)

‎compiler/ext/warnings.ml‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,28 @@ let letter_all =
140140
let letter = function
141141
| 'a' -> letter_all
142142
| 'b' -> []
143-
| 'c' -> [1; 2]
143+
| 'c' -> []
144144
| 'd' -> [3]
145145
| 'e' -> [4]
146146
| 'f' -> [5]
147147
| 'g' -> []
148148
| 'h' -> []
149149
| 'i' -> []
150150
| 'j' -> []
151-
| 'k' -> [32; 33; 34; 35; 36; 37; 38; 39]
152-
| 'l' -> [6]
153-
| 'm' -> [7]
151+
| 'k' -> [32; 33; 34; 35; 37; 38; 39]
152+
| 'l' -> []
153+
| 'm' -> []
154154
| 'n' -> []
155155
| 'o' -> []
156156
| 'p' -> [8]
157157
| 'q' -> []
158158
| 'r' -> [9]
159-
| 's' -> [10]
159+
| 's' -> []
160160
| 't' -> []
161161
| 'u' -> [11; 12]
162-
| 'v' -> [13]
162+
| 'v' -> []
163163
| 'w' -> []
164-
| 'x' -> [14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 30]
164+
| 'x' -> [20; 21; 22; 23; 30]
165165
| 'y' -> [26]
166166
| 'z' -> [27]
167167
| _ -> assert false
@@ -505,14 +505,10 @@ let descriptions =
505505
(9, "Missing fields in a record pattern.");
506506
(11, "Redundant case in a pattern matching (unused match case).");
507507
(12, "Redundant sub-pattern in a pattern-matching.");
508-
(17, "Undeclared virtual method.");
509-
(18, "Non-principal type.");
510-
(19, "Type without principality.");
511508
(20, "Unused function argument.");
512509
(21, "Non-returning statement.");
513510
(22, "Preprocessor warning.");
514511
(23, "Useless record \"with\" clause.");
515-
(25, "Deprecated: now part of warning 8.");
516512
( 26,
517513
"Suspicious unused variable: unused variable that is bound\n\
518514
\ with \"let\" or \"as\", and doesn't start with an underscore (\"_\")\n\
@@ -525,29 +521,24 @@ let descriptions =
525521
( 30,
526522
"Two labels or constructors of the same name are defined in two\n\
527523
\ mutually recursive types." );
528-
(31, "A module is linked twice in the same executable.");
529524
(32, "Unused value declaration.");
530525
(33, "Unused open statement.");
531526
(34, "Unused type declaration.");
532527
(35, "Unused for-loop index.");
533-
(36, "Unused ancestor variable.");
534528
(37, "Unused constructor.");
535529
(38, "Unused extension constructor.");
536530
(39, "Unused rec flag.");
537531
(41, "Ambiguous constructor or label name.");
538532
(43, "Nonoptional label applied as optional.");
539533
(44, "Open statement shadows an already defined identifier.");
540534
(45, "Open statement shadows an already defined label or constructor.");
541-
(46, "Error in environment variable.");
542535
(47, "Illegal attribute payload.");
543536
(49, "Absent cmi file when looking up module alias.");
544537
(52, "Fragile constant pattern.");
545538
(53, "Attribute cannot appear in this context");
546539
(54, "Attribute used more than once on an expression");
547-
(55, "Inlining impossible");
548540
(56, "Unreachable case in a pattern-matching (based on type information).");
549541
(57, "Ambiguous or-pattern variables under guard");
550-
(59, "Assignment to non-mutable value");
551542
(60, "Unused module declaration");
552543
(62, "Type constraint on GADT type declaration");
553544
(101, "Unused bs attributes");

‎compiler/gentype/translate_type_declarations.ml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver
230230
match representation with
231231
| Record_unboxed _ -> true
232232
| Record_regular | Record_inlined _ | Record_extension -> false
233-
| Record_float_unused -> assert false
234233
in
235234
let {Translate_type_expr_from_types.dependencies; type_} =
236235
label_declarations |> translate_label_declarations ~unboxed

‎compiler/ml/ast_helper.ml‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,13 @@ let default_loc = ref Location.none
2929
module Const = struct
3030
let integer ?suffix i = Pconst_integer (i, suffix)
3131
let int ?suffix i = integer ?suffix (string_of_int i)
32-
let int32 ?(suffix = 'l') i = integer ~suffix (Int32.to_string i)
33-
let int64 ?(suffix = 'L') i = integer ~suffix (Int64.to_string i)
34-
let float ?suffix f = Pconst_float (f, suffix)
35-
let char c =
36-
let semantic = Char.code c in
37-
Pconst_char {source = String_literal.encode_char_source semantic; semantic}
3832
let string semantic =
3933
Pconst_string (String_literal.string_from_semantic semantic)
4034
end
4135

4236
module Typ = struct
4337
let mk ?(loc = !default_loc) ?(attrs = []) d =
4438
{ptyp_desc = d; ptyp_loc = loc; ptyp_attributes = attrs}
45-
let attr d a = {d with ptyp_attributes = d.ptyp_attributes @ [a]}
4639

4740
let any ?loc ?attrs () = mk ?loc ?attrs Ptyp_any
4841
let var ?loc ?attrs a = mk ?loc ?attrs (Ptyp_var a)
@@ -127,7 +120,6 @@ end
127120
module Pat = struct
128121
let mk ?(loc = !default_loc) ?(attrs = []) d =
129122
{ppat_desc = d; ppat_loc = loc; ppat_attributes = attrs}
130-
let attr d a = {d with ppat_attributes = d.ppat_attributes @ [a]}
131123

132124
let any ?loc ?attrs () = mk ?loc ?attrs Ppat_any
133125
let var ?loc ?attrs a = mk ?loc ?attrs (Ppat_var a)
@@ -152,7 +144,6 @@ end
152144
module Exp = struct
153145
let mk ?(loc = !default_loc) ?(attrs = []) d =
154146
{pexp_desc = d; pexp_loc = loc; pexp_attributes = attrs}
155-
let attr d a = {d with pexp_attributes = d.pexp_attributes @ [a]}
156147

157148
let braces ?(attrs = []) ~braces_loc e =
158149
mk ~loc:e.pexp_loc ~attrs (Pexp_braces {expr = e; braces_loc})
@@ -267,7 +258,6 @@ end
267258
module Mty = struct
268259
let mk ?(loc = !default_loc) ?(attrs = []) d =
269260
{pmty_desc = d; pmty_loc = loc; pmty_attributes = attrs}
270-
let attr d a = {d with pmty_attributes = d.pmty_attributes @ [a]}
271261

272262
let ident ?loc ?attrs a = mk ?loc ?attrs (Pmty_ident a)
273263
let alias ?loc ?attrs a = mk ?loc ?attrs (Pmty_alias a)
@@ -281,7 +271,6 @@ end
281271
module Mod = struct
282272
let mk ?(loc = !default_loc) ?(attrs = []) d =
283273
{pmod_desc = d; pmod_loc = loc; pmod_attributes = attrs}
284-
let attr d a = {d with pmod_attributes = d.pmod_attributes @ [a]}
285274

286275
let ident ?loc ?attrs x = mk ?loc ?attrs (Pmod_ident x)
287276
let structure ?loc ?attrs x = mk ?loc ?attrs (Pmod_structure x)
@@ -562,23 +551,6 @@ module Te = struct
562551
pext_loc = loc;
563552
pext_attributes = attrs;
564553
}
565-
566-
let decl ?(loc = !default_loc) ?(attrs = []) ?(args = Pcstr_tuple []) ?res
567-
name =
568-
{
569-
pext_name = name;
570-
pext_kind = Pext_decl (args, res);
571-
pext_loc = loc;
572-
pext_attributes = attrs;
573-
}
574-
575-
let rebind ?(loc = !default_loc) ?(attrs = []) name lid =
576-
{
577-
pext_name = name;
578-
pext_kind = Pext_rebind lid;
579-
pext_loc = loc;
580-
pext_attributes = attrs;
581-
}
582554
end
583555

584556
module Jsx = struct

‎compiler/ml/ast_helper.mli‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,16 @@ type attrs = attribute list
2828
(** {1 Constants} *)
2929

3030
module Const : sig
31-
val char : char -> constant
3231
val string : string -> constant
3332
val integer : ?suffix:char -> string -> constant
3433
val int : ?suffix:char -> int -> constant
35-
val int32 : ?suffix:char -> int32 -> constant
36-
val int64 : ?suffix:char -> int64 -> constant
37-
val float : ?suffix:char -> string -> constant
3834
end
3935

4036
(** {1 Core language} *)
4137

4238
(** Type expressions *)
4339
module Typ : sig
4440
val mk : ?loc:loc -> ?attrs:attrs -> core_type_desc -> core_type
45-
val attr : core_type -> attribute -> core_type
4641

4742
val any : ?loc:loc -> ?attrs:attrs -> unit -> core_type
4843
val var : ?loc:loc -> ?attrs:attrs -> string -> core_type
@@ -81,7 +76,6 @@ end
8176
(** Patterns *)
8277
module Pat : sig
8378
val mk : ?loc:loc -> ?attrs:attrs -> pattern_desc -> pattern
84-
val attr : pattern -> attribute -> pattern
8579

8680
val any : ?loc:loc -> ?attrs:attrs -> unit -> pattern
8781
val var : ?loc:loc -> ?attrs:attrs -> str -> pattern
@@ -117,7 +111,6 @@ end
117111
(** Expressions *)
118112
module Exp : sig
119113
val mk : ?loc:loc -> ?attrs:attrs -> expression_desc -> expression
120-
val attr : expression -> attribute -> expression
121114

122115
val braces : ?attrs:attrs -> braces_loc:loc -> expression -> expression
123116
val ident : ?loc:loc -> ?attrs:attrs -> lid -> expression
@@ -358,15 +351,6 @@ module Te : sig
358351
str ->
359352
extension_constructor_kind ->
360353
extension_constructor
361-
362-
val decl :
363-
?loc:loc ->
364-
?attrs:attrs ->
365-
?args:constructor_arguments ->
366-
?res:core_type ->
367-
str ->
368-
extension_constructor
369-
val rebind : ?loc:loc -> ?attrs:attrs -> str -> lid -> extension_constructor
370354
end
371355

372356
module Jsx : sig
@@ -379,7 +363,6 @@ end
379363
(** Module type expressions *)
380364
module Mty : sig
381365
val mk : ?loc:loc -> ?attrs:attrs -> module_type_desc -> module_type
382-
val attr : module_type -> attribute -> module_type
383366

384367
val ident : ?loc:loc -> ?attrs:attrs -> lid -> module_type
385368
val alias : ?loc:loc -> ?attrs:attrs -> lid -> module_type
@@ -404,7 +387,6 @@ end
404387
(** Module expressions *)
405388
module Mod : sig
406389
val mk : ?loc:loc -> ?attrs:attrs -> module_expr_desc -> module_expr
407-
val attr : module_expr -> attribute -> module_expr
408390

409391
val ident : ?loc:loc -> ?attrs:attrs -> lid -> module_expr
410392
val structure : ?loc:loc -> ?attrs:attrs -> structure -> module_expr

‎compiler/ml/ast_mapper_from0.ml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ module E = struct
745745
in
746746
let first_wrapper =
747747
let rec find = function
748-
| ({txt = "res.braces" | "ns.braces"; loc}, _) :: _ ->
749-
Some (`Braces loc)
748+
| ({txt = "res.braces"; loc}, _) :: _ -> Some (`Braces loc)
750749
| ({txt = "res.await"}, _) :: _ -> Some `Await
751750
| _ :: rest -> find rest
752751
| [] -> None
@@ -760,7 +759,7 @@ module E = struct
760759
| _ -> false ->
761760
let outer_attrs0, braces_loc, inner_attrs0 =
762761
let rec split acc = function
763-
| ({Location.txt = "res.braces" | "ns.braces"; loc}, _) :: rest ->
762+
| ({Location.txt = "res.braces"; loc}, _) :: rest ->
764763
(List.rev acc, loc, rest)
765764
| a :: rest -> split (a :: acc) rest
766765
| [] -> assert false

‎compiler/ml/matching.ml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,6 @@ let make_record_matching loc all_labels def = function
14881488
let lbl = all_labels.(pos) in
14891489
let access =
14901490
match lbl.lbl_repres with
1491-
| Record_float_unused -> assert false
14921491
| Record_regular ->
14931492
prim
14941493
~primitive:

‎compiler/ml/printtyped.ml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ let record_representation i ppf =
127127
let open Types in
128128
function
129129
| Record_regular -> line i ppf "Record_regular\n"
130-
| Record_float_unused -> assert false
131130
| Record_unboxed b -> line i ppf "Record_unboxed %b\n" b
132131
| Record_inlined {name} -> line i ppf "Record_inlined %s\n" name
133132
| Record_extension -> line i ppf "Record_extension\n"

0 commit comments

Comments
 (0)