git.iko.soy/rowtype-yoga/purescript-backend-optimizer
on main help sign in
Fixed substract/divide associativity (aristanetworks#38). (#39)
commitc37b527f163232358d82c23740ae1bee0095aec4 authorHans-Thomas Mueller <htmue@gmx.net> dateWed 21 Dec 2022, 18:31 (4 years ago) parent56409ec
3 files changed+10−3
backend-es/src/PureScript/Backend/Optimizer/Codegen/EcmaScript/Syntax.purs+2−2 backend-es/test/snapshots-out/Snapshot.PrimOpNumber01.js+3−1 backend-es/test/snapshots/Snapshot.PrimOpNumber01.purs+5
backend-es/src/PureScript/Backend/Optimizer/Codegen/EcmaScript/Syntax.purs+2−2
@@ -525,8 +525,8 @@ esBinaryFixity = case _ of
525525 EsBitShitRight -> fixity false 8 ">>"
526526 EsZeroFillShiftRight -> fixity false 8 ">>>"
527527 EsAdd -> fixity true 9 "+"
528− EsSubtract -> fixity true 9 "-"
529− EsDivide -> fixity true 10 "/"
528+ EsSubtract -> fixity false 9 "-"
529+ EsDivide -> fixity false 10 "/"
530530 EsMultiply -> fixity true 10 "*"
531531 where
532532 fixity associative precedence symbol =
backend-es/test/snapshots-out/Snapshot.PrimOpNumber01.js+3−1
@@ -6,7 +6,9 @@ const test5 = a => b => a < b;
66const test4 = a => b => a !== b;
77const test3 = a => b => a === b;
88const test2 = a => b => a - b;
9+const test13 = a => b => c => a / (b / c);
10+const test12 = a => b => c => a - (b - c);
911const test11 = a => -a;
1012const test10 = a => b => a / b;
1113const test1 = a => b => a + b;
12−export {test1, test10, test11, test2, test3, test4, test5, test6, test7, test8, test9};
14+export {test1, test10, test11, test12, test13, test2, test3, test4, test5, test6, test7, test8, test9};
backend-es/test/snapshots/Snapshot.PrimOpNumber01.purs+5
@@ -35,3 +35,8 @@ test10 a b = a / b
3535test11 :: Number -> Number
3636test11 a = -a
3737
38+test12 :: Number -> Number -> Number -> Number
39+test12 a b c = a - (b - c)
40+
41+test13 :: Number -> Number -> Number -> Number
42+test13 a b c = a / (b / c)