Skip to content

Commit a921c2b

Browse files
committed
Remove processing of @bs which is from ocaml.
1 parent 46bf066 commit a921c2b

File tree

6 files changed

+5
-37
lines changed

6 files changed

+5
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
- Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875
6868
- Build the compiler libraries/tests in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6864
6969
- Ignore `-uncurried` command-line flag. https://github.com/rescript-lang/rescript-compiler/pull/6885
70+
- Cleanup: remove tracking of uncurried state in parser/printer. https://github.com/rescript-lang/rescript-compiler/pull/6888
7071

7172
#### :nail_care: Polish
7273

jscomp/frontend/ast_attributes.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,15 @@ let process_method_attributes_rev (attrs : t) =
7474
({st with set = Some result}, acc)
7575
| _ -> (st, attr :: acc))
7676

77-
type attr_kind =
78-
| Nothing
79-
| Meth_callback of attr
80-
| Uncurry of attr
81-
| Method of attr
77+
type attr_kind = Nothing | Meth_callback of attr | Method of attr
8278

8379
let process_attributes_rev (attrs : t) : attr_kind * t =
8480
Ext_list.fold_left attrs (Nothing, [])
8581
(fun (st, acc) (({txt; loc}, _) as attr) ->
8682
match (txt, st) with
87-
| "bs", (Nothing | Uncurry _) ->
88-
(Uncurry attr, acc) (* TODO: warn unused/duplicated attribute *)
8983
| "this", (Nothing | Meth_callback _) -> (Meth_callback attr, acc)
9084
| "meth", (Nothing | Method _) -> (Method attr, acc)
91-
| ("bs" | "this"), _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
85+
| "this", _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
9286
| _, _ -> (st, attr :: acc))
9387

9488
let process_bs (attrs : t) =

jscomp/frontend/ast_attributes.mli

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ type ('a, 'b) st = {get: 'a option; set: 'b option}
2929

3030
val process_method_attributes_rev : t -> (bool * bool, [`Get | `No_get]) st * t
3131

32-
type attr_kind =
33-
| Nothing
34-
| Meth_callback of attr
35-
| Uncurry of attr
36-
| Method of attr
32+
type attr_kind = Nothing | Meth_callback of attr | Method of attr
3733

3834
val process_attributes_rev : t -> attr_kind * t
3935

@@ -47,7 +43,7 @@ val has_async_payload : t -> attr option
4743
type derive_attr = {bs_deriving: Ast_payload.action list option} [@@unboxed]
4844

4945
val iter_process_bs_string_int_unwrap_uncurry :
50-
t -> [`Nothing | `String | `Int | `Ignore | `Unwrap | `Uncurry of int option]
46+
t -> [`Nothing | `String | `Int | `Ignore | `Unwrap]
5147

5248
val iter_process_bs_string_as : t -> string option
5349

jscomp/frontend/ast_core_type_class_type.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
8080
ptyp_loc = loc;
8181
} -> (
8282
match fst (Ast_attributes.process_attributes_rev ptyp_attributes) with
83-
| Uncurry _ -> Ast_typ_uncurry.to_uncurry_type loc self label args body
8483
| Meth_callback _ ->
8584
Ast_typ_uncurry.to_method_callback_type loc self label args body
8685
| Method _ ->
@@ -100,7 +99,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
10099
let attrs, core_type =
101100
match Ast_attributes.process_attributes_rev attrs with
102101
| Nothing, attrs -> (attrs, ty) (* #1678 *)
103-
| Uncurry attr, attrs -> (attrs, attr +> ty)
104102
| Method _, _ ->
105103
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
106104
| Meth_callback attr, attrs -> (attrs, attr +> ty)
@@ -111,7 +109,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
111109
let attrs, core_type =
112110
match Ast_attributes.process_attributes_rev attrs with
113111
| Nothing, attrs -> (attrs, ty)
114-
| Uncurry attr, attrs -> (attrs, attr +> ty)
115112
| Method _, _ ->
116113
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
117114
| Meth_callback attr, attrs -> (attrs, attr +> ty)
@@ -124,7 +121,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
124121
let attrs, core_type =
125122
match Ast_attributes.process_attributes_rev ptyp_attrs with
126123
| Nothing, attrs -> (attrs, ty)
127-
| Uncurry attr, attrs -> (attrs, attr +> ty)
128124
| Method attr, attrs -> (attrs, attr +> ty)
129125
| Meth_callback attr, attrs -> (attrs, attr +> ty)
130126
in

jscomp/frontend/ast_external_process.ml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,6 @@ let spec_of_ptyp (nolabel : bool) (ptyp : Parsetree.core_type) :
6666
Unwrap
6767
(* Unwrap attribute can only be attached to things like `[a of a0 | b of b0]` *)
6868
| _ -> Bs_syntaxerr.err ptyp.ptyp_loc Invalid_bs_unwrap_type)
69-
| `Uncurry opt_arity -> (
70-
let real_arity =
71-
if Ast_uncurried.core_type_is_uncurried_fun ptyp then
72-
let arity, _ = Ast_uncurried.core_type_extract_uncurried_fun ptyp in
73-
Some arity
74-
else Ast_core_type.get_uncurry_arity ptyp
75-
in
76-
match (opt_arity, real_arity) with
77-
| Some arity, None -> Fn_uncurry_arity arity
78-
| None, None -> Bs_syntaxerr.err ptyp.ptyp_loc Canot_infer_arity_by_syntax
79-
| None, Some arity -> Fn_uncurry_arity arity
80-
| Some arity, Some n ->
81-
if n <> arity then
82-
Bs_syntaxerr.err ptyp.ptyp_loc (Inconsistent_arity (arity, n))
83-
else Fn_uncurry_arity arity)
8469
| `Nothing -> (
8570
match ptyp_desc with
8671
| Ptyp_constr ({txt = Lident "unit"; _}, []) ->

jscomp/frontend/bs_builtin_ppx.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
138138
async_context := (old_in_function_def && !async_context) || async;
139139
in_function_def := true;
140140
Ast_async.make_function_async ~async (default_expr_mapper self e)
141-
| Uncurry _, pexp_attributes ->
142-
async_context := async;
143-
Ast_uncurry_gen.to_uncurry_fn {e with pexp_attributes} self label pat body
144-
async
145141
| Method _, _ ->
146142
Location.raise_errorf ~loc:e.pexp_loc
147143
"%@meth is not supported in function expression"

0 commit comments

Comments
 (0)