
  Syntax error!
  syntax_tests/data/parsing/errors/other/spread.res:1:6-8

  1 │ let [...arr, _] = [1, 2, 3]
  2 │ 
  3 │ let record = {...x, ...y}

  Array spread (`...`) is not supported in pattern matches.

Explanation: Allowing `...` here would require creating a new subarray at match time, but for performance reasons pattern matching is guaranteed to never create intermediate data.

Possible solutions:
- To validate specific elements: Use `if` with length checks and `Array.get`
- To extract a subarray: Use `Array.slice`


  Syntax error!
  syntax_tests/data/parsing/errors/other/spread.res:3:21-23

  1 │ let [...arr, _] = [1, 2, 3]
  2 │ 
  3 │ let record = {...x, ...y}
  4 │ let {...x, ...y} = myRecord
  5 │ 

  Records can only have one `...` spread, at the beginning.
Explanation: since records have a known, fixed shape, a spread like `{a, ...b}` wouldn't make sense, as `b` would override every field of `a` anyway.


  Syntax error!
  syntax_tests/data/parsing/errors/other/spread.res:4:15-18

  2 │ 
  3 │ let record = {...x, ...y}
  4 │ let {...x, ...y} = myRecord
  5 │ 
  6 │ let list{...x, ...y} = myList

  Record spread (`...`) is not supported in pattern matches.
Explanation: you can't collect a subset of a record's field into its own record, since a record needs an explicit declaration and that subset wouldn't have one.
Solution: you need to pull out each field you want explicitly.


  Syntax error!
  syntax_tests/data/parsing/errors/other/spread.res:6:13-22

  4 │ let {...x, ...y} = myRecord
  5 │ 
  6 │ let list{...x, ...y} = myList
  7 │ 
  8 │ type t = {...a}

  List pattern matches only supports one `...` spread, at the end.
Explanation: a list spread at the tail is efficient, but a spread in the middle would create new lists; out of performance concern, our pattern matching currently guarantees to never create new intermediate data.

let [|arr;_|] = [|1;2;3|]
let record = { x with y }
let { x; y } = myRecord
let x::y = myList
type nonrec t = {
  ...: a }
type nonrec t =
  | Foo of {
  ...: a } 
type nonrec t = (foo, < x  > ) option