Fix bug in PRMMinimize feature for InfixN operators
parent
9103ed55c2
commit
2cec32e6e1
|
@ -25,3 +25,7 @@ func = func ((((((((nested + expression))))))))
|
||||||
#expected
|
#expected
|
||||||
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
||||||
func = func (nested + expression)
|
func = func (nested + expression)
|
||||||
|
|
||||||
|
#test does not remove parens on InfixN
|
||||||
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
||||||
|
func = (a == Foo) == (b == Bar)
|
||||||
|
|
|
@ -216,7 +216,13 @@ remSuperfluousParens outerFixity = \case
|
||||||
locO
|
locO
|
||||||
locC
|
locC
|
||||||
fixity
|
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 ]
|
[ (op, remSuperfluousParens (fixLevel fixity) tree) | (op, tree) <- cs ]
|
||||||
x -> x
|
x -> x
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in New Issue