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
3 changes: 3 additions & 0 deletions jscomp/syntax/src/res_comments_table.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,9 @@ and walkCoreType typ t comments =
attach t.trailing typexpr.ptyp_loc afterTyp
| Ptyp_variant (rowFields, _, _) ->
walkList (rowFields |> List.map (fun rf -> RowField rf)) t comments
| Ptyp_constr
({txt = Lident "function$"}, [({ptyp_desc = Ptyp_arrow _} as desc); _]) ->
walkCoreType desc t comments
| Ptyp_constr (longident, typexprs) ->
let beforeLongident, _afterLongident =
partitionLeadingTrailing comments longident.loc
Expand Down
14 changes: 14 additions & 0 deletions jscomp/syntax/tests/printer/comments/expected/typexpr.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ type jsUser = /* before */ {
// above age
/* before age */ "age" /* after age */: /* before int */ int /* after int */,
} /* after */

external test: (
// comment 1
~int: int,
// comment 2
~int: int,
) => unit = "test"

external another_test: (
// comment 1
int,
// comment 2
int,
) => unit = "test"
14 changes: 14 additions & 0 deletions jscomp/syntax/tests/printer/comments/typexpr.res
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,17 @@ type jsUser = /* before */ {
// above age
/* before age */"age" /* after age */: /*before int */ int /*after int */
} /* after */

external test: (
// comment 1
~int: int,
// comment 2
~int: int,
) => unit = "test"

external another_test: (
// comment 1
int,
// comment 2
int,
) => unit = "test"