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
7 changes: 0 additions & 7 deletions analysis/src/completion_decorators.ml
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,6 @@ You will need this decorator whenever you want to use a JSX component in ReScrip

[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#unboxed-decorator).|};
] );
( "uncurry",
None,
[
{|The `@uncurry` decorator can be used to mark any callback argument within an external function as an uncurried function without the need for any explicit uncurried function syntax (`(.) => { ... }`).

[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#uncurry-decorator).|};
] );
( "unwrap",
None,
[
Expand Down
3 changes: 1 addition & 2 deletions analysis/src/hover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ let find_relevant_types_from_type ~state ~file ~package typ =
match References.dig_constructor ~state ~env ~package path with
| None -> None
| Some (env, {name = {txt}; extent_loc; item = {decl}}) ->
if Utils.is_uncurried_internal path then None
else Some {name = txt; env; loc = extent_loc; decl; path}
Some {name = txt; env; loc = extent_loc; decl; path}
in
let constructors = Shared.find_type_constructors types_to_search in
constructors |> List.filter_map (from_constructor_path ~env:env_to_search)
Expand Down
3 changes: 0 additions & 3 deletions analysis/src/references.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ let get_loc_item ~full ~pos ~debug =
Printf.printf "n1:%s n2:%s n3:%s n4:%s\n" (name_of li1) (name_of li2)
(name_of li3) (name_of li4);
Some li3
| {loc_type = Typed (_, {desc = Tconstr (path, _, _)}, _)} :: li :: _
when Utils.is_uncurried_internal path ->
Some li
| li :: _ -> Some li
| _ -> None

Expand Down
12 changes: 1 addition & 11 deletions analysis/src/shared.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,5 @@ let find_type_constructors (tel : Types.type_expr list) =
let decl_to_string ?print_name_as_is ?(rec_status = Types.Trec_not) name t =
Print_type.print_decl ?print_name_as_is ~rec_status name t

let cache_type_to_string = ref false
let type_tbl = Hashtbl.create 1

let type_to_string ?line_width (t : Types.type_expr) =
match
if !cache_type_to_string then Hashtbl.find_opt type_tbl (t.id, t) else None
with
| None ->
let s = Print_type.print_expr ?line_width t in
Hashtbl.replace type_tbl (t.id, t) s;
s
| Some s -> s
Print_type.print_expr ?line_width t
1 change: 0 additions & 1 deletion analysis/src/utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ let filter_map f =
aux []

let dump_path path = Str.global_replace (Str.regexp_string "\\") "/" path
let is_uncurried_internal path = starts_with (Path.name path) "Js.Fn.arity"

let flatten_long_ident ?(jsx = false) ?(cut_at_offset = None) lid =
let extend_path s path =
Expand Down
1 change: 1 addition & 0 deletions changes/remove-dead-code-2.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove dead code: the `js_stdout` flag, gentype's Curry import path, an unused analysis type cache, the OCaml toplevel entry point, commented-out OCaml code and the unused `Otyp_attribute` outcome node.
1 change: 1 addition & 0 deletions changes/uncurry-completion.polish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Stop suggesting the `@uncurry` decorator in editor completion; the compiler no longer supports it.
2 changes: 0 additions & 2 deletions compiler/common/js_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type t = {
force_cmj: bool ref;
jsx_version: jsx_version option ref;
jsx_module: jsx_module ref;
js_stdout: bool ref;
source_map: source_map ref;
source_map_sources_content: bool ref;
source_map_root: string ref;
Expand Down Expand Up @@ -76,7 +75,6 @@ let create () =
force_cmj = ref false;
jsx_version = ref None;
jsx_module = ref React;
js_stdout = ref true;
source_map = ref No_source_map;
source_map_sources_content = ref false;
source_map_root = ref "";
Expand Down
1 change: 0 additions & 1 deletion compiler/common/js_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type t = {
force_cmj: bool ref;
jsx_version: jsx_version option ref;
jsx_module: jsx_module ref;
js_stdout: bool ref;
source_map: source_map ref;
source_map_sources_content: bool ref;
source_map_root: string ref;
Expand Down
5 changes: 1 addition & 4 deletions compiler/core/lam_compile_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,7 @@ let dump_deps_program_with_source_map ?(remove_stale_map = true) ~target_file
let lambda_as_module (lambda_output : J.deps_program) (output_prefix : string) :
unit =
let package_info = Js_packages_state.get_packages_info () in
if
Js_packages_info.is_empty package_info
&& !((Js_config.current ()).js_stdout)
then
if Js_packages_info.is_empty package_info then
match !((Js_config.current ()).source_map) with
| Inline ->
let target_file =
Expand Down
5 changes: 1 addition & 4 deletions compiler/core/lam_compile_primitive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ let ensure_value_unit (st : Lam_compile_context.continuation) e : E.t =
let get_module_system () =
let package_info = Js_packages_state.get_packages_info () in
let module_system =
if
Js_packages_info.is_empty package_info
&& !((Js_config.current ()).js_stdout)
then [Ext_module_system.Commonjs]
if Js_packages_info.is_empty package_info then [Ext_module_system.Commonjs]
else
Js_packages_info.map package_info (fun {module_system} -> module_system)
in
Expand Down
8 changes: 0 additions & 8 deletions compiler/gentype/emit_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -690,14 +690,6 @@ let emit_translation_as_string ~config ~file_name
| true -> Emit_type.emit_import_react ~emitters
| false -> emitters
in
let env =
match config.emit_import_curry with
| true ->
Module_name.curry
|> require_module ~import:true ~env
~import_path:(Import_path.bs_curry_path ~config)
| false -> env
in
let final_env = env in
let emitters =
module_items_emitter
Expand Down
14 changes: 0 additions & 14 deletions compiler/gentype/gentype_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type t = {
dep_paths: (string, string) Hashtbl.t;
(** Map from package name to its install path, used to locate
[.cmt]/[.cmti] files of cross-package references. *)
mutable emit_import_curry: bool;
mutable emit_import_react: bool;
mutable emit_type_prop_done: bool;
mutable everything: bool;
Expand All @@ -25,7 +24,6 @@ type t = {
module_: module_;
module_resolution: module_resolution;
namespace: string option;
platform_lib: string;
project_root: string;
shims_map: Module_name.t Module_name_map.t;
sources: string list;
Expand All @@ -37,7 +35,6 @@ let default =
bsb_project_root = "";
bs_dependencies = [];
dep_paths = Hashtbl.create 0;
emit_import_curry = false;
emit_import_react = false;
emit_type_prop_done = false;
everything = false;
Expand All @@ -46,21 +43,12 @@ let default =
module_ = ESModule;
module_resolution = Node;
namespace = None;
platform_lib = "";
project_root = "";
shims_map = Module_name_map.empty;
sources = [];
suffix = ".bs.js";
}

let bs_platform_lib ~config =
match config.module_ with
| ESModule -> config.platform_lib ^ "/lib/es6"
| CommonJS -> config.platform_lib ^ "/lib/js"

let get_bs_curry_path ~config =
Filename.concat (bs_platform_lib ~config) "curry.js"

(* ----- CLI-flag backing state ----------------------------------------- *)

(** The following refs are populated by bsc's CLI flags (registered in
Expand Down Expand Up @@ -195,7 +183,6 @@ let build_config ~namespace =
bsb_project_root;
bs_dependencies = !(bs_dependencies_flag ());
dep_paths;
emit_import_curry = false;
emit_import_react = false;
emit_type_prop_done = false;
everything = false;
Expand All @@ -204,7 +191,6 @@ let build_config ~namespace =
module_;
module_resolution;
namespace;
platform_lib = "rescript";
project_root;
shims_map;
sources = !(source_dirs_flag ());
Expand Down
2 changes: 0 additions & 2 deletions compiler/gentype/import_path.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ open Gentype_common

type t = string * string

let bs_curry_path ~config = ("", Config.get_bs_curry_path ~config)

let from_module ~dir ~import_extension module_name =
let with_no_path =
(module_name |> Module_name.to_string
Expand Down
1 change: 0 additions & 1 deletion compiler/gentype/import_path.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ open Gentype_common

type t

val bs_curry_path : config:Config.t -> t
val dump : t -> string

(* Escape a semantic import path for a single-quoted JavaScript/TypeScript
Expand Down
1 change: 0 additions & 1 deletion compiler/gentype/module_name.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
type t = string

let curry = "Curry"
let rescript_pervasives = "RescriptPervasives"

let sanitize_id s =
Expand Down
1 change: 0 additions & 1 deletion compiler/gentype/module_name.mli
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
type t

val compare : t -> t -> int
val curry : t
val for_js_file : t -> t
val for_inner_module : file_name:t -> inner_module_name:string -> t

Expand Down
1 change: 0 additions & 1 deletion compiler/jsoo/jsoo_playground_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ module Compile = struct
{
Gentype_config.default with
module_;
platform_lib = "rescript";
project_root;
bsb_project_root = project_root;
suffix = Literals.suffix_js;
Expand Down
20 changes: 0 additions & 20 deletions compiler/ml/btype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ let newty2 level desc =
{desc; level; id = state.type_node_id}
let newgenty desc = newty2 generic_level desc
let newgenvar ?name () = newgenty (Tvar name)
(*
let newmarkedvar level =
incr new_id; { desc = Tvar; level = pivot_level - level; id = !new_id }
let newmarkedgenvar () =
incr new_id;
{ desc = Tvar; level = pivot_level - generic_level; id = !new_id }
*)

(**** Check some types ****)

Expand Down Expand Up @@ -617,19 +610,6 @@ let rec find_expans priv p1 = function
| Mcons (_, _, _, _, rem) -> find_expans priv p1 rem
| Mlink {contents = rem} -> find_expans priv p1 rem

(* debug: check for cycles in abbreviation. only works with -principal
let rec check_expans visited ty =
let ty = repr ty in
assert (not (List.memq ty visited));
match ty.desc with
Tconstr (path, args, abbrev) ->
begin match find_expans path !abbrev with
Some ty' -> check_expans (ty :: visited) ty'
| None -> ()
end
| _ -> ()
*)

let memo = Request_local.new_key (fun () -> ref [])
(* Contains the list of saved abbreviation expansions. *)

Expand Down
7 changes: 0 additions & 7 deletions compiler/ml/btype.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ val newgenty : type_desc -> type_expr
val newgenvar : ?name:string -> unit -> type_expr
(* Return a fresh generic variable *)

(* Use Tsubst instead
val newmarkedvar: int -> type_expr
(* Return a fresh marked variable *)
val newmarkedgenvar: unit -> type_expr
(* Return a fresh marked generic variable *)
*)

(**** Types ****)

val is_Tvar : type_expr -> bool
Expand Down
2 changes: 1 addition & 1 deletion compiler/ml/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ let type_changed () = Domain.DLS.get type_changed_key
let merge r b = if b then r := true

let occur env ty0 ty =
let allow_recursive = (*!Clflags.recursive_types ||*) !(umode ()) = Pattern in
let allow_recursive = !(umode ()) = Pattern in
let old = !(type_changed ()) in
try
while
Expand Down
6 changes: 3 additions & 3 deletions compiler/ml/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1800,10 +1800,10 @@ let open_signature slot root env0 =

(* Open a signature from a file *)

let open_signature ?(used_slot = ref false) ?(loc = Location.none)
?(toplevel = false) ovf root env =
let open_signature ?(used_slot = ref false) ?(loc = Location.none) ovf root env
=
if
(not toplevel) && ovf = Asttypes.Fresh
ovf = Asttypes.Fresh
&& (not loc.Location.loc_ghost)
&& (Warnings.is_active (Warnings.Unused_open "")
|| Warnings.is_active (Warnings.Open_shadow_identifier ("", ""))
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ val add_signature : signature -> t -> t
val open_signature :
?used_slot:bool ref ->
?loc:Location.t ->
?toplevel:bool ->
Asttypes.override_flag ->
Path.t ->
t ->
Expand Down
1 change: 0 additions & 1 deletion compiler/ml/outcometree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type out_type =
| Otyp_variant of bool * out_variant * bool * string list option
| Otyp_poly of string list * out_type
| Otyp_module of string * string list * out_type list
| Otyp_attribute of out_type * out_attribute

and out_variant =
| Ovar_fields of (string * bool * out_type list) list
Expand Down
39 changes: 0 additions & 39 deletions compiler/ml/parmatch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1337,29 +1337,6 @@ let rec try_many_gadt f = function
| [] -> Rnone
| (p, pss) :: rest -> rappend (f (p, pss)) (try_many_gadt f rest)

(*
let print_pat pat =
let rec string_of_pat pat =
match pat.pat_desc with
Tpat_var _ -> "v"
| Tpat_any -> "_"
| Tpat_alias (p, x) -> Printf.sprintf "(%s) as ?" (string_of_pat p)
| Tpat_constant n -> "0"
| Tpat_construct (_, lid, _) ->
Printf.sprintf "%s" (String.concat "." (Longident.flatten lid.txt))
| Tpat_lazy p ->
Printf.sprintf "(lazy %s)" (string_of_pat p)
| Tpat_or (p1,p2,_) ->
Printf.sprintf "(%s | %s)" (string_of_pat p1) (string_of_pat p2)
| Tpat_tuple list ->
Printf.sprintf "(%s)" (String.concat "," (List.map string_of_pat list))
| Tpat_variant (_, _, _) -> "variant"
| Tpat_record (_, _, _) -> "record"
| Tpat_array _ -> "array"
in
Printf.fprintf stderr "PAT[%s]\n%!" (string_of_pat pat)
*)

(* strictly more powerful than exhaust; however, exhaust
was kept for backwards compatibility *)

Expand Down Expand Up @@ -1519,22 +1496,6 @@ type answer =
*)
type 'a row = {no_ors: 'a list; ors: 'a list; active: 'a list}

(*
let pretty_row {ors=ors ; no_ors=no_ors; active=active} =
pretty_line ors ; prerr_string " *" ;
pretty_line no_ors ; prerr_string " *" ;
pretty_line active

let pretty_rows rs =
prerr_endline "begin matrix" ;
List.iter
(fun r ->
pretty_row r ;
prerr_endline "")
rs ;
prerr_endline "end matrix"
*)

(* Initial build *)
let make_row ps = {ors = []; no_ors = []; active = ps}

Expand Down
Loading
Loading