From 4befcd8b1d0e83b78eada338df8eceb49096ec31 Mon Sep 17 00:00:00 2001 From: Arnaud BOEGLIN Date: Sat, 20 Apr 2024 22:36:26 +0200 Subject: [PATCH] revert: revert part of the previous commit --- compiler/main/Canonicalize/Canonicalize.hs | 3 +++ compiler/main/Format/Format.hs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/compiler/main/Canonicalize/Canonicalize.hs b/compiler/main/Canonicalize/Canonicalize.hs index c23cc9e9..bb2ed302 100644 --- a/compiler/main/Canonicalize/Canonicalize.hs +++ b/compiler/main/Canonicalize/Canonicalize.hs @@ -140,6 +140,9 @@ instance Canonicalizable Src.Exp Can.Exp where Src.Source _ _ (Src.LStr "") -> Nothing + Src.Source area srcTarget (Src.LStr s) -> + Just $ Src.Source area srcTarget (Src.LStr ("\"" <> s <> "\"")) + _ -> Just exp diff --git a/compiler/main/Format/Format.hs b/compiler/main/Format/Format.hs index c5d39173..bcc2b68c 100644 --- a/compiler/main/Format/Format.hs +++ b/compiler/main/Format/Format.hs @@ -1156,6 +1156,8 @@ expToDoc comments exp = Source _ _ (LStr s) -> if "\n" `isSuffixOf` s then (Pretty.pretty (init s) <> Pretty.hardline, comments') + else if "\n" `isPrefixOf` s then + (Pretty.hardline <> Pretty.pretty (tail s), comments') else (Pretty.pretty s, comments')