Adam Chalmers
6aa588f09f
Bug: KCL formatter removes 'fn' from closures: ( #4718 )
...
# Problem
Before this PR, our formatter reformats
```
squares_out = reduce(arr, 0, fn (i, squares) {
return 1
})
```
to
```
squares_out = reduce(arr, 0, (i, squares) {
return 1
})
```
i.e. it removes the `fn` keyword from the closure. This keyword is required, so, our formatter turned working code into invalid code.
# Cause
When this closure parameter is formatted, the ExprContext is ::Decl, so `Expr::recast` skips adding the `fn` keyword. The reason it's ::Decl is because the `squares_out = ` declaration sets it, and no subsequent call sets the context to something else.
# Solution
When recasting a call expression, set the context for every argument to `ExprContext::Other`.
2024-12-09 19:13:49 -06:00
..
2024-12-02 14:36:49 -06:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-13 09:04:35 -05:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-11-27 15:46:58 +13:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-27 15:46:58 +13:00
2024-11-24 20:21:55 +00:00
2024-12-06 13:16:04 -05:00
2024-10-02 22:05:12 -07:00
2024-11-25 18:07:03 +00:00
2024-11-27 15:46:58 +13:00
2024-09-12 16:13:11 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-09-27 10:37:46 -04:00
2024-09-27 10:37:46 -04:00
2024-09-27 10:37:46 -04:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-12-09 19:13:49 -06:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-12-03 19:47:21 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-27 15:46:58 +13:00
2024-11-27 15:46:58 +13:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-28 20:52:51 -04:00
2024-12-09 19:13:49 -06:00
2024-12-05 14:27:51 -06:00
2024-11-24 20:21:55 +00:00
2024-11-25 10:50:43 +13:00
2024-10-02 22:05:12 -07:00
2024-11-27 15:46:58 +13:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-11-27 15:46:58 +13:00
2024-11-05 14:10:35 -06:00
2024-11-05 14:10:35 -06:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-12-09 19:13:49 -06:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-25 18:07:03 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-12-03 18:17:02 +00:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00
2024-10-02 22:05:12 -07:00
2024-11-24 20:21:55 +00:00
2024-11-24 20:21:55 +00:00