Open n-osborne opened 4 months ago
I believe that this may come from the fact that internal representations for plain record and inlined record are different while typing pattern on records doesn't differentiate.
Plain records are represented with Tast.rec_declaration
which contains a lsymbol
for a generated contructor and a list of lsymbol label_declaration
s for the field, while inlined record are represented by a list of (Ident.t * ty) label_declaration
s.
I have to confess I don't really understand the need for the generated constructor (constr#type_name
) for the plain record. But if we remove it, we can harmonize the way records (plain and inlined) are represented and this should at least bring us closer to a fix to this issue.
One other thing that should be done when removing the generated constructor for plain records is to add a Prec
to Tterm.pattern_node
.
In the following example, Gospel type-checker only complains when the record syntax is used. We would have expected the other way around.
We also have an error when we deconstruct the record in the pattern:
This is not the case when we use a named record type:
I believe we can either fix this or decide that we don't really want inlined records (even if it means adding them back later if we happen to miss them). The rational for removing them is that they are not a key feature of a specification language and we talk about simplifying Gospel type-checker berfore adding new logical features.
What do you think?