diff --git a/jscomp/frontend/ast_exp_apply.ml b/jscomp/frontend/ast_exp_apply.ml index 847340b252..817facc16c 100644 --- a/jscomp/frontend/ast_exp_apply.ml +++ b/jscomp/frontend/ast_exp_apply.ml @@ -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 ) diff --git a/jscomp/test/res_debug.js b/jscomp/test/res_debug.js index 7ae8a31c70..bd4779d995 100644 --- a/jscomp/test/res_debug.js +++ b/jscomp/test/res_debug.js @@ -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 = { @@ -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 */ diff --git a/jscomp/test/res_debug.res b/jscomp/test/res_debug.res index e2cae86f9f..142f8f580c 100644 --- a/jscomp/test/res_debug.res +++ b/jscomp/test/res_debug.res @@ -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)} \ No newline at end of file +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} diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 75dfe915af..481c949428 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -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 ) diff --git a/lib/4.06.1/unstable/js_playground_compiler.ml b/lib/4.06.1/unstable/js_playground_compiler.ml index a8c679ca54..0d25a58228 100644 --- a/lib/4.06.1/unstable/js_playground_compiler.ml +++ b/lib/4.06.1/unstable/js_playground_compiler.ml @@ -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 ) diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index 1b32d1bdfc..a7f38284a1 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -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 )