From e0dc22678709da65907f90874f50a175499fa04e Mon Sep 17 00:00:00 2001 From: Robert Dockins Date: Sat, 25 Jun 2016 12:45:01 -0700 Subject: [PATCH] Make random value generation work on a slightly larger class of types. Simplify types when calculating random generators to avoid spurrious failures. --- src/Cryptol/Testing/Random.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Cryptol/Testing/Random.hs b/src/Cryptol/Testing/Random.hs index d50f60b2..c8b4790b 100644 --- a/src/Cryptol/Testing/Random.hs +++ b/src/Cryptol/Testing/Random.hs @@ -14,6 +14,8 @@ module Cryptol.Testing.Random where import Cryptol.Eval.Value (BV(..),Value,GenValue(..)) import qualified Cryptol.Testing.Concrete as Conc import Cryptol.TypeCheck.AST (Type(..),TCon(..),TC(..),tNoUser) +import Cryptol.TypeCheck.Solve(simpType) + import Cryptol.Utils.Ident (Ident) import Control.Monad (forM) @@ -62,7 +64,7 @@ randomValue :: RandomGen g => Type -> Maybe (Gen g) randomValue ty = case ty of TCon tc ts -> - case (tc, map tNoUser ts) of + case (tc, map (simpType . tNoUser) ts) of (TC TCBit, []) -> Just randomBit (TC TCSeq, [TCon (TC TCInf) [], el]) ->