Merge pull request #9567 from Octachron/flatten_fields_comment

#5428: import comment on flatten_fields
master
Florian Angeletti 2020-05-18 16:23:18 +02:00 committed by GitHub
commit 39954596fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 ->