packages feed

inspection-testing 0.4.3.0 → 0.4.4.0

raw patch · 5 files changed

+42/−4 lines, 5 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for inspection-testing +## 0.4.4.0 -- 2020-04-21++* More GHC-9.0 compatibility (thanks @aadaa-fgtaa)+ ## 0.4.3.0 -- 2020-01-26  * Ignores HPC ticks in `(==-)` (thanks @konn)
examples/Fusion.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell, CPP #-}+{-# OPTIONS_GHC -dsuppress-all -funfolding-use-threshold=120 #-} module Fusion (main) where  import Test.Inspection@@ -11,8 +12,6 @@ inspect $ ('sumUp1 `hasNoType` ''Int) { expectFail = True } inspect $ mkObligation 'sumUp1 NoAllocation -#if !MIN_VERSION_GLASGOW_HASKELL(9,0,0,0)- -- This stopped working in GHC-9.0, because -- * the > 1000 comparison is floated into the recursive join point (ok) -- * `sumUp2` is compiled with a worker-wrapper split that does not happen for@@ -27,7 +26,6 @@                | otherwise = go (m+1) (s+m)  inspect $ 'sumUp1 === 'sumUp2-#endif  -- Example for a non-fusing funtion sumUpSort :: Int -> Int
+ examples/UnsafeCoerce.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE TemplateHaskell #-}+module UnsafeCoerce (main) where++import Test.Inspection+import Unsafe.Coerce+import GHC.Exts++lhs :: Any -> Any+lhs a = unsafeCoerce $ unsafeCoerce a + (1 :: Int)++rhs :: Int -> Int+rhs = (+ 1)++inspect $ 'lhs =/= 'rhs+inspect $ 'lhs ==- 'rhs++main :: IO ()+main = return ()
inspection-testing.cabal view
@@ -1,5 +1,5 @@ name:                inspection-testing-version:             0.4.3.0+version:             0.4.4.0 synopsis:            GHC plugin to do inspection testing description:         Some carefully crafted libraries make promises to their                      users beyond functionality and performance.@@ -168,6 +168,17 @@   build-depends:       base   default-language:    Haskell2010   ghc-options:         -main-is WorkerWrapper+  if impl(ghc < 8.4)+      ghc-options:       -fplugin=Test.Inspection.Plugin++test-suite unsafe-coerce+  type:                exitcode-stdio-1.0+  hs-source-dirs:      examples+  main-is:             UnsafeCoerce.hs+  build-depends:       inspection-testing+  build-depends:       base+  default-language:    Haskell2010+  ghc-options:         -main-is UnsafeCoerce   if impl(ghc < 8.4)       ghc-options:       -fplugin=Test.Inspection.Plugin 
src/Test/Inspection/Core.hs view
@@ -155,6 +155,9 @@     essentiallyVar (App e a)  | it, isTyCoArg a = essentiallyVar e     essentiallyVar (Lam v e)  | it, isTyCoVar v = essentiallyVar e     essentiallyVar (Cast e _) | it              = essentiallyVar e+#if MIN_VERSION_ghc(9,0,0)+    essentiallyVar (Case s _ _ [(_, _, e)]) | it, isUnsafeEqualityProof s = essentiallyVar e+#endif     essentiallyVar (Var v)                      = Just v     essentiallyVar (Tick HpcTick{} e) | it      = essentiallyVar e     essentiallyVar _                            = Nothing@@ -168,6 +171,10 @@      go env (Cast e1 _) e2 | it             = go env e1 e2     go env e1 (Cast e2 _) | it             = go env e1 e2+#if MIN_VERSION_ghc(9,0,0)+    go env (Case s _ _ [(_, _, e1)]) e2 | it, isUnsafeEqualityProof s = go env e1 e2+    go env e1 (Case s _ _ [(_, _, e2)]) | it, isUnsafeEqualityProof s = go env e1 e2+#endif     go env (Cast e1 co1) (Cast e2 co2)     = do guard (eqCoercionX env co1 co2)                                                 go env e1 e2