Fix bug in PRMMinimize feature for InfixN operators

ghc92
Lennart Spitzner 2023-08-31 13:47:15 +02:00
parent 812957dca4
commit 2fd6308d09
2 changed files with 11 additions and 1 deletions

View File

@ -25,3 +25,7 @@ func = func ((((((((nested + expression))))))))
#expected
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
func = func (nested + expression)
#test does not remove parens on InfixN
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
func = (a == Foo) == (b == Bar)

View File

@ -215,7 +215,13 @@ remSuperfluousParens outerFixity = \case
locO
locC
fixity
(remSuperfluousParens (fixLevel fixity) c)
(remSuperfluousParens
(case fixity of
Fixity _ level InfixN -> level + 1
Fixity _ level _ -> level
)
c
)
[ (op, remSuperfluousParens (fixLevel fixity) tree) | (op, tree) <- cs ]
x -> x
where