summaryrefslogtreecommitdiff
path: root/src/initial_check.ml
diff options
context:
space:
mode:
authorKathy Gray2016-07-24 15:22:47 +0100
committerKathy Gray2016-07-24 15:22:47 +0100
commitc2694d69cc4b8fe2a956bf60fd9b9061ac775bc0 (patch)
tree14271613c7bfddad916d575f81aed8373faf07e2 /src/initial_check.ml
parentcc61f795555c6e80f2d82f9b6655a5a3115d50f2 (diff)
Make sure that all type constructors with unit type have a type union with just an id (hopefully fixes Christopher issue).
Diffstat (limited to 'src/initial_check.ml')
-rw-r--r--src/initial_check.ml9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/initial_check.ml b/src/initial_check.ml
index a69be9bf..beaac9c2 100644
--- a/src/initial_check.ml
+++ b/src/initial_check.ml
@@ -583,8 +583,13 @@ let rec to_ast_range (Parse_ast.BF_aux(r,l)) = (* TODO add check that ranges are
let to_ast_type_union k_env default_order (Parse_ast.Tu_aux(tu,l)) =
match tu with
- | Parse_ast.Tu_ty_id(atyp,id) -> (Tu_aux(Tu_ty_id ((to_ast_typ k_env default_order atyp),(to_ast_id id)),l))
- | Parse_ast.Tu_id id -> (Tu_aux(Tu_id(to_ast_id id),l))
+ | Parse_ast.Tu_ty_id(atyp,id) ->
+ let typ = to_ast_typ k_env default_order atyp in
+ (match typ with
+ | Typ_aux(Typ_id (Id_aux (Id "unit",_)),_) ->
+ Tu_aux(Tu_id(to_ast_id id),l)
+ | _ -> Tu_aux(Tu_ty_id(typ, to_ast_id id), l))
+ | Parse_ast.Tu_id id -> (Tu_aux(Tu_id(to_ast_id id),l))
let to_ast_typedef (names,k_env,def_ord) (td:Parse_ast.type_def) : (tannot type_def) envs_out =
match td with