@@ -49,7 +49,7 @@ import GHC.Stack
49
49
import Data.Array (Array , Ix , listArray , elems , bounds , rangeSize )
50
50
import Data.Bits (Bits (.. ))
51
51
import Data.Int (Int8 , Int16 , Int32 , Int64 )
52
- import Data.List (genericLength , genericIndex , genericTake , unzip4 , unzip5 , unzip6 , unzip7 )
52
+ import Data.List (genericLength , genericIndex , genericTake , unzip4 , unzip5 , unzip6 , unzip7 , intercalate )
53
53
import Data.Maybe (fromMaybe )
54
54
import Data.Word (Word8 , Word16 , Word32 , Word64 )
55
55
@@ -630,7 +630,7 @@ pbToInteger :: String -> Int -> SBool -> Integer
630
630
pbToInteger w c b
631
631
| c < 0 = error $ " SBV." ++ w ++ " : Non-negative coefficient required, received: " ++ show c
632
632
| Just v <- unliteral b = if v then fromIntegral c else 0
633
- | True = error $ " SBV.pbToInteger: Received a symbolic boolean at coefficient " ++ show c
633
+ | True = error $ " SBV.pbToInteger: Received a symbolic boolean: " ++ show (c, b)
634
634
635
635
-- | Predicate for optimizing word operations like (+) and (*).
636
636
isConcreteZero :: SBV a -> Bool
@@ -761,13 +761,13 @@ instance (Num a, Bits a, SymWord a) => Bits (SBV a) where
761
761
| SBV (SVal _ (Left (CW _ (CWInteger n)))) <- x
762
762
= testBit n i
763
763
| True
764
- = error " SBV.testBit: Called on symbolic value! Use sTestBit instead."
764
+ = error $ " SBV.testBit: Called on symbolic value: " ++ show x ++ " . Use sTestBit instead."
765
765
-- NB. popCount is *not* implementable on non-concrete symbolic words
766
766
popCount x
767
767
| SBV (SVal _ (Left (CW (KBounded _ w) (CWInteger n)))) <- x
768
768
= popCount (n .&. (bit w - 1 ))
769
769
| True
770
- = error " SBV.popCount: Called on symbolic value! Use sPopCount instead."
770
+ = error $ " SBV.popCount: Called on symbolic value: " ++ show x ++ " . Use sPopCount instead."
771
771
772
772
-- | Replacement for 'testBit'. Since 'testBit' requires a 'Bool' to be returned,
773
773
-- we cannot implement it for symbolic words. Index 0 is the least-significant bit.
@@ -1000,7 +1000,7 @@ instance (Show a, Bounded a, Integral a, Num a, SymWord a) => Enum (SBV a) where
1000
1000
-- | Helper function for use in enum operations
1001
1001
enumCvt :: (SymWord a , Integral a , Num b ) => String -> SBV a -> b
1002
1002
enumCvt w x = case unliteral x of
1003
- Nothing -> error $ " Enum." ++ w ++ " {" ++ showType x ++ " }: Called on symbolic value! "
1003
+ Nothing -> error $ " Enum." ++ w ++ " {" ++ showType x ++ " }: Called on symbolic value " ++ show x
1004
1004
Just v -> fromIntegral v
1005
1005
1006
1006
-- | The 'SDivisible' class captures the essence of division.
@@ -1757,7 +1757,7 @@ instance Metric SReal where minimize nm o = addSValOptGoal (unSBV `fmap` Mini
1757
1757
-- Quickcheck interface on symbolic-booleans..
1758
1758
instance Testable SBool where
1759
1759
property (SBV (SVal _ (Left b))) = property (cwToBool b)
1760
- property _ = error " Cannot quick-check in the presence of uninterpreted constants!"
1760
+ property s = error $ " Cannot quick-check in the presence of uninterpreted constants! ( " ++ show s ++ " ) "
1761
1761
1762
1762
instance Testable (Symbolic SBool ) where
1763
1763
property prop = QC. monadicIO $ do (cond, r, tvals) <- QC. run test
@@ -1771,13 +1771,13 @@ instance Testable (Symbolic SBool) where
1771
1771
1772
1772
case map fst unints of
1773
1773
[] -> case unliteral r of
1774
- Nothing -> noQC
1774
+ Nothing -> noQC [ show r]
1775
1775
Just b -> return (cond, b, tvals)
1776
- _ -> noQC
1776
+ us -> noQC us
1777
1777
1778
1778
complain qcInfo = showModel defaultSMTCfg (SMTModel [] qcInfo)
1779
1779
1780
- noQC = error " Cannot quick-check in the presence of uninterpreted constants! "
1780
+ noQC us = error $ " Cannot quick-check in the presence of uninterpreted constants: " ++ intercalate " , " us
1781
1781
1782
1782
-- | Quick check an SBV property. Note that a regular 'quickCheck' call will work just as
1783
1783
-- well. Use this variant if you want to receive the boolean result.
0 commit comments