summaryrefslogtreecommitdiff
path: root/src/pretty_print_sail.ml
diff options
context:
space:
mode:
authorBrian Campbell2017-12-05 11:31:02 +0000
committerBrian Campbell2017-12-06 17:36:59 +0000
commitc497bef0d49ec32afae584c63a0cee0730cb90b1 (patch)
tree864a5c115090a4a810956303a843e5ce633d3493 /src/pretty_print_sail.ml
parent17c518d94e5b2f531de47ee94ca0ceca09051f25 (diff)
Add top-level pattern match guards internally
Also fix bug in mono analysis with generated variables Breaks lots of typechecking tests because it generates unnecessary equality tests on units (and the tests don't have generic equality), which I'll fix next.
Diffstat (limited to 'src/pretty_print_sail.ml')
-rw-r--r--src/pretty_print_sail.ml9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml
index 4ef506c5..05dbb9ee 100644
--- a/src/pretty_print_sail.ml
+++ b/src/pretty_print_sail.ml
@@ -485,8 +485,13 @@ let doc_effects_opt (Effect_opt_aux(e,_)) = match e with
| Effect_opt_pure -> string "pure"
| Effect_opt_effect e -> doc_effects e
-let doc_funcl (FCL_aux(FCL_Funcl(id,pat,exp),_)) =
- group (doc_op equals (separate space [doc_id id; doc_atomic_pat pat]) (doc_exp exp))
+let doc_funcl (FCL_aux(FCL_Funcl(id,pexp),_)) =
+ match pexp with
+ | Pat_aux (Pat_exp (pat,exp),_) ->
+ group (doc_op equals (separate space [doc_id id; doc_atomic_pat pat]) (doc_exp exp))
+ | Pat_aux (Pat_when (pat,wh,exp),_) ->
+ group (doc_op equals (separate space [doc_id id; doc_atomic_pat pat; string "if"; doc_exp wh])
+ (doc_exp exp))
let doc_fundef (FD_aux(FD_function(r, typa, efa, fcls),_)) =
match fcls with