summaryrefslogtreecommitdiff
path: root/typing/includecore.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 /typing/includecore.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 'typing/includecore.ml')
-rw-r--r--typing/includecore.ml16
1 files changed, 8 insertions, 8 deletions
diff --git a/typing/includecore.ml b/typing/includecore.ml
index dc6cd374aa..f56baab0d8 100644
--- a/typing/includecore.ml
+++ b/typing/includecore.ml
@@ -101,14 +101,14 @@ let value_descriptions ~loc env name
(* Inclusion between manifest types (particularly for private row types) *)
let is_absrow env ty =
- match ty.desc with
- | Tconstr(Pident _, _, _) -> begin
+ match get_desc ty with
+ | Tconstr(Pident _, _, _) ->
(* This function is checking for an abstract row on the side that is being
included into (usually numbered with "2" in this file). In this case,
the abstract row variable has been subsituted for an object or variant
type. *)
- match Ctype.expand_head env ty with
- | {desc=Tobject _|Tvariant _} -> true
+ begin match get_desc (Ctype.expand_head env ty) with
+ | Tobject _|Tvariant _ -> true
| _ -> false
end
| _ -> false
@@ -524,7 +524,7 @@ let privacy_mismatch env decl1 decl2 =
match decl1.type_manifest with
| Some ty1 -> begin
let ty1 = Ctype.expand_head env ty1 in
- match ty1.desc with
+ match get_desc ty1 with
| Tvariant row when Btype.is_constr_row ~allow_ident:true
(Btype.row_more row) ->
Some Private_row_type
@@ -634,7 +634,7 @@ let private_object env fields1 params1 fields2 params2 =
let type_manifest env ty1 params1 ty2 params2 priv2 kind2 =
let ty1' = Ctype.expand_head env ty1 and ty2' = Ctype.expand_head env ty2 in
- match ty1'.desc, ty2'.desc with
+ match get_desc ty1', get_desc ty2' with
| Tvariant row1, Tvariant row2
when is_absrow env (Btype.row_more row2) -> begin
let row1 = Btype.row_repr row1 and row2 = Btype.row_repr row2 in
@@ -657,7 +657,7 @@ let type_manifest env ty1 params1 ty2 params2 priv2 kind2 =
match priv2, kind2 with
| Private, Type_abstract -> begin
(* Same checks as the [when] guards from above, inverted *)
- match ty2'.desc with
+ match get_desc ty2' with
| Tvariant row ->
not (is_absrow env (Btype.row_more row))
| Tobject (fi, _) ->
@@ -770,7 +770,7 @@ let type_declarations ?(equality = false) ~loc env ~mark name
if not need_variance then None else
let abstr = abstr || decl2.type_private = Private in
let opn = decl2.type_kind = Type_open && decl2.type_manifest = None in
- let constrained ty = not (Btype.(is_Tvar (repr ty))) in
+ let constrained ty = not (Btype.is_Tvar ty) in
if List.for_all2
(fun ty (v1,v2) ->
let open Variance in