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 @@ -18,6 +18,7 @@
- Generic JSX transform: Rename expected module name for lowercase JSX to `Elements` from `DOM`. https://github.com/rescript-lang/rescript-compiler/pull/6606
- Generic JSX transform: Set default config params for `jsxConfig`. https://github.com/rescript-lang/rescript-compiler/pull/6606
- Generic JSX transform: Handle namespaced names. https://github.com/rescript-lang/rescript-compiler/pull/6606
- Fix issue with doc comment in recursive module. https://github.com/rescript-lang/rescript-compiler/pull/6613

#### :house: Internal

Expand Down
9 changes: 8 additions & 1 deletion jscomp/syntax/src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6028,7 +6028,14 @@ and parseModuleBindingBody p =
and parseModuleBindings ~attrs ~startPos p =
let rec loop p acc =
let startPos = p.Parser.startPos in
let attrs = parseAttributesAndBinding p in
let docAttr : Parsetree.attributes =
match p.Parser.token with
| DocComment (loc, s) ->
Parser.next p;
[docCommentToAttribute loc s]
| _ -> []
in
let attrs = docAttr @ parseAttributesAndBinding p in
match p.Parser.token with
| And ->
Parser.next p;
Expand Down
15 changes: 15 additions & 0 deletions jscomp/syntax/tests/printer/expr/DocComments.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ module M : {

@val
external ex : (/** ddd */ ~x: int, /** eee */ n) => int = "ex"

/** A */
module rec A : { type t } = {
type t
}

/** B */
and B : { type t } = {
type t
}

@res.doc(" C ")
and C : { type t} = {
type t
}
21 changes: 21 additions & 0 deletions jscomp/syntax/tests/printer/expr/expected/DocComments.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ module M: {

@val
external ex: (/** ddd */ ~x: int, /** eee */ n) => int = "ex"

/** A */
module rec A: {
type t
} = {
type t
}

/** B */
and B: {
type t
} = {
type t
}

/** C */
and C: {
type t
} = {
type t
}