From 1dcd20abd7eae17b4d35cb2fd2626eae4606dc56 Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Thu, 23 Nov 2017 15:26:22 +0000 Subject: Case splitting on bools (mostly to make test cases easier) --- src/monomorphise.ml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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,_) -> -- cgit v1.2.3