Fix PRMMinimize behaviour on simple paren'ed expressions

ghc92
Lennart Spitzner 2023-05-28 14:51:15 +02:00
parent 5481e5015f
commit 5e5433f33a
2 changed files with 10 additions and 2 deletions

View File

@ -1059,3 +1059,10 @@ func = do
stmt2
)
`shouldReturn` thing
#golden minimize parens basic test
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
func = func (abc) (def)
#expected
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
func = func abc def

View File

@ -184,8 +184,9 @@ addAllParens topLevelParen = \case
remSuperfluousParens :: Int -> OpTree -> OpTree
remSuperfluousParens outerFixity = \case
x@OpLeaf{} -> x
x@OpUnknown{} -> x
x@OpLeaf{} -> x
OpUnknown _ locO locC c [] -> OpUnknown NoParen locO locC c []
x@OpUnknown{} -> x
OpKnown paren locO locC fixity c cs ->
OpKnown
-- We do not support removing superfluous parens around