diff options
| author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-11-22 13:22:55 +0000 |
|---|---|---|
| committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-11-22 13:22:55 +0000 |
| commit | e3206bb26c66255964cb5cf5c0a447f905d6f06e (patch) | |
| tree | d8cff81c14025ee8d1d19bdb6b1d1b5b7d24da87 | |
| parent | e551820eeffe314c918f22bfda095ccb5234f3d0 (diff) | |
| download | ocaml-e3206bb26c66255964cb5cf5c0a447f905d6f06e.tar.gz | |
plus correct
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4033 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | typing/ctype.ml | 18 | ||||
| -rw-r--r-- | typing/subst.ml | 11 |
2 files changed, 16 insertions, 13 deletions
diff --git a/typing/ctype.ml b/typing/ctype.ml index 71daf2d24c..801855d61a 100644 --- a/typing/ctype.ml +++ b/typing/ctype.ml @@ -2475,6 +2475,7 @@ let rec nondep_type_rec env id ty = match ty.desc with Tvar -> ty | Tsubst ty -> ty +(*| Tvariant row when not (static_row row) -> ty *) | _ -> let desc = ty.desc in save_desc ty desc; @@ -2519,18 +2520,11 @@ let rec nondep_type_rec env id ty = save_desc more more.desc; more.desc <- ty.desc; (* Return a new copy *) - Tvariant (copy_row (nondep_type_rec env id) row (newgenvar())) - end - | Tfield(label, kind, t1, t2) -> - begin match field_kind_repr kind with - Fpresent -> - Tfield(label, Fpresent, nondep_type_rec env id t1, - nondep_type_rec env id t2) - | Fvar _ (* {contents = None} *) as k -> - Tfield(label, k, nondep_type_rec env id t1, - nondep_type_rec env id t2) - | Fabsent -> - assert false + let row = copy_row (nondep_type_rec env id) row (newgenvar()) in + match row.row_name with + Some (p, tl) when Path.isfree id p -> + Tvariant {row with row_name = None} + | _ -> Tvariant row end | _ -> copy_type_desc (nondep_type_rec env id) desc end; diff --git a/typing/subst.ml b/typing/subst.ml index 63a9461906..1dc6a9f2e3 100644 --- a/typing/subst.ml +++ b/typing/subst.ml @@ -66,6 +66,10 @@ let rec typexp s ty = ty | Tsubst ty -> ty +(* cannot do it, since it would omit subsitution + | Tvariant row when not (static_row row) -> + ty +*) | _ -> let desc = ty.desc in save_desc ty desc; @@ -95,7 +99,12 @@ let rec typexp s ty = save_desc more more.desc; more.desc <- ty.desc; (* Return a new copy *) - Tvariant (copy_row (typexp s) row (newgenvar())) + let row = copy_row (typexp s) row (newgenvar()) in + match row.row_name with + Some (p, tl) -> + Tvariant {row with row_name = Some (type_path s p, tl)} + | None -> + Tvariant row end | Tfield(label, kind, t1, t2) -> begin match field_kind_repr kind with |
