File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -70,13 +70,14 @@ module ErrorMessages = struct
7070 [@@ live]
7171
7272 let array_pattern_spread =
73- " Array spread (`...`) is not supported in pattern matches.\n \
74- Explanation: such spread would create a subarray; out of performance \
75- concern, our pattern matching currently guarantees to never create new \
76- intermediate data.\n \
77- Solution: if it's to validate the first few elements, use an `if` clause \
78- + Array length check + `get` checks on the current pattern. If it's to \
79- obtain a subarray, use `Array.slice`."
73+ " Array spread (`...`) is not supported in pattern matches.\n\n \
74+ Explanation: Allowing `...` here would require creating a new subarray at \
75+ match time, but for performance reasons pattern matching is guaranteed to \
76+ never create intermediate data.\n\n \
77+ Possible solutions:\n \
78+ - To validate specific elements: Use `if` with length checks and \
79+ `Array.get`\n \
80+ - To extract a subarray: Use `Array.slice`"
8081
8182 let record_expr_spread =
8283 " Records can only have one `...` spread, at the beginning.\n \
You can’t perform that action at this time.
0 commit comments