Skip to content
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

Fix issues where pipe "->" processing eats up attributes in 1 arity function #5585

Merged
merged 3 commits into from
Jul 23, 2022
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
4 changes: 3 additions & 1 deletion jscomp/frontend/ast_exp_apply.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
pexp_attributes = [];
pexp_loc = loc;
}
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
| _ ->
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
new_obj_arg))
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
(* - obj##property
- obj#(method a b )
Expand Down
18 changes: 18 additions & 0 deletions jscomp/test/res_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ var bad = {
name: bad_name
};

function identity(x) {
return x;
}

var name1 = "ReScript";

var ok1 = {
name: name1
};

var bad1 = {
name: name1
};

var v2 = newrecord;

var v1 = {
Expand All @@ -73,4 +87,8 @@ exports.optionMap = optionMap;
exports.name = name;
exports.ok = ok;
exports.bad = bad;
exports.identity = identity;
exports.name1 = name1;
exports.ok1 = ok1;
exports.bad1 = bad1;
/* Not a pure module */
9 changes: 8 additions & 1 deletion jscomp/test/res_debug.res
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@ type props<'name> = {key?: string, name?: string}
let name = None

let ok = {name: ?optionMap(name, x => x)}
let bad = {name: ?name->optionMap(x => x)}
let bad = {name: ?name->optionMap(x => x)}

let identity = x => x

let name1 = Some("ReScript")

let ok1 = {name: ?identity(name1)}
let bad1 = {name: ?name1->identity}
4 changes: 3 additions & 1 deletion lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -269598,7 +269598,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
pexp_attributes = [];
pexp_loc = loc;
}
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
| _ ->
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
new_obj_arg))
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
(* - obj##property
- obj#(method a b )
Expand Down
4 changes: 3 additions & 1 deletion lib/4.06.1/unstable/js_playground_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -271061,7 +271061,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
pexp_attributes = [];
pexp_loc = loc;
}
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
| _ ->
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
new_obj_arg))
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
(* - obj##property
- obj#(method a b )
Expand Down
4 changes: 3 additions & 1 deletion lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -281351,7 +281351,9 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
pexp_attributes = [];
pexp_loc = loc;
}
| _ -> Ast_compatible.app1 ~loc fn new_obj_arg))
| _ ->
Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes fn
new_obj_arg))
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
(* - obj##property
- obj#(method a b )
Expand Down