summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2018-04-10 15:26:19 +0100
committerBrian Campbell2018-04-10 15:26:40 +0100
commitfcd83f61370393508d4d9cb2924ddfa810d1dc00 (patch)
tree02bb79659057c4fbbcc0a144cc4bfeb805393464 /src
parentadfa96f9ad64f9e9a604a52a536010a2d43735a2 (diff)
Avoid rejecting reasonable pattern matches in monomorphisation
(when they're not relevant)
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index 27b4b247..7b98d1c2 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -1836,14 +1836,15 @@ let split_defs all_errors splits defs =
match p with
| P_app (id,args) ->
begin
- let kid,kid_annot =
- match args with
- | [P_aux (P_var (_, TP_aux (TP_var kid, _)),ann)] -> kid,ann
- | _ ->
- raise (Reporting_basic.err_general l
- "Pattern match not currently supported by monomorphisation")
- in match List.find (fun (id',_) -> Id.compare id id' = 0) refinements with
+ match List.find (fun (id',_) -> Id.compare id id' = 0) refinements with
| (_,variants) ->
+ let kid,kid_annot =
+ match args with
+ | [P_aux (P_var (_, TP_aux (TP_var kid, _)),ann)] -> kid,ann
+ | _ ->
+ raise (Reporting_basic.err_general l
+ "Pattern match not currently supported by monomorphisation")
+ in
let map_inst (insts,id',_) =
let insts =
match insts with [(v,Some i)] -> [(kid,Nexp_aux (Nexp_constant i, Generated l))]