Closed cdsmith closed 2 years ago
Describe the bug Ormolu introduces a parse error when SCC annotations are used in do blocks
do
To Reproduce
module BugReport where foo :: IO Int foo = do {-# SCC "foo" #-} fmap succ $ do {-# SCC "bar" #-} pure 1
Run Ormolu:
$ ormolu -i --no-cabal BugReport.hs BugReport.hs:6:3 Parsing of formatted code failed: parse error (possibly incorrect indentation or mismatched brackets)
Try harder:
$ ormolu -i -u --no-cabal BugReport.hs
The latter code fails to compile because an SCC annotation is part of an expression, not a separate statement in the do block.
Expected behavior I'd expect the code after the SCC annotation to be indented as line-wrapped statements in a do block typically are.
SCC
This compiles correctly. However, rerunning Ormolu restores the broken version.
Environment
$ uname -a Linux csmith 5.4.0-1086-gcp #94~18.04.1-Ubuntu SMP Fri Aug 5 18:26:39 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ ormolu --version ormolu 0.5.0.1 UNKNOWN UNKNOWN using ghc-lib-parser 9.2.4.20220729
Describe the bug Ormolu introduces a parse error when SCC annotations are used in
do
blocksTo Reproduce
Run Ormolu:
Try harder:
The latter code fails to compile because an SCC annotation is part of an expression, not a separate statement in the do block.
Expected behavior I'd expect the code after the
SCC
annotation to be indented as line-wrapped statements in ado
block typically are.This compiles correctly. However, rerunning Ormolu restores the broken version.
Environment