Skip to content

Bug: comments dropped #1603

@moatom

Description

@moatom

Describe the bug
The inputed .ml file:

let bar = 1
and 
(* aaaaaa *)
foo : type a. a = failwith "foo"

Then, I got the following error.

Error: Comment (* aaaaaa *) dropped.

It seems the combination of and and type a. (polymorphic syntax for locally abstract types) causes this problem.

How to Reproduce

$ocamlformat --version
0.16.0-35-gb3d3aa5

(This version is #1602)

$ocamlformat --print-config
profile=default
quiet=false
max-iters=10
comment-check=true
wrap-fun-args=true
wrap-comments=false
type-decl-indent=2
type-decl=compact
stritem-extension-indent=0
space-around-variants=true
space-around-records=true
space-around-lists=true
space-around-arrays=true
single-case=compact
sequence-style=terminator
sequence-blank-line=preserve-one
parse-docstrings=false
parens-tuple-patterns=multi-line-only
parens-tuple=always
parens-ite=false
ocp-indent-compat=false
nested-match=wrap
module-item-spacing=sparse
max-indent=68
match-indent-nested=never
match-indent=0
margin=80
let-module=compact
let-binding-spacing=compact
let-binding-indent=2
let-and=compact
leading-nested-match-parens=false
infix-precedence=indent
indicate-nested-or-patterns=unsafe-no
indicate-multiline-delimiters=no
indent-after-in=0
if-then-else=compact
function-indent-nested=never
function-indent=2
field-space=loose
extension-indent=2
exp-grouping=parens
dock-collection-brackets=true
doc-comments-tag-only=default
doc-comments-padding=2
doc-comments=after-when-possible
disambiguate-non-breaking-match=false
disable=false
cases-matching-exp-indent=normal
cases-exp-indent=4
break-struct=force
break-string-literals=auto
break-sequences=true
break-separators=after
break-infix-before-func=false
break-infix=wrap
break-fun-sig=wrap
break-fun-decl=wrap
break-collection-expressions=fit-or-vertical
break-cases=fit
break-before-in=fit-or-vertical
assignment-operator=end-line
align-variants-decl=false
align-constructors-decl=false
align-cases=false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions