Skip to content

Commit db0f66f

Browse files
committed
Fix comment removed when function signature has type keyword
1 parent d241c65 commit db0f66f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

jscomp/syntax/src/res_comments_table.ml

+2
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,8 @@ and walk_expression expr t comments =
14521452
attach t.leading expr.pexp_loc leading;
14531453
walk_expression expr t inside;
14541454
attach t.trailing expr.pexp_loc trailing
1455+
| Pexp_construct ({txt = Longident.Lident "Function$"}, Some return_expr) ->
1456+
walk_expression return_expr t comments
14551457
| _ ->
14561458
if is_block_expr return_expr then walk_expression return_expr t comments
14571459
else

jscomp/syntax/tests/printer/comments/expected/expr.res.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ let f = (
226226
/* c6 */ ~x=?,
227227
) => /* c7 */ ()
228228

229-
let multiply = (type /* c-2 */ t /* c-1 */, m1 /* c1 */, /* c2 */ m2 /* c3 */) => ()
229+
let multiply = (type /* c-2 */ t /* c-1 */, /* c0 */ m1 /* c1 */, /* c2 */ m2 /* c3 */) => ()
230230
let multiply = (
231231
type /* c-4 */ t /* c-3 */,
232-
m1 /* c1 */,
232+
/* c0 */ m1 /* c1 */,
233233
type /* c-2 */ s /* c-1 */,
234234
/* c2 */ m2 /* c3 */,
235235
) => ()

0 commit comments

Comments
 (0)