From 3b431cdad2bea5c50e1874f027e529bd79eaebb4 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Thu, 18 May 2023 20:35:08 +0200 Subject: [PATCH] Fix invalid syntax on nested do-block with comment --- data/15-regressions.blt | 10 ++++++++++ .../Brittany/Internal/Transformations/T5_Indent.hs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/data/15-regressions.blt b/data/15-regressions.blt index 84a56de..8e2ee2a 100644 --- a/data/15-regressions.blt +++ b/data/15-regressions.blt @@ -998,3 +998,13 @@ func = do func False = 0 -- comment func True = 1 + +#test nested do-block-with-comment issue +dofunc = do + do + some + code + do + -- abc + more + code diff --git a/source/library/Language/Haskell/Brittany/Internal/Transformations/T5_Indent.hs b/source/library/Language/Haskell/Brittany/Internal/Transformations/T5_Indent.hs index bb7489b..a47522d 100644 --- a/source/library/Language/Haskell/Brittany/Internal/Transformations/T5_Indent.hs +++ b/source/library/Language/Haskell/Brittany/Internal/Transformations/T5_Indent.hs @@ -44,6 +44,8 @@ transformSimplifyIndent = Uniplate.rewrite $ \case Just $ BDFlushCommentsPrior c (BDAddBaseY i x) BDAddBaseY i (BDFlushCommentsPost c sm x) -> Just $ BDFlushCommentsPost c sm (BDAddBaseY i x) + BDAddBaseY i (BDQueueComments comms x) -> + Just $ BDQueueComments comms (BDAddBaseY i x) BDAddBaseY i (BDSeq l) -> Just $ BDSeq $ List.init l ++ [BDAddBaseY i $ List.last l] BDAddBaseY i (BDCols sig l) ->