File tree Expand file tree Collapse file tree 7 files changed +37
-8
lines changed Expand file tree Collapse file tree 7 files changed +37
-8
lines changed Original file line number Diff line number Diff line change 1515#### :nail_care : Polish
1616
1717- Add the gap property to jsxDOMStyle https://github.com/rescript-lang/rescript-compiler/pull/5956
18+
19+ #### :bug : Bug Fix
1820- Fix issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730
1921- Fix issue where uncurried functions were incorrectly converting the type of a prop given as a default value to curried https://github.com/rescript-lang/syntax/pull/731
22+ - Fix issue with nested async functions, where the inner function would be emitted without ` async `
2023
2124# 10.1.2
2225
Original file line number Diff line number Diff line change @@ -681,6 +681,8 @@ let rec cut n l =
681681
682682let try_ids = Hashtbl. create 8
683683
684+ let has_async_attribute exp = exp.exp_attributes |> List. exists (fun ({txt} , _payload ) -> txt = " res.async" )
685+
684686let rec transl_exp e =
685687 List. iter (Translattribute. check_attribute e) e.exp_attributes;
686688 transl_exp0 e
@@ -695,7 +697,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
695697 | Texp_let (rec_flag , pat_expr_list , body ) ->
696698 transl_let rec_flag pat_expr_list (transl_exp body)
697699 | Texp_function { arg_label = _ ; param; cases; partial } ->
698- let async = e.exp_attributes |> List. exists ( fun ( {txt} , _payload ) -> txt = " res.async " ) in
700+ let async = has_async_attribute e in
699701 let params, body, return_unit =
700702 let pl = push_defaults e.exp_loc [] cases partial in
701703 transl_function e.exp_loc partial param pl
@@ -1021,7 +1023,7 @@ and transl_function loc partial param cases =
10211023 } as exp;
10221024 };
10231025 ]
1024- when Parmatch. inactive ~partial pat ->
1026+ when Parmatch. inactive ~partial pat && not (exp |> has_async_attribute) ->
10251027 let params, body, return_unit =
10261028 transl_function exp.exp_loc partial' param' cases
10271029 in
Original file line number Diff line number Diff line change @@ -38,10 +38,24 @@ async function broken$1(someAsyncFunction) {
3838
3939var broken$2 = broken$1 ;
4040
41+ function nested1 ( param ) {
42+ return async function ( y ) {
43+ return await y ;
44+ } ;
45+ }
46+
47+ async function nested2 ( param ) {
48+ return async function ( y ) {
49+ return await y ;
50+ } ;
51+ }
52+
4153exports . willBeInlined = willBeInlined ;
4254exports . inlined = inlined ;
4355exports . wrapSomethingAsync = wrapSomethingAsync ;
4456exports . wrapSomethingAsync2 = wrapSomethingAsync2 ;
4557exports . M = M ;
4658exports . broken = broken$2 ;
59+ exports . nested1 = nested1 ;
60+ exports . nested2 = nested2 ;
4761/* inlined Not a pure module */
Original file line number Diff line number Diff line change @@ -36,3 +36,7 @@ let broken = async (someAsyncFunction) => {
3636}
3737
3838let broken = someAsyncFunction => broken (someAsyncFunction )
39+
40+ let nested1 = () => async (y ) => await y
41+
42+ let nested2 = async () => async (y ) => await y
Original file line number Diff line number Diff line change @@ -283499,6 +283499,8 @@ let rec cut n l =
283499283499
283500283500let try_ids = Hashtbl.create 8
283501283501
283502+ let has_async_attribute exp = exp.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async")
283503+
283502283504let rec transl_exp e =
283503283505 List.iter (Translattribute.check_attribute e) e.exp_attributes;
283504283506 transl_exp0 e
@@ -283513,7 +283515,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
283513283515 | Texp_let (rec_flag, pat_expr_list, body) ->
283514283516 transl_let rec_flag pat_expr_list (transl_exp body)
283515283517 | Texp_function { arg_label = _; param; cases; partial } ->
283516- let async = e.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async") in
283518+ let async = has_async_attribute e in
283517283519 let params, body, return_unit =
283518283520 let pl = push_defaults e.exp_loc [] cases partial in
283519283521 transl_function e.exp_loc partial param pl
@@ -283839,7 +283841,7 @@ and transl_function loc partial param cases =
283839283841 } as exp;
283840283842 };
283841283843 ]
283842- when Parmatch.inactive ~partial pat ->
283844+ when Parmatch.inactive ~partial pat && not (exp |> has_async_attribute) ->
283843283845 let params, body, return_unit =
283844283846 transl_function exp.exp_loc partial' param' cases
283845283847 in
Original file line number Diff line number Diff line change @@ -293507,6 +293507,8 @@ let rec cut n l =
293507293507
293508293508let try_ids = Hashtbl.create 8
293509293509
293510+ let has_async_attribute exp = exp.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async")
293511+
293510293512let rec transl_exp e =
293511293513 List.iter (Translattribute.check_attribute e) e.exp_attributes;
293512293514 transl_exp0 e
@@ -293521,7 +293523,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
293521293523 | Texp_let (rec_flag, pat_expr_list, body) ->
293522293524 transl_let rec_flag pat_expr_list (transl_exp body)
293523293525 | Texp_function { arg_label = _; param; cases; partial } ->
293524- let async = e.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async") in
293526+ let async = has_async_attribute e in
293525293527 let params, body, return_unit =
293526293528 let pl = push_defaults e.exp_loc [] cases partial in
293527293529 transl_function e.exp_loc partial param pl
@@ -293847,7 +293849,7 @@ and transl_function loc partial param cases =
293847293849 } as exp;
293848293850 };
293849293851 ]
293850- when Parmatch.inactive ~partial pat ->
293852+ when Parmatch.inactive ~partial pat && not (exp |> has_async_attribute) ->
293851293853 let params, body, return_unit =
293852293854 transl_function exp.exp_loc partial' param' cases
293853293855 in
Original file line number Diff line number Diff line change @@ -292966,6 +292966,8 @@ let rec cut n l =
292966292966
292967292967let try_ids = Hashtbl.create 8
292968292968
292969+ let has_async_attribute exp = exp.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async")
292970+
292969292971let rec transl_exp e =
292970292972 List.iter (Translattribute.check_attribute e) e.exp_attributes;
292971292973 transl_exp0 e
@@ -292980,7 +292982,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
292980292982 | Texp_let (rec_flag, pat_expr_list, body) ->
292981292983 transl_let rec_flag pat_expr_list (transl_exp body)
292982292984 | Texp_function { arg_label = _; param; cases; partial } ->
292983- let async = e.exp_attributes |> List.exists (fun ({txt}, _payload) -> txt = "res.async") in
292985+ let async = has_async_attribute e in
292984292986 let params, body, return_unit =
292985292987 let pl = push_defaults e.exp_loc [] cases partial in
292986292988 transl_function e.exp_loc partial param pl
@@ -293306,7 +293308,7 @@ and transl_function loc partial param cases =
293306293308 } as exp;
293307293309 };
293308293310 ]
293309- when Parmatch.inactive ~partial pat ->
293311+ when Parmatch.inactive ~partial pat && not (exp |> has_async_attribute) ->
293310293312 let params, body, return_unit =
293311293313 transl_function exp.exp_loc partial' param' cases
293312293314 in
You can’t perform that action at this time.
0 commit comments