summaryrefslogtreecommitdiff
path: root/typing/datarepr.ml
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-12-16 01:37:44 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-12-16 01:37:44 +0000
commitfd2e5d7a52dbcd95b0f5b2a671884c63d686d10d (patch)
treed220a3c7e19d63f6e3fba491d50cbefb34baec14 /typing/datarepr.ml
parentd96b151e0c826d1ebb6c0468ee6358fd77bf27ec (diff)
downloadocaml-fd2e5d7a52dbcd95b0f5b2a671884c63d686d10d.tar.gz
Fix PR#6716: Assertion failure with existentials + inline records + rows
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15675 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing/datarepr.ml')
-rw-r--r--typing/datarepr.ml11
1 files changed, 8 insertions, 3 deletions
diff --git a/typing/datarepr.ml b/typing/datarepr.ml
index 1c121d35a9..4bbd8f959b 100644
--- a/typing/datarepr.ml
+++ b/typing/datarepr.ml
@@ -18,7 +18,7 @@ open Types
open Btype
(* Simplified version of Ctype.free_vars *)
-let free_vars ty =
+let free_vars ?(param=false) ty =
let ret = ref TypeSet.empty in
let rec loop ty =
let ty = repr ty in
@@ -30,7 +30,11 @@ let free_vars ty =
| Tvariant row ->
let row = row_repr row in
iter_row loop row;
- if not (static_row row) then loop row.row_more
+ if not (static_row row) then begin
+ match row.row_more.desc with
+ | Tvar _ when param -> ret := TypeSet.add ty !ret
+ | _ -> loop row.row_more
+ end
| _ ->
iter_type_expr loop ty
end
@@ -47,17 +51,18 @@ let constructor_args cd_args cd_res path rep =
| Cstr_tuple l -> l
| Cstr_record l -> List.map (fun l -> l.ld_type) l
in
- let arg_vars_set = free_vars (newgenty (Ttuple tyl)) in
let existentials =
match cd_res with
| None -> []
| Some type_ret ->
+ let arg_vars_set = free_vars (newgenty (Ttuple tyl)) in
let res_vars = free_vars type_ret in
TypeSet.elements (TypeSet.diff arg_vars_set res_vars)
in
match cd_args with
| Cstr_tuple l -> existentials, l, None
| Cstr_record lbls ->
+ let arg_vars_set = free_vars ~param:true (newgenty (Ttuple tyl)) in
let type_params = TypeSet.elements arg_vars_set in
let tdecl =
{