You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In layout mode (i.e. where, do, let), empty lines between blocks of code are optional. But if one block ends with a trailing comment on its final line, then an empty line before the next block is removed.
To Reproduce
The blank lines between the a and b lines in this snippet are removed.
test1 = foo where
a = a --
b = b
test2 =do
a --
b
test3 =let a = a --
b = b
in c
This also happens if the comment includes text (a = a -- foo), or if it's a block comment with nothing after it (a = a {- foo -}), or if there's another comment on the next line. It doesn't happen if the comment is on the next line without one on the current line, or if the expression continues on the next line, or if it's a block comment with something following (a = a {- foo -} 1). (A block comment with newlines has the same behavior as one without.) Also, it doesn't happen if the following block starts with a comment, as long as it does have a newline before it. That is:
-- all these blank lines are preserved
test4 =do
a ----
bar
-- this one is removed
test5 =do
a ----
bar
Describe the bug
In layout mode (i.e.
where
,do
,let
), empty lines between blocks of code are optional. But if one block ends with a trailing comment on its final line, then an empty line before the next block is removed.To Reproduce
The blank lines between the
a
andb
lines in this snippet are removed.This also happens if the comment includes text (
a = a -- foo
), or if it's a block comment with nothing after it (a = a {- foo -}
), or if there's another comment on the next line. It doesn't happen if the comment is on the next line without one on the current line, or if the expression continues on the next line, or if it's a block comment with something following (a = a {- foo -} 1
). (A block comment with newlines has the same behavior as one without.) Also, it doesn't happen if the following block starts with a comment, as long as it does have a newline before it. That is:Expected behavior
I'd expect all these blank lines to be preserved
Environment
Tested on the web at https://ormolu-live.tweag.io/. Version 0.7.7.0, commit 392b2bc, using ghc-lib-parser 9.10.1.20240511.
The text was updated successfully, but these errors were encountered: