Skip to content

AST differs when using CAPI CTYPE pragma #689

@noughtmare

Description

@noughtmare

Describe the bug

ormolu fails to run on files with CTYPE pragmas, e.g. (from the GHC docs):

data    {-# CTYPE "unistd.h" "useconds_t" #-} T

This produces the error:

Test2.hs
  AST of input and AST of formatted code differ.
    at Test2.hs:1:1-47
  Please, consider reporting the bug.

To Reproduce
Make a file that contains the above example and run ormolu on it.

Expected behavior
Ormolu should correctly format such files without errors.

Environment

  • OS name + version: Debian 10 buster
  • Version of the code:
    ormolu 0.1.4.1 UNKNOWN UNKNOWN
    using ghc-lib-parser 8.10.4.20210206

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