summaryrefslogtreecommitdiff
path: root/src/spec_analysis.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-07-27 18:50:31 +0100
committerAlasdair Armstrong2018-07-27 18:50:31 +0100
commite4af7c3090c93a129e99dd75f2a20d5a9d2f6920 (patch)
tree124e9a76fbc36e36f4499e7bdb0fb1f2b25691e9 /src/spec_analysis.ml
parent4c84c70eafbbf9bea475e3264f21eedc3555021f (diff)
Make type annotations abstract in type_check.mli
Rather than exporting the implementation of type annotations as type tannot = (Env.t * typ * effect) option we leave it abstract as type tannot Some additional functions have been added to type_check.mli to work with these abstract type annotations. Most use cases where the type was constructed explicitly can be handled by using either mk_tannot or empty_tannot. For pattern matching on a tannot there is a function val destruct_tannot : tannot -> (Env.t * typ * effect) option Note that it is specifically not guaranteed that using mk_tannot on the elements returned by destruct_tannot re-constructs the same tannot, as destruct_tannot is only used to give the old view of a type annotation, and we may add additional information that will not be returned by destruct_tannot.
Diffstat (limited to 'src/spec_analysis.ml')
-rw-r--r--src/spec_analysis.ml3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/spec_analysis.ml b/src/spec_analysis.ml
index 9481d6b1..b459610d 100644
--- a/src/spec_analysis.ml
+++ b/src/spec_analysis.ml
@@ -105,7 +105,8 @@ and free_type_names_t_args consider_var targs =
nameset_bigunion (List.map (free_type_names_t_arg consider_var) targs)
-let rec free_type_names_tannot consider_var = function
+let rec free_type_names_tannot consider_var tannot =
+ match Type_check.destruct_tannot tannot with
| None -> mt
| Some (_, t, _) -> free_type_names_t consider_var t