Skip to content

Fix printing of local module with type. #6239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
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 @@ -20,6 +20,7 @@

- Remove unnecessary require and import statements when using dynamic imports. https://github.com/rescript-lang/rescript-compiler/pull/6232
- Fix option unboxing logic in the presence of untagged variants. https://github.com/rescript-lang/rescript-compiler/pull/6233
- Fix printing of local module with type. https://github.com/rescript-lang/rescript-compiler/issues/6212

#### :nail_care: Polish

Expand Down
9 changes: 9 additions & 0 deletions jscomp/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4965,6 +4965,15 @@ and printExpressionBlock ~state ~braces expr cmtTbl =
let doc = Doc.text modName.txt in
printComments doc cmtTbl modName.loc
in
let name, modExpr =
match modExpr.pmod_desc with
| Pmod_constraint (modExpr, modType) ->
let name =
Doc.concat [name; Doc.text ": "; printModType ~state modType cmtTbl]
in
(name, modExpr)
| _ -> (name, modExpr)
in
let letModuleDoc =
Doc.concat
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ module Empty = {/* test */}
module EmptyModule = {
/* TODO: management on vacation */
}

module type T = {}

let g = {
module M: T = {}
0
}
7 changes: 7 additions & 0 deletions jscomp/syntax/tests/printer/modExpr/structure.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ module Empty = {/* test */}
module EmptyModule = {
/* TODO: management on vacation */
}

module type T = {}

let g = {
module M: T = {}
0
}