Skip to content

Apply Hint removes shebang line at top of file #140

@OwenGraves

Description

@OwenGraves

For example, applying "Redundant $" clears the first line of the file, so #!/usr/bin/env cabal is removed.
Before:

#!/usr/bin/env cabal

{- cabal:
build-depends: base
-}

main :: IO ()
main = print $ "test"

After:



{- cabal:
build-depends: base
-}

main :: IO ()
main = print "test"

This can be reproduced on refactor --version v0.13.0.0 with ghc 9.4.4 by running
hlint Test.hs --serialise > hlint-refactor
refactor Test.hs --refact-file hlint-refactor
with hlint-refactor containing

[("Test.hs:8:14: Suggestion: Redundant $\nFound:\n  print $ \"test\"\nPerhaps:\n  print \"test\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 8, startCol = 8, endLine = 8, endCol = 22}, subts = [("a",SrcSpan {startLine = 8, startCol = 8, endLine = 8, endCol = 13}),("b",SrcSpan {startLine = 8, startCol = 16, endLine = 8, endCol = 22})], orig = "a b"}])]

Looks related to this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions