summaryrefslogtreecommitdiff
path: root/src/jib
diff options
context:
space:
mode:
authorAlasdair2020-06-23 22:46:19 +0100
committerAlasdair2020-06-23 22:49:31 +0100
commitdf8429663a598d75853195d6552dda0e279e711f (patch)
tree092b00144088fbbdf1cd104e71ca55197fea31f4 /src/jib
parenta76ee971789a074c7b262d583e14a703a143a372 (diff)
Fix bug with duplicate enum identifiers in patterns
Diffstat (limited to 'src/jib')
-rw-r--r--src/jib/anf.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/jib/anf.ml b/src/jib/anf.ml
index ac25d359..7b91e4a5 100644
--- a/src/jib/anf.ml
+++ b/src/jib/anf.ml
@@ -127,7 +127,7 @@ let rec apat_bindings (AP_aux (apat_aux, _, _)) =
(** This function returns the types of all bound variables in a
pattern. It ignores AP_global, apat_globals is used for that. *)
-let rec apat_types (AP_aux (apat_aux, _, _)) =
+let rec apat_types (AP_aux (apat_aux, env, _)) =
let merge id b1 b2 =
match b1, b2 with
| None, None -> None
@@ -137,7 +137,8 @@ let rec apat_types (AP_aux (apat_aux, _, _)) =
in
match apat_aux with
| AP_tup apats -> List.fold_left (Bindings.merge merge) Bindings.empty (List.map apat_types apats)
- | AP_id (id, typ) -> Bindings.singleton id typ
+ | AP_id (id, typ) when not (is_enum_member id env) -> Bindings.singleton id typ
+ | AP_id _ -> Bindings.empty
| AP_global (id, _) -> Bindings.empty
| AP_app (id, apat, _) -> apat_types apat
| AP_cons (apat1, apat2) -> (Bindings.merge merge) (apat_types apat1) (apat_types apat2)