Skip to content

Remove attribute "internal.arity" #7004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2024
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 @@ -43,6 +43,7 @@

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

# 12.0.0-alpha.1

Expand Down
10 changes: 0 additions & 10 deletions jscomp/frontend/ast_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,6 @@ let get : attr = ({txt = "get"; loc = locg}, Ast_payload.empty)

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

let bs_get_arity : attr =
( {txt = "internal.arity"; loc = locg},
PStr
[
{
pstr_desc = Pstr_eval (Ast_compatible.const_exp_int ~loc:locg 1, []);
pstr_loc = locg;
};
] )

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

let internal_expansive : attr =
Expand Down
2 changes: 0 additions & 2 deletions jscomp/frontend/ast_attributes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ val get : attr

val get_index : attr

val bs_get_arity : attr

val set : attr

val bs_return_undefined : attr
Expand Down
2 changes: 1 addition & 1 deletion jscomp/frontend/ast_derive_abstract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let is_abstract (xs : Ast_payload.action list) =
let get_optional_attrs =
[Ast_attributes.get; Ast_attributes.bs_return_undefined]

let get_attrs = [Ast_attributes.bs_get_arity]
let get_attrs = []

let set_attrs = [Ast_attributes.set]

Expand Down
16 changes: 1 addition & 15 deletions jscomp/ml/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1730,21 +1730,7 @@ let transl_value_decl env loc valdecl =
| [] ->
raise (Error(valdecl.pval_loc, Val_in_structure))
| _ ->
let arity, from_constructor =
let rec scan_attributes (attrs : Parsetree.attributes) =
match attrs with
| ({txt = "internal.arity";_}, (* This is likely not needed in uncurried mode *)
PStr [ {pstr_desc = Pstr_eval
(
({pexp_desc = Pexp_constant (Pconst_integer (i,_))} :
Parsetree.expression) ,_)}]) :: _ ->
Some (int_of_string i)
| _ :: rest -> scan_attributes rest
| [] -> None
in
match scan_attributes valdecl.pval_attributes with
| None -> parse_arity env valdecl.pval_type ty
| Some x -> x, false
let arity, from_constructor = parse_arity env valdecl.pval_type ty
in
let prim = Primitive.parse_declaration valdecl ~arity ~from_constructor in
let prim_native_name = prim.prim_native_name in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,39 @@


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

65 │ };
66 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
67 │ let rec minNode = node =>
68 │ let findMin = rbt =>
69 │ let removeNode = (rbt, node) => {
70 │ let nodeToRemove =
59 │ };
60 │ let has = (rbt, value) => _findNode(rbt, rootGet(rbt), value) !== None;
61 │ let rec minNode = node =>
62 │ let findMin = rbt =>
63 │ let removeNode = (rbt, node) => {
64 │ let nodeToRemove =

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


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

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

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


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

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

Type parameters require angle brackets:
oldNewVisibleNodes<'value>
Expand Down Expand Up @@ -93,10 +93,8 @@ include
;;{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}
;;[|(({js|use sizeGet instead or use {abstract = light} explicitly|js})
[@ocaml.deprecated ])|]
;;[|((1)[@internal.arity ])|]
external size : ('value t -> int, [ `Has_arity1 ]) function$ = ""
;;{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}
;;[|((1)[@internal.arity ])|]
external sizeGet : ('value t -> int, [ `Has_arity1 ]) function$ = ""
;;{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}
external rootSet :
Expand All @@ -105,24 +103,20 @@ include
;;{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}
;;[|(({js|use rootGet instead or use {abstract = light} explicitly|js})
[@ocaml.deprecated ])|]
;;[|((1)[@internal.arity ])|]
external root :
('value t -> 'value node option, [ `Has_arity1 ]) function$ = ""
;;{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}
;;[|((1)[@internal.arity ])|]
external rootGet :
('value t -> 'value node option, [ `Has_arity1 ]) function$ = ""
;;{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}
;;[|(({js|use compareGet instead or use {abstract = light} explicitly|js})
[@ocaml.deprecated ])|]
;;[|((1)[@internal.arity ])|]
external compare :
('value t -> [ [%rescript.typehole ]] Js.Internal.fn,
[ `Has_arity1 ]) function$
;;(({js|Arity_2('value, 'value)], int) =
""
"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@";
[@internal.arity 1]
external compareGet:
t('value) => Js.Internal.fn([ | |js})
[@res.template ])
Expand Down
6 changes: 0 additions & 6 deletions jscomp/syntax/tests/parsing/infiniteLoops/nonRecTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ include {
[@ocaml.deprecated
"use sizeGet instead or use {abstract = light} explicitly"
]
[@internal.arity 1]
external size: t('value) => int =
""
"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@";
[@internal.arity 1]
external sizeGet: t('value) => int =
""
"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@";
Expand All @@ -41,23 +39,19 @@ include {
[@ocaml.deprecated
"use rootGet instead or use {abstract = light} explicitly"
]
[@internal.arity 1]
external root: t('value) => option(node('value)) =
""
"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@";
[@internal.arity 1]
external rootGet: t('value) => option(node('value)) =
""
"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@";
[@ocaml.deprecated
"use compareGet instead or use {abstract = light} explicitly"
]
[@internal.arity 1]
external compare:
t('value) => Js.Internal.fn([ | `Arity_2('value, 'value)], int) =
""
"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@";
[@internal.arity 1]
external compareGet:
t('value) => Js.Internal.fn([ | `Arity_2('value, 'value)], int) =
""
Expand Down