Skip to content
Playground(another site)

bynk.parse.record_pattern_without_rest

Error A record pattern does not end with ..; every record pattern is open.

Every record pattern ends with ... Record patterns are always open: they name the fields they care about and ignore the rest, so adding a field to the record later never breaks a pattern that was already written. The .. makes that openness visible at the pattern. The compiler offers the fix: it adds .. after the last field.

Example

match o {
Order { total } => total // ✗ no trailing `..`
}
match o {
Order { total, .. } => total // ✓ open: other fields ignored
}

In the Book

See also

  • The grammar rule it governs: record_pattern.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.record_pattern_without_rest shows the same from the installed toolchain, without a network.