Skip to content

Commit 4e269dc

Browse files
authored
Fix outcome printing for empty objects (rescript-lang#444)
1 parent d7211d6 commit 4e269dc

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

syntax/src/res_outcome_printer.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ let printPolyVarIdent txt =
468468
and printObjectFields fields rest =
469469
let dots = match rest with
470470
| Some non_gen -> Doc.text ((if non_gen then "_" else "") ^ "..")
471-
| None -> Doc.nil
471+
| None -> if fields = [] then Doc.dot else Doc.nil
472472
in
473473
Doc.group (
474474
Doc.concat [

syntax/tests/oprint/expected/oprint.resi.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,4 +490,5 @@ and ASet: {
490490
let find_last: (elt => bool, t) => elt
491491
let find_last_opt: (elt => bool, t) => option<elt>
492492
let of_list: list<elt> => t
493-
}
493+
}
494+
type emptyObject = {.}

syntax/tests/oprint/oprint.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,5 @@ module rec A: {
332332
}
333333
}
334334
and ASet: Set.S with type elt = A.t = Set.Make(A)
335+
336+
type emptyObject = {.}

0 commit comments

Comments
 (0)