Make random value generation work on a slightly larger class of types.

Simplify types when calculating random generators to avoid spurrious
failures.
This commit is contained in:
Robert Dockins 2016-06-25 12:45:01 -07:00
parent 2cface6f31
commit e0dc226787

View File

@ -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]) ->