Related to #3320, I noticed we cannot write matches over a record without specifying one of its fields. The pattern {} does not even parse, and will not desugar even if it did. I think this comes from when we really needed to resolve the fields immediately to find the record type, but now that we have unresolved record constructors and projectors, we definitely can allow empty patterns.
The patch seems easy enough and we can now write something like this:
type t =
| A { x:int; y:int }
| B { z:bool }
let is_A (x:t) : bool =
match x with
| A {} -> true
| _ -> false
Related to #3320, I noticed we cannot write matches over a record without specifying one of its fields. The pattern
{}
does not even parse, and will not desugar even if it did. I think this comes from when we really needed to resolve the fields immediately to find the record type, but now that we have unresolved record constructors and projectors, we definitely can allow empty patterns.The patch seems easy enough and we can now write something like this: