Commit f775915e authored by POTTIER Francois's avatar POTTIER Francois

Adjust to the changes in the types [object_field] and [row_field] in 4.08.

parent cc803fd3
......@@ -246,10 +246,9 @@ let rec occurs_type (alpha : tyvar) (ty : core_type) : unit =
| Ptyp_class (_, tys) ->
occurs_types alpha tys
| Ptyp_object (fields, _) ->
let tys : core_type list =
List.map VisitorsCompatibility.object_field_to_core_type fields
in
List.iter (occurs_type alpha) tys
fields
|> List.map VisitorsCompatibility.object_field_to_core_type
|> occurs_types alpha
| Ptyp_variant (fields, _, _) ->
List.iter (occurs_row_field alpha) fields
| Ptyp_poly (qs, ty) ->
......@@ -266,11 +265,9 @@ and occurs_types alpha tys =
List.iter (occurs_type alpha) tys
and occurs_row_field alpha field =
match field with
| Rtag (_, _, _, tys) ->
occurs_types alpha tys
| Rinherit ty ->
occurs_type alpha ty
field
|> VisitorsCompatibility.row_field_to_core_types
|> occurs_types alpha
and occurs_quantifiers alpha (qs : string list) =
List.mem alpha qs
......
......@@ -120,14 +120,34 @@ type object_field =
str * attributes * core_type
#endif
let object_field_to_core_type : object_field -> core_type =
let object_field_to_core_type (field : object_field) : core_type =
#if OCAML_VERSION < (4, 06, 0)
fun (_, _, ty) -> ty
#else
function
match field with
| (_, _, ty) -> ty
#elif OCAML_VERSION < (4, 08, 0)
match field with
| Otag (_, _, ty) -> ty
| Oinherit ty -> ty
(* this may seem nonsensical, but (so far) is used only in the
function [occurs_type], where we do not care what the types
mean *)
#else
match field.pof_desc with
| Otag (_, ty) -> ty
| Oinherit ty -> ty
#endif
let row_field_to_core_types (field : row_field) : core_type list =
#if OCAML_VERSION < (4, 08, 0)
match field with
| Rtag (_, _, _, tys) ->
tys
| Rinherit ty ->
[ ty ]
#else
match field.prf_desc with
| Rtag (_, _, tys) ->
tys
| Rinherit ty ->
[ ty ]
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment