import Jacques comment on flatten_fields from the issue tracker
parent
1a8a4dfd85
commit
9fe4b963cb
|
@ -132,8 +132,24 @@ val repr: type_expr -> type_expr
|
||||||
val object_fields: type_expr -> type_expr
|
val object_fields: type_expr -> type_expr
|
||||||
val flatten_fields:
|
val flatten_fields:
|
||||||
type_expr -> (string * field_kind * type_expr) list * type_expr
|
type_expr -> (string * field_kind * type_expr) list * type_expr
|
||||||
(* Transform a field type into a list of pairs label-type *)
|
(** Transform a field type into a list of pairs label-type.
|
||||||
(* The fields are sorted *)
|
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:
|
val associate_fields:
|
||||||
(string * field_kind * type_expr) list ->
|
(string * field_kind * type_expr) list ->
|
||||||
(string * field_kind * type_expr) list ->
|
(string * field_kind * type_expr) list ->
|
||||||
|
|
Loading…
Reference in New Issue