Skip to content

Fix issue with async context and locally abstract types #5985

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 1 commit into from
Feb 6, 2023
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
- Fix issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730
- 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
- Fix issue with nested async functions, where the inner function would be emitted without `async` https://github.com/rescript-lang/rescript-compiler/pull/5984
- Fix issue with printing async functions with locally abstract types https://github.com/rescript-lang/syntax/pull/732
- Fix issue with async context and locally abstract types https://github.com/rescript-lang/rescript-compiler/pull/5985

# 10.1.2

Expand Down
5 changes: 5 additions & 0 deletions jscomp/frontend/bs_builtin_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
| true, pexp_attributes ->
Ast_bs_open.convertBsErrorFunction e.pexp_loc self pexp_attributes
cases)
| Pexp_newtype (s, body) ->
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
let body = Ast_async.add_async_attribute ~async body in
let res = self.expr self body in
{e with pexp_desc = Pexp_newtype(s, res)}
| Pexp_fun (label, _, pat, body) -> (
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
match Ast_attributes.process_attributes_rev e.pexp_attributes with
Expand Down
1 change: 1 addition & 0 deletions jscomp/napkin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- Fix an issue where error messages related to duplicate props were displayed without a loc and were unclear https://github.com/rescript-lang/syntax/pull/728
- Fix issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730
- 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
- Fix issue with printing async functions with locally abstract types https://github.com/rescript-lang/syntax/pull/732

#### :eyeglasses: Spec Compliance

Expand Down
11 changes: 7 additions & 4 deletions lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49739,10 +49739,8 @@ let funExpr expr =
| expr -> (attrsBefore, List.rev acc, expr)
in
match expr with
| {
pexp_desc = Pexp_fun (_, _defaultExpr, _pattern, _returnExpr);
pexp_attributes = attrs;
} as expr ->
| {pexp_desc = Pexp_fun _ | Pexp_newtype _; pexp_attributes = attrs} as expr
->
collect attrs [] {expr with pexp_attributes = []}
| expr -> collect [] [] expr

Expand Down Expand Up @@ -272986,6 +272984,11 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
| true, pexp_attributes ->
Ast_bs_open.convertBsErrorFunction e.pexp_loc self pexp_attributes
cases)
| Pexp_newtype (s, body) ->
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
let body = Ast_async.add_async_attribute ~async body in
let res = self.expr self body in
{e with pexp_desc = Pexp_newtype(s, res)}
| Pexp_fun (label, _, pat, body) -> (
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
match Ast_attributes.process_attributes_rev e.pexp_attributes with
Expand Down
11 changes: 7 additions & 4 deletions lib/4.06.1/unstable/js_playground_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49739,10 +49739,8 @@ let funExpr expr =
| expr -> (attrsBefore, List.rev acc, expr)
in
match expr with
| {
pexp_desc = Pexp_fun (_, _defaultExpr, _pattern, _returnExpr);
pexp_attributes = attrs;
} as expr ->
| {pexp_desc = Pexp_fun _ | Pexp_newtype _; pexp_attributes = attrs} as expr
->
collect attrs [] {expr with pexp_attributes = []}
| expr -> collect [] [] expr

Expand Down Expand Up @@ -272986,6 +272984,11 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
| true, pexp_attributes ->
Ast_bs_open.convertBsErrorFunction e.pexp_loc self pexp_attributes
cases)
| Pexp_newtype (s, body) ->
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
let body = Ast_async.add_async_attribute ~async body in
let res = self.expr self body in
{e with pexp_desc = Pexp_newtype(s, res)}
| Pexp_fun (label, _, pat, body) -> (
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
match Ast_attributes.process_attributes_rev e.pexp_attributes with
Expand Down
11 changes: 7 additions & 4 deletions lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225711,10 +225711,8 @@ let funExpr expr =
| expr -> (attrsBefore, List.rev acc, expr)
in
match expr with
| {
pexp_desc = Pexp_fun (_, _defaultExpr, _pattern, _returnExpr);
pexp_attributes = attrs;
} as expr ->
| {pexp_desc = Pexp_fun _ | Pexp_newtype _; pexp_attributes = attrs} as expr
->
collect attrs [] {expr with pexp_attributes = []}
| expr -> collect [] [] expr

Expand Down Expand Up @@ -283370,6 +283368,11 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
| true, pexp_attributes ->
Ast_bs_open.convertBsErrorFunction e.pexp_loc self pexp_attributes
cases)
| Pexp_newtype (s, body) ->
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
let body = Ast_async.add_async_attribute ~async body in
let res = self.expr self body in
{e with pexp_desc = Pexp_newtype(s, res)}
| Pexp_fun (label, _, pat, body) -> (
let async = Ast_attributes.has_async_payload e.pexp_attributes <> None in
match Ast_attributes.process_attributes_rev e.pexp_attributes with
Expand Down