Don't warn about a/b*c for ksh or when b == c

This commit is contained in:
Vidar Holen 2015-05-09 11:48:08 -07:00
parent 3940462da3
commit 4c3e731445

View file

@ -376,6 +376,7 @@ dist a b
lab = length a - length b lab = length a - length b
min3 x y z = if x < y then x else min y z min3 x y z = if x < y then x else min y z
hasFloatingPoint params = shellType params == Ksh
prop_checkEchoWc3 = verify checkEchoWc "n=$(echo $foo | wc -c)" prop_checkEchoWc3 = verify checkEchoWc "n=$(echo $foo | wc -c)"
checkEchoWc _ (T_Pipeline id _ [a, b]) = checkEchoWc _ (T_Pipeline id _ [a, b]) =
@ -1293,7 +1294,9 @@ checkForDecimals _ _ = return ()
prop_checkDivBeforeMult = verify checkDivBeforeMult "echo $((c/n*100))" prop_checkDivBeforeMult = verify checkDivBeforeMult "echo $((c/n*100))"
prop_checkDivBeforeMult2 = verifyNot checkDivBeforeMult "echo $((c*100/n))" prop_checkDivBeforeMult2 = verifyNot checkDivBeforeMult "echo $((c*100/n))"
checkDivBeforeMult _ (TA_Binary _ "*" (TA_Binary id "/" _ _) _) = prop_checkDivBeforeMult3 = verifyNot checkDivBeforeMult "echo $((c/10*10))"
checkDivBeforeMult params (TA_Binary _ "*" (TA_Binary id "/" _ x) y)
| not (hasFloatingPoint params) && x /= y =
info id 2017 "Increase precision by replacing a/b*c with a*c/b." info id 2017 "Increase precision by replacing a/b*c with a*c/b."
checkDivBeforeMult _ _ = return () checkDivBeforeMult _ _ = return ()