Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • testsuite/tests/MiniQuickCheck.hs
    ... ... @@ -27,6 +27,7 @@ module MiniQuickCheck
    27 27
       , (===)
    
    28 28
       , propertyCompare
    
    29 29
       , propertyAnd
    
    30
    +  , propertyTrue
    
    30 31
       , getCheck
    
    31 32
     
    
    32 33
         -- * QuickCheck test tree
    
    ... ... @@ -144,6 +145,10 @@ infix 4 ===
    144 145
     propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck
    
    145 146
     propertyAnd = PropertyAnd
    
    146 147
     
    
    148
    +-- | A property check that trivially holds. Useful to mark a case to skip.
    
    149
    +propertyTrue :: PropertyCheck
    
    150
    +propertyTrue = PropertyBinaryOp True "trivially" "" ""
    
    151
    +
    
    147 152
     --------------------------------------------------------------------------------
    
    148 153
     -- Test tree
    
    149 154
     
    

  • testsuite/tests/numeric/should_run/foundation.hs
    ... ... @@ -82,11 +82,10 @@ testMultiplicative _ = Group "Multiplicative"
    82 82
     testDivisible :: forall a . (Show a, Eq a, Bounded a, Integral a, Num a, Arbitrary a, Typeable a)
    
    83 83
                   => Proxy a -> Test
    
    84 84
     testDivisible _ = Group "Divisible"
    
    85
    -    [ Property "(x `div` y) * y + (x `mod` y) == x" $ \(a :: a) (NonZero b) ->
    
    86
    -            -- See Note [Skipping minBound `div` (-1)].
    
    87
    -            if (minBound :: a) < 0 && a == minBound && b == (-1)
    
    88
    -              then True === True
    
    89
    -              else a === (a `div` b) * b + (a `mod` b)
    
    85
    +    [ Property "(x `div` y) * y + (x `mod` y) == x" $
    
    86
    +        -- 'safeDivArgs' skips (minBound, -1) for signed types; see
    
    87
    +        -- Note [Skipping signed quot/rem on minBound `quot` (-1)].
    
    88
    +        safeDivArgs (\(a :: a) b -> a === (a `div` b) * b + (a `mod` b))
    
    90 89
         ]
    
    91 90
     
    
    92 91
     -- | Divisibility test for unbounded Integral types (Integer). No overflow
    
    ... ... @@ -98,21 +97,6 @@ testDivisibleUnbounded _ = Group "Divisible"
    98 97
                 a === (a `div` b) * b + (a `mod` b)
    
    99 98
         ]
    
    100 99
     
    
    101
    --- Note [Skipping minBound `div` (-1)]
    
    102
    --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    103
    --- For a fixed-width *signed* Integral type, `minBound `div` (-1)` raises
    
    104
    --- ArithException(Overflow) because `-minBound` is not representable in the
    
    105
    --- type (e.g., for Int8, `-(-128)` would be 128, out of range). The div/mod
    
    106
    --- identity property cannot hold there, so we skip exactly that one pair.
    
    107
    ---
    
    108
    --- We detect "signed Bounded" with `(minBound :: a) < 0`: True for Int{N},
    
    109
    --- False for Word{N}. This way unsigned Bounded types lose no coverage,
    
    110
    --- and only the genuine overflow sample is skipped for signed types.
    
    111
    ---
    
    112
    --- For the unbounded `Integer`, no overflow can occur and we use a separate
    
    113
    --- 'testDivisibleUnbounded' (without the Bounded constraint or the skip).
    
    114
    --- See #27222.
    
    115
    -
    
    116 100
     testOperatorPrecedence :: forall a . (Show a, Eq a, Prelude.Num a, Integral a, Num a,  Arbitrary a, Typeable a)
    
    117 101
                            => Proxy a -> Test
    
    118 102
     testOperatorPrecedence _ = Group "Precedence"
    
    ... ... @@ -263,8 +247,29 @@ instance TestPrimop LowerBitsAreDefined where
    263 247
             valR = wWord# (undefinedBehavior r x0) .&. mask
    
    264 248
         in  valL === valR
    
    265 249
     
    
    266
    -twoNonZero :: (a -> a -> b) -> a -> NonZero a -> b
    
    267
    -twoNonZero f x (NonZero y) = f x y
    
    250
    +-- | Discharge a property over a non-zero divisor. For signed types, also
    
    251
    +-- skip the @(minBound, -1)@ pair, where signed quot/rem is platform
    
    252
    +-- dependent. For unsigned types (where @minBound = 0@), no additional skip
    
    253
    +-- happens.
    
    254
    +-- See Note [Skipping signed quot/rem on minBound `quot` (-1)].
    
    255
    +safeDivArgs
    
    256
    +  :: (Bounded a, Ord a, Num a)
    
    257
    +  => (a -> a -> PropertyCheck)
    
    258
    +  -> a -> NonZero a -> PropertyCheck
    
    259
    +safeDivArgs f x (NonZero y)
    
    260
    +  | x == minBound, x < 0, y == (-1) = propertyTrue
    
    261
    +  | otherwise                       = f x y
    
    262
    +
    
    263
    +-- Note [Skipping signed quot/rem on minBound `quot` (-1)]
    
    264
    +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    265
    +-- For a fixed-width signed integer type, `minBound `quot` (-1)` is platform
    
    266
    +-- dependent: the mathematical result `-minBound` is not representable in the
    
    267
    +-- type. On x86, IDIV traps; LLVM's sdiv is undefined behavior in this case; on
    
    268
    +-- AArch64/RISC-V, SDIV wraps to minBound.
    
    269
    +--
    
    270
    +-- Without the skip quickcheck eventually picks `(minBound, -1)` and the test
    
    271
    +-- crashes on the affected primops on platforms where signed quot/rem traps.
    
    272
    +-- See #27222.
    
    268 273
     
    
    269 274
     main :: IO ()
    
    270 275
     main = runTestsMain (Iterations 1000) (Group "ALL" [testNumberRefs, testPrimops])
    
    ... ... @@ -535,7 +540,7 @@ instance TestPrimop (Char# -> Int#) where
    535 540
     
    
    536 541
     instance TestPrimop (Int# -> Int# -> Int#) where
    
    537 542
       testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    538
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    543
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt#-> x0) (uInt#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    539 544
       testPrimopShift s l r = Property s $ \ (uInt#-> x0) (BoundedShiftAmount @Int shift) -> wInt# (l x0 (uInt# shift)) === wInt# (r x0 (uInt# shift))
    
    540 545
     
    
    541 546
     -- | Compare two 'mulIntMayOflo#'-like primops only on whether their result
    
    ... ... @@ -565,11 +570,11 @@ testPrimopMayOflo s l r =
    565 570
     
    
    566 571
     instance TestPrimop (Int# -> Int# -> (# Int#,Int# #)) where
    
    567 572
       testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP2(wInt#,wInt#, (l x0 x1)) === WTUP2(wInt#,wInt#, (r x0 x1))
    
    568
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP2(wInt#,wInt#, (l x0 x1)) === WTUP2(wInt#,wInt#, (r x0 x1))
    
    573
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP2(wInt#,wInt#, (l x0 x1)) === WTUP2(wInt#,wInt#, (r x0 x1))
    
    569 574
     
    
    570 575
     instance TestPrimop (Int# -> Int# -> (# Int#,Int#,Int# #)) where
    
    571 576
       testPrimop s l r = Property s $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP3(wInt#,wInt#,wInt#, (l x0 x1)) === WTUP3(wInt#,wInt#,wInt#, (r x0 x1))
    
    572
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP3(wInt#,wInt#,wInt#, (l x0 x1)) === WTUP3(wInt#,wInt#,wInt#, (r x0 x1))
    
    577
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt#-> x0) (uInt#-> x1) -> WTUP3(wInt#,wInt#,wInt#, (l x0 x1)) === WTUP3(wInt#,wInt#,wInt#, (r x0 x1))
    
    573 578
     
    
    574 579
     instance TestPrimop (Int# -> Char#) where
    
    575 580
       testPrimop s l r = Property s $ \ (uInt#-> x0) -> wChar# (l x0) === wChar# (r x0)
    
    ... ... @@ -598,15 +603,15 @@ instance TestPrimop (Int16# -> Int# -> Int16#) where
    598 603
     
    
    599 604
     instance TestPrimop (Int16# -> Int16# -> Int#) where
    
    600 605
       testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    601
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    606
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    602 607
     
    
    603 608
     instance TestPrimop (Int16# -> Int16# -> Int16#) where
    
    604 609
       testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    605
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    610
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt16#-> x0) (uInt16#-> x1) -> wInt16# (l x0 x1) === wInt16# (r x0 x1)
    
    606 611
     
    
    607 612
     instance TestPrimop (Int16# -> Int16# -> (# Int16#,Int16# #)) where
    
    608 613
       testPrimop s l r = Property s $ \ (uInt16#-> x0) (uInt16#-> x1) -> WTUP2(wInt16#,wInt16#, (l x0 x1)) === WTUP2(wInt16#,wInt16#, (r x0 x1))
    
    609
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt16#-> x0) (uInt16#-> x1) -> WTUP2(wInt16#,wInt16#, (l x0 x1)) === WTUP2(wInt16#,wInt16#, (r x0 x1))
    
    614
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt16#-> x0) (uInt16#-> x1) -> WTUP2(wInt16#,wInt16#, (l x0 x1)) === WTUP2(wInt16#,wInt16#, (r x0 x1))
    
    610 615
     
    
    611 616
     instance TestPrimop (Int16# -> Int#) where
    
    612 617
       testPrimop s l r = Property s $ \ (uInt16#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    ... ... @@ -623,15 +628,15 @@ instance TestPrimop (Int32# -> Int# -> Int32#) where
    623 628
     
    
    624 629
     instance TestPrimop (Int32# -> Int32# -> Int#) where
    
    625 630
       testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    626
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    631
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    627 632
     
    
    628 633
     instance TestPrimop (Int32# -> Int32# -> Int32#) where
    
    629 634
       testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    630
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    635
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt32#-> x0) (uInt32#-> x1) -> wInt32# (l x0 x1) === wInt32# (r x0 x1)
    
    631 636
     
    
    632 637
     instance TestPrimop (Int32# -> Int32# -> (# Int32#,Int32# #)) where
    
    633 638
       testPrimop s l r = Property s $ \ (uInt32#-> x0) (uInt32#-> x1) -> WTUP2(wInt32#,wInt32#, (l x0 x1)) === WTUP2(wInt32#,wInt32#, (r x0 x1))
    
    634
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt32#-> x0) (uInt32#-> x1) -> WTUP2(wInt32#,wInt32#, (l x0 x1)) === WTUP2(wInt32#,wInt32#, (r x0 x1))
    
    639
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt32#-> x0) (uInt32#-> x1) -> WTUP2(wInt32#,wInt32#, (l x0 x1)) === WTUP2(wInt32#,wInt32#, (r x0 x1))
    
    635 640
     
    
    636 641
     instance TestPrimop (Int32# -> Int#) where
    
    637 642
       testPrimop s l r = Property s $ \ (uInt32#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    ... ... @@ -648,11 +653,11 @@ instance TestPrimop (Int64# -> Int# -> Int64#) where
    648 653
     
    
    649 654
     instance TestPrimop (Int64# -> Int64# -> Int#) where
    
    650 655
       testPrimop s l r = Property s $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    651
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    656
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    652 657
     
    
    653 658
     instance TestPrimop (Int64# -> Int64# -> Int64#) where
    
    654 659
       testPrimop s l r = Property s $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    655
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    660
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt64#-> x0) (uInt64#-> x1) -> wInt64# (l x0 x1) === wInt64# (r x0 x1)
    
    656 661
     
    
    657 662
     instance TestPrimop (Int64# -> Int#) where
    
    658 663
       testPrimop s l r = Property s $ \ (uInt64#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    ... ... @@ -669,15 +674,15 @@ instance TestPrimop (Int8# -> Int# -> Int8#) where
    669 674
     
    
    670 675
     instance TestPrimop (Int8# -> Int8# -> Int#) where
    
    671 676
       testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    672
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    677
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    673 678
     
    
    674 679
     instance TestPrimop (Int8# -> Int8# -> Int8#) where
    
    675 680
       testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    676
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    681
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt8#-> x0) (uInt8#-> x1) -> wInt8# (l x0 x1) === wInt8# (r x0 x1)
    
    677 682
     
    
    678 683
     instance TestPrimop (Int8# -> Int8# -> (# Int8#,Int8# #)) where
    
    679 684
       testPrimop s l r = Property s $ \ (uInt8#-> x0) (uInt8#-> x1) -> WTUP2(wInt8#,wInt8#, (l x0 x1)) === WTUP2(wInt8#,wInt8#, (r x0 x1))
    
    680
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uInt8#-> x0) (uInt8#-> x1) -> WTUP2(wInt8#,wInt8#, (l x0 x1)) === WTUP2(wInt8#,wInt8#, (r x0 x1))
    
    685
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uInt8#-> x0) (uInt8#-> x1) -> WTUP2(wInt8#,wInt8#, (l x0 x1)) === WTUP2(wInt8#,wInt8#, (r x0 x1))
    
    681 686
     
    
    682 687
     instance TestPrimop (Int8# -> Int#) where
    
    683 688
       testPrimop s l r = Property s $ \ (uInt8#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    ... ... @@ -694,19 +699,19 @@ instance TestPrimop (Word# -> Int# -> Word#) where
    694 699
     
    
    695 700
     instance TestPrimop (Word# -> Word# -> Int#) where
    
    696 701
       testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    697
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    702
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord#-> x0) (uWord#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    698 703
     
    
    699 704
     instance TestPrimop (Word# -> Word# -> Word#) where
    
    700 705
       testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    701
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    706
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord#-> x0) (uWord#-> x1) -> wWord# (l x0 x1) === wWord# (r x0 x1)
    
    702 707
     
    
    703 708
     instance TestPrimop (Word# -> Word# -> (# Word#,Int# #)) where
    
    704 709
       testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wInt#, (l x0 x1)) === WTUP2(wWord#,wInt#, (r x0 x1))
    
    705
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wInt#, (l x0 x1)) === WTUP2(wWord#,wInt#, (r x0 x1))
    
    710
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wInt#, (l x0 x1)) === WTUP2(wWord#,wInt#, (r x0 x1))
    
    706 711
     
    
    707 712
     instance TestPrimop (Word# -> Word# -> (# Word#,Word# #)) where
    
    708 713
       testPrimop s l r = Property s $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wWord#, (l x0 x1)) === WTUP2(wWord#,wWord#, (r x0 x1))
    
    709
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wWord#, (l x0 x1)) === WTUP2(wWord#,wWord#, (r x0 x1))
    
    714
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord#-> x0) (uWord#-> x1) -> WTUP2(wWord#,wWord#, (l x0 x1)) === WTUP2(wWord#,wWord#, (r x0 x1))
    
    710 715
     
    
    711 716
     instance TestPrimop (Word# -> Int#) where
    
    712 717
       testPrimop s l r = Property s $ \ (uWord#-> x0) -> wInt# (l x0) === wInt# (r x0)
    
    ... ... @@ -732,15 +737,15 @@ instance TestPrimop (Word16# -> Int# -> Word16#) where
    732 737
     
    
    733 738
     instance TestPrimop (Word16# -> Word16# -> Int#) where
    
    734 739
       testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    735
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    740
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord16#-> x0) (uWord16#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    736 741
     
    
    737 742
     instance TestPrimop (Word16# -> Word16# -> Word16#) where
    
    738 743
       testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    739
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    744
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord16#-> x0) (uWord16#-> x1) -> wWord16# (l x0 x1) === wWord16# (r x0 x1)
    
    740 745
     
    
    741 746
     instance TestPrimop (Word16# -> Word16# -> (# Word16#,Word16# #)) where
    
    742 747
       testPrimop s l r = Property s $ \ (uWord16#-> x0) (uWord16#-> x1) -> WTUP2(wWord16#,wWord16#, (l x0 x1)) === WTUP2(wWord16#,wWord16#, (r x0 x1))
    
    743
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord16#-> x0) (uWord16#-> x1) -> WTUP2(wWord16#,wWord16#, (l x0 x1)) === WTUP2(wWord16#,wWord16#, (r x0 x1))
    
    748
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord16#-> x0) (uWord16#-> x1) -> WTUP2(wWord16#,wWord16#, (l x0 x1)) === WTUP2(wWord16#,wWord16#, (r x0 x1))
    
    744 749
     
    
    745 750
     instance TestPrimop (Word16# -> Int16#) where
    
    746 751
       testPrimop s l r = Property s $ \ (uWord16#-> x0) -> wInt16# (l x0) === wInt16# (r x0)
    
    ... ... @@ -757,15 +762,15 @@ instance TestPrimop (Word32# -> Int# -> Word32#) where
    757 762
     
    
    758 763
     instance TestPrimop (Word32# -> Word32# -> Int#) where
    
    759 764
       testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    760
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    765
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord32#-> x0) (uWord32#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    761 766
     
    
    762 767
     instance TestPrimop (Word32# -> Word32# -> Word32#) where
    
    763 768
       testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    764
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    769
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord32#-> x0) (uWord32#-> x1) -> wWord32# (l x0 x1) === wWord32# (r x0 x1)
    
    765 770
     
    
    766 771
     instance TestPrimop (Word32# -> Word32# -> (# Word32#,Word32# #)) where
    
    767 772
       testPrimop s l r = Property s $ \ (uWord32#-> x0) (uWord32#-> x1) -> WTUP2(wWord32#,wWord32#, (l x0 x1)) === WTUP2(wWord32#,wWord32#, (r x0 x1))
    
    768
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord32#-> x0) (uWord32#-> x1) -> WTUP2(wWord32#,wWord32#, (l x0 x1)) === WTUP2(wWord32#,wWord32#, (r x0 x1))
    
    773
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord32#-> x0) (uWord32#-> x1) -> WTUP2(wWord32#,wWord32#, (l x0 x1)) === WTUP2(wWord32#,wWord32#, (r x0 x1))
    
    769 774
     
    
    770 775
     instance TestPrimop (Word32# -> Int32#) where
    
    771 776
       testPrimop s l r = Property s $ \ (uWord32#-> x0) -> wInt32# (l x0) === wInt32# (r x0)
    
    ... ... @@ -782,11 +787,11 @@ instance TestPrimop (Word64# -> Int# -> Word64#) where
    782 787
     
    
    783 788
     instance TestPrimop (Word64# -> Word64# -> Int#) where
    
    784 789
       testPrimop s l r = Property s $ \ (uWord64#-> x0) (uWord64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    785
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord64#-> x0) (uWord64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    790
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord64#-> x0) (uWord64#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    786 791
     
    
    787 792
     instance TestPrimop (Word64# -> Word64# -> Word64#) where
    
    788 793
       testPrimop s l r = Property s $ \ (uWord64#-> x0) (uWord64#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    789
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord64#-> x0) (uWord64#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    794
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord64#-> x0) (uWord64#-> x1) -> wWord64# (l x0 x1) === wWord64# (r x0 x1)
    
    790 795
     
    
    791 796
     instance TestPrimop (Word64# -> Int64#) where
    
    792 797
       testPrimop s l r = Property s $ \ (uWord64#-> x0) -> wInt64# (l x0) === wInt64# (r x0)
    
    ... ... @@ -803,15 +808,15 @@ instance TestPrimop (Word8# -> Int# -> Word8#) where
    803 808
     
    
    804 809
     instance TestPrimop (Word8# -> Word8# -> Int#) where
    
    805 810
       testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    806
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    811
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord8#-> x0) (uWord8#-> x1) -> wInt# (l x0 x1) === wInt# (r x0 x1)
    
    807 812
     
    
    808 813
     instance TestPrimop (Word8# -> Word8# -> Word8#) where
    
    809 814
       testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    810
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    815
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord8#-> x0) (uWord8#-> x1) -> wWord8# (l x0 x1) === wWord8# (r x0 x1)
    
    811 816
     
    
    812 817
     instance TestPrimop (Word8# -> Word8# -> (# Word8#,Word8# #)) where
    
    813 818
       testPrimop s l r = Property s $ \ (uWord8#-> x0) (uWord8#-> x1) -> WTUP2(wWord8#,wWord8#, (l x0 x1)) === WTUP2(wWord8#,wWord8#, (r x0 x1))
    
    814
    -  testPrimopDivLike s l r = Property s $ twoNonZero $ \ (uWord8#-> x0) (uWord8#-> x1) -> WTUP2(wWord8#,wWord8#, (l x0 x1)) === WTUP2(wWord8#,wWord8#, (r x0 x1))
    
    819
    +  testPrimopDivLike s l r = Property s $ safeDivArgs $ \ (uWord8#-> x0) (uWord8#-> x1) -> WTUP2(wWord8#,wWord8#, (l x0 x1)) === WTUP2(wWord8#,wWord8#, (r x0 x1))
    
    815 820
     
    
    816 821
     instance TestPrimop (Word8# -> Int8#) where
    
    817 822
       testPrimop s l r = Property s $ \ (uWord8#-> x0) -> wInt8# (l x0) === wInt8# (r x0)