Skip to content

Bug: comments inside attributes are misplaced #1323

@craigfe

Description

@craigfe

Describe the bug

The following example,

type foo = Alpha | Beta [@@ocaml.warning "-37" (* Explanation of warning *)]

type foo =
  | Alpha______________________________
  | Beta_______________________________ 
  [@@ocaml.warning "-37" (* Explanation of warning *)]

gets OCamlformat-ted to:

type foo = Alpha | Beta [@@ocaml.warning "-37"] (* Explanation of warning *)

type foo =
  | Alpha______________________________
  | Beta_______________________________
[@@ocaml.warning "-37"]

(* Explanation of warning *)

The comments have been placed outside the attribute. IMO, this is 'fine but not ideal' in the first case and a bug in the second.

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