packages feed

copilot-core 4.8.1 → 4.8.2

raw patch · 6 files changed

+38/−13 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG view
@@ -1,3 +1,12 @@+2026-11-07+        * Version bump (4.8.2). (#792)+        * Increase test coverage for `Copilot.Core.Type.Array`. (#767)+        * Fix errors in the documentation of `Copilot.Core.Spec`. (#769)+        * Replace tab in CHANGELOG. (#772)+        * Fix comments for two tests in `Test.Copilot.Core.Type`. (#781)+        * Fix typo in Haddock comment of test property. (#783)+        * Fix test to use `typeSize` instead of `typeLength` (#784).+ 2026-09-07         * Version bump (4.8.1). (#760) 
copilot-core.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                copilot-core-version:             4.8.1+version:             4.8.2 synopsis:            An intermediate representation for Copilot. description:   Intermediate representation for Copilot.
src/Copilot/Core/Spec.hs view
@@ -11,9 +11,9 @@ -- and their handling functions, or streams to observe, or a theorem that must -- be proved. ----- In order to be executed, high-level Copilot Language Spec must be turned--- into Copilot Core's 'Spec'. This module defines the low-level Copilot Core--- representations for Specs and the main types of element in a spec.+-- In order to be executed, a high-level Copilot Language @Spec@ must be+-- turned into a Copilot Core 'Spec'. This module defines the low-level Copilot+-- Core representation for 'Spec' and the main types of element in a spec. module Copilot.Core.Spec     ( Stream (..)     , Observer (..)@@ -32,9 +32,9 @@ import Copilot.Core.Expr (Expr, Id, Name, UExpr) import Copilot.Core.Type (Type, Typed) --- | A stream in an infinite succession of values of the same type.+-- | A stream is an infinite succession of values of the same type. ----- Stream can carry different types of data. Boolean streams play a special+-- Streams can carry different types of data. Boolean streams play a special -- role: they are used by other parts (e.g., 'Trigger') to detect when the -- properties being monitored are violated. data Stream = forall a . (Typeable a, Typed a) => Stream
src/Copilot/Core/Type/Array.hs view
@@ -37,7 +37,7 @@          | otherwise          = error errmsg   where     datalen = length xs-    typelen = fromIntegral $ natVal (Proxy :: Proxy n)+    typelen = fromIntegral $ natVal $! (Proxy :: Proxy n)     errmsg = "Length of data (" ++ show datalen ++              ") does not match length of type (" ++ show typelen ++ ")." 
tests/Test/Copilot/Core/Type.hs view
@@ -165,7 +165,7 @@     a :: Type (Array 3 Int8)     a = Array Int8 --- | Test that the length of an multi-dimensional array is as expected.+-- | Test that the length of a multi-dimensional array is as expected. testTypeLength2 :: Property testTypeLength2 = property $ typeLength a == 3   where@@ -174,7 +174,7 @@  -- | Test that the size of an array is as expected. testTypeSize1 :: Property-testTypeSize1 = property $ typeLength a == 3+testTypeSize1 = property $ typeSize a == 3   where     a :: Type (Array 3 Int8)     a = Array Int8@@ -350,7 +350,7 @@                  forAll arbitrary $ \k2 ->   show (S (Field k1) (Field k2)) == "<field1:" ++ show k1 ++ ",field2:" ++ show k2 ++ ">" --- | Test showing a struct.+-- | Test updating a struct. testUpdateStruct :: Property testUpdateStruct =    forAll arbitrary $ \k1 ->@@ -364,7 +364,7 @@  where    unField (Field x) = x --- | Test showing a struct.+-- | Test updating a struct (should fail). testUpdateStructFail :: Property testUpdateStructFail = expectFailure $    forAll arbitrary $ \k1 ->
tests/Test/Copilot/Core/Type/Array.hs view
@@ -11,8 +11,9 @@ import Test.Framework.Providers.QuickCheck2 (testProperty) import Test.QuickCheck                      (Gen, Property, arbitrary,                                              chooseInt, expectFailure, forAll,-                                             getNegative, getNonNegative, oneof,-                                             property, vector, vectorOf)+                                             getNegative, getNonNegative,+                                             listOf, oneof, property, vector,+                                             vectorOf)  -- Internal imports: library modules being tested import Copilot.Core.Type.Array (Array, array, arrayElems, arrayUpdate)@@ -31,6 +32,10 @@         testArrayElemsFail     , testProperty "Show for arrays"         testShowArray+    , testProperty "showsPrec for arrays"+        testShowsPrecArray+    , testProperty "showList for arrays"+        testShowListArray     , testProperty "arrayElems (arrayUpdate x i v) !! i == v"         (testArrayUpdateElem (Proxy :: Proxy 5))     , testProperty "arrayUpdate x i ((arrayElems x) !! i) == x"@@ -69,6 +74,17 @@ testShowArray :: Property testShowArray = forAll (vector 3) $ \l -> property $   show (array l :: Array 3 Int64) == show (l :: [Int64])++-- | Test 'Show.showsPrec' for 'Array's.+testShowsPrecArray :: Property+testShowsPrecArray = forAll (getNonNegative <$> arbitrary) $ \prec ->+                     forAll (vector 3)                     $ \l -> property $+  showsPrec prec (array l :: Array 3 Int64) "" == show (l :: [Int64])++-- | Test 'Show.showList' for 'Array's.+testShowListArray :: Property+testShowListArray = forAll (listOf $ vector 3) $ \l -> property $+  showList (map array l :: [Array 3 Int64]) "" == show (l :: [[Int64]])  -- | Test that updating an array updates the element appropriately (if we -- project that element we get the value we put in).