summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2017-11-23 15:26:22 +0000
committerBrian Campbell2017-11-27 12:20:06 +0000
commit1dcd20abd7eae17b4d35cb2fd2626eae4606dc56 (patch)
treea094ba94d1eb24bce76a7dc68ec1fdea7df179cb /src
parent381071686f99aabdc8d618051b1b63d5aeb0108c (diff)
Case splitting on bools
(mostly to make test cases easier)
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index 79e276e1..f8c3530f 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -1154,6 +1154,10 @@ let split_defs splits defs =
("Cannot split type " ^ string_of_typ typ ^ " for variable " ^ v))
in
match ty with
+ | Typ_id (Id_aux (Id "bool",_)) ->
+ [P_aux (P_lit (L_aux (L_true,new_l)),(l,annot)),[var, E_aux (E_lit (L_aux (L_true,new_l)),(new_l,annot))];
+ P_aux (P_lit (L_aux (L_false,new_l)),(l,annot)),[var, E_aux (E_lit (L_aux (L_false,new_l)),(new_l,annot))]]
+
| Typ_id id ->
(try
(* enumerations *)
@@ -1168,6 +1172,7 @@ let split_defs splits defs =
[var,E_aux (E_lit (L_aux (b,new_l)),(new_l, annot))])
[L_zero; L_one]
| _ -> cannot ())
+
| Typ_app (Id_aux (Id "vector",_), [_;Typ_arg_aux (Typ_arg_nexp len,_);_;Typ_arg_aux (Typ_arg_typ (Typ_aux (Typ_id (Id_aux (Id "bit",_)),_)),_)]) ->
(match len with
| Nexp_aux (Nexp_constant sz,_) ->