Skip to content

Commit e8730f9

Browse files
authored
Remove attribute "internal.arity" (#7004)
* Remove attribute "internal.arity" * CHANGELOG
1 parent b0b5fb1 commit e8730f9

File tree

7 files changed

+23
-60
lines changed

7 files changed

+23
-60
lines changed

CHANGELOG.md

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

4444
- Add dev container. https://github.com/rescript-lang/rescript-compiler/pull/6962
4545
- Convert more tests to the node test runner. https://github.com/rescript-lang/rescript-compiler/pull/6956
46+
- Remove attribute "internal.arity". https://github.com/rescript-lang/rescript-compiler/pull/7004
4647

4748
# 12.0.0-alpha.1
4849

jscomp/frontend/ast_attributes.ml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,6 @@ let get : attr = ({txt = "get"; loc = locg}, Ast_payload.empty)
275275

276276
let get_index : attr = ({txt = "get_index"; loc = locg}, Ast_payload.empty)
277277

278-
let bs_get_arity : attr =
279-
( {txt = "internal.arity"; loc = locg},
280-
PStr
281-
[
282-
{
283-
pstr_desc = Pstr_eval (Ast_compatible.const_exp_int ~loc:locg 1, []);
284-
pstr_loc = locg;
285-
};
286-
] )
287-
288278
let set : attr = ({txt = "set"; loc = locg}, Ast_payload.empty)
289279

290280
let internal_expansive : attr =

jscomp/frontend/ast_attributes.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ val get : attr
5858

5959
val get_index : attr
6060

61-
val bs_get_arity : attr
62-
6361
val set : attr
6462

6563
val bs_return_undefined : attr

jscomp/frontend/ast_derive_abstract.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ let is_abstract (xs : Ast_payload.action list) =
5757
let get_optional_attrs =
5858
[Ast_attributes.get; Ast_attributes.bs_return_undefined]
5959

60-
let get_attrs = [Ast_attributes.bs_get_arity]
60+
let get_attrs = []
6161

6262
let set_attrs = [Ast_attributes.set]
6363

jscomp/ml/typedecl.ml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,21 +1730,7 @@ let transl_value_decl env loc valdecl =
17301730
| [] ->
17311731
raise (Error(valdecl.pval_loc, Val_in_structure))
17321732
| _ ->
1733-
let arity, from_constructor =
1734-
let rec scan_attributes (attrs : Parsetree.attributes) =
1735-
match attrs with
1736-
| ({txt = "internal.arity";_}, (* This is likely not needed in uncurried mode *)
1737-
PStr [ {pstr_desc = Pstr_eval
1738-
(
1739-
({pexp_desc = Pexp_constant (Pconst_integer (i,_))} :
1740-
Parsetree.expression) ,_)}]) :: _ ->
1741-
Some (int_of_string i)
1742-
| _ :: rest -> scan_attributes rest
1743-
| [] -> None
1744-
in
1745-
match scan_attributes valdecl.pval_attributes with
1746-
| None -> parse_arity env valdecl.pval_type ty
1747-
| Some x -> x, false
1733+
let arity, from_constructor = parse_arity env valdecl.pval_type ty
17481734
in
17491735
let prim = Primitive.parse_declaration valdecl ~arity ~from_constructor in
17501736
let prim_native_name = prim.prim_native_name in

jscomp/syntax/tests/parsing/infiniteLoops/expected/nonRecTypes.res.txt

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,39 @@
2525

2626

2727
Syntax error!
28-
tests/parsing/infiniteLoops/nonRecTypes.res:67:26-68:3
28+
tests/parsing/infiniteLoops/nonRecTypes.res:61:26-62:3
2929

30-
65 │ };
31-
66 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
32-
67 │ let rec minNode = node =>
33-
68 │ let findMin = rbt =>
34-
69 │ let removeNode = (rbt, node) => {
35-
70 │ let nodeToRemove =
30+
59 │ };
31+
60 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
32+
61 │ let rec minNode = node =>
33+
62 │ let findMin = rbt =>
34+
63 │ let removeNode = (rbt, node) => {
35+
64 │ let nodeToRemove =
3636

3737
I'm not sure what to parse here when looking at "let".
3838

3939

4040
Syntax error!
41-
tests/parsing/infiniteLoops/nonRecTypes.res:68:21-69:3
41+
tests/parsing/infiniteLoops/nonRecTypes.res:62:21-63:3
4242

43-
66 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
44-
67 │ let rec minNode = node =>
45-
68 │ let findMin = rbt =>
46-
69 │ let removeNode = (rbt, node) => {
47-
70 │ let nodeToRemove =
48-
71 │ switch (leftGet(node), rightGet(node)) {
43+
60 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
44+
61 │ let rec minNode = node =>
45+
62 │ let findMin = rbt =>
46+
63 │ let removeNode = (rbt, node) => {
47+
64 │ let nodeToRemove =
48+
65 │ switch (leftGet(node), rightGet(node)) {
4949

5050
I'm not sure what to parse here when looking at "let".
5151

5252

5353
Syntax error!
54-
tests/parsing/infiniteLoops/nonRecTypes.res:434:31-38
54+
tests/parsing/infiniteLoops/nonRecTypes.res:428:31-38
5555

56-
432 │ updateSum(Some(node), ~delta);
57-
433 │ };
58-
434 │ type nonrec oldNewVisibleNodes('value) = {
59-
435 │ mutable old: array('value),
60-
436 │ mutable new_: array('value),
56+
426 │ updateSum(Some(node), ~delta);
57+
427 │ };
58+
428 │ type nonrec oldNewVisibleNodes('value) = {
59+
429 │ mutable old: array('value),
60+
430 │ mutable new_: array('value),
6161

6262
Type parameters require angle brackets:
6363
oldNewVisibleNodes<'value>
@@ -93,10 +93,8 @@ include
9393
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x15\0\0\0\t\0\0\0\x1a\0\0\0\x19\xb0\xa0\xa0A\x91@\xa0\xa0A\x04\x03@E\x97\xa0$size@|js}
9494
;;[|(({js|use sizeGet instead or use {abstract = light} explicitly|js})
9595
[@ocaml.deprecated ])|]
96-
;;[|((1)[@internal.arity ])|]
9796
external size : ('value t -> int, [ `Has_arity1 ]) function$ = ""
9897
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$size@|js}
99-
;;[|((1)[@internal.arity ])|]
10098
external sizeGet : ('value t -> int, [ `Has_arity1 ]) function$ = ""
10199
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$size@|js}
102100
external rootSet :
@@ -105,24 +103,20 @@ include
105103
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x15\0\0\0\t\0\0\0\x1a\0\0\0\x19\xb0\xa0\xa0A\x91@\xa0\xa0A\x04\x03@E\x97\xa0$root@|js}
106104
;;[|(({js|use rootGet instead or use {abstract = light} explicitly|js})
107105
[@ocaml.deprecated ])|]
108-
;;[|((1)[@internal.arity ])|]
109106
external root :
110107
('value t -> 'value node option, [ `Has_arity1 ]) function$ = ""
111108
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$root@|js}
112-
;;[|((1)[@internal.arity ])|]
113109
external rootGet :
114110
('value t -> 'value node option, [ `Has_arity1 ]) function$ = ""
115111
;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$root@|js}
116112
;;[|(({js|use compareGet instead or use {abstract = light} explicitly|js})
117113
[@ocaml.deprecated ])|]
118-
;;[|((1)[@internal.arity ])|]
119114
external compare :
120115
('value t -> [ [%rescript.typehole ]] Js.Internal.fn,
121116
[ `Has_arity1 ]) function$
122117
;;(({js|Arity_2('value, 'value)], int) =
123118
""
124119
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x13\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0'compare@";
125-
[@internal.arity 1]
126120
external compareGet:
127121
t('value) => Js.Internal.fn([ | |js})
128122
[@res.template ])

jscomp/syntax/tests/parsing/infiniteLoops/nonRecTypes.res

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ include {
2727
[@ocaml.deprecated
2828
"use sizeGet instead or use {abstract = light} explicitly"
2929
]
30-
[@internal.arity 1]
3130
external size: t('value) => int =
3231
""
3332
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$size@";
34-
[@internal.arity 1]
3533
external sizeGet: t('value) => int =
3634
""
3735
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$size@";
@@ -41,23 +39,19 @@ include {
4139
[@ocaml.deprecated
4240
"use rootGet instead or use {abstract = light} explicitly"
4341
]
44-
[@internal.arity 1]
4542
external root: t('value) => option(node('value)) =
4643
""
4744
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$root@";
48-
[@internal.arity 1]
4945
external rootGet: t('value) => option(node('value)) =
5046
""
5147
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x10\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0$root@";
5248
[@ocaml.deprecated
5349
"use compareGet instead or use {abstract = light} explicitly"
5450
]
55-
[@internal.arity 1]
5651
external compare:
5752
t('value) => Js.Internal.fn([ | `Arity_2('value, 'value)], int) =
5853
""
5954
"BS:6.0.1\x84\x95\xa6\xbe\0\0\0\x13\0\0\0\x07\0\0\0\x14\0\0\0\x13\xb0\xa0\xa0A\x91@@A\x98\xa0'compare@";
60-
[@internal.arity 1]
6155
external compareGet:
6256
t('value) => Js.Internal.fn([ | `Arity_2('value, 'value)], int) =
6357
""

0 commit comments

Comments
 (0)