Skip to content
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 @@ -19,6 +19,7 @@
#### :rocket: New Feature

#### :bug: Bug fix
- Fix issue with ast conversion (for ppx use) on functions with attributes on first argument. https://github.com/rescript-lang/rescript/pull/7761

#### :memo: Documentation

Expand Down
4 changes: 3 additions & 1 deletion compiler/ml/ast_mapper_to0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ module T = struct
| Ptyp_arrow {arg; ret; arity} -> (
let lbl = Asttypes.to_noloc arg.lbl in
let typ0 =
arrow ~loc ~attrs lbl (sub.typ sub arg.typ) (sub.typ sub ret)
arrow ~loc
~attrs:(attrs @ sub.attributes sub arg.attrs)
lbl (sub.typ sub arg.typ) (sub.typ sub ret)
in
match arity with
| None -> typ0
Expand Down
1 change: 1 addition & 0 deletions tests/syntax_tests/data/ast-mapping/FunWithAttribute.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type fn = (@as("something") ~foo: string) => int
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type fn = (@as("something") ~foo: string) => int
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit illustrates the difference.
This should fix the original issue, but needs testing just in case.

Loading