Skip to content

Commit 0148456

Browse files
shulhicknitt
authored andcommitted
Fix comment removed when function signature has type keyword (#6997)
* Fix comment removed when function signature has type keyword * Update CHANGELOG
1 parent ae131a2 commit 0148456

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Fix incorrect format of function under unary operator. https://github.com/rescript-lang/rescript-compiler/pull/6953
1717
- Fix incorrect incorrect printing of module binding with signature. https://github.com/rescript-lang/rescript-compiler/pull/6963
1818
- Disallow spreading anything but regular variants inside of other variants. https://github.com/rescript-lang/rescript-compiler/pull/6980
19+
- Fix comment removed when function signature has `type` keyword. https://github.com/rescript-lang/rescript-compiler/pull/6997
1920

2021
# 11.1.3
2122

@@ -2508,4 +2509,4 @@ Features:
25082509
25092510
# 1.0.0
25102511
2511-
Initial release
2512+
Initial release

jscomp/syntax/src/res_comments_table.ml

+2
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,8 @@ and walkExpression expr t comments =
14041404
attach t.leading expr.pexp_loc leading;
14051405
walkExpression expr t inside;
14061406
attach t.trailing expr.pexp_loc trailing
1407+
| Pexp_construct ({txt = Longident.Lident "Function$"}, Some returnExpr) ->
1408+
walkExpression returnExpr t comments
14071409
| _ ->
14081410
if isBlockExpr returnExpr then walkExpression returnExpr t comments
14091411
else

0 commit comments

Comments
 (0)