import Jacques comment on flatten_fields from the issue tracker

master
octachron 2020-05-15 11:46:39 +02:00
parent 1a8a4dfd85
commit 9fe4b963cb
1 changed files with 18 additions and 2 deletions

View File

@ -132,8 +132,24 @@ val repr: type_expr -> type_expr
val object_fields: type_expr -> type_expr
val flatten_fields:
type_expr -> (string * field_kind * type_expr) list * type_expr
(* Transform a field type into a list of pairs label-type *)
(* The fields are sorted *)
(** Transform a field type into a list of pairs label-type.
The fields are sorted.
Beware of the interaction with GADTs:
Due to the introduction of object indexes for GADTs, the row variable of
an object may now be an expansible type abbreviation.
A first consequence is that [flatten_fields] will not completely flatten
the object, since the type abbreviation will not be expanded
([flatten_fields] does not receive the current environment).
Another consequence is that various functions may be called with the
expansion of this type abbreviation, which is a Tfield, e.g. during
printing.
Concrete problems have been fixed, but new bugs may appear in the
future. (Test cases were added to typing-gadts/test.ml)
*)
val associate_fields:
(string * field_kind * type_expr) list ->
(string * field_kind * type_expr) list ->