Skip to content

Bug: 'generating invalid comment attachment' when 2 doc comments #2796

@Durbatuluk1701

Description

@Durbatuluk1701

A function that has 2 doc comments causes ocamlformat to throw an error.

$ opam search ocamlformat
# Packages matching: match(*ocamlformat*)
# Name              # Installed # Synopsis
dump_ocamlformat    --          Dump preset configuration files for ocamlformat
ocamlformat         0.29.0      Auto-formatter for OCaml code
ocamlformat-lib     0.29.0      OCaml Code Formatter
ocamlformat-mlx     --          Auto-formatter for OCaml .mlx code
ocamlformat-mlx-lib --          OCaml .mlx Code Formatter
ocamlformat-rpc     --          Auto-formatter for OCaml code (RPC mode)
ocamlformat-rpc-lib 0.29.0      Auto-formatter for OCaml code (RPC mode)
oskel               --          Skeleton generator for OCaml projects

$ cat .ocamlformat
version=0.29.0
profile=janestreet
ocaml-version=4.08.0

$ cat test.ml
(** First comment *)
let test = function
  | true -> assert true
  | false -> assert false (** Second comment *)

$ ocamlformat -i test.ml
ocamlformat: Cannot process "test.ml".
  Please report this bug at https://github.com/ocaml-ppx/ocamlformat/issues.
  BUG: generating invalid comment attachment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions