Skip to content

Formatter drops a comment before the spread of a list pattern like list{/* c */ ...r} #9123

Closed

Description

@cknitt

Formatting drops a comment written before the spread of a list pattern that has no other items.

let f = x =>
  switch x {
  | list{/* d */ ...r} => r
  }

bsc -format (master at 3562ce6) prints:

let f = x =>
  switch x {
  | r => r
  }

The comment /* d */ is gone. list{...r} parses to the pattern r itself, so the printer prints r, and the comment attached to the spread is never printed. The expression list{/* h */ ...xs} keeps its comment (/* h */ xs), and list{a, /* e */ ...r} keeps it too (with #9119).

Found while working on #9107; #9119 does not change this case.

🤖 Generated with Claude Code

Activity

  1. added theissue type on Oct 29, 2026
  2. added a commit that references this issue on Oct 29, 2026
    bfe3834
  3. added a commit that references this issue on Oct 31, 2026
    9d79796
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions