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
which are different strings for all GHC versions but 9.12.1 (on 9.12.1, they are the same, but that is a bug that is already fixed on GHC master: https://gitlab.haskell.org/ghc/ghc/-/issues/25784).
Concretely, the first string is equal to "A0" (two characters), while the second one is equal to "ʊ" (single character).
Oh! I didn't know ormolu/fourmolu automatically collapsed string gaps. Yeah, that's a bit surprising for a formatter to do, IMO. I think leaving the string gaps as is makes sense
EDIT: oh I didn't read carefully. IMO we should leave string gaps alone instead of minimizing them. But option 1 is fine too.
Describe the bug
The string literal
"\65\ \0"
is formatted to
"\650"
which are different strings for all GHC versions but 9.12.1 (on 9.12.1, they are the same, but that is a bug that is already fixed on GHC master: https://gitlab.haskell.org/ghc/ghc/-/issues/25784).
Concretely, the first string is equal to
"A0"
(two characters), while the second one is equal to"ʊ"
(single character).This has been broken ever since #376.
Expected behavior
The input should be formatted to a string literal representing the same string.
I see multiple options:
Never fully collapse string gaps, i.e. all gaps (when in single-line layout or in a multi-line literal) are replaced with
\ \
.The input above would be a fixed point in this case.
I think this is the simplest option.
Replace string gaps (in single-line layout or in a multi-line literal) with the special escape character
\&
.I think this is potentially confusing as
\&
is rarely used (I had never heard of it before.)Like 1./2., but only when necessary to be semantics-preserving.
Not sure if this is worth the (small) additional complexity.
Environment
Ormolu 0.8.0.0 or current
master
(4369d7c)The text was updated successfully, but these errors were encountered: