summaryrefslogtreecommitdiff
path: root/toplevel/topdirs.ml
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue@math.nagoya-u.ac.jp>2021-06-24 12:54:16 +0900
committerGitHub <noreply@github.com>2021-06-24 12:54:16 +0900
commit47e5a7acb6abddaaf0653dcf357df70fa4984755 (patch)
treee0814a594aec2e070a5fcc5d67e6fe7376a45f64 /toplevel/topdirs.ml
parentf68acd1a618ac54790a8347fad466084f15a9a9e (diff)
downloadocaml-47e5a7acb6abddaaf0653dcf357df70fa4984755.tar.gz
Normalize type_expr nodes on access (#10337)
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
Diffstat (limited to 'toplevel/topdirs.ml')
-rw-r--r--toplevel/topdirs.ml11
1 files changed, 6 insertions, 5 deletions
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml
index 98cf36e899..aa692af580 100644
--- a/toplevel/topdirs.ml
+++ b/toplevel/topdirs.ml
@@ -175,7 +175,7 @@ exception Bad_printing_function
let filter_arrow ty =
let ty = Ctype.expand_head !toplevel_env ty in
- match ty.desc with
+ match get_desc ty with
| Tarrow (lbl, l, r, _) when not (Btype.is_optional lbl) -> Some (l, r)
| _ -> None
@@ -189,9 +189,10 @@ let rec extract_last_arrow desc =
let extract_target_type ty = fst (extract_last_arrow ty)
let extract_target_parameters ty =
let ty = extract_target_type ty |> Ctype.expand_head !toplevel_env in
- match ty.desc with
+ match get_desc ty with
| Tconstr (path, (_ :: _ as args), _)
- when Ctype.all_distinct_vars !toplevel_env args -> Some (path, args)
+ when Ctype.all_distinct_vars !toplevel_env args ->
+ Some (path, args)
| _ -> None
type 'a printer_type_new = Format.formatter -> 'a -> unit
@@ -454,8 +455,8 @@ let () =
if is_exception_constructor env desc.cstr_res then
raise Not_found;
let path =
- match Ctype.repr desc.cstr_res with
- | {desc=Tconstr(path, _, _)} -> path
+ match get_desc desc.cstr_res with
+ | Tconstr(path, _, _) -> path
| _ -> raise Not_found
in
let type_decl = Env.find_type path env in