From c4723c747fec4557776858641b03e1eb4a0a5878 Mon Sep 17 00:00:00 2001 From: Alasdair Date: Mon, 23 Nov 2020 14:18:58 +0000 Subject: Don't allow type synonyms with the same name as existing types --- src/type_check.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/type_check.ml b/src/type_check.ml index aeb9cf01..1ada515e 100644 --- a/src/type_check.ml +++ b/src/type_check.ml @@ -647,8 +647,8 @@ end = struct else typ_error env (id_loc id) ("Could not prove " ^ string_of_list ", " string_of_n_constraint ncs ^ " for type constructor " ^ string_of_id id) let add_typ_synonym id typq arg env = - if Bindings.mem id env.typ_synonyms then - typ_error env (id_loc id) ("Type synonym " ^ string_of_id id ^ " already exists") + if bound_typ_id env id then + typ_error env (id_loc id) ("Cannot define type synonym " ^ string_of_id id ^ ", as a type or synonym with that name already exists") else begin typ_print (lazy (adding ^ "type synonym " ^ string_of_id id)); -- cgit v1.2.3