250 lines
7.5 KiB
Plaintext
250 lines
7.5 KiB
Plaintext
#group expression/op-precedence
|
|
|
|
|
|
|
|
#test basic precedence-aware layouting
|
|
operatorExpr1 =
|
|
( foo1 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ foo2 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ foo3 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ foo4 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
+ foo5 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr5
|
|
+ foo6 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr6
|
|
+ foo7 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7
|
|
+ foo8 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8
|
|
+ foo9 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr9
|
|
)
|
|
|
|
#test nested different precedences
|
|
operatorExpr2 =
|
|
( foo1 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ foo2 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ foo3 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ foo4 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
== foo5 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr5
|
|
+ foo6 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr6
|
|
+ foo7 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7
|
|
+ foo8 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8
|
|
+ foo9 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr9
|
|
)
|
|
|
|
#test simple comment respecting
|
|
alternatives = -- a
|
|
( -- b
|
|
alternativeOne -- c
|
|
<|> alterantiveTwo -- d
|
|
<|> alternativeThree -- e
|
|
) -- f
|
|
|
|
#golden retaining comments while minimizing duplicated parens
|
|
#pending
|
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
|
alternatives = -- a
|
|
x
|
|
+ ( -- b
|
|
( -- c
|
|
alternativeOne -- c
|
|
<|> alterantiveTwo -- d
|
|
<|> alternativeThree -- e
|
|
) -- f
|
|
) -- g
|
|
#expected
|
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
|
alternatives = -- a
|
|
x
|
|
+ -- b
|
|
( -- c
|
|
alternativeOne -- c
|
|
<|> alterantiveTwo -- d
|
|
<|> alternativeThree -- e
|
|
) -- f -- g
|
|
|
|
#golden refactoring unnecessary parens basic example
|
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
|
operatorExpr1 =
|
|
( (goo1 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1)
|
|
+ goo2 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ goo3 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ goo4 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
)
|
|
#expected
|
|
-- brittany { lconfig_operatorParenthesisRefactorMode: PRMMinimize }
|
|
operatorExpr1 =
|
|
( goo1 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ goo2 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ goo3 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ goo4 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
)
|
|
|
|
#test feature flag fixityAwareOps works
|
|
-- brittany { lconfig_fixityAwareOps: False }
|
|
operatorExpr1 =
|
|
( goo1
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ goo2
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ goo3
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ goo4
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
+ goo5
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr5
|
|
+ goo6
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr6
|
|
+ goo7
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7
|
|
+ goo8
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8
|
|
+ goo9
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr9
|
|
)
|
|
|
|
#golden op-app simple golden test
|
|
operatorExpr1 =
|
|
( goo1
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ goo2
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ goo3
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ goo4
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
+ goo5
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr5
|
|
+ goo6
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr6
|
|
+ goo7
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7
|
|
+ goo8
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8
|
|
+ goo9
|
|
* barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr9
|
|
)
|
|
#expected
|
|
operatorExpr1 =
|
|
( goo1 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr1
|
|
+ goo2 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2
|
|
+ goo3 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr3
|
|
+ goo4 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr4
|
|
+ goo5 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr5
|
|
+ goo6 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr6
|
|
+ goo7 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr7
|
|
+ goo8 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8
|
|
+ goo9 * barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr9
|
|
)
|
|
|
|
#golden op-app mixed golden
|
|
doop =
|
|
some long invocation ==
|
|
loooooooooongman + (third nested expression)
|
|
- 4 && {- meow -} 5
|
|
- 6
|
|
> 7
|
|
`mod` loooooooooongwoman || ill just invoke a function with these args
|
|
|| foo && dooasdoiaosdoi ** oaisdoioasido <= asduiuaisduiasdu + asdahjsd + ahsjdhjhasd
|
|
#expected
|
|
doop =
|
|
some long invocation == loooooooooongman + (third nested expression) - 4
|
|
&& {- meow -} 5 - 6 > 7 `mod` loooooooooongwoman
|
|
|| ill just invoke a function with these args
|
|
|| foo
|
|
&& dooasdoiaosdoi ** oaisdoioasido
|
|
<= asduiuaisduiasdu + asdahjsd + ahsjdhjhasd
|
|
|
|
#golden op-app mixed golden with added parens
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
doop =
|
|
some long invocation ==
|
|
loooooooooongman + (third nested expression)
|
|
- 4 && {- meow -} 5
|
|
- 6
|
|
> 7
|
|
`mod` loooooooooongwoman || ill just invoke a function with these args
|
|
|| foo && dooasdoiaosdoi ** oaisdoioasido <= asduiuaisduiasdu + asdahjsd + ahsjdhjhasd
|
|
#expected
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
doop =
|
|
( ( some long invocation == loooooooooongman + (third nested expression) - 4
|
|
&& {- meow -} 5 - 6 > 7 `mod` loooooooooongwoman
|
|
)
|
|
|| ill just invoke a function with these args
|
|
|| ( foo
|
|
&& ( dooasdoiaosdoi ** oaisdoioasido
|
|
<= asduiuaisduiasdu + asdahjsd + ahsjdhjhasd
|
|
)
|
|
)
|
|
)
|
|
|
|
#golden multiline mixed op expression 1
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
meow =
|
|
[docSeparator, docForceSL od1, docSeparator, docForceSL ed1]
|
|
++ join
|
|
[ [docSeparator, docForceSingleline od, docSeparator, docForceSingleline ed]
|
|
| (od, ed) <- ems
|
|
]
|
|
++ [docSeparator, docForceSingleline odN, docSeparator, lastWrap edN]
|
|
#expected
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
meow =
|
|
( [docSeparator, docForceSL od1, docSeparator, docForceSL ed1]
|
|
++ join
|
|
[ [ docSeparator
|
|
, docForceSingleline od
|
|
, docSeparator
|
|
, docForceSingleline ed
|
|
]
|
|
| (od, ed) <- ems
|
|
]
|
|
++ [docSeparator, docForceSingleline odN, docSeparator, lastWrap edN]
|
|
)
|
|
|
|
#golden multiline mixed op expression 2
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
meow =
|
|
[docSeparator, docForceSingleline od1, docSeparator, docForceSingleline ed1, something]
|
|
++ join
|
|
[ [docSeparator, docForceSingleline od, docSeparator, docForceSingleline ed]
|
|
| (od, ed) <- ems
|
|
]
|
|
++ [docSeparator, docForceSingleline odN, docSeparator, lastWrap edN, something]
|
|
#expected
|
|
-- brittany { lconfig_fixityBasedAddAlignParens: True }
|
|
meow =
|
|
( [ docSeparator
|
|
, docForceSingleline od1
|
|
, docSeparator
|
|
, docForceSingleline ed1
|
|
, something
|
|
]
|
|
++ join
|
|
[ [ docSeparator
|
|
, docForceSingleline od
|
|
, docSeparator
|
|
, docForceSingleline ed
|
|
]
|
|
| (od, ed) <- ems
|
|
]
|
|
++ [ docSeparator
|
|
, docForceSingleline odN
|
|
, docSeparator
|
|
, lastWrap edN
|
|
, something
|
|
]
|
|
)
|
|
|
|
#test operator-paren-alignment inside do and other op
|
|
func = do
|
|
other
|
|
( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
**~ bbbbbbbbbbbbbbbbbb
|
|
**~ cccccccccccccccccccccccccccccccccccccccccccccccccc
|
|
)
|
|
== 13
|
|
|
|
#test allow lambdacase parspacing after operator
|
|
foo = do
|
|
abc `forM_` \case
|
|
True -> 1
|
|
False -> 0
|