Skip to content

Parsing failure with multi-line list comprehension in do block #893

@JaSpa

Description

@JaSpa

Describe the bug

Ormolu outputs a parsing failure when formatting a multi-line list comprehension inside a do block.

To Reproduce

Format the following code:

a :: B
a = do
  [ c
      | c <- d ]

Expected behavior

Formatting is successful.

Actual behavior

Parsing of formatted code failed:

<input>:4:3

parse error (possibly incorrect indentation or mismatched brackets)

Environment

Ormolu Live, Version 0.5.0.0, commit 25b04d4, using ghc-lib-parser 9.2.1.20220109

Additional context

  • Where the line break inside the comprehension occurs seems to make no difference.
  • The problem occurs only inside do-blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions