diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-02 13:43:31 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-02 13:43:31 +0000 |
commit | ebbd9b95e764d2d5043ced74e8f0a998a0649846 (patch) | |
tree | 582238b4ac660305ac9f7fa4a5c14ba4face2cac /src/VeriFuzz/AST.hs | |
parent | c03e629452312105c3a2db638a478fe0acd63ac9 (diff) | |
download | verismith-ebbd9b95e764d2d5043ced74e8f0a998a0649846.tar.gz verismith-ebbd9b95e764d2d5043ced74e8f0a998a0649846.zip |
Add case for empty context
Diffstat (limited to 'src/VeriFuzz/AST.hs')
-rw-r--r-- | src/VeriFuzz/AST.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/VeriFuzz/AST.hs b/src/VeriFuzz/AST.hs index 2e3a54e..259da50 100644 --- a/src/VeriFuzz/AST.hs +++ b/src/VeriFuzz/AST.hs @@ -323,6 +323,11 @@ expr n where subexpr y = expr (n `div` y) exprWithContext :: [Identifier] -> Int -> QC.Gen Expr +exprWithContext [] n + | n == 0 = QC.oneof exprSafeList + | n > 0 = QC.oneof $ exprRecList subexpr + | otherwise = exprWithContext [] 0 + where subexpr y = exprWithContext [] (n `div` y) exprWithContext l n | n == 0 = QC.oneof $ (Id <$> QC.elements l) : exprSafeList | n > 0 = QC.oneof $ (Id <$> QC.elements l) : exprRecList subexpr |