bynk.parse.list_rest_not_last
Error A .. in a list pattern is not the final element; suffix forms such as [.., last] are not available.
In a list pattern the .. (or ..rest) stands for the elements the pattern does not name, and it must be the last element and appear once. A pattern that matches the end of a list, such as [.., last], is not available, so match from the front. When only _ patterns follow the .., the error offers a machine-applicable fix that moves it to the end.
Example
match xs { [.., a, b] => b // ✗ `..` must come last [_, b, ..] => b // ✓ match from the front _ => 0}In the Book
See also
- The grammar rule it governs:
list_pattern. - Every code in its category, Parser, on the diagnostic index.
bynk explain bynk.parse.list_rest_not_lastshows the same from the installed toolchain, without a network.