Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

#### :house: Internal

- 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
- Remove the S-expression parsetree printer (`res_parser -print sexp`). https://github.com/rescript-lang/rescript/pull/8803
- 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
- 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
Expand Down
6 changes: 2 additions & 4 deletions compiler/ext/bsc_warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@
type b = A | B | C
]}

- 50 Unexpected documentation comment.

- 102 Bs_polymorphic_comparison.
*)
(* If you change this, don't forget to adapt docs/docson/build-schema.json as well. *)
let defaults_w = "+a-4-9-20-41-50-102"
let defaults_w = "+a-4-9-20-41-102"

let defaults_warn_error = "-a+5+6+101+109"
let defaults_warn_error = "-a+5+101+109"
(*TODO: add +10*)
4 changes: 2 additions & 2 deletions compiler/ext/config.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let cmi_magic_number = "Caml1999I035"
let cmi_magic_number = "Caml1999I036"

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

and ast0_intf_magic_number = "Caml1999N022"

and cmt_magic_number = "Caml1999T042"
and cmt_magic_number = "Caml1999T043"

let load_path = ref ([] : string list)
23 changes: 7 additions & 16 deletions compiler/ext/warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,28 @@ let letter_all =
let letter = function
| 'a' -> letter_all
| 'b' -> []
| 'c' -> [1; 2]
| 'c' -> []
| 'd' -> [3]
| 'e' -> [4]
| 'f' -> [5]
| 'g' -> []
| 'h' -> []
| 'i' -> []
| 'j' -> []
| 'k' -> [32; 33; 34; 35; 36; 37; 38; 39]
| 'l' -> [6]
| 'm' -> [7]
| 'k' -> [32; 33; 34; 35; 37; 38; 39]
| 'l' -> []
| 'm' -> []
| 'n' -> []
| 'o' -> []
| 'p' -> [8]
| 'q' -> []
| 'r' -> [9]
| 's' -> [10]
| 's' -> []
| 't' -> []
| 'u' -> [11; 12]
| 'v' -> [13]
| 'v' -> []
| 'w' -> []
| 'x' -> [14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 30]
| 'x' -> [20; 21; 22; 23; 30]
| 'y' -> [26]
| 'z' -> [27]
| _ -> assert false
Expand Down Expand Up @@ -505,14 +505,10 @@ let descriptions =
(9, "Missing fields in a record pattern.");
(11, "Redundant case in a pattern matching (unused match case).");
(12, "Redundant sub-pattern in a pattern-matching.");
(17, "Undeclared virtual method.");
(18, "Non-principal type.");
(19, "Type without principality.");
(20, "Unused function argument.");
(21, "Non-returning statement.");
(22, "Preprocessor warning.");
(23, "Useless record \"with\" clause.");
(25, "Deprecated: now part of warning 8.");
( 26,
"Suspicious unused variable: unused variable that is bound\n\
\ with \"let\" or \"as\", and doesn't start with an underscore (\"_\")\n\
Expand All @@ -525,29 +521,24 @@ let descriptions =
( 30,
"Two labels or constructors of the same name are defined in two\n\
\ mutually recursive types." );
(31, "A module is linked twice in the same executable.");
(32, "Unused value declaration.");
(33, "Unused open statement.");
(34, "Unused type declaration.");
(35, "Unused for-loop index.");
(36, "Unused ancestor variable.");
(37, "Unused constructor.");
(38, "Unused extension constructor.");
(39, "Unused rec flag.");
(41, "Ambiguous constructor or label name.");
(43, "Nonoptional label applied as optional.");
(44, "Open statement shadows an already defined identifier.");
(45, "Open statement shadows an already defined label or constructor.");
(46, "Error in environment variable.");
(47, "Illegal attribute payload.");
(49, "Absent cmi file when looking up module alias.");
(52, "Fragile constant pattern.");
(53, "Attribute cannot appear in this context");
(54, "Attribute used more than once on an expression");
(55, "Inlining impossible");
(56, "Unreachable case in a pattern-matching (based on type information).");
(57, "Ambiguous or-pattern variables under guard");
(59, "Assignment to non-mutable value");
(60, "Unused module declaration");
(62, "Type constraint on GADT type declaration");
(101, "Unused bs attributes");
Expand Down
1 change: 0 additions & 1 deletion compiler/gentype/translate_type_declarations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ let traslate_declaration_kind ~config ~loc ~output_file_relative ~resolver
match representation with
| Record_unboxed _ -> true
| Record_regular | Record_inlined _ | Record_extension -> false
| Record_float_unused -> assert false
in
let {Translate_type_expr_from_types.dependencies; type_} =
label_declarations |> translate_label_declarations ~unboxed
Expand Down
28 changes: 0 additions & 28 deletions compiler/ml/ast_helper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,13 @@ let default_loc = ref Location.none
module Const = struct
let integer ?suffix i = Pconst_integer (i, suffix)
let int ?suffix i = integer ?suffix (string_of_int i)
let int32 ?(suffix = 'l') i = integer ~suffix (Int32.to_string i)
let int64 ?(suffix = 'L') i = integer ~suffix (Int64.to_string i)
let float ?suffix f = Pconst_float (f, suffix)
let char c =
let semantic = Char.code c in
Pconst_char {source = String_literal.encode_char_source semantic; semantic}
let string semantic =
Pconst_string (String_literal.string_from_semantic semantic)
end

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

let any ?loc ?attrs () = mk ?loc ?attrs Ptyp_any
let var ?loc ?attrs a = mk ?loc ?attrs (Ptyp_var a)
Expand Down Expand Up @@ -127,7 +120,6 @@ end
module Pat = struct
let mk ?(loc = !default_loc) ?(attrs = []) d =
{ppat_desc = d; ppat_loc = loc; ppat_attributes = attrs}
let attr d a = {d with ppat_attributes = d.ppat_attributes @ [a]}

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

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

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

let ident ?loc ?attrs x = mk ?loc ?attrs (Pmod_ident x)
let structure ?loc ?attrs x = mk ?loc ?attrs (Pmod_structure x)
Expand Down Expand Up @@ -562,23 +551,6 @@ module Te = struct
pext_loc = loc;
pext_attributes = attrs;
}

let decl ?(loc = !default_loc) ?(attrs = []) ?(args = Pcstr_tuple []) ?res
name =
{
pext_name = name;
pext_kind = Pext_decl (args, res);
pext_loc = loc;
pext_attributes = attrs;
}

let rebind ?(loc = !default_loc) ?(attrs = []) name lid =
{
pext_name = name;
pext_kind = Pext_rebind lid;
pext_loc = loc;
pext_attributes = attrs;
}
end

module Jsx = struct
Expand Down
18 changes: 0 additions & 18 deletions compiler/ml/ast_helper.mli
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,16 @@ type attrs = attribute list
(** {1 Constants} *)

module Const : sig
val char : char -> constant
val string : string -> constant
val integer : ?suffix:char -> string -> constant
val int : ?suffix:char -> int -> constant
val int32 : ?suffix:char -> int32 -> constant
val int64 : ?suffix:char -> int64 -> constant
val float : ?suffix:char -> string -> constant
end

(** {1 Core language} *)

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

val any : ?loc:loc -> ?attrs:attrs -> unit -> core_type
val var : ?loc:loc -> ?attrs:attrs -> string -> core_type
Expand Down Expand Up @@ -81,7 +76,6 @@ end
(** Patterns *)
module Pat : sig
val mk : ?loc:loc -> ?attrs:attrs -> pattern_desc -> pattern
val attr : pattern -> attribute -> pattern

val any : ?loc:loc -> ?attrs:attrs -> unit -> pattern
val var : ?loc:loc -> ?attrs:attrs -> str -> pattern
Expand Down Expand Up @@ -117,7 +111,6 @@ end
(** Expressions *)
module Exp : sig
val mk : ?loc:loc -> ?attrs:attrs -> expression_desc -> expression
val attr : expression -> attribute -> expression

val braces : ?attrs:attrs -> braces_loc:loc -> expression -> expression
val ident : ?loc:loc -> ?attrs:attrs -> lid -> expression
Expand Down Expand Up @@ -358,15 +351,6 @@ module Te : sig
str ->
extension_constructor_kind ->
extension_constructor

val decl :
?loc:loc ->
?attrs:attrs ->
?args:constructor_arguments ->
?res:core_type ->
str ->
extension_constructor
val rebind : ?loc:loc -> ?attrs:attrs -> str -> lid -> extension_constructor
end

module Jsx : sig
Expand All @@ -379,7 +363,6 @@ end
(** Module type expressions *)
module Mty : sig
val mk : ?loc:loc -> ?attrs:attrs -> module_type_desc -> module_type
val attr : module_type -> attribute -> module_type

val ident : ?loc:loc -> ?attrs:attrs -> lid -> module_type
val alias : ?loc:loc -> ?attrs:attrs -> lid -> module_type
Expand All @@ -404,7 +387,6 @@ end
(** Module expressions *)
module Mod : sig
val mk : ?loc:loc -> ?attrs:attrs -> module_expr_desc -> module_expr
val attr : module_expr -> attribute -> module_expr

val ident : ?loc:loc -> ?attrs:attrs -> lid -> module_expr
val structure : ?loc:loc -> ?attrs:attrs -> structure -> module_expr
Expand Down
5 changes: 2 additions & 3 deletions compiler/ml/ast_mapper_from0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,7 @@ module E = struct
in
let first_wrapper =
let rec find = function
| ({txt = "res.braces" | "ns.braces"; loc}, _) :: _ ->
Some (`Braces loc)
| ({txt = "res.braces"; loc}, _) :: _ -> Some (`Braces loc)
Comment thread
cknitt marked this conversation as resolved.
| ({txt = "res.await"}, _) :: _ -> Some `Await
| _ :: rest -> find rest
| [] -> None
Expand All @@ -760,7 +759,7 @@ module E = struct
| _ -> false ->
let outer_attrs0, braces_loc, inner_attrs0 =
let rec split acc = function
| ({Location.txt = "res.braces" | "ns.braces"; loc}, _) :: rest ->
| ({Location.txt = "res.braces"; loc}, _) :: rest ->
(List.rev acc, loc, rest)
| a :: rest -> split (a :: acc) rest
| [] -> assert false
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,6 @@ let make_record_matching loc all_labels def = function
let lbl = all_labels.(pos) in
let access =
match lbl.lbl_repres with
| Record_float_unused -> assert false
| Record_regular ->
prim
~primitive:
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/printtyped.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ let record_representation i ppf =
let open Types in
function
| Record_regular -> line i ppf "Record_regular\n"
| Record_float_unused -> assert false
| Record_unboxed b -> line i ppf "Record_unboxed %b\n" b
| Record_inlined {name} -> line i ppf "Record_inlined %s\n" name
| Record_extension -> line i ppf "Record_extension\n"
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/rec_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ let rec expression : Env.env -> Typedtree.expression -> Use.t =
let use =
match rep with
| Record_unboxed _ -> fun x -> x
| Record_float_unused -> assert false
| Record_regular | Record_inlined _ | Record_extension -> Use.guard
in
let field env = function
Expand Down
6 changes: 0 additions & 6 deletions compiler/ml/translcore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,6 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.t =
| Texp_field (arg, _, lbl) -> (
let targ = transl_exp arg in
match lbl.lbl_repres with
| Record_float_unused -> assert false
| Record_regular ->
prim
~primitive:
Expand All @@ -1432,7 +1431,6 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.t =
| Texp_setfield (arg, _, lbl, newval) ->
let access =
match lbl.lbl_repres with
| Record_float_unused -> assert false
| Record_regular ->
Psetfield (lbl.lbl_pos, Lambda.fld_record_set lbl.lbl_runtime_name)
| Record_inlined _ ->
Expand Down Expand Up @@ -1768,7 +1766,6 @@ and transl_record loc env fields repres opt_init_expr =
| Kept _ ->
let access =
match repres with
| Record_float_unused -> assert false
| Record_regular ->
Pfield (i, Lambda.fld_record lbl.lbl_runtime_name)
| Record_inlined _ ->
Expand All @@ -1793,7 +1790,6 @@ and transl_record loc env fields repres opt_init_expr =
if mut = Mutable then raise Not_constant;
let cl = List.map extract_constant ll in
match repres with
| Record_float_unused -> assert false
| Record_regular ->
const (Const_block (Lambda.blk_record (field_shape ()) mut, cl))
| Record_inlined {name; representation} ->
Expand Down Expand Up @@ -1823,7 +1819,6 @@ and transl_record loc env fields repres opt_init_expr =
prim
~primitive:(Pmakeblock (Lambda.blk_record (field_shape ()) mut))
~args:ll loc
| Record_float_unused -> assert false
| Record_inlined {name; representation} ->
let runtime =
match Variant_runtime.representation representation with
Expand Down Expand Up @@ -1870,7 +1865,6 @@ and transl_record loc env fields repres opt_init_expr =
| Overridden (_lid, expr) ->
let upd =
match repres with
| Record_float_unused -> assert false
| Record_regular ->
Psetfield (lbl.lbl_pos, Lambda.fld_record_set lbl.lbl_runtime_name)
| Record_inlined _ ->
Expand Down
2 changes: 0 additions & 2 deletions compiler/ml/types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ and type_kind =

and record_representation =
| Record_regular (* All fields are boxed / tagged *)
| Record_float_unused (* Was: all fields are floats. Now: unused *)
| Record_unboxed of bool (* Unboxed single-field record, inlined or not *)
| Record_inlined of
(* Inlined record *)
Expand Down Expand Up @@ -325,7 +324,6 @@ type label_description = {
let same_record_representation x y =
match x with
| Record_regular -> y = Record_regular
| Record_float_unused -> y = Record_float_unused
| Record_inlined {name} -> (
match y with
| Record_inlined y -> name = y.name
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/types.mli
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ and type_kind =

and record_representation =
| Record_regular (* All fields are boxed / tagged *)
| Record_float_unused (* Was: all fields are floats. Now: unused *)
| Record_unboxed of bool (* Unboxed single-field record, inlined or not *)
| Record_inlined of
(* Inlined record *)
Expand Down
2 changes: 1 addition & 1 deletion docs/docson/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
"properties": {
"number": {
"type": "string",
"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"
"description": "Default: \"+a-4-9-20-41-102\". Go [here](https://rescript-lang.org/docs/manual/latest/warning-numbers) for the meanings of the warning flags"
},
"error": {
"oneOf": [
Expand Down
Loading
Loading