aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/VeriFuzz/AST.hs')
-rw-r--r--src/VeriFuzz/AST.hs5
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