Skip to content

Commit

Permalink
futhark fmt: handle comment-only programs better.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Jan 11, 2025
1 parent 69e3a42 commit 7f15f73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Futhark/Fmt/Printer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ instance Format UncheckedDec where
addComments loc $ "import" <+> "\"" <> fmtPretty path <> "\""

instance Format UncheckedProg where
fmt (Prog Nothing []) = popComments
fmt (Prog Nothing decs) = sepDecs fmt decs </> popComments
fmt (Prog (Just dc) decs) = fmt dc </> sepDecs fmt decs </> popComments

Expand Down
1 change: 1 addition & 0 deletions tests_fmt/expected/header_comment.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- # This comment is the first and only thing in this file.
1 change: 1 addition & 0 deletions tests_fmt/header_comment.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- # This comment is the first and only thing in this file.

0 comments on commit 7f15f73

Please sign in to comment.