running refmt on:
true ? (a, {...a, b: 1}) : a"
outputs
File "", line 1, characters 12-16:
Error: Record's `...` 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.
Errors too:
true ? ({...a, b: 1}) : a
Doesn't error:
true ? {...a, b: 1} : a
We're also running into this issue on bs-platform v4.0.5 in our codebase in many places.
This errors:
true ? (Update({...a, b: 1}), None) : (NoUpdate(a), None)
This doesn't error:
true ? {(Update({...a, b: 1}), None)} : (NoUpdate(a), None)
However refmt 3.3.3-macos-1 always removes the {} around the tuple so we're kind of stuck.
Can someone help us understand this issue? Is there some syntax change that we're missing or is this just a known regression that will be fixed soon? Anything that we can do to help? It's blocking us from upgrading past 4.0.1
I'm working on a fix atm.
Found the problem, submitted a PR with a solution.