Division_by_zero for / and mod with a non-zero literal divisor.Semantic Diff
1 commit, rendered from its record.
| Range | Commits | Changelog | Areas | JS output changes | Formats | Failed checks |
|---|---|---|---|---|---|---|
58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-8917 | 1 | ๐ Bug fix | reanalyzetests | 0 | none | 0 |
Division_by_zero for / and mod with a non-zero literal divisor.58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-8917The exception analysis treats / and mod as throwing Division_by_zero. It now skips that when the divisor is a non-zero int, float or bigint literal, so x / 10 needs no @throws annotation. Divisions by a variable or by a zero literal are still reported.
let foo = (x: int) => x / 10
Before: foo might throw Division_by_zero ... and is not annotated with @throws(Division_by_zero) After: no warning
Division_by_zero for / and mod with a non-zero literal divisor.@throws(Division_by_zero) or @doesNotThrow on such expressions are now reported as redundant, which is correct.x / -y is still reported; only literal constants are recognised.| M | analysis/reanalyze/src/exception.ml | +25 | โ1 |
| A | changes/reanalyze-division-literal-divisor.fix.md | +1 | โ0 |
| M | tests/analysis_tests/tests-reanalyze/deadcode/expected/exception.txt | +21 | โ1 |
| A | tests/analysis_tests/tests-reanalyze/deadcode/src/exception/Division.res | +19 | โ0 |