Skip to content

Every non haddock comments before OPTIONS_GHC pragma get pushed to the top #1168

Open
@SeungheonOh

Description

@SeungheonOh

Describe the bug
Every non haddock comments that appears before a OPTIONS_GHC pragma get pushed to the very top.

To Reproduce

module Plugin.Data.Spec where

{-
foo bar boz
-}
monoConstructor :: CompiledCode (Integer -> Integer -> MyMonoData)
monoConstructor = plc (Proxy @"monoConstructor") Mono1

-- hello world
-- | A type of rose trees with empty leaves.
data EmptyRose = EmptyRose [EmptyRose]

-- This seems to cause issue
{-# OPTIONS_GHC -Wno-incomplete-patterns #-}

-- bob alice eve
f :: ()
f = ()

formats to

{-
foo bar boz
-}
-- hello world
-- This seems to cause issue
{-# OPTIONS_GHC -Wno-incomplete-patterns #-}

module Plugin.Data.Spec where

monoConstructor :: CompiledCode (Integer -> Integer -> MyMonoData)
monoConstructor = plc (Proxy @"monoConstructor") Mono1

-- | A type of rose trees with empty leaves.
data EmptyRose = EmptyRose [EmptyRose]

-- bob alice eve
f :: ()
f = ()

Expected behavior
Location of the comments should be respected regardless of the presence of OPTIONS_GHC pragma

Environment
Used web application at https://ormolu-live.tweag.io/

Metadata

Metadata

Assignees

No one assigned

    Labels

    commentsIssues related to comment placementstyleNitpicking and things related to purely visual aspect for formatting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions