summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair2020-11-23 14:18:58 +0000
committerAlasdair2021-01-05 11:11:04 +0000
commitc4723c747fec4557776858641b03e1eb4a0a5878 (patch)
tree14a5669c5d79a951783763427a219613405df75c /src
parent3c43a474e03ef94839ebef530f5a2bbd173add5b (diff)
Don't allow type synonyms with the same name as existing types
Diffstat (limited to 'src')
-rw-r--r--src/type_check.ml4
1 files changed, 2 insertions, 2 deletions
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));