Error out of invalid Int/Word bit shifts
Although the Haddock's for `shiftL` and `shiftR` do require the number of bits to be non-negative, we should still check this before calling out to primitives (which also have undefined behaviour for negative bit shifts). If a user _really_ wants to bypass checks that the number of bits is sensible, they already have the aptly-named `unsafeShiftL`/`unsafeShiftR` at their disposal. See #16111.
Showing
- compiler/prelude/PrelRules.hs 2 additions, 3 deletionscompiler/prelude/PrelRules.hs
- libraries/base/Data/Bits.hs 16 additions, 6 deletionslibraries/base/Data/Bits.hs
- libraries/base/GHC/Int.hs 30 additions, 10 deletionslibraries/base/GHC/Int.hs
- libraries/base/GHC/Word.hs 30 additions, 10 deletionslibraries/base/GHC/Word.hs
- libraries/base/changelog.md 4 additions, 0 deletionslibraries/base/changelog.md
Loading
-
mentioned in issue #16111 (closed)
-
mentioned in merge request !113 (closed)
-
mentioned in issue #16449 (closed)
-
mentioned in merge request !1021 (closed)
-
mentioned in commit d9d0e514
-
mentioned in commit 1503da32
-
mentioned in merge request !1099 (closed)
-
mentioned in commit c26461fc
Please register or sign in to comment